Addmore Too rockets

This commit is contained in:
epCode 2021-10-14 18:05:39 -07:00
parent 65bb7877ed
commit 570f9bf8c4
4 changed files with 202 additions and 64 deletions

View File

@ -32,74 +32,212 @@ local function random_arrow_positions(positions, placement)
return 0 return 0
end end
local function damage_explosion(self) local function damage_explosion(self, damagemulitplier)
local objects = minetest.get_objects_inside_radius(self.object:get_pos(), 10) local objects = minetest.get_objects_inside_radius(self.object:get_pos(), damagemulitplier * 8)
for _,obj in pairs(objects) do for _,obj in pairs(objects) do
if obj:is_player() then 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 elseif obj:get_luaentity()._cmi_is_mob then
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=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()) }, self.object:get_velocity())
end end
end end
end end
local function particle_explosion(self) local function particle_explosion(self)
minetest.sound_play("mcl_bows_firework", { local particle_pattern = math.random(1, 3)
pos = self.object:get_pos(), local fpitch = 0
max_hear_distance = 100, local true_type = ""
gain = 3.0, local type = math.random(1,2)
}, true) local size = math.random(1,3)
minetest.add_particlespawner({ local colors = {"red", "yellow", "blue", "green", "white"}
amount = 100, local this_colors = {colors[math.random(#colors)], colors[math.random(#colors)], colors[math.random(#colors)]}
time = 0.0001,
minpos = self.object:get_pos(), if size == 1 then
maxpos = self.object:get_pos(), fpitch = math.random(200, 300)
minvel = vector.new(-4,-4,-4), elseif size == 2 then
maxvel = vector.new(4,4,4), fpitch = math.random(100, 130)
minexptime = 1.1, else
maxexptime = 1.5, fpitch = math.random(60, 70)
minsize = 2, end
maxsize = 3,
collisiondetection = false, if type == 1 then
vertical = false, true_type = "Popper"
texture = "mcl_bows_firework_red.png", else
glow = 14, true_type = "Floof"
}) end
minetest.add_particlespawner({
amount = 100, if type == 1 then
time = 0.0001, minetest.sound_play("mcl_bows_firework", {
minpos = self.object:get_pos(), pos = self.object:get_pos(),
maxpos = self.object:get_pos(), max_hear_distance = 100,
minvel = vector.new(-9,-9,-9), gain = 3.0,
maxvel = vector.new(9,9,9), pitch = fpitch/100
minexptime = 1.1, }, true)
maxexptime = 1.5, else
minsize = 2, minetest.sound_play("mcl_bows_firework_soft", {
maxsize = 3, pos = self.object:get_pos(),
collisiondetection = false, max_hear_distance = 100,
vertical = false, gain = 4.0,
texture = "mcl_bows_firework_blue.png", pitch = fpitch/100
glow = 14, }, true)
}) end
minetest.add_particlespawner({
amount = 100, if particle_pattern == 1 then
time = 0.0001, minetest.add_particlespawner({
minpos = self.object:get_pos(), amount = 400 * size,
maxpos = self.object:get_pos(), time = 0.0001,
minvel = vector.new(-2,-2,-2), minpos = self.object:get_pos(),
maxvel = vector.new(2,2,2), maxpos = self.object:get_pos(),
minexptime = 1.1, minvel = vector.new(-7 * size,-7 * size,-7 * size),
maxexptime = 1.5, maxvel = vector.new(7 * size,7 * size,7 * size),
minsize = 2, minexptime = .6 * size / 2,
maxsize = 3, maxexptime = .9 * size / 2,
collisiondetection = false, minsize = 2 * size,
vertical = false, maxsize = 3 * size,
texture = "mcl_bows_firework_green.png", collisiondetection = false,
glow = 14, 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 end
local mod_awards = minetest.get_modpath("awards") and minetest.get_modpath("mcl_achievements") 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 end
if self._stuck then if self._stuck then
if self._fuse > ARROW_TIMEOUT then if self._fuse > ARROW_TIMEOUT then
particle_explosion(self) local eploded_particle = particle_explosion(self)
damage_explosion(self) damage_explosion(self, eploded_particle * 17)
mcl_burning.extinguish(self.object) mcl_burning.extinguish(self.object)
self.object:remove() self.object:remove()
return return
@ -346,8 +484,8 @@ function ARROW_ENTITY.on_step(self, dtime)
damage_groups={fleshy=self._damage}, damage_groups={fleshy=self._damage},
}, self.object:get_velocity()) }, self.object:get_velocity())
if obj:is_player() then if obj:is_player() then
particle_explosion(self) local eploded_particle = particle_explosion(self)
damage_explosion(self) damage_explosion(self, eploded_particle * 17)
mcl_burning.extinguish(self.object) mcl_burning.extinguish(self.object)
self.object:remove() self.object:remove()
end end
@ -380,8 +518,8 @@ function ARROW_ENTITY.on_step(self, dtime)
if not obj:is_player() then if not obj:is_player() then
mcl_burning.extinguish(self.object) mcl_burning.extinguish(self.object)
if self._piercing == 0 then if self._piercing == 0 then
particle_explosion(self) local eploded_particle = particle_explosion(self)
damage_explosion(self) damage_explosion(self, eploded_particle * 17)
self.object:remove() self.object:remove()
end end
end end
@ -556,7 +694,7 @@ if minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_mobitems") the
output = "mcl_bows:rocket 1", output = "mcl_bows:rocket 1",
recipe = { recipe = {
{"mcl_core:paper"}, {"mcl_core:paper"},
{"mcl_firewoks:rocket_2"}, {"mcl_fireworks:rocket_2"},
{"mcl_bows:arrow"}, {"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