Hooper formspec

This commit is contained in:
AFCMS 2022-09-10 11:20:48 +02:00
parent 452cd26558
commit 1065eb4d8c
No known key found for this signature in database
GPG Key ID: 8720389A25B652E3
2 changed files with 43 additions and 38 deletions

@ -366,8 +366,6 @@ local function set_inventory(player, armor_change_only)
return
end
player:set_inventory_formspec(mcl_inventory.build_survival_formspec(player))
end
@ -436,7 +434,7 @@ function mcl_inventory.update_inventory(player, armor_change_only)
local player_gamemode = mcl_gamemode.get_gamemode(player)
if player_gamemode == "creative" then
if armor_change_only then
-- Stay on survival inventory plage if only the armor has been changed
-- Stay on survival inventory page if only the armor has been changed
mcl_inventory.set_creative_formspec(player, 0, 0, nil, nil, "inv")
else
mcl_inventory.set_creative_formspec(player, 0, 1)

@ -12,17 +12,24 @@ end
--[[ BEGIN OF NODE DEFINITIONS ]]
local mcl_hoppers_formspec = table.concat({
"size[9,7]",
"label[2,0;"..F(C(mcl_formspec.label_color, S("Hopper"))).."]",
"list[context;main;2,0.5;5,1;]",
mcl_formspec.get_itemslot_bg(2,0.5,5,1),
"label[0,2;"..F(C(mcl_formspec.label_color, S("Inventory"))).."]",
"list[current_player;main;0,2.5;9,3;9]",
mcl_formspec.get_itemslot_bg(0,2.5,9,3),
"list[current_player;main;0,5.74;9,1;]",
mcl_formspec.get_itemslot_bg(0,5.74,9,1),
"formspec_version[4]",
"size[11.75,8.175]",
"label[0.375,0.375;" .. F(C(mcl_formspec.label_color, S("Hopper"))) .. "]",
mcl_formspec.get_itemslot_bg_v4(2.875, 0.75, 5, 1),
"list[context;main;2.875,0.75;5,1;]",
"label[0.375,2.45;" .. F(C(mcl_formspec.label_color, S("Inventory"))) .. "]",
mcl_formspec.get_itemslot_bg_v4(0.375, 2.85, 9, 3),
"list[current_player;main;0.375,2.85;9,3;9]",
mcl_formspec.get_itemslot_bg_v4(0.375, 6.8, 9, 1),
"list[current_player;main;0.375,6.8;9,1;]",
"listring[context;main]",
"listring[current_player;main]"
"listring[current_player;main]",
})
-- Downwards hopper (base definition)
@ -31,7 +38,7 @@ local mcl_hoppers_formspec = table.concat({
local def_hopper = {
inventory_image = "mcl_hoppers_item.png",
wield_image = "mcl_hoppers_item.png",
groups = {pickaxey = 1, container = 2, deco_block = 1, hopper = 1},
groups = { pickaxey = 1, container = 2, deco_block = 1, hopper = 1 },
drawtype = "nodebox",
paramtype = "light",
-- FIXME: mcl_hoppers_hopper_inside.png is unused by hoppers.
@ -47,25 +54,25 @@ local def_hopper = {
type = "fixed",
fixed = {
--funnel walls
{-0.5, 0.0, 0.4, 0.5, 0.5, 0.5},
{0.4, 0.0, -0.5, 0.5, 0.5, 0.5},
{-0.5, 0.0, -0.5, -0.4, 0.5, 0.5},
{-0.5, 0.0, -0.5, 0.5, 0.5, -0.4},
{ -0.5, 0.0, 0.4, 0.5, 0.5, 0.5 },
{ 0.4, 0.0, -0.5, 0.5, 0.5, 0.5 },
{ -0.5, 0.0, -0.5, -0.4, 0.5, 0.5 },
{ -0.5, 0.0, -0.5, 0.5, 0.5, -0.4 },
--funnel base
{-0.5, 0.0, -0.5, 0.5, 0.1, 0.5},
{ -0.5, 0.0, -0.5, 0.5, 0.1, 0.5 },
--spout
{-0.3, -0.3, -0.3, 0.3, 0.0, 0.3},
{-0.1, -0.3, -0.1, 0.1, -0.5, 0.1},
{ -0.3, -0.3, -0.3, 0.3, 0.0, 0.3 },
{ -0.1, -0.3, -0.1, 0.1, -0.5, 0.1 },
},
},
selection_box = {
type = "fixed",
fixed = {
--funnel
{-0.5, 0.0, -0.5, 0.5, 0.5, 0.5},
{ -0.5, 0.0, -0.5, 0.5, 0.5, 0.5 },
--spout
{-0.3, -0.3, -0.3, 0.3, 0.0, 0.3},
{-0.1, -0.3, -0.1, 0.1, -0.5, 0.1},
{ -0.3, -0.3, -0.3, 0.3, 0.0, 0.3 },
{ -0.1, -0.3, -0.1, 0.1, -0.5, 0.1 },
},
},
is_ground_content = false,
@ -248,25 +255,25 @@ local def_hopper_side = {
type = "fixed",
fixed = {
--funnel walls
{-0.5, 0.0, 0.4, 0.5, 0.5, 0.5},
{0.4, 0.0, -0.5, 0.5, 0.5, 0.5},
{-0.5, 0.0, -0.5, -0.4, 0.5, 0.5},
{-0.5, 0.0, -0.5, 0.5, 0.5, -0.4},
{ -0.5, 0.0, 0.4, 0.5, 0.5, 0.5 },
{ 0.4, 0.0, -0.5, 0.5, 0.5, 0.5 },
{ -0.5, 0.0, -0.5, -0.4, 0.5, 0.5 },
{ -0.5, 0.0, -0.5, 0.5, 0.5, -0.4 },
--funnel base
{-0.5, 0.0, -0.5, 0.5, 0.1, 0.5},
{ -0.5, 0.0, -0.5, 0.5, 0.1, 0.5 },
--spout
{-0.3, -0.3, -0.3, 0.3, 0.0, 0.3},
{-0.5, -0.3, -0.1, 0.1, -0.1, 0.1},
{ -0.3, -0.3, -0.3, 0.3, 0.0, 0.3 },
{ -0.5, -0.3, -0.1, 0.1, -0.1, 0.1 },
},
},
selection_box = {
type = "fixed",
fixed = {
--funnel
{-0.5, 0.0, -0.5, 0.5, 0.5, 0.5},
{ -0.5, 0.0, -0.5, 0.5, 0.5, 0.5 },
--spout
{-0.3, -0.3, -0.3, 0.3, 0.0, 0.3},
{-0.5, -0.3, -0.1, 0.1, -0.1, 0.1},
{ -0.3, -0.3, -0.3, 0.3, 0.0, 0.3 },
{ -0.5, -0.3, -0.1, 0.1, -0.1, 0.1 },
},
},
is_ground_content = false,
@ -559,8 +566,8 @@ end
minetest.register_abm({
label = "Hopper/container item exchange",
nodenames = {"mcl_hoppers:hopper"},
neighbors = {"group:container"},
nodenames = { "mcl_hoppers:hopper" },
neighbors = { "group:container" },
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
@ -591,8 +598,8 @@ minetest.register_abm({
minetest.register_abm({
label = "Side-hopper/container item exchange",
nodenames = {"mcl_hoppers:hopper_side"},
neighbors = {"group:container"},
nodenames = { "mcl_hoppers:hopper_side" },
neighbors = { "group:container" },
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)