From 39c9d96924a799df3425e3d26090667e346b726d Mon Sep 17 00:00:00 2001 From: rtldg <55846624+rtldg@users.noreply.github.com> Date: Sun, 19 Dec 2021 10:46:15 +0000 Subject: [PATCH] don't do zone offset stuff on mins/maxs if the offset is bigger than the zone's x/y half-distance xc_fox_shrine_japan_v1 will crash if i make a 16unit zone at the top (maybe elsewhere too?) so that's why this was added. --- addons/sourcemod/scripting/shavit-zones.sp | 25 +++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/addons/sourcemod/scripting/shavit-zones.sp b/addons/sourcemod/scripting/shavit-zones.sp index a2ed06ef8..f26f0aed8 100644 --- a/addons/sourcemod/scripting/shavit-zones.sp +++ b/addons/sourcemod/scripting/shavit-zones.sp @@ -3877,15 +3877,30 @@ public void CreateZoneEntities(bool only_create_dead_entities) float height = ((IsSource2013(gEV_Type))? 62.0:72.0) / 2; float min[3]; - min[0] = -distance_x + gCV_BoxOffset.FloatValue; - min[1] = -distance_y + gCV_BoxOffset.FloatValue; + min[0] = -distance_x; + min[1] = -distance_y; min[2] = -distance_z + height; - SetEntPropVector(entity, Prop_Send, "m_vecMins", min); float max[3]; - max[0] = distance_x - gCV_BoxOffset.FloatValue; - max[1] = distance_y - gCV_BoxOffset.FloatValue; + max[0] = distance_x; + max[1] = distance_y; max[2] = distance_z - height; + + float offset = gCV_BoxOffset.FloatValue; + + if (distance_x > offset) + { + min[0] += offset; + max[0] -= offset; + } + + if (distance_y > offset) + { + min[1] += offset; + max[1] -= offset; + } + + SetEntPropVector(entity, Prop_Send, "m_vecMins", min); SetEntPropVector(entity, Prop_Send, "m_vecMaxs", max); SetEntProp(entity, Prop_Send, "m_nSolidType", 2);