Tweaked arrow code

This commit is contained in:
TenPlus1 2015-09-23 16:09:42 +01:00
parent 66120e80b4
commit ec890d4a56

11
api.lua
View File

@ -1,4 +1,4 @@
-- Mobs Api (17th September 2015)
-- Mobs Api (23rd September 2015)
mobs = {}
mobs.mod = "redo"
@ -1479,12 +1479,11 @@ function mobs:register_arrow(name, def)
return
end
local engage = 10 - (self.velocity / 2) -- clear entity before arrow becomes active
if self.hit_node then
local node = minetest.get_node_or_nil(pos)
if node then node = node.name else node = "air" end
if self.hit_node
and minetest.registered_nodes[node]
if minetest.registered_nodes[node]
and minetest.registered_nodes[node].walkable then
self.hit_node(self, pos, node)
if self.drop == true then
@ -1495,9 +1494,11 @@ function mobs:register_arrow(name, def)
self.object:remove() ; -- print ("hit node")
return
end
end
if (self.hit_player or self.hit_mob)
and self.timer > engage then
-- clear entity before arrow becomes active
and self.timer > (10 - (self.velocity / 2)) then
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.0)) do
if self.hit_player
and player:is_player() then