mirror of
https://codeberg.org/usrib/emeraldbank.git
synced 2024-11-19 22:23:50 +01:00
remove copy_tool
This commit is contained in:
parent
cd4d58ecc6
commit
0a703d7a11
140
fancyshop.lua
140
fancyshop.lua
@ -128,16 +128,16 @@ if minetest.get_modpath("awards") then
|
|||||||
icon = "player_vend_front.png",
|
icon = "player_vend_front.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
awards.register_achievement("fancy_vend:wizard",{
|
-- awards.register_achievement("fancy_vend:wizard",{
|
||||||
title = "You're a Wizard",
|
-- title = "You're a Wizard",
|
||||||
description = S("Craft a copy tool."),
|
-- description = S("Craft a copy tool."),
|
||||||
trigger = {
|
-- trigger = {
|
||||||
type = "craft",
|
-- type = "craft",
|
||||||
item = "fancy_vend:copy_tool",
|
-- item = "fancy_vend:copy_tool",
|
||||||
target = 1,
|
-- target = 1,
|
||||||
},
|
-- },
|
||||||
icon = "copier.png",
|
-- icon = "copier.png",
|
||||||
})
|
-- })
|
||||||
|
|
||||||
awards.register_achievement("fancy_vend:trader",{
|
awards.register_achievement("fancy_vend:trader",{
|
||||||
title = "Trader",
|
title = "Trader",
|
||||||
@ -1520,75 +1520,77 @@ local function get_vendor_pos_and_settings(pointed_thing)
|
|||||||
return pos, settings
|
return pos, settings
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_tool(":fancy_vend:copy_tool",{
|
minetest.register_alias("fancy_vend:copy_tool", "mcl_core:emerald")
|
||||||
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()
|
-- minetest.register_tool(":fancy_vend:copy_tool",{
|
||||||
meta:set_string("settings", minetest.serialize(settings))
|
-- 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.chat_send_player(placer:get_player_name(), "Settings saved.")
|
-- local meta = itemstack:get_meta()
|
||||||
|
-- meta:set_string("settings", minetest.serialize(settings))
|
||||||
|
|
||||||
return itemstack
|
-- minetest.chat_send_player(placer:get_player_name(), "Settings saved.")
|
||||||
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()
|
-- return itemstack
|
||||||
local node_meta = minetest.get_meta(pos)
|
-- end,
|
||||||
local new_settings = minetest.deserialize(meta:get_string("settings"))
|
-- on_use = function(itemstack, user, pointed_thing)
|
||||||
if not new_settings then
|
-- local pos, current_settings = get_vendor_pos_and_settings(pointed_thing)
|
||||||
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.")
|
-- if not pos then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if can_modify_vendor(pos, user) then
|
-- local meta = itemstack:get_meta()
|
||||||
-- Admin vendor priv check
|
-- local node_meta = minetest.get_meta(pos)
|
||||||
if not minetest.check_player_privs(node_meta:get_string("owner"), {admin_vendor=true}) and new_settings.admin_vendor == true then
|
-- local new_settings = minetest.deserialize(meta:get_string("settings"))
|
||||||
settings.admin_vendor = false
|
-- if not new_settings then
|
||||||
end
|
-- 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
|
||||||
|
|
||||||
new_settings.input_item = current_settings.input_item
|
-- if can_modify_vendor(pos, user) then
|
||||||
new_settings.input_item_qty = current_settings.input_item_qty
|
-- -- Admin vendor priv check
|
||||||
new_settings.output_item = current_settings.output_item
|
-- if not minetest.check_player_privs(node_meta:get_string("owner"), {admin_vendor=true}) and new_settings.admin_vendor == true then
|
||||||
new_settings.output_item_qty = current_settings.output_item_qty
|
-- settings.admin_vendor = false
|
||||||
|
-- end
|
||||||
|
|
||||||
-- Admin vendor priv check
|
-- new_settings.input_item = current_settings.input_item
|
||||||
if not minetest.check_player_privs(node_meta:get_string("owner"), {admin_vendor=true}) and new_settings.admin_vendor then
|
-- new_settings.input_item_qty = current_settings.input_item_qty
|
||||||
new_settings.admin_vendor = current_settings.admin_vendor
|
-- new_settings.output_item = current_settings.output_item
|
||||||
end
|
-- new_settings.output_item_qty = current_settings.output_item_qty
|
||||||
|
|
||||||
set_vendor_settings(pos, new_settings)
|
-- -- Admin vendor priv check
|
||||||
refresh_vendor(pos)
|
-- if not minetest.check_player_privs(node_meta:get_string("owner"), {admin_vendor=true}) and new_settings.admin_vendor then
|
||||||
minetest.chat_send_player(user:get_player_name(), "Settings set.")
|
-- new_settings.admin_vendor = current_settings.admin_vendor
|
||||||
else
|
-- end
|
||||||
minetest.chat_send_player(user:get_player_name(), "You cannot modify this vendor.")
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
-- set_vendor_settings(pos, new_settings)
|
||||||
output = "fancy_vend:copy_tool",
|
-- refresh_vendor(pos)
|
||||||
recipe = {
|
-- minetest.chat_send_player(user:get_player_name(), "Settings set.")
|
||||||
{"mcl_core:stick","", "" },
|
-- else
|
||||||
{"", "mcl_core:obsidian","" },
|
-- minetest.chat_send_player(user:get_player_name(), "You cannot modify this vendor.")
|
||||||
{"", "", "mcl_core:emerald"},
|
-- end
|
||||||
}
|
-- end,
|
||||||
})
|
-- })
|
||||||
|
|
||||||
minetest.register_craft({
|
-- minetest.register_craft({
|
||||||
output = "fancy_vend:copy_tool",
|
-- output = "fancy_vend:copy_tool",
|
||||||
recipe = {
|
-- recipe = {
|
||||||
{"", "", "mcl_core:stick"},
|
-- {"mcl_core:stick","", "" },
|
||||||
{"", "mcl_core:obsidian","" },
|
-- {"", "mcl_core:obsidian","" },
|
||||||
{"mcl_core:emerald", "", "" },
|
-- {"", "", "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