Skip to content

Helper functions for melonlib #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 3, 2025
Merged

Conversation

protocol-1903
Copy link
Contributor

Some things that I noticed weren't included, and wouldn't necessarily be needed for the main mods but would significantly help with addons like pyblock and hardmode (and later pymods that need to modify earlier ones)

@oorzkws
Copy link
Contributor

oorzkws commented Feb 21, 2025

The implementation of replace_unlock won't preserve the order of unlocks as the replacement will always be added to the end of the list. Is this intentional?

@oorzkws
Copy link
Contributor

oorzkws commented Feb 21, 2025

Also, set result amount and set ingredient amount can currently be accomplished with replace_ingredient and replace_result. I think your implementation could simply call those, if the shorthand is still necessary (I don't mind the addition).

@protocol-1903
Copy link
Contributor Author

The implementation of replace_unlock won't preserve the order of unlocks as the replacement will always be added to the end of the list. Is this intentional?

Come again?

This simply removes it from the technology(s) in technology_old and adds it to the technology(s) in technology_new

Also, set result amount and set ingredient amount can currently be accomplished with replace_ingredient and replace_result. I think your implementation could simply call those, if the shorthand is still necessary (I don't mind the addition).

Missed that, thanks. I'll update the PR.

@oorzkws
Copy link
Contributor

oorzkws commented Feb 21, 2025

The implementation of replace_unlock won't preserve the order of unlocks as the replacement will always be added to the end of the list. Is this intentional?

Come again?

So if a tech unlocks recipe_a, recipe_b, and recipe_c, and you replace_unlock on recipe a, the replacement ends up at the end of the list. This means if the unlocks were sorted before and the replacement fits the sorting, it is no longer sorted (as far as I'm aware, I don't think they use the order strings there).

@protocol-1903
Copy link
Contributor Author

The replace() function replaces a single recipe for multiple technologies, not multiple recipes for a single technology. It's for moving recipes around technologies.

@notnotmelon
Copy link
Contributor

Thank you for the PR. Merged.

@notnotmelon notnotmelon merged commit f05c838 into pyanodon:main Mar 3, 2025
3 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants