Move interactable input handling into Player2D so we can selectively block it from working if OldComputer is open
ci/woodpecker/push/woodpecker Pipeline was successful

We probably could have special-cased that check in Interactable now that I think about it
This commit is contained in:
yagigreg committed 2026-10-18 02:05:51 -05:00
1 parent f061e1905f
commit 93baf56fd5
4 files changed
+17 -9

No files matched your search

+10 -6
View File
@@ -7,7 +7,7 @@ var checked_teleport
var telecam_speed_mult = 4
var enabled = true
var cooldown = 2
var is_interactable = false
var _is_interactable = false
func disable():
enabled = false
@@ -17,10 +17,12 @@ func enable():
enabled = true
$Sprite2D.modulate = Color.WHITE
func _process(delta: float) -> void:
if not (is_interactable and Input.is_action_just_released("interact")):
return
func is_interactable() -> bool:
return _is_interactable
func interact() -> void:
if not is_interactable():
return
interacted.emit()
func _physics_process(delta: float) -> void:
@@ -29,11 +31,13 @@ func _physics_process(delta: float) -> void:
func _on_approach(body) -> void:
if body!=%Player2D:
return
is_interactable = true
_is_interactable = true
self.add_to_group("nearby_interactables")
$Sprite2D/ButtonPrompt.show()
func _on_abandon(body) -> void:
if body!=%Player2D:
return
is_interactable = false
_is_interactable = false
self.remove_from_group("nearby_interactables")
$Sprite2D/ButtonPrompt.hide()