Defuse win
This commit is contained in:
parent
215598c63b
commit
8535dba9cd
10 changed files with 151 additions and 21 deletions
|
|
@ -5,6 +5,8 @@ class_name Player
|
|||
@export var team: Session.TEAMS
|
||||
@export var weapon_models: Dictionary[StringName,Node3D]
|
||||
|
||||
var passived: bool = false
|
||||
|
||||
signal spawned
|
||||
signal health_changed(to: int)
|
||||
signal died
|
||||
|
|
@ -38,6 +40,15 @@ func die() -> void:
|
|||
return
|
||||
Session.add_dead.rpc(team)
|
||||
died.emit()
|
||||
passived = true
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
func passive() -> void:
|
||||
passived = true
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
func depassive() -> void:
|
||||
passived = false
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
func kill_request() -> void:
|
||||
|
|
@ -55,3 +66,11 @@ func set_after_spawn(start_position: Vector3,new_team: int):
|
|||
@rpc("any_peer","call_local","reliable")
|
||||
func take_damage(damage: int):
|
||||
hp -= damage
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not is_multiplayer_authority():
|
||||
return
|
||||
if event.is_action_pressed("plr_interact"):
|
||||
Session.interact()
|
||||
if event.is_action_released("plr_interact"):
|
||||
Session.stop_interact()
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@ extends Node
|
|||
class_name PlayerMovement
|
||||
|
||||
@export var player: Player
|
||||
var disabled: bool
|
||||
|
||||
func process_movement(max_speed: float,acceleration: float,deceleration: float,delta: float) -> void:
|
||||
if is_multiplayer_authority() == false:
|
||||
return
|
||||
if Session.round_state == Session.ROUND_STATES.BUY:
|
||||
if Session.round_state == Session.ROUND_STATES.BUY or disabled or player.passived:
|
||||
player.velocity.x = 0
|
||||
player.velocity.z = 0
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue