Add default gui_bg and listcolors. Survival inv no longer uses sfinv
parent
729a8d05e7
commit
77fd213408
|
@ -6,7 +6,7 @@ beds.spawn = {}
|
|||
|
||||
beds.formspec = "size[8,11;true]" ..
|
||||
"no_prepend[]" ..
|
||||
"bgcolor[#08080880;true]" ..
|
||||
default.gui_bg..
|
||||
"button_exit[2,10;4,0.75;leave;Leave Bed]"
|
||||
|
||||
local modpath = minetest.get_modpath("beds")
|
||||
|
|
|
@ -43,7 +43,8 @@ minetest.register_node("default:chest", {
|
|||
meta:set_string("formspec",
|
||||
"size[9,11.5]"..
|
||||
"background[-0.2,-0.35;9.42,12.46;formspec_chest_large.png]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]" ..
|
||||
default.gui_bg..
|
||||
default.listcolors..
|
||||
"image_button_exit[8.35,-0.28;0.75,0.75;close.png;exit;;true;true;]"..
|
||||
"list[nodemeta:"..p.x..","..p.y..","..p.z..";main;0.01,0.4;9,3;]"..
|
||||
"list[current_name;main;0.01,3.39;9,3;]"..
|
||||
|
@ -55,7 +56,8 @@ minetest.register_node("default:chest", {
|
|||
m:set_string("formspec",
|
||||
"size[9,11.5]"..
|
||||
"background[-0.2,-0.35;9.42,12.46;formspec_chest_large.png]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]" ..
|
||||
default.gui_bg..
|
||||
default.listcolors..
|
||||
"image_button_exit[8.35,-0.28;0.75,0.75;close.png;exit;;true;true;]"..
|
||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0.01,3.39;9,3;]"..
|
||||
"list[current_name;main;0.01,0.4;9,3;]"..
|
||||
|
@ -68,7 +70,8 @@ minetest.register_node("default:chest", {
|
|||
meta:set_string("formspec",
|
||||
"size[9,11.5]"..
|
||||
"background[-0.2,-0.35;9.42,12.46;formspec_chest_large.png]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]" ..
|
||||
default.gui_bg..
|
||||
default.listcolors..
|
||||
"image_button_exit[8.35,-0.28;0.75,0.75;close.png;exit;;true;true;]"..
|
||||
"list[nodemeta:"..p.x..","..p.y..","..p.z..";main;0.01,3.39;9,3;]"..
|
||||
"list[current_name;main;0.01,0.4;9,3;]"..
|
||||
|
@ -80,7 +83,8 @@ minetest.register_node("default:chest", {
|
|||
m:set_string("formspec",
|
||||
"size[9,11.5]"..
|
||||
"background[-0.2,-0.35;9.42,12.46;formspec_chest_large.png]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]" ..
|
||||
default.gui_bg..
|
||||
default.listcolors..
|
||||
"image_button_exit[8.35,-0.28;0.75,0.75;close.png;exit;;true;true;]"..
|
||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0.01,0.4;9,3;]"..
|
||||
"list[current_name;main;0.01,3.39;9,3;]"..
|
||||
|
@ -91,7 +95,8 @@ minetest.register_node("default:chest", {
|
|||
meta:set_string("formspec",
|
||||
"size[9,8.75]"..
|
||||
"background[-0.2,-0.26;9.41,9.49;formspec_chest.png]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]" ..
|
||||
default.gui_bg..
|
||||
default.listcolors..
|
||||
"image_button_exit[8.35,-0.19;0.75,0.75;close.png;exit;;true;true;]"..
|
||||
"list[current_name;main;0,0.5;9,3;]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]" ..
|
||||
|
@ -156,7 +161,8 @@ minetest.register_node("default:chest_left", {
|
|||
meta:set_string("formspec",
|
||||
"size[9,8.75]"..
|
||||
"background[-0.2,-0.26;9.41,9.49;formspec_chest.png]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]" ..
|
||||
default.gui_bg..
|
||||
default.listcolors..
|
||||
"image_button_exit[8.35,-0.19;0.75,0.75;close.png;exit;;true;true;]"..
|
||||
"list[current_name;main;0,0.5;9,3;]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]" ..
|
||||
|
@ -213,7 +219,8 @@ minetest.register_node("default:chest_right", {
|
|||
meta:set_string("formspec",
|
||||
"size[9,8.75]"..
|
||||
"background[-0.2,-0.26;9.41,9.49;formspec_chest.png]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]" ..
|
||||
default.gui_bg..
|
||||
default.listcolors..
|
||||
"image_button_exit[8.35,-0.19;0.75,0.75;close.png;exit;;true;true;]"..
|
||||
"list[current_name;main;0,0.5;9,3;]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]" ..
|
||||
|
|
|
@ -7,8 +7,8 @@ function default.get_furnace_active_formspec(fuel_percent, item_percent)
|
|||
return "size[9,8.75]"..
|
||||
"background[-0.2,-0.26;9.41,9.49;formspec_inventory.png]"..
|
||||
"background[-0.2,-0.26;9.41,9.49;formspec_furnace.png]"..
|
||||
"bgcolor[#08080880;true]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||
default.gui_bg..
|
||||
default.listcolors..
|
||||
"image_button_exit[8.4,-0.1;0.75,0.75;close.png;exit;;true;true;]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
|
@ -24,8 +24,8 @@ function default.get_furnace_inactive_formspec()
|
|||
return "size[9,8.75]"..
|
||||
"background[-0.2,-0.26;9.41,9.49;formspec_inventory.png]"..
|
||||
"background[-0.2,-0.26;9.41,9.49;formspec_furnace.png]"..
|
||||
"bgcolor[#08080880;true]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||
default.gui_bg..
|
||||
default.listcolors..
|
||||
"image_button_exit[8.4,-0.1;0.75,0.75;close.png;exit;;true;true;]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
|
|
|
@ -8,6 +8,9 @@ default = {}
|
|||
|
||||
default.LIGHT_MAX = 14
|
||||
|
||||
default.gui_bg = "bgcolor[#08080880;true]"
|
||||
default.listcolors = "listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"
|
||||
|
||||
-- Load files
|
||||
local default_path = minetest.get_modpath("default")
|
||||
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
default
|
||||
sfinv
|
||||
3d_armor?
|
||||
|
|
|
@ -9,44 +9,39 @@ local function drop_fields(player, name)
|
|||
end
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local inv = player:get_inventory()
|
||||
if inv then
|
||||
inv:set_size("main", 9*4)
|
||||
local function set_inventory(player)
|
||||
local form = "size[9,8.75]"..
|
||||
default.gui_bg..
|
||||
default.listcolors..
|
||||
"background[-0.2,-0.26;9.41,9.49;formspec_inventory.png]"..
|
||||
"background[-0.2,-0.26;9.41,9.49;formspec_inventory_inventory.png]"..
|
||||
"image_button_exit[8.4,-0.1;0.75,0.75;close.png;exit;;true;true;]"..
|
||||
"list[current_player;main;0.01,4.51;9,3;9]"..
|
||||
"list[current_player;main;0.01,7.74;9,1;]"..
|
||||
"list[current_player;craft;4,1;2,1;1]"..
|
||||
"list[current_player;craft;4,2;2,1;4]"..
|
||||
"list[current_player;craftpreview;7.05,1.53;1,1;]"..
|
||||
"list[detached:split;main;8,3.14;1,1;]"..
|
||||
"image[1.5,0;2,4;default_player2d.png]"
|
||||
-- Armor
|
||||
if show_armor then
|
||||
local player_name = player:get_player_name()
|
||||
form = form ..
|
||||
"list[detached:"..player_name.."_armor;armor;0,0;1,1;]"..
|
||||
"list[detached:"..player_name.."_armor;armor;0,1;1,1;1]"..
|
||||
"list[detached:"..player_name.."_armor;armor;0,2;1,1;2]"..
|
||||
"list[detached:"..player_name.."_armor;armor;0,3;1,1;3]"
|
||||
end
|
||||
player:set_inventory_formspec(form)
|
||||
end
|
||||
|
||||
-- Drop craft items on closing
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if fields.quit then
|
||||
drop_fields(player, "craft")
|
||||
end
|
||||
end)
|
||||
|
||||
sfinv.override_page("sfinv:inventory", {
|
||||
title = "Inventory",
|
||||
get = function(self, player, context)
|
||||
local form = [[
|
||||
background[-0.2,-0.26;9.41,9.49;formspec_inventory.png]
|
||||
background[-0.2,-0.26;9.41,9.49;formspec_inventory_inventory.png]
|
||||
image_button_exit[8.4,-0.1;0.75,0.75;close.png;exit;;true;true;]
|
||||
listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]
|
||||
list[current_player;craft;4,1;2,1;1]
|
||||
list[current_player;craft;4,2;2,1;4]
|
||||
list[current_player;craftpreview;7.05,1.53;1,1;]
|
||||
list[detached:split;main;8,3.14;1,1;]
|
||||
image[1.5,0;2,4;default_player2d.png]
|
||||
]]
|
||||
if show_armor then
|
||||
local player_name = player:get_player_name()
|
||||
form = form ..
|
||||
"list[detached:"..player_name.."_armor;armor;0,0;1,1;]"..
|
||||
"list[detached:"..player_name.."_armor;armor;0,1;1,1;1]"..
|
||||
"list[detached:"..player_name.."_armor;armor;0,2;1,1;2]"..
|
||||
"list[detached:"..player_name.."_armor;armor;0,3;1,1;3]"
|
||||
end
|
||||
return sfinv.make_formspec(player, context, form, true)
|
||||
end,
|
||||
on_player_receive_fields = function(self, player, context, fields)
|
||||
if fields.quit then
|
||||
drop_fields(player, "craft")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local split_inv = minetest.create_detached_inventory("split", {
|
||||
allow_move = function(_, _, _, _, _, count, _)
|
||||
return count
|
||||
|
@ -58,4 +53,16 @@ local split_inv = minetest.create_detached_inventory("split", {
|
|||
return stack:get_count()
|
||||
end,
|
||||
})
|
||||
split_inv:set_size("main", 1)
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
local inv = player:get_inventory()
|
||||
if inv then
|
||||
inv:set_size("main", 9*4)
|
||||
end
|
||||
if split_inv then
|
||||
split_inv:set_size("main", 1)
|
||||
end
|
||||
set_inventory(player)
|
||||
end
|
||||
end)
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
dofile(minetest.get_modpath("sfinv") .. "/api.lua")
|
||||
|
||||
sfinv.register_page("sfinv:inventory", {
|
||||
title = "Inventory",
|
||||
get = function(self, player, context)
|
||||
return sfinv.make_formspec(player, context, [[
|
||||
list[current_player;craft;1.75,0.5;3,3;]
|
||||
list[current_player;craftpreview;5.75,1.5;1,1;]
|
||||
]], true)
|
||||
return sfinv.make_formspec(player, context, [[ ]], true)
|
||||
end
|
||||
})
|
||||
})
|
|
@ -146,8 +146,8 @@ split_inv:set_size("main", 1)
|
|||
function workbench:set_formspec(meta, id)
|
||||
meta:set_string("formspec", "size[9,8.75;]"..
|
||||
"background[-0.2,-0.26;9.41,9.49;formspec_inventory.png]" ..
|
||||
sfinv.gui_bg..
|
||||
sfinv.listcolors..
|
||||
default.gui_bg..
|
||||
default.listcolors..
|
||||
"image_button_exit[8.4,-0.1;0.75,0.75;close.png;exit;;true;true;]" ..
|
||||
"list[detached:split;main;8,3.14;1,1;]"..
|
||||
"list[current_player;main;0.01,4.51;9,3;9]"..
|
||||
|
|
Loading…
Reference in New Issue