forgot run_on_collision

This commit is contained in:
Jouni 2023-12-06 01:24:55 +02:00
parent c9081f02e7
commit c8c96d79c2

View File

@ -30,11 +30,12 @@ bullet.on_step = function(self, dtime, moveresult)
if thing.type == "node" then
local node = minetest.registered_nodes[minetest.get_node(pos).name]
if node and node.walkable then
self:run_on_collision(self.itemstack, self.owner, thing)
if node.tiles then
for i=1,math.random(4,8) do
if type(node.tiles[1]) == "string" then
minetest.add_particle({
pos = self.object:get_pos(),
pos = pos,
velocity = {
x=math.random(-10,10),
y=math.random(-10,10),
@ -55,6 +56,7 @@ bullet.on_step = function(self, dtime, moveresult)
obj = thing.ref
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
self:run_on_collision(self.itemstack, self.owner, thing)
local dmg = {full_punch_interval = 1, damage_groups = self.damage}
obj:punch(self.owner, 1, dmg, nil)
self.object:remove()
@ -68,4 +70,4 @@ bullet.on_step = function(self, dtime, moveresult)
end
end
minetest.register_entity("guns:bullet", bullet)
minetest.register_entity("guns:bullet", bullet)