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:
|
func _ready() -> void:
|
||||||
|
_deferred_init.call_deferred()
|
||||||
|
|
||||||
|
|
||||||
|
func _deferred_init() -> void:
|
||||||
if start_open:
|
if start_open:
|
||||||
_instant_open()
|
_instant_open()
|
||||||
|
|
||||||
@ -59,7 +63,4 @@ func serialize() -> Dictionary:
|
|||||||
|
|
||||||
|
|
||||||
func deserialize(state: Dictionary) -> void:
|
func deserialize(state: Dictionary) -> void:
|
||||||
if state["open"]:
|
start_open = state["open"]
|
||||||
_instant_open()
|
|
||||||
else:
|
|
||||||
_instant_close() # unneccessary?
|
|
||||||
|
@ -8,6 +8,10 @@ signal activated
|
|||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
_deferred_init.call_deferred()
|
||||||
|
|
||||||
|
|
||||||
|
func _deferred_init() -> void:
|
||||||
if enabled:
|
if enabled:
|
||||||
enable()
|
enable()
|
||||||
else:
|
else:
|
||||||
@ -47,5 +51,4 @@ func serialize() -> Dictionary:
|
|||||||
|
|
||||||
|
|
||||||
func deserialize(state: Dictionary) -> void:
|
func deserialize(state: Dictionary) -> void:
|
||||||
if state["enabled"]:
|
enabled = state["enabled"]
|
||||||
enable()
|
|
||||||
|
@ -22,6 +22,10 @@ const CLEAN_THRESHOLD := 1400
|
|||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
interactive.label = label
|
interactive.label = label
|
||||||
|
_deferred_init.call_deferred()
|
||||||
|
|
||||||
|
|
||||||
|
func _deferred_init() -> void:
|
||||||
if clean:
|
if clean:
|
||||||
gunk_body.clear_all()
|
gunk_body.clear_all()
|
||||||
_on_clean()
|
_on_clean()
|
||||||
@ -88,11 +92,12 @@ func _on_action_delay_timeout() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func serialize() -> Dictionary:
|
func serialize() -> Dictionary:
|
||||||
return {"enabled": enabled}
|
return {
|
||||||
|
"clean": clean,
|
||||||
|
"enabled": enabled,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func deserialize(state: Dictionary) -> void:
|
func deserialize(state: Dictionary) -> void:
|
||||||
if state["enabled"]:
|
clean = state["clean"]
|
||||||
enable()
|
enabled = state["enabled"]
|
||||||
else:
|
|
||||||
disable()
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user