mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-26 12:41:40 +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;
|
package src;
|
||||||
|
|
||||||
|
import gui.MultiplayerLevelSelectGui;
|
||||||
import collision.CollisionPool;
|
import collision.CollisionPool;
|
||||||
import net.GemPredictionStore;
|
import net.GemPredictionStore;
|
||||||
import modes.HuntMode;
|
import modes.HuntMode;
|
||||||
|
|
@ -646,7 +647,11 @@ class MarbleWorld extends Scheduler {
|
||||||
|
|
||||||
AudioManager.playSound(ResourceLoader.getResource('data/sound/spawn_alternate.wav', ResourceLoader.getAudio, this.soundResources));
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1984,6 +1989,10 @@ class MarbleWorld extends Scheduler {
|
||||||
if (isMultiplayer) {
|
if (isMultiplayer) {
|
||||||
if (Net.isHost) {
|
if (Net.isHost) {
|
||||||
NetCommands.endGame();
|
NetCommands.endGame();
|
||||||
|
this.dispose();
|
||||||
|
MultiplayerLevelSelectGui.currentSelectionStatic = mission.index + 1;
|
||||||
|
var pmg = new MultiplayerLevelSelectGui(true);
|
||||||
|
MarbleGame.canvas.setContent(pmg);
|
||||||
}
|
}
|
||||||
if (Net.isClient) {
|
if (Net.isClient) {
|
||||||
Net.disconnect();
|
Net.disconnect();
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ interface GameMode {
|
||||||
public function applyRewindState(state:RewindableState):Void;
|
public function applyRewindState(state:RewindableState):Void;
|
||||||
public function onTimeExpire():Void;
|
public function onTimeExpire():Void;
|
||||||
public function onRestart():Void;
|
public function onRestart():Void;
|
||||||
|
public function onClientRestart():Void;
|
||||||
public function onRespawn(marble:Marble):Void;
|
public function onRespawn(marble:Marble):Void;
|
||||||
public function onGemPickup(marble:Marble, gem:Gem):Void;
|
public function onGemPickup(marble:Marble, gem:Gem):Void;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -297,6 +297,18 @@ class HuntMode extends NullMode {
|
||||||
@:privateAccess level.playGui.formatGemHuntCounter(points);
|
@: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) {
|
override function onGemPickup(marble:Marble, gem:Gem) {
|
||||||
if (@:privateAccess !marble.isNetUpdate) {
|
if (@:privateAccess !marble.isNetUpdate) {
|
||||||
if (marble == level.marble)
|
if (marble == level.marble)
|
||||||
|
|
@ -476,6 +488,7 @@ class HuntMode extends NullMode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (sphereId in spawnGroup) {
|
for (sphereId in spawnGroup) {
|
||||||
|
Console.log('Spawning gem id ${sphereId}');
|
||||||
var gemSpawn = gemSpawnPoints[sphereId];
|
var gemSpawn = gemSpawnPoints[sphereId];
|
||||||
if (gemSpawn.gem != null) {
|
if (gemSpawn.gem != null) {
|
||||||
gemSpawn.gem.pickedUp = false;
|
gemSpawn.gem.pickedUp = false;
|
||||||
|
|
|
||||||
|
|
@ -108,4 +108,6 @@ class NullMode implements GameMode {
|
||||||
public function constructRewindState() {
|
public function constructRewindState() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onClientRestart() {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ class MoveManager {
|
||||||
delta = queuedMoves[0].id - lastAckMoveId;
|
delta = queuedMoves[0].id - lastAckMoveId;
|
||||||
mv = queuedMoves.shift();
|
mv = queuedMoves.shift();
|
||||||
ackRTT = timeState.ticks - mv.timeState.ticks;
|
ackRTT = timeState.ticks - mv.timeState.ticks;
|
||||||
maxMoves = ackRTT + 2;
|
// maxMoves = ackRTT + 2;
|
||||||
}
|
}
|
||||||
lastAckMoveId = m.id;
|
lastAckMoveId = m.id;
|
||||||
return mv;
|
return mv;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue