Cleaned and improved some event stuff

This commit is contained in:
2025-05-26 13:11:27 -05:00
parent c1d8dd46d8
commit d6a2f4b567
27 changed files with 296 additions and 108 deletions

View File

@@ -2,15 +2,13 @@ class_name Event extends Node
const Entity = preload("res://scripts/Entity/Entity.gd");
var inEventSystemTree:bool = false;
var started:bool = false;
var ended:bool = false;
var interactor:EntityInteractor = null
var interactee:EntityInteractable = null
# Godot Methods
func _init() -> void:
pass
func _process(delta: float) -> void:
if !started || ended:
return
@@ -21,6 +19,11 @@ func _process(delta: float) -> void:
# Event methods (cleaned up)
func start() -> void:
assert(
self.is_inside_tree(),
"Event is trying to start but the node is not part of the scene tree. "+
"Refer to EventSystem.addEvent"
)
assert(started == false)
started = true
@@ -34,6 +37,8 @@ func isDone() -> bool:
func end() -> void:
assert(ended == false)
ended = true
if self.inEventSystemTree:
EVENT.removeEvent(self)
func isEndingEvent() -> bool:
return false