-
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. These can be accessed in the commands
folder.
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 |
|
removeItem <itemName> |
This command removes an item from 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 |
|
addWeatherEvent <weatherEvent> <numHoursUntil> <duration> <priority> <severity> |
This command will set the in-game weather according to the given arguments |
|
setTimeScale <timeScale> <numHoursUntil> <duration> <priority> <severity> |
This command will set the in-game time scale to the given argument |
|
plant <growth stage> |
This command will set all plants in the game to a desired growth stage. |
|
The current implementation of the addItem
command only works on items that are included in AddItemCommand.java
. The currently implemented itemName
parameters and their associated items are as follows:
-
hoe
- Hoe -
shovel
- Shovel -
can
- Watering Can -
scythe
- Scythe -
sprinkler
- Sprinkler -
pump
- Pump -
fence
- Fence -
gate
- Gate -
chest
- Chest -
shipPart
- Ship Part
The current implementation of the removeItem
command only works on items that are included in removeItemCommand.java
. The currently implemented itemName
parameters and their associated items are as follows:
-
hoe
- Hoe -
shovel
- Shovel -
can
- Watering Can -
scythe
- Scythe -
sprinkler
- Sprinkler -
pump
- Pump -
fence
- Fence -
gate
- Gate -
chest
- Chest
The current implementation of the spawn
command only spawns in animals that are included in SpawnCommand.java
. The currently implemented entity
parameters are as follows:
-
cow
- Cow -
chicken
- Chicken -
astrolotl
- Astrolotl -
oe
- Oxygen Eater
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 -
rainStorm
- Rain Storm -
blizzard
- Blizzard
For more information on the meaning of the arguments given in this command, see here.