diff --git a/README.md b/README.md index 09c7118b..d8bfbde3 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Configure Options: 0.14.13 - - Reverted: Pheromone generation tweaks from 0.14.11 - Feature: Recycling large biter swarms that are stuck (causes a big attack wave, and pops up a message) -- Feature: Biters destroying player buildings will attract other unit groups +- Feature: Breaching, Biters destroying player buildings will attract other unit groups - Tweak: Reduced unit group max size from 600 to 450 - Tweak: Reduced unit group radius from 30 to 20 - Fix: Unit groups merging during combat diff --git a/control.lua b/control.lua index 80cecef4..94934632 100644 --- a/control.lua +++ b/control.lua @@ -198,7 +198,7 @@ local function onTick(event) local players = game.players processPendingChunks(regionMap, surface, pendingChunks) - scanMap(regionMap, surface, natives, evolutionFactor, tick) + scanMap(regionMap, surface, natives, evolutionFactor) if (tick == regionMap.logicTick) then regionMap.logicTick = regionMap.logicTick + INTERVAL_LOGIC @@ -207,7 +207,7 @@ local function onTick(event) natives.retreats = MAX_RETREATS - planning(natives, evolutionFactor, tick) + planning(natives, evolutionFactor, tick, surface) regroupSquads(natives, evolutionFactor) diff --git a/libs/AIPlanning.lua b/libs/AIPlanning.lua index 9387bcda..3db816d2 100644 --- a/libs/AIPlanning.lua +++ b/libs/AIPlanning.lua @@ -18,6 +18,8 @@ local AI_MIN_TEMPERAMENT_DURATION = constants.AI_MIN_TEMPERAMENT_DURATION local AI_MAX_STATE_DURATION = constants.AI_MAX_STATE_DURATION local AI_MAX_TEMPERAMENT_DURATION = constants.AI_MAX_TEMPERAMENT_DURATION +local TICKS_A_MINUTE = constants.TICKS_A_MINUTE + -- imported functions local randomTickEvent = mathUtils.randomTickEvent @@ -26,7 +28,7 @@ local mMax = math.max -- module code -function aiPlanning.planning(natives, evolution_factor, tick) +function aiPlanning.planning(natives, evolution_factor, tick, surface) local maxPoints = AI_MAX_POINTS * evolution_factor if (natives.points < maxPoints) then natives.points = natives.points + math.floor((AI_POINT_GENERATOR_AMOUNT * math.random()) + ((AI_POINT_GENERATOR_AMOUNT * 0.7) * (evolution_factor ^ 2.5))) @@ -45,7 +47,12 @@ function aiPlanning.planning(natives, evolution_factor, tick) natives.state = AI_STATE_AGGRESSIVE end natives.stateTick = randomTickEvent(tick, AI_MIN_STATE_DURATION, AI_MAX_STATE_DURATION) - end + end + + if (natives.state == AI_STATE_AGGRESSIVE) and (tick - natives.lastShakeMessage > TICKS_A_MINUTE * 5) and (natives.points > AI_MAX_POINTS) then + natives.lastShakeMessage = tick + surface.print("Rampant: The ground begins to shake") + end end return aiPlanning diff --git a/libs/MapProcessor.lua b/libs/MapProcessor.lua index d6c2a399..21a18a18 100644 --- a/libs/MapProcessor.lua +++ b/libs/MapProcessor.lua @@ -32,8 +32,6 @@ local MOVEMENT_PHEROMONE = constants.MOVEMENT_PHEROMONE local PLAYER_BASE_GENERATOR = constants.PLAYER_BASE_GENERATOR local BUILDING_PHEROMONES = constants.BUILDING_PHEROMONES -local TICKS_A_MINUTE = constants.TICKS_A_MINUTE - -- imported functions local scents = pheromoneUtils.scents @@ -193,7 +191,7 @@ end --[[ Passive scan to find entities that have been generated outside the factorio event system --]] -function mapProcessor.scanMap(regionMap, surface, natives, evolution_factor, tick) +function mapProcessor.scanMap(regionMap, surface, natives, evolution_factor) local index = regionMap.scanPointer local processQueue = regionMap.processQueue @@ -233,11 +231,6 @@ function mapProcessor.scanMap(regionMap, surface, natives, evolution_factor, tic if (natives.points > (AI_MAX_POINTS * 3)) then natives.points = (AI_MAX_POINTS * 3) end - - if (tick - natives.lastShakeMessage > TICKS_A_MINUTE * 5) then - natives.lastShakeMessage = tick - surface.print("Rampant: The ground begins to shake") - end end local playerBaseGenerator = 0