Skip to content

Commit 3c9274d

Browse files
committed
Fix for Continuous Repair of Vehicles
- A bug may cause some vehicles to continue to repair after leaving the Light Vehicle Factory repair zones under certain situations
1 parent 7f189ae commit 3c9274d

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Si_RepairFacility/Si_RepairFacility.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ You should have received a copy of the GNU General Public License
3636
using System.Collections.Generic;
3737
using System.Text;
3838

39-
[assembly: MelonInfo(typeof(RepairFacility), "Repair Facility", "1.0.1", "databomb", "https://github.com/data-bomb/Silica")]
39+
[assembly: MelonInfo(typeof(RepairFacility), "Repair Facility", "1.0.2", "databomb", "https://github.com/data-bomb/Silica")]
4040
[assembly: MelonGame("Bohemia Interactive", "Silica")]
4141
[assembly: MelonOptionalDependencies("Admin Mod")]
4242

@@ -174,21 +174,26 @@ public static void Postfix(OpenableBase __instance, Zone __0, Unit __1)
174174
return;
175175
}
176176

177-
// is the unit a player-controlled vehicle?
178-
if (__1.DriverCompartment == null || __1.NetworkComponent == null || __1.ControlledBy == null)
179-
{
180-
return;
181-
}
182-
183177
// there are two openablebases in a LightVehicleFactory:
184178
// HousingUnit07_MainDoor and LVF_EntryDoor_Part01
185179
if (!__instance.NetworkComponent.ToString().StartsWith("LightVehicleF"))
186180
{
187181
return;
188182
}
189183

190-
MelonLogger.Msg("Found player's vehicle exiting LVF repair zone: " + __1.ControlledBy.PlayerName + " with vehicle " + __1.ToString());
191-
184+
// is the unit a player-controlled vehicle?
185+
if (__1.DriverCompartment == null || __1.NetworkComponent == null || __1.ControlledBy == null)
186+
{
187+
if (vehiclesAtRepairShop.Contains(__1.DamageManager))
188+
{
189+
MelonLogger.Msg("Found vehicle exiting LVF repair zone: " + __1.ToString());
190+
}
191+
}
192+
else
193+
{
194+
MelonLogger.Msg("Found player's vehicle exiting LVF repair zone: " + __1.ControlledBy.PlayerName + " with vehicle " + __1.ToString());
195+
}
196+
192197
vehiclesAtRepairShop.RemoveAll(vehicleDM => vehicleDM == __1.DamageManager);
193198
}
194199
catch (Exception error)

0 commit comments

Comments
 (0)