Global refactor
This commit is contained in:
parent
3868af29e3
commit
0589ca4e23
180 changed files with 249 additions and 401 deletions
30
systems/interaction_system/interactible.gd
Normal file
30
systems/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
systems/interaction_system/interactible.gd.uid
Normal file
1
systems/interaction_system/interactible.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://d1c4u4aul8oc1
|
||||
Loading…
Add table
Add a link
Reference in a new issue