diff --git a/assign-preferences.lua b/assign-preferences.lua index dae521d379..86cc3fbf2f 100644 --- a/assign-preferences.lua +++ b/assign-preferences.lua @@ -29,7 +29,7 @@ end local function format_preference(pref, index) print(string.format("Preference #%d:", index)) - local pref_type = df.unit_preference.T_type[pref.type] + local pref_type = df.unitpref_type[pref.type] local description = "" if pref_type == "LikeMaterial" then description = "Likes material: " .. dfhack.matinfo.getToken(pref.mattype, pref.matindex) @@ -76,7 +76,7 @@ local preference_functions = { local ret = {} if mat_info then ret = { --luacheck:retype - type = df.unit_preference.T_type.LikeMaterial, + type = df.unitpref_type.LikeMaterial, item_type = -1, creature_id = -1, color_id = -1, @@ -109,7 +109,7 @@ local preference_functions = { local index = utils.linear_index(df.global.world.raws.creatures.all, creature_id, "creature_id") if index then return { - type = df.unit_preference.T_type.LikeCreature, + type = df.unitpref_type.LikeCreature, item_type = index, creature_id = index, color_id = index, @@ -186,7 +186,7 @@ local preference_functions = { if item_type then return { - type = df.unit_preference.T_type.LikeFood, + type = df.unitpref_type.LikeFood, item_type = item_type, creature_id = item_type, color_id = item_type, @@ -221,7 +221,7 @@ local preference_functions = { local index = utils.linear_index(df.global.world.raws.creatures.all, creature_id, "creature_id") if index then return { - type = df.unit_preference.T_type.HateCreature, + type = df.unitpref_type.HateCreature, item_type = index, creature_id = index, color_id = index, @@ -262,7 +262,7 @@ local preference_functions = { do if item_type then return { - type = df.unit_preference.T_type.LikeItem, + type = df.unitpref_type.LikeItem, item_type = item_type, creature_id = item_type, color_id = item_type, @@ -297,7 +297,7 @@ local preference_functions = { local index = utils.linear_index(df.global.world.raws.plants.all, plant_id, "id") if index then return { - type = df.unit_preference.T_type.LikePlant, + type = df.unitpref_type.LikePlant, item_type = index, creature_id = index, color_id = index, @@ -330,7 +330,7 @@ local preference_functions = { local index = utils.linear_index(df.global.world.raws.plants.all, plant_id, "id") if index then return { - type = df.unit_preference.T_type.LikeTree, + type = df.unitpref_type.LikeTree, item_type = index, creature_id = index, color_id = index, @@ -364,7 +364,7 @@ local preference_functions = { local _, found, index = utils.binsearch(df.global.world.raws.descriptors.colors, color_name, "id") if found then return { - type = df.unit_preference.T_type.LikeColor, + type = df.unitpref_type.LikeColor, item_type = index, creature_id = index, color_id = index, @@ -397,7 +397,7 @@ local preference_functions = { local index, _ = utils.linear_index(df.global.world.raws.descriptors.shapes, shape_name, "id") if index then return { - type = df.unit_preference.T_type.LikeShape, + type = df.unitpref_type.LikeShape, item_type = index, creature_id = index, color_id = index, diff --git a/autocheese.lua b/autocheese.lua index b365f3f7b1..0e9fb52215 100644 --- a/autocheese.lua +++ b/autocheese.lua @@ -18,7 +18,7 @@ function makeCheese(barrel, workshop) jitem.flags1.milk = true job.job_items.elements:insert('#', jitem) - if not dfhack.job.attachJobItem(job, barrel, df.job_item_ref.T_role.Reagent, 0, -1) then + if not dfhack.job.attachJobItem(job, barrel, df.job_role_type.Reagent, 0, -1) then dfhack.error('could not attach item') end diff --git a/deep-embark.lua b/deep-embark.lua index 1745774a9b..6738bd532f 100644 --- a/deep-embark.lua +++ b/deep-embark.lua @@ -137,7 +137,7 @@ end function moveEmbarkStuff(selectedBlock, embarkTiles) local spawnPosCentre for _, hotkey in ipairs(df.global.plotinfo.main.hotkeys) do - if hotkey.cmd == df.ui_hotkey.T_cmd.Zoom then -- the preset hotkey is centred around the spawn point + if hotkey.cmd == df.hotkey_type.Zoom then -- the preset hotkey is centred around the spawn point spawnPosCentre = xyz2pos(hotkey.x, hotkey.y, hotkey.z) hotkey:assign(embarkTiles[math.random(1, #embarkTiles)]) -- set the hotkey to the new spawn point break diff --git a/devel/export-dt-ini.lua b/devel/export-dt-ini.lua index 5d8169697b..e1ea4439b7 100644 --- a/devel/export-dt-ini.lua +++ b/devel/export-dt-ini.lua @@ -201,7 +201,7 @@ address('hist_name',df.historical_figure,'name') address('id',df.historical_figure,'id') address('hist_fig_info',df.historical_figure,'info') address('reputation',df.historical_figure_info,'reputation') -address('current_ident',df.historical_figure_info.T_reputation,'cur_identity') +address('current_ident',df.reputation_profilest,'cur_identity') address('fake_name',df.identity,'name') address('fake_birth_year',df.identity,'birth_year') address('fake_birth_time',df.identity,'birth_second') @@ -356,16 +356,16 @@ address('trans_race_vec',df.creature_interaction_effect_body_transformationst,'r header('unit_wound_offsets') address('parts',df.unit_wound,'parts') -address('id',df.unit_wound.T_parts,'body_part_id') -address('layer',df.unit_wound.T_parts,'layer_idx') +address('id',df.unit_wound_layerst,'body_part_id') +address('layer',df.unit_wound_layerst,'layer_idx') address('general_flags',df.unit_wound,'flags') -address('flags1',df.unit_wound.T_parts,'flags1') -address('flags2',df.unit_wound.T_parts,'flags2') -address('effects_vector',df.unit_wound.T_parts,'effect_type') -address('bleeding',df.unit_wound.T_parts,'bleeding') -address('pain',df.unit_wound.T_parts,'pain') -address('cur_pen',df.unit_wound.T_parts,'cur_penetration_perc') -address('max_pen',df.unit_wound.T_parts,'max_penetration_perc') +address('flags1',df.unit_wound_layerst,'flags1') +address('flags2',df.unit_wound_layerst,'flags2') +address('effects_vector',df.unit_wound_layerst,'effect_type') +address('bleeding',df.unit_wound_layerst,'bleeding') +address('pain',df.unit_wound_layerst,'pain') +address('cur_pen',df.unit_wound_layerst,'cur_penetration_perc') +address('max_pen',df.unit_wound_layerst,'max_penetration_perc') header('soul_details') address('name',df.unit_soul,'name') @@ -377,7 +377,7 @@ address('personality',df.unit_soul,'personality') address('beliefs',df.unit_personality,'values') address('emotions',df.unit_personality,'emotions') address('goals',df.unit_personality,'dreams') -address('goal_realized',df.unit_personality.T_dreams,'flags') +address('goal_realized',df.personality_goalst,'flags') address('traits',df.unit_personality,'traits') address('stress_level',df.unit_personality,'stress') address('needs',df.unit_personality,'needs') @@ -387,10 +387,10 @@ address('combat_hardened',df.unit_personality,'combat_hardened') address('likes_outdoors',df.unit_personality,'likes_outdoors') header('need_offsets') -address('id',df.unit_personality.T_needs,'id') -address('deity_id',df.unit_personality.T_needs,'deity_id') -address('focus_level',df.unit_personality.T_needs,'focus_level') -address('need_level',df.unit_personality.T_needs,'need_level') +address('id',df.personality_needst,'id') +address('deity_id',df.personality_needst,'deity_id') +address('focus_level',df.personality_needst,'focus_level') +address('need_level',df.personality_needst,'need_level') header('emotion_offsets') address('emotion_type',df.personality_moodst,'type') @@ -456,7 +456,7 @@ address('knowledge_category',df.activity_event_ponder_topicst,'topic','research' address('knowledge_flag',df.activity_event_ponder_topicst,'topic','research','flag_data') address('perf_type',df.activity_event_performancest,'type') address('perf_participants',df.activity_event_performancest,'participant_actions') -address('perf_histfig',df.activity_event_performancest.T_participant_actions,'histfig_id') +address('perf_histfig',df.performance_rolest,'histfig_id') header('art_offsets') address('name',df.poetic_form,'name') diff --git a/devel/sc.lua b/devel/sc.lua index 3c3eb7c6cc..085514fc9b 100644 --- a/devel/sc.lua +++ b/devel/sc.lua @@ -175,7 +175,6 @@ local function check_container(obj, path) if not (obj._type == df.unit_preference and k == 'item_type') and not (obj._type == df.unit.T_job and k == 'mood_skill') and not (obj._type == df.unit and k == 'idle_area_type') - and not (obj._type == df.history_event_body_abusedst.T_props) and not (field._type == df.skill_rating) and field.value >= -1 and field.value < 1024 then local key = tostring(obj._type) .. '.' .. k .. tostring(field.value) diff --git a/diplomacy.lua b/diplomacy.lua index 7b44efa4cf..512d0df4d0 100644 --- a/diplomacy.lua +++ b/diplomacy.lua @@ -7,7 +7,7 @@ local p_civ = df.historical_entity.find(df.global.plotinfo.civ_id) -- get list of civs: function get_civ_list() local civ_list = {} - for _, entity in pairs(p_civ.relations.diplomacy) do + for _, entity in ipairs(p_civ.relations.diplomacy.state) do local cur_civ_id = entity.group_id local cur_civ = df.historical_entity.find(cur_civ_id) if cur_civ.type == 0 then @@ -19,7 +19,7 @@ function get_civ_list() rel_str = "War" end matched = "No" - for _, entity2 in pairs(cur_civ.relations.diplomacy) do + for _, entity2 in ipairs(cur_civ.relations.diplomacy.state) do if entity2.group_id == p_civ_id and entity2.relation == entity.relation then matched = "Yes" end @@ -51,12 +51,12 @@ end -- change relation: function change_relation(civ_id, relation) print("Changing relation with " .. civ_id .. " to " .. (relation == 0 and "Peace" or "War")) - for _, entity in pairs(p_civ.relations.diplomacy) do + for _, entity in ipairs(p_civ.relations.diplomacy.state) do local cur_civ_id = entity.group_id local cur_civ = df.historical_entity.find(cur_civ_id) if cur_civ.type == 0 and cur_civ_id == civ_id then entity.relation = relation - for _, entity2 in pairs(cur_civ.relations.diplomacy) do + for _, entity2 in pairs(cur_civ.relations.diplomacy.state) do if entity2.group_id == p_civ_id then entity2.relation = relation end diff --git a/docs/modtools/pref-edit.rst b/docs/modtools/pref-edit.rst index c305c97a0a..cc154e117c 100644 --- a/docs/modtools/pref-edit.rst +++ b/docs/modtools/pref-edit.rst @@ -34,7 +34,7 @@ Valid filters: Include one of these to describe what the id argument represents. - ``-type ``: This describes the type of the preference. Can be entered either using the numerical ID or text id. - Run ``lua @df.unit_preference.T_type`` for a full list of valid values. + Run ``lua @df.unitpref_type`` for a full list of valid values. - ``-subtype ``: The value for an item's subtype - ``-material ``: diff --git a/exportlegends.lua b/exportlegends.lua index e4c5eedea4..3e65abd68b 100644 --- a/exportlegends.lua +++ b/exportlegends.lua @@ -717,7 +717,7 @@ local function export_more_legends_xml() file:write("\t\t<"..k..">"..escape_xml(dfhack.df2utf(df.creature_raw.find(detailV).name[0])).."\n") end elseif df.history_event_body_abusedst:is_instance(event) and (k == "abuse_data") then - if event.abuse_type == df.history_event_body_abusedst.T_abuse_type.Impaled then + if event.abuse_type == df.body_abuse_method_type.Impaled then file:write("\t\t"..tostring(df_enums.item_type[event.abuse_data.Impaled.item_type]):lower().."\n") file:write("\t\t"..getItemSubTypeName(event.abuse_data.Impaled.item_type,event.abuse_data.Impaled.item_subtype).."\n") if (event.abuse_data.Impaled.mat_type > -1) then @@ -728,16 +728,16 @@ local function export_more_legends_xml() file:write("\t\t"..dfhack.df2utf(dfhack.matinfo.toString(dfhack.matinfo.decode(event.abuse_data.Impaled.mat_type, event.abuse_data.Impaled.mat_index))).."\n") end end - elseif event.abuse_type == df.history_event_body_abusedst.T_abuse_type.Piled then - local val = df.history_event_body_abusedst.T_abuse_data.T_Piled.T_pile_type [event.abuse_data.Piled.pile_type] + elseif event.abuse_type == df.body_abuse_method_type.Piled then + local val = df.body_abuse_sculpture_type [event.abuse_data.Piled.pile_type] if not val then file:write("\t\tunknown "..tostring(event.abuse_data.Piled.pile_type).."\n") else file:write("\t\t"..tostring(val):lower().."\n") end - elseif event.abuse_type == df.history_event_body_abusedst.T_abuse_type.Flayed then + elseif event.abuse_type == df.body_abuse_method_type.Flayed then file:write("\t\t"..tostring(event.abuse_data.Flayed.structure).."\n") - elseif event.abuse_type == df.history_event_body_abusedst.T_abuse_type.Hung then + elseif event.abuse_type == df.body_abuse_method_type.Hung then file:write("\t\t"..tostring(event.abuse_data.Hung.tree).."\n") if (dfhack.matinfo.decode(event.abuse_data.Hung.mat_type, event.abuse_data.Hung.mat_index) == nil) then file:write("\t\t"..event.abuse_data.Hung.mat_type.."\n") @@ -745,8 +745,8 @@ local function export_more_legends_xml() else file:write("\t\t"..dfhack.df2utf(dfhack.matinfo.toString(dfhack.matinfo.decode(event.abuse_data.Hung.mat_type, event.abuse_data.Hung.mat_index))).."\n") end - elseif event.abuse_type == df.history_event_body_abusedst.T_abuse_type.Mutilated then -- For completeness. No fields - elseif event.abuse_type == df.history_event_body_abusedst.T_abuse_type.Animated then + elseif event.abuse_type == df.body_abuse_method_type.Mutilated then -- For completeness. No fields + elseif event.abuse_type == df.body_abuse_method_type.Animated then file:write("\t\t"..tostring(event.abuse_data.Animated.interaction).."\n") end elseif df.history_event_assume_identityst:is_instance(event) and k == "identity" then diff --git a/fix/civil-war.lua b/fix/civil-war.lua index 80086bc1b1..2f05773071 100644 --- a/fix/civil-war.lua +++ b/fix/civil-war.lua @@ -3,7 +3,7 @@ local civ = df.historical_entity.find(df.global.plotinfo.civ_id) local fixed = false -for _, entity in pairs(civ.relations.diplomacy) do +for _, entity in ipairs(civ.relations.diplomacy.state) do if entity.group_id == civ.id and entity.relation > 0 then entity.relation = 0 fixed = true diff --git a/gui/advfort.lua b/gui/advfort.lua index 125bed7ba8..7e3b6298c3 100644 --- a/gui/advfort.lua +++ b/gui/advfort.lua @@ -837,8 +837,8 @@ end function EnumItems_with_settings( args ) if settings.check_inv then return EnumItems{pos=args.from_pos,unit=args.unit, - inv={[df.unit_inventory_item.T_mode.Hauled]=settings.use_worn,[df.unit_inventory_item.T_mode.Worn]=settings.use_worn, - [df.unit_inventory_item.T_mode.Weapon]=settings.use_worn,},deep=true} + inv={[df.inv_item_role_type.Hauled]=settings.use_worn,[df.inv_item_role_type.Worn]=settings.use_worn, + [df.inv_item_role_type.Weapon]=settings.use_worn,},deep=true} else return EnumItems{pos=args.from_pos} end @@ -872,7 +872,7 @@ function find_suitable_items(job,items,job_items) if not settings.gui_item_select then if (item_counts[job_id]>0 and item_suitable) or settings.build_by_items then --cur_item.flags.in_job=true - job.items:insert("#",{new=true,item=cur_item,role=df.job_item_ref.T_role.Reagent,job_item_idx=job_id}) + job.items:insert("#",{new=true,item=cur_item,role=df.job_role_type.Reagent,job_item_idx=job_id}) item_counts[job_id]=item_counts[job_id]-cur_item:getTotalDimension() --print(string.format("item added, job_item_id=%d, item %s, quantity left=%d",job_id,tostring(cur_item),item_counts[job_id])) used_item_id[cur_item.id]=true @@ -1021,8 +1021,8 @@ end -- print("AAA FAILED!") -- return false -- end --- args.job.items[0].role=df.job_item_ref.T_role.LinkToTarget --- args.job.items[1].role=df.job_item_ref.T_role.LinkToTrigger +-- args.job.items[0].role=df.job_role_type.LinkToTarget +-- args.job.items[1].role=df.job_role_type.LinkToTrigger -- end function fake_linking(lever,building,slots) local item1=slots[1].items[1] @@ -1331,8 +1331,8 @@ end function usetool:openPutWindow(building) local adv=df.global.world.units.active[0] local items=EnumItems{pos=adv.pos,unit=adv, - inv={[df.unit_inventory_item.T_mode.Hauled]=true,--[df.unit_inventory_item.T_mode.Worn]=true, - [df.unit_inventory_item.T_mode.Weapon]=true,},deep=true} + inv={[df.inv_item_role_type.Hauled]=true,--[df.inv_item_role_type.Worn]=true, + [df.inv_item_role_type.Weapon]=true,},deep=true} local choices={} for k,v in pairs(items) do table.insert(choices,{text=dfhack.items.getDescription(v,0),item=v}) diff --git a/gui/civ-alert.lua b/gui/civ-alert.lua index 6e4b0cef79..45efacf4eb 100644 --- a/gui/civ-alert.lua +++ b/gui/civ-alert.lua @@ -9,7 +9,7 @@ local widgets = require('gui.widgets') local function get_civ_alert() local list = df.global.plotinfo.alerts.list while #list < 2 do - local list_item = df.plotinfost.T_alerts.T_list:new() + local list_item = df.alert_statest:new() list_item.id = df.global.plotinfo.alerts.next_id df.global.plotinfo.alerts.next_id = df.global.plotinfo.alerts.next_id + 1 list_item.name = 'civ-alert' diff --git a/gui/notify.lua b/gui/notify.lua index cc469d1480..d9b3eaa163 100644 --- a/gui/notify.lua +++ b/gui/notify.lua @@ -161,7 +161,7 @@ AdvNotifyOverlay.ATTRS{ function AdvNotifyOverlay:set_width() local desired_width = 13 - if df.global.adventure.player_control_state ~= df.adventurest.T_player_control_state.TAKING_INPUT then + if df.global.adventure.player_control_state ~= df.adventure_game_loop_type.TAKING_INPUT then local offset = self.frame_parent_rect.width > 137 and 26 or (self.frame_parent_rect.width+1) // 2 - 43 desired_width = self.frame_parent_rect.width // 2 + offset diff --git a/gui/sandbox.lua b/gui/sandbox.lua index e99e3d3a64..8418c79377 100644 --- a/gui/sandbox.lua +++ b/gui/sandbox.lua @@ -448,7 +448,7 @@ local function init_arena() if #list > list_size then utils.assign(list[list_size], element) else - element.new = df.embark_item_choice.T_list + element.new = df.itinfost list:insert('#', element) end list_size = list_size + 1 diff --git a/immortal-cravings.lua b/immortal-cravings.lua index 5ec1519931..2b76ee4646 100644 --- a/immortal-cravings.lua +++ b/immortal-cravings.lua @@ -74,7 +74,7 @@ local function goDrink(unit) job.flags.special = true local dx, dy, dz = dfhack.items.getPosition(drink) job.pos = xyz2pos(dx, dy, dz) - if not dfhack.job.attachJobItem(job, drink, df.job_item_ref.T_role.Other, -1, -1) then + if not dfhack.job.attachJobItem(job, drink, df.job_role_type.Other, -1, -1) then error('could not attach drink') return end @@ -96,7 +96,7 @@ local function goEat(unit) job.flags.special = true local dx, dy, dz = dfhack.items.getPosition(meal) job.pos = xyz2pos(dx, dy, dz) - if not dfhack.job.attachJobItem(job, meal, df.job_item_ref.T_role.Other, -1, -1) then + if not dfhack.job.attachJobItem(job, meal, df.job_role_type.Other, -1, -1) then error('could not attach meal') return end diff --git a/internal/advfort/advfort_items.lua b/internal/advfort/advfort_items.lua index e89cd8e9f1..32131521c3 100644 --- a/internal/advfort/advfort_items.lua +++ b/internal/advfort/advfort_items.lua @@ -189,7 +189,7 @@ function jobitemEditor:commit() for _,slot in pairs(self.slots) do if slot.id == orderedSlotID then for _1,cur_item in pairs(slot.items) do - self.job.items:insert("#",{new=true,item=cur_item,role=df.job_item_ref.T_role.Reagent,job_item_idx=slot.id}) + self.job.items:insert("#",{new=true,item=cur_item,role=df.job_role_type.Reagent,job_item_idx=slot.id}) end end end diff --git a/internal/advtools/fastcombat.lua b/internal/advtools/fastcombat.lua index 2b9cd184f0..f9d87c6868 100644 --- a/internal/advtools/fastcombat.lua +++ b/internal/advtools/fastcombat.lua @@ -30,7 +30,7 @@ function AdvCombatOverlay:preUpdateLayout(parent_rect) end function AdvCombatOverlay:render(dc) - if df.global.adventure.player_control_state == df.adventurest.T_player_control_state.TAKING_INPUT then + if df.global.adventure.player_control_state == df.adventure_game_loop_type.TAKING_INPUT then self.skip_combat = false return end @@ -62,7 +62,7 @@ local COMBAT_MOVE_KEYS = { function AdvCombatOverlay:onInput(keys) for code,_ in pairs(keys) do if not COMBAT_MOVE_KEYS[code] then goto continue end - if df.global.adventure.player_control_state ~= df.adventurest.T_player_control_state.TAKING_INPUT then + if df.global.adventure.player_control_state ~= df.adventure_game_loop_type.TAKING_INPUT then -- Instantly speed up the combat self.skip_combat = true elseif df.global.world.status.temp_flag.adv_showing_announcements then diff --git a/internal/caravan/common.lua b/internal/caravan/common.lua index 061accb5a5..ec53bd585e 100644 --- a/internal/caravan/common.lua +++ b/internal/caravan/common.lua @@ -335,7 +335,7 @@ end function get_banned_items() local banned_items = {} for _, mandate in ipairs(df.global.world.mandates) do - if mandate.mode == df.mandate.T_mode.Export then + if mandate.mode == df.mandate_type.Export then register_item_type(banned_items, mandate) end end @@ -344,7 +344,7 @@ end local function analyze_noble(unit, risky_items, banned_items) for _, preference in ipairs(unit.status.current_soul.preferences) do - if preference.type == df.unit_preference.T_type.LikeItem and + if preference.type == df.unitpref_type.LikeItem and preference.active then register_item_type(risky_items, preference, banned_items) diff --git a/internal/confirm/specs.lua b/internal/confirm/specs.lua index 3fb9ed13c4..67628222aa 100644 --- a/internal/confirm/specs.lua +++ b/internal/confirm/specs.lua @@ -367,7 +367,7 @@ ConfirmSpec{ local max_visible_buttons = num_sections // 2 if selected_offset >= max_visible_buttons or selected_idx >= num_hotkeys or - plotinfo.main.hotkeys[selected_idx].cmd == df.ui_hotkey.T_cmd.None + plotinfo.main.hotkeys[selected_idx].cmd == df.hotkey_type.None then return false end diff --git a/internal/exportlegends/racefilter.lua b/internal/exportlegends/racefilter.lua index 7270396c23..48af2be76c 100644 --- a/internal/exportlegends/racefilter.lua +++ b/internal/exportlegends/racefilter.lua @@ -106,7 +106,7 @@ end local function is_hf_page(scr, page) page = page or get_cur_page(scr) - return page.mode == df.legend_pagest.T_mode.HFS and page.index == -1 + return page.mode == df.legends_mode_type.HFS and page.index == -1 end function RaceFilterOverlay:render(dc) diff --git a/internal/notify/notifications.lua b/internal/notify/notifications.lua index e992feb2e7..b053689bd4 100644 --- a/internal/notify/notifications.lua +++ b/internal/notify/notifications.lua @@ -384,7 +384,7 @@ NOTIFICATIONS_BY_IDX = { dwarf_fn=function() local count = 0 for _, mandate in ipairs(df.global.world.mandates) do - if mandate.mode == df.mandate.T_mode.Make and + if mandate.mode == df.mandate_type.Make and mandate.timeout_limit - mandate.timeout_counter < 2500 then count = count + 1 diff --git a/internal/quickfort/place.lua b/internal/quickfort/place.lua index c3533103f4..e9bc42a179 100644 --- a/internal/quickfort/place.lua +++ b/internal/quickfort/place.lua @@ -155,7 +155,7 @@ local function make_db_entry(keys) num_barrels=num_barrels, num_wheelbarrows=num_wheelbarrows, links={give_to={}, take_from={}}, - props={}, + props={storage={}}, adjustments={}, logistics={}, } @@ -192,12 +192,12 @@ local function custom_stockpile(_, keys) end end - -- convert from older parsing style to properties - db_entry.props.max_barrels = db_entry.num_barrels + -- convert to assign()able properties + db_entry.props.storage.max_barrels = db_entry.num_barrels db_entry.num_barrels = nil - db_entry.props.max_bins = db_entry.num_bins + db_entry.props.storage.max_bins = db_entry.num_bins db_entry.num_bins = nil - db_entry.props.max_wheelbarrows = db_entry.num_wheelbarrows + db_entry.props.storage.max_wheelbarrows = db_entry.num_wheelbarrows db_entry.num_wheelbarrows = nil -- alias properties @@ -215,15 +215,15 @@ local function custom_stockpile(_, keys) -- actual properties if props.barrels then - db_entry.props.max_barrels = tonumber(props.barrels) + db_entry.props.storage.max_barrels = tonumber(props.barrels) props.barrels = nil end if props.bins then - db_entry.props.max_bins = tonumber(props.bins) + db_entry.props.storage.max_bins = tonumber(props.bins) props.bins = nil end if props.wheelbarrows then - db_entry.props.max_wheelbarrows = tonumber(props.wheelbarrows) + db_entry.props.storage.max_wheelbarrows = tonumber(props.wheelbarrows) props.wheelbarrows = nil end if props.links_only == 'true' then @@ -268,24 +268,25 @@ local function configure_stockpile(bld, db_entry) end local function init_containers(db_entry, ntiles) - if db_entry.want_barrels or db_entry.props.max_barrels then - local max_barrels = db_entry.props.max_barrels or + local storage = db_entry.props.storage + if db_entry.want_barrels or storage.max_barrels then + local max_barrels = storage.max_barrels or quickfort_set.get_setting('stockpiles_max_barrels') - db_entry.props.max_barrels = (max_barrels < 0 or max_barrels >= ntiles) and ntiles or max_barrels - log('barrels set to %d', db_entry.props.max_barrels) + storage.max_barrels = (max_barrels < 0 or max_barrels >= ntiles) and ntiles or max_barrels + log('barrels set to %d', storage.max_barrels) end - if db_entry.want_bins or db_entry.props.max_bins then - local max_bins = db_entry.props.max_bins or + if db_entry.want_bins or storage.max_bins then + local max_bins = storage.max_bins or quickfort_set.get_setting('stockpiles_max_bins') - db_entry.props.max_bins = (max_bins < 0 or max_bins >= ntiles) and ntiles or max_bins - log('bins set to %d', db_entry.props.max_bins) + storage.max_bins = (max_bins < 0 or max_bins >= ntiles) and ntiles or max_bins + log('bins set to %d', storage.max_bins) end - if db_entry.want_wheelbarrows or db_entry.props.max_wheelbarrows then - local max_wb = db_entry.props.max_wheelbarrows or + if db_entry.want_wheelbarrows or storage.max_wheelbarrows then + local max_wb = storage.max_wheelbarrows or quickfort_set.get_setting('stockpiles_max_wheelbarrows') if max_wb < 0 then max_wb = 1 end - db_entry.props.max_wheelbarrows = (max_wb >= ntiles - 1) and ntiles-1 or max_wb - log('wheelbarrows set to %d', db_entry.props.max_wheelbarrows) + storage.max_wheelbarrows = (max_wb >= ntiles - 1) and ntiles-1 or max_wb + log('wheelbarrows set to %d', storage.max_wheelbarrows) end end @@ -456,7 +457,7 @@ function do_orders(zlevel, grid, ctx) local db_entry = s.db_entry local props = db_entry.props or {} quickfort_orders.enqueue_container_orders(ctx, - props.max_bins, props.max_barrels, props.max_wheelbarrows) + props.storage.max_bins, props.storage.max_barrels, props.storage.max_wheelbarrows) end end diff --git a/internal/quickfort/zone.lua b/internal/quickfort/zone.lua index dbb2522cf8..0900d57f8d 100644 --- a/internal/quickfort/zone.lua +++ b/internal/quickfort/zone.lua @@ -61,11 +61,11 @@ end local function parse_tomb_props(zone_data, props) if props.pets == 'true' then - ensure_keys(zone_data, 'zone_settings', 'tomb').no_pets = false + ensure_keys(zone_data, 'zone_settings', 'tomb', 'flags').no_pets = false props.pets = nil end if props.citizens == 'false' then - ensure_keys(zone_data, 'zone_settings', 'tomb').no_citizens = true + ensure_keys(zone_data, 'zone_settings', 'tomb', 'flags').no_citizens = true props.citizens = nil end end @@ -106,7 +106,7 @@ local zone_db_raw = { b={label='Bedroom', default_data={type=df.civzone_type.Bedroom}}, h={label='Dining Hall', default_data={type=df.civzone_type.DiningHall}}, n={label='Pen/Pasture', default_data={type=df.civzone_type.Pen, - assign={zone_settings={pen={check_occupants=true}}}}}, + assign={zone_settings={pen={flags={check_occupants=true}}}}}}, p={label='Pit/Pond', props_fn=parse_pit_pond_props, default_data={type=df.civzone_type.Pond, assign={zone_settings={pond={flag={keep_filled=true}}}}}}, w={label='Water Source', default_data={type=df.civzone_type.WaterSource}}, @@ -121,7 +121,7 @@ local zone_db_raw = { d={label='Garbage Dump', default_data={type=df.civzone_type.Dump}}, t={label='Animal Training', default_data={type=df.civzone_type.AnimalTraining}}, T={label='Tomb', props_fn=parse_tomb_props, default_data={type=df.civzone_type.Tomb, - assign={zone_settings={tomb={whole=1}}}}}, + assign={zone_settings={tomb={flags={whole=1}}}}}}, g={label='Gather/Pick Fruit', props_fn=parse_gather_props, default_data={type=df.civzone_type.PlantGathering, assign={zone_settings={gather={flags={pick_trees=true, pick_shrubs=true, gather_fallen=true}}}}}}, c={label='Clay', default_data={type=df.civzone_type.ClayCollection}}, diff --git a/lever.lua b/lever.lua index 28cb52e590..39e9be9e53 100644 --- a/lever.lua +++ b/lever.lua @@ -35,6 +35,12 @@ function leverPullInstant(lever) end end +local flag_names = { + [df.building_type.Bridge]={closed="raised", closing="raising", opening="lowering"}, + [df.building_type.Weapon]={closed="retracted", closing="retracting", opening="unretracting"}, +} +setmetatable(flag_names, {__index=function() return {closed="closed", closing="closing", opening="opening"} end}) + function leverDescribe(lever) local lever_name = '' if #lever.name > 0 then @@ -70,23 +76,18 @@ function leverDescribe(lever) for _, m in ipairs(lever.linked_mechanisms) do local tref = dfhack.items.getGeneralRef(m, df.general_ref_type.BUILDING_HOLDER) if tref then - tg = tref:getBuilding() + local tg = tref:getBuilding() if pcall(function() return tg.gate_flags end) then - if tg.gate_flags.closed then - state = "closed" - else - state = "opened" - end + local btype = tg:getType() + state = flag_names[btype].closed - if tg.gate_flags.closing then - state = state .. (', closing (%d)'):format(tg.timer) + if tg.gate_flags[flag_names[btype].closing] then + state = state .. (', %s (%d)'):format(flag_names[btype].closing, tg.timer) + elseif tg.gate_flags[flag_names[btype].opening] then + state = state .. (', %s (%d)'):format(flag_names[btype].opening, tg.timer) end - if tg.gate_flags.opening then - state = state .. (', opening (%d)'):format(tg.timer) - end - end t = t .. diff --git a/load-save.lua b/load-save.lua index 47d5faf46a..1fff6953e0 100644 --- a/load-save.lua +++ b/load-save.lua @@ -12,7 +12,7 @@ if not loadgame_screen then end local found = false for idx, item in ipairs(title_screen.menu_line_id) do - if item == df.viewscreen_titlest.T_menu_line_id.Continue then + if item == df.main_choice_type.Continue then found = true title_screen.sel_menu_line = idx break diff --git a/makeown.lua b/makeown.lua index 5265287253..a0cbae4a71 100644 --- a/makeown.lua +++ b/makeown.lua @@ -46,7 +46,7 @@ local function fix_clothing_ownership(unit) for _, inv_item in ipairs(unit.inventory) do local item = inv_item.item -- only act on worn items, not weapons - if inv_item.mode == df.unit_inventory_item.T_mode.Worn and + if inv_item.mode == df.inv_item_role_type.Worn and not dfhack.items.getOwner(item) and dfhack.items.setOwner(item, unit) then diff --git a/modtools/create-unit.lua b/modtools/create-unit.lua index 8f5b623caf..e612d3d894 100644 --- a/modtools/create-unit.lua +++ b/modtools/create-unit.lua @@ -50,7 +50,7 @@ function createUnit(raceStr, casteStr, pos, locationRange, locationType, age, do if entityRawName and entityRawName~="" then local isValidRawName - for k,v in ipairs(df.global.world.raws.entities) do + for k,v in ipairs(df.global.world.raws.entities.all) do if v.code == entityRawName then isValidRawName = true break @@ -601,7 +601,7 @@ function nameUnit(unit, entityRawName) --choose three random words in the appropriate things local entity_raw if entityRawName and entityRawName~="" then - for k,v in ipairs(df.global.world.raws.entities) do + for k,v in ipairs(df.global.world.raws.entities.all) do if v.code == entityRawName then entity_raw = v break diff --git a/modtools/equip-item.lua b/modtools/equip-item.lua index eca12201ee..ad8e916487 100644 --- a/modtools/equip-item.lua +++ b/modtools/equip-item.lua @@ -94,6 +94,6 @@ if not part then end local mode = args.mode -mode = df.unit_inventory_item.T_mode[mode] --luacheck: retype +mode = df.inv_item_role_type[mode] --luacheck: retype equipItem(unit, item, partId, mode) diff --git a/modtools/item-trigger.lua b/modtools/item-trigger.lua index 5ccb91bd42..290dbc224a 100644 --- a/modtools/item-trigger.lua +++ b/modtools/item-trigger.lua @@ -65,7 +65,7 @@ function compareInvModes(reqMode, itemMode) if reqMode == nil then return end - if not tonumber(reqMode) and df.unit_inventory_item.T_mode[itemMode] == tostring(reqMode) then + if not tonumber(reqMode) and df.inv_item_role_type[itemMode] == tostring(reqMode) then return true elseif tonumber(reqMode) == itemMode then return true @@ -217,7 +217,7 @@ eventful.onUnitAttack.attackTrigger = function(attacker, defender, wound) local attackerWeapon for _, item in ipairs(attacker.inventory) do - if item.mode == df.unit_inventory_item.T_mode.Weapon then + if item.mode == df.inv_item_role_type.Weapon then attackerWeapon = item.item break end diff --git a/modtools/moddable-gods.lua b/modtools/moddable-gods.lua index 5d783f397f..3d1726ba10 100644 --- a/modtools/moddable-gods.lua +++ b/modtools/moddable-gods.lua @@ -77,7 +77,7 @@ godFig.id = df.global.hist_figure_next_id df.global.hist_figure_next_id = 1+df.global.hist_figure_next_id godFig.info = df.historical_figure_info:new() godFig.info.spheres = {new=true} -godFig.info.known_info = df.historical_figure_info.T_known_info:new() +godFig.info.known_info = df.knowledge_profilest:new() godFig.race = race godFig.caste = 0 godFig.sex = gender diff --git a/modtools/pref-edit.lua b/modtools/pref-edit.lua index a8638932fe..471930a7ca 100644 --- a/modtools/pref-edit.lua +++ b/modtools/pref-edit.lua @@ -35,7 +35,7 @@ Valid filters: Include one of these to describe what the id argument represents. - ``-type ``: This describes the type of the preference. Can be entered either using the numerical ID or text id. - Run ``lua @df.unit_preference.T_type`` for a full list of valid values. + Run ``lua @df.unitpref_type`` for a full list of valid values. - ``-subtype ``: The value for an item's subtype - ``-material ``: @@ -267,7 +267,7 @@ function main(...) if args.type and tonumber(args.type) then type = tonumber(args.type) elseif args.type then - type = df.unit_preference.T_type[args.type] + type = df.unitpref_type[args.type] end -- Handle material diff --git a/pref-adjust.lua b/pref-adjust.lua index b06804f6cf..22b3b3b70d 100644 --- a/pref-adjust.lua +++ b/pref-adjust.lua @@ -6,7 +6,7 @@ pss_counter = pss_counter or 31415926 -- --------------------------------------------------------------------------- function insert_preference(unit, preftype, val1) - if preftype == df.unit_preference.T_type.LikeMaterial then + if preftype == df.unitpref_type.LikeMaterial then utils.insert_or_update(unit.status.current_soul.preferences, { new = true, type = preftype, @@ -18,7 +18,7 @@ function insert_preference(unit, preftype, val1) prefstring_seed = pss_counter, }, 'prefstring_seed') -- mattype for some is non zero, those non-inorganic like creature:gazelle:hoof is 42,344 - elseif preftype == df.unit_preference.T_type.LikeFood then + elseif preftype == df.unitpref_type.LikeFood then consumable_type = val1[1] consumable_name = val1[2] utils.insert_or_update(unit.status.current_soul.preferences, { @@ -32,7 +32,7 @@ function insert_preference(unit, preftype, val1) active = true, prefstring_seed = pss_counter, }, 'prefstring_seed') - elseif df.unit_preference.T_type[preftype] ~= nil then + elseif df.unitpref_type[preftype] ~= nil then utils.insert_or_update(unit.status.current_soul.preferences, { new = true, type = preftype, @@ -61,68 +61,68 @@ function brainwash_unit(unit, profile) if profile == "IDEAL" then -- Material Likes: IRON(0),STEEL(8),ADAMANTINE(25) - insert_preference(unit, df.unit_preference.T_type.LikeMaterial, "IRON") - insert_preference(unit, df.unit_preference.T_type.LikeMaterial, "STEEL") - -- insert_preference(unit, df.unit_preference.T_type.LikeMaterial, "ADAMANTINE") + insert_preference(unit, df.unitpref_type.LikeMaterial, "IRON") + insert_preference(unit, df.unitpref_type.LikeMaterial, "STEEL") + -- insert_preference(unit, df.unitpref_type.LikeMaterial, "ADAMANTINE") -- Item likes: (WEAPON, ARMOR, SHIELD) - insert_preference(unit, df.unit_preference.T_type.LikeItem, df.item_type.WEAPON) - insert_preference(unit, df.unit_preference.T_type.LikeItem, df.item_type.ARMOR) - insert_preference(unit, df.unit_preference.T_type.LikeItem, df.item_type.SHIELD) + insert_preference(unit, df.unitpref_type.LikeItem, df.item_type.WEAPON) + insert_preference(unit, df.unitpref_type.LikeItem, df.item_type.ARMOR) + insert_preference(unit, df.unitpref_type.LikeItem, df.item_type.SHIELD) -- Plant Likes: "Likes plump helmets for their rounded tops" - insert_preference(unit, df.unit_preference.T_type.LikePlant, dfhack.matinfo.find("MUSHROOM_HELMET_PLUMP:STRUCTURAL").index) - -- insert_preference(unit, df.unit_preference.T_type.LikePlant, dfhack.matinfo.find("PEACH").index) + insert_preference(unit, df.unitpref_type.LikePlant, dfhack.matinfo.find("MUSHROOM_HELMET_PLUMP:STRUCTURAL").index) + -- insert_preference(unit, df.unitpref_type.LikePlant, dfhack.matinfo.find("PEACH").index) -- Prefers to consume drink: (From plump helmets we get dwarven wine) - insert_preference(unit, df.unit_preference.T_type.LikeFood, {df.item_type.DRINK, "MUSHROOM_HELMET_PLUMP:DRINK"}) + insert_preference(unit, df.unitpref_type.LikeFood, {df.item_type.DRINK, "MUSHROOM_HELMET_PLUMP:DRINK"}) -- Prefers to consume food: (plump helmets, mushrooms) - insert_preference(unit, df.unit_preference.T_type.LikeFood, {df.item_type.PLANT, "MUSHROOM_HELMET_PLUMP:MUSHROOM"}) + insert_preference(unit, df.unitpref_type.LikeFood, {df.item_type.PLANT, "MUSHROOM_HELMET_PLUMP:MUSHROOM"}) -- Prefers to consume prepared meals: (quarry bush) - insert_preference(unit, df.unit_preference.T_type.LikeFood, {df.item_type.FOOD, "BUSH_QUARRY"}) + insert_preference(unit, df.unitpref_type.LikeFood, {df.item_type.FOOD, "BUSH_QUARRY"}) -- Creature detests (TROLL, BIRD_BUZZARD, BIRD_VULTURE, CRUNDLE) - insert_preference(unit, df.unit_preference.T_type.HateCreature, list_of_creatures.TROLL) - insert_preference(unit, df.unit_preference.T_type.HateCreature, list_of_creatures.BIRD_BUZZARD) - insert_preference(unit, df.unit_preference.T_type.HateCreature, list_of_creatures.BIRD_VULTURE) - insert_preference(unit, df.unit_preference.T_type.HateCreature, list_of_creatures.CRUNDLE) + insert_preference(unit, df.unitpref_type.HateCreature, list_of_creatures.TROLL) + insert_preference(unit, df.unitpref_type.HateCreature, list_of_creatures.BIRD_BUZZARD) + insert_preference(unit, df.unitpref_type.HateCreature, list_of_creatures.BIRD_VULTURE) + insert_preference(unit, df.unitpref_type.HateCreature, list_of_creatures.CRUNDLE) if #df.global.world.poetic_forms.all > 0 then - insert_preference(unit, df.unit_preference.T_type.LikePoeticForm, 0) -- this just inserts the first song out of typically many. + insert_preference(unit, df.unitpref_type.LikePoeticForm, 0) -- this just inserts the first song out of typically many. end if #df.global.world.musical_forms.all > 0 then - insert_preference(unit, df.unit_preference.T_type.LikeMusicalForm, 0) -- same goes for music + insert_preference(unit, df.unitpref_type.LikeMusicalForm, 0) -- same goes for music end if #df.global.world.dance_forms.all > 0 then - insert_preference(unit, df.unit_preference.T_type.LikeDanceForm, 0) -- and dancing + insert_preference(unit, df.unitpref_type.LikeDanceForm, 0) -- and dancing end -- end IDEAL profile elseif profile == "GOTH" then - insert_preference(unit, df.unit_preference.T_type.LikeMaterial, "CREATURE:DWARF:SKIN") - insert_preference(unit, df.unit_preference.T_type.LikeItem, df.item_type.CORPSE) - insert_preference(unit, df.unit_preference.T_type.LikeItem, df.item_type.CORPSEPIECE) - insert_preference(unit, df.unit_preference.T_type.LikeItem, df.item_type.REMAINS) - insert_preference(unit, df.unit_preference.T_type.LikeItem, df.item_type.COFFIN) - insert_preference(unit, df.unit_preference.T_type.LikeColor, list_of_colors.BLACK) - insert_preference(unit, df.unit_preference.T_type.LikeShape, list_of_shapes.CROSS) - insert_preference(unit, df.unit_preference.T_type.LikePlant, dfhack.matinfo.find("GLUMPRONG").index) - insert_preference(unit, df.unit_preference.T_type.LikeFood, {df.item_type.DRINK, "WEED_RAT:DRINK"}) - insert_preference(unit, df.unit_preference.T_type.LikeFood, {df.item_type.DRINK, "SLIVER_BARB:DRINK"}) - insert_preference(unit, df.unit_preference.T_type.LikeFood, {df.item_type.PLANT, "TUBER_BLOATED:STRUCTURAL"}) - insert_preference(unit, df.unit_preference.T_type.HateCreature, list_of_creatures.ELF) - insert_preference(unit, df.unit_preference.T_type.HateCreature, list_of_creatures.HUMAN) - insert_preference(unit, df.unit_preference.T_type.HateCreature, list_of_creatures.DWARF) + insert_preference(unit, df.unitpref_type.LikeMaterial, "CREATURE:DWARF:SKIN") + insert_preference(unit, df.unitpref_type.LikeItem, df.item_type.CORPSE) + insert_preference(unit, df.unitpref_type.LikeItem, df.item_type.CORPSEPIECE) + insert_preference(unit, df.unitpref_type.LikeItem, df.item_type.REMAINS) + insert_preference(unit, df.unitpref_type.LikeItem, df.item_type.COFFIN) + insert_preference(unit, df.unitpref_type.LikeColor, list_of_colors.BLACK) + insert_preference(unit, df.unitpref_type.LikeShape, list_of_shapes.CROSS) + insert_preference(unit, df.unitpref_type.LikePlant, dfhack.matinfo.find("GLUMPRONG").index) + insert_preference(unit, df.unitpref_type.LikeFood, {df.item_type.DRINK, "WEED_RAT:DRINK"}) + insert_preference(unit, df.unitpref_type.LikeFood, {df.item_type.DRINK, "SLIVER_BARB:DRINK"}) + insert_preference(unit, df.unitpref_type.LikeFood, {df.item_type.PLANT, "TUBER_BLOATED:STRUCTURAL"}) + insert_preference(unit, df.unitpref_type.HateCreature, list_of_creatures.ELF) + insert_preference(unit, df.unitpref_type.HateCreature, list_of_creatures.HUMAN) + insert_preference(unit, df.unitpref_type.HateCreature, list_of_creatures.DWARF) if list_of_creatures.DEMON_1 and df.global.world.raws.creatures.all[list_of_creatures.DEMON_1].prefstring[0] ~= '' then - insert_preference(unit, df.unit_preference.T_type.LikeCreature, list_of_creatures.DEMON_1) + insert_preference(unit, df.unitpref_type.LikeCreature, list_of_creatures.DEMON_1) end if #df.global.world.poetic_forms.all > 0 then - insert_preference(unit, df.unit_preference.T_type.LikePoeticForm, #df.global.world.poetic_forms.all - 1) -- this just inserts the last song out of typically many. + insert_preference(unit, df.unitpref_type.LikePoeticForm, #df.global.world.poetic_forms.all - 1) -- this just inserts the last song out of typically many. end if #df.global.world.musical_forms.all > 0 then - insert_preference(unit, df.unit_preference.T_type.LikeMusicalForm, #df.global.world.musical_forms.all - 1) -- same goes for music + insert_preference(unit, df.unitpref_type.LikeMusicalForm, #df.global.world.musical_forms.all - 1) -- same goes for music end if #df.global.world.dance_forms.all > 0 then - insert_preference(unit, df.unit_preference.T_type.LikeDanceForm, #df.global.world.dance_forms.all - 1) -- and dancing + insert_preference(unit, df.unitpref_type.LikeDanceForm, #df.global.world.dance_forms.all - 1) -- and dancing end -- end GOTH profile else @@ -282,7 +282,7 @@ function get_preferences(unit) print("Preferences for " .. unit_name_to_console(unit) .. ":") for _, pref in ipairs(preferences) do - local pref_type = df.unit_preference.T_type[pref.type] + local pref_type = df.unitpref_type[pref.type] local description = "" if pref_type == "LikeMaterial" then diff --git a/remove-stress.lua b/remove-stress.lua index 76bdee9dac..7cf0193645 100644 --- a/remove-stress.lua +++ b/remove-stress.lua @@ -6,9 +6,9 @@ local utils = require('utils') function removeStress(unit,value) - if unit.counters.soldier_mood > df.unit.T_counters.T_soldier_mood.Enraged then + if unit.counters.soldier_mood > df.soldier_mood_type.Enraged then -- Tantrum, Depressed, or Oblivious - unit.counters.soldier_mood = df.unit.T_counters.T_soldier_mood.None + unit.counters.soldier_mood = df.soldier_mood_type.None end if unit.status.current_soul then if unit.status.current_soul.personality.stress > value then diff --git a/stripcaged.lua b/stripcaged.lua index 2585057c56..a334daba44 100644 --- a/stripcaged.lua +++ b/stripcaged.lua @@ -60,7 +60,7 @@ local function cage_dump_armor(list) if df.general_ref_contains_unitst:is_instance(ref) then local inventory = df.unit.find(ref.unit_id).inventory for _, it in ipairs(inventory) do - if it.mode == df.unit_inventory_item.T_mode.Worn then + if it.mode == df.inv_item_role_type.Worn then count = count + dump_item(it.item) end end @@ -81,7 +81,7 @@ local function cage_dump_weapons(list) if df.general_ref_contains_unitst:is_instance(ref) then local inventory = df.unit.find(ref.unit_id).inventory for _, it in ipairs(inventory) do - if it.mode == df.unit_inventory_item.T_mode.Weapon then + if it.mode == df.inv_item_role_type.Weapon then count = count + dump_item(it.item) end end diff --git a/uniform-unstick.lua b/uniform-unstick.lua index be3a4ad858..73fd78b9aa 100644 --- a/uniform-unstick.lua +++ b/uniform-unstick.lua @@ -138,9 +138,9 @@ local function process(unit, args, need_newline) for _, inv_item in ipairs(unit.inventory) do local item = inv_item.item -- Include weapons so we can check we have them later - if inv_item.mode == df.unit_inventory_item.T_mode.Worn or - inv_item.mode == df.unit_inventory_item.T_mode.Weapon or - inv_item.mode == df.unit_inventory_item.T_mode.Strapped + if inv_item.mode == df.inv_item_role_type.Worn or + inv_item.mode == df.inv_item_role_type.Weapon or + inv_item.mode == df.inv_item_role_type.Strapped then worn_items[item.id] = item worn_parts[item.id] = inv_item.body_part_id diff --git a/workorder.lua b/workorder.lua index c72ec99981..32837e7560 100644 --- a/workorder.lua +++ b/workorder.lua @@ -40,11 +40,11 @@ end local used_types = { df.job_type, df.item_type, - df.manager_order.T_frequency, - df.manager_order_condition_item.T_compare_type, - df.manager_order_condition_order.T_condition, + df.workquota_frequency_type, + df.logic_condition_type, + df.workquota_order_condition_type, df.tool_uses, - df.job_art_specification.T_type + df.job_art_specifier_type } local function print_types(_, filter) for _, t in ipairs(used_types) do @@ -265,7 +265,7 @@ function create_orders(orders, quiet) end if it["art"] then - order.art_spec.type = ensure_df_id(df.job_art_specification.T_type, it["art"]["type"]) + order.art_spec.type = ensure_df_id(df.job_art_specifier_type, it["art"]["type"]) or qerror ("Invalid art type value for manager order: " .. it["art"]["type"]) order.art_spec.id = tonumber( it["art"]["id"] ) if it["art"]["subid"] then @@ -278,7 +278,7 @@ function create_orders(orders, quiet) --order.status.validated = it["is_validated"] -- ignoring --order.status.active = it["is_active"] -- ignoring - order.frequency = ensure_df_id(df.manager_order.T_frequency, it["frequency"]) + order.frequency = ensure_df_id(df.workquota_frequency_type, it["frequency"]) or qerror("Invalid frequency value for manager order: " .. it["frequency"]) -- finished_year, finished_year_tick @@ -300,7 +300,7 @@ function create_orders(orders, quiet) condition = df.manager_order_condition_item:new() dfhack.with_onerror(function() condition:delete() end, -- cleanup in case of errors function() - condition.compare_type = ensure_df_id(df.manager_order_condition_item.T_compare_type, it2["condition"]) + condition.compare_type = ensure_df_id(df.logic_condition_type, it2["condition"]) or qerror ("Invalid item condition for manager order: " .. it2["condition"] ) condition.compare_val = tonumber(it2["value"]) @@ -386,7 +386,7 @@ function create_orders(orders, quiet) condition.order_id = id ~= it["id"] and id_mapping[id] or qerror("Missing order condition target for manager order: " .. it2["order"]) - condition.condition = ensure_df_id(df.manager_order_condition_order.T_condition, it2["condition"]) + condition.condition = ensure_df_id(df.workquota_order_condition_type, it2["condition"]) or qerror ( "Invalid order condition type for manager order: " .. it2["condition"] ) -- condition.unk_1