remove copy_tool

This commit is contained in:
Freeman 2023-10-19 17:28:26 +02:00
parent cd4d58ecc6
commit 0a703d7a11

@ -128,16 +128,16 @@ if minetest.get_modpath("awards") then
icon = "player_vend_front.png",
})
awards.register_achievement("fancy_vend:wizard",{
title = "You're a Wizard",
description = S("Craft a copy tool."),
trigger = {
type = "craft",
item = "fancy_vend:copy_tool",
target = 1,
},
icon = "copier.png",
})
-- awards.register_achievement("fancy_vend:wizard",{
-- title = "You're a Wizard",
-- description = S("Craft a copy tool."),
-- trigger = {
-- type = "craft",
-- item = "fancy_vend:copy_tool",
-- target = 1,
-- },
-- icon = "copier.png",
-- })
awards.register_achievement("fancy_vend:trader",{
title = "Trader",
@ -1520,75 +1520,77 @@ local function get_vendor_pos_and_settings(pointed_thing)
return pos, settings
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
minetest.register_alias("fancy_vend:copy_tool", "mcl_core:emerald")
local meta = itemstack:get_meta()
meta:set_string("settings", minetest.serialize(settings))
-- 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.chat_send_player(placer:get_player_name(), "Settings saved.")
-- local meta = itemstack:get_meta()
-- meta:set_string("settings", minetest.serialize(settings))
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
-- minetest.chat_send_player(placer:get_player_name(), "Settings saved.")
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
-- 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
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
-- 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
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
-- 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
-- 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
-- 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
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,
})
-- -- 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
minetest.register_craft({
output = "fancy_vend:copy_tool",
recipe = {
{"mcl_core:stick","", "" },
{"", "mcl_core:obsidian","" },
{"", "", "mcl_core:emerald"},
}
})
-- 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", "", "" },
-- }
-- })
---------------------------