remove copy_tool

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

View File

@ -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.)"), -- minetest.register_tool(":fancy_vend:copy_tool",{
stack_max = 1, -- inventory_image = "copier.png",
on_place = function(itemstack, placer, pointed_thing) -- description = S("Geminio Wand (For copying vendor settings, right click to save settings, left click to set settings.)"),
local pos, settings = get_vendor_pos_and_settings(pointed_thing) -- stack_max = 1,
if not pos then return end -- 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() -- local meta = itemstack:get_meta()
meta:set_string("settings", minetest.serialize(settings)) -- 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 -- return itemstack
end, -- end,
on_use = function(itemstack, user, pointed_thing) -- on_use = function(itemstack, user, pointed_thing)
local pos, current_settings = get_vendor_pos_and_settings(pointed_thing) -- local pos, current_settings = get_vendor_pos_and_settings(pointed_thing)
if not pos then return end -- if not pos then return end
local meta = itemstack:get_meta() -- local meta = itemstack:get_meta()
local node_meta = minetest.get_meta(pos) -- local node_meta = minetest.get_meta(pos)
local new_settings = minetest.deserialize(meta:get_string("settings")) -- local new_settings = minetest.deserialize(meta:get_string("settings"))
if not new_settings then -- 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.") -- 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 -- return
end -- end
if can_modify_vendor(pos, user) then -- if can_modify_vendor(pos, user) then
-- Admin vendor priv check -- -- 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 -- 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 -- settings.admin_vendor = false
end -- end
new_settings.input_item = current_settings.input_item -- new_settings.input_item = current_settings.input_item
new_settings.input_item_qty = current_settings.input_item_qty -- new_settings.input_item_qty = current_settings.input_item_qty
new_settings.output_item = current_settings.output_item -- new_settings.output_item = current_settings.output_item
new_settings.output_item_qty = current_settings.output_item_qty -- new_settings.output_item_qty = current_settings.output_item_qty
-- Admin vendor priv check -- -- Admin vendor priv check
if not minetest.check_player_privs(node_meta:get_string("owner"), {admin_vendor=true}) and new_settings.admin_vendor then -- 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 -- new_settings.admin_vendor = current_settings.admin_vendor
end -- end
set_vendor_settings(pos, new_settings) -- set_vendor_settings(pos, new_settings)
refresh_vendor(pos) -- refresh_vendor(pos)
minetest.chat_send_player(user:get_player_name(), "Settings set.") -- minetest.chat_send_player(user:get_player_name(), "Settings set.")
else -- else
minetest.chat_send_player(user:get_player_name(), "You cannot modify this vendor.") -- minetest.chat_send_player(user:get_player_name(), "You cannot modify this vendor.")
end -- end
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({ -- 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", "", "" },
} -- }
}) -- })
--------------------------- ---------------------------