Cleaned and improved some event stuff
This commit is contained in:
@@ -38,6 +38,9 @@ func getRaycastInteractable() -> EntityInteractable:
|
||||
return interactable
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if !entity or entity.isPaused():
|
||||
return
|
||||
|
||||
match interactorType:
|
||||
InteractorType.PLAYER_INPUT:
|
||||
_processPlayerInput()
|
||||
@@ -49,6 +52,10 @@ func _process(delta: float) -> void:
|
||||
func _processPlayerInput() -> void:
|
||||
if !Input.is_action_just_pressed("interact"):
|
||||
return
|
||||
|
||||
# Conditions where player cannot interact.
|
||||
if UI.hasInteractionFocus():
|
||||
return
|
||||
|
||||
var interactable:EntityInteractable = getRaycastInteractable()
|
||||
if interactable:
|
||||
|
@@ -22,11 +22,9 @@ func onEntityInteract(
|
||||
interactor:EntityInteractor,
|
||||
interactee:EntityInteractable
|
||||
) -> void:
|
||||
print("Interact?")
|
||||
var event = EventGetItem.new()
|
||||
event.itemType = itemType;
|
||||
event.quantity = quantity;
|
||||
event.removeNode = self
|
||||
EVENT.addEvent(event)
|
||||
event.onEntityInteract(interactor, interactee)
|
||||
|
||||
get_parent().remove_child(self)
|
||||
self.queue_free()
|
Reference in New Issue
Block a user