generated from krampus/template-godot4
Bulkhead & wall switch defer state initialization until after loading
This commit is contained in:
parent
48c9953c53
commit
e4a2f31de9
@ -19,6 +19,10 @@ extends Node3D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_deferred_init.call_deferred()
|
||||
|
||||
|
||||
func _deferred_init() -> void:
|
||||
if start_open:
|
||||
_instant_open()
|
||||
|
||||
@ -59,7 +63,4 @@ func serialize() -> Dictionary:
|
||||
|
||||
|
||||
func deserialize(state: Dictionary) -> void:
|
||||
if state["open"]:
|
||||
_instant_open()
|
||||
else:
|
||||
_instant_close() # unneccessary?
|
||||
start_open = state["open"]
|
||||
|
@ -8,6 +8,10 @@ signal activated
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_deferred_init.call_deferred()
|
||||
|
||||
|
||||
func _deferred_init() -> void:
|
||||
if enabled:
|
||||
enable()
|
||||
else:
|
||||
@ -47,5 +51,4 @@ func serialize() -> Dictionary:
|
||||
|
||||
|
||||
func deserialize(state: Dictionary) -> void:
|
||||
if state["enabled"]:
|
||||
enable()
|
||||
enabled = state["enabled"]
|
||||
|
@ -22,6 +22,10 @@ const CLEAN_THRESHOLD := 1400
|
||||
|
||||
func _ready() -> void:
|
||||
interactive.label = label
|
||||
_deferred_init.call_deferred()
|
||||
|
||||
|
||||
func _deferred_init() -> void:
|
||||
if clean:
|
||||
gunk_body.clear_all()
|
||||
_on_clean()
|
||||
@ -88,11 +92,12 @@ func _on_action_delay_timeout() -> void:
|
||||
|
||||
|
||||
func serialize() -> Dictionary:
|
||||
return {"enabled": enabled}
|
||||
return {
|
||||
"clean": clean,
|
||||
"enabled": enabled,
|
||||
}
|
||||
|
||||
|
||||
func deserialize(state: Dictionary) -> void:
|
||||
if state["enabled"]:
|
||||
enable()
|
||||
else:
|
||||
disable()
|
||||
clean = state["clean"]
|
||||
enabled = state["enabled"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user