update lua too

develop
Myk Taylor 2023-01-05 17:35:33 -08:00
parent 5e5775f5e3
commit c4a2bdd08e
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
10 changed files with 23 additions and 23 deletions

@ -49,7 +49,7 @@ function enterSidebarMode(sidebar_mode, max_esc)
while remaining_esc > 0 do
local screen = dfhack.gui.getCurViewscreen(true)
focus_string = dfhack.gui.getFocusString(screen)
if df.global.ui.main.mode == df.ui_sidebar_mode.Default and
if df.global.plotinfo.main.mode == df.ui_sidebar_mode.Default and
focus_string == 'dwarfmode/Default' then
if #navkey > 0 then gui.simulateInput(screen, navkey) end
if navkey == 'D_DESIGNATE' then
@ -275,7 +275,7 @@ end
HOTKEY_KEYS = {}
for i,v in ipairs(df.global.ui.main.hotkeys) do
for i,v in ipairs(df.global.plotinfo.main.hotkeys) do
HOTKEY_KEYS['D_HOTKEY'..(i+1)] = v
end
@ -433,7 +433,7 @@ function MenuOverlay:init()
end
if self.sidebar_mode then
self.saved_sidebar_mode = df.global.ui.main.mode
self.saved_sidebar_mode = df.global.plotinfo.main.mode
-- what mode should we restore when this window is dismissed? ideally, we'd
-- restore the mode that the user has set, but we should fall back to
-- restoring the default mode if either of the following conditions are

@ -288,11 +288,11 @@ end
function make_own(unit)
--tweak makeown
unit.flags2.resident = false; unit.flags1.merchant = false; unit.flags1.forest = false;
unit.civ_id = df.global.ui.civ_id
unit.civ_id = df.global.plotinfo.civ_id
if unit.profession == df.profession.MERCHANT then unit.profession = df.profession.TRADER end
if unit.profession2 == df.profession.MERCHANT then unit.profession2 = df.profession.TRADER end
fix_clothing_ownership(unit)
if unit.race == df.global.ui.race_id then
if unit.race == df.global.plotinfo.race_id then
make_citizen(unit)
end
end

@ -87,7 +87,7 @@ end
-- returns a vector of constructed buildings (usually of size 1, but potentially
-- more for constructions)
function construct_buildings_from_ui_state()
local uibs = df.global.ui_build_selector
local uibs = df.global.buildreq
local world = df.global.world
local direction = world.selected_direction
local _, width, height = dfhack.buildings.getCorrectSize(

@ -1,6 +1,6 @@
local _ENV = mkmodule('plugins.confirm')
local ui = df.global.ui
local ui = df.global.plotinfo
local confs = {}
-- Wraps df.interface_key[foo] functionality but fails with invalid keys

@ -54,10 +54,10 @@ local function onPostSidebar(workshop)
if shop_id then
if _registeredStuff.shopNonNative and _registeredStuff.shopNonNative[shop_id] then
if _registeredStuff.shopNonNative[shop_id].all then
--[[for _,button in ipairs(df.global.ui_sidebar_menus.workshop_job.choices_all) do
--[[for _,button in ipairs(df.global.game.workshop_job.choices_all) do
button.is_hidden=true
end]]
df.global.ui_sidebar_menus.workshop_job.choices_visible:resize(0)
df.global.game.workshop_job.choices_visible:resize(0)
else
--todo by name
end
@ -72,7 +72,7 @@ local function onPostSidebar(workshop)
new_button.job_type=df.job_type.CustomReaction --could be used for other stuff too i guess...
new_button.reaction_name=reaction_name
new_button.is_custom=true
local wjob=df.global.ui_sidebar_menus.workshop_job
local wjob=df.global.game.workshop_job
wjob.choices_all:insert("#",new_button)
wjob.choices_visible:insert("#",new_button)
end

@ -146,7 +146,7 @@ function getBaseUnitWeight(unit)
return -30
elseif flags1.diplomat or flags1.merchant or flags1.forest then
return -5
elseif flags1.tame and unit.civ_id == df.global.ui.civ_id then
elseif flags1.tame and unit.civ_id == df.global.plotinfo.civ_id then
return -1
end
end

@ -234,7 +234,7 @@ function material_reactions(reactions, itemtypes, mat_info)
end
function clothing_reactions(reactions, mat_info, filter)
local resources = df.historical_entity.find(df.global.ui.civ_id).resources
local resources = df.historical_entity.find(df.global.plotinfo.civ_id).resources
local itemdefs = df.global.world.raws.itemdefs
local job_types = df.job_type
resource_reactions(reactions, job_types.MakeArmor, mat_info, resources.armor_type, itemdefs.armor, {permissible = filter})
@ -408,7 +408,7 @@ function collect_reactions()
-- Reactions defined in the raws.
-- Not all reactions are allowed to the civilization.
-- That includes "Make sharp rock" by default.
local entity = df.historical_entity.find(df.global.ui.civ_id)
local entity = df.historical_entity.find(df.global.plotinfo.civ_id)
if not entity then
-- No global civilization; arena mode?
-- Anyway, skip remaining reactions, since many depend on the civ.

@ -36,39 +36,39 @@ function test.enterSidebarMode()
end)
-- verify expected starting state
expect.eq(df.ui_sidebar_mode.Default, df.global.ui.main.mode)
expect.eq(df.ui_sidebar_mode.Default, df.global.plotinfo.main.mode)
expect.eq('dwarfmode/Default', dfhack.gui.getCurFocus(true))
-- get into the orders screen
gui.simulateInput(dfhack.gui.getCurViewscreen(true), 'D_JOBLIST')
gui.simulateInput(dfhack.gui.getCurViewscreen(true), 'UNITJOB_MANAGER')
expect.eq(df.ui_sidebar_mode.Default, df.global.ui.main.mode)
expect.eq(df.ui_sidebar_mode.Default, df.global.plotinfo.main.mode)
expect.eq('jobmanagement/Main', dfhack.gui.getCurFocus(true))
-- get back into default from some deep screen
guidm.enterSidebarMode(df.ui_sidebar_mode.Default)
expect.eq(df.ui_sidebar_mode.Default, df.global.ui.main.mode)
expect.eq(df.ui_sidebar_mode.Default, df.global.plotinfo.main.mode)
expect.eq('dwarfmode/Default', dfhack.gui.getCurFocus(true))
-- move from default to some other mode
guidm.enterSidebarMode(df.ui_sidebar_mode.QueryBuilding)
expect.eq(df.ui_sidebar_mode.QueryBuilding, df.global.ui.main.mode)
expect.eq(df.ui_sidebar_mode.QueryBuilding, df.global.plotinfo.main.mode)
expect.str_find('^dwarfmode/QueryBuilding', dfhack.gui.getCurFocus(true))
-- move between non-default modes
guidm.enterSidebarMode(df.ui_sidebar_mode.LookAround)
expect.eq(df.ui_sidebar_mode.LookAround, df.global.ui.main.mode)
expect.eq(df.ui_sidebar_mode.LookAround, df.global.plotinfo.main.mode)
expect.str_find('^dwarfmode/LookAround', dfhack.gui.getCurFocus(true))
-- get back into default from a supported mode
guidm.enterSidebarMode(df.ui_sidebar_mode.Default)
expect.eq(df.ui_sidebar_mode.Default, df.global.ui.main.mode)
expect.eq(df.ui_sidebar_mode.Default, df.global.plotinfo.main.mode)
expect.eq('dwarfmode/Default', dfhack.gui.getCurFocus(true))
-- verify that all supported modes lead where we say they'll go
for k,v in pairs(guidm.SIDEBAR_MODE_KEYS) do
guidm.enterSidebarMode(k)
expect.eq(k, df.global.ui.main.mode, df.ui_sidebar_mode[k])
expect.eq(k, df.global.plotinfo.main.mode, df.ui_sidebar_mode[k])
end
-- end test back in default so the test harness doesn't have to autocorrect
guidm.enterSidebarMode(df.ui_sidebar_mode.Default)

@ -94,7 +94,7 @@ function test.df_expr_to_ref()
dfhack.with_temp_object(df.new('ptr-vector'), function(vec)
fake_unit = vec
vec:insert('#', df.global.world)
vec:insert('#', df.global.ui)
vec:insert('#', df.global.plotinfo)
expect.eq(utils.df_expr_to_ref('unit'), vec)
@ -102,7 +102,7 @@ function test.df_expr_to_ref()
expect.eq(df.reinterpret_cast(df.world, utils.df_expr_to_ref('unit[0]').value), df.global.world)
expect.eq(utils.df_expr_to_ref('unit[1]'), utils.df_expr_to_ref('unit.1'))
expect.eq(df.reinterpret_cast(df.ui, utils.df_expr_to_ref('unit[1]').value), df.global.ui)
expect.eq(df.reinterpret_cast(df.ui, utils.df_expr_to_ref('unit[1]').value), df.global.plotinfo)
expect.error_match('index out of bounds', function() utils.df_expr_to_ref('unit.2') end)
expect.error_match('index out of bounds', function() utils.df_expr_to_ref('unit[2]') end)

@ -397,7 +397,7 @@ function extra_fns.gui_quantum(pos)
local vehicles = assign_minecarts.get_free_vehicles()
local confirm_state = confirm.isEnabled()
local confirm_conf = confirm.get_conf_data()
local routes = df.global.ui.hauling.routes
local routes = df.global.plotinfo.hauling.routes
local num_routes = #routes
local next_order_id = df.global.world.manager_order_next_id