perf: harden runtime for weaker hardware
This commit is contained in:
@@ -3,6 +3,7 @@ extends Control
|
||||
|
||||
const ENTER_OFFSET := 9.0
|
||||
const EXIT_OFFSET := 4.0
|
||||
const PROBE_INTERVAL_SECONDS := 0.1
|
||||
|
||||
@export var player: Node
|
||||
@export var simulation_manager: Node
|
||||
@@ -21,6 +22,7 @@ var current_context_key := ""
|
||||
var motion_tween: Tween
|
||||
var motion_version := 0
|
||||
var is_hiding := false
|
||||
var _probe_elapsed := 0.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -32,11 +34,17 @@ func _ready() -> void:
|
||||
call_deferred("refresh_note", true)
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
func _process(delta: float) -> void:
|
||||
_probe_elapsed += delta
|
||||
if _probe_elapsed < PROBE_INTERVAL_SECONDS:
|
||||
return
|
||||
_probe_elapsed = fmod(_probe_elapsed, PROBE_INTERVAL_SECONDS)
|
||||
refresh_note()
|
||||
|
||||
|
||||
func refresh_note(force: bool = false) -> void:
|
||||
if force:
|
||||
_probe_elapsed = 0.0
|
||||
if player == null or not player.has_method("get_nearby_villager_inspection"):
|
||||
current_context_key = ""
|
||||
_hide_note()
|
||||
|
||||
Reference in New Issue
Block a user