AdamLearns / JumpRoyale

This is the game that chat plays during my stream breaks. It's a platformer controlled through Twitch chat.
19 stars 2 forks source link

Refactoring, part 1 #83

Closed DarkStoorM closed 9 months ago

DarkStoorM commented 9 months ago

This PR delegates the command handling to external class, so at least one part of it can be tested and it takes some unrelated logic out. Sadly, the command execution still can't be tested, reason below:

Spoiler Note copied from #82: _I'm really disappointed with testing in Godot, you have to rely on in-scene testing with almost every package and can't run them in CI, they just introduce more confusion 😡 you literally have to extract everything, which can be hard with the current codebase_ ![Kappa](https://github.com/AdamLearns/JumpRoyale/assets/7021295/5c0fdf37-7293-4fde-8dec-5dc4daa2d1d4)

Small note: some private fields were changed to auto properties, except their setters are private or omitted, meaning that they are still readonly even within the instance context. This was made especially for the command handler to let it read the properties from Arena. Ultimately, those public properties could be placed into exposed Struct, so we don't get the entire Arena reference, but I guess that doesn't really matter. Tests were also updated to make sure nothing changed.

I made a small mess with the previous PR, it was not based on the branch with color changes, so I had to merge them. You can refer to #82 for the color changes (description only)

Character customization has been moved from Join to jumper.Init(); seems like a more appropriate place.