Fix variable == nil.

This commit is contained in:
Duane 2016-07-13 21:02:07 -05:00
parent b6e66def05
commit 410259de35

View file

@ -156,10 +156,12 @@ for _, mob in pairs(mob_stats) do
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 fun_caves.db.status[player_name].damage_elixir then
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
tool_capabilities.damage_groups.fleshy = tool_capabilities.damage_groups.fleshy + fun_caves.db.status[player_name].damage_elixir.bonus
end
end
self.on_punch_orig(self, puncher, time_from_last_punch, tool_capabilities, dir)
end