get rid of `uninv` global

make all uses of it back into `unified_inventory.`
This commit is contained in:
Vanessa Dannenberg 2021-03-07 05:26:48 -05:00
parent eb4cf5bf47
commit 603b5d1d4e
4 changed files with 11 additions and 13 deletions

View File

@ -14,7 +14,7 @@ unified_inventory.register_page("bags", {
local player_name = player:get_player_name() local player_name = player:get_player_name()
return { formspec = table.concat({ return { formspec = table.concat({
unified_inventory.standard_inv_bg, unified_inventory.standard_inv_bg,
bags_inv_bg_prefix..uninv.imgscale..";ui_bags_header.png]", bags_inv_bg_prefix..unified_inventory.imgscale..";ui_bags_header.png]",
"label["..unified_inventory.form_header_x..","..unified_inventory.form_header_y..";" .. F(S("Bags")) .. "]", "label["..unified_inventory.form_header_x..","..unified_inventory.form_header_y..";" .. F(S("Bags")) .. "]",
"button[0.6125,2.75;1.875,0.75;bag1;" .. F(S("Bag @1", 1)) .. "]", "button[0.6125,2.75;1.875,0.75;bag1;" .. F(S("Bag @1", 1)) .. "]",
"button[3.1125,2.75;1.875,0.75;bag2;" .. F(S("Bag @1", 2)) .. "]", "button[3.1125,2.75;1.875,0.75;bag2;" .. F(S("Bag @1", 2)) .. "]",
@ -57,11 +57,11 @@ for bag_i = 1, 4 do
} }
local slots = stack:get_definition().groups.bagslots local slots = stack:get_definition().groups.bagslots
if slots == 8 then if slots == 8 then
fs[#fs + 1] = bags_inv_bg_prefix..uninv.imgscale..";ui_bags_inv_small.png]" fs[#fs + 1] = bags_inv_bg_prefix..unified_inventory.imgscale..";ui_bags_inv_small.png]"
elseif slots == 16 then elseif slots == 16 then
fs[#fs + 1] = bags_inv_bg_prefix..(uninv.imgscale*2)..";ui_bags_inv_medium.png]" fs[#fs + 1] = bags_inv_bg_prefix..(unified_inventory.imgscale*2)..";ui_bags_inv_medium.png]"
elseif slots == 24 then elseif slots == 24 then
fs[#fs + 1] = bags_inv_bg_prefix..(uninv.imgscale*3)..";ui_bags_inv_large.png]" fs[#fs + 1] = bags_inv_bg_prefix..(unified_inventory.imgscale*3)..";ui_bags_inv_large.png]"
end end
fs[#fs + 1] = "list[current_player;bag" .. bag_i .. "contents;0.45,1.65;8,3;]" fs[#fs + 1] = "list[current_player;bag" .. bag_i .. "contents;0.45,1.65;8,3;]"
fs[#fs + 1] = "listring[current_name;bag" .. bag_i .. "contents]" fs[#fs + 1] = "listring[current_name;bag" .. bag_i .. "contents]"
@ -70,7 +70,7 @@ for bag_i = 1, 4 do
if unified_inventory.trash_enabled if unified_inventory.trash_enabled
or unified_inventory.is_creative(player_name) or unified_inventory.is_creative(player_name)
or minetest.get_player_privs(player_name).give then or minetest.get_player_privs(player_name).give then
fs[#fs + 1] = "image[7.8,0.25;"..uninv.imgscale..","..uninv.imgscale..";ui_trash_slot.png]" fs[#fs + 1] = "image[7.8,0.25;"..unified_inventory.imgscale..","..unified_inventory.imgscale..";ui_trash_slot.png]"
.. "list[detached:trash;main;7.95,0.25;1,1;]" .. "list[detached:trash;main;7.95,0.25;1,1;]"
end end
local inv = player:get_inventory() local inv = player:get_inventory()

View File

@ -61,11 +61,9 @@ unified_inventory = {
standard_background = "background9[0,0;1,1;ui_formbg_9_sliced.png;true;16]", standard_background = "background9[0,0;1,1;ui_formbg_9_sliced.png;true;16]",
} }
uninv = unified_inventory unified_inventory.standard_inv = "list[current_player;main;"..(unified_inventory.std_inv_x+0.15)..","..(unified_inventory.std_inv_y+0.15)..";8,4;]"
unified_inventory.standard_inv_bg = "image["..unified_inventory.std_inv_x..","..unified_inventory.std_inv_y..";"..(unified_inventory.imgscale*8)..
uninv.standard_inv = "list[current_player;main;"..(uninv.std_inv_x+0.15)..","..(uninv.std_inv_y+0.15)..";8,4;]" ","..(unified_inventory.imgscale*4)..";ui_main_inventory.png]"
uninv.standard_inv_bg = "image["..uninv.std_inv_x..","..uninv.std_inv_y..";"..(uninv.imgscale*8)..
","..(uninv.imgscale*4)..";ui_main_inventory.png]"
-- Disable default creative inventory -- Disable default creative inventory
local creative = rawget(_G, "creative") or rawget(_G, "creative_inventory") local creative = rawget(_G, "creative") or rawget(_G, "creative_inventory")

View File

@ -110,7 +110,7 @@ function unified_inventory.get_formspec(player, page)
if unified_inventory.is_creative(player_name) if unified_inventory.is_creative(player_name)
and page == "craft" then -- add the "Refill" slot. and page == "craft" then -- add the "Refill" slot.
formspec[n] = "image["..(ui_peruser.craft_x-2.5)..","..(ui_peruser.craft_y+2.5)..";"..uninv.imgscale..","..uninv.imgscale..";ui_single_slot.png]" formspec[n] = "image["..(ui_peruser.craft_x-2.5)..","..(ui_peruser.craft_y+2.5)..";"..unified_inventory.imgscale..","..unified_inventory.imgscale..";ui_single_slot.png]"
n = n+1 n = n+1
end end

View File

@ -172,7 +172,7 @@ unified_inventory.register_page("craft", {
local craftresultx = craftx + 5 local craftresultx = craftx + 5
local player_name = player:get_player_name() local player_name = player:get_player_name()
local formspec = "image["..craftx..","..crafty..";"..(uninv.imgscale*6)..","..(uninv.imgscale*3)..";ui_crafting_form.png]" local formspec = "image["..craftx..","..crafty..";"..(unified_inventory.imgscale*6)..","..(unified_inventory.imgscale*3)..";ui_crafting_form.png]"
formspec = formspec..perplayer_formspec.standard_inv_bg formspec = formspec..perplayer_formspec.standard_inv_bg
formspec = formspec.."label["..formheaderx..","..formheadery..";" ..F(S("Crafting")).."]" formspec = formspec.."label["..formheaderx..","..formheadery..";" ..F(S("Crafting")).."]"
formspec = formspec.."listcolors[#00000000;#00000000]" formspec = formspec.."listcolors[#00000000;#00000000]"
@ -180,7 +180,7 @@ unified_inventory.register_page("craft", {
formspec = formspec.."list[current_player;craft;"..(craftx+0.15)..","..(crafty+0.15)..";3,3;]" formspec = formspec.."list[current_player;craft;"..(craftx+0.15)..","..(crafty+0.15)..";3,3;]"
if unified_inventory.trash_enabled or unified_inventory.is_creative(player_name) or minetest.get_player_privs(player_name).give then if unified_inventory.trash_enabled or unified_inventory.is_creative(player_name) or minetest.get_player_privs(player_name).give then
formspec = formspec.."label["..(craftx+6.45)..","..(crafty + 2.4)..";" .. F(S("Trash:")) .. "]" formspec = formspec.."label["..(craftx+6.45)..","..(crafty + 2.4)..";" .. F(S("Trash:")) .. "]"
formspec = formspec.."image["..(craftx+6.25)..","..(crafty + 2.5)..";"..uninv.imgscale..","..uninv.imgscale..";ui_trash_slot.png]" formspec = formspec.."image["..(craftx+6.25)..","..(crafty + 2.5)..";"..unified_inventory.imgscale..","..unified_inventory.imgscale..";ui_trash_slot.png]"
formspec = formspec.."list[detached:trash;main;"..(craftx+6.4)..","..(crafty + 2.65)..";1,1;]" formspec = formspec.."list[detached:trash;main;"..(craftx+6.4)..","..(crafty + 2.65)..";1,1;]"
end end
formspec = formspec.."listring[current_name;craft]" formspec = formspec.."listring[current_name;craft]"