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

Bug: world_api.md docs misuses item/event initialization in example code #4597

Open
Rooby-Roo opened this issue Feb 2, 2025 · 2 comments
Open

Comments

@Rooby-Roo
Copy link

What happened?

In world api, lines 573-575:

def create_event(self, event: str) -> MyGameItem:
    # while we are at it, we can also add a helper to create events
    return MyGameItem(event, True, None, self.player)

MyGameItem is an instance of the item class and inherits the init from it. To my understanding, the second parameter is meant to be an ItemClassification, not a bool. Folks in the discord believe that this may actually result in an event getting passed up on in generation due to not being progression. Blame says this line in particular is four years old.

What were the expected results?

Maybe something like this?

def create_event(self, event: str) -> MyGameItem:
    # while we are at it, we can also add a helper to create events
    return MyGameItem(event, ItemClassification.progression, None, self.player)

Lots of ways to handle it though.

Software

Website

@qwint
Copy link
Collaborator

qwint commented Feb 2, 2025

#4596

@Berserker66
Copy link
Member

I still believe we should figure out a way to set up doctests for github.
Though the doc is in need of plenty of fixing to get that to pass:

Image

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

No branches or pull requests

3 participants