#5268 mention missing npc privs in debug mode

This commit is contained in:
Sokomine 2024-12-15 17:09:01 +01:00
parent 9797ada402
commit 8af9a995a0

View File

@ -489,6 +489,8 @@ yl_speak_up.execute_effect = function(player, n_id, o_id, r)
elseif(r.r_type == "function") then
-- this can only be set and edited with the staff
if(not(yl_speak_up.npc_has_priv(n_id, "effect_exec_lua", r.r_is_generic))) then
yl_speak_up.debug_msg(player, n_id, o_id, tostring(r.r_id).." "..
r.r_type..": The NPC does not have the \"effect_exec_lua\" priv.")
return false
end
return yl_speak_up.eval_and_execute_function(player, r, "r_")
@ -498,6 +500,8 @@ yl_speak_up.execute_effect = function(player, n_id, o_id, r)
return false
end
if(not(yl_speak_up.npc_has_priv(n_id, "effect_give_item", r.r_is_generic))) then
yl_speak_up.debug_msg(player, n_id, o_id, tostring(r.r_id).." "..
r.r_type..": The NPC does not have the \"effect_give_item\" priv.")
return false
end
local item = ItemStack(r.r_value)
@ -518,6 +522,8 @@ yl_speak_up.execute_effect = function(player, n_id, o_id, r)
-- this can only be set and edited with the staff
elseif(r.r_type == "take_item") then
if(not(yl_speak_up.npc_has_priv(n_id, "effect_take_item", r.r_is_generic))) then
yl_speak_up.debug_msg(player, n_id, o_id, tostring(r.r_id).." "..
r.r_type..": The NPC does not have the \"effect_take_item\" priv.")
return false
end
if(not(r.r_value)) then
@ -539,6 +545,8 @@ yl_speak_up.execute_effect = function(player, n_id, o_id, r)
-- this can only be set and edited with the staff
elseif(r.r_type == "move") then
if(not(yl_speak_up.npc_has_priv(n_id, "effect_move_player", r.r_is_generic))) then
yl_speak_up.debug_msg(player, n_id, o_id, tostring(r.r_id).." "..
r.r_type..": The NPC does not have the \"effect_move_player\" priv.")
return false
end
-- copeid/moved here from AliasAlreadyTakens code in functions.lua
@ -791,6 +799,7 @@ yl_speak_up.execute_effect = function(player, n_id, o_id, r)
return yl_speak_up.use_tool_on_block(r, "on_use", player, n_id, o_id)
end
-- even air can be punched - even if that is pretty pointless
-- TODO: some blocks may define their own functions and care for what the player wields (i.e. cheese mod)
minetest.punch_node(r.r_pos, nil)
return true
-- "Right-click the block.", -- 5