From cd62f52c873338ad43c2bc4a4d239b256ace2394 Mon Sep 17 00:00:00 2001 From: Sn1p3rr3c0n Date: Tue, 13 Oct 2020 21:38:29 +0200 Subject: [PATCH] switchd from a foreach to a for loop to avoid a timing related error (changing allowed area during drone spawn) --- Source/ProjectRimFactory/Drones/Building_DroneStation.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/ProjectRimFactory/Drones/Building_DroneStation.cs b/Source/ProjectRimFactory/Drones/Building_DroneStation.cs index 755028cd..c23df72f 100644 --- a/Source/ProjectRimFactory/Drones/Building_DroneStation.cs +++ b/Source/ProjectRimFactory/Drones/Building_DroneStation.cs @@ -226,9 +226,9 @@ public void Update_droneAllowedArea_forDrones(Area dr = null) { //Refresh the area droneAllowedArea = dr ?? (Area)GetDroneAllowedArea; - foreach (Pawn_Drone sdrone in spawnedDrones) + for (int i = 0; i < spawnedDrones.Count; i++) { - sdrone.playerSettings.AreaRestriction = droneAllowedArea; + spawnedDrones[i].playerSettings.AreaRestriction = droneAllowedArea; } }