Skip to content

Commit

Permalink
don't do zone offset stuff on mins/maxs if the offset is bigger than …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
rtldg committed Dec 21, 2021
1 parent 6952bab commit 39c9d96
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions addons/sourcemod/scripting/shavit-zones.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 39c9d96

Please sign in to comment.