Table of Contents

Class BattleInputSystem

Namespace
AshesOfVelsingrad.Systems
Assembly
Ashes of Velsingrad.dll

Central system responsible for handling player inputs during battle phases.

[ScriptPath("res://scripts/systems/BattleInputSystem.cs")]
public class BattleInputSystem : Node, IDisposable
Inheritance
GodotObject
Node
BattleInputSystem
Implements
Inherited Members
Node.NotificationEnterTree
Node.NotificationExitTree
Node.NotificationMovedInParent
Node.NotificationReady
Node.NotificationPaused
Node.NotificationUnpaused
Node.NotificationPhysicsProcess
Node.NotificationProcess
Node.NotificationParented
Node.NotificationUnparented
Node.NotificationSceneInstantiated
Node.NotificationDragBegin
Node.NotificationDragEnd
Node.NotificationPathRenamed
Node.NotificationChildOrderChanged
Node.NotificationInternalProcess
Node.NotificationInternalPhysicsProcess
Node.NotificationPostEnterTree
Node.NotificationDisabled
Node.NotificationEnabled
Node.NotificationResetPhysicsInterpolation
Node.NotificationEditorPreSave
Node.NotificationEditorPostSave
Node.NotificationWMMouseEnter
Node.NotificationWMMouseExit
Node.NotificationWMWindowFocusIn
Node.NotificationWMWindowFocusOut
Node.NotificationWMCloseRequest
Node.NotificationWMGoBackRequest
Node.NotificationWMSizeChanged
Node.NotificationWMDpiChange
Node.NotificationVpMouseEnter
Node.NotificationVpMouseExit
Node.NotificationWMPositionChanged
Node.NotificationOsMemoryWarning
Node.NotificationTranslationChanged
Node.NotificationWMAbout
Node.NotificationCrash
Node.NotificationOsImeUpdate
Node.NotificationApplicationResumed
Node.NotificationApplicationPaused
Node.NotificationApplicationFocusIn
Node.NotificationApplicationFocusOut
Node.NotificationTextServerChanged
Node.NotificationAccessibilityUpdate
Node.NotificationAccessibilityInvalidate
Node.GetNode<T>(NodePath)
Node.GetNodeOrNull<T>(NodePath)
Node.GetOwner<T>()
Node.GetOwnerOrNull<T>()
Node.GetParent<T>()
Node.GetParentOrNull<T>()
Node._EnterTree()
Node._GetAccessibilityConfigurationWarnings()
Node._GetConfigurationWarnings()
Node._GetFocusedAccessibilityElement()
Node._ShortcutInput(InputEvent)
Node._UnhandledInput(InputEvent)
Node._UnhandledKeyInput(InputEvent)
Node.PrintOrphanNodes()
Node.GetOrphanNodeIds()
Node.RemoveChild(Node)
Node.HasNode(NodePath)
Node.GetNode(NodePath)
Node.GetNodeOrNull(NodePath)
Node.GetParent()
Node.HasNodeAndResource(NodePath)
Node.GetNodeAndResource(NodePath)
Node.IsInsideTree()
Node.IsPartOfEditedScene()
Node.IsAncestorOf(Node)
Node.IsGreaterThan(Node)
Node.GetPath()
Node.RemoveFromGroup(StringName)
Node.IsInGroup(StringName)
Node.GetGroups()
Node.PrintTree()
Node.PrintTreePretty()
Node.GetTreeString()
Node.GetTreeStringPretty()
Node.GetPhysicsProcessDeltaTime()
Node.IsPhysicsProcessing()
Node.GetProcessDeltaTime()
Node.IsProcessing()
Node.IsProcessingInput()
Node.IsProcessingShortcutInput()
Node.IsProcessingUnhandledInput()
Node.IsProcessingUnhandledKeyInput()
Node.CanProcess()
Node.QueueAccessibilityUpdate()
Node.GetAccessibilityElement()
Node.IsDisplayedFolded()
Node.IsProcessingInternal()
Node.IsPhysicsProcessingInternal()
Node.IsPhysicsInterpolated()
Node.IsPhysicsInterpolatedAndEnabled()
Node.ResetPhysicsInterpolation()
Node.CanAutoTranslate()
Node.SetTranslationDomainInherited()
Node.GetWindow()
Node.GetLastExclusiveWindow()
Node.GetTree()
Node.CreateTween()
Node.GetSceneInstanceLoadPlaceholder()
Node.IsEditableInstance(Node)
Node.GetViewport()
Node.QueueFree()
Node.RequestReady()
Node.IsNodeReady()
Node.GetMultiplayerAuthority()
Node.IsMultiplayerAuthority()
Node.RpcConfig(StringName, Variant)
Node.GetNodeRpcConfig()
Node.Rpc(StringName, params Variant[])
Node.UpdateConfigurationWarnings()
Node.CallDeferredThreadGroup(StringName, params Variant[])
Node.SetDeferredThreadGroup(StringName, Variant)
Node.CallThreadSafe(StringName, params Variant[])
Node.SetThreadSafe(StringName, Variant)
Node.EmitSignalReady()
Node.EmitSignalRenamed()
Node.EmitSignalTreeEntered()
Node.EmitSignalTreeExiting()
Node.EmitSignalTreeExited()
Node.EmitSignalChildEnteredTree(Node)
Node.EmitSignalChildExitingTree(Node)
Node.EmitSignalChildOrderChanged()
Node.EmitSignalReplacingBy(Node)
Node.EmitSignalEditorDescriptionChanged(Node)
Node.EmitSignalEditorStateChanged()
Node.InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Node.HasGodotClassMethod(in godot_string_name)
Node.HasGodotClassSignal(in godot_string_name)
Node.Name
Node.UniqueNameInOwner
Node.SceneFilePath
Node.Owner
Node.Multiplayer
Node.ProcessMode
Node.ProcessPriority
Node.ProcessPhysicsPriority
Node.ProcessThreadGroup
Node.ProcessThreadGroupOrder
Node.ProcessThreadMessages
Node.PhysicsInterpolationMode
Node.AutoTranslateMode
Node.EditorDescription
Node.Ready
Node.Renamed
Node.TreeEntered
Node.TreeExiting
Node.TreeExited
Node.ChildEnteredTree
Node.ChildExitingTree
Node.ChildOrderChanged
Node.ReplacingBy
Node.EditorDescriptionChanged
Node.EditorStateChanged
GodotObject.NotificationPostinitialize
GodotObject.NotificationPredelete
GodotObject.NotificationExtensionReloaded
GodotObject.IsInstanceValid(GodotObject)
GodotObject.WeakRef(GodotObject)
GodotObject.Dispose()
GodotObject.ToString()
GodotObject.ToSignal(GodotObject, StringName)
GodotObject._Get(StringName)
GodotObject._GetPropertyList()
GodotObject._IterGet(Variant)
GodotObject._IterInit(Array)
GodotObject._IterNext(Array)
GodotObject._PropertyCanRevert(StringName)
GodotObject._PropertyGetRevert(StringName)
GodotObject._Set(StringName, Variant)
GodotObject._ValidateProperty(Dictionary)
GodotObject.Free()
GodotObject.GetClass()
GodotObject.Set(StringName, Variant)
GodotObject.Get(StringName)
GodotObject.SetIndexed(NodePath, Variant)
GodotObject.GetIndexed(NodePath)
GodotObject.GetPropertyList()
GodotObject.GetMethodList()
GodotObject.PropertyCanRevert(StringName)
GodotObject.PropertyGetRevert(StringName)
GodotObject.GetInstanceId()
GodotObject.SetScript(Variant)
GodotObject.GetScript()
GodotObject.SetMeta(StringName, Variant)
GodotObject.RemoveMeta(StringName)
GodotObject.GetMeta(StringName, Variant)
GodotObject.HasMeta(StringName)
GodotObject.GetMetaList()
GodotObject.HasUserSignal(StringName)
GodotObject.RemoveUserSignal(StringName)
GodotObject.EmitSignal(StringName, params Variant[])
GodotObject.Call(StringName, params Variant[])
GodotObject.CallDeferred(StringName, params Variant[])
GodotObject.SetDeferred(StringName, Variant)
GodotObject.Callv(StringName, Array)
GodotObject.HasMethod(StringName)
GodotObject.GetMethodArgumentCount(StringName)
GodotObject.HasSignal(StringName)
GodotObject.GetSignalList()
GodotObject.GetSignalConnectionList(StringName)
GodotObject.GetIncomingConnections()
GodotObject.Disconnect(StringName, Callable)
GodotObject.IsConnected(StringName, Callable)
GodotObject.HasConnections(StringName)
GodotObject.IsBlockingSignals()
GodotObject.NotifyPropertyListChanged()
GodotObject.CanTranslateMessages()
GodotObject.Tr(StringName, StringName)
GodotObject.GetTranslationDomain()
GodotObject.SetTranslationDomain(StringName)
GodotObject.IsQueuedForDeletion()
GodotObject.CancelFree()
GodotObject.EmitSignalScriptChanged()
GodotObject.EmitSignalPropertyListChanged()
GodotObject.NativeInstance
GodotObject.ScriptChanged
GodotObject.PropertyListChanged

Remarks

BattleInputSystem captures and interprets user actions (keyboard and mouse) related to combat gameplay, including:

  • Passing the turn
  • Moving a unit or selecting a target on the map
  • Selecting the move action
  • Selecting a skill

This system acts as a single entry point for battle-related inputs and communicates with other game systems through Godot signals.

The class follows a singleton-like pattern to ensure that only one active instance exists within the scene tree.

Methods

EmitSignalOnMoveUnitOrSelectTargetPressed(Vector3I)

protected void EmitSignalOnMoveUnitOrSelectTargetPressed(Vector3I dest)

Parameters

dest Vector3I

EmitSignalOnPassTurnPressed()

protected void EmitSignalOnPassTurnPressed()

EmitSignalOnSelectMovePressed()

protected void EmitSignalOnSelectMovePressed()

EmitSignalOnSelectedSkillPressed(int)

protected void EmitSignalOnSelectedSkillPressed(int skillId)

Parameters

skillId int

Initialize()

Initializes the BattleInputSystem instance This method should be overridden in derived classes to set up specific functionality.

protected virtual void Initialize()

Remarks

This method is called by the _Ready method to initialize the map. It should contain the logic necessary to set up the map's state and functionality. Derived classes must implement this method to provide their specific initialization logic.

SetInputEnabled(bool)

Set the input to enabled or not.

public virtual void SetInputEnabled(bool enabled)

Parameters

enabled bool

A boolean that set the input to enabled or not.

SetInstanceForTesting(BattleInputSystem?)

FOR TESTING ONLY: Manually sets the singleton instance. This method should only be used in unit tests.

protected static void SetInstanceForTesting(BattleInputSystem? instance)

Parameters

instance BattleInputSystem

The instance to set as the singleton.

_ExitTree()

Called when the node is removed from the scene tree. Cleans up the BattleInputSystem instance and sets it to null.

public override void _ExitTree()

Remarks

This method is called automatically by Godot when the node is removed from the scene tree. It ensures that the BattleInputSystem instance is properly cleaned up and set to null. This is important for preventing memory leaks and ensuring that the manager can be re-initialized later if needed.

_Input(InputEvent)

Called when there is an input event. The input event propagates up through the node tree until a node consumes it.

It is only called if input processing is enabled, which is done automatically if this method is overridden, and can be toggled with SetProcessInput(bool).

To consume the input event and stop it propagating further to other nodes, Godot.Viewport.SetInputAsHandled() can be called.

For gameplay input, Godot.Node._UnhandledInput(Godot.InputEvent) and Godot.Node._UnhandledKeyInput(Godot.InputEvent) are usually a better fit as they allow the GUI to intercept the events first.

Note: This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).

public override void _Input(InputEvent @event)

Parameters

event InputEvent

_Ready()

Called when the node is added to the scene tree. Initializes the BattleInputSystem instance and checks for duplicates.

public override void _Ready()

Remarks

This method is called automatically by Godot when the node is ready. It ensures that only one instance of the BattleInputSystem exists in the scene tree. If a duplicate instance is found, it removes the duplicate.

Events

OnMoveUnitOrSelectTargetPressed

Emitted when the player clicks on a map cell to move a unit or select a target.

public event BattleInputSystem.OnMoveUnitOrSelectTargetPressedEventHandler OnMoveUnitOrSelectTargetPressed

Event Type

BattleInputSystem.OnMoveUnitOrSelectTargetPressedEventHandler

Remarks

This signal notifies systems responsible for unit movement or selection that the player has requested a move or target action.

OnPassTurnPressed

Emitted when the player presses the "pass turn" input action.

public event BattleInputSystem.OnPassTurnPressedEventHandler OnPassTurnPressed

Event Type

BattleInputSystem.OnPassTurnPressedEventHandler

Remarks

Used by the GameManager to indicate that the player has chosen to skip their current turn and let control pass to the next entity.

OnSelectMovePressed

Emitted when the player selects the move action

public event BattleInputSystem.OnSelectMovePressedEventHandler OnSelectMovePressed

Event Type

BattleInputSystem.OnSelectMovePressedEventHandler

Remarks

This signal is used to notify systems handling unit commands that the player has initiated a move selection.

OnSelectedSkillPressed

Emitted when the player selects a specific skill.

public event BattleInputSystem.OnSelectedSkillPressedEventHandler OnSelectedSkillPressed

Event Type

BattleInputSystem.OnSelectedSkillPressedEventHandler

Remarks

Used by the combat system or skill management system to determine which skill the player intends to use. Skills are indexed from 0 to 4.