Fixed spawning issue
This commit is contained in:
parent
edd1894bcd
commit
bcb42f8d16
3 changed files with 6 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue