1
0
mirror of https://github.com/veden/Rampant.git synced 2025-03-17 20:58:35 +02:00

added max move and auto settling

This commit is contained in:
Aaron Veden 2021-12-05 20:27:03 -08:00
parent 926ef9e383
commit 893bd393ff
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
3 changed files with 29 additions and 1 deletions

View File

@ -16,6 +16,7 @@ Date: 23. 11. 2021
- Factorissimo, Space Exploration Orbits, asteroid belts, secret maps, starmap, AAI-signal, NiceFill, Blueprint lab surfaces are no longer processed
- Map processing around player now changes to the surface the player is standing on
- Squads now get processed regardless of the current active surface being processed
- Added max number of move commands that touch the same chunk to squads before disbanding or settling based on if migration is enabled
Tweaks:
- Increase chance to upgrade an enemy structure from 5% to 30%
- New enemy regional bases that have two factions now do 75% on one faction and 25% on the faction for building and upgrading enemy structures

View File

@ -13,8 +13,12 @@ local mathUtils = require("MathUtils")
local MAGIC_MAXIMUM_NUMBER = constants.MAGIC_MAXIMUM_NUMBER
local SQUAD_SETTLING = constants.SQUAD_SETTLING
-- imported functions
local gaussianRandomRangeRG = mathUtils.gaussianRandomRangeRG
local canMoveChunkDirection = mapUtils.canMoveChunkDirection
local getNeighborChunks = mapUtils.getNeighborChunks
@ -53,8 +57,25 @@ function movementUtils.addMovementPenalty(squad, chunk)
local penalty = penalties[i]
if (penalty.c.id == chunk.id) then
penalty.v = penalty.v + 1
if (penalty.v > 2) then
if (penalty.v > 2) and (penalty.v < 15) then
squad.kamikaze = true
elseif penalty.v >= 15 then
local universe = squad.map.universe
if universe.enabledMigration and
(universe.builderCount < universe.AI_MAX_BUILDER_COUNT) then
squad.settler = true
squad.originPosition.x = squad.group.position.x
squad.originPosition.y = squad.group.position.y
squad.maxDistance = gaussianRandomRangeRG(universe.expansionMaxDistance * 0.5,
universe.expansionMaxDistanceDerivation,
10,
universe.expansionMaxDistance,
universe.random)
squad.status = SQUAD_SETTLING
else
squad.group.destroy()
end
end
return
end

View File

@ -125,6 +125,9 @@ local function settleMove(map, squad)
if chunk ~= -1 then
addSquadToChunk(map, chunk, squad)
addMovementPenalty(squad, chunk)
if not squad.group.valid then
return
end
end
local distance = euclideanDistancePoints(groupPosition.x,
groupPosition.y,
@ -256,6 +259,9 @@ local function attackMove(map, squad)
if chunk ~= -1 then
addSquadToChunk(map, chunk, squad)
addMovementPenalty(squad, chunk)
if not squad.group.valid then
return
end
end
squad.frenzy = (squad.frenzy and (euclideanDistanceNamed(groupPosition, squad.frenzyPosition) < 100))
local attackChunk, attackDirection,