mirror of
https://github.com/minetest-mods/hopper.git
synced 2024-08-21 13:44:07 +02:00
Code tweaks
This commit is contained in:
parent
80740cd0cb
commit
80ff962ba5
52
init.lua
52
init.lua
@ -1,3 +1,18 @@
|
|||||||
|
local function get_hopper_formspec(pos)
|
||||||
|
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
|
||||||
|
local formspec =
|
||||||
|
"size[8,9]"
|
||||||
|
.. default.gui_bg
|
||||||
|
.. default.gui_bg_img
|
||||||
|
.. default.gui_slots
|
||||||
|
.. "list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]"
|
||||||
|
.. "list[current_player;main;0,4.85;8,1;]"
|
||||||
|
.. "list[current_player;main;0,6.08;8,3;8]"
|
||||||
|
.. "listring[nodemeta:" .. spos .. ";main]"
|
||||||
|
.. "listring[current_player;main]"
|
||||||
|
return formspec
|
||||||
|
end
|
||||||
|
|
||||||
-- hopper
|
-- hopper
|
||||||
minetest.register_node("hopper:hopper", {
|
minetest.register_node("hopper:hopper", {
|
||||||
description = "Hopper",
|
description = "Hopper",
|
||||||
@ -35,19 +50,11 @@ minetest.register_node("hopper:hopper", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
local meta = minetest.get_meta(pos)
|
minetest.show_formspec(
|
||||||
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
|
clicker:get_player_name(),
|
||||||
local formspec =
|
"hopper:hopper",
|
||||||
"size[8,9]"
|
get_hopper_formspec(pos)
|
||||||
.. default.gui_bg
|
)
|
||||||
.. default.gui_bg_img
|
|
||||||
.. default.gui_slots
|
|
||||||
.. "list[nodemeta:"..spos..";main;0,0.3;8,4;]"
|
|
||||||
.. "list[current_player;main;0,4.85;8,1;]"
|
|
||||||
.. "list[current_player;main;0,6.08;8,3;8]"
|
|
||||||
.. "listring[nodemeta:"..spos..";main]"
|
|
||||||
.. "listring[current_player;main]"
|
|
||||||
minetest.show_formspec(clicker:get_player_name(), "", formspec)
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
@ -95,7 +102,6 @@ minetest.register_node("hopper:hopper_side", {
|
|||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
--meta:set_string("formspec", hopper_formspec)
|
|
||||||
meta:set_string("infotext", "Side Hopper")
|
meta:set_string("infotext", "Side Hopper")
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main", 8*4)
|
inv:set_size("main", 8*4)
|
||||||
@ -108,19 +114,11 @@ minetest.register_node("hopper:hopper_side", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
local meta = minetest.get_meta(pos)
|
minetest.show_formspec(
|
||||||
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
|
clicker:get_player_name(),
|
||||||
local formspec =
|
"hopper:hopper_side",
|
||||||
"size[8,9]"
|
get_hopper_formspec(pos)
|
||||||
.. default.gui_bg
|
)
|
||||||
.. default.gui_bg_img
|
|
||||||
.. default.gui_slots
|
|
||||||
.. "list[nodemeta:"..spos..";main;0,0.3;8,4;]"
|
|
||||||
.. "list[current_player;main;0,4.85;8,1;]"
|
|
||||||
.. "list[current_player;main;0,6.08;8,3;8]"
|
|
||||||
.. "listring[nodemeta:"..spos..";main]"
|
|
||||||
.. "listring[current_player;main]"
|
|
||||||
minetest.show_formspec(clicker:get_player_name(), "", formspec)
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
|
Loading…
Reference in New Issue
Block a user