Add firework damage

This commit is contained in:
IamPyu 2024-12-06 20:45:41 -06:00
parent ccb678a33a
commit 4f0d920988
9 changed files with 43 additions and 7 deletions

View File

@ -11,6 +11,7 @@ Notable Game Changes:
- Improved Stairs
- Added Reinforced Glass
- Add back the Rubies that were removed a while ago!
- Replaced Spawnpoints with a item
Other Game Changes:
@ -31,6 +32,8 @@ Other Game Changes:
- Fire is now marked as floodable
- You can now walk through leaves
- Make crop hitbox smaller
- Fireworks now damage entities when they're too close to the explosion
- Added new damage type `fireworks`
Code Changes:

View File

@ -16,6 +16,14 @@ PyuTest.DAMAGE_TYPES = {
}
}
end,
fireworks = function ()
return {
type = "set_hp",
_pyutest = {
type = "fireworks",
}
}
end,
burning = function ()
return {
type = "set_hp",
@ -55,6 +63,8 @@ core.register_on_dieplayer(function(player, reason)
if newreason.type == "explosion" then
message = string.format("%s blew up", playername)
elseif newreason.type == "fireworks" then
message = string.format("%s went off with a bang", playername)
elseif newreason.type == "burning" then
message = string.format("%s burned to death", playername)
end

View File

@ -25,7 +25,6 @@ core.register_entity("pyutest_fireworks:firework", {
trail = function(self)
local pos = self.object:get_pos() - vector.new(0, 1, 0)
local velocity = vector.new(math.random(-1, 1), 0, math.random(-1, 1))
if math.random(1, 2) == 1 then
@ -65,6 +64,12 @@ core.register_entity("pyutest_fireworks:firework", {
local pos = self.object:get_pos()
for _, v in pairs(core.get_objects_inside_radius(pos, 3)) do
if v ~= self.object then
PyuTest.deal_damage(v, 9, PyuTest.DAMAGE_TYPES.fireworks())
end
end
core.add_particlespawner({
amount = math.random(20, 40),
time = 0.8,

View File

@ -0,0 +1,17 @@
-- core.hud_replace_builtin("health", {})
-- PyuTest.HUDBARS = {
-- }
-- core.hud_replace_builtin("health", {
-- hud_elem_type = "statbar",
-- text = "pyutest-bar-health.png",
-- text2 = "pyutest-bar-empty.png",
-- number = core.PLAYER_MAX_HP_DEFAULT,
-- item = core.PLAYER_MAX_HP_DEFAULT,
-- position = {x = 0.5, y = 1},
-- direction = 0,
-- size = {x = 24, y = 24},
-- offset = {x = (-10 * 24) - 25, y = -(48 + 24 + 16)},
-- })

View File

@ -23,16 +23,17 @@ end
core.register_on_shutdown(save_data)
PyuTest.register_interval(save_data, 10)
PyuTest.make_node("pyutest_spawnpoints:spawnpoint", "Spawnpoint", {
choppy = PyuTest.BLOCK_FAST,
block = 1
}, { "pyutest-spawnpoint.png" }, {
on_rightclick = function(pos, node, clicker)
PyuTest.make_item("pyutest_spawnpoints:spawnpoint", "Spawnpoint Setter", {}, "pyutest-star.png", {
color = PyuTest.COLORS.khaki[2],
on_use = function(itemstack, clicker)
if clicker == nil then return end
if not clicker:is_player() then return end
local name = clicker:get_player_name()
spawnpoints[name] = pos
spawnpoints[name] = clicker:get_pos()
itemstack:take_item()
return itemstack
end
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

BIN
textures/pyutest-star.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B