chore: Prettifies get_ending
to not be numerically based, but instead string-based. #219
No reviewers
Labels
No Label
bug
Critical Priority
duplicate
enhancement
help wanted
High Priority
Low Priority
Medium Priority
Meta
needs more info
question
refactor
wontfix
bug
Critical Priority
duplicate
enhancement
help wanted
High Priority
invalid
Low Priority
Medium Priority
Meta
question
wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Cavemanon/SnootGame#219
Loading…
Reference in New Issue
No description provided.
Delete Branch "san7890/SnootGame:glooorg"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hey there,
I'm not sure if this project accepts unsolicited contributions (without an issue), but I played through the game and really enjoyed it. While doing so, I noticed some patterns that really made me :(. Instead of feeling :(, I decided to clean it up to pay it forward to whoever wants to extend this really neat game.
This PR does the following:
get_ending
method now returns SCREAMING_SNAKE_CASE variables that resolve to strings. This is mainly done as a "code improvement", such that the code is no longer reliant on the "funny numbers" 1, 2, 3, and 4 and not needing to rely on a comment to explain what 1, 2, 3, and 4 mean.The code has also been amended to reflect this change (i really wish renpy had switch 🙁)
849c9ce9f5
), which is also good because the indentation looks slightly nicer to my eyes. I'm not new to python, but I am new to the unique synax of RenPy so let me know ifdcb7fbb473
is un-needed or if thejump
function does that for us.Cleans up credit code as well.
get_ending
for some reason, despite the fact that we weren't actually callingget_ending
. That seems very silly to me, so I decided to tie a method-local var (are they methods?) that assumes the return value fromget_ending
and we just use that to do all our credit determinations rather than rely on calling the tradwife flag or doing the same exact calculations but different. Should help with less "drifting from reality" between the different credit sequences and the actual requirements for those credits.I spent more time writing about what I did than actually doing the code (testing took a while longer), so hopefully it is no-more-than-trivial to review (and hopefully doesn't break stuff (but that's why Git is so good: reverts)). Thank you for your time.
note: This PR is also targetting the 'NewPatch' since the readme said to not push to master? I assume that's the best spot, please let me know if I should change it.
tested™️
Thanks for the contribution, we do accept random contributions on our projects (although there is no guarantee they'll be merged).
The changes seem fine, but I think using an enum would be superior to flat string comparison given that string comparisons are much more expensive than simple integer checking. I'll submit a proper review here in a moment.
@ -3,0 +5,4 @@
ENDING_GOLDEN = "golden"
ENDING_TRADWIFE = "tradwife"
ENDING_DOOMER = "doomer"
ENDING_SHOOTER = "shooter"
I heavily suggest swapping these out for enums instead of strings. It has both the user readability of a string, and the simplicity of an integer.
Though, do check if this screws with the ending checking after this is done. I don't know if enums can be compared in python or not.
They can be, implemented in latest commit. Works on my machine.
It's nice that the latest renpy actually supports Python 3.0+ features- enums weren't a thing until 3.4.
Looks good, will merge.