-
Notifications
You must be signed in to change notification settings - Fork 26
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
Static class usage #175
Static class usage #175
Conversation
Moved mineflayer dependencies to devDependencies.
@GenerelSchwerz I see are you modifing the core of package, maybe you are developing your own package and this pr must be close? |
…o build transitions
Probably, I decided to open a PR in case the Prismarine devs wanted to switch. Probably not though. |
…ed, to the same machine
…erverBehaviorPositions class
Typings within this version are vebose (to say the least) but are completely functional. Added functionality: Backend/functionality
======================
1. immediate chained state switching.
- re-iterate over transitions after change in case other transitions are now true.
2. multiple parent states for transitions.
- provides strongly typed union for shouldTransition.
3. Wildcard implementation.
- provided wildcard transitions will be checked regardless of currently active state.
# Frontend/utility
======================
1. Positions for states can be set per state machine instead of globally.
- Positions are not provided on the behaviors themselves, instead they are provided to a handler.
2. Exit states will be colored.
- Wildcard states may also become colored in the future. |
As Frej mentioned on the Discord you can apply these changes on sefiros' change_nested_layout_bar branch to avoid a conflict later on after #172 gets merged |
Sure, I can do that. 👍 |
@GenerelSchwerz this seems to be changing everything could be considered to merge but only if you then want to maintain it. Is it the case? |
I moved this PR to a new repository: https://github.com/GenerelSchwerz/mineflayer-static-statemachine There are a lot of additions/improvements I have added to that project that I will try to move here in time. |
This PR is breaking.
To alleviate some of the boilerplate (making new variables for every transition), I have abstracted the class creation process into the state-machine itself. Behaviors and nested machines alike are provided to the state machine in static form. Access to the individual classes are provided only while the class is active, usually through
shouldTransition
.The examples are not yet complete, so consider this branch W.I.P.