diff --git a/mods/CORE/mcl_particles/textures/mcl_particles_mob_death.png b/mods/CORE/mcl_particles/textures/mcl_particles_mob_death.png new file mode 100644 index 00000000..6dc9cdc6 Binary files /dev/null and b/mods/CORE/mcl_particles/textures/mcl_particles_mob_death.png differ diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 9d9c9163..6dac2e60 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -571,7 +571,7 @@ local damage_effect = function(self, damage) end end -mobs.death_effect = function(pos, collisionbox) +mobs.death_effect = function(pos, yaw, collisionbox) local min, max if collisionbox then min = {x=collisionbox[1], y=collisionbox[2], z=collisionbox[3]} @@ -580,20 +580,33 @@ mobs.death_effect = function(pos, collisionbox) min = { x = -0.5, y = 0, z = -0.5 } max = { x = 0.5, y = 0.5, z = 0.5 } end + min = vector.rotate(min, {x=0, y=yaw, z=math.pi/2}) + max = vector.rotate(max, {x=0, y=yaw, z=math.pi/2}) + min, max = vector.sort(min, max) + min = vector.multiply(min, 0.5) + max = vector.multiply(max, 0.5) minetest.add_particlespawner({ - amount = 40, - time = 0.1, + amount = 50, + time = 0.001, minpos = vector.add(pos, min), maxpos = vector.add(pos, max), - minvel = {x = -0.2, y = -0.1, z = -0.2}, - maxvel = {x = 0.2, y = 0.1, z = 0.2}, - minexptime = 0.5, + minvel = vector.new(-5,-5,-5), + maxvel = vector.new(5,5,5), + minexptime = 1.1, maxexptime = 1.5, - minsize = 0.5, - maxsize = 1.5, - texture = "mcl_particles_smoke.png", + minsize = 1, + maxsize = 2, + collisiondetection = false, + vertical = false, + texture = "mcl_particles_mob_death.png^[colorize:#000000:255", }) + + minetest.sound_play("mcl_mobs_mob_poof", { + pos = pos, + gain = 1.0, + max_hear_distance = 8, + }, true) end local update_tag = function(self) @@ -746,10 +759,11 @@ local check_for_death = function(self, cause, cmi_cause) -- execute custom death function if self.on_die then - death_handle(self) - local pos = self.object:get_pos() local on_die_exit = self.on_die(self, pos) + if on_die_exit ~= true then + death_handle(self) + end if use_cmi then cmi.notify_die(self.object, cmi_cause) @@ -805,8 +819,10 @@ local check_for_death = function(self, cause, cmi_cause) death_handle(self) local dpos = self.object:get_pos() + local cbox = self.collisionbox + local yaw = self.object:get_rotation().y self.object:remove() - mobs.death_effect(dpos) + mobs.death_effect(dpos, yaw, cbox) end, self) diff --git a/mods/ENTITIES/mcl_mobs/readme.MD b/mods/ENTITIES/mcl_mobs/readme.MD index 0d332f85..aa79d909 100644 --- a/mods/ENTITIES/mcl_mobs/readme.MD +++ b/mods/ENTITIES/mcl_mobs/readme.MD @@ -10,13 +10,14 @@ This mod contains the API only for adding your own mobs into the world, so pleas https://forum.minetest.net/viewtopic.php?f=11&t=9917 +------------ +Credits: -Items: - -- Nametag (paper, black dye, string) can be used right-click on a tamed mob to give them a name. - -Lucky Block items: 1 +mcl_mobs_mob_poof.ogg: +- by Planman (license: Creative Commons Zero) +- Source: +------------ Changelog from original Mobs Redo mod: - 1.41- Mob pathfinding has been updated thanks to Elkien3 diff --git a/mods/ENTITIES/mcl_mobs/sounds/mcl_mobs_mob_poof.ogg b/mods/ENTITIES/mcl_mobs/sounds/mcl_mobs_mob_poof.ogg new file mode 100644 index 00000000..9f683c0c Binary files /dev/null and b/mods/ENTITIES/mcl_mobs/sounds/mcl_mobs_mob_poof.ogg differ