Skip to content

Commit 4694814

Browse files
committed
check dead citizens when resurrecting citizens
1 parent 24fbf00 commit 4694814

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

changelog.txt

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Template for new versions:
3131
## New Features
3232

3333
## Fixes
34+
- `full-heal`: fix ``-r --all_citizens`` option combination not resurrecting citizens
3435

3536
## Misc Improvements
3637

full-heal.lua

+2-15
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,6 @@ if args.help then
1919
return
2020
end
2121

22-
function isCitizen(unit)
23-
-- required as dfhack.units.isCitizen() returns false for dead units
24-
local hf = df.historical_figure.find(unit.hist_figure_id)
25-
if not hf then
26-
return false
27-
end
28-
for _,link in ipairs(hf.entity_links) do
29-
if link.entity_id == df.global.plotinfo.group_id and df.histfig_entity_link_type[link:getType()] == 'MEMBER' then
30-
return true
31-
end
32-
end
33-
end
34-
3522
function addResurrectionEvent(histFigID)
3623
local event = df.history_event_hist_figure_revivedst:new()
3724
event.histfig = histFigID
@@ -48,7 +35,7 @@ function heal(unit, resurrect, keep_corpse)
4835
end
4936
if resurrect then
5037
if unit.flags2.killed and not unit.flags3.scuttle then -- scuttle appears to be applicable to just wagons, which probably shouldn't be resurrected
51-
--print("Resurrecting...")
38+
print(('Resurrecting %s'):format(dfhack.units.getReadableName(unit)))
5239
unit.flags1.inactive = false
5340
unit.flags2.slaughter = false
5441
unit.flags2.killed = false
@@ -250,7 +237,7 @@ if args.all then
250237
elseif args.all_citizens then
251238
-- can't use dfhack.units.getCitizens since we want dead ones too
252239
for _,unit in ipairs(df.global.world.units.active) do
253-
if dfhack.units.isCitizen(unit) or dfhack.units.isResident(unit) then
240+
if dfhack.units.isCitizen(unit, true) or dfhack.units.isResident(unit) then
254241
heal(unit,args.r,args.keep_corpse)
255242
end
256243
end

0 commit comments

Comments
 (0)