Restructure code to only check `def` once.
authorred-001 <red-001@openmailbox.org>
Wed, 23 Mar 2016 11:01:59 +0000 (11:01 +0000)
committerparamat <mat.gregory@virginmedia.com>
Sat, 16 Apr 2016 18:27:16 +0000 (19:27 +0100)
mods/tnt/init.lua

index 83630d93874fdeb620f2565d4876acf606e0ea79..a3c2bf99e0ac4e064851f85384f695af04a6db19 100644 (file)
@@ -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