Refactoring

This commit is contained in:
2026-01-07 22:09:56 -06:00
parent fff088a0a7
commit b7716201d8
62 changed files with 110 additions and 78 deletions

View File

@@ -5,11 +5,15 @@ var interactableAreas:Array[EntityInteractableArea] = []
@export var entity:Entity
func hasInteraction() -> bool:
return true
return interactableAreas.size() > 0
func interact() -> void:
for area in interactableAreas:
area.onInteract()
if !area.isInteractable():
continue
area.onInteract(self.entity)
break
func _enter_tree() -> void:
self.area_entered.connect(_onAreaEntered)
@@ -23,11 +27,7 @@ func _onAreaEntered(area:Area3D) -> void:
if area is EntityInteractableArea:
if area.entity == entity:
return
if !area.isInteractable():
return
print("EntityInteractingArea: Area Entered")
interactableAreas.append(area)
func _onAreaExited(area:Area3D) -> void:
print("EntityInteractingArea: Area Exited")
interactableAreas.erase(area)