@@ -143,6 +143,31 @@ function makeBoneCraft(unit, workshop)
143143 return dfhack .job .addWorker (job , unit )
144144end
145145
146+ --- make shell crafts at specified workshop
147+ --- @param unit df.unit
148+ --- @param workshop df.building_workshopst
149+ --- @return boolean
150+ function makeShellCraft (unit , workshop )
151+ local job = make_job ()
152+ job .job_type = df .job_type .MakeCrafts
153+ job .mat_type = - 1
154+ job .material_category .shell = true
155+
156+ local jitem = df .job_item :new ()
157+ jitem .item_type = df .item_type .NONE
158+ jitem .mat_type = - 1
159+ jitem .mat_index = - 1
160+ jitem .quantity = 1
161+ jitem .vector_id = df .job_item_vector_id .ANY_REFUSE
162+ jitem .flags1 .unrotten = true
163+ jitem .flags2 .shell = true
164+ jitem .flags2 .body_part = true
165+ job .job_items .elements :insert (' #' , jitem )
166+
167+ assignToWorkshop (job , workshop )
168+ return dfhack .job .addWorker (job , unit )
169+ end
170+
146171--- make rock crafts at specified workshop
147172--- @param unit df.unit
148173--- @param workshop df.building_workshopst
@@ -177,6 +202,8 @@ local function categorize_craft(tab,item)
177202 tab [' skull' ] = (tab [' skull' ] or 0 ) + 1
178203 elseif item .corpse_flags .horn then
179204 tab [' horn' ] = (tab [' horn' ] or 0 ) + item .material_amount .Horn
205+ elseif item .corpse_flags .shell then
206+ tab [' shell' ] = (tab [' shell' ] or 0 ) + 1
180207 end
181208 elseif df .item_boulderst :is_instance (item ) then
182209 tab [' boulder' ] = (tab [' boulder' ] or 0 ) + 1
@@ -310,11 +337,13 @@ function select_crafting_job(workshop)
310337 tab [' bone' ] = nil
311338 tab [' skull' ] = nil
312339 tab [' horn' ] = nil
340+ tab [' shell' ] = nil
313341 end
314342 local material = weightedChoice (tab )
315343 if material == ' bone' then return makeBoneCraft
316344 elseif material == ' skull' then return makeTotem
317345 elseif material == ' horn' then return makeHornCrafts
346+ elseif material == ' shell' then return makeShellCraft
318347 elseif material == ' boulder' then return makeRockCraft
319348 else
320349 return nil
0 commit comments