I figured it out! It isn't quite as nice as vanilla, but it works!
Here is the code I use for First Landing:
-- Add hard-coded jobs to user defined workshops.
eventful.postWorkshopFillSidebarMenu.FirstLandingBase = function(workshop)
if workshop:getType() ~= df.building_type.Workshop then
return
end
local ctyp = workshop:getCustomType()
if ctyp == -1 then
return
end
local id = df.building_def_workshopst.find(ctyp).code
if id == "RESOURCE_COLLECTOR" then
-- Some stuff related to adding the collect clay and sand jobs
elseif id == "SLAB_ENGRAVER" then
local allUnits = df.global.world.units.active
local deadCitizens = {}
local deadOther = {}
for i = 0, #allUnits - 1, 1 do
if allUnits[i].flags1.dead == true and allUnits[i].hist_figure_id ~= -1 then
if allUnits[i].civ_id == df.global.ui.civ_id then
table.insert(deadCitizens, allUnits[i])
else
table.insert(deadOther, allUnits[i])
end
end
end
local mkBtn = function(unit)
new_button = df.interface_button_building_new_jobst:new()
new_button.building = workshop
new_button.job_type = df.job_type.EngraveSlab
new_button.hist_figure_id = unit.hist_figure_id
new_button.item_type = 25971 -- Slab?
new_button.unk_48 = true -- ???
local wjob = df.global.ui_sidebar_menus.workshop_job
wjob.choices_all:insert("#", new_button)
wjob.choices_visible:insert("#", new_button)
end
for _, u in ipairs(deadCitizens) do
mkBtn(u)
end
for _, u in ipairs(deadOther) do
mkBtn(u)
end
end
end