cleaned up interaction code
This commit is contained in:
@@ -5,7 +5,6 @@ var rayRange = 2000
|
||||
@onready var crosshair = %CrosshairCenter
|
||||
@export var terminal: TerminalControls
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
Get_Camera_Collision()
|
||||
|
||||
@@ -24,24 +23,26 @@ func Get_Camera_Collision():
|
||||
if crosshair and is_instance_valid(crosshair):
|
||||
crosshair.set_highlight(is_highlighted)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventKey and event.pressed and crosshair.is_highlighted:
|
||||
|
||||
if event.keycode == KEY_PAGEUP:
|
||||
terminal.ScrollUp()
|
||||
|
||||
if event.keycode == KEY_PAGEDOWN:
|
||||
terminal.ScrollDown()
|
||||
|
||||
if event.keycode == KEY_BACKSPACE:
|
||||
match event.keycode:
|
||||
KEY_PAGEUP:
|
||||
terminal.ScrollUp()
|
||||
|
||||
terminal.InputDelChar()
|
||||
KEY_PAGEDOWN:
|
||||
terminal.ScrollDown()
|
||||
|
||||
KEY_BACKSPACE:
|
||||
terminal.InputDelChar()
|
||||
|
||||
KEY_ENTER:
|
||||
terminal.EnterCommand()
|
||||
|
||||
if event.unicode > 31:
|
||||
var character = char(event.unicode)
|
||||
|
||||
if terminal: # Check that you assigned the node in the Inspector
|
||||
terminal.InputChar(character)
|
||||
|
||||
if event.keycode == KEY_ENTER:
|
||||
terminal.EnterCommand()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user