Vanilla-Expanded / VanillaExpandedFramework

Vanilla Expanded Framework for RimWorld
Other
73 stars 37 forks source link

[VFECore] CompMachineChargingStation cache not working properly #85

Open hhyzbd opened 6 months ago

hhyzbd commented 6 months ago

After a machine is destroyed, loading a save that still has this machine alive will cause pawns trying to rebuild this machine at its base.

After digging through the code, I noticed that cachedChargingStations and cachedChargingStationsDict didn't remove cached items. https://github.com/Vanilla-Expanded/VanillaExpandedFramework/blob/f7abe05737e4f216ad14198ce6c5489b784f1e1b/Source/VFECore/VFECore/Comps/ThingComps/CompMachineChargingStation.cs#L24-L25 cachedChargingStations allows duplication. cachedChargingStationsDict recognize same thing in different states as different keys. I think making cachedChargingStationsDict a Dictionary<ThingID, CompMachineChargingStation> will prevent this issue, but cached items still get kept between saves.