mirror of
https://github.com/veden/Rampant.git
synced 2025-03-17 20:58:35 +02:00
FACTO-305: Code cleanup
This commit is contained in:
parent
4d3eaf118b
commit
380137c916
@ -535,7 +535,7 @@ local function onDeath(event)
|
||||
if cause and cause.type == "unit" then
|
||||
local group = cause.unit_group
|
||||
if group and group.valid then
|
||||
local squad = Universe.groupNumberToSquad[group.group_number]
|
||||
squad = Universe.groupNumberToSquad[group.group_number]
|
||||
if squad then
|
||||
base = squad.base
|
||||
end
|
||||
|
@ -1624,6 +1624,10 @@ function constants.gpsDebug(x, y, msg)
|
||||
game.print("[gps=".. x .. "," .. y .. "]" .. msg)
|
||||
end
|
||||
|
||||
function constants.gpsSurfaceDebug(surface, x, y, msg)
|
||||
surface.print("[gps=".. x .. "," .. y .. "]" .. msg)
|
||||
end
|
||||
|
||||
constants.MAX_HIVE_TTL = 12400
|
||||
constants.MIN_HIVE_TTL = 4800
|
||||
constants.DEV_HIVE_TTL = 450
|
||||
|
@ -893,7 +893,6 @@ function Squad.retreatUnits(chunk, cause, tick, existingSquad, radius)
|
||||
nextExitDirection
|
||||
)
|
||||
)
|
||||
exitPath = nextExitPath
|
||||
else
|
||||
retreatPosition = findMovementPosition(
|
||||
surface,
|
||||
@ -912,9 +911,7 @@ function Squad.retreatUnits(chunk, cause, tick, existingSquad, radius)
|
||||
return
|
||||
end
|
||||
|
||||
local created = false
|
||||
if not existingSquad then
|
||||
created = true
|
||||
if (Universe.squadCount >= Universe.AI_MAX_SQUAD_COUNT) then
|
||||
return
|
||||
end
|
||||
@ -933,16 +930,12 @@ function Squad.retreatUnits(chunk, cause, tick, existingSquad, radius)
|
||||
local foundUnits = surface.set_multi_command(Queries.formRetreatCommand)
|
||||
|
||||
if (foundUnits == 0) then
|
||||
if created then
|
||||
existingSquad.group.destroy()
|
||||
end
|
||||
existingSquad.group.destroy()
|
||||
return
|
||||
end
|
||||
|
||||
if created then
|
||||
Universe.groupNumberToSquad[existingSquad.groupNumber] = existingSquad
|
||||
Universe.squadCount = Universe.squadCount + 1
|
||||
end
|
||||
Universe.groupNumberToSquad[existingSquad.groupNumber] = existingSquad
|
||||
Universe.squadCount = Universe.squadCount + 1
|
||||
else
|
||||
Queries.moveCommand.distraction = DEFINES_DISTRACTION_NONE
|
||||
setPositionInCommand(Queries.moveCommand, position)
|
||||
|
@ -339,14 +339,10 @@ local function addCommandSet()
|
||||
radius = TRIPLE_CHUNK_SIZE*2,
|
||||
ticks_to_wait = 2 * 60
|
||||
}
|
||||
Universe.squadQueries.stopCommand = {
|
||||
type = DEFINES_COMMAND_STOP
|
||||
}
|
||||
Universe.squadQueries.compoundSettleCommand = {
|
||||
type = DEFINES_COMMMAD_COMPOUND,
|
||||
structure_type = DEFINES_COMPOUND_COMMAND_RETURN_LAST,
|
||||
commands = {
|
||||
Universe.squadQueries.wonder2Command,
|
||||
Universe.squadQueries.settleCommand
|
||||
}
|
||||
}
|
||||
@ -443,6 +439,7 @@ function Upgrade.addUniverseProperties()
|
||||
for key in pairs(Universe) do
|
||||
Universe[key] = nil
|
||||
end
|
||||
|
||||
global.universePropertyVersion = 0
|
||||
end
|
||||
|
||||
@ -466,7 +463,6 @@ function Upgrade.addUniverseProperties()
|
||||
Universe.attackWaveDeviation = 0
|
||||
Universe.attackWaveUpperBound = 0
|
||||
Universe.unitRefundAmount = 0
|
||||
Universe.regroupIndex = 1
|
||||
|
||||
Universe.kamikazeThreshold = 0
|
||||
Universe.attackWaveLowerBound = 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user