Skip to content

Tool Manager

NebSeniah edited this page Jun 30, 2026 · 9 revisions

System Summary

The Tool Manager is a child of the Editor Manager, and handles variables that are shared between its children, changing of tools, rotating and selection of objects, and user inputs.


Connected Systems

List of connecting/parent/subsystems.

Connecting Systems:

Subsystems:


Related Controls

List of related controls.

Brush:

  • Left-Click: Places the brush's currently selected tile in the clicked cell.
  • Right-Click: Deletes a tile in the clicked cell.
  • Click & Drag: Places/deletes tiles in the hovered cell as long as the player holds.

Box Brush:

  • Click & Drag: Highlights a box-shaped area. (Left-Click for placement, Right-click for deletion)
  • Release Click: Sets the highlighted area and awaits a confirmation input.
  • Spacebar: Confirms and triggers the tile placement/deletion action.

Cursor:

  • Left-Click: Places the brush's currently selected entity in the clicked cell. Access the property menu of entities.
  • Right-Click: Deletes an entity in the clicked cell.
  • Click & Drag: Move any tile or object around to move it on the canvas.
  • Ctrl-Click & Drag: Copy an entity and place the new one elsewhere.

Bugs

List of known bugs. Be descriptive but keep it brief!

  • None.

Feature List / Breakdown of Features

  • Tools: Different tools have different functionality, and each behave in their own way as handled by this manager.
    • Brush: The Brush tool can be clicked or dragged onto the grid space to create or delete tiles. This tool cannot delete entities, nor edit their properties.
    • Box Brush: The Box Brush tool can be dragged on the grid space to fill or delete a specified area. This tool will skip over entities, refusing to fill or delete them.
    • Cursor Tool: The Cursor tool can be clicked on the grid to place or delete entities. When clicking on a entity, it will also open up the property menu, allowing for specific properties to be tweaked freely. It can also be held on an entity to drag them around on the grid or to duplicate entities with their properties.

Important Variables

Name the most important variables, their type, and what their purpose is

  • editorManager: Node2D = An exported reference to the editor manager.

  • entityManager: Node2D = An exported reference to the entity manager.

  • tileManager: Node2D = An exported reference to the tile manager.

  • tileSwitch: HBoxContainer = An exported reference to the object switching UI.

  • propertyMenu: Panel = An exported reference to the entity property editing UI.

  • previewTile: TileMapLayer = An exported reference to the preview tile map.

  • currentObjectRotation: int = The rotation of the currently selected object. Only applies to specific tiles and entities.

  • currentTool: Global.Tool = The current tool being used by the user.

  • boxBrushState: int = The current active state of the Box Brush. Unused when not using Box Brush.

  • prevEntity: int = The selected tile before dragging.

  • brushObject: int = The ID of the currently used object.

  • clickOnUI: bool = Whether the user has clicked on a UI element.

  • firstBoxCorner: vector2 = The first corner for when the user is Box Brushing.

  • secondBoxCorner: vector2 = The second corner for when the user is Box Brushing.

  • isPainting: bool = Whether the user is currently painting on the grid.

  • isErasing: bool = Whether the user is currently erasing on the grid.

  • isMoving: bool = Whether the user is currently moving an entity.

Important Functions

Name of the most important functions, their parameters, and what they do.

  • func _unhandled_input(event: InputEvent) -> void: Determines the current action the user is doing based on the tool, object, and event, and executes the correct function from their respective managers.

  • func update_brush_object(objectId: int) -> void: Change the currently selected object to the given objectId if possible based on the current tool.

  • func change_tool(tool: Global.Tool) -> void: Changes the tool to the selected tool, modifying the UI and states to be correct for the new tool.

  • func rotate_object() -> void: Rotates an object before placing it down. Only applicable to specific tiles and entities.


Future Work / Risks

List and description of upcoming work/risks.

Future Work:

  • None.

Risks:

  • None as of right now.

Clone this wiki locally