Add networking to weapon switching.
parent
c4c1e243f9
commit
aea76b12d0
|
@ -332,6 +332,12 @@ func shoot():
|
||||||
func reload():
|
func reload():
|
||||||
active_weapon.reload()
|
active_weapon.reload()
|
||||||
|
|
||||||
|
sync func switch_to_next_weapon():
|
||||||
|
active_weapon = weapons.next_weapon()
|
||||||
|
|
||||||
|
sync func switch_to_prev_weapon():
|
||||||
|
active_weapon = weapons.prev_weapon()
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if is_dead:
|
if is_dead:
|
||||||
return
|
return
|
||||||
|
@ -364,9 +370,9 @@ func _input(event):
|
||||||
reload()
|
reload()
|
||||||
|
|
||||||
if event.is_action_pressed("NextWeapon"):
|
if event.is_action_pressed("NextWeapon"):
|
||||||
active_weapon = weapons.next_weapon()
|
rpc("switch_to_next_weapon")
|
||||||
if event.is_action_pressed("PrevWeapon"):
|
if event.is_action_pressed("PrevWeapon"):
|
||||||
active_weapon = weapons.prev_weapon()
|
rpc("switch_to_prev_weapon")
|
||||||
|
|
||||||
|
|
||||||
func set_local_player():
|
func set_local_player():
|
||||||
|
|
Reference in New Issue