Defuse win
This commit is contained in:
parent
215598c63b
commit
8535dba9cd
10 changed files with 151 additions and 21 deletions
30
scripts/interaction_system/interactible.gd
Normal file
30
scripts/interaction_system/interactible.gd
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
extends CharacterBody3D
|
||||
|
||||
class_name Interactible
|
||||
|
||||
signal interacted(with: int)
|
||||
signal stopped_interacting(with: int)
|
||||
|
||||
var interacted_id: int = -1
|
||||
|
||||
func _ready() -> void:
|
||||
if not multiplayer.is_server():
|
||||
return
|
||||
Session.player_stopped_interacting.connect(player_stopped_interacting)
|
||||
|
||||
func interaction_start(player_id: int):
|
||||
if not multiplayer.is_server():
|
||||
return
|
||||
interacted.emit(player_id)
|
||||
|
||||
interacted_id = player_id
|
||||
|
||||
func player_stopped_interacting(id: int):
|
||||
if interacted_id == id:
|
||||
interaction_end()
|
||||
|
||||
func interaction_end():
|
||||
if not multiplayer.is_server():
|
||||
return
|
||||
stopped_interacting.emit(interacted_id)
|
||||
interacted_id = -1
|
||||
1
scripts/interaction_system/interactible.gd.uid
Normal file
1
scripts/interaction_system/interactible.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://d1c4u4aul8oc1
|
||||
Loading…
Add table
Add a link
Reference in a new issue