Skip to content

PlayerController ​

Inherits: Node3D

---------- Signals ----------

Variables ​

ControllerLogiccurrent_controller_logic
Nodecurrent_mouse_hover_targetnull
floatmouse_hover_check_timer0.0
floatmouse_hover_check_interval0.05
CollisionShape3Ddragbox_collisionnull
Paneldragbox_visual
Dictionarycurrent_targeting_context{}
boolis_targeting_modefalse
PointMarkerpoint_marker
RadiusMarkerradius_marker
Playercurrent_player

Methods ​

voidunhandled_input( event: InputEvent )
boolhandle_esc_key()
voidclear_selection()
Entityget_current_player()
Array[Entity]get_selected_units()
voidhandle_action_bar_button_click( slot_number: int )
boolstart_ability_targeting( ability: AbilityInstance, initiator: Variant = null )
voidcreate_new_radius_marker( user: Entity, is_marker_friendly: bool, marker_range: float )
Dictionaryget_mouse_collision_info()
voidselect_single_player( player: Player )
voidtoggle_player_selection( player: Player )

Signals ​

input_detected( action_name: String ) ​

---------- Signals ----------

rquest_ui_panel( panel_name: String ) ​

A panel key opened or closed a panel (its name)

request_warning_message( message: String ) ​

Emitted when the controller wants to tell the player something (out of range, not ready ...).

Constants ​

  • const SELECTION_BOX_STYLE = preload("res://addons/chroniclenode/assets/targeting/selection_box_style.tres") - ---------- Constants ----------

Variable descriptions ​

ControllerLogic current_controller_logic ​

The controller logic in use.

Node current_mouse_hover_target = null ​

---------- Properties ----------

float mouse_hover_check_timer = 0.0 ​

The time since the last check of what is under the mouse.

float mouse_hover_check_interval = 0.05 ​

How many seconds between checks of what is under the mouse.

CollisionShape3D dragbox_collision = null ​

Properties needed by controller logic classes

Panel dragbox_visual ​

The rectangle drawn while the player drags a selection.

Dictionary current_targeting_context = ​

---------- Targeting System (Universal) ----------

bool is_targeting_mode = false ​

True while the player picks the target of an ability.

PointMarker point_marker ​

---------- Node References ----------

RadiusMarker radius_marker ​

The circle that shows the radius of an ability while it is aimed.

Player current_player ​

The player the controller moves.

Method descriptions ​

void unhandled_input( event: InputEvent ) ​

Gameplay input entry point. NOT an engine callback: it is called by InputManager (presses, motion and other events after the GUI; releases before it). Mouse-look no longer comes through here - it is delivered via ControllerLogic.handle_look / on_look_state.

bool handle_esc_key() ​

Handle ESC key with priority chain - called directly from GameHost Returns true if handled, false if should go to pause menu

void clear_selection() ​

Clear selection - implement if supporting multi-unit selection

Entity get_current_player() ​

The player the controller logic controls now.

Array[Entity] get_selected_units() ​

The entities the player has selected.

void handle_action_bar_button_click( slot_number: int ) ​

Uses the slot of the action bar that was clicked.

bool start_ability_targeting( ability: AbilityInstance, initiator: Variant = null ) ​

Starts the picking of a target for an ability. False when the logic cannot.

void create_new_radius_marker( user: Entity, is_marker_friendly: bool, marker_range: float ) ​

Create radius marker for an entity

Dictionary get_mouse_collision_info() ​

What is under the mouse: the object and the point.

void select_single_player( player: Player ) ​

Selects one player of the party.

void toggle_player_selection( player: Player ) ​

Adds a player to the selection or takes it out.