forked from DFHack/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsleepers.lua
More file actions
21 lines (19 loc) · 849 Bytes
/
sleepers.lua
File metadata and controls
21 lines (19 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- Number of fixed army controller(s) that may be shared by multiple units
local num_fixed = 0
-- Loop through all the active units currently loaded
for _, unit in ipairs(df.global.world.units.active) do
local army_controller = unit.enemy.army_controller
-- Only Campers have been observed to sleep
if army_controller and army_controller.goal == df.army_controller_goal_type.CAMP then
if not army_controller.data.goal_camp.camp_flag.ALARM_INTRUDER then
-- Intruder alert! Bloodthirsty adventurer is in the camp!
army_controller.data.goal_camp.camp_flag.ALARM_INTRUDER = true
num_fixed = num_fixed + 1
end
end
end
if num_fixed == 0 then
print ("No sleepers with the fixable bug were found, sorry.")
else
print ("Fixed " .. num_fixed .. " group(s) of sleeping units.")
end