public void OnEventFinished(string zoneId) { List <BaseEntity> entities; if (!spawnedContainers.TryGetValue(zoneId, out entities)) { return; } for (int i = entities.Count - 1; i >= 0; i--) { BaseEntity entity = entities[i]; if (entity != null && !entity.IsDestroyed) { StorageContainer container = entity.GetComponent <StorageContainer>(); if (container != null) { ClearContainer(entity); container.Die(new HitInfo(container, container, Rust.DamageType.Explosion, 1000f)); } JunkPile junkPile = entity.GetComponent <JunkPile>(); if (junkPile != null) { for (int y = 0; y < junkPile.spawngroups.Length; y++) { junkPile.spawngroups[y].Clear(); } junkPile.SinkAndDestroy(); } } } spawnedContainers[zoneId].Clear(); }