From a84e2669c7ee1482678941aec5b5ce3263f6b569 Mon Sep 17 00:00:00 2001 From: red-001 Date: Wed, 23 Mar 2016 11:01:59 +0000 Subject: [PATCH] Restructure code to only check `def` once. --- mods/tnt/init.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua index 83630d93..a3c2bf99 100644 --- a/mods/tnt/init.lua +++ b/mods/tnt/init.lua @@ -88,13 +88,14 @@ local function destroy(drops, npos, cid, c_air, c_fire, on_blast_queue, ignore_p if not ignore_protection and minetest.is_protected(npos, "") then return cid end + local def = cid_data[cid] - if not ignore_on_blast and def and def.on_blast then - on_blast_queue[#on_blast_queue + 1] = {pos = vector.new(npos), on_blast = def.on_blast} - return cid - end + if not def then return c_air + elseif not ignore_on_blast and def.on_blast then + on_blast_queue[#on_blast_queue + 1] = {pos = vector.new(npos), on_blast = def.on_blast} + return cid elseif def.flammable then return c_fire else -- 2.25.1