Ignite tnt minecart by fire charge

This commit is contained in:
Wuzzy 2020-01-30 23:11:16 +01:00
parent 9f344b4307
commit 04c8a08cc4
4 changed files with 30 additions and 6 deletions

View file

@ -3605,6 +3605,7 @@ function mobs:register_arrow(name, def)
hit_player = def.hit_player,
hit_node = def.hit_node,
hit_mob = def.hit_mob,
hit_object = def.hit_object,
drop = def.drop or false, -- drops arrow as registered item when true
collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows
timer = 0,
@ -3671,7 +3672,7 @@ function mobs:register_arrow(name, def)
end
end
if self.hit_player or self.hit_mob then
if self.hit_player or self.hit_mob or self.hit_object then
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.0)) do
@ -3690,11 +3691,18 @@ function mobs:register_arrow(name, def)
and entity._cmi_is_mob == true
and tostring(player) ~= self.owner_id
and entity.name ~= self.object:get_luaentity().name then
self.hit_mob(self, player)
self.object:remove();
return
end
if entity
and self.hit_object
and (not entity._cmi_is_mob)
and tostring(player) ~= self.owner_id
and entity.name ~= self.object:get_luaentity().name then
self.hit_object(self, player)
self.object:remove();
return
end
end

View file

@ -428,6 +428,9 @@ This function registers a arrow for mobs with the attack type shoot.
'hit_mob' a function that is called when the arrow hits a mob;
this function should hurt the mob, the parameters are
(self, mob)
'hit_object' a function that is called when the arrow hits an object
that is neither a player nor a mob. this function should
hurt the object, the parameters are (self, object)
'hit_node' a function that is called when the arrow hits a node, the
parameters are (self, pos, node)
'tail' when set to 1 adds a trail or tail to mob arrows