Updated several mods for Minetest 0.4.16
castles modpack, areas, biome_lib, blox, boost_cart, plantlife modpack
caverealms, coloredwood, concrete, currency, farming redo, home decor,
ilights, mesecons, moreores, pipeworks, signs_lib, technic, unified inventory
unified bricks, unified dyes, worldedit, and xban2
2017-06-16 18:12:21 -04:00
|
|
|
-- internationalization boilerplate
|
|
|
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
|
|
|
local S, NS = dofile(MP.."/intllib.lua")
|
|
|
|
|
update castles modpack, boost_cart, homedecor, currency, farming redo,
framed glass, gloopblocks, mesecons, moreblocks, pipeworks, signs_lib,
technic, unified mesecons, and worldedit
created a new tag for this release (this will be standard procedure from
now on)
2017-09-26 00:11:57 -04:00
|
|
|
function default.get_safe_formspec(pos, page)
|
2016-04-01 20:02:19 -04:00
|
|
|
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
|
update castles modpack, boost_cart, homedecor, currency, farming redo,
framed glass, gloopblocks, mesecons, moreblocks, pipeworks, signs_lib,
technic, unified mesecons, and worldedit
created a new tag for this release (this will be standard procedure from
now on)
2017-09-26 00:11:57 -04:00
|
|
|
local ipos = 50*page
|
2016-04-01 20:02:19 -04:00
|
|
|
local formspec =
|
update castles modpack, boost_cart, homedecor, currency, farming redo,
framed glass, gloopblocks, mesecons, moreblocks, pipeworks, signs_lib,
technic, unified mesecons, and worldedit
created a new tag for this release (this will be standard procedure from
now on)
2017-09-26 00:11:57 -04:00
|
|
|
"size[8,11]"..
|
|
|
|
default.gui_bg..
|
|
|
|
default.gui_bg_img..
|
|
|
|
default.gui_slots..
|
|
|
|
"button[1,-0.1;2,1;page1;Page 1]"..
|
|
|
|
"button[5,-0.1;2,1;page2;Page 2]"..
|
|
|
|
"list[nodemeta:".. spos .. ";main;0,0.9;8,6;"..ipos.."]"..
|
|
|
|
"list[current_player;main;0,7.2;8,4;]"..
|
|
|
|
"listring[nodemeta:".. spos .. ";main]"..
|
|
|
|
"listring[current_player;main]"
|
2016-04-01 20:02:19 -04:00
|
|
|
return formspec
|
|
|
|
end
|
|
|
|
|
update castles modpack, boost_cart, homedecor, currency, farming redo,
framed glass, gloopblocks, mesecons, moreblocks, pipeworks, signs_lib,
technic, unified mesecons, and worldedit
created a new tag for this release (this will be standard procedure from
now on)
2017-09-26 00:11:57 -04:00
|
|
|
local function show_safe_form(clicker, pos, page)
|
|
|
|
minetest.show_formspec(
|
|
|
|
clicker:get_player_name(),
|
|
|
|
"currency:safe",
|
|
|
|
default.get_safe_formspec(pos, page)
|
|
|
|
)
|
|
|
|
minetest.register_on_receive_fields(function(player, form, pressed)
|
|
|
|
print("[SAFE] page button pressed: "..dump(pressed))
|
|
|
|
if form=="currency:safe" then
|
|
|
|
if pressed.page1 then show_safe_form(clicker, pos, 0) end
|
|
|
|
if pressed.page2 then show_safe_form(clicker, pos, 1) end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-01 20:02:19 -04:00
|
|
|
local function has_safe_privilege(meta, player)
|
Update several mods:
biome_lib, boost_cart, building_blocks, castle, homedecor, glooptest,
currency, roads, invsaw, maptools, mesecons, moreblocks, nixie_tubes,
pipeworks, signs_lib, technic, unified_inventory, unifiedbricks, worldedit,
xban2
2016-12-01 04:22:40 -05:00
|
|
|
local name = ""
|
|
|
|
if player then
|
|
|
|
if minetest.check_player_privs(player, "protection_bypass") then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
name = player:get_player_name()
|
|
|
|
end
|
|
|
|
if name ~= meta:get_string("owner") then
|
2016-04-01 20:02:19 -04:00
|
|
|
return false
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_node("currency:safe", {
|
Updated several mods for Minetest 0.4.16
castles modpack, areas, biome_lib, blox, boost_cart, plantlife modpack
caverealms, coloredwood, concrete, currency, farming redo, home decor,
ilights, mesecons, moreores, pipeworks, signs_lib, technic, unified inventory
unified bricks, unified dyes, worldedit, and xban2
2017-06-16 18:12:21 -04:00
|
|
|
description = S("Safe"),
|
2016-04-01 20:02:19 -04:00
|
|
|
inventory_image = "safe_front.png",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
tiles = {"safe_side.png",
|
update castles modpack, boost_cart, homedecor, currency, farming redo,
framed glass, gloopblocks, mesecons, moreblocks, pipeworks, signs_lib,
technic, unified mesecons, and worldedit
created a new tag for this release (this will be standard procedure from
now on)
2017-09-26 00:11:57 -04:00
|
|
|
"safe_side.png",
|
2016-04-01 20:02:19 -04:00
|
|
|
"safe_side.png",
|
|
|
|
"safe_side.png",
|
|
|
|
"safe_side.png",
|
|
|
|
"safe_front.png",},
|
|
|
|
is_ground_content = false,
|
|
|
|
groups = {cracky=1},
|
update castles modpack, boost_cart, homedecor, currency, farming redo,
framed glass, gloopblocks, mesecons, moreblocks, pipeworks, signs_lib,
technic, unified mesecons, and worldedit
created a new tag for this release (this will be standard procedure from
now on)
2017-09-26 00:11:57 -04:00
|
|
|
on_rightclick = function(pos, node, clicker)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
if has_safe_privilege(meta, clicker) then
|
|
|
|
show_safe_form(clicker, pos, 0)
|
|
|
|
end
|
|
|
|
end,
|
2016-04-01 20:02:19 -04:00
|
|
|
after_place_node = function(pos, placer)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_string("owner", placer:get_player_name() or "")
|
Updated several mods for Minetest 0.4.16
castles modpack, areas, biome_lib, blox, boost_cart, plantlife modpack
caverealms, coloredwood, concrete, currency, farming redo, home decor,
ilights, mesecons, moreores, pipeworks, signs_lib, technic, unified inventory
unified bricks, unified dyes, worldedit, and xban2
2017-06-16 18:12:21 -04:00
|
|
|
meta:set_string("infotext", S("Safe (owned by @1)", meta:get_string("owner")))
|
2016-04-01 20:02:19 -04:00
|
|
|
end,
|
|
|
|
on_construct = function(pos)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_string("infotext", "Safe")
|
|
|
|
meta:set_string("owner", "")
|
|
|
|
local inv = meta:get_inventory()
|
update castles modpack, boost_cart, homedecor, currency, farming redo,
framed glass, gloopblocks, mesecons, moreblocks, pipeworks, signs_lib,
technic, unified mesecons, and worldedit
created a new tag for this release (this will be standard procedure from
now on)
2017-09-26 00:11:57 -04:00
|
|
|
inv:set_size("main", 12*8)
|
2016-04-01 20:02:19 -04:00
|
|
|
end,
|
|
|
|
can_dig = function(pos,player)
|
|
|
|
local meta = minetest.get_meta(pos);
|
|
|
|
local inv = meta:get_inventory()
|
|
|
|
return inv:is_empty("main") and has_safe_privilege(meta, player)
|
|
|
|
end,
|
|
|
|
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
if not has_safe_privilege(meta, player) then
|
Updated several mods for Minetest 0.4.16
castles modpack, areas, biome_lib, blox, boost_cart, plantlife modpack
caverealms, coloredwood, concrete, currency, farming redo, home decor,
ilights, mesecons, moreores, pipeworks, signs_lib, technic, unified inventory
unified bricks, unified dyes, worldedit, and xban2
2017-06-16 18:12:21 -04:00
|
|
|
minetest.log("action", S("@1 tried to access a safe belonging to @2 at @3",
|
|
|
|
player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos)))
|
2016-04-01 20:02:19 -04:00
|
|
|
return 0
|
|
|
|
end
|
|
|
|
return count
|
|
|
|
end,
|
update castles modpack, boost_cart, homedecor, currency, farming redo,
framed glass, gloopblocks, mesecons, moreblocks, pipeworks, signs_lib,
technic, unified mesecons, and worldedit
created a new tag for this release (this will be standard procedure from
now on)
2017-09-26 00:11:57 -04:00
|
|
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
2016-04-01 20:02:19 -04:00
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
if not has_safe_privilege(meta, player) then
|
Updated several mods for Minetest 0.4.16
castles modpack, areas, biome_lib, blox, boost_cart, plantlife modpack
caverealms, coloredwood, concrete, currency, farming redo, home decor,
ilights, mesecons, moreores, pipeworks, signs_lib, technic, unified inventory
unified bricks, unified dyes, worldedit, and xban2
2017-06-16 18:12:21 -04:00
|
|
|
minetest.log("action", S("@1 tried to access a safe belonging to @2 at @3",
|
|
|
|
player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos)))
|
2016-04-01 20:02:19 -04:00
|
|
|
return 0
|
|
|
|
end
|
|
|
|
return stack:get_count()
|
|
|
|
end,
|
update castles modpack, boost_cart, homedecor, currency, farming redo,
framed glass, gloopblocks, mesecons, moreblocks, pipeworks, signs_lib,
technic, unified mesecons, and worldedit
created a new tag for this release (this will be standard procedure from
now on)
2017-09-26 00:11:57 -04:00
|
|
|
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
2016-04-01 20:02:19 -04:00
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
if not has_safe_privilege(meta, player) then
|
Updated several mods for Minetest 0.4.16
castles modpack, areas, biome_lib, blox, boost_cart, plantlife modpack
caverealms, coloredwood, concrete, currency, farming redo, home decor,
ilights, mesecons, moreores, pipeworks, signs_lib, technic, unified inventory
unified bricks, unified dyes, worldedit, and xban2
2017-06-16 18:12:21 -04:00
|
|
|
minetest.log("action", S("@1 tried to access a safe belonging to @2 at @3",
|
|
|
|
player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos)))
|
2016-04-01 20:02:19 -04:00
|
|
|
return 0
|
|
|
|
end
|
|
|
|
return stack:get_count()
|
|
|
|
end,
|
|
|
|
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
Updated several mods for Minetest 0.4.16
castles modpack, areas, biome_lib, blox, boost_cart, plantlife modpack
caverealms, coloredwood, concrete, currency, farming redo, home decor,
ilights, mesecons, moreores, pipeworks, signs_lib, technic, unified inventory
unified bricks, unified dyes, worldedit, and xban2
2017-06-16 18:12:21 -04:00
|
|
|
minetest.log("action", S("@1 moves stuff in safe at @2", player:get_player_name(), minetest.pos_to_string(pos)))
|
2016-04-01 20:02:19 -04:00
|
|
|
end,
|
update castles modpack, boost_cart, homedecor, currency, farming redo,
framed glass, gloopblocks, mesecons, moreblocks, pipeworks, signs_lib,
technic, unified mesecons, and worldedit
created a new tag for this release (this will be standard procedure from
now on)
2017-09-26 00:11:57 -04:00
|
|
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
Updated several mods for Minetest 0.4.16
castles modpack, areas, biome_lib, blox, boost_cart, plantlife modpack
caverealms, coloredwood, concrete, currency, farming redo, home decor,
ilights, mesecons, moreores, pipeworks, signs_lib, technic, unified inventory
unified bricks, unified dyes, worldedit, and xban2
2017-06-16 18:12:21 -04:00
|
|
|
minetest.log("action", S("@1 moves stuff to safe at @2", player:get_player_name(), minetest.pos_to_string(pos)))
|
2016-04-01 20:02:19 -04:00
|
|
|
end,
|
update castles modpack, boost_cart, homedecor, currency, farming redo,
framed glass, gloopblocks, mesecons, moreblocks, pipeworks, signs_lib,
technic, unified mesecons, and worldedit
created a new tag for this release (this will be standard procedure from
now on)
2017-09-26 00:11:57 -04:00
|
|
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
Updated several mods for Minetest 0.4.16
castles modpack, areas, biome_lib, blox, boost_cart, plantlife modpack
caverealms, coloredwood, concrete, currency, farming redo, home decor,
ilights, mesecons, moreores, pipeworks, signs_lib, technic, unified inventory
unified bricks, unified dyes, worldedit, and xban2
2017-06-16 18:12:21 -04:00
|
|
|
minetest.log("action", S("@1 takes stuff from safe at @2", player:get_player_name(), minetest.pos_to_string(pos)))
|
2016-04-01 20:02:19 -04:00
|
|
|
end,
|
|
|
|
})
|