mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-22 02:32:01 +00:00
few more fixes
This commit is contained in:
parent
9774d6d9a2
commit
5b74548cf4
5 changed files with 36 additions and 16 deletions
|
|
@ -709,6 +709,7 @@ class MarbleWorld extends Scheduler {
|
||||||
marble.megaMarbleUseTick = 0;
|
marble.megaMarbleUseTick = 0;
|
||||||
marble.helicopterUseTick = 0;
|
marble.helicopterUseTick = 0;
|
||||||
marble.collider.radius = marble._radius = 0.3;
|
marble.collider.radius = marble._radius = 0.3;
|
||||||
|
@:privateAccess marble.netFlags |= MarbleNetFlags.DoHelicopter | MarbleNetFlags.DoMega | MarbleNetFlags.GravityChange;
|
||||||
} else {
|
} else {
|
||||||
@:privateAccess marble.helicopterEnableTime = -1e8;
|
@:privateAccess marble.helicopterEnableTime = -1e8;
|
||||||
@:privateAccess marble.megaMarbleEnableTime = -1e8;
|
@:privateAccess marble.megaMarbleEnableTime = -1e8;
|
||||||
|
|
@ -1398,6 +1399,7 @@ class MarbleWorld extends Scheduler {
|
||||||
public function removePlayer(cc:GameConnection) {
|
public function removePlayer(cc:GameConnection) {
|
||||||
var otherMarble = this.clientMarbles[cc];
|
var otherMarble = this.clientMarbles[cc];
|
||||||
if (otherMarble != null) {
|
if (otherMarble != null) {
|
||||||
|
cancel(otherMarble.oobSchedule);
|
||||||
this.predictions.removeMarbleFromPrediction(otherMarble);
|
this.predictions.removeMarbleFromPrediction(otherMarble);
|
||||||
this.scene.removeChild(otherMarble);
|
this.scene.removeChild(otherMarble);
|
||||||
this.collisionWorld.removeMarbleEntity(otherMarble.collider);
|
this.collisionWorld.removeMarbleEntity(otherMarble.collider);
|
||||||
|
|
|
||||||
|
|
@ -775,20 +775,24 @@ class PlayGui {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addPlayer(id:Int, name:String, us:Bool) {
|
public function addPlayer(id:Int, name:String, us:Bool) {
|
||||||
playerList.push({
|
if (playerListCtrl != null) {
|
||||||
id: id,
|
playerList.push({
|
||||||
name: name,
|
id: id,
|
||||||
us: us,
|
name: name,
|
||||||
score: 0
|
us: us,
|
||||||
});
|
score: 0
|
||||||
redrawPlayerList();
|
});
|
||||||
|
redrawPlayerList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removePlayer(id:Int) {
|
public function removePlayer(id:Int) {
|
||||||
var f = playerList.filter(x -> x.id == id);
|
if (playerListCtrl != null) {
|
||||||
if (f.length != 0)
|
var f = playerList.filter(x -> x.id == id);
|
||||||
playerList.remove(f[0]);
|
if (f.length != 0)
|
||||||
redrawPlayerList();
|
playerList.remove(f[0]);
|
||||||
|
redrawPlayerList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function incrementPlayerScore(id:Int, score:Int) {
|
public function incrementPlayerScore(id:Int, score:Int) {
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ class HuntMode extends NullMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
override function onRespawn(marble:Marble) {
|
override function onRespawn(marble:Marble) {
|
||||||
if (activeGemSpawnGroup.length != 0) {
|
if (marble.controllable && activeGemSpawnGroup.length != 0) {
|
||||||
var gemAvg = new Vector();
|
var gemAvg = new Vector();
|
||||||
for (gi in activeGemSpawnGroup) {
|
for (gi in activeGemSpawnGroup) {
|
||||||
var g = gemSpawnPoints[gi];
|
var g = gemSpawnPoints[gi];
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,9 @@ class Net {
|
||||||
if (Net.client != null)
|
if (Net.client != null)
|
||||||
Net.client.close();
|
Net.client.close();
|
||||||
Net.client = null;
|
Net.client = null;
|
||||||
|
Net.clientDatachannel = null;
|
||||||
Net.clientId = 0;
|
Net.clientId = 0;
|
||||||
|
Net.clients.clear();
|
||||||
Net.clientIdMap.clear();
|
Net.clientIdMap.clear();
|
||||||
Net.clientConnection = null;
|
Net.clientConnection = null;
|
||||||
Net.serverInfo = null;
|
Net.serverInfo = null;
|
||||||
|
|
@ -217,6 +219,7 @@ class Net {
|
||||||
Net.isMP = false;
|
Net.isMP = false;
|
||||||
Net.isClient = false;
|
Net.isClient = false;
|
||||||
Net.isHost = false;
|
Net.isHost = false;
|
||||||
|
Net.clientId = 0;
|
||||||
Net.clients.clear();
|
Net.clients.clear();
|
||||||
Net.clientIdMap.clear();
|
Net.clientIdMap.clear();
|
||||||
MasterServerClient.disconnectFromMasterServer();
|
MasterServerClient.disconnectFromMasterServer();
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,17 @@ class NetCommands {
|
||||||
var conn = Net.clientIdMap.get(clientId);
|
var conn = Net.clientIdMap.get(clientId);
|
||||||
if (MarbleGame.instance.world != null) {
|
if (MarbleGame.instance.world != null) {
|
||||||
MarbleGame.instance.world.removePlayer(conn);
|
MarbleGame.instance.world.removePlayer(conn);
|
||||||
|
|
||||||
|
var allReady = true;
|
||||||
|
for (id => client in Net.clientIdMap) {
|
||||||
|
if (client.state != GameplayState.GAME) {
|
||||||
|
allReady = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (allReady && MarbleGame.instance.world.serverStartTicks == 0) {
|
||||||
|
MarbleGame.instance.world.allClientsReady();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Net.clientIdMap.remove(clientId);
|
Net.clientIdMap.remove(clientId);
|
||||||
if (MarbleGame.canvas.content is MultiplayerLevelSelectGui) {
|
if (MarbleGame.canvas.content is MultiplayerLevelSelectGui) {
|
||||||
|
|
@ -202,16 +213,16 @@ class NetCommands {
|
||||||
}
|
}
|
||||||
|
|
||||||
@:rpc(server) public static function endGame() {
|
@:rpc(server) public static function endGame() {
|
||||||
|
for (c => v in Net.clientIdMap) {
|
||||||
|
v.state = LOBBY;
|
||||||
|
v.lobbyReady = false;
|
||||||
|
}
|
||||||
if (Net.isClient) {
|
if (Net.isClient) {
|
||||||
if (MarbleGame.instance.world != null) {
|
if (MarbleGame.instance.world != null) {
|
||||||
MarbleGame.instance.quitMission();
|
MarbleGame.instance.quitMission();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Net.isHost) {
|
if (Net.isHost) {
|
||||||
for (c => v in Net.clientIdMap) {
|
|
||||||
v.state = LOBBY;
|
|
||||||
v.lobbyReady = false;
|
|
||||||
}
|
|
||||||
Net.lobbyHostReady = false;
|
Net.lobbyHostReady = false;
|
||||||
|
|
||||||
if (Net.isHost) {
|
if (Net.isHost) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue