WIP: Add more spawners and start moving authority to the server
This commit is contained in:
parent
3e6eab08fd
commit
d024f217d0
@ -10,13 +10,13 @@ height = 1.6
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_tl74a"]
|
||||
properties/0/path = NodePath(".:position")
|
||||
properties/0/spawn = false
|
||||
properties/0/spawn = true
|
||||
properties/0/replication_mode = 1
|
||||
properties/1/path = NodePath(".:rotation")
|
||||
properties/1/spawn = false
|
||||
properties/1/spawn = true
|
||||
properties/1/replication_mode = 1
|
||||
properties/2/path = NodePath(".:health")
|
||||
properties/2/spawn = false
|
||||
properties/2/spawn = true
|
||||
properties/2/replication_mode = 2
|
||||
|
||||
[sub_resource type="Animation" id="Animation_falg4"]
|
||||
|
@ -19,15 +19,12 @@ func _get_root() -> Node3D:
|
||||
# -- Spawn a player node and sync it across all peers
|
||||
func spawn_players(spawn_location: SpawnController, id: int) -> Error:
|
||||
if multiplayer.is_server():
|
||||
var char : Node3D = null
|
||||
var char : CharacterBody3D = null
|
||||
var player_data: PlayerState = GameServerManager.players[id]
|
||||
char = ResourceLoader.load("res://scenes/characters/placeholder.tscn").instantiate()
|
||||
char.name = "PlayerPlaceholder_" + str(player_data.id)
|
||||
print(player_data)
|
||||
var position = spawn_location.get_spawner(SpawnController.Sides.BLUE)
|
||||
var position: Vector3 = spawn_location.get_spawner(SpawnController.Sides.BLUE)
|
||||
char.global_position = position
|
||||
char.global_position = position
|
||||
#_get_spawner().spawn(char)
|
||||
_get_root().add_child(char)
|
||||
return OK
|
||||
return ERR_UNAUTHORIZED
|
||||
|
@ -41,6 +41,7 @@ func _get_available_spawn(spawn_set: Node3D) -> Node3D:
|
||||
func get_spawner(team: Sides) -> Vector3:
|
||||
match team:
|
||||
Sides.BLUE:
|
||||
print("Getting a blue spawner")
|
||||
var spawn := _get_available_spawn(blue_spawners)
|
||||
return spawn.choose_spawn_location()
|
||||
Sides.RED:
|
||||
|
@ -961,13 +961,37 @@ script = ExtResource("2_1ss1b")
|
||||
|
||||
[node name="Blue" type="Node3D" parent="SpawnLocations"]
|
||||
|
||||
[node name="Spawn4" type="Node3D" parent="SpawnLocations/Blue"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 53.1487, -0.0093751, -8.68195)
|
||||
|
||||
[node name="Spawn1" type="Node3D" parent="SpawnLocations/Blue"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.234959, 25.2818, 2.12756)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 52.9098, -0.00937462, 10.3532)
|
||||
|
||||
[node name="Spawn2" type="Node3D" parent="SpawnLocations/Blue"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 29.4253, 15.2112, 4.25512)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 52.8486, -0.00937653, 4.25512)
|
||||
|
||||
[node name="Spawn3" type="Node3D" parent="SpawnLocations/Blue"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 53.6493, -0.00937504, -4.34097)
|
||||
|
||||
[node name="Spawn5" type="Node3D" parent="SpawnLocations/Blue"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 51.5453, -0.0187502, -17.3639)
|
||||
|
||||
[node name="Red" type="Node3D" parent="SpawnLocations"]
|
||||
|
||||
[node name="Spawn4" type="Node3D" parent="SpawnLocations/Red"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -40.9916, -0.0093751, -8.68195)
|
||||
|
||||
[node name="Spawn1" type="Node3D" parent="SpawnLocations/Red"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -41.2305, -0.00937462, 10.3532)
|
||||
|
||||
[node name="Spawn2" type="Node3D" parent="SpawnLocations/Red"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -41.2917, -0.00937653, 4.25512)
|
||||
|
||||
[node name="Spawn3" type="Node3D" parent="SpawnLocations/Red"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -40.491, -0.00937504, -4.34097)
|
||||
|
||||
[node name="Spawn5" type="Node3D" parent="SpawnLocations/Red"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -42.595, -0.0187502, -17.3639)
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_3ha0j")
|
||||
|
@ -29,7 +29,7 @@ var multiplayer_id: int = 0
|
||||
var alive: bool = true
|
||||
|
||||
func _ready() -> void:
|
||||
player_synchronizer.set_multiplayer_authority(owner_id)
|
||||
player_synchronizer.set_multiplayer_authority(1)
|
||||
multiplayer_id = multiplayer.get_unique_id()
|
||||
# -- Separate logic for player and other models that are controlled
|
||||
# -- by other players on the server
|
||||
|
Loading…
x
Reference in New Issue
Block a user