mirror of
https://github.com/veden/Rampant.git
synced 2025-02-07 13:31:36 +02:00
24 lines
537 B
Lua
Executable File
24 lines
537 B
Lua
Executable File
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
|