admin_vendor priv is admin_shop priv

This commit is contained in:
Freeman 2023-11-19 11:37:01 +01:00
parent 599cf7b359
commit 35e5429fca
2 changed files with 6 additions and 7 deletions

@ -56,7 +56,6 @@ minetest.register_node(":fancy_vend:display_node", display_node_def)
-- Craftitem to display when vendor is inactive (Use just image for this???)
minetest.register_craftitem(":fancy_vend:inactive",{inventory_image = "inactive.png",})
minetest.register_privilege("admin_vendor", S("Enables the user to set regular vendors to admin vendors."))
minetest.register_privilege("disable_vendor", S("Enables the user to set all vendors to inactive."))
local function bts(bool)
@ -527,7 +526,7 @@ local function get_vendor_status(pos)
return false, "unconfigured"
elseif settings.inactive_force then
return false, "inactive_force"
elseif not minetest.check_player_privs(meta:get_string("owner"), {admin_vendor=true}) and settings.admin_vendor == true then
elseif not minetest.check_player_privs(meta:get_string("owner"), {admin_shop=true}) and settings.admin_vendor == true then
return false, "no_privs"
elseif not inv_contains_items(inv, "main", settings.output_item, settings.output_item_qty, settings.accept_worn_output) and not settings.admin_vendor then
return false, "no_output"
@ -833,7 +832,7 @@ local function get_vendor_settings_fs(pos)
-- Admin vendor checkbox only if owner is admin
local meta = minetest.get_meta(pos)
if minetest.check_player_privs(meta:get_string("owner"), {admin_vendor=true}) or settings.admin_vendor then
if minetest.check_player_privs(meta:get_string("owner"), {admin_shop=true}) or settings.admin_vendor then
checkboxes = checkboxes..
"checkbox[5,2.2;admin_vendor;"..S("Set vendor to an admin vendor.")..";"..bts(settings.admin_vendor).."]"
end
@ -1137,7 +1136,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
-- Admin vendor priv check
if not minetest.check_player_privs(meta:get_string("owner"), {admin_vendor=true}) and fields.admin_vendor == "true" then
if not minetest.check_player_privs(meta:get_string("owner"), {admin_shop=true}) and fields.admin_vendor == "true" then
settings.admin_vendor = false
end
@ -1568,7 +1567,7 @@ minetest.register_tool(":fancy_vend:copy_tool",{
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
if not minetest.check_player_privs(node_meta:get_string("owner"), {admin_shop=true}) and new_settings.admin_vendor == true then
settings.admin_vendor = false
end
@ -1578,7 +1577,7 @@ minetest.register_tool(":fancy_vend:copy_tool",{
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
if not minetest.check_player_privs(node_meta:get_string("owner"), {admin_shop=true}) and new_settings.admin_vendor then
new_settings.admin_vendor = current_settings.admin_vendor
end

@ -24,7 +24,7 @@ local oldshopcraft = core.settings:get_bool("emeraldbank.old_shop_craft") or fal
-- privilege
core.register_privilege("admin_shop", {
description = "Permission to edit others shops",
description = S("Enables the user to set regular vendors to admin vendors, or edit other players shops.")
give_to_singleplayer = false,
})