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.
FEATURE
This PR adds to the game engine a way to create custom python scripts for utilities items and make them run when the key defined in the item definition is used in the game loop. You'll also have the ability to tell the game which arguments you want to get from the script. Only the game data (yaml files variable) and the player' save variable can be asked. Note that to make that work for both vanilla and plugins, a new folder called 'scripts' has been created.
This PR also optimize some things for the github workflows.
Summary
Here's how utilities items will now be defined:
Usage examples
Useful to create custom utilities items for plugins, and also vanilla. For example, a plugin creator could easily create an item that teleports the player:
The item definition:
The script, located at
<game_folder>/plugins/<plugin_name>/scripts/teleportation_rock.py
:Testing Done
Everything tested by now; tested the example and it works fine.
Performance Impact
Some minor, because of the
scripts/
directory being downloaded at the game start.