forked from mtcontrib/mobs_monster
sand monsters kinda dissolve when killed
This commit is contained in:
parent
20fba93293
commit
55b2e8d429
@ -2,6 +2,34 @@
|
||||
local S = mobs.intllib
|
||||
|
||||
|
||||
-- custom particle effects
|
||||
local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow)
|
||||
|
||||
radius = radius or 2
|
||||
min_size = min_size or 0.5
|
||||
max_size = max_size or 1
|
||||
gravity = gravity or -10
|
||||
glow = glow or 0
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = amount,
|
||||
time = 0.25,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x = -radius, y = -radius, z = -radius},
|
||||
maxvel = {x = radius, y = radius, z = radius},
|
||||
minacc = {x = 0, y = gravity, z = 0},
|
||||
maxacc = {x = 0, y = gravity, z = 0},
|
||||
minexptime = 0.1,
|
||||
maxexptime = 1,
|
||||
minsize = min_size,
|
||||
maxsize = max_size,
|
||||
texture = texture,
|
||||
glow = glow,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
-- Sand Monster by PilzAdam
|
||||
|
||||
mobs:register_mob("mobs_monster:sand_monster", {
|
||||
@ -21,6 +49,7 @@ mobs:register_mob("mobs_monster:sand_monster", {
|
||||
textures = {
|
||||
{"mobs_sand_monster.png"},
|
||||
},
|
||||
blood_texture = "default_sand.png",
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
random = "mobs_sandmonster",
|
||||
@ -55,6 +84,13 @@ mobs:register_mob("mobs_monster:sand_monster", {
|
||||
minetest.add_item(pos, "default:sand")
|
||||
end,
|
||||
]]
|
||||
on_die = function(self, pos)
|
||||
pos.y = pos.y + 0.5
|
||||
effect(pos, 20, "default_sand.png", nil, nil, 0.5, nil)
|
||||
pos.y = pos.y + 0.25
|
||||
effect(pos, 20, "default_sand.png", nil, nil, 1, nil)
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user