diff --git a/scenes/weapons/droppable_sp.tscn b/scenes/weapons/droppable_sp.tscn index a4f1de2..5aacc41 100644 --- a/scenes/weapons/droppable_sp.tscn +++ b/scenes/weapons/droppable_sp.tscn @@ -14,12 +14,6 @@ properties/0/replication_mode = 1 properties/1/path = NodePath(".:rotation") properties/1/spawn = true properties/1/replication_mode = 1 -properties/2/path = NodePath("StartingPistol:ammo") -properties/2/spawn = true -properties/2/replication_mode = 1 -properties/3/path = NodePath("StartingPistol:remaining_ammo") -properties/3/spawn = true -properties/3/replication_mode = 1 [node name="DroppableStartingPistol" type="RigidBody3D" node_paths=PackedStringArray("weapon")] collision_layer = 8 diff --git a/scripts/multiplayer/spawn_system/dyn_objects_spawner.gd b/scripts/multiplayer/spawn_system/dyn_objects_spawner.gd index fb8398f..c7fd947 100644 --- a/scripts/multiplayer/spawn_system/dyn_objects_spawner.gd +++ b/scripts/multiplayer/spawn_system/dyn_objects_spawner.gd @@ -9,7 +9,6 @@ func request_spawn(data: Variant) -> Node: return Node.new() var node = load(data.scene).instantiate() if data.has("impulse"): - print() if data.has_all(["ammo","remaining_ammo","slot"]): node.weapon.ammo = data.ammo node.weapon.remaining_ammo = data.remaining_ammo diff --git a/scripts/weapon_system/weapon_substate_machine.gd b/scripts/weapon_system/weapon_substate_machine.gd index 464b216..87dc84e 100644 --- a/scripts/weapon_system/weapon_substate_machine.gd +++ b/scripts/weapon_system/weapon_substate_machine.gd @@ -7,7 +7,7 @@ class_name WeaponSubStateMachine @export var visibility_target: StringName @export var max_ammo: int -@export var ammo: int: +@export var ammo: int = -1: set(value): if value < 0: ammo = 0 @@ -19,7 +19,7 @@ class_name WeaponSubStateMachine get: return ammo @export var ammo_mags: int = 3 -@export var remaining_ammo: int: +@export var remaining_ammo: int = -1: set(value): if value < 0: remaining_ammo = 0 @@ -42,8 +42,10 @@ var player_camera: PlayerCamera var player: Player func _ready() -> void: - remaining_ammo = max_ammo * ammo_mags - ammo = max_ammo + if remaining_ammo == -1: + remaining_ammo = max_ammo * ammo_mags + if ammo == -1: + ammo = max_ammo for child in get_children(): if child is WeaponState: states[child.name] = child