Last active
December 11, 2015 21:28
-
-
Save warmist/4662735 to your computer and use it in GitHub Desktop.
A thought collector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local events_by_type={} | |
for k,v in pairs(df.global.world.units.active) do | |
if dfhack.units.isCitizen(v) then | |
local mytypes={} | |
for idx,event in pairs(v.status.recent_events) do | |
local t=event.type | |
if mytypes[t]==nil then | |
if events_by_type[t] then | |
events_by_type[t]=events_by_type[t]+1 | |
else | |
events_by_type[t]=1 | |
end | |
mytypes[t]=true | |
end | |
end | |
end | |
end | |
for k,v in pairs(events_by_type) do | |
print(df.unit_thought_type[k],v) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment