perf: harden runtime for weaker hardware
This commit is contained in:
@@ -10,8 +10,11 @@ static var _all: Array = []
|
||||
|
||||
@onready var interaction_point: Marker3D = $InteractionPoint
|
||||
|
||||
const PRESENTATION_UPDATE_INTERVAL_SECONDS := 0.25
|
||||
|
||||
var state: StorageStateRecord
|
||||
var _last_label_text := ""
|
||||
var _presentation_elapsed := 0.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -35,11 +38,15 @@ func _ready() -> void:
|
||||
add_to_group("storage_nodes")
|
||||
_try_register_with_simulation()
|
||||
_update_presentation()
|
||||
set_process(debug_label_enabled)
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if debug_label_enabled:
|
||||
_update_presentation()
|
||||
func _process(delta: float) -> void:
|
||||
_presentation_elapsed += delta
|
||||
if _presentation_elapsed < PRESENTATION_UPDATE_INTERVAL_SECONDS:
|
||||
return
|
||||
_presentation_elapsed = fmod(_presentation_elapsed, PRESENTATION_UPDATE_INTERVAL_SECONDS)
|
||||
_update_presentation()
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
@@ -93,6 +100,8 @@ func _update_presentation() -> void:
|
||||
|
||||
func set_debug_label_enabled(is_enabled: bool) -> void:
|
||||
debug_label_enabled = is_enabled
|
||||
_presentation_elapsed = 0.0
|
||||
set_process(is_enabled)
|
||||
_update_presentation()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user