From 0097c42e0a900e86f56ae5860e6f13b4e39e4486 Mon Sep 17 00:00:00 2001 From: Riggs Date: Fri, 21 Jun 2024 13:24:39 +0200 Subject: [PATCH 1/2] Update sh_util.lua --- gamemode/core/sh_util.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gamemode/core/sh_util.lua b/gamemode/core/sh_util.lua index af0b3dc9..0025f501 100644 --- a/gamemode/core/sh_util.lua +++ b/gamemode/core/sh_util.lua @@ -903,13 +903,19 @@ ALWAYS_RAISED["weapon_physgun"] = true ALWAYS_RAISED["gmod_tool"] = true ALWAYS_RAISED["ix_poshelper"] = true -function ix.util.FindEmptySpace(entity, filter, spacing, size, height, tolerance) +function ix.util.FindEmptySpace(variable, filter, spacing, size, height, tolerance) + filter = filter or {} spacing = spacing or 32 size = size or 3 height = height or 36 tolerance = tolerance or 5 - local position = entity:GetPos() + local position = isvector(variable) and variable or isentity(variable) and variable:GetPos() + print(position) + if (!position) then + return + end + local mins, maxs = Vector(-spacing * 0.5, -spacing * 0.5, 0), Vector(spacing * 0.5, spacing * 0.5, height) local output = {} @@ -920,7 +926,7 @@ function ix.util.FindEmptySpace(entity, filter, spacing, size, height, tolerance local data = {} data.start = origin + mins + Vector(0, 0, tolerance) data.endpos = origin + maxs - data.filter = filter or entity + data.filter = filter or isentity(variable) and variable or {} local trace = util.TraceLine(data) data.start = origin + Vector(-maxs.x, -maxs.y, tolerance) From 9e73732cdfad27afc1cc3b45b467d27ebdbb60df Mon Sep 17 00:00:00 2001 From: Riggs Date: Fri, 21 Jun 2024 13:24:44 +0200 Subject: [PATCH 2/2] Update sh_util.lua --- gamemode/core/sh_util.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/gamemode/core/sh_util.lua b/gamemode/core/sh_util.lua index 0025f501..28652655 100644 --- a/gamemode/core/sh_util.lua +++ b/gamemode/core/sh_util.lua @@ -911,7 +911,6 @@ function ix.util.FindEmptySpace(variable, filter, spacing, size, height, toleran tolerance = tolerance or 5 local position = isvector(variable) and variable or isentity(variable) and variable:GetPos() - print(position) if (!position) then return end