Skip to content

Commit

Permalink
adjustment to when console message appears
Browse files Browse the repository at this point in the history
  • Loading branch information
veden committed Apr 21, 2017
1 parent 9cd4766 commit 69ab6e2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -207,7 +207,7 @@ local function onTick(event)

natives.retreats = MAX_RETREATS

planning(natives, evolutionFactor, tick)
planning(natives, evolutionFactor, tick, surface)

regroupSquads(natives, evolutionFactor)

Expand Down
11 changes: 9 additions & 2 deletions libs/AIPlanning.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)))
Expand All @@ -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
9 changes: 1 addition & 8 deletions libs/MapProcessor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 69ab6e2

Please sign in to comment.