Erabior / RouteManager

Mod for Railroader the game that adds basic automation for passenger routes
12 stars 6 forks source link

Fixed Instancing #14

Closed AdamC1228 closed 8 months ago

AdamC1228 commented 8 months ago

Fixed duplicate instances being created Altered Game Object creation to better track and identify mod for debugging / development.

I noticed that during the game some odd behavior was occurring where it seemed like some actions were fighting the user. For example switching to Manual mode from yard mode would revert back to Yard mode after a few seconds.

Using object explorer and creating a basic test Mod I was able to determine that the current method of creating an instance of Route AI leads to multiple instances getting created. The proposed pull request will resolve those issues.

Additionally the approach used to load the mod into the game was creating the instance as "New Game Object". This is not conducive to long term debugging / development. Instead the proposed fix solves this by creating a properly named parent object and binding the mod to the properly named parent instance.

Before: Screenshot 2023-07-03 234411 Note the duplicate New Game Object Instances

After: Screenshot 2023-12-25 220600 Note the single instance of Erabior.Dispatcher

Adam.

Erabior commented 8 months ago

Thank you m8.

AdamC1228 commented 8 months ago

No problem :)