CombatExtendedRWMod / CombatExtended

Combat Extended mod for RimWorld
129 stars 91 forks source link

(bugfix) Fix bug where turrets cannot be loaded #1209

Open MadaraUchiha opened 4 years ago

MadaraUchiha commented 4 years ago

Additions

N/A

Changes

Adjustments to other features made in this merge, e.g.

References

Reasoning

Alternatives

Remove the GenClosestAmmo class, as suggested by @NoImageAvailable.

Testing

Check tests you have performed:

NoImageAvailable commented 4 years ago

What's the reasoning behind the try-catch block?

N7Huntsman commented 4 years ago

We certainly appreciate the help, though unfortunately the issue persists. In testing, I'm seeing some truly bizarre behavior, but I'm hopeful you'll find the details helpful. I've included video of my testing, and a trace for the reload job error I encountered. Mod list: Harmony (from Steam), Core, Royalty, Combat Extended from your 'reload fix' branch. Video: https://www.youtube.com/watch?v=TzJw2h3qvGU&feature=youtu.be Trace from video: https://pastebin.com/Q7AUjSvS Another, slightly different trace (not in the video, seems to be from a different part of the same job?): https://pastebin.com/9E0bQhcE Observations:

NoImageAvailable commented 4 years ago

All those issues sound like issues with the caching system. Unless there is some 1.1 specific reason it has to be there it should be rolled back.

MadaraUchiha commented 4 years ago

What's the reasoning behind the try-catch block?

The variable tracking the last check should be updated regardless of whether the cache lookup bails early. I could have added the last check update before every return, but figured this was easier and clearer.

I do agree that if there's no real good reason for this cache class, it should be removed.

NoImageAvailable commented 4 years ago

So here's the case for reverting the cache class Con:

Pro:

@MadaraUchiha can you ditch the caching in favor of 1.0 style reloading while keeping mech functionality intact (potentially by reimplementing it in a more reasonable format such as a ThinkNode)?

MadaraUchiha commented 4 years ago

My RimWorld specific C# experience is very much lacking, but I'll give it my best shot. If you have any resources that you think can be useful (i.e. save me on reading decompiled RimWorld code) please let me know :).

N7Huntsman commented 4 years ago

I'll ping @zhrocks11 on this for the sake of bringing him into the loop so he's aware that @MadaraUchiha will be taking over the turret issue.