-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from BusyCityGuy/fix/wally-package-structure
Fix/wally package structure
- Loading branch information
Showing
12 changed files
with
123 additions
and
83 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
{ | ||
"luau-lsp.require.mode": "relativeToFile", | ||
"luau-lsp.require.directoryAliases": { | ||
"@lune/": "~/.lune/.typedefs/0.8.8/" | ||
}, | ||
"luau-lsp.sourcemap.rojoProjectFile": "test.project.json", | ||
"luau-lsp.ignoreGlobs": [ | ||
"**/_Index/**", | ||
"**/*.d.luau", | ||
"*Packages/**" | ||
], | ||
"cSpell.words": ["rokit", "rbxl", "rojo"] | ||
"luau-lsp.require.mode": "relativeToFile", | ||
"luau-lsp.require.directoryAliases": { | ||
"@lune/": "~/.lune/.typedefs/0.8.8/" | ||
}, | ||
"luau-lsp.sourcemap.rojoProjectFile": "test.project.json", | ||
"luau-lsp.ignoreGlobs": ["**/*.d.luau", "*Packages/**"], | ||
"cSpell.words": ["rokit", "rbxl", "rojo"] | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,20 +23,20 @@ These signals, transition callbacks, and state changes are processed in the foll | |
![SequenceDiagram](https://github.com/BusyCityGuy/finite-state-machine-luau/assets/55513323/9ace09e3-a16e-474b-83ca-aac91cd69492) | ||
|
||
1. Fire `beforeEvent` signal | ||
- with arguments `eventName`, `beforeState` | ||
- with arguments `eventName`, `beforeState` | ||
1. Call `transition.beforeAsync()` (required, returns next state) | ||
- with the VarArgs from `:handle(eventName, transitionArgs...)` | ||
- with the VarArgs from `:handle(eventName, transitionArgs...)` | ||
1. Fire `leavingState` signal | ||
- with arguments `beforeState, afterState` | ||
- with arguments `beforeState, afterState` | ||
1. Update `_currentState` to next state | ||
1. Fire `stateEntered` signal | ||
- with arguments `afterState, beforeState` | ||
- with arguments `afterState, beforeState` | ||
1. Call `transition.afterAsync()` (if specified) | ||
- with the VarArgs from `:handle(eventName, transitionArgs...)` | ||
- with the VarArgs from `:handle(eventName, transitionArgs...)` | ||
1. Fire `afterEvent` signal | ||
- with arguments `eventName, afterState, beforeState` | ||
- with arguments `eventName, afterState, beforeState` | ||
1. Fire `finished` signal if next state from `beforeAsync()` was `nil` | ||
- with argument `beforeState` | ||
- with argument `beforeState` | ||
|
||
Transitions can be asynchronous, which is supported by queuing each Event submitted via :handle() and processing them in First-In-First-Out (FIFO) order. The next Event starts processing immediately after the previous Event's handler fires `afterEvent`. | ||
|
||
|
@@ -54,6 +54,10 @@ A simple state machine diagram for a light switch may look like this, where | |
![ExampleUsage](https://github.com/BusyCityGuy/finite-state-machine-luau/assets/55513323/3d5b2118-91ea-4427-ac2d-688fb0094d1f) | ||
|
||
```luau | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
local StateQ = require(ReplicatedStorage.Packages.StateQ) | ||
local LightState = { | ||
On = "On", | ||
Off = "Off", | ||
|
@@ -110,17 +114,22 @@ light:handle(Event.SwitchOn) -- warns "Illegal event `SwitchOn` called during st | |
## Rojo users | ||
|
||
If your project is set up to build with Rojo, the preferred installation method is using [Wally](https://wally.run/). Add this to your `wally.toml` file: | ||
|
||
```bash | ||
> StateQ = "busycityguy/[email protected]" | ||
``` | ||
|
||
If you're not using Wally, you can add this repository as a submodule of your project by running the following command: | ||
|
||
> git submodule add https://github.com/BusyCityGuy/finite-state-machine-luau path/to/your/dependencies | ||
```bash | ||
> git submodule add <https://github.com/BusyCityGuy/finite-state-machine-luau> path/to/your/dependencies | ||
``` | ||
|
||
If you want to avoid submodules too, you can download the `.zip` file from the [latest release](https://github.com/BusyCityGuy/finite-state-machine-luau/releases/latest) page. | ||
|
||
## Non-Rojo users | ||
|
||
If you aren't using Rojo, you can download the `.rbxm` file from the [latest release](https://github.com/BusyCityGuy/finite-state-machine-luau/releases/latest) page and drag it into Roblox Studio. | ||
If you aren't using Rojo, you can download the `.rbxm` file from the [latest release](https://github.com/BusyCityGuy/finite-state-machine-luau/releases/latest) page and drag it into Roblox Studio, placing the `Packages` folder in `ReplicatedStorage`. | ||
|
||
# Feedback | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
{ | ||
"name": "StateQ", | ||
"tree": { | ||
"$path": "src/StateQ", | ||
"Dependencies": { | ||
"$path": "Packages" | ||
"name": "StateQ", | ||
"tree": { | ||
"$path": "src/StateQ" | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "Packages", | ||
"tree": { | ||
"$path": "Packages", | ||
"StateQ": { | ||
"$path": "src/StateQ" | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.