added loging of capturing mobs (at least those using the mobs_redo interface)

This commit is contained in:
Sokomine 2023-11-08 21:46:47 +01:00
parent dc278123d6
commit 1416ab39d3

View File

@ -33,13 +33,30 @@ function yl_speak_up.do_mobs_on_rightclick(self, clicker)
-- Take the mob only with net or lasso
if self.owner and self.owner == name then
local pos = self.object:get_pos()
if mobs:capture_mob(self, clicker, nil, 100, 100, true, nil) then
return
if(self.yl_speak_up) then
minetest.log("action","[MOD] yl_speak_up "..
" NPC n_"..tostring(self.yl_speak_up.id)..
" named "..tostring(self.yl_speak_up.npc_name)..
" (owned by "..tostring(self.owner)..
") picked up by "..tostring(clicker:get_player_name())..
" at pos "..minetest.pos_to_string(pos, 0)..".")
end
return
end
end
-- protect npc with mobs:protector
if mobs:protect(self, clicker) then
if(self.yl_speak_up) then
minetest.log("action","[MOD] yl_speak_up "..
" NPC n_"..tostring(self.yl_speak_up.id)..
" named "..tostring(self.yl_speak_up.npc_name)..
" (owned by "..tostring(self.owner)..
") protected with protector by "..tostring(clicker:get_player_name())..
" at pos "..minetest.pos_to_string(pos, 0)..".")
end
return
end