Doodad Linking #7
Labels
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: SketchyMaze/doodle#7
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add the ability for doodads to link to other doodads, so that buttons can connect to doors and open them when pushed.
All doodads have the ability to link to any other doodad, whether it makes sense or not. For example, two buttons linked together would have no effect.
Pub/Sub Message Passing
In the JavaScript API for the doodads, implement a pub/sub system where a doodad can listen for named events from linked doodads and publish named events to linked doodads.
Each pub/sub message would have a name (string) and pass arbitrary arguments that would be related to the name. Some event names would be Well Known for common behaviors:
power(bool)
: invoked by buttons and switches to pass a boolean "powered" flag.true
when pressed andfalse
when released.true
when pressed and then stay pressed.power(true)
and close when they receivepower(false)
default()
: for subscribers only, a "default" event would be invoked as a catch-all for ALL events passed to the doodad. Might be useful for some doodads?Data Structure
To store the link data in the level file, it would be a stored as mutual ID lists between one actor's ID and the other. Something like,
Editor Mode User Interface
For a quick first pass:
For a better user experience, the Link tool should be seamlessly integrated into the Doodad tool:
When a doodad is deleted from the level in the Doodad tool, delete all mutual links between that doodad and others.