mirror of
https://github.com/veden/Rampant.git
synced 2024-12-30 21:19:46 +02:00
22 lines
407 B
Lua
22 lines
407 B
Lua
local nocturnalUtils = {}
|
|
|
|
-- imports
|
|
|
|
local constants = require("Constants")
|
|
|
|
-- constants
|
|
|
|
local AI_STATE_NOCTURNAL = constants.AI_STATE_NOCTURNAL
|
|
|
|
-- module code
|
|
|
|
function nocturnalUtils.isDark(surface)
|
|
return surface.darkness > 0.65
|
|
end
|
|
|
|
function nocturnalUtils.canAttack(natives, surface)
|
|
return nocturnalUtils.isDark(surface) and natives.state == AI_STATE_NOCTURNAL
|
|
end
|
|
|
|
return nocturnalUtils
|