aboutsummaryrefslogtreecommitdiff
path: root/lib/lua/src/lapi.c
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2019-02-03 12:31:55 +0000
committerLoic Blot <loic.blot@unix-experience.fr>2019-02-09 19:52:56 +0100
commit7796a3118d7b4f58752fad0ca5f676dcafd7a76c (patch)
tree12348fd175d8b144bf72c977dd117fffa81b4a84 /lib/lua/src/lapi.c
parentb7e1bca28c2c551198d284473c22b0293139163d (diff)
downloadminetest-7796a3118d7b4f58752fad0ca5f676dcafd7a76c.tar.gz
minetest-7796a3118d7b4f58752fad0ca5f676dcafd7a76c.tar.bz2
minetest-7796a3118d7b4f58752fad0ca5f676dcafd7a76c.zip
Disable confirmation dialog on localhost
Diffstat (limited to 'lib/lua/src/lapi.c')
0 files changed, 0 insertions, 0 deletions
07 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
local F = minetest.formspec_escape

-- Create a detached inventory
local inv_everything = minetest.create_detached_inventory("everything", {
	allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
		return 0
	end,
	allow_put = function(inv, listname, index, stack, player)
		return 0
	end,
	allow_take = function(inv, listname, index, stack, player)
		return -1
	end,
})
local inv_trash = minetest.create_detached_inventory("trash", {
	allow_take = function(inv, listname, index, stack, player)
		return 0
	end,
	allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
		return 0
	end,
	on_put = function(inv, listname, index, stack, player)
		inv:set_list("main", {})
	end,
})
inv_trash:set_size("main", 1)

local max_page = 1

local function get_chest_formspec(page)
	local start = 0 + (page-1)*32
	return "size[8,9]"..
	"list[detached:everything;main;0,0;8,4;"..start.."]"..
	"list[current_player;main;0,5;8,4;]" ..
	"label[6,4;Trash:]" ..
	"list[detached:trash;main;7,4;1,1]" ..
	"button[0,4;1,1;chest_of_everything_prev;"..F("<").."]"..
	"button[1,4;1,1;chest_of_everything_next;"..F(">").."]"..
	"label[2,4;"..F("Page: "..page).."]"..
	"listring[detached:everything;main]"..
	"listring[current_player;main]"..
	"listring[detached:trash;main]"
end

minetest.register_node("chest_of_everything:chest", {
	description = "Chest of Everything" .. "\n" ..
		"Grants access to all items",
	tiles ={"chest_of_everything_chest.png^[sheet:2x2:0,0", "chest_of_everything_chest.png^[sheet:2x2:0,0",
		"chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:1,0",
		"chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:0,1"},
	paramtype2 = "facedir",
	groups = {dig_immediate=2,choppy=3},
	is_ground_content = false,
	on_construct = function(pos)
		local meta = minetest.get_meta(pos)
		meta:set_string("infotext", "Chest of Everything")
		meta:set_int("page", 1)
		meta:set_string("formspec", get_chest_formspec(1))