mirror of
https://codeberg.org/usrib/emeraldbank.git
synced 2024-12-22 22:22:25 +01:00
copy tool enabled
This commit is contained in:
parent
0cdac3859b
commit
b1ba61501f
120
fancyshop.lua
120
fancyshop.lua
@ -1520,77 +1520,77 @@ local function get_vendor_pos_and_settings(pointed_thing)
|
||||
return pos, settings
|
||||
end
|
||||
|
||||
minetest.register_alias("fancy_vend:copy_tool", "mcl_core:emerald")
|
||||
--minetest.register_alias("fancy_vend:copy_tool", "mcl_core:emerald")
|
||||
|
||||
-- minetest.register_tool(":fancy_vend:copy_tool",{
|
||||
-- inventory_image = "copier.png",
|
||||
-- description = S("Geminio Wand (For copying vendor settings, right click to save settings, left click to set settings.)"),
|
||||
-- stack_max = 1,
|
||||
-- on_place = function(itemstack, placer, pointed_thing)
|
||||
-- local pos, settings = get_vendor_pos_and_settings(pointed_thing)
|
||||
-- if not pos then return end
|
||||
minetest.register_tool(":fancy_vend:copy_tool",{
|
||||
inventory_image = "copier.png",
|
||||
description = S("Geminio Wand (For copying vendor settings, right click to save settings, left click to set settings.)"),
|
||||
stack_max = 1,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pos, settings = get_vendor_pos_and_settings(pointed_thing)
|
||||
if not pos then return end
|
||||
|
||||
-- local meta = itemstack:get_meta()
|
||||
-- meta:set_string("settings", minetest.serialize(settings))
|
||||
local meta = itemstack:get_meta()
|
||||
meta:set_string("settings", minetest.serialize(settings))
|
||||
|
||||
-- minetest.chat_send_player(placer:get_player_name(), "Settings saved.")
|
||||
minetest.chat_send_player(placer:get_player_name(), "Settings saved.")
|
||||
|
||||
-- return itemstack
|
||||
-- end,
|
||||
-- on_use = function(itemstack, user, pointed_thing)
|
||||
-- local pos, current_settings = get_vendor_pos_and_settings(pointed_thing)
|
||||
-- if not pos then return end
|
||||
return itemstack
|
||||
end,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local pos, current_settings = get_vendor_pos_and_settings(pointed_thing)
|
||||
if not pos then return end
|
||||
|
||||
-- local meta = itemstack:get_meta()
|
||||
-- local node_meta = minetest.get_meta(pos)
|
||||
-- local new_settings = minetest.deserialize(meta:get_string("settings"))
|
||||
-- if not new_settings then
|
||||
-- minetest.chat_send_player(user:get_player_name(), "No settings to set with. Right-click first on the vendor you want to copy settings from.")
|
||||
-- return
|
||||
-- end
|
||||
local meta = itemstack:get_meta()
|
||||
local node_meta = minetest.get_meta(pos)
|
||||
local new_settings = minetest.deserialize(meta:get_string("settings"))
|
||||
if not new_settings then
|
||||
minetest.chat_send_player(user:get_player_name(), "No settings to set with. Right-click first on the vendor you want to copy settings from.")
|
||||
return
|
||||
end
|
||||
|
||||
-- if can_modify_vendor(pos, user) then
|
||||
-- -- Admin vendor priv check
|
||||
-- if not minetest.check_player_privs(node_meta:get_string("owner"), {admin_vendor=true}) and new_settings.admin_vendor == true then
|
||||
-- settings.admin_vendor = false
|
||||
-- end
|
||||
if can_modify_vendor(pos, user) then
|
||||
-- Admin vendor priv check
|
||||
if not minetest.check_player_privs(node_meta:get_string("owner"), {admin_vendor=true}) and new_settings.admin_vendor == true then
|
||||
settings.admin_vendor = false
|
||||
end
|
||||
|
||||
-- new_settings.input_item = current_settings.input_item
|
||||
-- new_settings.input_item_qty = current_settings.input_item_qty
|
||||
-- new_settings.output_item = current_settings.output_item
|
||||
-- new_settings.output_item_qty = current_settings.output_item_qty
|
||||
new_settings.input_item = current_settings.input_item
|
||||
new_settings.input_item_qty = current_settings.input_item_qty
|
||||
new_settings.output_item = current_settings.output_item
|
||||
new_settings.output_item_qty = current_settings.output_item_qty
|
||||
|
||||
-- -- Admin vendor priv check
|
||||
-- if not minetest.check_player_privs(node_meta:get_string("owner"), {admin_vendor=true}) and new_settings.admin_vendor then
|
||||
-- new_settings.admin_vendor = current_settings.admin_vendor
|
||||
-- end
|
||||
-- Admin vendor priv check
|
||||
if not minetest.check_player_privs(node_meta:get_string("owner"), {admin_vendor=true}) and new_settings.admin_vendor then
|
||||
new_settings.admin_vendor = current_settings.admin_vendor
|
||||
end
|
||||
|
||||
-- set_vendor_settings(pos, new_settings)
|
||||
-- refresh_vendor(pos)
|
||||
-- minetest.chat_send_player(user:get_player_name(), "Settings set.")
|
||||
-- else
|
||||
-- minetest.chat_send_player(user:get_player_name(), "You cannot modify this vendor.")
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
set_vendor_settings(pos, new_settings)
|
||||
refresh_vendor(pos)
|
||||
minetest.chat_send_player(user:get_player_name(), "Settings set.")
|
||||
else
|
||||
minetest.chat_send_player(user:get_player_name(), "You cannot modify this vendor.")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- minetest.register_craft({
|
||||
-- output = "fancy_vend:copy_tool",
|
||||
-- recipe = {
|
||||
-- {"mcl_core:stick","", "" },
|
||||
-- {"", "mcl_core:obsidian","" },
|
||||
-- {"", "", "mcl_core:emerald"},
|
||||
-- }
|
||||
-- })
|
||||
minetest.register_craft({
|
||||
output = "fancy_vend:copy_tool",
|
||||
recipe = {
|
||||
{"mcl_core:stick","", "" },
|
||||
{"", "mcl_core:obsidian","" },
|
||||
{"", "", "mcl_core:emerald"},
|
||||
}
|
||||
})
|
||||
|
||||
-- minetest.register_craft({
|
||||
-- output = "fancy_vend:copy_tool",
|
||||
-- recipe = {
|
||||
-- {"", "", "mcl_core:stick"},
|
||||
-- {"", "mcl_core:obsidian","" },
|
||||
-- {"mcl_core:emerald", "", "" },
|
||||
-- }
|
||||
-- })
|
||||
minetest.register_craft({
|
||||
output = "fancy_vend:copy_tool",
|
||||
recipe = {
|
||||
{"", "", "mcl_core:stick"},
|
||||
{"", "mcl_core:obsidian","" },
|
||||
{"mcl_core:emerald", "", "" },
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
---------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user