Interaction brought back
This commit is contained in:
parent
2c7903e95d
commit
66e8707940
6 changed files with 23 additions and 11 deletions
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=83 format=4 uid="uid://dpsr6ug3pkb40"]
|
||||
[gd_scene load_steps=84 format=4 uid="uid://dpsr6ug3pkb40"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://3dphlay25fih" path="res://scripts/player/player.gd" id="1_g2els"]
|
||||
[ext_resource type="Script" uid="uid://dalwlndejfdhm" path="res://scripts/player/crosshair.gd" id="3_dqkch"]
|
||||
|
|
@ -36,6 +36,7 @@
|
|||
[ext_resource type="Script" uid="uid://b2djbdh05pbcn" path="res://scripts/player/team_color_switcher.gd" id="25_1mtds"]
|
||||
[ext_resource type="Material" uid="uid://cjb0h3of85nc2" path="res://materials/players/molikman/mat_Molikman.tres" id="26_r2jxp"]
|
||||
[ext_resource type="Texture2D" uid="uid://15mf4452fse0" path="res://textures/players/molikman/molikman_ingame_Molikman_blue.png" id="27_j3w78"]
|
||||
[ext_resource type="Script" uid="uid://dsp1sq46c5i3y" path="res://scripts/player/player_interaction.gd" id="37_5amik"]
|
||||
[ext_resource type="Script" path="res://scripts/multiplayer/player_input.gd" id="37_b2eak"]
|
||||
|
||||
[sub_resource type="ArrayMesh" id="ArrayMesh_lot4n"]
|
||||
|
|
@ -8867,6 +8868,9 @@ material = ExtResource("26_r2jxp")
|
|||
player = NodePath("..")
|
||||
blue_team_texture = ExtResource("27_j3w78")
|
||||
|
||||
[node name="Interaction" type="Node" parent="."]
|
||||
script = ExtResource("37_5amik")
|
||||
|
||||
[node name="PlayerInput" type="MultiplayerSynchronizer" parent="."]
|
||||
replication_config = SubResource("SceneReplicationConfig_5amik")
|
||||
script = ExtResource("37_b2eak")
|
||||
|
|
@ -8878,3 +8882,5 @@ script = ExtResource("37_b2eak")
|
|||
[connection signal="died" from="." to="WeaponSystem" method="disable"]
|
||||
[connection signal="health_changed" from="." to="HUD/Healthbar" method="on_hp_changed"]
|
||||
[connection signal="ammo_updated" from="WeaponSystem" to="HUD/AmmoDisplay" method="on_ammo_updated"]
|
||||
[connection signal="interact_begin" from="PlayerInput" to="Interaction" method="on_player_start_interacting"]
|
||||
[connection signal="interact_end" from="PlayerInput" to="Interaction" method="on_player_end_interacting"]
|
||||
|
|
|
|||
|
|
@ -244,11 +244,9 @@ func shoot(id:int , damage: int, distance: float) -> void:
|
|||
collision["collider"].take_damage(damage)
|
||||
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
func interact() -> void:
|
||||
func interact(id: int) -> void:
|
||||
if multiplayer.is_server() == false:
|
||||
return
|
||||
var id = multiplayer.get_remote_sender_id()
|
||||
|
||||
var player: Player = player_nodes[id]
|
||||
var player_camera: Camera3D = player.get_node("Camera3D")
|
||||
|
|
@ -264,11 +262,9 @@ func interact() -> void:
|
|||
if collision != {} and collision["collider"] is Interactible:
|
||||
collision["collider"].interaction_start(id)
|
||||
|
||||
@rpc("any_peer","call_local","reliable")
|
||||
func stop_interact() -> void:
|
||||
func stop_interact(id: int) -> void:
|
||||
if multiplayer.is_server() == false:
|
||||
return
|
||||
var id = multiplayer.get_remote_sender_id()
|
||||
player_stopped_interacting.emit(id)
|
||||
|
||||
func is_on_site(id: int) -> bool:
|
||||
|
|
|
|||
8
scripts/player/player_interaction.gd
Normal file
8
scripts/player/player_interaction.gd
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
extends Node
|
||||
|
||||
|
||||
func on_player_start_interacting():
|
||||
Session.interact(get_parent().player_id)
|
||||
|
||||
func on_player_end_interacting():
|
||||
Session.stop_interact(get_parent().player_id)
|
||||
1
scripts/player/player_interaction.gd.uid
Normal file
1
scripts/player/player_interaction.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dsp1sq46c5i3y
|
||||
|
|
@ -40,10 +40,10 @@ func interaction_start(player_id: int):
|
|||
super(player_id)
|
||||
defuse_timer.start()
|
||||
$DefuseAudio.multiplayer_play()
|
||||
Session.player_nodes[player_id].passive.rpc_id(player_id)
|
||||
Session.player_nodes[player_id].passive()
|
||||
|
||||
func interaction_end():
|
||||
Session.player_nodes[interacted_id].depassive.rpc_id(interacted_id)
|
||||
Session.player_nodes[interacted_id].depassive()
|
||||
|
||||
super()
|
||||
defuse_timer.stop()
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ const active_bomb: StringName = "uid://dtbpyfdawb02b"
|
|||
func enter():
|
||||
machine.animation_player.play(machine.animation_prefix+"plant")
|
||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||
if is_multiplayer_authority():
|
||||
machine.speed_modifier = 0.0
|
||||
machine.player.get_node("PlantAudio").multiplayer_play()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue