From: red-001 Date: Wed, 23 Mar 2016 11:01:59 +0000 (+0000) Subject: Restructure code to only check `def` once. X-Git-Tag: 0.4.14~39 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a84e2669c7ee1482678941aec5b5ce3263f6b569;p=oweals%2Fminetest_game.git Restructure code to only check `def` once. --- 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