added property server_nolog_effects

This commit is contained in:
Sokomine 2023-04-27 23:14:51 +02:00
parent 5dd6ebe8e7
commit d8736a3520
2 changed files with 16 additions and 3 deletions

View File

@ -274,6 +274,11 @@ NPC, inventory movements and purchases are logged.
The log shows the date but not the time of the action. Players can view the
logs of their own NPC.
If you want to keep an NPC from logging, set the property
server_nolog_effects to i.e "true"
That way, the NPC will no longer log or send debug messages when executing
effects.
### 13. Quest items
<a name="quest-items"></a>

View File

@ -70,16 +70,24 @@ yl_speak_up.execute_all_relevant_effects = function(player, effects, o_id, actio
local last_result = action_was_successful
local res = true
local refuse_items = true
local properties = yl_speak_up.get_npc_properties(pname)
local no_log = properties["server_nolog_effects"]
for i, k in ipairs(sorted_key_list) do
local r = effects[ k ]
yl_speak_up.debug_msg(player, n_id, o_id, "..executing "..
tostring(r.r_id)..": "..yl_speak_up.show_effect(r, pname))
-- do not execute effects in edit mode
if(not(edit_mode)) then
yl_speak_up.debug_msg(player, n_id, o_id,
"Executing effect "..tostring(r.r_id)..".")
if(not(no_log)) then
yl_speak_up.debug_msg(player, n_id, o_id,
"Executing effect "..tostring(r.r_id)..".")
end
res = yl_speak_up.execute_effect(player, n_id, o_id, r)
if(not(res)) then
if(no_log) then
if(not(res)) then
alternate_text = r.alternate_text
end
elseif(not(res)) then
yl_speak_up.debug_msg(player, n_id, o_id, tostring(r.r_id)..
" -> Effect failed to execute.")
if(r.r_type ~= "dialog") then