Compare commits

...

2 Commits

Author SHA1 Message Date
EvanGee 21e16b16a5 tower! 2024-05-31 16:50:22 -06:00
Spencer Killen 4ff3ed3e7c
fix server 2024-05-31 16:47:56 -06:00
6 changed files with 47 additions and 9 deletions

View File

@ -71,7 +71,6 @@ func server_add_player(id: int):
%PlayerSpawner.spawn(id) %PlayerSpawner.spawn(id)
static func find_level(node: Node) -> Level: static func find_level(node: Node) -> Level:
var parent := node
while not (node is Level): while not (node is Level):
node = node.get_parent() node = node.get_parent()
return node return node

View File

@ -38,7 +38,6 @@ _subresources={
}, },
"nodes": { "nodes": {
"PATH:Cube": { "PATH:Cube": {
"generate/physics": true,
"physics/shape_type": 2 "physics/shape_type": 2
} }
} }

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://b00brfkibo5cj"] [gd_scene load_steps=12 format=3 uid="uid://b00brfkibo5cj"]
[ext_resource type="PackedScene" uid="uid://bq654gwim6col" path="res://level/level.glb" id="1_s37in"] [ext_resource type="PackedScene" uid="uid://bq654gwim6col" path="res://level/level.glb" id="1_s37in"]
[ext_resource type="Environment" uid="uid://covjrwmk4rplw" path="res://level/world_environment.tres" id="2_ptkl6"] [ext_resource type="Environment" uid="uid://covjrwmk4rplw" path="res://level/world_environment.tres" id="2_ptkl6"]
@ -14,6 +14,11 @@ margin = 2.067
[sub_resource type="BoxShape3D" id="BoxShape3D_qp06x"] [sub_resource type="BoxShape3D" id="BoxShape3D_qp06x"]
size = Vector3(2, 0.1, 2) size = Vector3(2, 0.1, 2)
[sub_resource type="QuadMesh" id="QuadMesh_8lqeb"]
size = Vector2(100, 100)
[sub_resource type="BoxShape3D" id="BoxShape3D_m3lo5"]
[node name="level" instance=ExtResource("1_s37in")] [node name="level" instance=ExtResource("1_s37in")]
script = ExtResource("2_s1bx6") script = ExtResource("2_s1bx6")
@ -23,6 +28,10 @@ environment = ExtResource("2_ptkl6")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="WorldEnvironment" index="0"] [node name="DirectionalLight3D" type="DirectionalLight3D" parent="WorldEnvironment" index="0"]
transform = Transform3D(1, 0, 0, 0, 0.566018, 0.824393, 0, -0.824393, 0.566018, 0, 13.4573, 0) transform = Transform3D(1, 0, 0, 0, 0.566018, 0.824393, 0, -0.824393, 0.566018, 0, 13.4573, 0)
[node name="Plane" parent="." index="1"]
transform = Transform3D(25.5862, 0, 0, 0, 25.5862, 0, 0, 0, 25.5862, 0.00464344, 0, 0.0305362)
visible = false
[node name="StaticBody3D" type="StaticBody3D" parent="Plane" index="0" groups=["ground"]] [node name="StaticBody3D" type="StaticBody3D" parent="Plane" index="0" groups=["ground"]]
script = ExtResource("4_6rwm2") script = ExtResource("4_6rwm2")
@ -34,9 +43,12 @@ shape = SubResource("WorldBoundaryShape3D_ujmev")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0)
shape = SubResource("BoxShape3D_qp06x") shape = SubResource("BoxShape3D_qp06x")
[node name="Cube" parent="." index="2"]
visible = false
[node name="Players" type="Node3D" parent="." index="3"] [node name="Players" type="Node3D" parent="." index="3"]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 12, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.4823, 12, 16.4239)
[node name="PlayerSpawner" type="MultiplayerSpawner" parent="." index="4"] [node name="PlayerSpawner" type="MultiplayerSpawner" parent="." index="4"]
unique_name_in_owner = true unique_name_in_owner = true
@ -48,9 +60,31 @@ script = ExtResource("6_7ww0m")
script = ExtResource("5_2tyle") script = ExtResource("5_2tyle")
[node name="GridMap" type="GridMap" parent="." index="6"] [node name="GridMap" type="GridMap" parent="." index="6"]
visible = false
mesh_library = ExtResource("6_d34iv") mesh_library = ExtResource("6_d34iv")
cell_size = Vector3(0.928, 1.005, 0.928) cell_size = Vector3(0.928, 1.005, 0.928)
data = { data = {
"cells": PackedInt32Array(2, 3, 655363, 3, 2, 655364, 3, 3, 655364, 4, 3, 655364, 5, 3, 655364, 65540, 5, 655364, 65539, 4, 655364, 65539, 3, 655364, 131075, 3, 655364, 65541, 3, 655366, 65543, 1, 1441813, 65545, 1, 1441813, 65543, 0, 1441813, 65545, 0, 1441813, 6, 3, 1441839, 65542, 3, 1441839, 131078, 3, 1441839, 196614, 3, 1441839, 262150, 3, 1441839, 327686, 3, 1441839, 393222, 3, 1441839, 524294, 3, 1441839, 458758, 3, 1441839, 589830, 3, 1441839, 655366, 3, 1441839, 720902, 3, 1441839, 786438, 3, 1441846, 7, 3, 1441839, 8, 3, 1441839, 9, 3, 1441839, 65543, 3, 1441839, 65544, 3, 1441839, 65545, 3, 1441839, 196617, 3, 1441837, 196616, 3, 1441837, 196615, 3, 1441837, 10, 3, 1048642, 11, 3, 1048642, 12, 3, 1048642, 13, 3, 1048642, 14, 3, 1048642, 15, 3, 1048642, 16, 3, 1048642, 17, 3, 1048642, 18, 3, 1048642, 19, 3, 1048642, 20, 3, 1048642, 21, 3, 1048642, 22, 3, 1048642, 23, 3, 1048642, 24, 3, 1441856, 24, 1, 64, 25, 3, 63, 25, 2, 655433, 25, 1, 655433, 25, 0, 655433, 25, 65535, 655433, 25, 65533, 655433, 25, 65532, 655437, 26, 65534, 655436, 25, 65531, 655425) "cells": PackedInt32Array(2, 3, 655363, 3, 2, 655364, 3, 3, 655364, 4, 3, 655364, 5, 3, 655364, 65540, 5, 655364, 65539, 4, 655364, 65539, 3, 655364, 131075, 3, 655364, 65541, 3, 655366, 65543, 1, 1441813, 65545, 1, 1441813, 65543, 0, 1441813, 65545, 0, 1441813, 6, 3, 1441839, 65542, 3, 1441839, 131078, 3, 1441839, 196614, 3, 1441839, 262150, 3, 1441839, 327686, 3, 1441839, 393222, 3, 1441839, 524294, 3, 1441839, 458758, 3, 1441839, 589830, 3, 1441839, 655366, 3, 1441839, 720902, 3, 1441839, 786438, 3, 1441846, 7, 3, 1441839, 8, 3, 1441839, 9, 3, 1441839, 65543, 3, 1441839, 65544, 3, 1441839, 65545, 3, 1441839, 196617, 3, 1441837, 196616, 3, 1441837, 196615, 3, 1441837, 10, 3, 1048642, 11, 3, 1048642, 12, 3, 1048642, 13, 3, 1048642, 14, 3, 1048642, 15, 3, 1048642, 16, 3, 1048642, 17, 3, 1048642, 18, 3, 1048642, 19, 3, 1048642, 20, 3, 1048642, 21, 3, 1048642, 22, 3, 1048642, 23, 3, 1048642, 24, 3, 1441856, 24, 1, 64, 25, 3, 63, 25, 2, 655433, 25, 1, 655433, 25, 0, 655433, 25, 65535, 655433, 25, 65533, 655433, 25, 65532, 655437, 26, 65534, 655436, 25, 65531, 655425)
} }
metadata/_editor_floor_ = Vector3(0, 0, 3) metadata/_editor_floor_ = Vector3(0, 0, 3)
[node name="GridMap2" type="GridMap" parent="." index="7"]
transform = Transform3D(10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 5, 0)
mesh_library = ExtResource("6_d34iv")
cell_size = Vector3(1, 1, 1)
cell_octant_size = 1
data = {
"cells": PackedInt32Array(-65535, 65535, 655431, -65536, 65535, 1048620, 65536, 65535, 38, 131072, 65535, 30, 196608, 65535, 30, -65536, 0, 1048647, -1, 65535, 71, -65536, 65534, 1441863, -65535, 0, 63, -1, 0, 1441855, -65535, 65534, 1048639, -1, 65534, 655423, 1, 65534, 1441848, 65535, 65534, 1441848, 65535, 0, 655419, 1, 0, 1441868, 65536, 65534, 1048623, 65537, 65535, 1048623, 131071, 65535, 1048623, 65537, 65534, 65593, 0, 65535, 1048621, 65537, 65533, 1310777, 65536, 65533, 327737, 65537, 0, 65612, 262144, 65535, 52, 131072, 65533, 393271, 196607, 65535, 1048612)
}
metadata/_editor_floor_ = Vector3(0, 2, 0)
[node name="MeshInstance3D" type="MeshInstance3D" parent="." index="8"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.001, 0, 0)
mesh = SubResource("QuadMesh_8lqeb")
skeleton = NodePath("../Cube")
[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D" index="0"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D" index="0"]
transform = Transform3D(100, 0, 0, 0, 100, 0, 0, 0, 1, 0, 0, -0.5)
shape = SubResource("BoxShape3D_m3lo5")

View File

@ -27,6 +27,7 @@ func is_on_ground() -> bool:
func _physics_process(delta): func _physics_process(delta):
print(is_on_ground())
if not is_on_floor(): if not is_on_floor():
velocity.y -= gravity * delta velocity.y -= gravity * delta
@ -58,7 +59,7 @@ func get_first_bumper() -> Player:
func _on_tag_detection_area_entered(area): func _on_tag_detection_area_entered(area):
if not (area.get_parent() is Player): if not (area.get_parent() is Player):
return return
var other_player: Player = area.get_parent() var _other_player: Player = area.get_parent()
if is_bumping.is_connected(_bump_check): if is_bumping.is_connected(_bump_check):
return return
is_bumping.connect(_bump_check) is_bumping.connect(_bump_check)
@ -66,7 +67,7 @@ func _on_tag_detection_area_entered(area):
func _on_tag_detection_area_exited(area): func _on_tag_detection_area_exited(area):
if not (area.get_parent() is Player): if not (area.get_parent() is Player):
return return
var other_player: Player = area.get_parent() var _other_player: Player = area.get_parent()
if not is_bumping.is_connected(_bump_check): if not is_bumping.is_connected(_bump_check):
return return
is_bumping.disconnect(_bump_check) is_bumping.disconnect(_bump_check)
@ -74,6 +75,7 @@ func _on_tag_detection_area_exited(area):
func _on_tag_detection_body_entered(body): func _on_tag_detection_body_entered(body):
if body.is_in_group("ground"): if body.is_in_group("ground"):
print("fuck")
if not is_grounded.is_connected(body.grounded): if not is_grounded.is_connected(body.grounded):
is_grounded.connect(body.grounded) is_grounded.connect(body.grounded)

View File

@ -3,8 +3,12 @@ extends Control
signal join_lobby(addr: String, port: int) signal join_lobby(addr: String, port: int)
@rpc("reliable", "authority", "call_local") @rpc("reliable", "authority", "call_local")
func add(addr: String, port: int): func add(port: int):
var lobby_button := preload("res://server/lobby_list_entry.tscn").instantiate() var lobby_button := preload("res://server/lobby_list_entry.tscn").instantiate()
var addr := "127.0.0.1"
var peer := (multiplayer.multiplayer_peer as ENetMultiplayerPeer).get_peer(1)
if peer != null:
addr = peer.get_remote_address()
lobby_button.address = addr lobby_button.address = addr
lobby_button.port = port lobby_button.port = port
$Lobbies.add_child(lobby_button, true) $Lobbies.add_child(lobby_button, true)

View File

@ -19,14 +19,14 @@ func _ready():
func peer_connected(id: int): func peer_connected(id: int):
print("Client " + str(id) + " connected to master server") print("Client " + str(id) + " connected to master server")
for lobby in %LobbyList.lobbies(): for lobby in %LobbyList.lobbies():
%LobbyList.add.rpc_id(id, lobby.address, lobby.port) %LobbyList.add.rpc_id(id, lobby.port)
func create_lobby(): func create_lobby():
var lobby := preload("res://server/lobby.tscn").instantiate() var lobby := preload("res://server/lobby.tscn").instantiate()
lobby.port = next_port_num lobby.port = next_port_num
next_port_num += 1 next_port_num += 1
%Lobbies.add_child(lobby) %Lobbies.add_child(lobby)
%LobbyList.add.rpc(external_address, lobby.port) %LobbyList.add.rpc(lobby.port)
func _on_create_lobby_pressed(): func _on_create_lobby_pressed():
create_lobby() create_lobby()