From 1c285f77d964aec25952e02d8ff03ff40031e595 Mon Sep 17 00:00:00 2001 From: Billy S Date: Wed, 25 Jul 2018 09:43:02 -0400 Subject: [PATCH] Removed unnecessary for loop --- handlers.lua | 9 +-------- init.lua | 2 -- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/handlers.lua b/handlers.lua index 41268ae..46cb5e8 100644 --- a/handlers.lua +++ b/handlers.lua @@ -71,14 +71,7 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, if knockout.knocked_out[victim] ~= nil then return end if currHp <= 0 then return end local tool = hitter:get_wielded_item():get_name() -- Get tool used - local def = nil - -- Get tool knockout def - for name, tdef in pairs(knockout.tools) do - if name == tool then - def = tdef - break - end - end + local def = knockout.tools[tool] if def == nil then return end -- Calculate if currHp <= def.max_health then diff --git a/init.lua b/init.lua index 5388952..503b9a0 100644 --- a/init.lua +++ b/init.lua @@ -1,8 +1,6 @@ local path = minetest.get_modpath(minetest.get_current_modname()) dofile(path .. "/overrides.lua") - - -- Create globals knockout = {} knockout.knocked_out = {}