]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/player_mechanics/player_interaction.lua
Update player_interaction.lua
[Crafter.git] / mods / player_mechanics / player_interaction.lua
index e6901f3cf2ac916453bc42aaaf72ca87f76ca43d..9d051c336e9d61f66c650131b683f8bdc9618d9c 100644 (file)
@@ -29,6 +29,7 @@ local inv
 local stack
 local count
 local obj
+local name
 minetest.register_on_dieplayer(function(player, reason)
        pos = player:get_pos()
        inv = player:get_inventory()
@@ -230,6 +231,9 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch,
        punch_diff = (minetest.get_us_time()/1000000)-temp_pool
 
        hurt = tool_capabilities.damage_groups.damage
+       if not hurt then
+               hurt = 0
+       end
        hp = player:get_hp()
 
        if punch_diff >= 0.5 and hp > 0 then
@@ -266,7 +270,9 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch,
                elseif modify_output then
                        hurt = 0
                end
+
                player:add_player_velocity(dir)
+
                player:set_hp(hp-hurt)
        end
 end)