diff options
| author | Alexander Gavrilov | 2012-09-24 20:01:53 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-09-24 20:01:53 +0400 |
| commit | 821271383ed024dbcef469043ade36790cde89fe (patch) | |
| tree | 23f768968a18a73d730873e66fac6af853b56610 /scripts | |
| parent | 627f0368306273e21abe35d938d8fd7d43583553 (diff) | |
| download | dfhack-821271383ed024dbcef469043ade36790cde89fe.tar.gz dfhack-821271383ed024dbcef469043ade36790cde89fe.tar.bz2 dfhack-821271383ed024dbcef469043ade36790cde89fe.tar.xz | |
Add one more bad thought from siren for civilians.
Originally a Tax Collector thought, but the message sounds appropriate.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/siren.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/scripts/siren.lua b/scripts/siren.lua index 5371e3d7..30d3aa07 100644 --- a/scripts/siren.lua +++ b/scripts/siren.lua @@ -19,6 +19,8 @@ for _,v in ipairs(args) do table.insert(burrows, b) end +local in_siege = false + function is_in_burrows(pos) if #burrows == 0 then return true @@ -75,10 +77,21 @@ function stop_break(unit) end end +-- Check siege for thought purpose +for _,v in ipairs(df.global.ui.invasions.list) do + if v.flags.siege and v.flags.active then + in_siege = true + break + end +end + -- Stop rest for _,v in ipairs(df.global.world.units.active) do local x,y,z = dfhack.units.getPosition(v) - if x and not dfhack.units.isDead(v) and is_in_burrows(xyz2pos(x,y,z)) then + if x and dfhack.units.isCitizen(v) and is_in_burrows(xyz2pos(x,y,z)) then + if not in_siege and v.military.squad_index < 0 then + add_thought(v, df.unit_thought_type.LackProtection) + end wake_unit(v) stop_break(v) end |
