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

FunctionManager: implement framework for handling "info" functions #291

Merged
merged 29 commits into from
Aug 13, 2022

Conversation

magicus
Copy link
Member

@magicus magicus commented Aug 12, 2022

No description provided.

@magicus magicus marked this pull request as ready for review August 12, 2022 13:52
@magicus magicus changed the title WIP: Info functions FunctionManager: implement framework for handling "info" functions Aug 12, 2022
@magicus
Copy link
Member Author

magicus commented Aug 12, 2022

The template parser is still missing. It's a bit more complex to get right, so I'd like to return to it in a separate PR. Otherwise I'm pretty happy with this design. The two test functions should be removed when we start to get some real functions in their place.

@kristofbolyai
Copy link
Member

This can now use new managers

@magicus
Copy link
Member Author

magicus commented Aug 12, 2022

@kristofbolyai I'm not sure how new managers would fit in. I think I'll keep the function init as a separate step, with I18n, close to the feature init (after the latest i18n init fix). Am I missing something?

public class TestFunction extends Function<Integer> {
@Override
public Integer getValue(String argument) {
return 42;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for this function to exist. We have a real world example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove it as soon as we have real functions. But I'm not sure what real world example you are thinking of..? I do need some kind of test function in this PR, so I'm planning on removing this in a follow-up when we start to port over legacy functions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And with a real world example I am referring to an actual implementation as we might expect in production

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll port over a handful of "info variables" from legacy, so we can see this API in action. It's a fair point, which I'm usually trying to make. ;-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We lack the source data for most of our info variables. I made a list at #301 for keeping track of what is still left to do. I implemented two categories of functions: those that derive their value from Minecraft, and those that derive their value from the general environment (basically, the JVM).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think I got this covered for now. If anything, we should perhaps try to get some ActiveFunctions as well. I'll see if there is any I can implement without far too much work.

Copy link
Member

@HighCrit HighCrit Aug 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason my comment disappeared regarding the already present worldnamefunction :?

magicus and others added 8 commits August 13, 2022 11:57
@magicus magicus merged commit ce48bc8 into Wynntils:main Aug 13, 2022
@magicus magicus deleted the functions branch August 13, 2022 17:24
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.

None yet

4 participants