don't kill zone entities in OnEntityDestroyed

This commit is contained in:
rtldg 2021-07-13 01:45:17 +00:00
parent 6f1c8ce09c
commit 7df75c4c35

View File

@ -868,7 +868,7 @@ public void OnEntityDestroyed(int entity)
{ {
if (entity > MaxClients && entity < 4096 && gI_EntityZone[entity] > -1) if (entity > MaxClients && entity < 4096 && gI_EntityZone[entity] > -1)
{ {
KillZoneEntity(gI_EntityZone[entity]); KillZoneEntity(gI_EntityZone[entity], false);
} }
} }
@ -1068,7 +1068,7 @@ void UnhookEntity(int entity)
SDKUnhook(entity, SDKHook_TouchPost, TouchPost); SDKUnhook(entity, SDKHook_TouchPost, TouchPost);
} }
void KillZoneEntity(int index) void KillZoneEntity(int index, bool kill=true)
{ {
int entity = gA_ZoneCache[index].iEntityID; int entity = gA_ZoneCache[index].iEntityID;
@ -1094,7 +1094,7 @@ void KillZoneEntity(int index)
UnhookEntity(entity); UnhookEntity(entity);
if (!gA_ZoneCache[index].bPrebuilt) if (kill && !gA_ZoneCache[index].bPrebuilt)
{ {
AcceptEntityInput(entity, "Kill"); AcceptEntityInput(entity, "Kill");
} }
@ -1104,12 +1104,7 @@ void KillZoneEntity(int index)
// 0 - all zones // 0 - all zones
void UnloadZones(int zone) void UnloadZones(int zone)
{ {
if(zone == Zone_CustomSpawn) if (zone != Zone_CustomSpawn)
{
ClearCustomSpawn(-1);
}
else
{ {
for(int i = 0; i < MAX_ZONES; i++) for(int i = 0; i < MAX_ZONES; i++)
{ {
@ -1119,9 +1114,9 @@ void UnloadZones(int zone)
ClearZone(i); ClearZone(i);
} }
} }
ClearCustomSpawn(-1);
} }
ClearCustomSpawn(-1);
} }
void RefreshZones() void RefreshZones()