forked from VoxeLibre/VoxeLibre
Addmore Too rockets
This commit is contained in:
parent
65bb7877ed
commit
570f9bf8c4
|
@ -32,74 +32,212 @@ local function random_arrow_positions(positions, placement)
|
|||
return 0
|
||||
end
|
||||
|
||||
local function damage_explosion(self)
|
||||
local objects = minetest.get_objects_inside_radius(self.object:get_pos(), 10)
|
||||
local function damage_explosion(self, damagemulitplier)
|
||||
local objects = minetest.get_objects_inside_radius(self.object:get_pos(), damagemulitplier * 8)
|
||||
for _,obj in pairs(objects) do
|
||||
if obj:is_player() then
|
||||
mcl_util.deal_damage(obj, 17 - vector.distance(self.object:get_pos(), obj:get_pos()), {type = "explosion"})
|
||||
mcl_util.deal_damage(obj, damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos()), {type = "explosion"})
|
||||
elseif obj:get_luaentity()._cmi_is_mob then
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
damage_groups={fleshy=17 - vector.distance(self.object:get_pos(), obj:get_pos())},
|
||||
damage_groups={fleshy=damagemulitplier - vector.distance(self.object:get_pos(), obj:get_pos())},
|
||||
}, self.object:get_velocity())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function particle_explosion(self)
|
||||
minetest.sound_play("mcl_bows_firework", {
|
||||
pos = self.object:get_pos(),
|
||||
max_hear_distance = 100,
|
||||
gain = 3.0,
|
||||
}, true)
|
||||
minetest.add_particlespawner({
|
||||
amount = 100,
|
||||
time = 0.0001,
|
||||
minpos = self.object:get_pos(),
|
||||
maxpos = self.object:get_pos(),
|
||||
minvel = vector.new(-4,-4,-4),
|
||||
maxvel = vector.new(4,4,4),
|
||||
minexptime = 1.1,
|
||||
maxexptime = 1.5,
|
||||
minsize = 2,
|
||||
maxsize = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "mcl_bows_firework_red.png",
|
||||
glow = 14,
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 100,
|
||||
time = 0.0001,
|
||||
minpos = self.object:get_pos(),
|
||||
maxpos = self.object:get_pos(),
|
||||
minvel = vector.new(-9,-9,-9),
|
||||
maxvel = vector.new(9,9,9),
|
||||
minexptime = 1.1,
|
||||
maxexptime = 1.5,
|
||||
minsize = 2,
|
||||
maxsize = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "mcl_bows_firework_blue.png",
|
||||
glow = 14,
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 100,
|
||||
time = 0.0001,
|
||||
minpos = self.object:get_pos(),
|
||||
maxpos = self.object:get_pos(),
|
||||
minvel = vector.new(-2,-2,-2),
|
||||
maxvel = vector.new(2,2,2),
|
||||
minexptime = 1.1,
|
||||
maxexptime = 1.5,
|
||||
minsize = 2,
|
||||
maxsize = 3,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "mcl_bows_firework_green.png",
|
||||
glow = 14,
|
||||
})
|
||||
local particle_pattern = math.random(1, 3)
|
||||
local fpitch = 0
|
||||
local true_type = ""
|
||||
local type = math.random(1,2)
|
||||
local size = math.random(1,3)
|
||||
local colors = {"red", "yellow", "blue", "green", "white"}
|
||||
local this_colors = {colors[math.random(#colors)], colors[math.random(#colors)], colors[math.random(#colors)]}
|
||||
|
||||
if size == 1 then
|
||||
fpitch = math.random(200, 300)
|
||||
elseif size == 2 then
|
||||
fpitch = math.random(100, 130)
|
||||
else
|
||||
fpitch = math.random(60, 70)
|
||||
end
|
||||
|
||||
if type == 1 then
|
||||
true_type = "Popper"
|
||||
else
|
||||
true_type = "Floof"
|
||||
end
|
||||
|
||||
if type == 1 then
|
||||
minetest.sound_play("mcl_bows_firework", {
|
||||
pos = self.object:get_pos(),
|
||||
max_hear_distance = 100,
|
||||
gain = 3.0,
|
||||
pitch = fpitch/100
|
||||
}, true)
|
||||
else
|
||||
minetest.sound_play("mcl_bows_firework_soft", {
|
||||
pos = self.object:get_pos(),
|
||||
max_hear_distance = 100,
|
||||
gain = 4.0,
|
||||
pitch = fpitch/100
|
||||
}, true)
|
||||
end
|
||||
|
||||
if particle_pattern == 1 then
|
||||
minetest.add_particlespawner({
|
||||
amount = 400 * size,
|
||||
time = 0.0001,
|
||||
minpos = self.object:get_pos(),
|
||||
maxpos = self.object:get_pos(),
|
||||
minvel = vector.new(-7 * size,-7 * size,-7 * size),
|
||||
maxvel = vector.new(7 * size,7 * size,7 * size),
|
||||
minexptime = .6 * size / 2,
|
||||
maxexptime = .9 * size / 2,
|
||||
minsize = 2 * size,
|
||||
maxsize = 3 * size,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "mcl_bows_firework_"..this_colors[1]..".png",
|
||||
glow = 14,
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 400 * size,
|
||||
time = 0.0001,
|
||||
minpos = self.object:get_pos(),
|
||||
maxpos = self.object:get_pos(),
|
||||
minvel = vector.new(-2 * size,-2 * size,-2 * size),
|
||||
maxvel = vector.new(2 * size,2 * size,2 * size),
|
||||
minexptime = .6 * size / 2,
|
||||
maxexptime = .9 * size / 2,
|
||||
minsize = 2 * size,
|
||||
maxsize = 3 * size,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "mcl_bows_firework_"..this_colors[2]..".png",
|
||||
glow = 14,
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 100 * size,
|
||||
time = 0.0001,
|
||||
minpos = self.object:get_pos(),
|
||||
maxpos = self.object:get_pos(),
|
||||
minvel = vector.new(-14 * size,-14 * size,-14 * size),
|
||||
maxvel = vector.new(14 * size,14 * size,14 * size),
|
||||
minexptime = .6 * size / 2,
|
||||
maxexptime = .9 * size / 2,
|
||||
minsize = 2 * size,
|
||||
maxsize = 3 * size,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "mcl_bows_firework_"..this_colors[3]..".png",
|
||||
glow = 14,
|
||||
})
|
||||
elseif particle_pattern == 2 then
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = 240 * size,
|
||||
time = 0.0001,
|
||||
minpos = self.object:get_pos(),
|
||||
maxpos = self.object:get_pos(),
|
||||
minvel = vector.new(-5 * size,-5 * size,-5 * size),
|
||||
maxvel = vector.new(5 * size,5 * size,5 * size),
|
||||
minexptime = .6 * size / 2,
|
||||
maxexptime = .9 * size / 2,
|
||||
minsize = 2 * size,
|
||||
maxsize = 3 * size,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "mcl_bows_firework_"..this_colors[1]..".png",
|
||||
glow = 14,
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 500 * size,
|
||||
time = 0.0001,
|
||||
minpos = self.object:get_pos(),
|
||||
maxpos = self.object:get_pos(),
|
||||
minvel = vector.new(-2 * size,-2 * size,-2 * size),
|
||||
maxvel = vector.new(2 * size,2 * size,2 * size),
|
||||
minexptime = .6 * size / 2,
|
||||
maxexptime = .9 * size / 2,
|
||||
minsize = 2 * size,
|
||||
maxsize = 3 * size,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "mcl_bows_firework_"..this_colors[2]..".png",
|
||||
glow = 14,
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 350 * size,
|
||||
time = 0.0001,
|
||||
minpos = self.object:get_pos(),
|
||||
maxpos = self.object:get_pos(),
|
||||
minvel = vector.new(-3 * size,-3 * size,-3 * size),
|
||||
maxvel = vector.new(3 * size,3 * size,3 * size),
|
||||
minexptime = .6 * size / 2,
|
||||
maxexptime = .9 * size / 2,
|
||||
minsize = 2 * size,
|
||||
maxsize = 3 * size,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "mcl_bows_firework_"..this_colors[3]..".png",
|
||||
glow = 14,
|
||||
})
|
||||
elseif particle_pattern == 3 then
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = 400 * size,
|
||||
time = 0.0001,
|
||||
minpos = self.object:get_pos(),
|
||||
maxpos = self.object:get_pos(),
|
||||
minvel = vector.new(-6 * size,-4 * size,-6 * size),
|
||||
maxvel = vector.new(6 * size,4 * size,6 * size),
|
||||
minexptime = .6 * size,
|
||||
maxexptime = .9 * size,
|
||||
minsize = 2 * size,
|
||||
maxsize = 3 * size,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "mcl_bows_firework_"..this_colors[1]..".png",
|
||||
glow = 14,
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 120 * size,
|
||||
time = 0.0001,
|
||||
minpos = self.object:get_pos(),
|
||||
maxpos = self.object:get_pos(),
|
||||
minvel = vector.new(-8 * size,6 * size,-8 * size),
|
||||
maxvel = vector.new(8 * size,6 * size,8 * size),
|
||||
minexptime = .6 * size,
|
||||
maxexptime = .9 * size,
|
||||
minsize = 2 * size,
|
||||
maxsize = 3 * size,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "mcl_bows_firework_"..this_colors[2]..".png",
|
||||
glow = 14,
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 130 * size,
|
||||
time = 0.0001,
|
||||
minpos = self.object:get_pos(),
|
||||
maxpos = self.object:get_pos(),
|
||||
minvel = vector.new(-3 * size,3 * size,-3 * size),
|
||||
maxvel = vector.new(3 * size,3 * size,3 * size),
|
||||
minexptime = .6 * size,
|
||||
maxexptime = .9 * size,
|
||||
minsize = 2 * size,
|
||||
maxsize = 3 * size,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "mcl_bows_firework_"..this_colors[3]..".png",
|
||||
glow = 14,
|
||||
})
|
||||
end
|
||||
|
||||
return size
|
||||
|
||||
end
|
||||
|
||||
local mod_awards = minetest.get_modpath("awards") and minetest.get_modpath("mcl_achievements")
|
||||
|
@ -209,8 +347,8 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
end
|
||||
if self._stuck then
|
||||
if self._fuse > ARROW_TIMEOUT then
|
||||
particle_explosion(self)
|
||||
damage_explosion(self)
|
||||
local eploded_particle = particle_explosion(self)
|
||||
damage_explosion(self, eploded_particle * 17)
|
||||
mcl_burning.extinguish(self.object)
|
||||
self.object:remove()
|
||||
return
|
||||
|
@ -346,8 +484,8 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
damage_groups={fleshy=self._damage},
|
||||
}, self.object:get_velocity())
|
||||
if obj:is_player() then
|
||||
particle_explosion(self)
|
||||
damage_explosion(self)
|
||||
local eploded_particle = particle_explosion(self)
|
||||
damage_explosion(self, eploded_particle * 17)
|
||||
mcl_burning.extinguish(self.object)
|
||||
self.object:remove()
|
||||
end
|
||||
|
@ -380,8 +518,8 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
if not obj:is_player() then
|
||||
mcl_burning.extinguish(self.object)
|
||||
if self._piercing == 0 then
|
||||
particle_explosion(self)
|
||||
damage_explosion(self)
|
||||
local eploded_particle = particle_explosion(self)
|
||||
damage_explosion(self, eploded_particle * 17)
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
|
@ -556,7 +694,7 @@ if minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_mobitems") the
|
|||
output = "mcl_bows:rocket 1",
|
||||
recipe = {
|
||||
{"mcl_core:paper"},
|
||||
{"mcl_firewoks:rocket_2"},
|
||||
{"mcl_fireworks:rocket_2"},
|
||||
{"mcl_bows:arrow"},
|
||||
}
|
||||
})
|
||||
|
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in New Issue