WIP: Damage/frag system is implemented without ragdolls
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
extends Node3D
|
||||
class_name PlayerPlaceholder
|
||||
|
||||
@export var health: int = 100
|
||||
@onready var character_node: CharacterWrapper = $ServerControlledNode/Character
|
||||
@export var owner_id: int = 0
|
||||
@export var initial_position: Vector3 = Vector3(0, 0, 0)
|
||||
# -- Components
|
||||
@ -22,7 +24,7 @@ func _ready() -> void:
|
||||
$PlayerControlledNode/CameraMount.set_multiplayer_authority(owner_id)
|
||||
switch_players_camera.rpc_id(owner_id)
|
||||
server_node.global_position = initial_position
|
||||
|
||||
character_node.set_owner_placeholder($".")
|
||||
client_node.global_position = server_node.global_position
|
||||
client_node.rotation.y = server_node.rotation.y
|
||||
client_node.rotation.x = server_node.rotation.x
|
||||
@ -48,7 +50,13 @@ func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
pass
|
||||
if character_node != null:
|
||||
if health < 1:
|
||||
character_node.die()
|
||||
character_node = null
|
||||
|
||||
func take_damage(damage: int):
|
||||
health -= damage
|
||||
|
||||
@rpc("authority", "call_local", "reliable")
|
||||
func switch_players_camera():
|
||||
|
@ -3,7 +3,7 @@
|
||||
[ext_resource type="Script" path="res://scenes/player/player_input_controller.gd" id="1_m6tul"]
|
||||
[ext_resource type="Script" path="res://scenes/player/placeholder.gd" id="1_ts455"]
|
||||
[ext_resource type="Texture2D" uid="uid://oopj5mj1vdp0" path="res://assets/crosshairs/crosshair_default.png" id="3_8ulsx"]
|
||||
[ext_resource type="PackedScene" uid="uid://1txob6jskn5s" path="res://scenes/characters/blue/dummy.tscn" id="5_16l76"]
|
||||
[ext_resource type="PackedScene" uid="uid://ddwrs0so7swxn" path="res://scenes/characters/y-bot/character.tscn" id="4_ewxcr"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_taqso"]
|
||||
radius = 0.4
|
||||
@ -106,6 +106,9 @@ properties/6/replication_mode = 1
|
||||
properties/7/path = NodePath("ServerControlledNode/BulletStartingPoint:rotation")
|
||||
properties/7/spawn = true
|
||||
properties/7/replication_mode = 1
|
||||
properties/8/path = NodePath(".:health")
|
||||
properties/8/spawn = true
|
||||
properties/8/replication_mode = 1
|
||||
|
||||
[node name="Placeholder" type="Node3D"]
|
||||
script = ExtResource("1_ts455")
|
||||
@ -220,10 +223,9 @@ shape = SubResource("CapsuleShape3D_taqso")
|
||||
[node name="BulletStartingPoint" type="Node3D" parent="ServerControlledNode"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1.287, -0.37786)
|
||||
|
||||
[node name="Dummy" parent="ServerControlledNode" instance=ExtResource("5_16l76")]
|
||||
visible = false
|
||||
|
||||
[node name="CameraMount" type="Node3D" parent="ServerControlledNode"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.15245, -0.0611187)
|
||||
|
||||
[node name="Character" parent="ServerControlledNode" instance=ExtResource("4_ewxcr")]
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
|
Reference in New Issue
Block a user