Removed unnecessary for loop

This commit is contained in:
Billy S 2018-07-25 09:43:02 -04:00
parent 059666e0f6
commit 1c285f77d9
2 changed files with 1 additions and 10 deletions

View File

@ -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 knockout.knocked_out[victim] ~= nil then return end
if currHp <= 0 then return end if currHp <= 0 then return end
local tool = hitter:get_wielded_item():get_name() -- Get tool used local tool = hitter:get_wielded_item():get_name() -- Get tool used
local def = nil local def = knockout.tools[tool]
-- Get tool knockout def
for name, tdef in pairs(knockout.tools) do
if name == tool then
def = tdef
break
end
end
if def == nil then return end if def == nil then return end
-- Calculate -- Calculate
if currHp <= def.max_health then if currHp <= def.max_health then

View File

@ -1,8 +1,6 @@
local path = minetest.get_modpath(minetest.get_current_modname()) local path = minetest.get_modpath(minetest.get_current_modname())
dofile(path .. "/overrides.lua") dofile(path .. "/overrides.lua")
-- Create globals -- Create globals
knockout = {} knockout = {}
knockout.knocked_out = {} knockout.knocked_out = {}