This repository was archived by the owner on Jan 3, 2025. It is now read-only.
Draft
Conversation
Owner
|
As for generalizing the pattern, observers also work on |
MiniaczQ
reviewed
Jul 25, 2024
Comment on lines
+14
to
+24
| impl From<EmitterEvent> for GameEvent { | ||
| fn from(other: EmitterEvent) -> Self { | ||
| Self(other.0) | ||
| } | ||
| } | ||
|
|
||
| impl From<GameEvent> for ActorEvent { | ||
| fn from(other: GameEvent) -> Self { | ||
| Self(other.0.len()) | ||
| } | ||
| } |
Owner
There was a problem hiding this comment.
Not super sold on the From, instead of having a:
graph TD
base --base event--> pluginA
base --base event--> pluginB
pluginA --> game
pluginB --> game
we create this dependency abomination
graph TD
base --base event--> pluginA
base --base event--> pluginB
pluginA --event A--> base
pluginB --event B--> base
pluginA --> game
pluginB --> game
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is about a pattern to make plugins (even internal ones) independent of other code, even in terms of imports.
https://github.com/Pfeil/bevy-design-patterns/tree/generic-events/patterns/event_bridge
Let's shortly define some properties / levels of independence of a plugin:
I was aiming for both properties. So far, it at least works in the example case. Not sure how it applies in practice. This is a really early idea.
Things which came to my mind, but I was not able to try yet: