Fixed spawning issue
This commit is contained in:
parent
edd1894bcd
commit
bcb42f8d16
3 changed files with 6 additions and 11 deletions
|
|
@ -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