Deploy and shooting brought back
This commit is contained in:
parent
c1548e5451
commit
b94e4cdf30
10 changed files with 25 additions and 15 deletions
|
|
@ -5,6 +5,7 @@ class_name WeaponSystem
|
|||
@export var animation_player: AnimationPlayer
|
||||
@export var camera: PlayerCamera
|
||||
@export var player: Player
|
||||
@export var player_input: PlayerInput
|
||||
|
||||
var current_state: WeaponSubStateMachine
|
||||
var last_slot: StringName
|
||||
|
|
@ -27,6 +28,9 @@ signal ammo_updated(ammo: int, remaining_ammo: int)
|
|||
|
||||
func _ready() -> void:
|
||||
$WeaponSpawner.spawn_function = pick_up_weapon
|
||||
player_input.drop.connect(drop_current)
|
||||
player_input.fire_begin.connect(use_begin)
|
||||
player_input.fire_end.connect(use_end)
|
||||
|
||||
func get_speed_modifier() -> float:
|
||||
if current_state == null:
|
||||
|
|
@ -89,6 +93,8 @@ func drop_current():
|
|||
drop(current_state)
|
||||
|
||||
func drop(weapon: WeaponSubStateMachine) -> void:
|
||||
if not is_multiplayer_authority():
|
||||
return
|
||||
if slots.find_key(weapon) == "knife":
|
||||
return
|
||||
var drop_data: Dictionary = {}
|
||||
|
|
@ -161,3 +167,9 @@ func _physics_process(delta: float) -> void:
|
|||
if current_state == null or disabled:
|
||||
return
|
||||
current_state.physics_update(delta)
|
||||
|
||||
func use_begin() -> void:
|
||||
current_state.use_begin.rpc()
|
||||
|
||||
func use_end() -> void:
|
||||
current_state.use_end.rpc()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue