Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -4,6 +4,7 @@ extends RefCounted
|
||||
|
||||
const STICKMAN_RIG_SCRIPT := preload("res://scripts/characters/stickman/stickman_rig.gd")
|
||||
const PROP_STAGE_ROLES := preload("res://scripts/props/prop_stage_roles.gd")
|
||||
const STAGE_SCENERY_ARTWORK := preload("res://scripts/stage/scenery/stage_scenery_artwork.gd")
|
||||
|
||||
const STATE_STOPPED: int = 0
|
||||
const STATE_RUNNING: int = 1
|
||||
@@ -224,6 +225,12 @@ func capture_prop_pause_state(body: RigidBody2D) -> Dictionary:
|
||||
|
||||
|
||||
func save_object_state(node: Node2D) -> void:
|
||||
# Scenery artwork is editor-authored and does not move during simulation.
|
||||
# Its live transform is the document state, so a pre-PLAY snapshot must not
|
||||
# restore an old position when the user returns to EDIT.
|
||||
if node is STAGE_SCENERY_ARTWORK:
|
||||
authored_state.erase(node.get_instance_id())
|
||||
return
|
||||
var authored_rotation: float = node.global_rotation
|
||||
if node is STICKMAN_RIG_SCRIPT and (node as StickmanRig).get_facing_profile() == StickmanRig.FacingProfile.LEFT:
|
||||
# LEFT is a derived root reflection. Remove it before persisting the
|
||||
@@ -256,6 +263,9 @@ func restore_authored_state(stage_mode_name: String, run_state_name: String, cam
|
||||
if node == null or not is_instance_valid(node):
|
||||
authored_state.erase(id)
|
||||
continue
|
||||
if node is STAGE_SCENERY_ARTWORK:
|
||||
authored_state.erase(id)
|
||||
continue
|
||||
node.global_position = entry.get("position", node.global_position)
|
||||
node.global_rotation = entry.get("rotation", node.global_rotation)
|
||||
if entry.has("scale"):
|
||||
|
||||
Reference in New Issue
Block a user