mirror of
https://github.com/veden/Rampant.git
synced 2025-01-28 03:29:34 +02:00
see changelog
This commit is contained in:
parent
17a5c716c6
commit
14e82d074e
18
Upgrade.lua
18
Upgrade.lua
@ -127,8 +127,8 @@ function upgrade.attempt(natives, setNewSurface, gameSurfaces)
|
||||
natives.pendingStealGroups = {}
|
||||
natives.pendingStealGroups.len = 1
|
||||
end
|
||||
if (global.version < 109) then
|
||||
global.version = 109
|
||||
if (global.version < 110) then
|
||||
global.version = 110
|
||||
|
||||
local gameSurfs
|
||||
if not gameSurfaces then
|
||||
@ -161,8 +161,20 @@ function upgrade.attempt(natives, setNewSurface, gameSurfaces)
|
||||
end
|
||||
end
|
||||
|
||||
for i=1,natives.squads.len do
|
||||
natives.squads[i].chunk = -1
|
||||
end
|
||||
|
||||
for i=1,natives.pendingAttack.len do
|
||||
natives.pendingAttack[i].chunk = -1
|
||||
end
|
||||
|
||||
for i=1,#natives.building do
|
||||
natives.building[i].chunk = -1
|
||||
end
|
||||
|
||||
if not setNewSurface then
|
||||
game.get_surface(natives.activeSurface).print("Rampant - Version 0.18.9")
|
||||
game.get_surface(natives.activeSurface).print("Rampant - Version 0.18.11")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,8 +1,21 @@
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.18.11
|
||||
Date: 13. 4 2020
|
||||
Improvements:
|
||||
- Groups stolen from vanilla AI can now become settlers based on ai state
|
||||
- AI now gains extra credits based on the number of spawners in pollution
|
||||
Tweaks:
|
||||
- Increased chance to 45% for both attack and settle on a map processing logic cycle
|
||||
- Squads and settlers created per map scan capped at 7
|
||||
Bugfixes:
|
||||
- fixed script_raised_destroy not being pass to the onDeath handler
|
||||
- fixed SENTINEL_IMPASSABLE_CHUNK not being defined in base entity upgrade handler
|
||||
- fixed rapid in squad defense to rabid (Thanks to jnshi)
|
||||
- fixed squads being able to record movement penalties for SENTINEL_IMPASSABLE_CHUNK
|
||||
- fixed squads being able to be added to SENTINEL_IMPASSABLE_CHUNK
|
||||
- fixed new unit scalers now have a minimum of 0.0001
|
||||
- fixed tile changes using surface index instead of surface name
|
||||
- fixed squad cap due to spawning not taking into account pending squads
|
||||
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.18.10
|
||||
|
356
control.lua
356
control.lua
@ -46,8 +46,6 @@ local WATER_TILE_NAMES = constants.WATER_TILE_NAMES
|
||||
|
||||
local MOVEMENT_PHEROMONE = constants.MOVEMENT_PHEROMONE
|
||||
|
||||
local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
|
||||
|
||||
local RETREAT_GRAB_RADIUS = constants.RETREAT_GRAB_RADIUS
|
||||
|
||||
local RETREAT_SPAWNER_GRAB_RADIUS = constants.RETREAT_SPAWNER_GRAB_RADIUS
|
||||
@ -157,7 +155,7 @@ local function onIonCannonFired(event)
|
||||
natives.ionCannonBlasts = natives.ionCannonBlasts + 1
|
||||
natives.points = natives.points + 3000
|
||||
local chunk = getChunkByPosition(map, event.position)
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (chunk ~= -1) then
|
||||
rallyUnits(chunk, map, surface, event.tick)
|
||||
end
|
||||
end
|
||||
@ -227,20 +225,20 @@ local function rebuildMap()
|
||||
|
||||
-- preallocating memory to be used in code, making it fast by reducing garbage generated.
|
||||
map.neighbors = {
|
||||
SENTINEL_IMPASSABLE_CHUNK,
|
||||
SENTINEL_IMPASSABLE_CHUNK,
|
||||
SENTINEL_IMPASSABLE_CHUNK,
|
||||
SENTINEL_IMPASSABLE_CHUNK,
|
||||
SENTINEL_IMPASSABLE_CHUNK,
|
||||
SENTINEL_IMPASSABLE_CHUNK,
|
||||
SENTINEL_IMPASSABLE_CHUNK,
|
||||
SENTINEL_IMPASSABLE_CHUNK
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1
|
||||
}
|
||||
map.cardinalNeighbors = {
|
||||
SENTINEL_IMPASSABLE_CHUNK,
|
||||
SENTINEL_IMPASSABLE_CHUNK,
|
||||
SENTINEL_IMPASSABLE_CHUNK,
|
||||
SENTINEL_IMPASSABLE_CHUNK
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1
|
||||
}
|
||||
map.position = {
|
||||
x=0,
|
||||
@ -264,10 +262,10 @@ local function rebuildMap()
|
||||
map.chunkScanCounts = {}
|
||||
|
||||
map.chunkOverlapArray = {
|
||||
SENTINEL_IMPASSABLE_CHUNK,
|
||||
SENTINEL_IMPASSABLE_CHUNK,
|
||||
SENTINEL_IMPASSABLE_CHUNK,
|
||||
SENTINEL_IMPASSABLE_CHUNK
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1
|
||||
}
|
||||
|
||||
-- map.mapOrdering = {}
|
||||
@ -606,140 +604,142 @@ end
|
||||
|
||||
local function onDeath(event)
|
||||
local entity = event.entity
|
||||
local surface = entity.surface
|
||||
if (surface.name == natives.activeSurface) then
|
||||
local entityPosition = entity.position
|
||||
local chunk = getChunkByPosition(map, entityPosition)
|
||||
local cause = event.cause
|
||||
local tick = event.tick
|
||||
local entityType = entity.type
|
||||
if (entity.force.name == "enemy") then
|
||||
if entity.valid then
|
||||
local surface = entity.surface
|
||||
if (surface.name == natives.activeSurface) then
|
||||
local entityPosition = entity.position
|
||||
local chunk = getChunkByPosition(map, entityPosition)
|
||||
local cause = event.cause
|
||||
local tick = event.tick
|
||||
local entityType = entity.type
|
||||
if (entity.force.name == "enemy") then
|
||||
|
||||
local artilleryBlast = (cause and ((cause.type == "artillery-wagon") or (cause.type == "artillery-turret")))
|
||||
local artilleryBlast = (cause and ((cause.type == "artillery-wagon") or (cause.type == "artillery-turret")))
|
||||
|
||||
if artilleryBlast then
|
||||
natives.artilleryBlasts = natives.artilleryBlasts + 1
|
||||
end
|
||||
|
||||
if (entityType == "unit") then
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
-- drop death pheromone where unit died
|
||||
deathScent(map, chunk)
|
||||
|
||||
if event.force and (event.force.name ~= "enemy") and (chunk[MOVEMENT_PHEROMONE] < -natives.retreatThreshold) then
|
||||
|
||||
natives.lostEnemyUnits = natives.lostEnemyUnits + 1
|
||||
|
||||
retreatUnits(chunk,
|
||||
entityPosition,
|
||||
convertUnitGroupToSquad(natives, entity.unit_group),
|
||||
map,
|
||||
surface,
|
||||
tick,
|
||||
(artilleryBlast and RETREAT_SPAWNER_GRAB_RADIUS) or RETREAT_GRAB_RADIUS,
|
||||
artilleryBlast)
|
||||
|
||||
if (mRandom() < natives.rallyThreshold) and not surface.peaceful_mode then
|
||||
rallyUnits(chunk, map, surface, tick)
|
||||
end
|
||||
end
|
||||
if artilleryBlast then
|
||||
natives.artilleryBlasts = natives.artilleryBlasts + 1
|
||||
end
|
||||
|
||||
elseif event.force and (event.force.name ~= "enemy") and ((entityType == "unit-spawner") or (entityType == "turret")) then
|
||||
if (entityType == "unit") then
|
||||
if (chunk ~= -1) then
|
||||
-- drop death pheromone where unit died
|
||||
deathScent(map, chunk)
|
||||
|
||||
natives.points = natives.points + (((entityType == "unit-spawner") and RECOVER_NEST_COST) or RECOVER_WORM_COST)
|
||||
if event.force and (event.force.name ~= "enemy") and (chunk[MOVEMENT_PHEROMONE] < -natives.retreatThreshold) then
|
||||
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
unregisterEnemyBaseStructure(map, entity)
|
||||
natives.lostEnemyUnits = natives.lostEnemyUnits + 1
|
||||
|
||||
rallyUnits(chunk, map, surface, tick)
|
||||
retreatUnits(chunk,
|
||||
entityPosition,
|
||||
convertUnitGroupToSquad(natives, entity.unit_group),
|
||||
map,
|
||||
surface,
|
||||
tick,
|
||||
(artilleryBlast and RETREAT_SPAWNER_GRAB_RADIUS) or RETREAT_GRAB_RADIUS,
|
||||
artilleryBlast)
|
||||
|
||||
retreatUnits(chunk,
|
||||
entityPosition,
|
||||
nil,
|
||||
map,
|
||||
surface,
|
||||
tick,
|
||||
RETREAT_SPAWNER_GRAB_RADIUS,
|
||||
(cause and ((cause.type == "artillery-wagon") or (cause.type == "artillery-turret"))))
|
||||
end
|
||||
end
|
||||
|
||||
local pair = natives.drainPylons[entity.unit_number]
|
||||
if pair then
|
||||
local target = pair[1]
|
||||
local pole = pair[2]
|
||||
if target == entity then
|
||||
natives.drainPylons[entity.unit_number] = nil
|
||||
if pole.valid then
|
||||
natives.drainPylons[pole.unit_number] = nil
|
||||
pole.die()
|
||||
end
|
||||
elseif (pole == entity) then
|
||||
natives.drainPylons[entity.unit_number] = nil
|
||||
if target.valid then
|
||||
natives.drainPylons[target.unit_number] = nil
|
||||
target.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif (entity.force.name ~= "enemy") then
|
||||
local creditNatives = false
|
||||
if (event.force ~= nil) and (event.force.name == "enemy") then
|
||||
creditNatives = true
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
victoryScent(map, chunk, entityType)
|
||||
end
|
||||
|
||||
local drained = (entityType == "electric-turret") and map.chunkToDrained[chunk]
|
||||
if (cause ~= nil) or (drained and (drained - tick) > 0) then
|
||||
if ((cause and ENERGY_THIEF_LOOKUP[cause.name]) or (not cause)) then
|
||||
local conversion = ENERGY_THIEF_CONVERSION_TABLE[entityType]
|
||||
if conversion then
|
||||
local newEntity = surface.create_entity({position=entity.position,
|
||||
name=convertTypeToDrainCrystal(entity.force.evolution_factor, conversion),
|
||||
direction=entity.direction})
|
||||
if (conversion == "pole") then
|
||||
local targetEntity = surface.create_entity({position=entity.position,
|
||||
name="pylon-target-rampant",
|
||||
direction=entity.direction})
|
||||
targetEntity.backer_name = ""
|
||||
local pair = {targetEntity, newEntity}
|
||||
natives.drainPylons[targetEntity.unit_number] = pair
|
||||
natives.drainPylons[newEntity.unit_number] = pair
|
||||
local wires = entity.neighbours
|
||||
if wires then
|
||||
for _,v in pairs(wires.copper) do
|
||||
if (v.valid) then
|
||||
newEntity.connect_neighbour(v);
|
||||
end
|
||||
end
|
||||
for _,v in pairs(wires.red) do
|
||||
if (v.valid) then
|
||||
newEntity.connect_neighbour({wire = DEFINES_WIRE_TYPE_RED, target_entity = v});
|
||||
end
|
||||
end
|
||||
for _,v in pairs(wires.green) do
|
||||
if (v.valid) then
|
||||
newEntity.connect_neighbour({wire = DEFINES_WIRE_TYPE_GREEN, target_entity = v});
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif newEntity.backer_name then
|
||||
newEntity.backer_name = ""
|
||||
if (mRandom() < natives.rallyThreshold) and not surface.peaceful_mode then
|
||||
rallyUnits(chunk, map, surface, tick)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
elseif event.force and (event.force.name ~= "enemy") and ((entityType == "unit-spawner") or (entityType == "turret")) then
|
||||
|
||||
natives.points = natives.points + (((entityType == "unit-spawner") and RECOVER_NEST_COST) or RECOVER_WORM_COST)
|
||||
|
||||
if (chunk ~= -1) then
|
||||
unregisterEnemyBaseStructure(map, entity)
|
||||
|
||||
rallyUnits(chunk, map, surface, tick)
|
||||
|
||||
retreatUnits(chunk,
|
||||
entityPosition,
|
||||
nil,
|
||||
map,
|
||||
surface,
|
||||
tick,
|
||||
RETREAT_SPAWNER_GRAB_RADIUS,
|
||||
(cause and ((cause.type == "artillery-wagon") or (cause.type == "artillery-turret"))))
|
||||
end
|
||||
end
|
||||
elseif (entity.type == "resource") and (entity.force.name == "neutral") then
|
||||
if (entity.amount == 0) then
|
||||
unregisterResource(entity, map)
|
||||
|
||||
local pair = natives.drainPylons[entity.unit_number]
|
||||
if pair then
|
||||
local target = pair[1]
|
||||
local pole = pair[2]
|
||||
if target == entity then
|
||||
natives.drainPylons[entity.unit_number] = nil
|
||||
if pole.valid then
|
||||
natives.drainPylons[pole.unit_number] = nil
|
||||
pole.die()
|
||||
end
|
||||
elseif (pole == entity) then
|
||||
natives.drainPylons[entity.unit_number] = nil
|
||||
if target.valid then
|
||||
natives.drainPylons[target.unit_number] = nil
|
||||
target.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif (entity.force.name ~= "enemy") then
|
||||
local creditNatives = false
|
||||
if (event.force ~= nil) and (event.force.name == "enemy") then
|
||||
creditNatives = true
|
||||
if (chunk ~= -1) then
|
||||
victoryScent(map, chunk, entityType)
|
||||
end
|
||||
|
||||
local drained = (entityType == "electric-turret") and map.chunkToDrained[chunk]
|
||||
if (cause ~= nil) or (drained and (drained - tick) > 0) then
|
||||
if ((cause and ENERGY_THIEF_LOOKUP[cause.name]) or (not cause)) then
|
||||
local conversion = ENERGY_THIEF_CONVERSION_TABLE[entityType]
|
||||
if conversion then
|
||||
local newEntity = surface.create_entity({position=entity.position,
|
||||
name=convertTypeToDrainCrystal(entity.force.evolution_factor, conversion),
|
||||
direction=entity.direction})
|
||||
if (conversion == "pole") then
|
||||
local targetEntity = surface.create_entity({position=entity.position,
|
||||
name="pylon-target-rampant",
|
||||
direction=entity.direction})
|
||||
targetEntity.backer_name = ""
|
||||
local pair = {targetEntity, newEntity}
|
||||
natives.drainPylons[targetEntity.unit_number] = pair
|
||||
natives.drainPylons[newEntity.unit_number] = pair
|
||||
local wires = entity.neighbours
|
||||
if wires then
|
||||
for _,v in pairs(wires.copper) do
|
||||
if (v.valid) then
|
||||
newEntity.connect_neighbour(v);
|
||||
end
|
||||
end
|
||||
for _,v in pairs(wires.red) do
|
||||
if (v.valid) then
|
||||
newEntity.connect_neighbour({wire = DEFINES_WIRE_TYPE_RED, target_entity = v});
|
||||
end
|
||||
end
|
||||
for _,v in pairs(wires.green) do
|
||||
if (v.valid) then
|
||||
newEntity.connect_neighbour({wire = DEFINES_WIRE_TYPE_GREEN, target_entity = v});
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif newEntity.backer_name then
|
||||
newEntity.backer_name = ""
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif (entity.type == "resource") and (entity.force.name == "neutral") then
|
||||
if (entity.amount == 0) then
|
||||
unregisterResource(entity, map)
|
||||
end
|
||||
end
|
||||
if creditNatives and natives.safeBuildings and (natives.safeEntities[entityType] or natives.safeEntities[entity.name]) then
|
||||
makeImmortalEntity(surface, entity)
|
||||
else
|
||||
accountPlayerEntity(entity, natives, false, creditNatives)
|
||||
end
|
||||
end
|
||||
if creditNatives and natives.safeBuildings and (natives.safeEntities[entityType] or natives.safeEntities[entity.name]) then
|
||||
makeImmortalEntity(surface, entity)
|
||||
else
|
||||
accountPlayerEntity(entity, natives, false, creditNatives)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -747,38 +747,41 @@ end
|
||||
|
||||
local function onEnemyBaseBuild(event)
|
||||
local entity = event.entity
|
||||
local surface = entity.surface
|
||||
if entity.valid then
|
||||
local surface = entity.surface
|
||||
|
||||
if entity.valid and (surface.name == natives.activeSurface) then
|
||||
local chunk = getChunkByPosition(map, entity.position)
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
local base
|
||||
if natives.newEnemies then
|
||||
base = findNearbyBase(map, chunk)
|
||||
if not base then
|
||||
base = createBase(natives,
|
||||
chunk,
|
||||
event.tick)
|
||||
if (surface.name == natives.activeSurface) then
|
||||
local chunk = getChunkByPosition(map, entity.position)
|
||||
if (chunk ~= -1) then
|
||||
local base
|
||||
if natives.newEnemies then
|
||||
base = findNearbyBase(map, chunk)
|
||||
if not base then
|
||||
base = createBase(natives,
|
||||
chunk,
|
||||
event.tick)
|
||||
end
|
||||
entity = upgradeEntity(entity,
|
||||
surface,
|
||||
base.alignment,
|
||||
natives,
|
||||
nil,
|
||||
true)
|
||||
end
|
||||
if entity and entity.valid then
|
||||
event.entity = registerEnemyBaseStructure(map, entity, base, surface)
|
||||
end
|
||||
entity = upgradeEntity(entity,
|
||||
surface,
|
||||
base.alignment,
|
||||
natives,
|
||||
nil,
|
||||
true)
|
||||
end
|
||||
if entity and entity.valid then
|
||||
event.entity = registerEnemyBaseStructure(map, entity, base, surface)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function onSurfaceTileChange(event)
|
||||
local surfaceName = event.surface_index or (event.robot and event.robot.surface and event.robot.surface.name)
|
||||
if event.item and
|
||||
local surfaceIndex = event.surface_index or (event.robot and event.robot.surface and event.robot.surface.index)
|
||||
local surfaceName = game.surfaces[surfaceIndex].name
|
||||
if (surfaceName == natives.activeSurface) and
|
||||
((event.item.name == "landfill") or (event.item.name == "waterfill")) and
|
||||
(surfaceName == natives.activeSurface)
|
||||
event.item
|
||||
then
|
||||
local surface = game.get_surface(natives.activeSurface)
|
||||
local chunks = {}
|
||||
@ -787,7 +790,7 @@ local function onSurfaceTileChange(event)
|
||||
local position = tiles[i].position
|
||||
local chunk = getChunkByPosition(map, position)
|
||||
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (chunk ~= -1) then
|
||||
map.chunkToPassScan[chunk] = true
|
||||
else
|
||||
local x,y = positionToChunkXY(position)
|
||||
@ -820,14 +823,14 @@ end
|
||||
local function onRobotCliff(event)
|
||||
|
||||
local surface = event.robot.surface
|
||||
if (event.item.name == "cliff-explosives") and (surface.name == natives.activeSurface) then
|
||||
if (surface.name == natives.activeSurface) and (event.item.name == "cliff-explosives") then
|
||||
entityForPassScan(map, event.cliff)
|
||||
end
|
||||
end
|
||||
|
||||
local function onUsedCapsule(event)
|
||||
local surface = game.players[event.player_index].surface
|
||||
if (event.item.name == "cliff-explosives") and (surface.name == natives.activeSurface) then
|
||||
if (surface.name == natives.activeSurface) and (event.item.name == "cliff-explosives") then
|
||||
map.position2Top.x = event.position.x-0.75
|
||||
map.position2Top.y = event.position.y-0.75
|
||||
map.position2Bottom.x = event.position.x+0.75
|
||||
@ -849,9 +852,9 @@ end
|
||||
|
||||
local function onTriggerEntityCreated(event)
|
||||
local entity = event.entity
|
||||
if entity.valid and (entity.name == "drain-trigger-rampant") then
|
||||
if entity.valid and (entity.surface.name == natives.activeSurface) and (entity.name == "drain-trigger-rampant") then
|
||||
local chunk = getChunkByPosition(map, entity.position)
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (chunk ~= -1) then
|
||||
map.chunkToDrained[chunk] = event.tick + 60
|
||||
end
|
||||
entity.destroy()
|
||||
@ -875,18 +878,18 @@ end
|
||||
|
||||
local function onEntitySpawned(event)
|
||||
local entity = event.entity
|
||||
if natives.newEnemies and (entity.valid and entity.type ~= "unit") then
|
||||
if natives.buildingHiveTypeLookup[entity.name] then
|
||||
if natives.newEnemies and entity.valid then
|
||||
local surface = entity.surface
|
||||
|
||||
if (surface.name == natives.activeSurface) and (entity.type ~= "unit") then
|
||||
if natives.buildingHiveTypeLookup[entity.name] then
|
||||
local spawner = event.spawner
|
||||
|
||||
local spawner = event.spawner
|
||||
local surface = entity.surface
|
||||
|
||||
if (surface.name == natives.activeSurface) then
|
||||
local disPos = mathUtils.distortPosition(entity.position, 8)
|
||||
local canPlaceQuery = map.canPlaceQuery
|
||||
|
||||
local chunk = getChunkByPosition(map, disPos)
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (chunk ~= -1) then
|
||||
local base = findNearbyBase(map, chunk)
|
||||
if not base then
|
||||
base = createBase(natives,
|
||||
@ -914,7 +917,7 @@ end
|
||||
|
||||
local function onUnitGroupCreated(event)
|
||||
local group = event.group
|
||||
if (group.force.name == "enemy") then
|
||||
if (group.surface.name == natives.activeSurface) and (group.force.name == "enemy") then
|
||||
if not group.is_script_driven then
|
||||
natives.pendingStealGroups.len = natives.pendingStealGroups.len + 1
|
||||
natives.pendingStealGroups[natives.pendingStealGroups.len] = group
|
||||
@ -1109,6 +1112,7 @@ script.on_event(defines.events.on_pre_robot_exploded_cliff, onRobotCliff)
|
||||
script.on_event(defines.events.on_biter_base_built, onEnemyBaseBuild)
|
||||
script.on_event({defines.events.on_player_mined_entity,
|
||||
defines.events.on_robot_mined_entity}, onMine)
|
||||
|
||||
script.on_event({defines.events.on_built_entity,
|
||||
defines.events.on_robot_built_entity,
|
||||
defines.events.script_raised_built,
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name" : "Rampant",
|
||||
"factorio_version" : "0.18",
|
||||
"version" : "0.18.10",
|
||||
"version" : "0.18.11",
|
||||
"title" : "Rampant",
|
||||
"author" : "Veden",
|
||||
"homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445",
|
||||
|
@ -46,8 +46,6 @@ local AI_STATE_SIEGE = constants.AI_STATE_SIEGE
|
||||
|
||||
local AI_STATE_RAIDING = constants.AI_STATE_RAIDING
|
||||
|
||||
local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
|
||||
|
||||
-- imported functions
|
||||
|
||||
local randomTickEvent = mathUtils.randomTickEvent
|
||||
@ -132,7 +130,7 @@ function aiAttackWave.rallyUnits(chunk, map, surface, tick)
|
||||
for y=cY - RALLY_CRY_DISTANCE, cY + RALLY_CRY_DISTANCE, 32 do
|
||||
if (x ~= cX) and (y ~= cY) then
|
||||
local rallyChunk = getChunkByXY(map, x, y)
|
||||
if (rallyChunk ~= SENTINEL_IMPASSABLE_CHUNK) and (getNestCount(map, rallyChunk) > 0) then
|
||||
if (rallyChunk ~= -1) and (getNestCount(map, rallyChunk) > 0) then
|
||||
if not aiAttackWave.formVengenceSquad(map, surface, rallyChunk) then
|
||||
return false
|
||||
end
|
||||
@ -152,7 +150,7 @@ function aiAttackWave.formAttackWave(chunk, map, surface, tick)
|
||||
for y=cY - RALLY_CRY_DISTANCE, cY + RALLY_CRY_DISTANCE, 32 do
|
||||
if (x ~= cX) and (y ~= cY) then
|
||||
local rallyChunk = getChunkByXY(map, x, y)
|
||||
if (rallyChunk ~= SENTINEL_IMPASSABLE_CHUNK) and (getNestCount(map, rallyChunk) > 0) then
|
||||
if (rallyChunk ~= -1) and (getNestCount(map, rallyChunk) > 0) then
|
||||
if not aiAttackWave.formSquads(map, surface, rallyChunk, tick) then
|
||||
return false
|
||||
end
|
||||
@ -172,7 +170,7 @@ local function noNearbySettlers(map, chunk, tick)
|
||||
for y=cY - SETTLER_DISTANCE, cY + SETTLER_DISTANCE, 32 do
|
||||
if (x ~= cX) and (y ~= cY) then
|
||||
local c = getChunkByXY(map, x, y)
|
||||
if (c ~= SENTINEL_IMPASSABLE_CHUNK) and ((tick - getChunkSettlerTick(map, c)) < 0) then
|
||||
if (c ~= -1) and ((tick - getChunkSettlerTick(map, c)) < 0) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
@ -183,7 +181,10 @@ end
|
||||
|
||||
function aiAttackWave.formSettlers(map, surface, chunk, tick)
|
||||
local natives = map.natives
|
||||
if (mRandom() < natives.formSquadThreshold) and ((natives.squads.len + #natives.building) < AI_MAX_SQUAD_COUNT) then
|
||||
if (mRandom() < natives.formSquadThreshold) and
|
||||
((natives.squads.len + #natives.building) < AI_MAX_SQUAD_COUNT) and
|
||||
(natives.remainingSquads > 0)
|
||||
then
|
||||
|
||||
local squadPath, squadDirection
|
||||
if (natives.state == AI_STATE_SIEGE) then
|
||||
@ -199,7 +200,7 @@ function aiAttackWave.formSettlers(map, surface, chunk, tick)
|
||||
map)
|
||||
end
|
||||
|
||||
if (squadPath ~= SENTINEL_IMPASSABLE_CHUNK) and noNearbySettlers(map, chunk, tick) then
|
||||
if (squadPath ~= -1) and noNearbySettlers(map, chunk, tick) then
|
||||
local squadPosition = surface.find_non_colliding_position("chunk-scanner-squad-rampant",
|
||||
positionFromDirectionAndChunk(squadDirection,
|
||||
chunk,
|
||||
@ -226,6 +227,7 @@ function aiAttackWave.formSettlers(map, surface, chunk, tick)
|
||||
local pending = natives.pendingAttack
|
||||
pending.len = pending.len + 1
|
||||
squad.cycles = 30
|
||||
natives.remainingSquads = natives.remainingSquads - 1
|
||||
pending[pending.len] = squad
|
||||
natives.points = natives.points - AI_SETTLER_COST
|
||||
else
|
||||
@ -237,7 +239,7 @@ function aiAttackWave.formSettlers(map, surface, chunk, tick)
|
||||
end
|
||||
end
|
||||
|
||||
return (natives.points - AI_SETTLER_COST) > 0
|
||||
return ((natives.points - AI_SETTLER_COST) > 0) and (natives.remainingSquads > 0)
|
||||
end
|
||||
|
||||
function aiAttackWave.formVengenceSquad(map, surface, chunk)
|
||||
@ -248,7 +250,7 @@ function aiAttackWave.formVengenceSquad(map, surface, chunk)
|
||||
validUnitGroupLocation,
|
||||
scoreUnitGroupLocation,
|
||||
map)
|
||||
if (squadPath ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (squadPath ~= -1) then
|
||||
local squadPosition = surface.find_non_colliding_position("chunk-scanner-squad-rampant",
|
||||
positionFromDirectionAndChunk(squadDirection,
|
||||
chunk,
|
||||
@ -289,13 +291,14 @@ function aiAttackWave.formSquads(map, surface, chunk, tick)
|
||||
local natives = map.natives
|
||||
if attackWaveValidCandidate(chunk, natives, map) and
|
||||
(mRandom() < natives.formSquadThreshold) and
|
||||
(natives.squads.len < AI_MAX_SQUAD_COUNT)
|
||||
(natives.squads.len + natives.pendingAttack.len < AI_MAX_SQUAD_COUNT) and
|
||||
(natives.remainingSquads > 0)
|
||||
then
|
||||
local squadPath, squadDirection = scoreNeighborsForFormation(getNeighborChunks(map, chunk.x, chunk.y),
|
||||
validUnitGroupLocation,
|
||||
scoreUnitGroupLocation,
|
||||
map)
|
||||
if (squadPath ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (squadPath ~= -1) then
|
||||
local squadPosition = surface.find_non_colliding_position("chunk-scanner-squad-rampant",
|
||||
positionFromDirectionAndChunk(squadDirection,
|
||||
chunk,
|
||||
@ -320,6 +323,7 @@ function aiAttackWave.formSquads(map, surface, chunk, tick)
|
||||
squad.cycles = 30
|
||||
pending[pending.len] = squad
|
||||
natives.points = natives.points - AI_SQUAD_COST
|
||||
natives.remainingSquads = natives.remainingSquads - 1
|
||||
if tick and (natives.state == AI_STATE_AGGRESSIVE) then
|
||||
natives.canAttackTick = randomTickEvent(tick,
|
||||
AGGRESSIVE_CAN_ATTACK_WAIT_MIN_DURATION,
|
||||
@ -335,7 +339,7 @@ function aiAttackWave.formSquads(map, surface, chunk, tick)
|
||||
end
|
||||
end
|
||||
|
||||
return (natives.points - AI_SQUAD_COST) > 0
|
||||
return ((natives.points - AI_SQUAD_COST) > 0) and (natives.remainingSquads > 0)
|
||||
end
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ function aiPlanning.planning(natives, evolution_factor, tick)
|
||||
natives.unitRefundAmount = AI_UNIT_REFUND * evolution_factor
|
||||
natives.kamikazeThreshold = NO_RETREAT_BASE_PERCENT + (evolution_factor * NO_RETREAT_EVOLUTION_BONUS_MAX)
|
||||
|
||||
local points = mFloor((AI_POINT_GENERATOR_AMOUNT * mRandom()) + ((AI_POINT_GENERATOR_AMOUNT * 0.7) * (evolution_factor ^ 2.5)) * natives.aiPointsScaler)
|
||||
local points = mFloor((AI_POINT_GENERATOR_AMOUNT * mRandom()) + (natives.activeNests * 0.25) + ((AI_POINT_GENERATOR_AMOUNT * 0.7) * (evolution_factor ^ 2.5)) * natives.aiPointsScaler)
|
||||
|
||||
if (natives.state == AI_STATE_ONSLAUGHT) then
|
||||
points = points * 2
|
||||
|
@ -20,10 +20,10 @@ local AI_STATE_ONSLAUGHT = constants.AI_STATE_ONSLAUGHT
|
||||
-- module code
|
||||
|
||||
function aiPredicates.canAttack(natives, surface)
|
||||
return ((natives.state == AI_STATE_AGGRESSIVE) or (natives.state == AI_STATE_RAIDING) or (natives.state == AI_STATE_ONSLAUGHT))
|
||||
and not surface.peaceful_mode
|
||||
and ((not natives.aiNocturnalMode) or
|
||||
(natives.aiNocturnalMode and surface.darkness > 0.65))
|
||||
local goodAI = ((natives.state == AI_STATE_AGGRESSIVE) or (natives.state == AI_STATE_RAIDING) or (natives.state == AI_STATE_ONSLAUGHT))
|
||||
local notPeaceful = not surface.peaceful_mode
|
||||
local noctural = (not natives.aiNocturnalMode) or (natives.aiNocturnalMode and surface.darkness > 0.65)
|
||||
return goodAI and notPeaceful and noctural
|
||||
end
|
||||
|
||||
function aiPredicates.canMigrate(natives, surface)
|
||||
|
@ -274,7 +274,7 @@ local function findEntityUpgrade(baseAlignment, currentEvo, evoIndex, originalEn
|
||||
|
||||
if evolve then
|
||||
local chunk = getChunkByPosition(natives.map, originalEntity.position)
|
||||
local makeHive = (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (getResourceGenerator(natives.map, chunk) > 0) and (mRandom() < 0.2)
|
||||
local makeHive = (chunk ~= -1) and (getResourceGenerator(natives.map, chunk) > 0) and (mRandom() < 0.2)
|
||||
|
||||
return initialEntityUpgrade(baseAlignment, tier, maxTier, natives, (makeHive and "hive"))
|
||||
else
|
||||
|
@ -13,8 +13,6 @@ local constants = require("Constants")
|
||||
|
||||
local CHUNK_SIZE = constants.CHUNK_SIZE
|
||||
|
||||
local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
|
||||
|
||||
local MAX_TICKS_BEFORE_SORT_CHUNKS = constants.MAX_TICKS_BEFORE_SORT_CHUNKS
|
||||
|
||||
-- imported functions
|
||||
@ -83,7 +81,7 @@ function chunkProcessor.processPendingChunks(map, surface, pendingStack, tick, r
|
||||
|
||||
chunk = initialScan(chunk, surface, map, tick, rebuilding)
|
||||
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (chunk ~= -1) then
|
||||
map[x][y] = chunk
|
||||
processQueue[#processQueue+1] = chunk
|
||||
end
|
||||
@ -122,7 +120,7 @@ function chunkProcessor.processScanChunks(map, surface)
|
||||
|
||||
chunk = chunkPassScan(chunk, surface, map)
|
||||
|
||||
if (chunk == SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (chunk == -1) then
|
||||
map[x][y] = nil
|
||||
|
||||
chunkCount = chunkCount + 1
|
||||
|
@ -246,7 +246,7 @@ end
|
||||
function chunkPropertyUtils.addSquadToChunk(map, chunk, squad)
|
||||
local chunkToSquad = map.chunkToSquad
|
||||
|
||||
if squad.chunk ~= chunk then
|
||||
if (chunk ~= -1) and (squad.chunk ~= chunk) then
|
||||
chunkPropertyUtils.removeSquadFromChunk(map, squad)
|
||||
local squads = chunkToSquad[chunk]
|
||||
if not squads then
|
||||
|
@ -23,8 +23,6 @@ local DEFINES_WIRE_TYPE_GREEN = defines.wire_type.green
|
||||
|
||||
local CHUNK_PASS_THRESHOLD = constants.CHUNK_PASS_THRESHOLD
|
||||
|
||||
local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
|
||||
|
||||
local AI_STATE_ONSLAUGHT = constants.AI_STATE_ONSLAUGHT
|
||||
|
||||
local BASE_PHEROMONE = constants.BASE_PHEROMONE
|
||||
@ -99,10 +97,10 @@ local function getEntityOverlapChunks(map, entity)
|
||||
local boundingBox = entity.prototype.collision_box or entity.prototype.selection_box;
|
||||
local overlapArray = map.chunkOverlapArray
|
||||
|
||||
overlapArray[1] = SENTINEL_IMPASSABLE_CHUNK --LeftTop
|
||||
overlapArray[2] = SENTINEL_IMPASSABLE_CHUNK --RightTop
|
||||
overlapArray[3] = SENTINEL_IMPASSABLE_CHUNK --LeftBottom
|
||||
overlapArray[4] = SENTINEL_IMPASSABLE_CHUNK --RightBottom
|
||||
overlapArray[1] = -1 --LeftTop
|
||||
overlapArray[2] = -1 --RightTop
|
||||
overlapArray[3] = -1 --LeftBottom
|
||||
overlapArray[4] = -1 --RightBottom
|
||||
|
||||
if boundingBox then
|
||||
local center = entity.position
|
||||
@ -203,14 +201,13 @@ end
|
||||
function chunkUtils.initialScan(chunk, surface, map, tick, rebuilding)
|
||||
local passScore = 1 - (surface.count_tiles_filtered(map.filteredTilesQuery) * 0.0009765625)
|
||||
local natives = map.natives
|
||||
local enemyBuildings = surface.find_entities_filtered(map.filteredEntitiesEnemyStructureQuery)
|
||||
|
||||
if (passScore >= CHUNK_PASS_THRESHOLD) then
|
||||
if (passScore >= CHUNK_PASS_THRESHOLD) or (#enemyBuildings > 0) then
|
||||
local pass = scanPaths(chunk, surface, map)
|
||||
|
||||
local playerObjects = scorePlayerBuildings(surface, map)
|
||||
|
||||
local enemyBuildings = surface.find_entities_filtered(map.filteredEntitiesEnemyStructureQuery)
|
||||
|
||||
if ((playerObjects > 0) or (#enemyBuildings > 0)) and (pass == CHUNK_IMPASSABLE) then
|
||||
pass = CHUNK_ALL_DIRECTIONS
|
||||
end
|
||||
@ -287,7 +284,7 @@ function chunkUtils.initialScan(chunk, surface, map, tick, rebuilding)
|
||||
end
|
||||
end
|
||||
|
||||
return SENTINEL_IMPASSABLE_CHUNK
|
||||
return -1
|
||||
end
|
||||
|
||||
function chunkUtils.chunkPassScan(chunk, surface, map)
|
||||
@ -310,7 +307,7 @@ function chunkUtils.chunkPassScan(chunk, surface, map)
|
||||
return chunk
|
||||
end
|
||||
|
||||
return SENTINEL_IMPASSABLE_CHUNK
|
||||
return -1
|
||||
end
|
||||
|
||||
function chunkUtils.mapScanChunk(chunk, surface, map)
|
||||
@ -345,7 +342,7 @@ function chunkUtils.entityForPassScan(map, entity)
|
||||
|
||||
for i=1,#overlapArray do
|
||||
local chunk = overlapArray[i]
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (chunk ~= -1) then
|
||||
map.chunkToPassScan[chunk] = true
|
||||
end
|
||||
end
|
||||
@ -420,7 +417,7 @@ function chunkUtils.registerEnemyBaseStructure(map, entity, base, surface)
|
||||
|
||||
for i=1,#overlapArray do
|
||||
local chunk = overlapArray[i]
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (chunk ~= -1) then
|
||||
setFunc(map, chunk, getFunc(map, chunk) + 1)
|
||||
setChunkBase(map, chunk, base)
|
||||
processNestActiveness(map, chunk, natives, surface)
|
||||
@ -475,7 +472,7 @@ function chunkUtils.unregisterEnemyBaseStructure(map, entity)
|
||||
|
||||
for i=1,#overlapArray do
|
||||
local chunk = overlapArray[i]
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (chunk ~= -1) then
|
||||
local count = getFunc(map, chunk)
|
||||
if count then
|
||||
if (count <= 1) then
|
||||
@ -517,7 +514,7 @@ function chunkUtils.accountPlayerEntity(entity, natives, addObject, creditNative
|
||||
|
||||
for i=1,#overlapArray do
|
||||
local chunk = overlapArray[i]
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (chunk ~= -1) then
|
||||
addPlayerBaseGenerator(map, chunk, entityValue)
|
||||
end
|
||||
end
|
||||
@ -533,7 +530,7 @@ function chunkUtils.unregisterResource(entity, map)
|
||||
|
||||
for i=1,#overlapArray do
|
||||
local chunk = overlapArray[i]
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (chunk ~= -1) then
|
||||
addResourceGenerator(map, chunk, -RESOURCE_NORMALIZER)
|
||||
end
|
||||
end
|
||||
@ -544,7 +541,7 @@ function chunkUtils.registerResource(entity, map)
|
||||
|
||||
for i=1,#overlapArray do
|
||||
local chunk = overlapArray[i]
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (chunk ~= -1) then
|
||||
addResourceGenerator(map, chunk, RESOURCE_NORMALIZER)
|
||||
end
|
||||
end
|
||||
|
@ -121,11 +121,13 @@ constants.RAIDING_MINIMUM_BASE_THRESHOLD = 550
|
||||
|
||||
constants.AI_UNIT_REFUND = 3
|
||||
|
||||
constants.AI_MAX_SQUAD_COUNT = 35
|
||||
constants.AI_MAX_SQUAD_COUNT = 60
|
||||
constants.AI_MAX_BITER_GROUP_SIZE = 450
|
||||
|
||||
constants.AI_SQUAD_MERGE_THRESHOLD = constants.AI_MAX_BITER_GROUP_SIZE * 0.75
|
||||
|
||||
constants.AI_MAX_SQUADS_PER_CYCLE = 7
|
||||
|
||||
constants.AI_STATE_PEACEFUL = 1
|
||||
constants.AI_STATE_AGGRESSIVE = 2
|
||||
-- constants.AI_STATE_NOCTURNAL = 3
|
||||
@ -393,17 +395,6 @@ constants.BASE_ALIGNMENT_NE_PINK = 28
|
||||
|
||||
-- sentinels
|
||||
|
||||
constants.SENTINEL_IMPASSABLE_CHUNK = {}
|
||||
|
||||
constants.SENTINEL_IMPASSABLE_CHUNK.name = "ImpassableChunk"
|
||||
constants.SENTINEL_IMPASSABLE_CHUNK[constants.MOVEMENT_PHEROMONE] = constants.IMPASSABLE_TERRAIN_GENERATOR_AMOUNT
|
||||
constants.SENTINEL_IMPASSABLE_CHUNK[constants.BASE_PHEROMONE] = constants.IMPASSABLE_TERRAIN_GENERATOR_AMOUNT
|
||||
constants.SENTINEL_IMPASSABLE_CHUNK[constants.PLAYER_PHEROMONE] = constants.IMPASSABLE_TERRAIN_GENERATOR_AMOUNT
|
||||
constants.SENTINEL_IMPASSABLE_CHUNK[constants.RESOURCE_PHEROMONE] = constants.IMPASSABLE_TERRAIN_GENERATOR_AMOUNT
|
||||
constants.SENTINEL_IMPASSABLE_CHUNK[constants.CHUNK_TICK] = 0
|
||||
constants.SENTINEL_IMPASSABLE_CHUNK.x = -1
|
||||
constants.SENTINEL_IMPASSABLE_CHUNK.y = -1
|
||||
|
||||
constants.ENERGY_THIEF_CONVERSION_TABLE = {
|
||||
["generator"] = "unit",
|
||||
["pump"] = "smallUnit",
|
||||
|
@ -31,8 +31,6 @@ local TRIPLE_CHUNK_SIZE = constants.TRIPLE_CHUNK_SIZE
|
||||
local PROCESS_PLAYER_BOUND = constants.PROCESS_PLAYER_BOUND
|
||||
local CHUNK_TICK = constants.CHUNK_TICK
|
||||
|
||||
local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
|
||||
|
||||
local AI_SQUAD_COST = constants.AI_SQUAD_COST
|
||||
local AI_VENGENCE_SQUAD_COST = constants.AI_VENGENCE_SQUAD_COST
|
||||
local AI_SETTLER_COST = constants.AI_SETTLER_COST
|
||||
@ -111,21 +109,23 @@ function mapProcessor.processMap(map, surface, tick)
|
||||
|
||||
local chunkToBase = map.chunkToBase
|
||||
|
||||
local natives = map.natives
|
||||
|
||||
if (index == 1) then
|
||||
roll = mRandom()
|
||||
map.processRoll = roll
|
||||
natives.remainingSquads = constants.AI_MAX_SQUADS_PER_CYCLE
|
||||
print("squads", natives.squads.len, natives.pendingAttack.len, #natives.building)
|
||||
end
|
||||
|
||||
local natives = map.natives
|
||||
|
||||
local newEnemies = natives.newEnemies
|
||||
local scentStaging = map.scentStaging
|
||||
|
||||
local squads = canAttack(natives, surface) and (0.11 <= roll) and (roll <= 0.35) and (natives.points >= AI_SQUAD_COST)
|
||||
local squads = canAttack(natives, surface) and (roll <= 0.45) and (natives.points >= AI_SQUAD_COST)
|
||||
if squads and (natives.state == AI_STATE_AGGRESSIVE) and (tick < natives.canAttackTick) then
|
||||
squads = false
|
||||
end
|
||||
local settlers = canMigrate(natives, surface) and (0.90 <= roll) and (natives.points >= AI_SETTLER_COST)
|
||||
local settlers = canMigrate(natives, surface) and (roll <= 0.45) and (natives.points >= AI_SETTLER_COST)
|
||||
|
||||
local processQueue = map.processQueue
|
||||
local endIndex = mMin(index + PROCESS_QUEUE_SIZE, #processQueue)
|
||||
@ -230,7 +230,7 @@ function mapProcessor.processPlayers(players, map, surface, tick)
|
||||
if validPlayer(player, natives) then
|
||||
local playerChunk = getChunkByPosition(map, player.character.position)
|
||||
|
||||
if (playerChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (playerChunk ~= -1) then
|
||||
local i = 1
|
||||
local vengence = (allowingAttacks and
|
||||
(natives.points >= AI_VENGENCE_SQUAD_COST) and
|
||||
@ -240,7 +240,7 @@ function mapProcessor.processPlayers(players, map, surface, tick)
|
||||
for y=playerChunk.y - PROCESS_PLAYER_BOUND, playerChunk.y + PROCESS_PLAYER_BOUND, 32 do
|
||||
local chunk = getChunkByXY(map, x, y)
|
||||
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (chunk[CHUNK_TICK] ~= tick) then
|
||||
if (chunk ~= -1) and (chunk[CHUNK_TICK] ~= tick) then
|
||||
processPheromone(map, chunk, scentStaging[i])
|
||||
|
||||
processNestActiveness(map, chunk, natives, surface)
|
||||
@ -258,7 +258,7 @@ function mapProcessor.processPlayers(players, map, surface, tick)
|
||||
for x=playerChunk.x - PROCESS_PLAYER_BOUND, playerChunk.x + PROCESS_PLAYER_BOUND, 32 do
|
||||
for y=playerChunk.y - PROCESS_PLAYER_BOUND, playerChunk.y + PROCESS_PLAYER_BOUND, 32 do
|
||||
local chunk = getChunkByXY(map, x, y)
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (chunk[CHUNK_TICK] ~= tick) then
|
||||
if (chunk ~= -1) and (chunk[CHUNK_TICK] ~= tick) then
|
||||
commitPheromone(map, chunk, scentStaging[i], tick)
|
||||
end
|
||||
i = i + 1
|
||||
@ -273,7 +273,7 @@ function mapProcessor.processPlayers(players, map, surface, tick)
|
||||
if validPlayer(player, natives) then
|
||||
local playerChunk = getChunkByPosition(map, player.character.position)
|
||||
|
||||
if (playerChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (playerChunk ~= -1) then
|
||||
playerScent(playerChunk)
|
||||
end
|
||||
end
|
||||
|
@ -19,8 +19,6 @@ local CHUNK_ALL_DIRECTIONS = constants.CHUNK_ALL_DIRECTIONS
|
||||
|
||||
local CHUNK_SIZE = constants.CHUNK_SIZE
|
||||
|
||||
local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
|
||||
|
||||
local CHUNK_SIZE_DIVIDER = constants.CHUNK_SIZE_DIVIDER
|
||||
|
||||
-- imported functions
|
||||
@ -33,27 +31,27 @@ local getPassable = chunkPropertyUtils.getPassable
|
||||
function mapUtils.getChunkByXY(map, x, y)
|
||||
local chunkX = map[x]
|
||||
if chunkX then
|
||||
return chunkX[y] or SENTINEL_IMPASSABLE_CHUNK
|
||||
return chunkX[y] or -1
|
||||
end
|
||||
return SENTINEL_IMPASSABLE_CHUNK
|
||||
return -1
|
||||
end
|
||||
|
||||
function mapUtils.getChunkByPosition(map, position)
|
||||
local chunkX = map[mFloor(position.x * CHUNK_SIZE_DIVIDER) * CHUNK_SIZE]
|
||||
if chunkX then
|
||||
local chunkY = mFloor(position.y * CHUNK_SIZE_DIVIDER) * CHUNK_SIZE
|
||||
return chunkX[chunkY] or SENTINEL_IMPASSABLE_CHUNK
|
||||
return chunkX[chunkY] or -1
|
||||
end
|
||||
return SENTINEL_IMPASSABLE_CHUNK
|
||||
return -1
|
||||
end
|
||||
|
||||
function mapUtils.getChunkByUnalignedXY(map, x, y)
|
||||
local chunkX = map[mFloor(x * CHUNK_SIZE_DIVIDER) * CHUNK_SIZE]
|
||||
if chunkX then
|
||||
local chunkY = mFloor(y * CHUNK_SIZE_DIVIDER) * CHUNK_SIZE
|
||||
return chunkX[chunkY] or SENTINEL_IMPASSABLE_CHUNK
|
||||
return chunkX[chunkY] or -1
|
||||
end
|
||||
return SENTINEL_IMPASSABLE_CHUNK
|
||||
return -1
|
||||
end
|
||||
|
||||
function mapUtils.positionToChunkXY(position)
|
||||
@ -75,33 +73,33 @@ function mapUtils.getNeighborChunks(map, x, y)
|
||||
local chunkYRow3 = y + CHUNK_SIZE
|
||||
local xChunks = map[x-CHUNK_SIZE]
|
||||
if xChunks then
|
||||
neighbors[1] = xChunks[chunkYRow1] or SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[4] = xChunks[y] or SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[6] = xChunks[chunkYRow3] or SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[1] = xChunks[chunkYRow1] or -1
|
||||
neighbors[4] = xChunks[y] or -1
|
||||
neighbors[6] = xChunks[chunkYRow3] or -1
|
||||
else
|
||||
neighbors[1] = SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[4] = SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[6] = SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[1] = -1
|
||||
neighbors[4] = -1
|
||||
neighbors[6] = -1
|
||||
end
|
||||
|
||||
xChunks = map[x+CHUNK_SIZE]
|
||||
if xChunks then
|
||||
neighbors[3] = xChunks[chunkYRow1] or SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[5] = xChunks[y] or SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[8] = xChunks[chunkYRow3] or SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[3] = xChunks[chunkYRow1] or -1
|
||||
neighbors[5] = xChunks[y] or -1
|
||||
neighbors[8] = xChunks[chunkYRow3] or -1
|
||||
else
|
||||
neighbors[3] = SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[5] = SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[8] = SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[3] = -1
|
||||
neighbors[5] = -1
|
||||
neighbors[8] = -1
|
||||
end
|
||||
|
||||
xChunks = map[x]
|
||||
if xChunks then
|
||||
neighbors[2] = xChunks[chunkYRow1] or SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[7] = xChunks[chunkYRow3] or SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[2] = xChunks[chunkYRow1] or -1
|
||||
neighbors[7] = xChunks[chunkYRow3] or -1
|
||||
else
|
||||
neighbors[2] = SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[7] = SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[2] = -1
|
||||
neighbors[7] = -1
|
||||
end
|
||||
return neighbors
|
||||
end
|
||||
@ -149,25 +147,25 @@ function mapUtils.getCardinalChunks(map, x, y)
|
||||
local neighbors = map.cardinalNeighbors
|
||||
local xChunks = map[x]
|
||||
if xChunks then
|
||||
neighbors[1] = xChunks[y-CHUNK_SIZE] or SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[4] = xChunks[y+CHUNK_SIZE] or SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[1] = xChunks[y-CHUNK_SIZE] or -1
|
||||
neighbors[4] = xChunks[y+CHUNK_SIZE] or -1
|
||||
else
|
||||
neighbors[1] = SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[4] = SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[1] = -1
|
||||
neighbors[4] = -1
|
||||
end
|
||||
|
||||
xChunks = map[x-CHUNK_SIZE]
|
||||
if xChunks then
|
||||
neighbors[2] = xChunks[y] or SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[2] = xChunks[y] or -1
|
||||
else
|
||||
neighbors[2] = SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[2] = -1
|
||||
end
|
||||
|
||||
xChunks = map[x+CHUNK_SIZE]
|
||||
if xChunks then
|
||||
neighbors[3] = xChunks[y] or SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[3] = xChunks[y] or -1
|
||||
else
|
||||
neighbors[3] = SENTINEL_IMPASSABLE_CHUNK
|
||||
neighbors[3] = -1
|
||||
end
|
||||
return neighbors
|
||||
end
|
||||
|
@ -15,8 +15,6 @@ local MOVEMENT_PENALTY_AMOUNT = constants.MOVEMENT_PENALTY_AMOUNT
|
||||
|
||||
local MAGIC_MAXIMUM_NUMBER = constants.MAGIC_MAXIMUM_NUMBER
|
||||
|
||||
local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
|
||||
|
||||
-- imported functions
|
||||
|
||||
local canMoveChunkDirection = mapUtils.canMoveChunkDirection
|
||||
@ -56,6 +54,9 @@ function movementUtils.findMovementPositionDistort(surface, position)
|
||||
end
|
||||
|
||||
function movementUtils.addMovementPenalty(units, chunk)
|
||||
if (chunk == -1) or (squadChunk == chunk) then
|
||||
return
|
||||
end
|
||||
local penalties = units.penalties
|
||||
for i=1,#penalties do
|
||||
local penalty = penalties[i]
|
||||
@ -88,36 +89,37 @@ end
|
||||
Expects all neighbors adjacent to a chunk
|
||||
--]]
|
||||
function movementUtils.scoreNeighborsForAttack(map, chunk, neighborDirectionChunks, scoreFunction, squad)
|
||||
local highestChunk = SENTINEL_IMPASSABLE_CHUNK
|
||||
local highestChunk = -1
|
||||
local highestScore = -MAGIC_MAXIMUM_NUMBER
|
||||
local highestDirection
|
||||
|
||||
local nextHighestChunk = SENTINEL_IMPASSABLE_CHUNK
|
||||
local nextHighestChunk = -1
|
||||
local nextHighestScore = -MAGIC_MAXIMUM_NUMBER
|
||||
local nextHighestDirection
|
||||
|
||||
local natives = map.natives
|
||||
|
||||
|
||||
for x=1,8 do
|
||||
local neighborChunk = neighborDirectionChunks[x]
|
||||
|
||||
if ((neighborChunk ~= SENTINEL_IMPASSABLE_CHUNK) and canMoveChunkDirection(map, x, chunk, neighborChunk)) or
|
||||
(chunk == SENTINEL_IMPASSABLE_CHUNK) then
|
||||
local score = scoreFunction(natives, squad, neighborChunk)
|
||||
if (score > highestScore) then
|
||||
highestScore = score
|
||||
highestChunk = neighborChunk
|
||||
highestDirection = x
|
||||
if (neighborChunk ~= -1) then
|
||||
if canMoveChunkDirection(map, x, chunk, neighborChunk) or (chunk == -1) then
|
||||
local score = scoreFunction(natives, squad, neighborChunk)
|
||||
if (score > highestScore) then
|
||||
highestScore = score
|
||||
highestChunk = neighborChunk
|
||||
highestDirection = x
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (highestChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (highestChunk ~= -1) then
|
||||
neighborDirectionChunks = getNeighborChunks(map, highestChunk.x, highestChunk.y)
|
||||
for x=1,8 do
|
||||
local neighborChunk = neighborDirectionChunks[x]
|
||||
|
||||
if ((neighborChunk ~= SENTINEL_IMPASSABLE_CHUNK) and (neighborChunk ~= chunk) and
|
||||
if ((neighborChunk ~= -1) and (neighborChunk ~= chunk) and
|
||||
canMoveChunkDirection(map, x, highestChunk, neighborChunk)) then
|
||||
local score = scoreFunction(natives, squad, neighborChunk)
|
||||
if (score > nextHighestScore) then
|
||||
@ -130,7 +132,7 @@ function movementUtils.scoreNeighborsForAttack(map, chunk, neighborDirectionChun
|
||||
end
|
||||
|
||||
if (nextHighestChunk == nil) then
|
||||
nextHighestChunk = SENTINEL_IMPASSABLE_CHUNK
|
||||
nextHighestChunk = -1
|
||||
end
|
||||
|
||||
return highestChunk, highestDirection, nextHighestChunk, nextHighestDirection
|
||||
@ -141,37 +143,38 @@ end
|
||||
Expects all neighbors adjacent to a chunk
|
||||
--]]
|
||||
function movementUtils.scoreNeighborsForSettling(map, chunk, neighborDirectionChunks, scoreFunction, squad)
|
||||
local highestChunk = SENTINEL_IMPASSABLE_CHUNK
|
||||
local highestChunk = -1
|
||||
local highestScore = -MAGIC_MAXIMUM_NUMBER
|
||||
local highestDirection = 0
|
||||
|
||||
for x=1,8 do
|
||||
local neighborChunk = neighborDirectionChunks[x]
|
||||
if ((neighborChunk ~= SENTINEL_IMPASSABLE_CHUNK) and canMoveChunkDirection(map, x, chunk, neighborChunk)) or
|
||||
(chunk == SENTINEL_IMPASSABLE_CHUNK) then
|
||||
local score = scoreFunction(squad, neighborChunk)
|
||||
if (score > highestScore) then
|
||||
highestScore = score
|
||||
highestChunk = neighborChunk
|
||||
highestDirection = x
|
||||
if (neighborChunk ~= -1) then
|
||||
if canMoveChunkDirection(map, x, chunk, neighborChunk) or (chunk == -1) then
|
||||
local score = scoreFunction(squad, neighborChunk)
|
||||
if (score > highestScore) then
|
||||
highestScore = score
|
||||
highestChunk = neighborChunk
|
||||
highestDirection = x
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (scoreFunction(squad, chunk) > highestScore) then
|
||||
return chunk, 0, SENTINEL_IMPASSABLE_CHUNK, 0
|
||||
if (chunk ~= -1) and (scoreFunction(squad, chunk) > highestScore) then
|
||||
return chunk, 0, -1, 0
|
||||
end
|
||||
|
||||
local nextHighestChunk = SENTINEL_IMPASSABLE_CHUNK
|
||||
local nextHighestChunk = -1
|
||||
local nextHighestScore = -MAGIC_MAXIMUM_NUMBER
|
||||
local nextHighestDirection = 0
|
||||
|
||||
if (highestChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (highestChunk ~= -1) then
|
||||
neighborDirectionChunks = getNeighborChunks(map, highestChunk.x, highestChunk.y)
|
||||
for x=1,8 do
|
||||
local neighborChunk = neighborDirectionChunks[x]
|
||||
|
||||
if ((neighborChunk ~= SENTINEL_IMPASSABLE_CHUNK) and (neighborChunk ~= chunk) and
|
||||
if ((neighborChunk ~= -1) and (neighborChunk ~= chunk) and
|
||||
canMoveChunkDirection(map, x, highestChunk, neighborChunk)) then
|
||||
local score = scoreFunction(squad, neighborChunk)
|
||||
if (score > nextHighestScore) then
|
||||
@ -190,12 +193,12 @@ end
|
||||
Expects all neighbors adjacent to a chunk
|
||||
--]]
|
||||
function movementUtils.scoreNeighborsForResource(chunk, neighborDirectionChunks, validFunction, scoreFunction, map)
|
||||
local highestChunk = SENTINEL_IMPASSABLE_CHUNK
|
||||
local highestChunk = -1
|
||||
local highestScore = -MAGIC_MAXIMUM_NUMBER
|
||||
local highestDirection
|
||||
for x=1,8 do
|
||||
local neighborChunk = neighborDirectionChunks[x]
|
||||
if (neighborChunk ~= SENTINEL_IMPASSABLE_CHUNK) and canMoveChunkDirection(map, x, chunk, neighborChunk) and validFunction(map, chunk, neighborChunk) then
|
||||
if (neighborChunk ~= -1) and canMoveChunkDirection(map, x, chunk, neighborChunk) and validFunction(map, chunk, neighborChunk) then
|
||||
local score = scoreFunction(neighborChunk)
|
||||
if (score > highestScore) then
|
||||
highestScore = score
|
||||
@ -205,8 +208,8 @@ function movementUtils.scoreNeighborsForResource(chunk, neighborDirectionChunks,
|
||||
end
|
||||
end
|
||||
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (scoreFunction(chunk) > highestScore) then
|
||||
return SENTINEL_IMPASSABLE_CHUNK, -1
|
||||
if (chunk ~= -1) and (scoreFunction(chunk) > highestScore) then
|
||||
return -1, -1
|
||||
end
|
||||
|
||||
return highestChunk, highestDirection
|
||||
@ -216,33 +219,34 @@ end
|
||||
Expects all neighbors adjacent to a chunk
|
||||
--]]
|
||||
function movementUtils.scoreNeighborsForRetreat(chunk, neighborDirectionChunks, scoreFunction, map)
|
||||
local highestChunk = SENTINEL_IMPASSABLE_CHUNK
|
||||
local highestChunk = -1
|
||||
local highestScore = -MAGIC_MAXIMUM_NUMBER
|
||||
local highestDirection
|
||||
|
||||
local nextHighestChunk = SENTINEL_IMPASSABLE_CHUNK
|
||||
local nextHighestChunk = -1
|
||||
local nextHighestScore = -MAGIC_MAXIMUM_NUMBER
|
||||
local nextHighestDirection
|
||||
|
||||
for x=1,8 do
|
||||
local neighborChunk = neighborDirectionChunks[x]
|
||||
if ((neighborChunk ~= SENTINEL_IMPASSABLE_CHUNK) and canMoveChunkDirection(map, x, chunk, neighborChunk)) or
|
||||
(chunk == SENTINEL_IMPASSABLE_CHUNK) then
|
||||
local score = scoreFunction(map, neighborChunk)
|
||||
if (score > highestScore) then
|
||||
highestScore = score
|
||||
highestChunk = neighborChunk
|
||||
highestDirection = x
|
||||
if (neighborChunk ~= -1) then
|
||||
if canMoveChunkDirection(map, x, chunk, neighborChunk) or (chunk == -1) then
|
||||
local score = scoreFunction(map, neighborChunk)
|
||||
if (score > highestScore) then
|
||||
highestScore = score
|
||||
highestChunk = neighborChunk
|
||||
highestDirection = x
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (highestChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (highestChunk ~= -1) then
|
||||
neighborDirectionChunks = getNeighborChunks(map, highestChunk.x, highestChunk.y)
|
||||
for x=1,8 do
|
||||
local neighborChunk = neighborDirectionChunks[x]
|
||||
|
||||
if ((neighborChunk ~= SENTINEL_IMPASSABLE_CHUNK) and (neighborChunk ~= chunk) and
|
||||
if ((neighborChunk ~= -1) and (neighborChunk ~= chunk) and
|
||||
canMoveChunkDirection(map, x, highestChunk, neighborChunk)) then
|
||||
local score = scoreFunction(map, neighborChunk)
|
||||
if (score > nextHighestScore) then
|
||||
@ -255,7 +259,7 @@ function movementUtils.scoreNeighborsForRetreat(chunk, neighborDirectionChunks,
|
||||
end
|
||||
|
||||
if (nextHighestChunk == nil) then
|
||||
nextHighestChunk = SENTINEL_IMPASSABLE_CHUNK
|
||||
nextHighestChunk = -1
|
||||
end
|
||||
|
||||
return highestChunk, highestDirection, nextHighestChunk, nextHighestDirection
|
||||
@ -266,12 +270,12 @@ end
|
||||
Expects all neighbors adjacent to a chunk
|
||||
--]]
|
||||
function movementUtils.scoreNeighborsForFormation(neighborChunks, validFunction, scoreFunction, map)
|
||||
local highestChunk = SENTINEL_IMPASSABLE_CHUNK
|
||||
local highestChunk = -1
|
||||
local highestScore = -MAGIC_MAXIMUM_NUMBER
|
||||
local highestDirection
|
||||
for x=1,8 do
|
||||
local neighborChunk = neighborChunks[x]
|
||||
if (neighborChunk ~= SENTINEL_IMPASSABLE_CHUNK) and validFunction(map, neighborChunk) then
|
||||
if (neighborChunk ~= -1) and validFunction(map, neighborChunk) then
|
||||
local score = scoreFunction(neighborChunk)
|
||||
if (score > highestScore) then
|
||||
highestScore = score
|
||||
|
@ -25,7 +25,6 @@ local RESOURCE_PHEROMONE = constants.RESOURCE_PHEROMONE
|
||||
|
||||
local BUILDING_PHEROMONES = constants.BUILDING_PHEROMONES
|
||||
local VICTORY_SCENT = constants.VICTORY_SCENT
|
||||
local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
|
||||
|
||||
local PLAYER_PHEROMONE_GENERATOR_AMOUNT = constants.PLAYER_PHEROMONE_GENERATOR_AMOUNT
|
||||
|
||||
@ -116,7 +115,7 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
|
||||
if (chunkPass == CHUNK_ALL_DIRECTIONS) then
|
||||
neighbor = tempNeighbors[2]
|
||||
neighborPass = getPassable(map, neighbor)
|
||||
if ((neighbor ~= SENTINEL_IMPASSABLE_CHUNK) and
|
||||
if ((neighbor ~= -1) and
|
||||
((neighborPass == CHUNK_ALL_DIRECTIONS) or (neighborPass == CHUNK_NORTH_SOUTH))) then
|
||||
neighborCount = neighborCount + 1
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
@ -127,7 +126,7 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
|
||||
|
||||
neighbor = tempNeighbors[7]
|
||||
neighborPass = getPassable(map, neighbor)
|
||||
if ((neighbor ~= SENTINEL_IMPASSABLE_CHUNK) and
|
||||
if ((neighbor ~= -1) and
|
||||
((neighborPass == CHUNK_ALL_DIRECTIONS) or (neighborPass == CHUNK_NORTH_SOUTH))) then
|
||||
neighborCount = neighborCount + 1
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
@ -138,7 +137,7 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
|
||||
|
||||
neighbor = tempNeighbors[4]
|
||||
neighborPass = getPassable(map, neighbor)
|
||||
if ((neighbor ~= SENTINEL_IMPASSABLE_CHUNK) and
|
||||
if ((neighbor ~= -1) and
|
||||
((neighborPass == CHUNK_ALL_DIRECTIONS) or (neighborPass == CHUNK_EAST_WEST))) then
|
||||
neighborCount = neighborCount + 1
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
@ -149,7 +148,7 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
|
||||
|
||||
neighbor = tempNeighbors[5]
|
||||
neighborPass = getPassable(map, neighbor)
|
||||
if ((neighbor ~= SENTINEL_IMPASSABLE_CHUNK) and
|
||||
if ((neighbor ~= -1) and
|
||||
((neighborPass == CHUNK_ALL_DIRECTIONS) or (neighborPass == CHUNK_EAST_WEST))) then
|
||||
neighborCount = neighborCount + 1
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
@ -160,7 +159,7 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
|
||||
|
||||
neighbor = tempNeighbors[1]
|
||||
neighborPass = getPassable(map, neighbor)
|
||||
if (neighbor ~= SENTINEL_IMPASSABLE_CHUNK) and (neighborPass == CHUNK_ALL_DIRECTIONS) then
|
||||
if (neighbor ~= -1) and (neighborPass == CHUNK_ALL_DIRECTIONS) then
|
||||
neighborCount = neighborCount + 1
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
baseTotal = baseTotal + (neighbor[BASE_PHEROMONE] - chunkBase)
|
||||
@ -170,7 +169,7 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
|
||||
|
||||
neighbor = tempNeighbors[3]
|
||||
neighborPass = getPassable(map, neighbor)
|
||||
if (neighbor ~= SENTINEL_IMPASSABLE_CHUNK) and (neighborPass == CHUNK_ALL_DIRECTIONS) then
|
||||
if (neighbor ~= -1) and (neighborPass == CHUNK_ALL_DIRECTIONS) then
|
||||
neighborCount = neighborCount + 1
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
baseTotal = baseTotal + (neighbor[BASE_PHEROMONE] - chunkBase)
|
||||
@ -180,7 +179,7 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
|
||||
|
||||
neighbor = tempNeighbors[6]
|
||||
neighborPass = getPassable(map, neighbor)
|
||||
if (neighbor ~= SENTINEL_IMPASSABLE_CHUNK) and (neighborPass == CHUNK_ALL_DIRECTIONS) then
|
||||
if (neighbor ~= -1) and (neighborPass == CHUNK_ALL_DIRECTIONS) then
|
||||
neighborCount = neighborCount + 1
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
baseTotal = baseTotal + (neighbor[BASE_PHEROMONE] - chunkBase)
|
||||
@ -190,7 +189,7 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
|
||||
|
||||
neighbor = tempNeighbors[8]
|
||||
neighborPass = getPassable(map, neighbor)
|
||||
if (neighbor ~= SENTINEL_IMPASSABLE_CHUNK) and (neighborPass == CHUNK_ALL_DIRECTIONS) then
|
||||
if (neighbor ~= -1) and (neighborPass == CHUNK_ALL_DIRECTIONS) then
|
||||
neighborCount = neighborCount + 1
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
baseTotal = baseTotal + (neighbor[BASE_PHEROMONE] - chunkBase)
|
||||
@ -202,7 +201,7 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
|
||||
|
||||
neighbor = tempNeighbors[4]
|
||||
neighborPass = getPassable(map, neighbor)
|
||||
if ((neighbor ~= SENTINEL_IMPASSABLE_CHUNK) and
|
||||
if ((neighbor ~= -1) and
|
||||
((neighborPass == CHUNK_ALL_DIRECTIONS) or (neighborPass == CHUNK_EAST_WEST))) then
|
||||
neighborCount = neighborCount + 1
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
@ -213,7 +212,7 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
|
||||
|
||||
neighbor = tempNeighbors[5]
|
||||
neighborPass = getPassable(map, neighbor)
|
||||
if ((neighbor ~= SENTINEL_IMPASSABLE_CHUNK) and
|
||||
if ((neighbor ~= -1) and
|
||||
((neighborPass == CHUNK_ALL_DIRECTIONS) or (neighborPass == CHUNK_EAST_WEST))) then
|
||||
neighborCount = neighborCount + 1
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
@ -226,7 +225,7 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
|
||||
|
||||
neighbor = tempNeighbors[2]
|
||||
neighborPass = getPassable(map, neighbor)
|
||||
if ((neighbor ~= SENTINEL_IMPASSABLE_CHUNK) and
|
||||
if ((neighbor ~= -1) and
|
||||
((neighborPass == CHUNK_ALL_DIRECTIONS) or (neighborPass == CHUNK_NORTH_SOUTH))) then
|
||||
neighborCount = neighborCount + 1
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
@ -237,7 +236,7 @@ function pheromoneUtils.processPheromone(map, chunk, staging)
|
||||
|
||||
neighbor = tempNeighbors[7]
|
||||
neighborPass = getPassable(map, neighbor)
|
||||
if ((neighbor ~= SENTINEL_IMPASSABLE_CHUNK) and
|
||||
if ((neighbor ~= -1) and
|
||||
((neighborPass == CHUNK_ALL_DIRECTIONS) or (neighborPass == CHUNK_NORTH_SOUTH))) then
|
||||
neighborCount = neighborCount + 1
|
||||
movementTotal = movementTotal + (neighbor[MOVEMENT_PHEROMONE] - chunkMovement)
|
||||
|
@ -12,6 +12,7 @@ local movementUtils = require("MovementUtils")
|
||||
local mathUtils = require("MathUtils")
|
||||
local chunkPropertyUtils = require("ChunkPropertyUtils")
|
||||
local chunkUtils = require("ChunkUtils")
|
||||
local aiPredicates = require("AIPredicates")
|
||||
|
||||
-- constants
|
||||
|
||||
@ -48,14 +49,14 @@ local DEFINES_DISTRACTION_NONE = defines.distraction.none
|
||||
local DEFINES_DISTRACTION_BY_ENEMY = defines.distraction.by_enemy
|
||||
local DEFINES_DISTRACTION_BY_ANYTHING = defines.distraction.by_anything
|
||||
|
||||
local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
|
||||
|
||||
-- imported functions
|
||||
|
||||
local mRandom = math.random
|
||||
local mMin = math.min
|
||||
local tRemove = table.remove
|
||||
|
||||
local canMigrate = aiPredicates.canMigrate
|
||||
|
||||
local euclideanDistancePoints = mathUtils.euclideanDistancePoints
|
||||
|
||||
local findMovementPosition = movementUtils.findMovementPosition
|
||||
@ -134,12 +135,8 @@ local function settleMove(map, squad, surface)
|
||||
if (natives.state == AI_STATE_SIEGE) then
|
||||
scoreFunction = scoreSiegeLocation
|
||||
end
|
||||
if squad.chunk and (squad.chunk ~= SENTINEL_IMPASSABLE_CHUNK) and (squad.chunk ~= chunk) then
|
||||
addMovementPenalty(squad, squad.chunk)
|
||||
end
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
addSquadToChunk(map, chunk, squad)
|
||||
end
|
||||
addMovementPenalty(squad, squad.chunk)
|
||||
addSquadToChunk(map, chunk, squad)
|
||||
local distance = euclideanDistancePoints(groupPosition.x,
|
||||
groupPosition.y,
|
||||
squad.originPosition.x,
|
||||
@ -195,7 +192,7 @@ local function settleMove(map, squad, surface)
|
||||
scoreFunction,
|
||||
squad)
|
||||
|
||||
if (attackChunk == SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (attackChunk == -1) then
|
||||
squad.cycles = 30
|
||||
cmd = map.wonderCommand
|
||||
group.set_command(cmd)
|
||||
@ -235,7 +232,7 @@ local function settleMove(map, squad, surface)
|
||||
end
|
||||
end
|
||||
|
||||
if (nextAttackChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (nextAttackChunk ~= -1) then
|
||||
positionFromDirectionAndFlat(nextAttackDirection, targetPosition, targetPosition2)
|
||||
|
||||
position2 = findMovementPosition(surface, targetPosition2)
|
||||
@ -305,19 +302,15 @@ local function attackMove(map, squad, surface)
|
||||
or scoreAttackLocation
|
||||
|
||||
local squadChunk = squad.chunk
|
||||
if (squadChunk ~= SENTINEL_IMPASSABLE_CHUNK) and (squadChunk ~= chunk) then
|
||||
addMovementPenalty(squad, squadChunk)
|
||||
end
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK)then
|
||||
addSquadToChunk(map, chunk, squad)
|
||||
end
|
||||
addMovementPenalty(squad, squadChunk)
|
||||
addSquadToChunk(map, chunk, squad)
|
||||
squad.frenzy = (squad.frenzy and (euclideanDistanceNamed(groupPosition, squad.frenzyPosition) < 100))
|
||||
local attackChunk, attackDirection, nextAttackChunk, nextAttackDirection = scoreNeighborsForAttack(map,
|
||||
chunk,
|
||||
getNeighborChunks(map, x, y),
|
||||
attackScorer,
|
||||
squad)
|
||||
if (attackChunk == SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (attackChunk == -1) then
|
||||
squad.cycles = 30
|
||||
cmd = map.wonderCommand
|
||||
group.set_command(cmd)
|
||||
@ -359,7 +352,7 @@ local function attackMove(map, squad, surface)
|
||||
|
||||
local position2
|
||||
|
||||
if (nextAttackChunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (nextAttackChunk ~= -1) then
|
||||
positionFromDirectionAndFlat(nextAttackDirection, targetPosition, targetPosition2)
|
||||
|
||||
position2 = findMovementPosition(surface, targetPosition2)
|
||||
@ -436,9 +429,7 @@ function squadAttack.squadsDispatch(map, surface)
|
||||
attackMove(map, squad, surface)
|
||||
else
|
||||
local chunk = getChunkByPosition(map, group.position)
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
addSquadToChunk(map, chunk, squad)
|
||||
end
|
||||
addSquadToChunk(map, chunk, squad)
|
||||
end
|
||||
elseif (status == SQUAD_SETTLING) then
|
||||
x = x + 1
|
||||
@ -450,9 +441,7 @@ function squadAttack.squadsDispatch(map, surface)
|
||||
settleMove(map, squad, surface)
|
||||
else
|
||||
local chunk = getChunkByPosition(map, group.position)
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
addSquadToChunk(map, chunk, squad)
|
||||
end
|
||||
addSquadToChunk(map, chunk, squad)
|
||||
end
|
||||
elseif (status == SQUAD_RETREATING) then
|
||||
if (groupState == DEFINES_GROUP_FINISHED) or
|
||||
@ -467,9 +456,7 @@ function squadAttack.squadsDispatch(map, surface)
|
||||
squads[x] = squad
|
||||
end
|
||||
local chunk = getChunkByPosition(map, group.position)
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
addSquadToChunk(map, chunk, squad)
|
||||
end
|
||||
addSquadToChunk(map, chunk, squad)
|
||||
elseif (status == SQUAD_BUILDING) then
|
||||
removeSquadFromChunk(map, squad)
|
||||
natives.building[#natives.building+1] = squad
|
||||
@ -515,7 +502,8 @@ function squadAttack.squadsBeginAttack(natives, surface)
|
||||
local group = pendingStealGroups[i]
|
||||
if group and group.valid then
|
||||
if (group.state ~= DEFINES_GROUP_GATHERING) then
|
||||
local squad = createSquad(group.position, surface, nil, false)
|
||||
local settlers = canMigrate(natives, surface) and (mRandom() > 0.25)
|
||||
local squad = createSquad(group.position, surface, nil, settlers)
|
||||
pendingAttack.len = pendingAttack.len + 1
|
||||
pendingAttack[pendingAttack.len] = squad
|
||||
cmd.group = squad.group
|
||||
|
@ -23,8 +23,6 @@ local SQUAD_RETREATING = constants.SQUAD_RETREATING
|
||||
|
||||
local INTERVAL_RETREAT = constants.INTERVAL_RETREAT
|
||||
|
||||
local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
|
||||
|
||||
-- imported functions
|
||||
|
||||
local mRandom = math.random
|
||||
@ -92,7 +90,7 @@ function aiDefense.retreatUnits(chunk, position, squad, map, surface, tick, radi
|
||||
chunk.y),
|
||||
scoreRetreatLocation,
|
||||
map)
|
||||
if (exitPath ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (exitPath ~= -1) then
|
||||
local targetPosition = map.position
|
||||
local targetPosition2 = map.position2
|
||||
|
||||
@ -104,7 +102,7 @@ function aiDefense.retreatUnits(chunk, position, squad, map, surface, tick, radi
|
||||
return
|
||||
end
|
||||
|
||||
if (nextExitPath ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (nextExitPath ~= -1) then
|
||||
positionFromDirectionAndFlat(nextExitDirection, retreatPosition, targetPosition2)
|
||||
|
||||
local retreatPosition2 = findMovementPosition(surface, targetPosition2)
|
||||
@ -142,7 +140,7 @@ function aiDefense.retreatUnits(chunk, position, squad, map, surface, tick, radi
|
||||
end
|
||||
end
|
||||
|
||||
if not newSquad.rapid then
|
||||
if not newSquad.rabid then
|
||||
newSquad.frenzy = true
|
||||
local squadPosition = newSquad.group.position
|
||||
newSquad.frenzyPosition.x = squadPosition.x
|
||||
|
@ -28,8 +28,6 @@ local NO_RETREAT_SQUAD_SIZE_BONUS_MAX = constants.NO_RETREAT_SQUAD_SIZE_BONUS_MA
|
||||
local AI_MAX_BITER_GROUP_SIZE = constants.AI_MAX_BITER_GROUP_SIZE
|
||||
local AI_SQUAD_MERGE_THRESHOLD = constants.AI_SQUAD_MERGE_THRESHOLD
|
||||
|
||||
local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK
|
||||
|
||||
-- imported functions
|
||||
|
||||
local tRemove = table.remove
|
||||
@ -63,7 +61,7 @@ function unitGroupUtils.findNearbyRetreatingSquad(map, chunk)
|
||||
|
||||
for i=1,#neighbors do
|
||||
local neighbor = neighbors[i]
|
||||
if neighbor ~= SENTINEL_IMPASSABLE_CHUNK then
|
||||
if neighbor ~= -1 then
|
||||
squads = getSquadsOnChunk(map, neighbor)
|
||||
for squadIndex=1,#squads do
|
||||
local squad = squads[squadIndex]
|
||||
@ -92,7 +90,7 @@ function unitGroupUtils.findNearbySquad(map, chunk)
|
||||
|
||||
for i=1,#neighbors do
|
||||
local neighbor = neighbors[i]
|
||||
if neighbor ~= SENTINEL_IMPASSABLE_CHUNK then
|
||||
if neighbor ~= -1 then
|
||||
squads = getSquadsOnChunk(map, neighbor)
|
||||
for squadIndex=1,#squads do
|
||||
local squad = squads[squadIndex]
|
||||
@ -125,7 +123,7 @@ function unitGroupUtils.createSquad(position, surface, group, settlers)
|
||||
attackScoreFunction = 1,
|
||||
originPosition = {x = 0,
|
||||
y = 0},
|
||||
chunk = SENTINEL_IMPASSABLE_CHUNK
|
||||
chunk = -1
|
||||
}
|
||||
|
||||
if position then
|
||||
@ -242,7 +240,7 @@ function unitGroupUtils.regroupSquads(natives)
|
||||
local status = squad.status
|
||||
local chunk = squad.chunk
|
||||
|
||||
if (chunk ~= SENTINEL_IMPASSABLE_CHUNK) then
|
||||
if (chunk ~= -1) then
|
||||
local chunkSquads = getSquadsOnChunk(map, chunk)
|
||||
for p=1,#chunkSquads do
|
||||
local mergeSquad = chunkSquads[p]
|
||||
|
54
settings.lua
54
settings.lua
@ -465,7 +465,7 @@ data:extend({
|
||||
description = "rampant-unitBiterHealthScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-a[unit]",
|
||||
per_user = false
|
||||
@ -477,7 +477,7 @@ data:extend({
|
||||
description = "rampant-unitBiterHealingScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-a[unit]",
|
||||
per_user = false
|
||||
@ -489,7 +489,7 @@ data:extend({
|
||||
description = "rampant-unitBiterSpeedScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-b[unit]",
|
||||
per_user = false
|
||||
@ -501,7 +501,7 @@ data:extend({
|
||||
description = "rampant-unitBiterDamageScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-c[unit]",
|
||||
per_user = false
|
||||
@ -513,7 +513,7 @@ data:extend({
|
||||
description = "rampant-unitBiterRangeScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-d[unit]",
|
||||
per_user = false
|
||||
@ -525,7 +525,7 @@ data:extend({
|
||||
description = "rampant-unitSpitterHealthScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-e[unit]",
|
||||
per_user = false
|
||||
@ -537,7 +537,7 @@ data:extend({
|
||||
description = "rampant-unitSpitterHealingScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-e[unit]",
|
||||
per_user = false
|
||||
@ -549,7 +549,7 @@ data:extend({
|
||||
description = "rampant-unitSpitterSpeedScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-f[unit]",
|
||||
per_user = false
|
||||
@ -561,7 +561,7 @@ data:extend({
|
||||
description = "rampant-unitSpitterDamageScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-g[unit]",
|
||||
per_user = false
|
||||
@ -573,7 +573,7 @@ data:extend({
|
||||
description = "rampant-unitSpitterRangeScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-h[unit]",
|
||||
per_user = false
|
||||
@ -585,7 +585,7 @@ data:extend({
|
||||
description = "rampant-unitDroneHealthScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-i[unit]",
|
||||
per_user = false
|
||||
@ -597,7 +597,7 @@ data:extend({
|
||||
description = "rampant-unitDroneHealingScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-i[unit]",
|
||||
per_user = false
|
||||
@ -609,7 +609,7 @@ data:extend({
|
||||
description = "rampant-unitDroneSpeedScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-j[unit]",
|
||||
per_user = false
|
||||
@ -621,7 +621,7 @@ data:extend({
|
||||
description = "rampant-unitDroneDamageScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-k[unit]",
|
||||
per_user = false
|
||||
@ -633,7 +633,7 @@ data:extend({
|
||||
description = "rampant-unitDroneRangeScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-l[unit]",
|
||||
per_user = false
|
||||
@ -645,7 +645,7 @@ data:extend({
|
||||
description = "rampant-unitWormHealthScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-m[unit]",
|
||||
per_user = false
|
||||
@ -657,7 +657,7 @@ data:extend({
|
||||
description = "rampant-unitWormHealingScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-m[unit]",
|
||||
per_user = false
|
||||
@ -669,7 +669,7 @@ data:extend({
|
||||
description = "rampant-unitWormDamageScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-n[unit]",
|
||||
per_user = false
|
||||
@ -681,7 +681,7 @@ data:extend({
|
||||
description = "rampant-unitWormRangeScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-o[unit]",
|
||||
per_user = false
|
||||
@ -693,7 +693,7 @@ data:extend({
|
||||
description = "rampant-unitSpawnerHealthScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-p[unit]",
|
||||
per_user = false
|
||||
@ -705,7 +705,7 @@ data:extend({
|
||||
description = "rampant-unitSpawnerHealingScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-p[unit]",
|
||||
per_user = false
|
||||
@ -717,7 +717,7 @@ data:extend({
|
||||
description = "rampant-unitSpawnerOwnedScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-q[unit]",
|
||||
per_user = false
|
||||
@ -729,7 +729,7 @@ data:extend({
|
||||
description = "rampant-unitSpawnerSpawnScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-r[unit]",
|
||||
per_user = false
|
||||
@ -741,7 +741,7 @@ data:extend({
|
||||
description = "rampant-unitSpawnerRespawnScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-r[unit]",
|
||||
per_user = false
|
||||
@ -754,7 +754,7 @@ data:extend({
|
||||
description = "rampant-unitHiveRespawnScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-r[unit]",
|
||||
per_user = false
|
||||
@ -766,7 +766,7 @@ data:extend({
|
||||
description = "rampant-unitHiveHealthScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-r[unit]",
|
||||
per_user = false
|
||||
@ -778,7 +778,7 @@ data:extend({
|
||||
description = "rampant-unitHiveHealingScaler",
|
||||
setting_type = "startup",
|
||||
default_value = 1.0,
|
||||
minimum_value = 0.0,
|
||||
minimum_value = 0.0001,
|
||||
maximum_value = 100000.0,
|
||||
order = "p[modifier]-r[unit]",
|
||||
per_user = false
|
||||
|
@ -174,7 +174,7 @@ function tests.getOffsetChunk(x, y)
|
||||
end
|
||||
|
||||
function tests.aiStats()
|
||||
print(global.natives.points, game.tick, global.natives.state, global.natives.temperament, global.natives.stateTick, global.natives.temperamentTick)
|
||||
print(global.natives.points, game.tick, global.natives.state, global.natives.temperament, global.natives.stateTick, global.natives.temperamentTick, global.natives.activeNests, global.natives.activeRaidNests)
|
||||
end
|
||||
|
||||
function tests.fillableDirtTest()
|
||||
|
Loading…
x
Reference in New Issue
Block a user