1
0
mirror of https://github.com/veden/Rampant.git synced 2024-12-30 21:19:46 +02:00
Rampant/libs/AIPredicates.lua
2017-05-31 18:46:53 -07:00

25 lines
536 B
Lua

local aiPredicates = {}
-- imports
local constants = require("Constants")
local nocturnalUtils = require("NocturnalUtils")
-- constants
local AI_STATE_AGGRESSIVE = constants.AI_STATE_AGGRESSIVE
-- imported functions
local canAttackNocturnal = nocturnalUtils.canAttack
-- module code
function aiPredicates.canAttack(natives, surface)
return ((natives.state == AI_STATE_AGGRESSIVE) or
canAttackNocturnal(natives, surface)) and not surface.peaceful_mode and
(#natives.squads < natives.maxSquads)
end
return aiPredicates