Compare commits

..

1 Commits

Author SHA1 Message Date
EvanGee 8fbd8c86f3 tower! 2024-05-31 16:08:34 -06:00
4 changed files with 6 additions and 11 deletions

View File

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

View File

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

View File

@ -3,12 +3,8 @@ extends Control
signal join_lobby(addr: String, port: int)
@rpc("reliable", "authority", "call_local")
func add(port: int):
func add(addr: String, port: int):
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.port = port
$Lobbies.add_child(lobby_button, true)

View File

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