merge patch by jackdavidson
This commit is contained in:
parent
cb9ec2c5a5
commit
bb81e3db60
22
arrow.lua
22
arrow.lua
@ -2,9 +2,18 @@ bows.nothing=function(self,target,hp,user,lastpos)
|
||||
return self
|
||||
end
|
||||
|
||||
bows.is_in_entity=function(self,ob)
|
||||
local collisionbox = ob:get_properties().collisionbox
|
||||
return (collisionbox[1]+ob:get_pos().x <= self.object:get_pos().x and
|
||||
collisionbox[2]+ob:get_pos().y <= self.object:get_pos().y and
|
||||
collisionbox[3]+ob:get_pos().z <= self.object:get_pos().z and
|
||||
collisionbox[4]+ob:get_pos().x >= self.object:get_pos().x and
|
||||
collisionbox[5]+ob:get_pos().y >= self.object:get_pos().y and
|
||||
collisionbox[6]+ob:get_pos().z >= self.object:get_pos().z)
|
||||
end
|
||||
|
||||
bows.on_hit_object=function(self,target,hp,user,lastpos)
|
||||
target:set_hp(target:get_hp()-hp)
|
||||
target:punch(user,1, "default:sword_wood", nil)
|
||||
target:punch(user, 2,{full_punch_interval=1.0,damage_groups={fleshy=hp}}, "default:sword_wood", nil)
|
||||
if target:get_hp()>0 then
|
||||
local pos=self.object:getpos()
|
||||
local opos=target:getpos()
|
||||
@ -121,8 +130,13 @@ minetest.register_entity("bows:arrow",{
|
||||
self.x=pos.x
|
||||
self.y=pos.y
|
||||
self.z=pos.z
|
||||
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 1)) do
|
||||
if ob and ((bows.pvp and ob:is_player() and ob:get_player_name()~=self.user:get_player_name()) or (ob:get_luaentity() and ob:get_luaentity().physical and ob:get_luaentity().bow_arrow==nil and ob:get_luaentity().name~="__builtin:item" )) then
|
||||
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 3)) do
|
||||
if ob and ((bows.pvp and ob:is_player() and
|
||||
ob:get_player_name()~=self.user:get_player_name()) or
|
||||
(ob:get_luaentity() and ob:get_luaentity().physical and
|
||||
ob:get_luaentity().bow_arrow==nil and
|
||||
ob:get_luaentity().name~="__builtin:item")) and
|
||||
bows.is_in_entity(self,ob) then
|
||||
self.object:setvelocity({x=0, y=0, z=0})
|
||||
self.object:setacceleration({x=0, y=0, z=0})
|
||||
self.stuck=true
|
||||
|
Loading…
x
Reference in New Issue
Block a user