got rid of further minetest.log and used own logging

This commit is contained in:
Sokomine 2022-09-10 01:00:56 +02:00
parent f514acd3bc
commit dc80271803
4 changed files with 21 additions and 19 deletions

View File

@ -440,12 +440,14 @@ yl_speak_up.load_generic_dialogs = function()
local dialog = yl_speak_up.load_dialog(n_id, false)
local res = yl_speak_up.check_and_add_as_generic_dialog(dialog, n_id)
if(res == "OK") then
minetest.log("action", "[MOD] yl_speak_up: "..
"Generic dialog from NPC "..tostring(n_id).." loaded successfully.")
yl_speak_up.log_change("-", n_id,
"Generic dialog from NPC "..tostring(n_id).." loaded successfully.",
"action")
else
minetest.log("action", "[MOD] yl_speak_up: "..
yl_speak_up.log_change("-", n_id,
"Generic dialog from NPC "..tostring(n_id).." failed to load: "..
tostring(res)..".")
tostring(res)..".",
"action")
end
end
end

View File

@ -267,9 +267,11 @@ yl_speak_up.show_fs_decorated = function(pname, edit_mode, h,
elseif(allow_scrolling) then
if(fs_version < 2) then
-- if the player has an older formspec version
minetest.log( "info",
"[MOD] yl_speak_up: User " .. pname .. " talked to NPC ID n_" .. n_id ..
" with an old formspec version!")
-- (the NPC itself is not relevant, and players reading the NPC logfile don't
-- need this information)
yl_speak_up.log_change(pname, nil,
"User " .. pname .. " talked to NPC ID n_" .. n_id ..
" with an old formspec version!", "info")
table.insert(formspec,
"box[0.3,20;19,2.6;red]"..
"label[0.7,20.3;"..yl_speak_up.text_version_warning.."]")

View File

@ -51,22 +51,17 @@ function yl_speak_up.on_spawn(self)
self.tamed = true
self.object:set_armor_groups({immortal = 100})
minetest.log(
"action",
"[MOD] yl_speak_up: NPC with ID n_" ..
self.yl_speak_up.id .. " spawned at " .. minetest.pos_to_string(self.object:get_pos(), 0)
)
yl_speak_up.log_change("-", "n_"..self.yl_speak_up.id,
"spawned at "..minetest.pos_to_string(self.object:get_pos()), "action")
--Let's do it only once
return true
end
function yl_speak_up.after_activate(self, staticdata, def, dtime)
-- minetest.log(
-- "action",
-- "[MOD] yl_speak_up: NPC with ID n_" ..
-- self.yl_speak_up.id .. " activated at " .. minetest.pos_to_string(self.object:get_pos(), 0)
-- )
-- this scrolls far too much
-- yl_speak_up.log_change("-", "n_"..self.yl_speak_up.id,
-- "activated at "..minetest.pos_to_string(self.object:get_pos()), "action")
if yl_speak_up.status == 2 then
self.object:remove()

View File

@ -5,9 +5,12 @@ yl_speak_up.allow_staff_use = function(itemstack, user, pointed_thing)
if not has_priv then
minetest.chat_send_player(p_name,yl_speak_up.message_tool_taken_because_of_lacking_priv)
minetest.log("action","[MOD] yl_speak_up: User "..p_name..
-- no special NPC involved
yl_speak_up.log_change(p_name, nil,
"User "..p_name..
" used an admin item: "..itemstack:get_name()..
" at pos "..minetest.pos_to_string(user:get_pos(),0))
" at pos "..minetest.pos_to_string(user:get_pos(),0),
"action")
itemstack:take_item(1)
return
end