respawn on falling in the void
This commit is contained in:
parent
99d95402c1
commit
ea5ddbd4aa
@ -77,7 +77,7 @@ func _deactivate_chat() -> void:
|
|||||||
|
|
||||||
func _add_player(id: int) -> void:
|
func _add_player(id: int) -> void:
|
||||||
print("add player %d" % id)
|
print("add player %d" % id)
|
||||||
var character: CharacterBody3D = _player_scene.instantiate()
|
var character: Player = _player_scene.instantiate()
|
||||||
character.id = id
|
character.id = id
|
||||||
character.name = str(id)
|
character.name = str(id)
|
||||||
_players.add_child(character, true)
|
_players.add_child(character, true)
|
||||||
|
@ -217,9 +217,6 @@ environment = SubResource("Environment_ijk14")
|
|||||||
transform = Transform3D(0.943957, 0.3178, 0.0891561, 0, -0.270113, 0.962829, 0.33007, -0.908868, -0.254975, 0, 0, 0)
|
transform = Transform3D(0.943957, 0.3178, 0.0891561, 0, -0.270113, 0.962829, 0.33007, -0.908868, -0.254975, 0, 0, 0)
|
||||||
light_energy = 2.0
|
light_energy = 2.0
|
||||||
|
|
||||||
[node name="SpawnPoint" type="Marker3D" parent="." groups=["spawn_points"]]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
|
||||||
|
|
||||||
[node name="PlayerSpawner" type="MultiplayerSpawner" parent="."]
|
[node name="PlayerSpawner" type="MultiplayerSpawner" parent="."]
|
||||||
_spawnable_scenes = PackedStringArray("res://src/ingame/player.tscn")
|
_spawnable_scenes = PackedStringArray("res://src/ingame/player.tscn")
|
||||||
spawn_path = NodePath("../Players")
|
spawn_path = NodePath("../Players")
|
||||||
@ -288,6 +285,17 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.59598, 1.39617, -1.62022)
|
|||||||
[node name="Pipe" parent="." instance=ExtResource("4_mltw3")]
|
[node name="Pipe" parent="." instance=ExtResource("4_mltw3")]
|
||||||
transform = Transform3D(0.999929, -0.0119378, 0, -0.0119378, -0.999929, 8.74228e-08, -1.04363e-09, -8.74165e-08, -1, -7, 6.79123, 7)
|
transform = Transform3D(0.999929, -0.0119378, 0, -0.0119378, -0.999929, 8.74228e-08, -1.04363e-09, -8.74165e-08, -1, -7, 6.79123, 7)
|
||||||
|
|
||||||
|
[node name="SpawnPoints" type="Node3D" parent="."]
|
||||||
|
|
||||||
|
[node name="SpawnPoint" type="Marker3D" parent="SpawnPoints" groups=["spawn_points"]]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||||
|
|
||||||
|
[node name="SpawnPoint2" type="Marker3D" parent="SpawnPoints" groups=["spawn_points"]]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.15702, 1.04855, 5.88574)
|
||||||
|
|
||||||
|
[node name="SpawnPoint3" type="Marker3D" parent="SpawnPoints" groups=["spawn_points"]]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.43229, 0.627689, 7.20138)
|
||||||
|
|
||||||
[connection signal="text_submitted" from="UI/ChatPanel/ChatInput" to="." method="_on_chat_message_submitted"]
|
[connection signal="text_submitted" from="UI/ChatPanel/ChatInput" to="." method="_on_chat_message_submitted"]
|
||||||
[connection signal="pressed" from="UI/ChatPanel/ChatSendButton" to="." method="_on_chat_message_submitted"]
|
[connection signal="pressed" from="UI/ChatPanel/ChatSendButton" to="." method="_on_chat_message_submitted"]
|
||||||
[connection signal="timeout" from="UI/ComboTimer" to="UI" method="_on_combo_timer_timeout"]
|
[connection signal="timeout" from="UI/ComboTimer" to="UI" method="_on_combo_timer_timeout"]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
extends CharacterBody3D
|
class_name Player extends CharacterBody3D
|
||||||
|
|
||||||
|
|
||||||
const SPEED = 5.0
|
const SPEED = 5.0
|
||||||
const JUMP_VELOCITY = 4.5
|
const JUMP_VELOCITY = 4.5
|
||||||
@ -26,6 +25,7 @@ var _interaction_selection: Node3D
|
|||||||
|
|
||||||
var controls_disabled := false
|
var controls_disabled := false
|
||||||
var held_thing: String
|
var held_thing: String
|
||||||
|
|
||||||
|
|
||||||
# What the others see.
|
# What the others see.
|
||||||
func _init_bystander() -> void:
|
func _init_bystander() -> void:
|
||||||
@ -41,6 +41,7 @@ func _ready() -> void:
|
|||||||
$Model.hide()
|
$Model.hide()
|
||||||
_camera.make_current()
|
_camera.make_current()
|
||||||
|
|
||||||
|
# TODO: reliable rng
|
||||||
var spawn_point: Marker3D = get_tree().get_nodes_in_group("spawn_points").pick_random()
|
var spawn_point: Marker3D = get_tree().get_nodes_in_group("spawn_points").pick_random()
|
||||||
global_position = spawn_point.global_position
|
global_position = spawn_point.global_position
|
||||||
reset_physics_interpolation()
|
reset_physics_interpolation()
|
||||||
@ -84,7 +85,14 @@ func _physics_process(delta: float) -> void:
|
|||||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||||
velocity.z = move_toward(velocity.z, 0, SPEED)
|
velocity.z = move_toward(velocity.z, 0, SPEED)
|
||||||
|
|
||||||
move_and_slide()
|
if move_and_slide() and is_on_floor():
|
||||||
|
for idx in range(get_slide_collision_count()):
|
||||||
|
var collision := get_slide_collision(idx)
|
||||||
|
if collision.get_collider().is_in_group("voids"):
|
||||||
|
# TODO: reliable rng
|
||||||
|
var spawn_point: Marker3D = get_tree().get_nodes_in_group("spawn_points").pick_random()
|
||||||
|
global_position = spawn_point.global_position
|
||||||
|
reset_physics_interpolation()
|
||||||
|
|
||||||
|
|
||||||
@rpc("any_peer", "call_local", "reliable")
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
|
Loading…
Reference in New Issue
Block a user