new death particles

master
Juraj Vajda 2018-12-12 19:36:14 -05:00
parent db777f93cd
commit 9212bd7ddc
2 changed files with 29 additions and 3 deletions

32
api.lua
View File

@ -420,6 +420,34 @@ local flight_check = function(self, pos_w)
return false
end
local function mobs_death_cloud(pos)
pos.y = pos.y + 0.5
minetest.add_particlespawner({
amount = 3,
time = 0.5,
minpos = { x = pos.x-1, y = pos.y, z = pos.z-1 },
maxpos = { x = pos.x+1, y = pos.y, z = pos.z+1 },
minvel = { x = -0.5, y = 1, z = -0.5 },
maxvel = { x = 0.5, y = 2, z = 0.5 },
minacc = vector.new({ x = -0.5, y = 1, z = -0.5 }),
maxacc = vector.new({ x = 0.5, y = 4, z = 0.5 }),
minexptime = 0.5,
maxexptime = 1,
minsize = 16,
maxsize = 24,
texture = "mobs_death_particle_animated.png",
animation = {
type = "vertical_frames",
-- Width of a frame in pixels
aspect_w = 16,
-- Height of a frame in pixels
aspect_h = 16,
-- Full loop length
length = 1,
},
})
end
-- custom particle effects
local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow)
@ -493,8 +521,6 @@ local item_drop = function(self)
local death_by_player = self.cause_of_death and self.cause_of_death.puncher
and self.cause_of_death.puncher:is_player() or nil
print("cause_of_death", dump(cause_of_death))
local obj, item, num
local pos = self.object:get_pos()
@ -639,7 +665,7 @@ local check_for_death = function(self, cmi_cause)
self.object:remove()
end
effect(pos, 20, "tnt_smoke.png")
mobs_death_cloud(pos)
return true
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B