From 1e49bf270a0ce13feada101c2fa206e60eada2f9 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 24 Oct 2019 14:21:49 +0200 Subject: [PATCH] Item entity: Also add smoke puff on timeout --- mods/builtin_item/init.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mods/builtin_item/init.lua b/mods/builtin_item/init.lua index cfe3ed4..53f91be 100644 --- a/mods/builtin_item/init.lua +++ b/mods/builtin_item/init.lua @@ -4,6 +4,14 @@ -- Tweaked by Kaadmy, for Pixture -- +local function add_item_death_particle(ent) + minetest.add_particle({ + pos = ent.object:get_pos(), + size = 3, + texture = "smoke_puff.png", + }) +end + minetest.register_entity( ":__builtin:item", { @@ -103,6 +111,7 @@ minetest.register_entity( self.timer = self.timer + dtime if time_to_live ~= -1 and (self.timer > time_to_live) then + add_item_death_particle(self) minetest.log("action", "[builtin_item] Item entity removed due to timeout at "..minetest.pos_to_string(self.object:get_pos())) self.object:remove() return @@ -117,11 +126,7 @@ minetest.register_entity( if minetest.get_item_group(name, "lava") ~= 0 or minetest.get_item_group(name, "fire") ~= 0 then minetest.sound_play("builtin_item_lava", {pos = self.object:get_pos(), gain = 0.45}) end - minetest.add_particle({ - pos = self.object:get_pos(), - size = 3, - texture = "smoke_puff.png", - }) + add_item_death_particle(self) minetest.log("action", "[builtin_item] Item entity destroyed in damaging node at "..minetest.pos_to_string(self.object:get_pos())) self.object:remove() return