fauxnik / dv-rolling-stock-ownership

A Derail Valley mod that introduces a game mechanic of purchasing and managing rolling stock.
MIT License
5 stars 4 forks source link

Ensure reservations are loaded/setup properly #72

Closed fauxnik closed 6 months ago

fauxnik commented 6 months ago

Reservation callbacks were being setup too late to be applied to wagons loaded from save.

Checking reservation cargo against TrainCar instances is fraught because the player may be far enough away that the equipment has despawned. Comparing against Equipment works because these records persist even if the wagon is despawned due to lack of proximity.

Empty wagons that are part of a Shunting Unload job must skip reservation force-creation if they've already been unloaded. This would otherwise create reservations with CargoType.None, which is both unexpected and breaks logic therein.