Skip to content

Adding Tools (PC Perspective)

MathiasBaumgartinger edited this page Mar 6, 2020 · 1 revision

Adding Tools (PC-Perspective)

For adding a new Tools into the ToolsPanel, instance a ToolsButton.tscn. The control-node will give you a warning if you did not instance this node and on startup an assertion will follow. If the tool should visualize a menu on the button being clicked, add the menu as a child node. The script for the ToolsButton has a method set_popups_container(container : HBoxContainer) this will be called in the control node, so the menu of a tool will be added as a child of another node called PopupsContainer and removed from the button itself. If the button should not have a menu, dont worry, just do not add a child to the node. If anything other than opening the menu should happen on a button click extend the script and add the wished functionality.

Making a tool enabled

Because we added different game-modes to our project it is required you enable the tool in the game-mode-settings.json-file. In order to do this, add the name of the ToolsButton-Node in the tools section. Then add the according game-modes as field with the key "modes" and an array of integers as values [0, 2].

The following sample enabled the node with the name "Teleport" for modes 0 and 1.

"Teleport": {
   "modes": [0, 1]
}