forgot run_on_collision
This commit is contained in:
parent
c9081f02e7
commit
c8c96d79c2
@ -30,11 +30,12 @@ bullet.on_step = function(self, dtime, moveresult)
|
|||||||
if thing.type == "node" then
|
if thing.type == "node" then
|
||||||
local node = minetest.registered_nodes[minetest.get_node(pos).name]
|
local node = minetest.registered_nodes[minetest.get_node(pos).name]
|
||||||
if node and node.walkable then
|
if node and node.walkable then
|
||||||
|
self:run_on_collision(self.itemstack, self.owner, thing)
|
||||||
if node.tiles then
|
if node.tiles then
|
||||||
for i=1,math.random(4,8) do
|
for i=1,math.random(4,8) do
|
||||||
if type(node.tiles[1]) == "string" then
|
if type(node.tiles[1]) == "string" then
|
||||||
minetest.add_particle({
|
minetest.add_particle({
|
||||||
pos = self.object:get_pos(),
|
pos = pos,
|
||||||
velocity = {
|
velocity = {
|
||||||
x=math.random(-10,10),
|
x=math.random(-10,10),
|
||||||
y=math.random(-10,10),
|
y=math.random(-10,10),
|
||||||
@ -55,6 +56,7 @@ bullet.on_step = function(self, dtime, moveresult)
|
|||||||
obj = thing.ref
|
obj = thing.ref
|
||||||
ent = obj:get_luaentity()
|
ent = obj:get_luaentity()
|
||||||
if (obj:is_player() and obj:get_player_name() ~= self.owner:get_player_name()) or (ent and ent.name ~= self.name) then
|
if (obj:is_player() and obj:get_player_name() ~= self.owner:get_player_name()) or (ent and ent.name ~= self.name) then
|
||||||
|
self:run_on_collision(self.itemstack, self.owner, thing)
|
||||||
local dmg = {full_punch_interval = 1, damage_groups = self.damage}
|
local dmg = {full_punch_interval = 1, damage_groups = self.damage}
|
||||||
obj:punch(self.owner, 1, dmg, nil)
|
obj:punch(self.owner, 1, dmg, nil)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
@ -68,4 +70,4 @@ bullet.on_step = function(self, dtime, moveresult)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_entity("guns:bullet", bullet)
|
minetest.register_entity("guns:bullet", bullet)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user