fix respawn gravity and add ids to the hosted server

This commit is contained in:
RandomityGuy 2024-07-07 23:16:44 +05:30
parent 3fcf2c8799
commit e7417c7002
4 changed files with 12 additions and 10 deletions

View file

@ -840,10 +840,7 @@ class MarbleWorld extends Scheduler {
this.replay.recordMarbleStateFlags(false, false, true, false);
}
// In this case, we set the gravity to the relative "up" vector of the checkpoint shape.
var up = new Vector(0, 0, 1);
up.transform(respawnQuat.toMatrix());
this.setUp(marble, up, this.timeState, true);
this.setUp(marble, respawnUp, this.timeState, true);
if (marble == this.marble)
this.playGui.setCenterText('none');

View file

@ -212,9 +212,10 @@ class JoinServerGui extends GuiImage {
hostBtn.position = new Vector(521, 379);
hostBtn.extent = new Vector(93, 45);
hostBtn.pressedAction = (e) -> {
Net.hostServer(Settings.serverSettings.name, Settings.serverSettings.description, Settings.serverSettings.maxPlayers, "", () -> {
MarbleGame.canvas.setContent(new MPPlayMissionGui(true));
});
Net.hostServer(Settings.serverSettings.name, Settings.serverSettings.description, Settings.serverSettings.maxPlayers,
Settings.serverSettings.password, () -> {
MarbleGame.canvas.setContent(new MPPlayMissionGui(true));
});
}
window.addChild(hostBtn);
@ -237,7 +238,7 @@ class JoinServerGui extends GuiImage {
}
}
}, 15000);
Net.joinServer(ourServerList[curSelection].name, password, () -> {
Net.joinServer(ourServerList[curSelection].id, password, () -> {
failed = false;
Net.remoteServerInfo = ourServerList[curSelection];
});

View file

@ -10,6 +10,7 @@ import haxe.net.WebSocket;
import src.Console;
typedef RemoteServerInfo = {
id:String,
name:String,
host:String,
description:String,
@ -212,6 +213,7 @@ class MasterServerClient {
public function sendServerInfo(serverInfo:ServerInfo) {
queueMessage(Json.stringify({
type: "serverInfo",
id: serverInfo.id,
name: serverInfo.name,
host: serverInfo.hostname,
description: serverInfo.description,
@ -224,10 +226,10 @@ class MasterServerClient {
}));
}
public function sendConnectToServer(serverName:String, sdp:String, password:String) {
public function sendConnectToServer(serverId:String, sdp:String, password:String) {
queueMessage(Json.stringify({
type: "connect",
serverName: serverName,
id: serverId,
sdp: sdp,
password: password
}));

View file

@ -45,6 +45,7 @@ enum abstract NetPacketType(Int) from Int to Int {
@:publicFields
class ServerInfo {
var id:String;
var name:String;
var hostname:String;
var description:String;
@ -55,6 +56,7 @@ class ServerInfo {
var platform:NetPlatform;
public function new(name:String, hostname:String, description:String, players:Int, maxPlayers:Int, password:String, state:String, platform:NetPlatform) {
this.id = '${Math.random()}';
this.name = name;
this.hostname = hostname;
this.description = description;