mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
bugfixes for the reported issues
This commit is contained in:
parent
5a6c8ae6e1
commit
3d065c116e
11 changed files with 70 additions and 32 deletions
|
|
@ -7,7 +7,7 @@ new SimGroup(MissionGroup) {
|
|||
desc = "Find the gems in the maze of roads!";
|
||||
radiusFromGem = "20";
|
||||
gameMode = "Hunt";
|
||||
level = "5";
|
||||
level = "4";
|
||||
type = "Intermediate";
|
||||
time = "300000";
|
||||
maxGemsPerSpawn = "6";
|
||||
|
|
|
|||
|
|
@ -262,6 +262,9 @@ class MarbleGame {
|
|||
if (paused && world._ready) {
|
||||
Console.log("Game paused");
|
||||
world.setCursorLock(false);
|
||||
if (Util.isTouchDevice()) {
|
||||
this.touchInput.movementInput.forceRelease();
|
||||
}
|
||||
if (world.isMultiplayer) {
|
||||
exitGameDlg = new MPExitGameDlg(() -> {
|
||||
canvas.popDialog(exitGameDlg);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package src;
|
||||
|
||||
import net.NetPacket.ExplodableUpdatePacket;
|
||||
import net.TrapdoorPredictionStore;
|
||||
import shapes.Explodable;
|
||||
import net.ExplodablePredictionStore;
|
||||
|
|
@ -563,10 +564,10 @@ class MarbleWorld extends Scheduler {
|
|||
interior.onLevelStart();
|
||||
for (shape in this.dtsObjects)
|
||||
shape.onLevelStart();
|
||||
// if (this.isMultiplayer && Net.isClient)
|
||||
// NetCommands.clientIsReady(Net.clientId);
|
||||
if (this.isMultiplayer && Net.isClient && !_skipPreGame)
|
||||
NetCommands.clientIsReady(Net.clientId);
|
||||
if (this.isMultiplayer && Net.isHost) {
|
||||
// NetCommands.clientIsReady(-1);
|
||||
// NetCommands.clientIsReady(-1);
|
||||
|
||||
// Sort all the marbles so that they are updated in a deterministic order
|
||||
this.marbles.sort((a, b) -> @:privateAccess {
|
||||
|
|
@ -591,6 +592,7 @@ class MarbleWorld extends Scheduler {
|
|||
_skipPreGame = false;
|
||||
this.setCursorLock(true);
|
||||
NetCommands.requestMidGameJoinState(Net.clientId);
|
||||
NetCommands.clientIsReady(Net.clientId);
|
||||
}
|
||||
}
|
||||
this.gameMode.onMissionLoad();
|
||||
|
|
@ -1417,7 +1419,11 @@ class MarbleWorld extends Scheduler {
|
|||
// Marble states
|
||||
for (marb in this.marbles) {
|
||||
var oldFlags = @:privateAccess marb.netFlags;
|
||||
@:privateAccess marb.netFlags = MarbleNetFlags.DoBlast | MarbleNetFlags.DoMega | MarbleNetFlags.DoHelicopter | MarbleNetFlags.PickupPowerup | MarbleNetFlags.GravityChange | MarbleNetFlags.UsePowerup;
|
||||
@:privateAccess marb.netFlags = MarbleNetFlags.DoBlast | MarbleNetFlags.DoMega | MarbleNetFlags.DoHelicopter | MarbleNetFlags.DoShockAbsorber | MarbleNetFlags.DoSuperBounce | MarbleNetFlags.PickupPowerup | MarbleNetFlags.GravityChange | MarbleNetFlags.UsePowerup;
|
||||
|
||||
if (oldFlags & MarbleNetFlags.UpdateTrapdoor > 0) {
|
||||
@:privateAccess marb.netFlags |= MarbleNetFlags.UpdateTrapdoor;
|
||||
}
|
||||
|
||||
var innerMove = @:privateAccess marb.lastMove;
|
||||
if (innerMove == null) {
|
||||
|
|
@ -1452,6 +1458,19 @@ class MarbleWorld extends Scheduler {
|
|||
}
|
||||
}
|
||||
|
||||
// Explosion states
|
||||
for (exp in this.explodables) {
|
||||
if (this.timeState.ticks < (exp.lastContactTick + exp.renewTime >> 5)) {
|
||||
var b = new OutputBitStream();
|
||||
b.writeByte(NetPacketType.ExplodableUpdate);
|
||||
var explPacket = new ExplodableUpdatePacket();
|
||||
explPacket.explodableId = exp.netId;
|
||||
explPacket.serverTicks = timeState.ticks;
|
||||
explPacket.serialize(b);
|
||||
packets.push(b.getBytes());
|
||||
}
|
||||
}
|
||||
|
||||
// Scoreboard!
|
||||
var b = new OutputBitStream();
|
||||
b.writeByte(NetPacketType.ScoreBoardInfo);
|
||||
|
|
|
|||
|
|
@ -422,8 +422,8 @@ class Settings {
|
|||
levelStatistics.set(key, value);
|
||||
}
|
||||
}
|
||||
if (json.serverSettings != null) {
|
||||
serverSettings = json.serverSettings;
|
||||
if (json.server != null) {
|
||||
serverSettings = json.server;
|
||||
}
|
||||
#if js
|
||||
if (serverSettings.oldSpawns == null) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package gui;
|
||||
|
||||
import net.ClientConnection;
|
||||
import net.NetCommands;
|
||||
import net.Net;
|
||||
import h2d.filter.DropShadow;
|
||||
|
|
@ -91,6 +92,7 @@ class MPKickBanDlg extends GuiImage {
|
|||
var playerList = new GuiTextListCtrl(markerFelt18, playerNames, 0);
|
||||
playerList.position = new Vector(120, 60);
|
||||
playerList.extent = new Vector(188, 180);
|
||||
playerList.scrollable = true;
|
||||
playerList.textYOffset = -6;
|
||||
playerList.onSelectedFunc = (sel) -> {
|
||||
kickBtn.disabled = false;
|
||||
|
|
@ -106,6 +108,8 @@ class MPKickBanDlg extends GuiImage {
|
|||
playerList.setTexts(playerNames);
|
||||
kickBtn.disabled = true;
|
||||
NetCommands.getKickedClient(Net.clientIdMap.get(playerToKick));
|
||||
var cc = cast(Net.clientIdMap.get(playerToKick), ClientConnection);
|
||||
cc.socket.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -289,6 +289,8 @@ class MPPreGameDlg extends GuiControl {
|
|||
playerListLeft.setTexts(playerListCompiled);
|
||||
playerListRight.setTexts(playerListStateCompiled);
|
||||
|
||||
playerListContainer.setScrollMax(playerListLeft.calculateFullHeight());
|
||||
|
||||
if (playerListArr.length == 1) {
|
||||
// Disable spectating
|
||||
Net.hostSpectate = false;
|
||||
|
|
|
|||
|
|
@ -120,10 +120,19 @@ class HuntMode extends NullMode {
|
|||
override function getSpawnTransform() {
|
||||
var idx = Net.connectedServerInfo.competitiveMode ? idealSpawnIndex : Math.floor(rng2.randRange(0, playerSpawnPoints.length - 1));
|
||||
if (!Net.connectedServerInfo.competitiveMode) {
|
||||
while (spawnPointTaken[idx]) {
|
||||
idx = Math.floor(rng2.randRange(0, playerSpawnPoints.length - 1));
|
||||
var allTaken = true;
|
||||
for (spw in spawnPointTaken) {
|
||||
if (!spw) {
|
||||
allTaken = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!allTaken) {
|
||||
while (spawnPointTaken[idx]) {
|
||||
idx = Math.floor(rng2.randRange(0, playerSpawnPoints.length - 1));
|
||||
}
|
||||
spawnPointTaken[idx] = true;
|
||||
}
|
||||
spawnPointTaken[idx] = true;
|
||||
}
|
||||
|
||||
var randomSpawn = playerSpawnPoints[idx];
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import src.TimeState;
|
|||
enum abstract GameplayState(Int) from Int to Int {
|
||||
var UNKNOWN;
|
||||
var LOBBY;
|
||||
var LOADING;
|
||||
var GAME;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -433,6 +433,10 @@ class Net {
|
|||
for (dc => cc in clients) {
|
||||
if (cc is ClientConnection) {
|
||||
var conn = cast(cc, ClientConnection);
|
||||
if (Net.isHost && conn.state == LOADING)
|
||||
continue;
|
||||
if (Net.isClient && MarbleGame.instance.world != null && !MarbleGame.instance.world._ready)
|
||||
continue; // We still loading, don't disconnect
|
||||
if (conn.needsTimeoutWarn(t)) {
|
||||
conn.didWarnTimeout = true;
|
||||
if (Net.isClient) {
|
||||
|
|
|
|||
|
|
@ -160,28 +160,7 @@ class NetCommands {
|
|||
|
||||
@:rpc(client) public static function clientIsReady(clientId:Int) {
|
||||
if (Net.isHost) {
|
||||
if (Net.serverInfo.state == "WAITING") {
|
||||
Console.log('Client ${clientId} is ready!');
|
||||
if (clientId != -1)
|
||||
Net.clientIdMap[clientId].ready();
|
||||
else
|
||||
Net.hostReady = true;
|
||||
var allReady = true;
|
||||
for (id => client in Net.clientIdMap) {
|
||||
if (client.state != GameplayState.GAME) {
|
||||
allReady = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allReady && Net.hostReady) {
|
||||
if (MarbleGame.instance.world != null) {
|
||||
Console.log('All are ready, starting');
|
||||
MarbleGame.instance.world.allClientsReady();
|
||||
}
|
||||
Net.serverInfo.state = "PLAYING";
|
||||
MasterServerClient.instance.sendServerInfo(Net.serverInfo); // notify the server of the playing state
|
||||
}
|
||||
} else {}
|
||||
Net.clientIdMap[clientId].state = GAME;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ class MovementInput {
|
|||
|
||||
public var value:Vector = new Vector();
|
||||
|
||||
var releaseFn:() -> Void;
|
||||
|
||||
var touchId = -1;
|
||||
|
||||
public function new() {
|
||||
|
|
@ -69,6 +71,11 @@ class MovementInput {
|
|||
|
||||
var stopped = false;
|
||||
|
||||
releaseFn = () -> {
|
||||
stopped = true;
|
||||
collider.stopCapture();
|
||||
}
|
||||
|
||||
collider.startCapture((emove) -> {
|
||||
if (e.touchId != emove.touchId) {
|
||||
emove.propagate = true;
|
||||
|
|
@ -124,6 +131,16 @@ class MovementInput {
|
|||
}
|
||||
}
|
||||
|
||||
public function forceRelease() {
|
||||
releaseFn();
|
||||
this.area.graphics.alpha = 0;
|
||||
this.joystick.graphics.alpha = 0;
|
||||
|
||||
pressed = false;
|
||||
|
||||
this.value = new Vector(0, 0);
|
||||
}
|
||||
|
||||
public function add(parentGui:GuiControl) {
|
||||
parentGui.addChild(this.area);
|
||||
added = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue