From f0ddf04041752c85b360a5923d9b454faa6566bf Mon Sep 17 00:00:00 2001 From: Eli <88557639+lishaduck@users.noreply.github.com> Date: Tue, 27 Feb 2024 11:15:59 -0600 Subject: [PATCH] refactor: static typing --- .../animations/left/hand_blend_tree.tres | 2 +- .../animations/right/hand_blend_tree.tres | 2 +- components/helpers/scatter.gd | 69 +++++++--------- components/helpers/zone_save_point.gd | 8 +- components/helpers/zone_switch_area.gd | 6 +- components/persistent/persistent_item.gd | 43 +++++----- .../persistent/persistent_item_database.gd | 17 ++-- components/persistent/persistent_pocket.gd | 37 +++++---- components/persistent/persistent_staging.gd | 2 +- components/persistent/persistent_world.gd | 23 +++--- components/persistent/persistent_zone.gd | 64 ++++++++------- .../persistent/persistent_zone_database.gd | 17 ++-- game/game_state.gd | 38 +++++---- game/main.gd | 8 +- game/start_scene/start_ui.gd | 57 +++++++------- .../zones/start_island/start_island_zone.tscn | 78 +++++++++---------- game/zones/zone_wrist_ui.gd | 8 +- project.godot | 9 +++ 18 files changed, 244 insertions(+), 244 deletions(-) diff --git a/addons/godot-xr-tools/hands/animations/left/hand_blend_tree.tres b/addons/godot-xr-tools/hands/animations/left/hand_blend_tree.tres index ae6f20a..011abdb 100644 --- a/addons/godot-xr-tools/hands/animations/left/hand_blend_tree.tres +++ b/addons/godot-xr-tools/hands/animations/left/hand_blend_tree.tres @@ -29,4 +29,4 @@ nodes/OpenHand/node = SubResource("4") nodes/OpenHand/position = Vector2(-600, 100) nodes/Trigger/node = SubResource("5") nodes/Trigger/position = Vector2(-360, 20) -node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"] +node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] diff --git a/addons/godot-xr-tools/hands/animations/right/hand_blend_tree.tres b/addons/godot-xr-tools/hands/animations/right/hand_blend_tree.tres index f56fb58..f1d41a1 100644 --- a/addons/godot-xr-tools/hands/animations/right/hand_blend_tree.tres +++ b/addons/godot-xr-tools/hands/animations/right/hand_blend_tree.tres @@ -29,4 +29,4 @@ nodes/OpenHand/node = SubResource("3") nodes/OpenHand/position = Vector2(-600, 100) nodes/Trigger/node = SubResource("5") nodes/Trigger/position = Vector2(-360, 40) -node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"] +node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] diff --git a/components/helpers/scatter.gd b/components/helpers/scatter.gd index 49c19a5..e6986a7 100644 --- a/components/helpers/scatter.gd +++ b/components/helpers/scatter.gd @@ -8,62 +8,47 @@ extends Node3D ## random locations. @export var extend: Vector3 = Vector3(1.0, 0.0, 1.0): - set = set_extend + set(new_value): + extend = new_value + _set_dirty() + @export var instance_count: int = 10: - set = set_instance_count + set(new_value): + instance_count = new_value + _set_dirty() + @export var min_scale: float = 1.0: - set = set_min_scale + set(new_value): + min_scale = new_value + _set_dirty() @export var max_scale: float = 1.0: - set = set_max_scale + set(new_value): + max_scale = new_value + _set_dirty() @export var mesh: Mesh: - set = set_mesh + set(new_mesh): + mesh = new_mesh + if multi_mesh: + multi_mesh.mesh = mesh + @export var material_override: Material: - set = set_material_override + set(new_material): + material_override = new_material + if multi_mesh_instance: + multi_mesh_instance.material_override = material_override var dirty: bool = true var multi_mesh: MultiMesh var multi_mesh_instance: MultiMeshInstance3D -func set_extend(new_value): - extend = new_value - _set_dirty() - - -func set_instance_count(new_value): - instance_count = new_value - _set_dirty() - - -func set_min_scale(new_value): - min_scale = new_value - _set_dirty() - - -func set_max_scale(new_value): - max_scale = new_value - _set_dirty() - - -func set_mesh(new_mesh): - mesh = new_mesh - if multi_mesh: - multi_mesh.mesh = mesh - - -func set_material_override(new_material): - material_override = new_material - if multi_mesh_instance: - multi_mesh_instance.material_override = material_override - - -func _set_dirty(): +func _set_dirty() -> void: if !dirty: dirty = true - call_deferred("_update_multimesh") + _update_multimesh.call_deferred() -func _update_multimesh(): +func _update_multimesh() -> void: if !dirty: return @@ -83,7 +68,7 @@ func _update_multimesh(): # Called when the node enters the scene tree for the first time. -func _ready(): +func _ready() -> void: multi_mesh = MultiMesh.new() multi_mesh.transform_format = MultiMesh.TRANSFORM_3D multi_mesh.mesh = mesh diff --git a/components/helpers/zone_save_point.gd b/components/helpers/zone_save_point.gd index 86e0b28..cb52e10 100644 --- a/components/helpers/zone_save_point.gd +++ b/components/helpers/zone_save_point.gd @@ -3,10 +3,12 @@ extends Node3D @export var saved_material: Material # We only allow saving once after our scene loads -var is_saved = false +var is_saved := false +@onready var button: MeshInstance3D = $Pole/SaveButton/Button -func _on_save_button_button_pressed(_button): + +func _on_save_button_button_pressed(_button: XRToolsInteractableAreaButton) -> void: # Skip if already saved if is_saved: return @@ -16,5 +18,5 @@ func _on_save_button_button_pressed(_button): return # Change button to saved - $Pole/SaveButton/Button.set_surface_override_material(0, saved_material) + button.set_surface_override_material(0, saved_material) is_saved = true diff --git a/components/helpers/zone_switch_area.gd b/components/helpers/zone_switch_area.gd index 8f5b68b..40bebdf 100644 --- a/components/helpers/zone_switch_area.gd +++ b/components/helpers/zone_switch_area.gd @@ -12,12 +12,12 @@ extends Area3D # Called when the node enters the scene tree for the first time. -func _ready(): - connect("body_entered", Callable(self, "_on_body_entered")) +func _ready() -> void: + var _connection_err := body_entered.connect(_on_body_entered) # Called when a body enters this area -func _on_body_entered(body: Node3D): +func _on_body_entered(body: Node3D) -> void: # Ignore if not enabled if not enabled: return diff --git a/components/persistent/persistent_item.gd b/components/persistent/persistent_item.gd index e6a96be..fff1abb 100644 --- a/components/persistent/persistent_item.gd +++ b/components/persistent/persistent_item.gd @@ -56,12 +56,12 @@ func is_xr_class(p_name: String) -> bool: # Called when the node enters the scene tree for the first time. -func _ready(): +func _ready() -> void: super() # Subscribe to picked_up and dropped signals - picked_up.connect(_on_picked_up) - dropped.connect(_on_dropped) + var _connection_err := picked_up.connect(_on_picked_up) + var _connection_err2 := dropped.connect(_on_dropped) # Get configuration warnings @@ -70,15 +70,15 @@ func _get_configuration_warnings() -> PackedStringArray: # Verify item ID is set if not item_id: - warnings.append("PersistentItem ID not zet") + var _did_append := warnings.append("PersistentItem ID not zet") # Verify the item type is set if not item_type: - warnings.append("PersistentItem Type not set") + var _did_append := warnings.append("PersistentItem Type not set") # Verify item is in persistent group if not is_in_group("persistent"): - warnings.append("PersistentItem not in 'persistent' group") + var _did_append := warnings.append("PersistentItem not in 'persistent' group") # Return warnings return warnings @@ -102,7 +102,7 @@ func _notification(what: int) -> void: ## This method is called when the [PersistentItem] is dropped and freed -func drop_and_free(): +func drop_and_free() -> void: super() # Propagate destruction to this node and all children @@ -114,17 +114,17 @@ func drop_and_free(): # and all children for destruction, otherwise it restores the items state. func _load_state() -> void: # Restore the item state - var state = PersistentWorld.instance.get_value(item_id) - if not state is Dictionary: - return + var state: Variant = PersistentWorld.instance.get_value(item_id) + if state is Dictionary: + var dict_state: Dictionary = state - # If the item is recorded as having been destroyed then destroy it - if state.get("destroyed", false): - propagate_notification(Persistent.NOTIFICATION_DESTROY) - return + # If the item is recorded as having been destroyed then destroy it + if dict_state.get("destroyed", false): + propagate_notification(Persistent.NOTIFICATION_DESTROY) + return - # Restore the item state - _load_world_state(state) + # Restore the item state + _load_world_state(dict_state) # This method saves the state of the item to [PersistentWorld]. If the item @@ -166,9 +166,10 @@ func _destroy() -> void: ## state information from the dictionary. func _load_world_state(state: Dictionary) -> void: # Restore the location - var location = state.get("location") + var location: Variant = state.get("location") if location is Transform3D: - global_transform = location + var loc: Transform3D = location + global_transform = loc ## This method saves item state to the [param state] world data. The base @@ -188,7 +189,7 @@ func _start_auto_return_timer() -> void: if not _auto_return_timer: _auto_return_timer = Timer.new() _auto_return_timer.one_shot = true - _auto_return_timer.timeout.connect(_on_auto_return) + var _connection_err := _auto_return_timer.timeout.connect(_on_auto_return) add_child(_auto_return_timer) # Start the auto-return timer @@ -196,7 +197,7 @@ func _start_auto_return_timer() -> void: # Called when this object is picked up -func _on_picked_up(_pickable) -> void: +func _on_picked_up(_pickable: XRToolsPickable) -> void: # Save the last pocket if get_picked_up_by() is PersistentPocket: _last_pocket = get_picked_up_by() @@ -207,7 +208,7 @@ func _on_picked_up(_pickable) -> void: # Called when this object is dropped -func _on_dropped(_pickable) -> void: +func _on_dropped(_pickable: XRToolsPickable) -> void: # Start the auto-return timer if possible if auto_return and _last_pocket: _start_auto_return_timer() diff --git a/components/persistent/persistent_item_database.gd b/components/persistent/persistent_item_database.gd index efe88ac..ae176ec 100644 --- a/components/persistent/persistent_item_database.gd +++ b/components/persistent/persistent_item_database.gd @@ -9,7 +9,13 @@ extends Resource ## This property is the array of supported persistent item types @export var items: Array[PersistentItemType]: - set = _set_items + # Handle setting the items + set(p_items): + # Save the new items + items = p_items + + # Invalidate the cache + _cache_valid = false # Items cache var _cache := {} @@ -28,15 +34,6 @@ func get_type(type_id: String) -> PersistentItemType: return _cache.get(type_id) -# Handle setting the items -func _set_items(p_items: Array[PersistentItemType]) -> void: - # Save the new items - items = p_items - - # Invalidate the cache - _cache_valid = false - - # Populate the type cache func _populate_cache() -> void: # Populate the cache diff --git a/components/persistent/persistent_pocket.gd b/components/persistent/persistent_pocket.gd index 34b5f1e..74843fe 100644 --- a/components/persistent/persistent_pocket.gd +++ b/components/persistent/persistent_pocket.gd @@ -30,7 +30,11 @@ enum HeldBehavior { ## Pocket behavior when held @export var held_behavior := HeldBehavior.ENABLE: - set = _set_held_behavior + # Called when the held_behavior property has been modified + set(p_held_behavior): + held_behavior = p_held_behavior + if is_inside_tree() and _parent_body: + _update_held_behavior() # Parent pickable body var _parent_body: XRToolsPickable @@ -42,7 +46,7 @@ func is_xr_class(p_name: String) -> bool: # Called when the node enters the scene tree for the first time. -func _ready(): +func _ready() -> void: super() # Skip initialization if in editor @@ -52,8 +56,8 @@ func _ready(): # Search for an ancestor XRToolsPickable _parent_body = XRTools.find_xr_ancestor(self, "*", "XRToolsPickable") if _parent_body: - _parent_body.picked_up.connect(_on_picked_up) - _parent_body.dropped.connect(_on_dropped) + var _connection_err := _parent_body.picked_up.connect(_on_picked_up) + var _connection_err2 := _parent_body.dropped.connect(_on_dropped) # Update the held behavior _update_held_behavior() @@ -65,11 +69,11 @@ func _get_configuration_warnings() -> PackedStringArray: # Verify pocket ID is set if not pocket_id: - warnings.append("Pocket ID not zet") + var _did_append := warnings.append("Pocket ID not zet") # Verify pocket is in persistent group if not is_in_group("persistent"): - warnings.append("Pocket not in 'persistent' group") + var _did_append := warnings.append("Pocket not in 'persistent' group") # Return warnings return warnings @@ -108,9 +112,10 @@ func _save_state() -> void: # Save that the pocket is empty PersistentWorld.instance.clear_value(pocket_id) return + var persistent_picked_up_object: PersistentItem = picked_up_object # Get the item_id of the PersistentItem in the pocket - var item_id: String = picked_up_object.item_id + var item_id := persistent_picked_up_object.item_id # Save that the pocket holds the item PersistentWorld.instance.set_value(pocket_id, item_id) @@ -128,12 +133,13 @@ func _destroy() -> void: # Populate the contents of a pocket func _populate_pocket() -> void: # Get the ID of the item in the pocket - var item_id = PersistentWorld.instance.get_value(pocket_id) - if not item_id is String: + var _item_id: Variant = PersistentWorld.instance.get_value(pocket_id) + if not _item_id is String: return + var item_id: String = _item_id # Construct the item for the pocket - var zone = PersistentZone.find_instance(self) + var zone := PersistentZone.find_instance(self) var item := zone.create_item_instance(item_id) if not item: return @@ -144,22 +150,15 @@ func _populate_pocket() -> void: # Called when the parent pickable body is picked up -func _on_picked_up(_pickable) -> void: +func _on_picked_up(_pickable: XRToolsPickable) -> void: _update_held_behavior() # Called when the parent pickable body is dropped -func _on_dropped(_pickable) -> void: +func _on_dropped(_pickable: XRToolsPickable) -> void: _update_held_behavior() -# Called when the held_behavior property has been modified -func _set_held_behavior(p_held_behavior: HeldBehavior) -> void: - held_behavior = p_held_behavior - if is_inside_tree() and _parent_body: - _update_held_behavior() - - # Update the pocket enable func _update_held_behavior() -> void: # Skip if no valid parent body diff --git a/components/persistent/persistent_staging.gd b/components/persistent/persistent_staging.gd index 1f6f44b..63cc48c 100644 --- a/components/persistent/persistent_staging.gd +++ b/components/persistent/persistent_staging.gd @@ -12,7 +12,7 @@ func is_xr_class(p_name: String) -> bool: # Called when the node enters the scene tree for the first time. -func _ready(): +func _ready() -> void: super() # Register ourselves as the persistent stage instances diff --git a/components/persistent/persistent_world.gd b/components/persistent/persistent_world.gd index 13be9eb..ac166ca 100644 --- a/components/persistent/persistent_world.gd +++ b/components/persistent/persistent_world.gd @@ -52,15 +52,15 @@ func _get_configuration_warnings() -> PackedStringArray: # Check for blank password if save_file_password == "": - warnings.append("Save password not set - saves will be unencrypted") + var _did_append := warnings.append("Save password not set - saves will be unencrypted") # Check for zone database if not zone_database: - warnings.append("Zone database not set") + var _did_append := warnings.append("Zone database not set") # Check for item database if not item_database: - warnings.append("Item database not set") + var _did_append := warnings.append("Item database not set") # Return warnings return warnings @@ -95,9 +95,9 @@ func set_value(id: String, value: Variant) -> void: ## This method gets the value stored under the [param id]. If the [param id] ## does not exist then the [param default] value is returned. -func get_value(id: String, default: Variant = null): # -> Variant +func get_value(id: String, default: Variant = null) -> Variant: _mutex.lock() - var value = _data.get(id, default) + var value: Variant = _data.get(id, default) _mutex.unlock() return value @@ -105,7 +105,7 @@ func get_value(id: String, default: Variant = null): # -> Variant ## This method clears a value under the [param id]. func clear_value(id: String) -> void: _mutex.lock() - _data.erase(id) + var _existed := _data.erase(id) _mutex.unlock() @@ -113,10 +113,9 @@ func clear_value(id: String) -> void: ## [method String.match] for pattern matching rules. func clear_matching(pattern: String) -> void: _mutex.lock() - for _key in _data.keys(): - var key: String = _key + for key: String in _data.keys(): if key.match(pattern): - _data.erase(key) + var _existed := _data.erase(key) _mutex.unlock() @@ -137,7 +136,7 @@ func load_summary(file_name: String) -> Variant: return null # Read the summary - var summary = file.get_var() + var summary: Variant = file.get_var() file.close() # Return the summary @@ -160,7 +159,7 @@ func load_file(file_name: String) -> bool: file.get_var() # Read the data - var new_data = file.get_var() + var new_data: Variant = file.get_var() file.close() # Skip if not dictionary @@ -226,7 +225,7 @@ func list_saves() -> Array[String]: # Build a regular expression to match save file names var regex := RegEx.new() - regex.compile("^save_(?.*)\\.data$") + var _did_compile := regex.compile("^save_(?.*)\\.data$") # Process all files in the user folder for file in DirAccess.get_files_at("user://"): diff --git a/components/persistent/persistent_zone.gd b/components/persistent/persistent_zone.gd index 9993026..a9329be 100644 --- a/components/persistent/persistent_zone.gd +++ b/components/persistent/persistent_zone.gd @@ -32,14 +32,15 @@ func _get_configuration_warnings() -> PackedStringArray: # Verify zone info is set if not zone_info: - warnings.append("Zone ID not zet") + var _did_append := warnings.append("Zone ID not zet") # Return warnings return warnings ## Handle zone loaded -func scene_loaded(user_data = null): +func scene_loaded(user_data: Variant = null) -> void: + @warning_ignore("UNSAFE_CALL_ARGUMENT") super(user_data) # Save the current zone @@ -47,17 +48,18 @@ func scene_loaded(user_data = null): # Find all PersistentItem instances designed into the zone var items_in_zone := {} - for node in XRTools.find_xr_children(self, "*", "PersistentItem"): + for node: PersistentItem in XRTools.find_xr_children(self, "*", "PersistentItem"): items_in_zone[node.item_id] = node # Find the zone items the PersistentWorld thinks should be in this zone. - var zone_items = PersistentWorld.instance.get_value(zone_info.zone_id) + var zone_items: Variant = PersistentWorld.instance.get_value(zone_info.zone_id) # Free items designed into the zone but PersistentWorld thinks should # be removed. - if zone_items is Array: - for item_id in items_in_zone: - if not zone_items.has(item_id): + if zone_items is Array[String]: + var zone_items_list: Array[String] = zone_items + for item_id: String in items_in_zone: + if not zone_items_list.has(item_id): var item: PersistentItem = items_in_zone[item_id] item.get_parent().remove_child(item) item.queue_free() @@ -68,14 +70,16 @@ func scene_loaded(user_data = null): # Create items missing from the zone but PersistentWorld thinks should be # present. if zone_items is Array: - for item_id in zone_items: + var zone_items_list: Array[String] = zone_items + for item_id: String in zone_items_list: if not items_in_zone.has(item_id): - create_item_instance(item_id) + var _item := create_item_instance(item_id) # Create items held by the players left hand var left_pickup := XRToolsFunctionPickup.find_left($XROrigin3D) - var left_item_id = PersistentWorld.instance.get_value("player.left_hand") - if left_pickup and left_item_id is String: + var _left_item_id: Variant = PersistentWorld.instance.get_value("player.left_hand") + if left_pickup and _left_item_id is String: + var left_item_id: String = _left_item_id var left_instance := create_item_instance(left_item_id) if left_instance: left_instance.global_transform = left_pickup.global_transform @@ -83,8 +87,9 @@ func scene_loaded(user_data = null): # Create items held by the players right hand var right_pickup := XRToolsFunctionPickup.find_right($XROrigin3D) - var right_item_id = PersistentWorld.instance.get_value("player.right_hand") - if right_pickup and right_item_id is String: + var _right_item_id: Variant = PersistentWorld.instance.get_value("player.right_hand") + if right_pickup and _right_item_id is String: + var right_item_id: String = _right_item_id var right_instance := create_item_instance(right_item_id) if right_instance: right_instance.global_transform = right_pickup.global_transform @@ -92,7 +97,8 @@ func scene_loaded(user_data = null): ## Handle zone exiting -func scene_exiting(user_data = null): +func scene_exiting(user_data: Variant = null) -> void: + @warning_ignore("UNSAFE_CALL_ARGUMENT") super(user_data) # Ensure the zone state is saved before exiting the zone @@ -111,8 +117,8 @@ func save_world_state() -> void: # Identify items held directly by the zone var items_in_zone: Array[String] = [] - for node in get_tree().get_nodes_in_group("persistent"): - if is_item_held_by_zone(node): + for node: PersistentItem in get_tree().get_nodes_in_group("persistent"): + if PersistentZone.is_item_held_by_zone(node): items_in_zone.append(node.item_id) # Save the items held by the zone @@ -120,7 +126,8 @@ func save_world_state() -> void: # Handle items held in the players left hand var left_pickup := XRToolsFunctionPickup.find_left($XROrigin3D) - var left_item := _get_held_persistent_item(left_pickup) + # gdlint:ignore = private-method-call + var left_item := PersistentZone._get_held_persistent_item(left_pickup) if left_item: # The player.left_hand holds the item PersistentWorld.instance.set_value("player.left_hand", left_item.item_id) @@ -130,7 +137,8 @@ func save_world_state() -> void: # Handle items held in the players right hand var right_pickup := XRToolsFunctionPickup.find_right($XROrigin3D) - var right_item := _get_held_persistent_item(right_pickup) + # gdlint:ignore = private-method-call + var right_item := PersistentZone._get_held_persistent_item(right_pickup) if right_item: # The player.right_hand holds the item PersistentWorld.instance.set_value("player.right_hand", right_item.item_id) @@ -149,16 +157,18 @@ static func find_instance(node: Node) -> PersistentZone: # scene. func create_item_instance(item_id: String) -> PersistentItem: # Get the items state information - var state = PersistentWorld.instance.get_value(item_id) - if not state is Dictionary: + var _state: Variant = PersistentWorld.instance.get_value(item_id) + if not _state is Dictionary: push_warning("Item %s not in world-data" % item_id) return null + var state: Dictionary = _state # Get the items type_id - var item_type_id = state.get("type") - if not item_type_id is String: + var _item_type_id: Variant = state.get("type") + if not _item_type_id is String: push_warning("Item %s does not define type" % item_id) return null + var item_type_id: String = _item_type_id # Get the PersistentItemType var item_type := PersistentWorld.instance.item_database.get_type(item_type_id) @@ -198,20 +208,22 @@ static func is_item_held_by_zone(node: Node) -> bool: if not node is PersistentItem: return false + var item: PersistentItem = node + # If the node isn't held by anything valid then it's held by the zone - if not is_instance_valid(node.get_picked_up_by()): + if not is_instance_valid(item.get_picked_up_by()): return true # If held by a PersistentPocket then it's not held by the zone - if node.get_picked_up_by() is PersistentPocket: + if item.get_picked_up_by() is PersistentPocket: return false # If held by an XRToolsFunctionPickup the it's not held by the zone - if node.get_picked_up_by() is XRToolsFunctionPickup: + if item.get_picked_up_by() is XRToolsFunctionPickup: return false # Node is held by a non-persistent mechanism in the zone - push_warning("Item ", node.item_id, " held by non-persistent ", node.get_picked_up_by()) + push_warning("Item ", item.item_id, " held by non-persistent ", item.get_picked_up_by()) return true diff --git a/components/persistent/persistent_zone_database.gd b/components/persistent/persistent_zone_database.gd index 0205838..9611229 100644 --- a/components/persistent/persistent_zone_database.gd +++ b/components/persistent/persistent_zone_database.gd @@ -8,7 +8,13 @@ extends Resource ## This property is the array of supported zones @export var zones: Array[PersistentZoneInfo]: - set = _set_zones + # Handle setting the items + set(p_zones): + # Save the new items + zones = p_zones + + # Invalidate the cache + _cache_valid = false # Items cache var _cache := {} @@ -27,15 +33,6 @@ func get_zone(zone_id: String) -> PersistentZoneInfo: return _cache.get(zone_id) -# Handle setting the items -func _set_zones(p_zones: Array[PersistentZoneInfo]) -> void: - # Save the new items - zones = p_zones - - # Invalidate the cache - _cache_valid = false - - # Populate the type cache func _populate_cache() -> void: # Populate the cache diff --git a/game/game_state.gd b/game/game_state.gd index 3a35ac1..91d1a6e 100644 --- a/game/game_state.gd +++ b/game/game_state.gd @@ -19,13 +19,19 @@ enum GameDifficulty { GAME_EASY, GAME_NORMAL, GAME_HARD, GAME_MAX } ## This property sets the difficulty of the game. @export var game_difficulty: GameDifficulty = GameDifficulty.GAME_NORMAL: - set = _set_game_difficulty + # Handle changing the game difficulty + set(p_game_difficulty): + if p_game_difficulty < 0 or p_game_difficulty >= GameDifficulty.GAME_MAX: + push_warning("Difficulty %d is out of bounds" % [p_game_difficulty]) + return + game_difficulty = p_game_difficulty + set_value("game_difficulty", game_difficulty) ## Current zone (when playing game) var current_zone: PersistentZone -func _ready(): +func _ready() -> void: # Use this game state as the global world state instance = self @@ -70,10 +76,10 @@ func auto_save_game() -> bool: return false # Get auto save name - var auto_save_name = get_value("auto_save_name") + var auto_save_name: String = get_value("auto_save_name") if !auto_save_name: # First time saving? Determine this name - var date = Time.get_datetime_dict_from_system() + var date := Time.get_datetime_dict_from_system() auto_save_name = "auto_save_%d-%d-%d" % [date["year"], date["month"], date["day"]] set_value("auto_save_name", auto_save_name) @@ -108,16 +114,18 @@ func load_world_state() -> bool: return false # Get the zone ID - var zone_id = get_value("current_zone_id") - if not zone_id is String: + var _zone_id: Variant = get_value("current_zone_id") + if not _zone_id is String: # Default to the starting zone - zone_id = starting_zone.zone_id + _zone_id = starting_zone.zone_id + var zone_id: String = _zone_id # Get the location - var location = get_value("current_location") - if not location is Transform3D: + var _location: Variant = get_value("current_location") + if not _location is Transform3D: # Default to null (spawn location in level) - location = null + _location = null + var location: Transform3D = _location # Restore the game difficulty game_difficulty = get_value("game_difficulty") @@ -130,13 +138,3 @@ func load_world_state() -> bool: # Start transition to scene PersistentStaging.instance.load_scene(zone.instance_scene, location) return true - - -# Handle changing the game difficulty -func _set_game_difficulty(p_game_difficulty: GameDifficulty) -> void: - if p_game_difficulty < 0 or p_game_difficulty >= GameDifficulty.GAME_MAX: - push_warning("Difficulty %d is out of bounds" % [p_game_difficulty]) - return - - game_difficulty = p_game_difficulty - set_value("game_difficulty", game_difficulty) diff --git a/game/main.gd b/game/main.gd index 29431f6..e045a5b 100644 --- a/game/main.gd +++ b/game/main.gd @@ -9,7 +9,7 @@ extends PersistentStaging # Called when the node enters the scene tree for the first time. -func _ready(): +func _ready() -> void: super() # Do not initialise if in the editor @@ -17,9 +17,9 @@ func _ready(): return # Connect events - scene_loaded.connect(_on_scene_loaded) - xr_started.connect(_on_xr_started) - xr_ended.connect(_on_xr_ended) + var _connection_err := scene_loaded.connect(_on_scene_loaded) + var _connection_err2 := xr_started.connect(_on_xr_started) + var _connection_err3 := xr_ended.connect(_on_xr_ended) # This method is called when a scene is loaded diff --git a/game/start_scene/start_ui.gd b/game/start_scene/start_ui.gd index 67143b0..33b8c6b 100644 --- a/game/start_scene/start_ui.gd +++ b/game/start_scene/start_ui.gd @@ -1,11 +1,16 @@ extends CenterContainer -var save_list: Array -@onready var save_list_node = $LoadGame/SaveList +var save_list: Array[String] +@onready var load_game: VBoxContainer = $LoadGame +@onready var save_list_node: ItemList = $LoadGame/SaveList +@onready var main_menu: VBoxContainer = $MainMenu +@onready var load_game_btn: Button = $MainMenu/LoadGameBtn +@onready var new_game: Button = $NewGame +@onready var options: VBoxContainer = $Options # Called when the node enters the scene tree for the first time. -func _ready(): +func _ready() -> void: _set_pane(1) # Get our list of save games @@ -14,66 +19,66 @@ func _ready(): save_list_node.clear() for entry in save_list: - save_list_node.add_item(entry) + var _did_add := save_list_node.add_item(entry) - $MainMenu/LoadGameBtn.disabled = save_list.size() == 0 + load_game_btn.disabled = save_list.size() == 0 -func _set_pane(p_no): - $MainMenu.visible = p_no == 1 - $NewGame.visible = p_no == 2 - $LoadGame.visible = p_no == 3 - $Options.visible = p_no == 4 +func _set_pane(p_no: int) -> void: + main_menu.visible = p_no == 1 + new_game.visible = p_no == 2 + load_game.visible = p_no == 3 + options.visible = p_no == 4 # Main menu -func _on_new_game_btn_pressed(): +func _on_new_game_btn_pressed() -> void: _set_pane(2) -func _on_load_game_btn_pressed(): +func _on_load_game_btn_pressed() -> void: _set_pane(3) -func _on_options_btn_pressed(): +func _on_options_btn_pressed() -> void: _set_pane(4) -func _on_exit_btn_pressed(): +func _on_exit_btn_pressed() -> void: get_tree().quit() # New game -func _on_easy_btn_pressed(): - GameState.new_game(GameState.GameDifficulty.GAME_EASY) +func _on_easy_btn_pressed() -> void: + var _new_game_started := GameState.new_game(GameState.GameDifficulty.GAME_EASY) -func _on_normal_btn_pressed(): - GameState.new_game(GameState.GameDifficulty.GAME_NORMAL) +func _on_normal_btn_pressed() -> void: + var _new_game_started := GameState.new_game(GameState.GameDifficulty.GAME_NORMAL) -func _on_hard_btn_pressed(): - GameState.new_game(GameState.GameDifficulty.GAME_HARD) +func _on_hard_btn_pressed() -> void: + var _new_game_started := GameState.new_game(GameState.GameDifficulty.GAME_HARD) -func _on_back_btn_pressed(): +func _on_back_btn_pressed() -> void: _set_pane(1) # Load game -func _on_start_button_pressed(): - var selected_items = save_list_node.get_selected_items() +func _on_start_button_pressed() -> void: + var selected_items := save_list_node.get_selected_items() if selected_items.size() == 1: # Should be only one! - var selected_item = selected_items[0] + var selected_item: int = selected_items[0] print("Selected item: ", selected_item) - var save_name = save_list[selected_item] + var save_name: String = save_list[selected_item] print("Loading save: ", save_name) - GameState.load_game(save_name) + var _new_game_started := GameState.load_game(save_name) diff --git a/game/zones/start_island/start_island_zone.tscn b/game/zones/start_island/start_island_zone.tscn index d6939ef..6d01ee3 100644 --- a/game/zones/start_island/start_island_zone.tscn +++ b/game/zones/start_island/start_island_zone.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=123 format=3 uid="uid://dkbkyp60gubuk"] +[gd_scene load_steps=121 format=3 uid="uid://dkbkyp60gubuk"] [ext_resource type="PackedScene" uid="uid://qmejywplaagw" path="res://components/persistent/persistent_pocket.tscn" id="1_gy57t"] [ext_resource type="PackedScene" uid="uid://bkv43ec6chcf3" path="res://addons/godot-xr-tools/hands/scenes/collision/collision_hand_left.tscn" id="2_wawh4"] @@ -90,9 +90,7 @@ [ext_resource type="Animation" uid="uid://d2ukhr3n2r1u8" path="res://addons/godot-xr-tools/hands/animations/right/Thumb.res" id="83_nbjn5"] [ext_resource type="PackedScene" uid="uid://clc5dre31iskm" path="res://addons/godot-xr-tools/xr/start_xr.tscn" id="90_owqie"] [ext_resource type="Shader" path="res://assets/sky/sky.gdshader" id="90_u4dx2"] -[ext_resource type="CompressedTexture3D" uid="uid://1ipprqexqp8s" path="res://assets/images/world_noise.tga" id="91_mp1iy"] -[ext_resource type="Texture2D" uid="uid://dgv0vc1dtamig" path="res://assets/images/weather.bmp" id="92_obfjs"] -[ext_resource type="CompressedTexture3D" uid="uid://b8fh4icku58vx" path="res://assets/images/world_noise.bmp" id="93_qpomf"] +[ext_resource type="Texture2D" uid="uid://cwdmuc0cbm4si" path="res://assets/images/weather.bmp" id="92_obfjs"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_kw48d"] _data = { @@ -133,34 +131,34 @@ _data = { "Thumb": ExtResource("39_sagkm") } -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_fnfue"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_m81f7"] animation = &"Grip" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_qiiqm"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_d0wx6"] animation = &"Grip" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_ouiy1"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_78nhm"] filter_enabled = true filters = ["Armature/Skeleton3D:Little_Distal_L", "Armature/Skeleton3D:Little_Intermediate_L", "Armature/Skeleton3D:Little_Metacarpal_L", "Armature/Skeleton3D:Little_Proximal_L", "Armature/Skeleton3D:Middle_Distal_L", "Armature/Skeleton3D:Middle_Intermediate_L", "Armature/Skeleton3D:Middle_Metacarpal_L", "Armature/Skeleton3D:Middle_Proximal_L", "Armature/Skeleton3D:Ring_Distal_L", "Armature/Skeleton3D:Ring_Intermediate_L", "Armature/Skeleton3D:Ring_Metacarpal_L", "Armature/Skeleton3D:Ring_Proximal_L", "Armature/Skeleton3D:Thumb_Distal_L", "Armature/Skeleton3D:Thumb_Metacarpal_L", "Armature/Skeleton3D:Thumb_Proximal_L", "Armature/Skeleton:Little_Distal_L", "Armature/Skeleton:Little_Intermediate_L", "Armature/Skeleton:Little_Proximal_L", "Armature/Skeleton:Middle_Distal_L", "Armature/Skeleton:Middle_Intermediate_L", "Armature/Skeleton:Middle_Proximal_L", "Armature/Skeleton:Ring_Distal_L", "Armature/Skeleton:Ring_Intermediate_L", "Armature/Skeleton:Ring_Proximal_L", "Armature/Skeleton:Thumb_Distal_L", "Armature/Skeleton:Thumb_Proximal_L"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_633xy"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_14g4m"] animation = &"Grip 5" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_y1lka"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_t0h7q"] filter_enabled = true filters = ["Armature/Skeleton3D:Index_Distal_L", "Armature/Skeleton3D:Index_Intermediate_L", "Armature/Skeleton3D:Index_Metacarpal_L", "Armature/Skeleton3D:Index_Proximal_L", "Armature/Skeleton:Index_Distal_L", "Armature/Skeleton:Index_Intermediate_L", "Armature/Skeleton:Index_Proximal_L"] -[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_fke0y"] +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_g0kev"] graph_offset = Vector2(-536, 11) -nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_fnfue") +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_m81f7") nodes/ClosedHand1/position = Vector2(-600, 300) -nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_qiiqm") +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_d0wx6") nodes/ClosedHand2/position = Vector2(-360, 300) -nodes/Grip/node = SubResource("AnimationNodeBlend2_ouiy1") +nodes/Grip/node = SubResource("AnimationNodeBlend2_78nhm") nodes/Grip/position = Vector2(0, 20) -nodes/OpenHand/node = SubResource("AnimationNodeAnimation_633xy") +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_14g4m") nodes/OpenHand/position = Vector2(-600, 100) -nodes/Trigger/node = SubResource("AnimationNodeBlend2_y1lka") +nodes/Trigger/node = SubResource("AnimationNodeBlend2_t0h7q") nodes/Trigger/position = Vector2(-360, 20) node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] @@ -203,34 +201,34 @@ _data = { "Thumb": ExtResource("83_nbjn5") } -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_3m1ro"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1wgrx"] animation = &"Grip" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ptvwo"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_xdiu1"] animation = &"Grip" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_ut1vt"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_12cem"] filter_enabled = true filters = ["Armature/Skeleton3D:Little_Distal_R", "Armature/Skeleton3D:Little_Intermediate_R", "Armature/Skeleton3D:Little_Metacarpal_R", "Armature/Skeleton3D:Little_Proximal_R", "Armature/Skeleton3D:Middle_Distal_R", "Armature/Skeleton3D:Middle_Intermediate_R", "Armature/Skeleton3D:Middle_Metacarpal_R", "Armature/Skeleton3D:Middle_Proximal_R", "Armature/Skeleton3D:Ring_Distal_R", "Armature/Skeleton3D:Ring_Intermediate_R", "Armature/Skeleton3D:Ring_Metacarpal_R", "Armature/Skeleton3D:Ring_Proximal_R", "Armature/Skeleton3D:Thumb_Distal_R", "Armature/Skeleton3D:Thumb_Metacarpal_R", "Armature/Skeleton3D:Thumb_Proximal_R", "Armature/Skeleton:Little_Distal_R", "Armature/Skeleton:Little_Intermediate_R", "Armature/Skeleton:Little_Proximal_R", "Armature/Skeleton:Middle_Distal_R", "Armature/Skeleton:Middle_Intermediate_R", "Armature/Skeleton:Middle_Proximal_R", "Armature/Skeleton:Ring_Distal_R", "Armature/Skeleton:Ring_Intermediate_R", "Armature/Skeleton:Ring_Proximal_R", "Armature/Skeleton:Thumb_Distal_R", "Armature/Skeleton:Thumb_Proximal_R"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_n7sm8"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ct1bf"] animation = &"Grip 5" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_m0xyq"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_v1lim"] filter_enabled = true filters = ["Armature/Skeleton3D:Index_Distal_R", "Armature/Skeleton3D:Index_Intermediate_R", "Armature/Skeleton3D:Index_Metacarpal_R", "Armature/Skeleton3D:Index_Proximal_R", "Armature/Skeleton:Index_Distal_R", "Armature/Skeleton:Index_Intermediate_R", "Armature/Skeleton:Index_Proximal_R"] -[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_f66lv"] +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_2mx7s"] graph_offset = Vector2(-552.664, 107.301) -nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_3m1ro") +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_1wgrx") nodes/ClosedHand1/position = Vector2(-600, 300) -nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_ptvwo") +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_xdiu1") nodes/ClosedHand2/position = Vector2(-360, 300) -nodes/Grip/node = SubResource("AnimationNodeBlend2_ut1vt") +nodes/Grip/node = SubResource("AnimationNodeBlend2_12cem") nodes/Grip/position = Vector2(0, 40) -nodes/OpenHand/node = SubResource("AnimationNodeAnimation_n7sm8") +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_ct1bf") nodes/OpenHand/position = Vector2(-600, 100) -nodes/Trigger/node = SubResource("AnimationNodeBlend2_m0xyq") +nodes/Trigger/node = SubResource("AnimationNodeBlend2_v1lim") nodes/Trigger/position = Vector2(-360, 40) node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] @@ -322,8 +320,6 @@ shader_parameter/turbidity = 10.0 shader_parameter/sun_disk_scale = 1.0 shader_parameter/ground_color = Color(1, 1, 1, 1) shader_parameter/exposure = 0.1 -shader_parameter/worlnoise = ExtResource("93_qpomf") -shader_parameter/perlworlnoise = ExtResource("91_mp1iy") shader_parameter/weathermap = ExtResource("92_obfjs") [sub_resource type="Sky" id="Sky_y574f"] @@ -360,19 +356,19 @@ pose = &"aim" [node name="LeftHand" parent="XROrigin3D/LeftHand/CollisionHandLeft" instance=ExtResource("3_2dssu")] [node name="Skeleton3D" parent="XROrigin3D/LeftHand/CollisionHandLeft/LeftHand/Hand_Nails_low_L/Armature" index="0"] -bones/1/rotation = Quaternion(0.323537, -2.56577e-05, -0.0272204, 0.945824) +bones/1/rotation = Quaternion(0.323537, -2.56569e-05, -0.0272204, 0.945824) bones/2/rotation = Quaternion(-0.0904441, -0.0415175, -0.166293, 0.981042) bones/3/rotation = Quaternion(-0.0466199, 0.020971, 0.0103276, 0.998639) bones/5/rotation = Quaternion(-0.00128455, -0.0116081, -0.0168259, 0.99979) bones/6/rotation = Quaternion(0.102925, -0.00993208, -0.00794417, 0.994608) bones/7/rotation = Quaternion(-0.012859, -0.0236108, -0.323258, 0.945929) bones/8/rotation = Quaternion(0.0120575, -0.00929194, -0.247472, 0.968775) -bones/10/rotation = Quaternion(-0.0357539, -0.000400032, 0.00636764, 0.99934) +bones/10/rotation = Quaternion(-0.0357539, -0.000400033, 0.00636764, 0.99934) bones/11/rotation = Quaternion(-0.00264964, -0.00114471, -0.125992, 0.992027) -bones/12/rotation = Quaternion(0.0394225, 0.00193393, -0.228074, 0.972843) +bones/12/rotation = Quaternion(0.0394225, 0.00193392, -0.228074, 0.972843) bones/13/rotation = Quaternion(-0.0123395, -0.00881294, -0.280669, 0.959685) bones/15/rotation = Quaternion(-0.0702656, 0.0101908, -0.0243307, 0.99718) -bones/16/rotation = Quaternion(-0.0320634, -0.00223624, -0.0686366, 0.997124) +bones/16/rotation = Quaternion(-0.0320635, -0.00223624, -0.0686366, 0.997124) bones/17/rotation = Quaternion(0.0253452, 0.00812462, -0.249005, 0.968136) bones/18/rotation = Quaternion(0.00252232, 0.00788073, -0.243204, 0.96994) bones/20/rotation = Quaternion(-0.0917369, 0.0203027, -0.010183, 0.995524) @@ -393,7 +389,7 @@ root_node = NodePath("../Hand_Nails_low_L") libraries = { "": SubResource("AnimationLibrary_kw48d") } -tree_root = SubResource("AnimationNodeBlendTree_fke0y") +tree_root = SubResource("AnimationNodeBlendTree_g0kev") [node name="FunctionPointer" parent="XROrigin3D/LeftHand/CollisionHandLeft" instance=ExtResource("5_ja7nv")] show_laser = 2 @@ -434,28 +430,28 @@ pose = &"aim" [node name="RightHand" parent="XROrigin3D/RightHand/CollisionHandRight" instance=ExtResource("13_si85r")] [node name="Skeleton3D" parent="XROrigin3D/RightHand/CollisionHandRight/RightHand/Hand_Nails_low_R/Armature" index="0"] -bones/1/rotation = Quaternion(0.323537, 2.56577e-05, 0.0272204, 0.945824) +bones/1/rotation = Quaternion(0.323537, 2.56569e-05, 0.0272204, 0.945824) bones/2/rotation = Quaternion(-0.0904441, 0.0415175, 0.166293, 0.981042) bones/3/rotation = Quaternion(-0.0466199, -0.020971, -0.0103276, 0.998639) bones/5/rotation = Quaternion(-0.00128455, 0.0116081, 0.0168259, 0.99979) bones/6/rotation = Quaternion(0.102925, 0.00993208, 0.00794419, 0.994608) bones/7/rotation = Quaternion(-0.012859, 0.0236108, 0.323258, 0.945929) -bones/8/rotation = Quaternion(0.0120575, 0.00929193, 0.247472, 0.968775) -bones/10/rotation = Quaternion(-0.0357539, 0.000400032, -0.00636763, 0.99934) +bones/8/rotation = Quaternion(0.0120575, 0.00929192, 0.247472, 0.968775) +bones/10/rotation = Quaternion(-0.0357539, 0.000400033, -0.00636763, 0.99934) bones/11/rotation = Quaternion(-0.00264964, 0.00114471, 0.125992, 0.992027) bones/12/rotation = Quaternion(0.0394225, -0.00193393, 0.228074, 0.972843) bones/13/rotation = Quaternion(-0.0123395, 0.00881294, 0.280669, 0.959685) -bones/15/rotation = Quaternion(-0.0702656, -0.0101908, 0.0243307, 0.99718) -bones/16/rotation = Quaternion(-0.0320634, 0.00223624, 0.0686366, 0.997124) +bones/15/rotation = Quaternion(-0.0702656, -0.0101908, 0.0243307, 0.997179) +bones/16/rotation = Quaternion(-0.0320635, 0.00223624, 0.0686366, 0.997124) bones/17/rotation = Quaternion(0.0253452, -0.00812462, 0.249005, 0.968136) bones/18/rotation = Quaternion(0.00252233, -0.00788073, 0.243204, 0.96994) bones/20/rotation = Quaternion(-0.0917369, -0.0203027, 0.010183, 0.995524) bones/21/rotation = Quaternion(-0.0625182, 0.000225721, 0.115393, 0.991351) bones/22/rotation = Quaternion(0.0585786, -0.0216483, 0.269905, 0.96086) -bones/23/rotation = Quaternion(0.00687177, 0.00357275, 0.211953, 0.977249) +bones/23/rotation = Quaternion(0.00687176, 0.00357274, 0.211953, 0.977249) [node name="BoneAttachment3D" type="BoneAttachment3D" parent="XROrigin3D/RightHand/CollisionHandRight/RightHand/Hand_Nails_low_R/Armature/Skeleton3D" index="1"] -transform = Transform3D(0.540829, -0.840813, 0.0231736, 0.0826268, 0.0805242, 0.993322, -0.837064, -0.535303, 0.113024, -0.039902, 0.0402828, -0.150096) +transform = Transform3D(0.54083, -0.840813, 0.0231736, 0.0826267, 0.0805243, 0.993322, -0.837064, -0.535303, 0.113023, -0.039902, 0.0402828, -0.150096) bone_name = "Index_Tip_R" bone_idx = 9 @@ -467,7 +463,7 @@ root_node = NodePath("../Hand_Nails_low_R") libraries = { "": SubResource("AnimationLibrary_reqae") } -tree_root = SubResource("AnimationNodeBlendTree_f66lv") +tree_root = SubResource("AnimationNodeBlendTree_2mx7s") [node name="FunctionPointer" parent="XROrigin3D/RightHand/CollisionHandRight" instance=ExtResource("5_ja7nv")] show_laser = 2 diff --git a/game/zones/zone_wrist_ui.gd b/game/zones/zone_wrist_ui.gd index 8232042..b543758 100644 --- a/game/zones/zone_wrist_ui.gd +++ b/game/zones/zone_wrist_ui.gd @@ -1,9 +1,9 @@ extends PanelContainer -func _on_save_button_pressed(): - GameState.auto_save_game() +func _on_save_button_pressed() -> void: + var _did_save := GameState.auto_save_game() -func _on_quit_button_pressed(): - GameState.quit_game() +func _on_quit_button_pressed() -> void: + var _did_save := GameState.quit_game() diff --git a/project.godot b/project.godot index 71696c9..a55af2d 100644 --- a/project.godot +++ b/project.godot @@ -20,6 +20,15 @@ config/icon="res://icon.png" XRToolsUserSettings="*res://addons/godot-xr-tools/user_settings/user_settings.gd" GameState="*res://game/game_state.tscn" +[debug] + +gdscript/warnings/untyped_declaration=1 +gdscript/warnings/unsafe_property_access=1 +gdscript/warnings/unsafe_method_access=1 +gdscript/warnings/unsafe_cast=1 +gdscript/warnings/unsafe_call_argument=1 +gdscript/warnings/return_value_discarded=1 + [editor] version_control/plugin_name="GitPlugin"