Skip to content

Commit 23c761a

Browse files
committed
include residents in citizens list where applicable
1 parent fa7646a commit 23c761a

11 files changed

Lines changed: 14 additions & 26 deletions

allneeds.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ if units then
2626
print(('Summarizing needs for %s:'):format(dfhack.units.getReadableName(units)))
2727
units = {units}
2828
else
29-
print('Summarizing needs for all (sane) citizens:')
30-
units = dfhack.units.getCitizens(false)
29+
print('Summarizing needs for all (sane) citizens and residents:')
30+
units = dfhack.units.getCitizens()
3131
end
3232
print()
3333

combat-harden.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function main(args)
7979
qerror('--citizens requires fortress mode')
8080
end
8181

82-
for _, unit in ipairs(dfhack.units.getCitizens(false)) do
82+
for _, unit in ipairs(dfhack.units.getCitizens()) do
8383
table.insert(unitsList, unit)
8484
end
8585
end

docs/combat-harden.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Unit options
2828
``--all``
2929
All active units will be affected.
3030
``--citizens``
31-
All citizens of your fort will be affected. Will do nothing in adventure
32-
mode.
31+
All citizens and residents of your fort will be affected. Will do nothing
32+
in adventure mode.
3333
``--unit <id>``
3434
The given unit will be affected.
3535

docs/fillneeds.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ Usage
1515
``fillneeds --unit <id>``
1616
Make the specified unit focused and unstressed.
1717
``fillneeds --all``
18-
Make all units focused and unstressed.
18+
Make all citizens and residents focused and unstressed.

fillneeds.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function satisfyNeeds(unit)
1414
end
1515

1616
if args.all then
17-
for _, unit in ipairs(dfhack.units.getCitizens(true)) do
17+
for _, unit in ipairs(dfhack.units.getCitizens()) do
1818
satisfyNeeds(unit)
1919
end
2020
else

fix/stuck-worship.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ local function get_prayer_targets(unit)
7979
end
8080
end
8181

82-
for _,unit in ipairs(dfhack.units.getCitizens(true)) do
82+
for _,unit in ipairs(dfhack.units.getCitizens(false, true)) do
8383
local prayer_targets = get_prayer_targets(unit)
8484
if not unit.status.current_soul or not prayer_targets then
8585
goto next_unit

gui/unit-syndromes.lua

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -300,18 +300,6 @@ local function getUnitSyndromes(unit)
300300
return unit_syndromes
301301
end
302302

303-
local function getCitizens()
304-
local units = {}
305-
306-
for _, unit in pairs(df.global.world.units.active) do
307-
if dfhack.units.isCitizen(unit) and dfhack.units.isDwarf(unit) then
308-
table.insert(units, unit)
309-
end
310-
end
311-
312-
return units
313-
end
314-
315303
local function getLivestock()
316304
local units = {}
317305

@@ -382,7 +370,7 @@ function UnitSyndromes:init()
382370
view_id = 'category',
383371
frame = {t = 0, l = 0},
384372
choices = {
385-
{ text = "Dwarves", get_choices = getCitizens },
373+
{ text = "Dwarves", get_choices = curry(dfhack.units.getCitizens, false, true) },
386374
{ text = "Livestock", get_choices = getLivestock },
387375
{ text = "Wild animals", get_choices = getWildAnimals },
388376
{ text = "Hostile", get_choices = getHostiles },

internal/notify/notifications.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ local function for_starving(fn, reverse)
9494
end
9595

9696
local function for_moody(fn, reverse)
97-
for_iter(dfhack.units.getCitizens(false), function(unit)
97+
for_iter(dfhack.units.getCitizens(true), function(unit)
9898
local job = unit.job.current_job
9999
return job and df.job_type_class[df.job_type.attrs[job.job_type].type] == 'StrangeMood'
100100
end, fn, reverse)

list-waves.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ local function getWave(dwf)
7878
end
7979
end
8080

81-
for _,v in ipairs(dfhack.units.getCitizens(false)) do
81+
for _,v in ipairs(dfhack.units.getCitizens(true, true)) do
8282
getWave(v)
8383
end
8484

uniform-unstick.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ local function main(args)
264264

265265
if args.all then
266266
local need_newline = false
267-
for _, unit in ipairs(dfhack.units.getCitizens(false)) do
267+
for _, unit in ipairs(dfhack.units.getCitizens(true)) do
268268
do_drop(process(unit, args, need_newline))
269269
need_newline = true
270270
end

0 commit comments

Comments
 (0)