-
Notifications
You must be signed in to change notification settings - Fork 7
Debug Terminal
The debug terminal is for developers to run commands while the game is running. When visible, the terminal is displayed in the bottom-left of the screen and commands can be typed into the terminal using the keyboard.
The terminal uses the Command Pattern to action entered commands.
-
Terminal - Maintains the state of the terminal and actions commands:
Terminal
. -
Terminal Input Component - Processes input and triggers state changes in the terminal:
KeyboardTerminalInputComponent
. -
Terminal Display - Displays the terminal's UI:
TerminalDisplay
. -
Command - Defines actions to be taken when the command is triggered: e.g.
DebugCommand
.
The terminal can be toggled in and out of view using the F1
key.
Commands can be triggered by typing into the terminal and pressing enter
. When the name of the command followed by valid arguments is entered, the command is actioned. As an example, the "debug" command accepts the arguments "on" and "off". So debug on
or debug off
would be valid commands.
Commands must be added to the commands map in Terminal.java
using addCommand()
. They are composed of a name and an instance of the Command
interface. The following is an example for adding the debug command:
addCommand("debug", new DebugCommand());
These are the following commands that are available in the game.
Game Command | Description | Parameters |
---|---|---|
setTime <time> |
This command will set the game time to the specified time |
|
addItem <itemName> |
This command adds an item to the player's inventory |
|
spawn <entity> <x> <y> |
This command will spawn a living entity at a given position |
|
setDay <day> |
This command will set the in-game day to the given argument. |
|
The current implementation of the addItem
command only adds player tools to their inventory. More information on these can be found here. The itemName
parameter and their associated tools are as follows:
-
hoe
- Hoe -
shovel
- Shovel -
can
- Watering Can -
scythe
- Scythe
The current implementation of the spawn
command only spawns in two animals. More information on these can be found here. Possible values for the entity
parameter are as follows:
-
cow
- Cow -
chicken
- Chicken -
astrolotl
- Astrolotl
The current implementation of the AddWeather
command only creates two weather events. More information on these can be found here. Possible values for the weatherEvent
parameter are as follows:
-
solarSurge
- Solar Surge -
acidShower
- Acid Shower