From 9b40b56dfce78e1973b801cab39f1ef92afae95c Mon Sep 17 00:00:00 2001 From: oilboi Date: Fri, 24 Apr 2020 07:58:17 -0400 Subject: [PATCH] Make touch_hurt EVEN MORE efficient --- mods/new_functions/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/new_functions/init.lua b/mods/new_functions/init.lua index 763cdd4..0034884 100644 --- a/mods/new_functions/init.lua +++ b/mods/new_functions/init.lua @@ -84,6 +84,7 @@ local a_min local a_max local v_add = vector.add local v_sub = vector.subtract +local get_number = table.getn local function index_players_surroundings() for _,player in ipairs(minetest.get_connected_players()) do if player:get_hp() > 0 then @@ -109,7 +110,8 @@ local function index_players_surroundings() a_min = v_sub(pos,1) a_max = v_add(pos,1) damage_pos = minetest.find_nodes_in_area(a_min, a_max, hurt_nodes) - if damage_pos then + + if get_number(damage_pos) > 0 then for _,found_location in ipairs(damage_pos) do collisionbox = registered_nodes[get_node(found_location).name].collision_box if not collisionbox then