Move death particle to rp_textures

This commit is contained in:
Wuzzy 2024-03-21 22:34:23 +01:00
parent 54760539ff
commit 06cee828c1
6 changed files with 55 additions and 52 deletions

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator("rp_mobs") local S = minetest.get_translator("rp_mobs")
local mod_textures = minetest.get_modpath("rp_textures") ~= nil
-- If true, will write the task queues of mobs as their nametag -- If true, will write the task queues of mobs as their nametag
local TASK_DEBUG = false local TASK_DEBUG = false
local STATE_DEBUG = false local STATE_DEBUG = false
@ -337,29 +339,30 @@ end
rp_mobs.on_death_default = function(self, killer) rp_mobs.on_death_default = function(self, killer)
local radius = get_mob_death_particle_radius(self) local radius = get_mob_death_particle_radius(self)
local pos = self.object:get_pos() local pos = self.object:get_pos()
minetest.add_particlespawner({ if mod_textures then
amount = 16, minetest.add_particlespawner({
time = 0.02, amount = 16,
pos = { time = 0.02,
min = vector.subtract(pos, radius / 2), pos = {
max = vector.add(pos, radius / 2), min = vector.subtract(pos, radius / 2),
}, max = vector.add(pos, radius / 2),
vel = { },
min = vector.new(-1, 0, -1), vel = {
max = vector.new(1, 2, 1), min = vector.new(-1, 0, -1),
}, max = vector.new(1, 2, 1),
acc = vector.zero(), },
exptime = { min = 0.4, max = 0.8 }, acc = vector.zero(),
size = { min = 8, max = 12 }, exptime = { min = 0.4, max = 0.8 },
drag = vector.new(1,1,1), size = { min = 8, max = 12 },
-- TODO: Move particle to particle mod drag = vector.new(1,1,1),
texture = { texture = {
name = "rp_mobs_death_smoke_anim_1.png", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 }, name = "rp_textures_death_smoke_anim_1.png", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 },
name = "rp_mobs_death_smoke_anim_2.png", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 }, name = "rp_textures_death_smoke_anim_2.png", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 },
name = "rp_mobs_death_smoke_anim_1.png^[transformFX", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 }, name = "rp_textures_death_smoke_anim_1.png^[transformFX", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 },
name = "rp_mobs_death_smoke_anim_2.png^[transformFX", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 }, name = "rp_textures_death_smoke_anim_2.png^[transformFX", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 },
}, },
}) })
end
minetest.sound_play({name="rp_sounds_disappear", gain=0.4}, {pos=pos, max_hear_distance=12}, true) minetest.sound_play({name="rp_sounds_disappear", gain=0.4}, {pos=pos, max_hear_distance=12}, true)
rp_mobs.drop_death_items(self) rp_mobs.drop_death_items(self)
end end

View File

@ -2,4 +2,4 @@ name = rp_mobs
title = Repixture Mobs API title = Repixture Mobs API
description = Core logic for animals, monsters and other moving creatures description = Core logic for animals, monsters and other moving creatures
depends = rp_default, rp_sounds, rp_achievements, rp_hud depends = rp_default, rp_sounds, rp_achievements, rp_hud
optional_depends = rp_itemdef_defaults optional_depends = rp_itemdef_defaults, rp_textures

View File

@ -1,2 +1,2 @@
name = rp_player name = rp_player
optional_depends = rp_sounds, rp_achievements optional_depends = rp_sounds, rp_achievements, rp_textures

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator("rp_player") local S = minetest.get_translator("rp_player")
local mod_textures = minetest.get_modpath("rp_textures") ~= nil
local player_soundspec = {} local player_soundspec = {}
local player_lastsound = {} local player_lastsound = {}
local player_health = {} local player_health = {}
@ -153,29 +155,30 @@ end
local function on_respawnplayer(player) local function on_respawnplayer(player)
local pos = player:get_pos() local pos = player:get_pos()
minetest.add_particlespawner({ if mod_textures then
amount = 16, minetest.add_particlespawner({
time = 0.02, amount = 16,
pos = { time = 0.02,
min = vector.add(pos, vector.new(-0.4, 0.0, -0.4)), pos = {
max = vector.add(pos, vector.new(0.4, 0.1, 0.4)), min = vector.add(pos, vector.new(-0.4, 0.0, -0.4)),
}, max = vector.add(pos, vector.new(0.4, 0.1, 0.4)),
vel = { },
min = vector.new(-1, 0.2, -1), vel = {
max = vector.new(1, 2, 1), min = vector.new(-1, 0.2, -1),
}, max = vector.new(1, 2, 1),
acc = vector.zero(), },
exptime = { min = 1.0, max = 1.5 }, acc = vector.zero(),
size = { min = 8, max = 12 }, exptime = { min = 1.0, max = 1.5 },
drag = vector.new(1,1,1), size = { min = 8, max = 12 },
-- TODO: Move particle to particle mod drag = vector.new(1,1,1),
texture = { texture = {
name = "rp_mobs_death_smoke_anim_1.png", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 }, name = "rp_textures_death_smoke_anim_1.png", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 },
name = "rp_mobs_death_smoke_anim_2.png", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 }, name = "rp_textures_death_smoke_anim_2.png", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 },
name = "rp_mobs_death_smoke_anim_1.png^[transformFX", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 }, name = "rp_textures_death_smoke_anim_1.png^[transformFX", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 },
name = "rp_mobs_death_smoke_anim_2.png^[transformFX", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 }, name = "rp_textures_death_smoke_anim_2.png^[transformFX", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 },
}, },
}) })
end
minetest.sound_play({name="rp_sounds_disappear", gain=0.4}, {pos=pos, max_hear_distance=12}, true) minetest.sound_play({name="rp_sounds_disappear", gain=0.4}, {pos=pos, max_hear_distance=12}, true)
end end
@ -213,9 +216,6 @@ end
minetest.register_on_joinplayer(on_joinplayer) minetest.register_on_joinplayer(on_joinplayer)
minetest.register_on_leaveplayer(on_leaveplayer) minetest.register_on_leaveplayer(on_leaveplayer)
-- TODO: Remove mod requirement if particle moved to particle mod minetest.register_on_respawnplayer(on_respawnplayer)
if minetest.get_modpath("rp_mobs") then
minetest.register_on_respawnplayer(on_respawnplayer)
end
minetest.register_globalstep(step) minetest.register_globalstep(step)

View File

Before

Width:  |  Height:  |  Size: 202 B

After

Width:  |  Height:  |  Size: 202 B

View File

Before

Width:  |  Height:  |  Size: 202 B

After

Width:  |  Height:  |  Size: 202 B