feat: create tick-based task system #382
Merged
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 PR implements a tick-based task system for
Actors
(Player
/Npc
) and theWorld
.The main practical difference between this implementation and the previous
Behaviour
system is that the tasks here are synchronized for all entities in the world, and delays are handled by tick count rather than by milliseconds.There are a number of configuration options for a
Task
as well as some useful subtasks. You can read more about these in the attachedREADME.md
file. The current set of subtasks is a starting point, and we will surely want to create more for more interaction types.If you'd like to see how content is written in this new task system, there are some PRs on my fork that you can view: https://github.com/Jameskmonger/runejs-server/pulls
There are a number of
TODOs
around adding unit tests, I would like to propose that we keep these included for now - currently the areas are difficult to test due to complications with mocking the player class, but I have been working on other PRs to improve this.