mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix few bugs, proper game leaving midgame and endgame
This commit is contained in:
parent
204cc0af63
commit
4d2002804c
5 changed files with 27 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package src;
|
||||
|
||||
import gui.MultiplayerLevelSelectGui;
|
||||
import collision.CollisionPool;
|
||||
import net.GemPredictionStore;
|
||||
import modes.HuntMode;
|
||||
|
|
@ -646,7 +647,11 @@ class MarbleWorld extends Scheduler {
|
|||
|
||||
AudioManager.playSound(ResourceLoader.getResource('data/sound/spawn_alternate.wav', ResourceLoader.getAudio, this.soundResources));
|
||||
|
||||
this.gameMode.onRestart();
|
||||
if (marble == this.marble)
|
||||
this.gameMode.onRestart();
|
||||
if (Net.isClient) {
|
||||
this.gameMode.onClientRestart();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1984,6 +1989,10 @@ class MarbleWorld extends Scheduler {
|
|||
if (isMultiplayer) {
|
||||
if (Net.isHost) {
|
||||
NetCommands.endGame();
|
||||
this.dispose();
|
||||
MultiplayerLevelSelectGui.currentSelectionStatic = mission.index + 1;
|
||||
var pmg = new MultiplayerLevelSelectGui(true);
|
||||
MarbleGame.canvas.setContent(pmg);
|
||||
}
|
||||
if (Net.isClient) {
|
||||
Net.disconnect();
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ interface GameMode {
|
|||
public function applyRewindState(state:RewindableState):Void;
|
||||
public function onTimeExpire():Void;
|
||||
public function onRestart():Void;
|
||||
public function onClientRestart():Void;
|
||||
public function onRespawn(marble:Marble):Void;
|
||||
public function onGemPickup(marble:Marble, gem:Gem):Void;
|
||||
|
||||
|
|
|
|||
|
|
@ -297,6 +297,18 @@ class HuntMode extends NullMode {
|
|||
@:privateAccess level.playGui.formatGemHuntCounter(points);
|
||||
}
|
||||
|
||||
override function onClientRestart() {
|
||||
for (gi in 0...gemSpawnPoints.length) {
|
||||
var gemSpawn = gemSpawnPoints[gi];
|
||||
var vec = gemSpawn.position;
|
||||
if (gemSpawn.gem != null) {
|
||||
gemSpawn.gem.setHide(true);
|
||||
gemSpawn.gem.pickedUp = true;
|
||||
gemSpawn.gemBeam.setHide(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override function onGemPickup(marble:Marble, gem:Gem) {
|
||||
if (@:privateAccess !marble.isNetUpdate) {
|
||||
if (marble == level.marble)
|
||||
|
|
@ -476,6 +488,7 @@ class HuntMode extends NullMode {
|
|||
}
|
||||
}
|
||||
for (sphereId in spawnGroup) {
|
||||
Console.log('Spawning gem id ${sphereId}');
|
||||
var gemSpawn = gemSpawnPoints[sphereId];
|
||||
if (gemSpawn.gem != null) {
|
||||
gemSpawn.gem.pickedUp = false;
|
||||
|
|
|
|||
|
|
@ -108,4 +108,6 @@ class NullMode implements GameMode {
|
|||
public function constructRewindState() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function onClientRestart() {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ class MoveManager {
|
|||
delta = queuedMoves[0].id - lastAckMoveId;
|
||||
mv = queuedMoves.shift();
|
||||
ackRTT = timeState.ticks - mv.timeState.ticks;
|
||||
maxMoves = ackRTT + 2;
|
||||
// maxMoves = ackRTT + 2;
|
||||
}
|
||||
lastAckMoveId = m.id;
|
||||
return mv;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue