-
Notifications
You must be signed in to change notification settings - Fork 198
/
fixnaked.lua
38 lines (36 loc) · 1.36 KB
/
fixnaked.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--removes unhappy thoughts due to lack of clothing
function fixnaked()
local total_fixed = 0
local total_removed = 0
for fnUnitCount,fnUnit in ipairs(dfhack.units.getCitizens()) do
if fnUnit.status.current_soul then
local found = true
local fixed = false
while found do
local emotions = fnUnit.status.current_soul.personality.emotions
found = false
for k,v in pairs(emotions) do
if v.thought == df.unit_thought_type.Uncovered
or v.thought == df.unit_thought_type.NoShirt
or v.thought == df.unit_thought_type.NoShoes
or v.thought == df.unit_thought_type.NoCloak
or v.thought == df.unit_thought_type.OldClothing
or v.thought == df.unit_thought_type.TatteredClothing
or v.thought == df.unit_thought_type.RottedClothing then
emotions:erase(k)
found = true
total_removed = total_removed + 1
fixed = true
break
end
end
end
if fixed then
total_fixed = total_fixed + 1
print(total_fixed, total_removed, dfhack.TranslateName(dfhack.units.getVisibleName(fnUnit)))
end
end
end
print("Total Fixed: "..total_fixed)
end
fixnaked()