PointAndClickRTSLogic ​
Inherits: ControllerLogic < Resource
Point-and-click RTS-style controller Left-click: Select units (drag for group selection) Right-click: Issue commands (move, attack, interact) Shift: Add/remove from selection
Properties ​
bool | allow_drag_selection | true |
int | min_drag_distance_squared | 1 |
bool | shift_multi_select | true |
ControllerLogic.SecondaryActionTrigger | secondary_action_trigger | ControllerLogic.SecondaryActionTrigger.PRESS |
bool | allow_formation_movement | true |
FormationSystem.FormationType | default_formation | FormationSystem.FormationType.LINE |
bool | right_click_smart_command | true |
bool | smart_cast_abilities | true |
bool | allow_mouse_interact | true |
bool | allow_keyboard_interact | true |
bool | movement_cancels_cast | true |
bool | auto_face_target_on_attack | true |
Variables ​
Array[Entity] | selected_units | [] |
FormationSystem | formation_system | |
bool | mouse_left_click | false |
Vector3 | drag_start_position_3d | |
Vector2 | drag_start_position_2d | |
Dictionary | pending_interaction_targets | {} |
Methods ​
void | setup( pc: PlayerController ) |
void | cleanup() |
void | handle_input_event( event: InputEvent ) |
void | process_input( delta: float ) |
Array[Entity] | get_selected_units() |
Array[LookBinding] | get_look_bindings() |
void | on_click_completed( button_index: int, position: Vector2 ) |
Array[int] | get_exclusive_buttons() |
Entity | get_current_player() |
void | select_single_player( player: Entity ) |
void | toggle_player_selection( player: Entity ) |
String | get_type_display_name() |
Property descriptions ​
RTS Selection
bool allow_drag_selection = true ​
Enable drag-box selection
int min_drag_distance_squared = 1 ​
Minimum drag distance squared to trigger drag selection
bool shift_multi_select = true ​
Allow Shift+click to add/remove from selection
RTS Commands
ControllerLogic.SecondaryActionTrigger secondary_action_trigger = ControllerLogic.SecondaryActionTrigger.PRESS ​
When the right-click command fires. RELEASE_WITHOUT_DRAG lets a camera that uses right-drag to look (e.g. third-person) tell "click to command" from "drag to look".
bool allow_formation_movement = true ​
Enable formation movement for multiple units
FormationSystem.FormationType default_formation = FormationSystem.FormationType.LINE ​
Default formation type for group movement
bool right_click_smart_command = true ​
Right-click intelligently chooses action (attack/move/interact)
bool smart_cast_abilities = true ​
Smart cast abilities without entering targeting mode
Interaction
bool allow_mouse_interact = true ​
Allow mouse-click interactions
bool allow_keyboard_interact = true ​
Allow keyboard (E/F) interactions
Movement
bool movement_cancels_cast = true ​
Moving a unit cancels active casts
bool auto_face_target_on_attack = true ​
Auto-face target when attacking
Variable descriptions ​
Array[Entity] selected_units = [] ​
Runtime state (not exported)
FormationSystem formation_system ​
Places the selected units in a formation when they are sent somewhere.
bool mouse_left_click = false ​
True while the left button is held.
Vector3 drag_start_position_3d ​
Where in the world the drag selection started.
Vector2 drag_start_position_2d ​
Where on the screen the drag selection started.
Dictionary pending_interaction_targets = ​
What each unit goes to interact with, by unit.
Method descriptions ​
void setup( pc: PlayerController ) ​
Sets the logic up when it becomes the one in use.
void cleanup() ​
Lets go of what the logic holds when it is replaced.
void handle_input_event( event: InputEvent ) ​
Handles one input event (a click, a key).
void process_input( delta: float ) ​
Handles the input of one frame.
Array[Entity] get_selected_units() ​
The entities the player has selected.
Array[LookBinding] get_look_bindings() ​
With RELEASE_WITHOUT_DRAG: report a right-click only if the pointer was not dragged (a camera that uses right-drag to look then waits for the drag instead of starting at the press)
void on_click_completed( button_index: int, position: Vector2 ) ​
Called when a click ends (the button and the place on the screen).
Array[int] get_exclusive_buttons() ​
LMB press/drag/release is this controller's own drag-box selection, so no camera may also claim it for a look gesture (e.g. the third-person camera's left-drag orbit)
Entity get_current_player() ​
The player the logic controls now.
void select_single_player( player: Entity ) ​
Selects one player.
void toggle_player_selection( player: Entity ) ​
Adds the player to the selection, or takes it out.
String get_type_display_name() ​
The name of the logic in the editor.