What building type is nestbox...Here's not the most beautiful snippet from my constructmultiz:
function getBuildingTypeIndex(building_type_name)
local simplename = building_type_name
:gsub("_.", string.upper)
:gsub("_", "")
:gsub("<building","")
:gsub("st:.*","")
if df.building_type[simplename] then return df.building_type[simplename] end
--above fails for <building_farmplotst: 0xetcetera> resulting in Farmplot instead of FarmPlot, so...
for i = df.building_type._first_item, df.building_type._last_item do
if df.building_type[i]:lower() == simplename:lower() then
return i
end
end
end
It is not necessary for you. For nestbox, <building_nest_boxst: 0xasbadsre435a> would translate to df.building_type.NestBox - which is 48, but you already have the above just by using tostring(building).
For, say, checking an egg is hen egg, you could do df.global.world.raws.creatures.all[<eggitem>.race].caste[<eggitem>.caste].caste_name[0] to get the name of the female/male/third+ gender of the species.
Other not necessarily good options for this idea:
- I recall someone, I think Warmist (but am not sure), already has something like this? Couldn't quite manage to stop already in-process jobs from retrieving, but otherwise worked iirc.
- There's already autonestbox plugin; it'd make sense to attach this to it.
- Instead of iterating nestboxes, could disable eggs in a food stockpile whenever it is placed (less overhead, maybe) as well as disabling eggs from being cooked. Inferior from user perspective, ofc.
- You could also go over df.global.world.items.other.EGG, which contains all the eggs in a fortress. No idea how it compares to checking nestboxes.
- You could also follow around pregnant female birds and watch for them to lay eggs. Probably not optimal, though.