mirror of
https://github.com/veden/Rampant.git
synced 2024-12-30 21:19:46 +02:00
25 lines
536 B
Lua
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
|