Defuse win
This commit is contained in:
parent
215598c63b
commit
8535dba9cd
10 changed files with 151 additions and 21 deletions
|
|
@ -1,8 +1,10 @@
|
|||
extends Node3D
|
||||
extends Interactible
|
||||
|
||||
var plant: StringName
|
||||
@onready var defuse_timer: Timer = $DefuseTimer
|
||||
|
||||
func _ready() -> void:
|
||||
super()
|
||||
if multiplayer.is_server():
|
||||
Session.bomb_timer.timeout.connect(on_timeout)
|
||||
Session.begin_bomb_stage()
|
||||
|
|
@ -12,3 +14,19 @@ func on_timeout():
|
|||
return
|
||||
|
||||
Session.kill_site(plant)
|
||||
|
||||
func on_defuse_timeout():
|
||||
Session.defuse_win()
|
||||
|
||||
func interaction_start(player_id: int):
|
||||
if Session.player_nodes[player_id].team != Session.TEAMS.DEFENCE:
|
||||
return
|
||||
super(player_id)
|
||||
defuse_timer.start()
|
||||
Session.player_nodes[player_id].passive.rpc_id(player_id)
|
||||
|
||||
func interaction_end():
|
||||
Session.player_nodes[interacted_id].depassive.rpc_id(interacted_id)
|
||||
|
||||
super()
|
||||
defuse_timer.stop()
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ func _physics_process(delta: float) -> void:
|
|||
current_state.physics_update(delta)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if is_multiplayer_authority() == false or disabled or Session.round_state == Session.ROUND_STATES.BUY: return
|
||||
if is_multiplayer_authority() == false or disabled: return
|
||||
|
||||
if current_state != null:
|
||||
current_state.state_input(event)
|
||||
|
|
@ -196,14 +196,15 @@ func _input(event: InputEvent) -> void:
|
|||
elif event.is_action_pressed("plr_knife"):
|
||||
switch("knife")
|
||||
|
||||
if event.is_action_pressed("plr_fire"):
|
||||
current_state.use_begin.rpc()
|
||||
if event.is_action_released("plr_fire"):
|
||||
current_state.use_end.rpc()
|
||||
if event.is_action_pressed("plr_scope"):
|
||||
current_state.alternate_state()
|
||||
if event.is_action_pressed("plr_firemode"):
|
||||
current_state.switch_mode()
|
||||
if not Session.round_state == Session.ROUND_STATES.BUY and not player.passived:
|
||||
if event.is_action_pressed("plr_fire"):
|
||||
current_state.use_begin.rpc()
|
||||
if event.is_action_released("plr_fire"):
|
||||
current_state.use_end.rpc()
|
||||
if event.is_action_pressed("plr_scope"):
|
||||
current_state.alternate_state()
|
||||
if event.is_action_pressed("plr_firemode"):
|
||||
current_state.switch_mode()
|
||||
|
||||
if event.is_action_pressed("plr_drop"):
|
||||
drop_current()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue