mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 18:41:09 +01:00
Ignite tnt minecart by fire charge
This commit is contained in:
parent
9f344b4307
commit
04c8a08cc4
4 changed files with 30 additions and 6 deletions
|
@ -23,12 +23,16 @@ local function detach_driver(self)
|
|||
end
|
||||
end
|
||||
|
||||
local function activate_tnt_minecart(self)
|
||||
local function activate_tnt_minecart(self, timer)
|
||||
if self._boomtimer then
|
||||
return
|
||||
end
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
self._boomtimer = tnt.BOOMTIMER
|
||||
if timer then
|
||||
self._boomtimer = timer
|
||||
else
|
||||
self._boomtimer = tnt.BOOMTIMER
|
||||
end
|
||||
self.object:set_properties({textures = {
|
||||
"mcl_tnt_blink.png",
|
||||
"mcl_tnt_blink.png",
|
||||
|
@ -600,7 +604,7 @@ register_minecart(
|
|||
S("Minecarts can be used for a quick transportion on rails.") .. "\n" ..
|
||||
S("Minecarts only ride on rails and always follow the tracks. At a T-junction with no straight way ahead, they turn left. The speed is affected by the rail type."),
|
||||
S("You can place the minecart on rails. Right-click it to enter it. Punch it to get it moving.") .. "\n" ..
|
||||
S("To obtain the minecart, punch it while holding down the sneak key.") .. "\n"
|
||||
S("To obtain the minecart, punch it while holding down the sneak key.") .. "\n" ..
|
||||
S("If it moves over a powered activator rail, you'll get ejected."),
|
||||
"mcl_minecarts_minecart.b3d",
|
||||
{"mcl_minecarts_minecart.png"},
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -95,6 +95,15 @@ mobs:register_arrow("mobs_mc:blaze_fireball", {
|
|||
}, nil)
|
||||
end,
|
||||
|
||||
hit_object = function(self, object)
|
||||
local lua = object:get_luaentity()
|
||||
if lua then
|
||||
if lua.name == "mcl_minecarts:tnt_minecart" then
|
||||
lua:on_activate_by_rail(2)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
-- Node hit, make fire
|
||||
hit_node = function(self, pos, node)
|
||||
if node.name == "air" then
|
||||
|
|
Loading…
Reference in a new issue