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

More freedom in Loop state, add Loop:setWorlds() #118

Merged
merged 14 commits into from
Sep 17, 2024

Conversation

jackTabsCode
Copy link
Contributor

@jackTabsCode jackTabsCode commented Sep 5, 2024

Right now, there's a few issues with how the Loop and Debugger handle Worlds.

  • The Loop naively looks at its state to determine which values are Worlds, so it can buffer commands from systems.
  • The Debugger naively looks at the Loop's state to determine which values are Worlds, so it can render the appropriate widget. Additionally, it only supports one World which is stored in debugWorld for use cases like hover inspect and entity inspect.

In my game, I'd like to have a single loop parameter which is a class that contains both the world and other states. This is impossible due to the problems mentioned above, and it would break both the debugger, and Loop command buffering.

I propose an API Loop:setWorlds(worlds: {World} | {[string]: World}). This would be a breaking change-users would need to call this before calling Loop:begin(...), though it is a very easy change for users. worlds can be either an array of Worlds, or a dictionary (if they want to call the Worlds something else in the debugger). This allows both the Debugger and the Loop to know exactly what Worlds it can use without further introspection.

image

@jackTabsCode jackTabsCode marked this pull request as ready for review September 11, 2024 17:41
@jackTabsCode jackTabsCode changed the title Better World detection More freedom in Loop state Sep 12, 2024
@jackTabsCode jackTabsCode changed the title More freedom in Loop state More freedom in Loop state, add Loop:setWorlds() Sep 16, 2024
Ukendio
Ukendio previously approved these changes Sep 16, 2024
@jackTabsCode jackTabsCode merged commit 5dd8119 into main Sep 17, 2024
6 checks passed
@jackTabsCode jackTabsCode deleted the better-world-detection branch September 17, 2024 15:40
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