Commit 2aa82e65 authored by Milan's avatar Milan
Browse files

punch api update: basic crash fix

parent 2eb55a45
......@@ -13,7 +13,7 @@ bows.is_in_entity=function(self,ob)
end
bows.on_hit_object=function(self,target,hp,user,lastpos)
target:punch(user, 2,{full_punch_interval=1.0,damage_groups={fleshy=hp}}, "default:sword_wood", nil)
target:punch(user, 2,{full_punch_interval=1.0,damage_groups={fleshy=hp}}, nil)
if target:get_hp()>0 then
local pos=self.object:getpos()
local opos=target:getpos()
......@@ -54,9 +54,9 @@ end
bows.arrow_remove=function(self)
if self.object:get_attach() then self.object:set_detach() end
if self.target then self.target:punch(self.object, {full_punch_interval=1,damage_groups={fleshy=4}}, "default:bronze_pick", nil) end
if self.target then self.target:punch(self.object, 1.0, {full_punch_interval=1,damage_groups={fleshy=4}}, nil) end
self.object:set_hp(0)
self.object:punch(self.object, {full_punch_interval=1.0,damage_groups={fleshy=4}}, "bows:bow_wood", nil)
self.object:punch(self.object, 1.0, {full_punch_interval=1.0,damage_groups={fleshy=4}}, nil)
return self
end
......
......@@ -20,7 +20,7 @@ bows.arrow_toxic=function(self,target,hp,user,lastpos)
bows.arrow_remove(self)
return self
end
target:punch(user, 3,{full_punch_interval=1.0,damage_groups={fleshy=4}}, "default:sword_wood", nil)
target:punch(user, 3,{full_punch_interval=1.0,damage_groups={fleshy=4}}, nil)
local rnd=math.random(1,10)
if rnd~=4 and target:get_hp()>0 then
minetest.after(math.random(0.5,2), function(self,target,hp,user,lastpos)
......@@ -88,4 +88,4 @@ bows.arrow_rainbow_step=function(self,dtime,user,pos,lastpos)
maxsize = 9,
texture = "bows_rainbow.png",
})
end
\ No newline at end of file
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment