Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alecsouthward/switch-manager
Godot 'Switch' Manager, used for keeping track of multiple small one-off events.
https://github.com/alecsouthward/switch-manager
gdscript gdscript-language godot godot-4 godot-addon godot-engine godot-module godot-plugin godot4-2 godotengine
Last synced: 4 months ago
JSON representation
Godot 'Switch' Manager, used for keeping track of multiple small one-off events.
- Host: GitHub
- URL: https://github.com/alecsouthward/switch-manager
- Owner: AlecSouthward
- License: mit
- Created: 2024-02-26T19:07:17.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-03-01T10:02:25.000Z (11 months ago)
- Last Synced: 2024-09-23T12:32:34.063Z (4 months ago)
- Topics: gdscript, gdscript-language, godot, godot-4, godot-addon, godot-engine, godot-module, godot-plugin, godot4-2, godotengine
- Language: GDScript
- Homepage: https://godotengine.org/asset-library/asset/2634
- Size: 20.5 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Switch Manager
This is a simple tool used for helping manage small one-time events. For example, enemy encounters, dialogue that disappears after interaction, etc.
## Usage
> [!WARNING]
> The Switch Manager will not work unless you [autoload](https://docs.godotengine.org/en/stable/tutorials/scripting/singletons_autoload.html) the `state_machine.tscn`!
> As it will only work if it is a `Singleton`.If you need to change/add/remove switches outside of runtime, you can change them in `state_machine.tscn`'s scene.
You can also change the **Save Path** there.To use the Switch Manager is quite easy, there are easy to use and expand upon functions inside `state_machine.gd`.
Here is a list of functions and their use...
| Function | Arguments | Usage |
|----------|-----------|-------|
| `save_switches()` | None | Saves the current list of switches to a file specified in **SAVE_PATH**. |
| `load_switches()` | None | Loads a list of switches from a file specified in **SAVE_PATH**. |
| `erase_switches()` | None | Erases the current list of switches and clear the file specified in **SAVE_PATH**. |
| `create_switch(..)` | Switch Name, and Switch State (default state is false) | Adds a new switch to the switches list with the specified name and state. |
| `toggle_switch(.)` | Switch Name | Toggles a switch's state, returns the new state. (Flips a `False` state into a `True` one and vice versa) |
| `set_switch_state(..)` | Switch Name, and Switch State (default state is false) | Sets a switch's state to the one specifed. |
| `get_switch(.)` | Switch Name | Returns a switch's current state, if the switch is unable to be found it will return `null`. |
| `delete_switch(.)` | Switch Name | Deletes a switch from the switches list. |
| `get_switches()` | None | Returns an Array containing the switches. |> [!WARNING]
> If the `create_switch(..)` recieves a switch name that *already* exists, it will instead set the switch's state to the one specified.# Support
If you have any issues, create an [Issue](https://github.com/AlecSouthward/Switch-Manager/issues/new) or message me on Discord at `itsmealec`.