mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-11 12:13:15 +01:00
Rockets and piercing arrows fixed
They both work properly now.
This commit is contained in:
parent
b25d2ef31d
commit
31b99086f5
@ -263,19 +263,16 @@ local arrow_entity = {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not obj:is_player() then
|
|
||||||
mcl_burning.extinguish(self.object)
|
|
||||||
if self._piercing == 0 then
|
|
||||||
self._removed = true
|
|
||||||
self.object:remove()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Item definition entity collision hook
|
-- Item definition entity collision hook
|
||||||
local item_def = minetest.registered_items[self._arrow_item]
|
local item_def = minetest.registered_items[self._arrow_item]
|
||||||
local hook = item_def and item_def._on_collide_with_entity
|
local hook = item_def and item_def._on_collide_with_entity
|
||||||
if hook then hook(self, pos, obj) end
|
if hook then hook(self, pos, obj) end
|
||||||
|
|
||||||
|
if self._piercing > 0 then
|
||||||
|
self._piercing = self._piercing - 1
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- Because arrows are flagged to survive collisions to allow sticking into blocks, manually remove it now that it
|
-- Because arrows are flagged to survive collisions to allow sticking into blocks, manually remove it now that it
|
||||||
-- has collided with an entity
|
-- has collided with an entity
|
||||||
self._removed = true
|
self._removed = true
|
||||||
|
@ -8,10 +8,10 @@ local ROCKET_TIMEOUT = 1
|
|||||||
|
|
||||||
local YAW_OFFSET = -math.pi/2
|
local YAW_OFFSET = -math.pi/2
|
||||||
|
|
||||||
local function damage_explosion(self, damagemulitplier)
|
local function damage_explosion(self, damagemulitplier, pos)
|
||||||
if self._harmless then return end
|
if self._harmless then return end
|
||||||
|
|
||||||
local p = self.object:get_pos()
|
local p = pos or self.object:get_pos()
|
||||||
if not p then return end
|
if not p then return end
|
||||||
mcl_explosions.explode(p, 3, {})
|
mcl_explosions.explode(p, 3, {})
|
||||||
local objects = minetest.get_objects_inside_radius(p, 8)
|
local objects = minetest.get_objects_inside_radius(p, 8)
|
||||||
@ -27,7 +27,8 @@ local function damage_explosion(self, damagemulitplier)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function particle_explosion(self)
|
local function particle_explosion(pos)
|
||||||
|
if pos.object then pos = pos.object:get_pos() end
|
||||||
local particle_pattern = math.random(1, 3)
|
local particle_pattern = math.random(1, 3)
|
||||||
local fpitch
|
local fpitch
|
||||||
local type = math.random(1, 2)
|
local type = math.random(1, 2)
|
||||||
@ -45,14 +46,14 @@ local function particle_explosion(self)
|
|||||||
|
|
||||||
if type == 1 then
|
if type == 1 then
|
||||||
minetest.sound_play("mcl_bows_firework", {
|
minetest.sound_play("mcl_bows_firework", {
|
||||||
pos = self.object:get_pos(),
|
pos = pos,
|
||||||
max_hear_distance = 100,
|
max_hear_distance = 100,
|
||||||
gain = 3.0,
|
gain = 3.0,
|
||||||
pitch = fpitch/100
|
pitch = fpitch/100
|
||||||
}, true)
|
}, true)
|
||||||
else
|
else
|
||||||
minetest.sound_play("mcl_bows_firework_soft", {
|
minetest.sound_play("mcl_bows_firework_soft", {
|
||||||
pos = self.object:get_pos(),
|
pos = pos,
|
||||||
max_hear_distance = 100,
|
max_hear_distance = 100,
|
||||||
gain = 4.0,
|
gain = 4.0,
|
||||||
pitch = fpitch/100
|
pitch = fpitch/100
|
||||||
@ -63,8 +64,8 @@ local function particle_explosion(self)
|
|||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 400 * size,
|
amount = 400 * size,
|
||||||
time = 0.0001,
|
time = 0.0001,
|
||||||
minpos = self.object:get_pos(),
|
minpos = pos,
|
||||||
maxpos = self.object:get_pos(),
|
maxpos = pos,
|
||||||
minvel = vector.new(-7 * size,-7 * size,-7 * size),
|
minvel = vector.new(-7 * size,-7 * size,-7 * size),
|
||||||
maxvel = vector.new(7 * size,7 * size,7 * size),
|
maxvel = vector.new(7 * size,7 * size,7 * size),
|
||||||
minexptime = .6 * size / 2,
|
minexptime = .6 * size / 2,
|
||||||
@ -79,8 +80,8 @@ local function particle_explosion(self)
|
|||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 400 * size,
|
amount = 400 * size,
|
||||||
time = 0.0001,
|
time = 0.0001,
|
||||||
minpos = self.object:get_pos(),
|
minpos = pos,
|
||||||
maxpos = self.object:get_pos(),
|
maxpos = pos,
|
||||||
minvel = vector.new(-2 * size,-2 * size,-2 * size),
|
minvel = vector.new(-2 * size,-2 * size,-2 * size),
|
||||||
maxvel = vector.new(2 * size,2 * size,2 * size),
|
maxvel = vector.new(2 * size,2 * size,2 * size),
|
||||||
minexptime = .6 * size / 2,
|
minexptime = .6 * size / 2,
|
||||||
@ -95,8 +96,8 @@ local function particle_explosion(self)
|
|||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 100 * size,
|
amount = 100 * size,
|
||||||
time = 0.0001,
|
time = 0.0001,
|
||||||
minpos = self.object:get_pos(),
|
minpos = pos,
|
||||||
maxpos = self.object:get_pos(),
|
maxpos = pos,
|
||||||
minvel = vector.new(-14 * size,-14 * size,-14 * size),
|
minvel = vector.new(-14 * size,-14 * size,-14 * size),
|
||||||
maxvel = vector.new(14 * size,14 * size,14 * size),
|
maxvel = vector.new(14 * size,14 * size,14 * size),
|
||||||
minexptime = .6 * size / 2,
|
minexptime = .6 * size / 2,
|
||||||
@ -113,8 +114,8 @@ local function particle_explosion(self)
|
|||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 240 * size,
|
amount = 240 * size,
|
||||||
time = 0.0001,
|
time = 0.0001,
|
||||||
minpos = self.object:get_pos(),
|
minpos = pos,
|
||||||
maxpos = self.object:get_pos(),
|
maxpos = pos,
|
||||||
minvel = vector.new(-5 * size,-5 * size,-5 * size),
|
minvel = vector.new(-5 * size,-5 * size,-5 * size),
|
||||||
maxvel = vector.new(5 * size,5 * size,5 * size),
|
maxvel = vector.new(5 * size,5 * size,5 * size),
|
||||||
minexptime = .6 * size / 2,
|
minexptime = .6 * size / 2,
|
||||||
@ -129,8 +130,8 @@ local function particle_explosion(self)
|
|||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 500 * size,
|
amount = 500 * size,
|
||||||
time = 0.0001,
|
time = 0.0001,
|
||||||
minpos = self.object:get_pos(),
|
minpos = pos,
|
||||||
maxpos = self.object:get_pos(),
|
maxpos = pos,
|
||||||
minvel = vector.new(-2 * size,-2 * size,-2 * size),
|
minvel = vector.new(-2 * size,-2 * size,-2 * size),
|
||||||
maxvel = vector.new(2 * size,2 * size,2 * size),
|
maxvel = vector.new(2 * size,2 * size,2 * size),
|
||||||
minexptime = .6 * size / 2,
|
minexptime = .6 * size / 2,
|
||||||
@ -145,8 +146,8 @@ local function particle_explosion(self)
|
|||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 350 * size,
|
amount = 350 * size,
|
||||||
time = 0.0001,
|
time = 0.0001,
|
||||||
minpos = self.object:get_pos(),
|
minpos = pos,
|
||||||
maxpos = self.object:get_pos(),
|
maxpos = pos,
|
||||||
minvel = vector.new(-3 * size,-3 * size,-3 * size),
|
minvel = vector.new(-3 * size,-3 * size,-3 * size),
|
||||||
maxvel = vector.new(3 * size,3 * size,3 * size),
|
maxvel = vector.new(3 * size,3 * size,3 * size),
|
||||||
minexptime = .6 * size / 2,
|
minexptime = .6 * size / 2,
|
||||||
@ -163,8 +164,8 @@ local function particle_explosion(self)
|
|||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 400 * size,
|
amount = 400 * size,
|
||||||
time = 0.0001,
|
time = 0.0001,
|
||||||
minpos = self.object:get_pos(),
|
minpos = pos,
|
||||||
maxpos = self.object:get_pos(),
|
maxpos = pos,
|
||||||
minvel = vector.new(-6 * size,-4 * size,-6 * size),
|
minvel = vector.new(-6 * size,-4 * size,-6 * size),
|
||||||
maxvel = vector.new(6 * size,4 * size,6 * size),
|
maxvel = vector.new(6 * size,4 * size,6 * size),
|
||||||
minexptime = .6 * size,
|
minexptime = .6 * size,
|
||||||
@ -179,8 +180,8 @@ local function particle_explosion(self)
|
|||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 120 * size,
|
amount = 120 * size,
|
||||||
time = 0.0001,
|
time = 0.0001,
|
||||||
minpos = self.object:get_pos(),
|
minpos = pos,
|
||||||
maxpos = self.object:get_pos(),
|
maxpos = pos,
|
||||||
minvel = vector.new(-8 * size,6 * size,-8 * size),
|
minvel = vector.new(-8 * size,6 * size,-8 * size),
|
||||||
maxvel = vector.new(8 * size,6 * size,8 * size),
|
maxvel = vector.new(8 * size,6 * size,8 * size),
|
||||||
minexptime = .6 * size,
|
minexptime = .6 * size,
|
||||||
@ -195,8 +196,8 @@ local function particle_explosion(self)
|
|||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 130 * size,
|
amount = 130 * size,
|
||||||
time = 0.0001,
|
time = 0.0001,
|
||||||
minpos = self.object:get_pos(),
|
minpos = pos,
|
||||||
maxpos = self.object:get_pos(),
|
maxpos = pos,
|
||||||
minvel = vector.new(-3 * size,3 * size,-3 * size),
|
minvel = vector.new(-3 * size,3 * size,-3 * size),
|
||||||
maxvel = vector.new(3 * size,3 * size,3 * size),
|
maxvel = vector.new(3 * size,3 * size,3 * size),
|
||||||
minexptime = .6 * size,
|
minexptime = .6 * size,
|
||||||
@ -231,18 +232,17 @@ minetest.register_craftitem("mcl_bows:rocket", {
|
|||||||
end,
|
end,
|
||||||
_on_collide_with_entity = function(self, pos, obj)
|
_on_collide_with_entity = function(self, pos, obj)
|
||||||
if self._in_player == false then
|
if self._in_player == false then
|
||||||
|
pos = self.object:get_pos()
|
||||||
obj:punch(self.object, 1.0, {
|
obj:punch(self.object, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups={fleshy=self._damage},
|
damage_groups={fleshy=self._damage},
|
||||||
}, self.object:get_velocity())
|
}, self.object:get_velocity())
|
||||||
|
|
||||||
if obj:is_player() then
|
local eploded_particle = particle_explosion(pos)
|
||||||
local eploded_particle = particle_explosion(self)
|
damage_explosion(self, eploded_particle * 17, pos)
|
||||||
damage_explosion(self, eploded_particle * 17)
|
|
||||||
mcl_burning.extinguish(self.object)
|
mcl_burning.extinguish(self.object)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user