Skip to content
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

Function cleanup #5444

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open

Conversation

ZZZank
Copy link
Contributor

@ZZZank ZZZank commented Mar 1, 2024

This PR:

  • Adds type comments for most of functions in functions.js. These comments are basically copied from my functions.js
  • Rewrite about half of all functions in functions.js, to make them clearer and possibly more performant. E.g. getPreferredItemInTag is rewritten to use maxOf instead of sort, this can reduce time complexity from O(n*lg(n)) to O(n), so should be faster
  • fixed a horribly wrong format in unify_sawables::create_cutting(), which will prevent recipes from actually getting added
  • move functions for recipe-gen from global scope to inside event callback, to prevent access
    ing by accident. Also removing an unused param event. These functions are located mostly at server_script/xxx/unification/

These changes have been applied to my fork of E6/E6E for a long time, and they seems working pretty well

@NielsPilgaard
Copy link
Collaborator

Thanks for the PR, I'll go over it once I find some time 😅

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.

2 participants