Skip to content

Instantly share code, notes, and snippets.

@warmist
Last active December 11, 2015 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save warmist/4662735 to your computer and use it in GitHub Desktop.
Save warmist/4662735 to your computer and use it in GitHub Desktop.
A thought collector
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