mirror of
https://github.com/simon987/Much-Assembly-Required-Frontend.git
synced 2025-04-19 18:46:41 +00:00
Added support for multiple dimensions
This commit is contained in:
parent
92201666dc
commit
c721ce97e1
@ -104,6 +104,7 @@ class UserInfoListener implements MessageListener {
|
|||||||
|
|
||||||
mar.client.worldX = message.worldX;
|
mar.client.worldX = message.worldX;
|
||||||
mar.client.worldY = message.worldY;
|
mar.client.worldY = message.worldY;
|
||||||
|
mar.client.dimension = message.dimension;
|
||||||
|
|
||||||
//Maximum Universe width
|
//Maximum Universe width
|
||||||
mar.client.maxWidth = message.maxWidth;
|
mar.client.maxWidth = message.maxWidth;
|
||||||
@ -268,6 +269,7 @@ class GameClient {
|
|||||||
|
|
||||||
public worldX: number;
|
public worldX: number;
|
||||||
public worldY: number;
|
public worldY: number;
|
||||||
|
public dimension: string;
|
||||||
|
|
||||||
public consoleScreen: PlainTextConsole;
|
public consoleScreen: PlainTextConsole;
|
||||||
|
|
||||||
@ -292,7 +294,7 @@ class GameClient {
|
|||||||
console.log("[MAR] Requesting terrain for world (" + this.worldX + ", " + this.worldY + ")");
|
console.log("[MAR] Requesting terrain for world (" + this.worldX + ", " + this.worldY + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.socket.send(JSON.stringify({t: "terrain", x: this.worldX, y: this.worldY}));
|
this.socket.send(JSON.stringify({t: "terrain", x: this.worldX, y: this.worldY, dimension: this.dimension}));
|
||||||
this.requestObjects();
|
this.requestObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,7 +351,7 @@ class GameClient {
|
|||||||
console.log("[MAR] Requesting game objects");
|
console.log("[MAR] Requesting game objects");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.socket.send(JSON.stringify({t: "object", x: this.worldX, y: this.worldY}));
|
this.socket.send(JSON.stringify({t: "object", x: this.worldX, y: this.worldY, dimension: this.dimension}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public sendDebugCommand(json): void {
|
public sendDebugCommand(json): void {
|
||||||
|
@ -315,7 +315,7 @@ class WorldIndicator extends DebugMessage {
|
|||||||
|
|
||||||
if (mar.world != undefined) {
|
if (mar.world != undefined) {
|
||||||
|
|
||||||
return "World: (" + Number(mar.client.worldX).toString(16).toUpperCase() + ", " +
|
return "World: " + mar.client.dimension + "(" + Number(mar.client.worldX).toString(16).toUpperCase() + ", " +
|
||||||
Number(mar.client.worldY).toString(16).toUpperCase() + ")";
|
Number(mar.client.worldY).toString(16).toUpperCase() + ")";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
31
mar/app.js
31
mar/app.js
@ -255,7 +255,7 @@ var WorldIndicator = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
WorldIndicator.prototype.getMessage = function () {
|
WorldIndicator.prototype.getMessage = function () {
|
||||||
if (mar.world != undefined) {
|
if (mar.world != undefined) {
|
||||||
return "World: (" + Number(mar.client.worldX).toString(16).toUpperCase() + ", " +
|
return "World: " + mar.client.dimension + "(" + Number(mar.client.worldX).toString(16).toUpperCase() + ", " +
|
||||||
Number(mar.client.worldY).toString(16).toUpperCase() + ")";
|
Number(mar.client.worldY).toString(16).toUpperCase() + ")";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -298,7 +298,7 @@ var config = {
|
|||||||
font: "fixedsys"
|
font: "fixedsys"
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
kbBufferX: 225,
|
kbBufferX: 350,
|
||||||
kbBufferY: 20,
|
kbBufferY: 20,
|
||||||
arrowTextStyle: {
|
arrowTextStyle: {
|
||||||
fontSize: 32,
|
fontSize: 32,
|
||||||
@ -368,31 +368,33 @@ var Debug = /** @class */ (function () {
|
|||||||
worldX: mar.client.worldX, worldY: mar.client.worldY });
|
worldX: mar.client.worldX, worldY: mar.client.worldY });
|
||||||
mar.client.requestTerrain(); //Reload terrain
|
mar.client.requestTerrain(); //Reload terrain
|
||||||
};
|
};
|
||||||
Debug.createWorld = function (x, y) {
|
Debug.createWorld = function (x, y, dimension) {
|
||||||
mar.client.sendDebugCommand({ t: "debug", command: "createWorld", worldX: x, worldY: y });
|
mar.client.sendDebugCommand({ t: "debug", command: "createWorld", worldX: x, worldY: y, dimension: dimension });
|
||||||
mar.client.requestTerrain(); //Reload terrain
|
mar.client.requestTerrain(); //Reload terrain
|
||||||
};
|
};
|
||||||
Debug.createWorldHex = function (x, y) {
|
Debug.createWorldHex = function (x, y, dimension) {
|
||||||
mar.client.sendDebugCommand({ t: "debug", command: "createWorld", worldX: parseInt(x, 16), worldY: parseInt(y, 16) });
|
mar.client.sendDebugCommand({ t: "debug", command: "createWorld",
|
||||||
mar.client.requestTerrain(); //Reload terrain
|
worldX: parseInt(x, 16), worldY: parseInt(y, 16), dimension: dimension });
|
||||||
};
|
};
|
||||||
Debug.goTo = function (worldX, worldY) {
|
Debug.goTo = function (worldX, worldY, dimension) {
|
||||||
mar.client.worldX = worldX;
|
mar.client.worldX = worldX;
|
||||||
mar.client.worldY = worldY;
|
mar.client.worldY = worldY;
|
||||||
|
mar.client.dimension = dimension;
|
||||||
mar.client.requestTerrain(); //Reload terrain
|
mar.client.requestTerrain(); //Reload terrain
|
||||||
};
|
};
|
||||||
Debug.goToHex = function (worldX, worldY) {
|
Debug.goToHex = function (worldX, worldY, dimension) {
|
||||||
mar.client.worldX = parseInt(worldX, 16);
|
mar.client.worldX = parseInt(worldX, 16);
|
||||||
mar.client.worldY = parseInt(worldY, 16);
|
mar.client.worldY = parseInt(worldY, 16);
|
||||||
|
mar.client.dimension = dimension;
|
||||||
mar.client.requestTerrain();
|
mar.client.requestTerrain();
|
||||||
};
|
};
|
||||||
Debug.killAll = function (x, y) {
|
Debug.killAll = function (x, y) {
|
||||||
mar.client.sendDebugCommand({ t: "debug", command: "killAll", x: x, y: y,
|
mar.client.sendDebugCommand({ t: "debug", command: "killAll", x: x, y: y,
|
||||||
worldX: mar.client.worldX, worldY: mar.client.worldY });
|
worldX: mar.client.worldX, worldY: mar.client.worldY, dimension: mar.client.dimension });
|
||||||
};
|
};
|
||||||
Debug.objInfo = function (x, y) {
|
Debug.objInfo = function (x, y) {
|
||||||
mar.client.sendDebugCommand({ t: "debug", command: "objInfo", x: x, y: y,
|
mar.client.sendDebugCommand({ t: "debug", command: "objInfo", x: x, y: y,
|
||||||
worldX: mar.client.worldX, worldY: mar.client.worldY });
|
worldX: mar.client.worldX, worldY: mar.client.worldY, dimension: mar.client.dimension });
|
||||||
};
|
};
|
||||||
Debug.userInfo = function (username) {
|
Debug.userInfo = function (username) {
|
||||||
mar.client.sendDebugCommand({ t: "debug", command: "userInfo", username: username });
|
mar.client.sendDebugCommand({ t: "debug", command: "userInfo", username: username });
|
||||||
@ -403,7 +405,7 @@ var Debug = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
Debug.spawnObj = function (data) {
|
Debug.spawnObj = function (data) {
|
||||||
mar.client.sendDebugCommand({ t: "debug", command: "spawnObj", data: data,
|
mar.client.sendDebugCommand({ t: "debug", command: "spawnObj", data: data,
|
||||||
worldX: mar.client.worldX, worldY: mar.client.worldY });
|
worldX: mar.client.worldX, worldY: mar.client.worldY, dimension: mar.client.dimension });
|
||||||
};
|
};
|
||||||
return Debug;
|
return Debug;
|
||||||
}());
|
}());
|
||||||
@ -493,6 +495,7 @@ var UserInfoListener = /** @class */ (function () {
|
|||||||
}
|
}
|
||||||
mar.client.worldX = message.worldX;
|
mar.client.worldX = message.worldX;
|
||||||
mar.client.worldY = message.worldY;
|
mar.client.worldY = message.worldY;
|
||||||
|
mar.client.dimension = message.dimension;
|
||||||
//Maximum Universe width
|
//Maximum Universe width
|
||||||
mar.client.maxWidth = message.maxWidth;
|
mar.client.maxWidth = message.maxWidth;
|
||||||
mar.client.requestTerrain();
|
mar.client.requestTerrain();
|
||||||
@ -627,7 +630,7 @@ var GameClient = /** @class */ (function () {
|
|||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log("[MAR] Requesting terrain for world (" + this.worldX + ", " + this.worldY + ")");
|
console.log("[MAR] Requesting terrain for world (" + this.worldX + ", " + this.worldY + ")");
|
||||||
}
|
}
|
||||||
this.socket.send(JSON.stringify({ t: "terrain", x: this.worldX, y: this.worldY }));
|
this.socket.send(JSON.stringify({ t: "terrain", x: this.worldX, y: this.worldY, dimension: this.dimension }));
|
||||||
this.requestObjects();
|
this.requestObjects();
|
||||||
};
|
};
|
||||||
GameClient.prototype.uploadCode = function (code) {
|
GameClient.prototype.uploadCode = function (code) {
|
||||||
@ -668,7 +671,7 @@ var GameClient = /** @class */ (function () {
|
|||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log("[MAR] Requesting game objects");
|
console.log("[MAR] Requesting game objects");
|
||||||
}
|
}
|
||||||
this.socket.send(JSON.stringify({ t: "object", x: this.worldX, y: this.worldY }));
|
this.socket.send(JSON.stringify({ t: "object", x: this.worldX, y: this.worldY, dimension: this.dimension }));
|
||||||
};
|
};
|
||||||
GameClient.prototype.sendDebugCommand = function (json) {
|
GameClient.prototype.sendDebugCommand = function (json) {
|
||||||
this.socket.send(JSON.stringify(json));
|
this.socket.send(JSON.stringify(json));
|
||||||
|
24
mar/mar.ts
24
mar/mar.ts
@ -35,7 +35,7 @@ let config = {
|
|||||||
font: "fixedsys"
|
font: "fixedsys"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
kbBufferX: 225, ///Position of the keyboard buffer fill on screen
|
kbBufferX: 350, ///Position of the keyboard buffer fill on screen
|
||||||
kbBufferY: 20,
|
kbBufferY: 20,
|
||||||
arrowTextStyle: {
|
arrowTextStyle: {
|
||||||
fontSize: 32,
|
fontSize: 32,
|
||||||
@ -117,36 +117,38 @@ class Debug {
|
|||||||
mar.client.requestTerrain(); //Reload terrain
|
mar.client.requestTerrain(); //Reload terrain
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createWorld(x, y) {
|
public static createWorld(x, y, dimension) {
|
||||||
mar.client.sendDebugCommand({t:"debug", command: "createWorld", worldX: x, worldY: y});
|
mar.client.sendDebugCommand({t:"debug", command: "createWorld", worldX: x, worldY: y, dimension:dimension});
|
||||||
mar.client.requestTerrain(); //Reload terrain
|
mar.client.requestTerrain(); //Reload terrain
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createWorldHex(x, y) {
|
public static createWorldHex(x, y, dimension) {
|
||||||
mar.client.sendDebugCommand({t:"debug", command: "createWorld", worldX: parseInt(x, 16), worldY: parseInt(y, 16)});
|
mar.client.sendDebugCommand({t:"debug", command: "createWorld",
|
||||||
mar.client.requestTerrain(); //Reload terrain
|
worldX: parseInt(x, 16), worldY: parseInt(y, 16), dimension:dimension});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static goTo(worldX, worldY) {
|
public static goTo(worldX, worldY, dimension) {
|
||||||
mar.client.worldX = worldX;
|
mar.client.worldX = worldX;
|
||||||
mar.client.worldY = worldY;
|
mar.client.worldY = worldY;
|
||||||
|
mar.client.dimension = dimension;
|
||||||
mar.client.requestTerrain(); //Reload terrain
|
mar.client.requestTerrain(); //Reload terrain
|
||||||
}
|
}
|
||||||
|
|
||||||
public static goToHex(worldX, worldY) {
|
public static goToHex(worldX, worldY, dimension) {
|
||||||
mar.client.worldX = parseInt(worldX, 16);
|
mar.client.worldX = parseInt(worldX, 16);
|
||||||
mar.client.worldY = parseInt(worldY, 16);
|
mar.client.worldY = parseInt(worldY, 16);
|
||||||
|
mar.client.dimension = dimension;
|
||||||
mar.client.requestTerrain();
|
mar.client.requestTerrain();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static killAll(x, y) {
|
public static killAll(x, y) {
|
||||||
mar.client.sendDebugCommand({t:"debug", command: "killAll", x: x, y: y,
|
mar.client.sendDebugCommand({t:"debug", command: "killAll", x: x, y: y,
|
||||||
worldX: mar.client.worldX, worldY: mar.client.worldY});
|
worldX: mar.client.worldX, worldY: mar.client.worldY, dimension: mar.client.dimension});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static objInfo(x, y) {
|
public static objInfo(x, y) {
|
||||||
mar.client.sendDebugCommand({t:"debug", command: "objInfo", x: x, y: y,
|
mar.client.sendDebugCommand({t:"debug", command: "objInfo", x: x, y: y,
|
||||||
worldX: mar.client.worldX, worldY: mar.client.worldY});
|
worldX: mar.client.worldX, worldY: mar.client.worldY, dimension: mar.client.dimension});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static userInfo(username) {
|
public static userInfo(username) {
|
||||||
@ -160,7 +162,7 @@ class Debug {
|
|||||||
|
|
||||||
public static spawnObj(data) {
|
public static spawnObj(data) {
|
||||||
mar.client.sendDebugCommand({t:"debug", command: "spawnObj", data: data,
|
mar.client.sendDebugCommand({t:"debug", command: "spawnObj", data: data,
|
||||||
worldX: mar.client.worldX, worldY: mar.client.worldY});
|
worldX: mar.client.worldX, worldY: mar.client.worldY, dimension: mar.client.dimension});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user