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