Files
Dawn-Godot/overworld/entity/EntityInteractableArea.gd
2026-01-14 21:54:38 -06:00

46 lines
1.2 KiB
GDScript

class_name EntityInteractableArea extends Area3D
# const BattleStartAction = preload("res://cutscene/battle/BattleStartAction.gd")
@export var entity:Entity
func isInteractable() -> bool:
if !entity:
return false
if entity.interactType == Entity.InteractType.NONE:
return false
if entity.interactType == Entity.InteractType.CONVERSATION:
if entity.conversation.size() != 0:
return true
if entity.interactType == Entity.InteractType.TEST_BATTLE:
return true
return false
func _onConversationInteract(_other:Entity) -> void:
var cutscene:Cutscene = Cutscene.new()
cutscene.addConversation(entity.conversation)
cutscene.start()
func onInteract(other:Entity) -> void:
if entity.interactType == Entity.InteractType.NONE:
return
match entity.interactType:
Entity.InteractType.CONVERSATION:
_onConversationInteract(other)
return
Entity.InteractType.TEST_BATTLE:
var cutscene:Cutscene = Cutscene.new()
cutscene.addCallable(BattleStartAction.getStartBattleCallable({
BATTLE.BattlePosition.RIGHT_TOP_FRONT: PartySingleton.PARTY_JOHN,
}))
cutscene.start()
return
_:
pass