Refactor conversation stuff

This commit is contained in:
2026-01-14 23:20:56 -06:00
parent d916e65990
commit 5af98a69a2
18 changed files with 136 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
class_name EntityInteractableArea extends Area3D
# const BattleStartAction = preload("res://cutscene/battle/BattleStartAction.gd")
const ItemAction = preload("res://cutscene/item/ItemAction.gd")
@export var entity:Entity
@@ -16,6 +16,15 @@ func isInteractable() -> bool:
if entity.interactType == Entity.InteractType.TEST_BATTLE:
return true
if entity.interactType == Entity.InteractType.ONE_TIME_ITEM:
if entity.oneTimeItem == null:
return false
if entity.oneTimeItem.quantity <= 0:
return false
if entity.oneTimeItem.item == Item.ItemId.NULL:
return false
return true
return false
@@ -24,6 +33,13 @@ func _onConversationInteract(_other:Entity) -> void:
cutscene.addConversation(entity.conversation)
cutscene.start()
func _onItemInteract(_other:Entity) -> void:
assert(entity.oneTimeItem != null)
var cutscene:Cutscene = Cutscene.new()
cutscene.addCallable(ItemAction.getItemCallable(entity.oneTimeItem.toItemStack()))
cutscene.addCallable(ConversationAction.getTextboxCallable('This should be last'))
cutscene.start()
func onInteract(other:Entity) -> void:
if entity.interactType == Entity.InteractType.NONE:
return
@@ -33,6 +49,10 @@ func onInteract(other:Entity) -> void:
_onConversationInteract(other)
return
Entity.InteractType.ONE_TIME_ITEM:
_onItemInteract(other)
return
Entity.InteractType.TEST_BATTLE:
var cutscene:Cutscene = Cutscene.new()
cutscene.addCallable(BattleStartAction.getStartBattleCallable({