Fix some bugs with chat
This commit is contained in:
@@ -20,7 +20,7 @@ func _applyGravity() -> void:
|
||||
func _applyPlayerMovement(delta:float):
|
||||
# Interactions, may move
|
||||
if Input.is_action_just_pressed("interact") && interactingArea && interactingArea.hasInteraction():
|
||||
if !UI.hasAdvanceableChatBox():
|
||||
if !UI.hasAdvanceableChatBox() && !UI.dialogueActive:
|
||||
interactingArea.interact()
|
||||
return
|
||||
|
||||
@@ -63,8 +63,6 @@ func _applyFriction(delta:float) -> void:
|
||||
entity.velocity.z *= delta * FRICTION
|
||||
|
||||
func _canMove() -> bool:
|
||||
if UI.dialogueActive:
|
||||
return false
|
||||
if !UI.MAIN_CHATBOX.isClosed:
|
||||
return false
|
||||
if UI.GAME_MENU && UI.GAME_MENU.isOpen():
|
||||
|
||||
@@ -3,9 +3,11 @@ class_name EntityProximityArea extends Area3D
|
||||
@export var entity:Entity
|
||||
|
||||
var _triggered:bool = false
|
||||
var _chatbox:WorldChatBox = null
|
||||
|
||||
func _ready() -> void:
|
||||
body_entered.connect(_onBodyEntered)
|
||||
body_exited.connect(_onBodyExited)
|
||||
|
||||
func _onBodyEntered(body:Node3D) -> void:
|
||||
if _triggered:
|
||||
@@ -16,5 +18,15 @@ func _onBodyEntered(body:Node3D) -> void:
|
||||
return
|
||||
_triggered = true
|
||||
assert(entity != null && entity.chatboxMessage != "")
|
||||
var chatbox:WorldChatBox = UI.spawnWorldChatBox(entity)
|
||||
chatbox.showTimed(entity.chatboxMessage, entity.chatboxDuration)
|
||||
if is_instance_valid(_chatbox) and _chatbox.visible:
|
||||
_chatbox.resetTimer(entity.chatboxDuration)
|
||||
else:
|
||||
_chatbox = UI.spawnWorldChatBox(entity)
|
||||
_chatbox.showTimed(entity.chatboxMessage, entity.chatboxDuration)
|
||||
|
||||
func _onBodyExited(body:Node3D) -> void:
|
||||
if !(body is Entity):
|
||||
return
|
||||
if (body as Entity).entityId != "player":
|
||||
return
|
||||
_triggered = false
|
||||
|
||||
Reference in New Issue
Block a user