Add debugging code for punch function.
This commit is contained in:
parent
73354d3a96
commit
ddd97bc66a
1 changed files with 12 additions and 2 deletions
14
mobs.lua
14
mobs.lua
|
@ -158,7 +158,7 @@ end
|
|||
local function fun_caves_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
if puncher and puncher.get_player_name then
|
||||
local player_name = puncher:get_player_name()
|
||||
if player_name and fun_caves.db.status[player_name].damage_elixir and tool_capabilities and tool_capabilities.damage_groups and tool_capabilities.damage_groups.fleshy then
|
||||
if player_name and player_name ~= '' and fun_caves.db.status[player_name] and fun_caves.db.status[player_name].damage_elixir and tool_capabilities and tool_capabilities.damage_groups and tool_capabilities.damage_groups.fleshy then
|
||||
tool_capabilities.damage_groups.fleshy = tool_capabilities.damage_groups.fleshy + fun_caves.db.status[player_name].damage_elixir.bonus
|
||||
end
|
||||
end
|
||||
|
@ -168,7 +168,17 @@ end
|
|||
for _, mob in pairs(mob_stats) do
|
||||
if minetest.registered_entities[mob.name] then
|
||||
minetest.registered_entities[mob.name].on_punch_orig = minetest.registered_entities[mob.name].on_punch
|
||||
minetest.registered_entities[mob.name].on_punch = fun_caves_punch
|
||||
minetest.registered_entities[mob.name].on_punch = function(...)
|
||||
local error = pcall(fun_caves_punch, ...)
|
||||
if error ~= true then
|
||||
print('***********************')
|
||||
print('Fun Caves: fun_caves_punch failed with error message:')
|
||||
print(error)
|
||||
print(...)
|
||||
print('Please report this error.')
|
||||
print('***********************')
|
||||
end
|
||||
end
|
||||
minetest.registered_entities[mob.name].damage = mob.damage
|
||||
minetest.registered_entities[mob.name].hp_min = math.ceil(mob.hp * 0.5)
|
||||
minetest.registered_entities[mob.name].hp_max = math.ceil(mob.hp * 1.5)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue