mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-13 14:49:03 +00:00
Fixed some debug commands. Added blueprint item deserialization, Added inventory SCAN and SEEK actions
This commit is contained in:
@@ -68,7 +68,7 @@ public class GameServer implements Runnable {
|
||||
gameUniverse = new GameUniverse(config);
|
||||
gameUniverse.setMongo(mongo);
|
||||
gameRegistry = new GameRegistry();
|
||||
pluginManager = new PluginManager(config, gameRegistry);
|
||||
pluginManager = new PluginManager(this);
|
||||
|
||||
maxExecutionTime = config.getInt("user_timeout");
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.simon987.server.crypto;
|
||||
|
||||
interface Cypher {
|
||||
public interface Cypher {
|
||||
|
||||
char[] encrypt(char[] plainText, char[] key) throws CryptoException;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class DebugCommandEvent extends GameEvent {
|
||||
}
|
||||
|
||||
public ObjectId getObjectId(String key) {
|
||||
return (ObjectId) command.get(key);
|
||||
return new ObjectId((String) command.get(key));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.simon987.server.game.item;
|
||||
|
||||
import net.simon987.server.assembly.Memory;
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.server.io.JSONSerializable;
|
||||
import net.simon987.server.io.MongoSerializable;
|
||||
@@ -27,6 +28,15 @@ public abstract class Item implements JSONSerializable, MongoSerializable {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the item is scanned
|
||||
*
|
||||
* @param memory result is written here
|
||||
*/
|
||||
public void digitize(Memory memory, int offset) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to uniquely identify an item type in the database and in the game
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.simon987.server.plugin;
|
||||
|
||||
import net.simon987.server.ServerConfiguration;
|
||||
import net.simon987.server.game.objects.GameRegistry;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
|
||||
import java.io.File;
|
||||
@@ -21,12 +20,11 @@ public class PluginManager {
|
||||
|
||||
private ArrayList<ServerPlugin> loadedPlugins;
|
||||
private ArrayList<ServerPlugin> toLoadPlugins;
|
||||
private ServerConfiguration config;
|
||||
private GameRegistry gameRegistry;
|
||||
|
||||
public PluginManager(ServerConfiguration config, GameRegistry registry) {
|
||||
this.config = config;
|
||||
this.gameRegistry = registry;
|
||||
private GameServer gameServer;
|
||||
|
||||
public PluginManager(GameServer gameServer) {
|
||||
this.gameServer = gameServer;
|
||||
this.toLoadPlugins = new ArrayList<>(10);
|
||||
this.loadedPlugins = new ArrayList<>(10);
|
||||
}
|
||||
@@ -162,7 +160,7 @@ public class PluginManager {
|
||||
|
||||
toLoadPlugins.remove(plugin);
|
||||
loadedPlugins.add(plugin);
|
||||
plugin.init(config, gameRegistry);
|
||||
plugin.init(gameServer);
|
||||
}
|
||||
|
||||
public ArrayList<ServerPlugin> getPlugins() {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package net.simon987.server.plugin;
|
||||
|
||||
import net.simon987.server.ServerConfiguration;
|
||||
import net.simon987.server.GameServer;
|
||||
import net.simon987.server.event.GameEventListener;
|
||||
import net.simon987.server.game.objects.GameRegistry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -29,7 +28,7 @@ public abstract class ServerPlugin {
|
||||
/**
|
||||
* Called when the plugin is loaded
|
||||
*/
|
||||
public abstract void init(ServerConfiguration config, GameRegistry gameRegistry);
|
||||
public abstract void init(GameServer gameServer);
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
|
||||
@@ -28,6 +28,7 @@ public class UserInfoRequestHandler implements MessageHandler {
|
||||
json.put("worldX", object.getWorld().getX());
|
||||
json.put("worldY", object.getWorld().getY());
|
||||
json.put("dimension", object.getWorld().getDimension());
|
||||
json.put("id", object.getObjectId().toString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ mar_address=ws://localhost:4567/socket
|
||||
server_name=MAR dev
|
||||
# ALLOW | BLOCK
|
||||
guest_policy=ALLOW
|
||||
# DEBUG
|
||||
autologin=simon
|
||||
|
||||
#Database
|
||||
mongo_dbname=mar_beta
|
||||
|
||||
234
Server/src/main/resources/static/js/mar.js
vendored
234
Server/src/main/resources/static/js/mar.js
vendored
@@ -264,43 +264,66 @@ var RENDERER_WIDTH = document.getElementById("game").clientWidth * window.device
|
||||
var RENDERER_HEIGHT = (window.innerHeight / 1.40) * window.devicePixelRatio;
|
||||
var DEBUG = true;
|
||||
var config = {
|
||||
portalTint: 0xff43c8,
|
||||
tileTint: 0xFFFFFF,
|
||||
wallTint: 0xDDDDDD,
|
||||
vaultWallTint: 0x3F2D2A,
|
||||
vaultFloorTint: 0x2B1E1C,
|
||||
fluidTint: 0x0ACED6,
|
||||
oreTint: 0xF3F3F3,
|
||||
cubotHoverTint: 0x00FF00,
|
||||
cubotTint: 0xFFFFFF,
|
||||
textFill: "#FFFFFF",
|
||||
textStroke: "#9298a8",
|
||||
biomassTint: 0x63B85F,
|
||||
biomassHoverTint: 0x00FF00,
|
||||
tileHoverTint: 0x00FF00,
|
||||
itemIron: 0x434341,
|
||||
textIron: "#434341",
|
||||
itemCopper: 0xC87D38,
|
||||
textCopper: "#C87D38",
|
||||
hologramFill: "#0aced6",
|
||||
hologramStroke: "#12FFB0",
|
||||
copperFill: "#C87D38",
|
||||
plainSprite: "tiles/tile",
|
||||
magneticSprite: "tiles/magneticTile",
|
||||
wallSprite: "tiles/bigTile",
|
||||
wallSprite2: "tiles/bigTile2",
|
||||
walkDuration: 800,
|
||||
holoStyle: function (fill) {
|
||||
return {
|
||||
fontSize: 32,
|
||||
fill: fill ? fill : config.hologramFill,
|
||||
stroke: config.hologramStroke,
|
||||
strokeThickness: 1,
|
||||
font: "fixedsys"
|
||||
};
|
||||
kbBuffer: {
|
||||
x: 350,
|
||||
y: 35,
|
||||
},
|
||||
cubot: {
|
||||
tint: 0xFFFFFF,
|
||||
hoverTint: 0x00FF00,
|
||||
lowEnergyTint: 0xCC0000,
|
||||
walkDuration: 800,
|
||||
lowEnergy: 100,
|
||||
otherCubotAlpha: 0.6,
|
||||
},
|
||||
biomass: {
|
||||
tint: 0x63B85F,
|
||||
tintHover: 0x00FF00,
|
||||
},
|
||||
tile: {
|
||||
hover: 0x00FF00,
|
||||
vaultWall: 0x3F2D2A,
|
||||
vaultFloor: 0x2B1E1C,
|
||||
fluid: 0x0ACED6,
|
||||
ore: 0xF3F3F3,
|
||||
plain: 0xFFFFFF,
|
||||
wall: 0xDDDDDD,
|
||||
plainSprite: "tiles/tile",
|
||||
magneticSprite: "tiles/magneticTile",
|
||||
wallSprite: "tiles/bigTile",
|
||||
wallSprite2: "tiles/bigTile2",
|
||||
},
|
||||
item: {
|
||||
ironColor: 0x434341,
|
||||
copperColor: 0xC87D38,
|
||||
blueprintColor: 0xaced6,
|
||||
},
|
||||
portal: {
|
||||
tint: 0xff43c8,
|
||||
},
|
||||
text: {
|
||||
textFill: "#FFFFFF",
|
||||
textStroke: "#9298a8",
|
||||
textIron: "#434341",
|
||||
textCopper: "#C87D38",
|
||||
hologramFill: "#0aced6",
|
||||
hologramStroke: "#12FFB0",
|
||||
selfUsername: 0xFB4D0A,
|
||||
bigMessageFill: "#ff803d",
|
||||
holoStyle: function (fill) {
|
||||
return {
|
||||
fontSize: 32,
|
||||
fill: fill ? fill : config.text.hologramFill,
|
||||
stroke: config.text.hologramStroke,
|
||||
strokeThickness: 1,
|
||||
font: "fixedsys"
|
||||
};
|
||||
},
|
||||
},
|
||||
arrow: {
|
||||
tint: 0xFFFFFF,
|
||||
tintHover: 0x00FF00,
|
||||
},
|
||||
kbBufferX: 350,
|
||||
kbBufferY: 35,
|
||||
arrowTextStyle: {
|
||||
fontSize: 32,
|
||||
fill: "#ffffff",
|
||||
@@ -308,14 +331,9 @@ var config = {
|
||||
strokeThickness: 1,
|
||||
font: "fixedsys"
|
||||
},
|
||||
lowEnergy: 100,
|
||||
lowEnergyTint: 0xCC0000,
|
||||
bigMessageFill: "#ff803d",
|
||||
arrowTint: 0xFFFFFF,
|
||||
arrowHoverTint: 0x00FF00,
|
||||
selfUsernameColor: 0xFB4D0A,
|
||||
otherCubotAlpha: 0.6,
|
||||
defaultWorldSize: 16
|
||||
world: {
|
||||
defaultSize: 16
|
||||
}
|
||||
};
|
||||
var Util = (function () {
|
||||
function Util() {
|
||||
@@ -351,11 +369,13 @@ var Util = (function () {
|
||||
Util.itemColor = function (item) {
|
||||
switch (item) {
|
||||
case 1:
|
||||
return config.biomassTint;
|
||||
return config.biomass.tint;
|
||||
case 3:
|
||||
return config.itemIron;
|
||||
return config.item.ironColor;
|
||||
case 4:
|
||||
return config.itemCopper;
|
||||
return config.item.copperColor;
|
||||
case 5:
|
||||
return config.item.blueprintColor;
|
||||
}
|
||||
};
|
||||
return Util;
|
||||
@@ -463,6 +483,7 @@ var Debug = (function () {
|
||||
position: position
|
||||
});
|
||||
};
|
||||
Debug.SELF_ID = "";
|
||||
return Debug;
|
||||
}());
|
||||
DEBUG = false;
|
||||
@@ -537,6 +558,7 @@ var UserInfoListener = (function () {
|
||||
mar.client.worldX = message.worldX;
|
||||
mar.client.worldY = message.worldY;
|
||||
mar.client.dimension = message.dimension;
|
||||
Debug.SELF_ID = message.id;
|
||||
mar.client.maxWidth = message.maxWidth;
|
||||
mar.client.requestTerrain();
|
||||
};
|
||||
@@ -581,7 +603,7 @@ var TerrainListener = (function () {
|
||||
if (message.ok) {
|
||||
var worldSize = message.size;
|
||||
if (worldSize == undefined) {
|
||||
worldSize = config.defaultWorldSize;
|
||||
worldSize = config.world.defaultSize;
|
||||
}
|
||||
if (DEBUG) {
|
||||
console.log("[MAR] World is available");
|
||||
@@ -607,13 +629,13 @@ var TerrainListener = (function () {
|
||||
if (DEBUG) {
|
||||
console.log("[MAR] Updating World terrain");
|
||||
}
|
||||
mar.world.updateTerrain([], config.defaultWorldSize);
|
||||
mar.world.updateTerrain([], config.world.defaultSize);
|
||||
}
|
||||
else {
|
||||
if (DEBUG) {
|
||||
console.log("[MAR] Creating new World");
|
||||
}
|
||||
mar.world = new World([], config.defaultWorldSize);
|
||||
mar.world = new World([], config.world.defaultSize);
|
||||
}
|
||||
if (mar.world) {
|
||||
mar.world.setBigMessage("[Uncharted World]");
|
||||
@@ -772,7 +794,7 @@ var GameClient = (function () {
|
||||
GameClient.prototype.initGame = function () {
|
||||
if (this.username != "guest") {
|
||||
var self_1 = this;
|
||||
this.keyboardBuffer = new KeyboardBuffer(config.kbBufferX, config.kbBufferY);
|
||||
this.keyboardBuffer = new KeyboardBuffer(config.kbBuffer.x, config.kbBuffer.y);
|
||||
mar.addDebugMessage(this.keyboardBuffer);
|
||||
mar.game.input.keyboard.onDownCallback = function (event) {
|
||||
if (document.activeElement === document.getElementById("game")) {
|
||||
@@ -858,8 +880,8 @@ var GameObject = (function (_super) {
|
||||
GameObject.prototype.setText = function (text) {
|
||||
this.text = mar.game.make.text(0, 0, text, {
|
||||
fontSize: 22,
|
||||
fill: config.textFill,
|
||||
stroke: config.textStroke,
|
||||
fill: config.text.textFill,
|
||||
stroke: config.text.textStroke,
|
||||
strokeThickness: 2,
|
||||
font: "fixedsys"
|
||||
});
|
||||
@@ -934,7 +956,7 @@ var Cubot = (function (_super) {
|
||||
Cubot.prototype.onTileHover = function () {
|
||||
mar.game.add.tween(this).to({ isoZ: 45 }, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({ x: 1.2, y: 1.2 }, 200, Phaser.Easing.Linear.None, true);
|
||||
this.cubotSprite.tint = config.cubotHoverTint;
|
||||
this.cubotSprite.tint = config.cubot.hoverTint;
|
||||
if (this.text !== undefined) {
|
||||
this.text.visible = true;
|
||||
}
|
||||
@@ -974,15 +996,15 @@ var Cubot = (function (_super) {
|
||||
};
|
||||
Cubot.prototype.getTint = function () {
|
||||
if (!this.hovered) {
|
||||
if (this.energy <= config.lowEnergy) {
|
||||
return config.lowEnergyTint;
|
||||
if (this.energy <= config.cubot.lowEnergy) {
|
||||
return config.cubot.lowEnergyTint;
|
||||
}
|
||||
else {
|
||||
return config.cubotTint;
|
||||
return config.cubot.tint;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return config.cubotHoverTint;
|
||||
return config.cubot.hoverTint;
|
||||
}
|
||||
};
|
||||
Cubot.prototype.updateObject = function (json) {
|
||||
@@ -1034,10 +1056,10 @@ var Cubot = (function (_super) {
|
||||
this.hologram = mar.game.make.text(0, 32, "");
|
||||
this.hologram.anchor.set(0.5, 0);
|
||||
this.addChild(this.hologram);
|
||||
this.hologram.setStyle(config.holoStyle(fillColor));
|
||||
this.hologram.setStyle(config.text.holoStyle(fillColor));
|
||||
}
|
||||
else {
|
||||
this.hologram.setStyle(config.holoStyle(fillColor));
|
||||
this.hologram.setStyle(config.text.holoStyle(fillColor));
|
||||
}
|
||||
switch (holoMode) {
|
||||
case HologramMode.CLEARED:
|
||||
@@ -1095,7 +1117,7 @@ var Cubot = (function (_super) {
|
||||
self.isoY = Util.getIsoY(self.tileY);
|
||||
self.onTileExit();
|
||||
for (var i = 0; i < self.queuedAnimations.length; i++) {
|
||||
self.queuedAnimations[i](config.walkDuration / 2);
|
||||
self.queuedAnimations[i](config.cubot.walkDuration / 2);
|
||||
self.queuedAnimations.splice(i, 1);
|
||||
}
|
||||
});
|
||||
@@ -1104,24 +1126,24 @@ var Cubot = (function (_super) {
|
||||
this.queuedAnimations.push(walkAnimation);
|
||||
}
|
||||
else {
|
||||
walkAnimation(config.walkDuration);
|
||||
walkAnimation(config.cubot.walkDuration);
|
||||
}
|
||||
};
|
||||
Cubot.prototype.createUsername = function () {
|
||||
var username = mar.game.make.text(0, -24, this.username, {
|
||||
fontSize: 22,
|
||||
fill: config.textFill,
|
||||
stroke: config.textStroke,
|
||||
fill: config.text.textFill,
|
||||
stroke: config.text.textStroke,
|
||||
strokeThickness: 2,
|
||||
font: "fixedsys"
|
||||
});
|
||||
username.alpha = 0.85;
|
||||
username.anchor.set(0.5, 0);
|
||||
if (this.username === mar.client.username) {
|
||||
username.tint = config.selfUsernameColor;
|
||||
username.tint = config.text.selfUsername;
|
||||
}
|
||||
else {
|
||||
this.alpha = config.otherCubotAlpha;
|
||||
this.alpha = config.cubot.otherCubotAlpha;
|
||||
}
|
||||
this.addChild(username);
|
||||
};
|
||||
@@ -1167,7 +1189,7 @@ var HarvesterNPC = (function (_super) {
|
||||
return _this;
|
||||
}
|
||||
HarvesterNPC.prototype.getTint = function () {
|
||||
return config.cubotTint;
|
||||
return config.cubot.tint;
|
||||
};
|
||||
HarvesterNPC.prototype.updateDirection = function () {
|
||||
switch (this.direction) {
|
||||
@@ -1215,7 +1237,7 @@ var BiomassBlob = (function (_super) {
|
||||
_this.id = json.i;
|
||||
_this.tileX = json.x;
|
||||
_this.tileY = json.y;
|
||||
_this.tint = config.biomassTint;
|
||||
_this.tint = config.biomass.tint;
|
||||
_this.animations.add("idle", mar.animationFrames.biomassIdle);
|
||||
_this.animations.play("idle", 45, true);
|
||||
_this.setText("Biomass");
|
||||
@@ -1225,7 +1247,7 @@ var BiomassBlob = (function (_super) {
|
||||
BiomassBlob.prototype.onTileHover = function () {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({ isoZ: 45 }, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
this.tint = config.biomassHoverTint;
|
||||
this.tint = config.biomass.tintHover;
|
||||
mar.game.add.tween(this.scale).to({ x: 1.2, y: 1.2 }, 200, Phaser.Easing.Linear.None, true);
|
||||
this.text.visible = true;
|
||||
};
|
||||
@@ -1233,7 +1255,7 @@ var BiomassBlob = (function (_super) {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({ isoZ: 15 }, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({ x: 1, y: 1 }, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.biomassTint;
|
||||
this.tint = config.biomass.tintHover;
|
||||
this.text.visible = false;
|
||||
};
|
||||
BiomassBlob.prototype.updateObject = function (json) {
|
||||
@@ -1259,14 +1281,14 @@ var Factory = (function (_super) {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({ isoZ: 25 }, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({ x: 1.06, y: 1.06 }, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotHoverTint;
|
||||
this.tint = config.cubot.hoverTint;
|
||||
this.text.visible = true;
|
||||
};
|
||||
Factory.prototype.onTileExit = function () {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({ isoZ: 15 }, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({ x: 1, y: 1 }, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotTint;
|
||||
this.tint = config.cubot.tint;
|
||||
this.text.visible = false;
|
||||
};
|
||||
Factory.prototype.updateObject = function (json) {
|
||||
@@ -1293,14 +1315,14 @@ var RadioTower = (function (_super) {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({ isoZ: 25 }, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({ x: 1.06, y: 1.06 }, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotHoverTint;
|
||||
this.tint = config.cubot.hoverTint;
|
||||
this.text.visible = true;
|
||||
};
|
||||
RadioTower.prototype.onTileExit = function () {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({ isoZ: 15 }, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({ x: 1, y: 1 }, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotTint;
|
||||
this.tint = config.cubot.tint;
|
||||
this.text.visible = false;
|
||||
};
|
||||
RadioTower.prototype.updateObject = function (json) {
|
||||
@@ -1333,7 +1355,7 @@ var VaultDoor = (function (_super) {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({ isoZ: 15 }, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({ x: 1.06, y: 1.06 }, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotHoverTint;
|
||||
this.tint = config.cubot.hoverTint;
|
||||
this.text.visible = true;
|
||||
document.body.style.cursor = 'pointer';
|
||||
document.body.setAttribute("title", "Click to visit Vault");
|
||||
@@ -1342,7 +1364,7 @@ var VaultDoor = (function (_super) {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({ isoZ: 0 }, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({ x: 1, y: 1 }, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotTint;
|
||||
this.tint = config.cubot.tint;
|
||||
this.text.visible = false;
|
||||
document.body.style.cursor = 'default';
|
||||
document.body.setAttribute("title", "");
|
||||
@@ -1374,14 +1396,14 @@ var ElectricBox = (function (_super) {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({ isoZ: 25 }, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({ x: 1.06, y: 1.06 }, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotHoverTint;
|
||||
this.tint = config.cubot.hoverTint;
|
||||
this.text.visible = true;
|
||||
};
|
||||
ElectricBox.prototype.onTileExit = function () {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({ isoZ: 15 }, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({ x: 1, y: 1 }, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotTint;
|
||||
this.tint = config.cubot.tint;
|
||||
this.text.visible = false;
|
||||
};
|
||||
ElectricBox.prototype.makeSparks = function (self) {
|
||||
@@ -1397,7 +1419,7 @@ var Portal = (function (_super) {
|
||||
function Portal(json) {
|
||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/Portal") || this;
|
||||
_this.anchor.set(0.5, 0.3);
|
||||
_this.tint = config.portalTint;
|
||||
_this.tint = config.portal.tint;
|
||||
_this.setText("Portal");
|
||||
_this.text.visible = false;
|
||||
_this.id = json.i;
|
||||
@@ -1409,14 +1431,14 @@ var Portal = (function (_super) {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({ isoZ: 25 }, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({ x: 1.06, y: 1.06 }, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotHoverTint;
|
||||
this.tint = config.cubot.hoverTint;
|
||||
this.text.visible = true;
|
||||
};
|
||||
Portal.prototype.onTileExit = function () {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({ isoZ: 15 }, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({ x: 1, y: 1 }, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.portalTint;
|
||||
this.tint = config.portal.tint;
|
||||
this.text.visible = false;
|
||||
};
|
||||
Portal.prototype.updateObject = function (json) {
|
||||
@@ -1475,7 +1497,7 @@ var Tile = (function (_super) {
|
||||
}
|
||||
};
|
||||
Tile.prototype.onHover = function () {
|
||||
this.tint = config.tileHoverTint;
|
||||
this.tint = config.tile.hover;
|
||||
mar.game.add.tween(this).to({ isoZ: this.baseZ + 8 }, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.tileIndicator.tileX = this.tileX;
|
||||
mar.tileIndicator.tileY = this.tileY;
|
||||
@@ -1505,8 +1527,8 @@ var Tile = (function (_super) {
|
||||
var PlainTile = (function (_super) {
|
||||
__extends(PlainTile, _super);
|
||||
function PlainTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||
_this.baseTint = config.tileTint;
|
||||
var _this = _super.call(this, x, y, config.tile.plainSprite, 0) || this;
|
||||
_this.baseTint = config.tile.plain;
|
||||
_this.tint = _this.baseTint;
|
||||
_this.tileType = "plain";
|
||||
return _this;
|
||||
@@ -1516,8 +1538,8 @@ var PlainTile = (function (_super) {
|
||||
var WallTile = (function (_super) {
|
||||
__extends(WallTile, _super);
|
||||
function WallTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.wallSprite, 0.2) || this;
|
||||
_this.baseTint = config.wallTint;
|
||||
var _this = _super.call(this, x, y, config.tile.wallSprite, 0.2) || this;
|
||||
_this.baseTint = config.tile.wall;
|
||||
_this.tint = _this.baseTint;
|
||||
_this.tileType = "wall";
|
||||
return _this;
|
||||
@@ -1527,8 +1549,8 @@ var WallTile = (function (_super) {
|
||||
var VaultWallTile = (function (_super) {
|
||||
__extends(VaultWallTile, _super);
|
||||
function VaultWallTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.wallSprite2, 0.29) || this;
|
||||
_this.baseTint = config.vaultWallTint;
|
||||
var _this = _super.call(this, x, y, config.tile.wallSprite2, 0.29) || this;
|
||||
_this.baseTint = config.tile.vaultWall;
|
||||
_this.tint = _this.baseTint;
|
||||
_this.tileType = "vault wall";
|
||||
return _this;
|
||||
@@ -1538,8 +1560,8 @@ var VaultWallTile = (function (_super) {
|
||||
var VaultFloorTile = (function (_super) {
|
||||
__extends(VaultFloorTile, _super);
|
||||
function VaultFloorTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||
_this.baseTint = config.vaultFloorTint;
|
||||
var _this = _super.call(this, x, y, config.tile.plainSprite, 0) || this;
|
||||
_this.baseTint = config.tile.vaultFloor;
|
||||
_this.tint = _this.baseTint;
|
||||
_this.tileType = "vault floor";
|
||||
return _this;
|
||||
@@ -1549,8 +1571,8 @@ var VaultFloorTile = (function (_super) {
|
||||
var VoidTile = (function (_super) {
|
||||
__extends(VoidTile, _super);
|
||||
function VoidTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||
_this.baseTint = config.vaultFloorTint;
|
||||
var _this = _super.call(this, x, y, config.tile.plainSprite, 0) || this;
|
||||
_this.baseTint = config.tile.vaultFloor;
|
||||
_this.tileType = "void";
|
||||
_this.alpha = 0;
|
||||
return _this;
|
||||
@@ -1567,8 +1589,8 @@ var VoidTile = (function (_super) {
|
||||
var FluidTile = (function (_super) {
|
||||
__extends(FluidTile, _super);
|
||||
function FluidTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||
_this.baseTint = config.fluidTint;
|
||||
var _this = _super.call(this, x, y, config.tile.plainSprite, 0) || this;
|
||||
_this.baseTint = config.tile.fluid;
|
||||
_this.tint = _this.baseTint;
|
||||
_this.alpha = 0.6;
|
||||
_this.baseZ = -15;
|
||||
@@ -1581,10 +1603,10 @@ var FluidTile = (function (_super) {
|
||||
var MagneticTile = (function (_super) {
|
||||
__extends(MagneticTile, _super);
|
||||
function MagneticTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.magneticSprite, 0) || this;
|
||||
var _this = _super.call(this, x, y, config.tile.magneticSprite, 0) || this;
|
||||
_this.baseTint = 0xFFFFFF;
|
||||
_this.tint = _this.baseTint;
|
||||
_this.setText("Magnetic", config.textIron);
|
||||
_this.setText("Magnetic", config.text.textIron);
|
||||
_this.tileType = "Magnetic tile";
|
||||
return _this;
|
||||
}
|
||||
@@ -1599,10 +1621,10 @@ var MagneticTile = (function (_super) {
|
||||
var IronTile = (function (_super) {
|
||||
__extends(IronTile, _super);
|
||||
function IronTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||
_this.baseTint = config.oreTint;
|
||||
var _this = _super.call(this, x, y, config.tile.plainSprite, 0) || this;
|
||||
_this.baseTint = config.tile.ore;
|
||||
_this.tint = _this.baseTint;
|
||||
_this.setText("Iron", config.textIron);
|
||||
_this.setText("Iron", config.text.textIron);
|
||||
_this.tileType = "iron";
|
||||
return _this;
|
||||
}
|
||||
@@ -1611,10 +1633,10 @@ var IronTile = (function (_super) {
|
||||
var CopperTile = (function (_super) {
|
||||
__extends(CopperTile, _super);
|
||||
function CopperTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||
_this.baseTint = config.oreTint;
|
||||
var _this = _super.call(this, x, y, config.tile.plainSprite, 0) || this;
|
||||
_this.baseTint = config.tile.ore;
|
||||
_this.tint = _this.baseTint;
|
||||
_this.setText("Copper", config.textCopper);
|
||||
_this.setText("Copper", config.text.textCopper);
|
||||
_this.tileType = "copper";
|
||||
return _this;
|
||||
}
|
||||
@@ -1659,8 +1681,8 @@ var World = (function () {
|
||||
World.prototype.setBigMessage = function (msg) {
|
||||
this.bigMessage = mar.game.add.text(908, 450, msg, {
|
||||
fontSize: 46,
|
||||
fill: config.bigMessageFill,
|
||||
stroke: config.textStroke,
|
||||
fill: config.text.bigMessageFill,
|
||||
stroke: config.text.textStroke,
|
||||
strokeThickness: 2,
|
||||
font: "fixedsys"
|
||||
}, mar.textGroup);
|
||||
@@ -1752,12 +1774,12 @@ var WorldArrow = (function (_super) {
|
||||
mar.client.requestTerrain();
|
||||
});
|
||||
_this.events.onInputOver.add(function () {
|
||||
self.tint = config.arrowHoverTint;
|
||||
self.tint = config.arrow.tintHover;
|
||||
self.hoverText.visible = true;
|
||||
document.body.style.cursor = "pointer";
|
||||
});
|
||||
_this.events.onInputOut.add(function () {
|
||||
self.tint = config.arrowTint;
|
||||
self.tint = config.arrow.tint;
|
||||
self.hoverText.visible = false;
|
||||
document.body.style.cursor = "default";
|
||||
});
|
||||
|
||||
@@ -108,6 +108,7 @@ class UserInfoListener implements MessageListener {
|
||||
mar.client.worldX = message.worldX;
|
||||
mar.client.worldY = message.worldY;
|
||||
mar.client.dimension = message.dimension;
|
||||
Debug.SELF_ID = message.id;
|
||||
|
||||
//Maximum Universe width
|
||||
mar.client.maxWidth = message.maxWidth;
|
||||
@@ -163,7 +164,7 @@ class TerrainListener implements MessageListener {
|
||||
|
||||
let worldSize = message.size;
|
||||
if (worldSize == undefined) {
|
||||
worldSize = config.defaultWorldSize;
|
||||
worldSize = config.world.defaultSize;
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +202,7 @@ class TerrainListener implements MessageListener {
|
||||
console.log("[MAR] Updating World terrain");
|
||||
}
|
||||
|
||||
mar.world.updateTerrain([], config.defaultWorldSize);
|
||||
mar.world.updateTerrain([], config.world.defaultSize);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -209,7 +210,7 @@ class TerrainListener implements MessageListener {
|
||||
console.log("[MAR] Creating new World");
|
||||
}
|
||||
|
||||
mar.world = new World([], config.defaultWorldSize);
|
||||
mar.world = new World([], config.world.defaultSize);
|
||||
|
||||
}
|
||||
if (mar.world) {
|
||||
@@ -455,7 +456,7 @@ class GameClient {
|
||||
|
||||
let self = this;
|
||||
|
||||
this.keyboardBuffer = new KeyboardBuffer(config.kbBufferX, config.kbBufferY);
|
||||
this.keyboardBuffer = new KeyboardBuffer(config.kbBuffer.x, config.kbBuffer.y);
|
||||
mar.addDebugMessage(this.keyboardBuffer);
|
||||
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ abstract class GameObject extends Phaser.Plugin.Isometric.IsoSprite {
|
||||
protected setText(text: string): void {
|
||||
this.text = mar.game.make.text(0, 0, text, {
|
||||
fontSize: 22,
|
||||
fill: config.textFill,
|
||||
stroke: config.textStroke,
|
||||
fill: config.text.textFill,
|
||||
stroke: config.text.textStroke,
|
||||
strokeThickness: 2,
|
||||
font: "fixedsys"
|
||||
});
|
||||
@@ -207,7 +207,7 @@ class Cubot extends GameObject {
|
||||
mar.game.add.tween(this).to({isoZ: 45}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1.2, y: 1.2}, 200, Phaser.Easing.Linear.None, true);
|
||||
|
||||
this.cubotSprite.tint = config.cubotHoverTint;
|
||||
this.cubotSprite.tint = config.cubot.hoverTint;
|
||||
|
||||
if (this.text !== undefined) {
|
||||
this.text.visible = true;
|
||||
@@ -260,13 +260,13 @@ class Cubot extends GameObject {
|
||||
|
||||
public getTint(): number {
|
||||
if (!this.hovered) {
|
||||
if (this.energy <= config.lowEnergy) {
|
||||
return config.lowEnergyTint;
|
||||
if (this.energy <= config.cubot.lowEnergy) {
|
||||
return config.cubot.lowEnergyTint;
|
||||
} else {
|
||||
return config.cubotTint;
|
||||
return config.cubot.tint;
|
||||
}
|
||||
} else {
|
||||
return config.cubotHoverTint;
|
||||
return config.cubot.hoverTint;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,9 +343,9 @@ class Cubot extends GameObject {
|
||||
this.hologram = mar.game.make.text(0, 32, "");
|
||||
this.hologram.anchor.set(0.5, 0);
|
||||
this.addChild(this.hologram);
|
||||
this.hologram.setStyle(config.holoStyle(fillColor));
|
||||
this.hologram.setStyle(config.text.holoStyle(fillColor));
|
||||
} else {
|
||||
this.hologram.setStyle(config.holoStyle(fillColor));
|
||||
this.hologram.setStyle(config.text.holoStyle(fillColor));
|
||||
}
|
||||
|
||||
switch (holoMode) {
|
||||
@@ -430,7 +430,7 @@ class Cubot extends GameObject {
|
||||
|
||||
//Execute all the queued walk animations at a faster pace
|
||||
for (let i = 0; i < self.queuedAnimations.length; i++) {
|
||||
self.queuedAnimations[i](config.walkDuration / 2);
|
||||
self.queuedAnimations[i](config.cubot.walkDuration / 2);
|
||||
self.queuedAnimations.splice(i, 1)
|
||||
}
|
||||
});
|
||||
@@ -442,7 +442,7 @@ class Cubot extends GameObject {
|
||||
this.queuedAnimations.push(walkAnimation);
|
||||
|
||||
} else {
|
||||
walkAnimation(config.walkDuration);
|
||||
walkAnimation(config.cubot.walkDuration);
|
||||
}
|
||||
|
||||
|
||||
@@ -456,8 +456,8 @@ class Cubot extends GameObject {
|
||||
public createUsername() {
|
||||
let username = mar.game.make.text(0, -24, this.username, {
|
||||
fontSize: 22,
|
||||
fill: config.textFill,
|
||||
stroke: config.textStroke,
|
||||
fill: config.text.textFill,
|
||||
stroke: config.text.textStroke,
|
||||
strokeThickness: 2,
|
||||
font: "fixedsys"
|
||||
});
|
||||
@@ -466,9 +466,9 @@ class Cubot extends GameObject {
|
||||
|
||||
//Color own username
|
||||
if (this.username === mar.client.username) {
|
||||
username.tint = config.selfUsernameColor;
|
||||
username.tint = config.text.selfUsername;
|
||||
} else {
|
||||
this.alpha = config.otherCubotAlpha;
|
||||
this.alpha = config.cubot.otherCubotAlpha;
|
||||
}
|
||||
this.addChild(username);
|
||||
}
|
||||
@@ -528,7 +528,7 @@ class HarvesterNPC extends Cubot {
|
||||
* Needs to be overridden because Cubot() calls getTint() when initialised
|
||||
*/
|
||||
public getTint() {
|
||||
return config.cubotTint;
|
||||
return config.cubot.tint;
|
||||
}
|
||||
|
||||
public updateDirection() {
|
||||
@@ -585,7 +585,7 @@ class BiomassBlob extends GameObject {
|
||||
onTileHover() {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 45}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
this.tint = config.biomassHoverTint;
|
||||
this.tint = config.biomass.tintHover;
|
||||
mar.game.add.tween(this.scale).to({x: 1.2, y: 1.2}, 200, Phaser.Easing.Linear.None, true);
|
||||
|
||||
this.text.visible = true;
|
||||
@@ -595,7 +595,7 @@ class BiomassBlob extends GameObject {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 15}, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1, y: 1}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.biomassTint;
|
||||
this.tint = config.biomass.tintHover;
|
||||
|
||||
this.text.visible = false;
|
||||
}
|
||||
@@ -618,7 +618,7 @@ class BiomassBlob extends GameObject {
|
||||
this.tileX = json.x;
|
||||
this.tileY = json.y;
|
||||
|
||||
this.tint = config.biomassTint;
|
||||
this.tint = config.biomass.tint;
|
||||
|
||||
this.animations.add("idle", mar.animationFrames.biomassIdle);
|
||||
this.animations.play("idle", 45, true);
|
||||
@@ -635,7 +635,7 @@ class Factory extends GameObject {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 25}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1.06, y: 1.06}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotHoverTint;
|
||||
this.tint = config.cubot.hoverTint;
|
||||
|
||||
this.text.visible = true;
|
||||
}
|
||||
@@ -644,7 +644,7 @@ class Factory extends GameObject {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 15}, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1, y: 1}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotTint;
|
||||
this.tint = config.cubot.tint;
|
||||
|
||||
this.text.visible = false;
|
||||
}
|
||||
@@ -678,7 +678,7 @@ class RadioTower extends GameObject {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 25}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1.06, y: 1.06}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotHoverTint;
|
||||
this.tint = config.cubot.hoverTint;
|
||||
|
||||
this.text.visible = true;
|
||||
}
|
||||
@@ -687,7 +687,7 @@ class RadioTower extends GameObject {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 15}, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1, y: 1}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotTint;
|
||||
this.tint = config.cubot.tint;
|
||||
|
||||
this.text.visible = false;
|
||||
}
|
||||
@@ -715,7 +715,7 @@ class VaultDoor extends GameObject {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 15}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1.06, y: 1.06}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotHoverTint;
|
||||
this.tint = config.cubot.hoverTint;
|
||||
|
||||
this.text.visible = true;
|
||||
|
||||
@@ -727,7 +727,7 @@ class VaultDoor extends GameObject {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 0}, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1, y: 1}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotTint;
|
||||
this.tint = config.cubot.tint;
|
||||
|
||||
this.text.visible = false;
|
||||
document.body.style.cursor = 'default';
|
||||
@@ -773,7 +773,7 @@ class ElectricBox extends GameObject {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 25}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1.06, y: 1.06}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotHoverTint;
|
||||
this.tint = config.cubot.hoverTint;
|
||||
|
||||
this.text.visible = true;
|
||||
}
|
||||
@@ -782,7 +782,7 @@ class ElectricBox extends GameObject {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 15}, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1, y: 1}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotTint;
|
||||
this.tint = config.cubot.tint;
|
||||
|
||||
this.text.visible = false;
|
||||
}
|
||||
@@ -827,7 +827,7 @@ class Portal extends GameObject {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 25}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1.06, y: 1.06}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotHoverTint;
|
||||
this.tint = config.cubot.hoverTint;
|
||||
|
||||
this.text.visible = true;
|
||||
}
|
||||
@@ -836,7 +836,7 @@ class Portal extends GameObject {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 15}, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1, y: 1}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.portalTint;
|
||||
this.tint = config.portal.tint;
|
||||
|
||||
this.text.visible = false;
|
||||
}
|
||||
@@ -848,7 +848,7 @@ class Portal extends GameObject {
|
||||
constructor(json) {
|
||||
super(Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/Portal");
|
||||
this.anchor.set(0.5, 0.3);
|
||||
this.tint = config.portalTint;
|
||||
this.tint = config.portal.tint;
|
||||
|
||||
this.setText("Portal");
|
||||
this.text.visible = false;
|
||||
|
||||
@@ -84,7 +84,7 @@ class Tile extends Phaser.Plugin.Isometric.IsoSprite {
|
||||
}
|
||||
|
||||
public onHover() {
|
||||
this.tint = config.tileHoverTint;
|
||||
this.tint = config.tile.hover;
|
||||
mar.game.add.tween(this).to({isoZ: this.baseZ + 8}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
|
||||
mar.tileIndicator.tileX = this.tileX;
|
||||
@@ -121,9 +121,9 @@ class Tile extends Phaser.Plugin.Isometric.IsoSprite {
|
||||
class PlainTile extends Tile {
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
super(x, y, config.plainSprite, 0);
|
||||
super(x, y, config.tile.plainSprite, 0);
|
||||
|
||||
this.baseTint = config.tileTint;
|
||||
this.baseTint = config.tile.plain;
|
||||
this.tint = this.baseTint;
|
||||
this.tileType = "plain";
|
||||
}
|
||||
@@ -132,9 +132,9 @@ class PlainTile extends Tile {
|
||||
class WallTile extends Tile {
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
super(x, y, config.wallSprite, 0.2);
|
||||
super(x, y, config.tile.wallSprite, 0.2);
|
||||
|
||||
this.baseTint = config.wallTint;
|
||||
this.baseTint = config.tile.wall;
|
||||
this.tint = this.baseTint;
|
||||
this.tileType = "wall";
|
||||
|
||||
@@ -144,9 +144,9 @@ class WallTile extends Tile {
|
||||
class VaultWallTile extends Tile {
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
super(x, y, config.wallSprite2, 0.29);
|
||||
super(x, y, config.tile.wallSprite2, 0.29);
|
||||
|
||||
this.baseTint = config.vaultWallTint;
|
||||
this.baseTint = config.tile.vaultWall;
|
||||
this.tint = this.baseTint;
|
||||
this.tileType = "vault wall";
|
||||
|
||||
@@ -156,9 +156,9 @@ class VaultWallTile extends Tile {
|
||||
class VaultFloorTile extends Tile {
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
super(x, y, config.plainSprite, 0);
|
||||
super(x, y, config.tile.plainSprite, 0);
|
||||
|
||||
this.baseTint = config.vaultFloorTint;
|
||||
this.baseTint = config.tile.vaultFloor;
|
||||
this.tint = this.baseTint;
|
||||
this.tileType = "vault floor";
|
||||
}
|
||||
@@ -177,9 +177,9 @@ class VoidTile extends Tile {
|
||||
}
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
super(x, y, config.plainSprite, 0);
|
||||
super(x, y, config.tile.plainSprite, 0);
|
||||
|
||||
this.baseTint = config.vaultFloorTint;
|
||||
this.baseTint = config.tile.vaultFloor;
|
||||
this.tileType = "void";
|
||||
this.alpha = 0;
|
||||
}
|
||||
@@ -187,9 +187,9 @@ class VoidTile extends Tile {
|
||||
|
||||
class FluidTile extends Tile {
|
||||
constructor(x: number, y: number) {
|
||||
super(x, y, config.plainSprite, 0);
|
||||
super(x, y, config.tile.plainSprite, 0);
|
||||
|
||||
this.baseTint = config.fluidTint;
|
||||
this.baseTint = config.tile.fluid;
|
||||
this.tint = this.baseTint;
|
||||
this.alpha = 0.6;
|
||||
this.baseZ = -15;
|
||||
@@ -210,12 +210,12 @@ class MagneticTile extends Tile {
|
||||
}
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
super(x, y, config.magneticSprite, 0);
|
||||
super(x, y, config.tile.magneticSprite, 0);
|
||||
|
||||
this.baseTint = 0xFFFFFF;
|
||||
this.tint = this.baseTint;
|
||||
|
||||
this.setText("Magnetic", config.textIron);
|
||||
this.setText("Magnetic", config.text.textIron);
|
||||
this.tileType = "Magnetic tile";
|
||||
}
|
||||
}
|
||||
@@ -223,12 +223,12 @@ class MagneticTile extends Tile {
|
||||
class IronTile extends Tile {
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
super(x, y, config.plainSprite, 0);
|
||||
super(x, y, config.tile.plainSprite, 0);
|
||||
|
||||
this.baseTint = config.oreTint;
|
||||
this.baseTint = config.tile.ore;
|
||||
this.tint = this.baseTint;
|
||||
|
||||
this.setText("Iron", config.textIron);
|
||||
this.setText("Iron", config.text.textIron);
|
||||
this.tileType = "iron";
|
||||
}
|
||||
}
|
||||
@@ -237,12 +237,12 @@ class IronTile extends Tile {
|
||||
class CopperTile extends Tile {
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
super(x, y, config.plainSprite, 0);
|
||||
super(x, y, config.tile.plainSprite, 0);
|
||||
|
||||
this.baseTint = config.oreTint;
|
||||
this.baseTint = config.tile.ore;
|
||||
this.tint = this.baseTint;
|
||||
|
||||
this.setText("Copper", config.textCopper);
|
||||
this.setText("Copper", config.text.textCopper);
|
||||
this.tileType = "copper";
|
||||
}
|
||||
}
|
||||
@@ -321,8 +321,8 @@ class World {
|
||||
public setBigMessage(msg: string) {
|
||||
this.bigMessage = mar.game.add.text(908, 450, msg, {
|
||||
fontSize: 46,
|
||||
fill: config.bigMessageFill,
|
||||
stroke: config.textStroke,
|
||||
fill: config.text.bigMessageFill,
|
||||
stroke: config.text.textStroke,
|
||||
strokeThickness: 2,
|
||||
font: "fixedsys"
|
||||
}, mar.textGroup);
|
||||
@@ -465,13 +465,13 @@ class WorldArrow extends Phaser.Plugin.Isometric.IsoSprite {
|
||||
});
|
||||
|
||||
this.events.onInputOver.add(function () {
|
||||
self.tint = config.arrowHoverTint;
|
||||
self.tint = config.arrow.tintHover;
|
||||
self.hoverText.visible = true;
|
||||
document.body.style.cursor = "pointer";
|
||||
});
|
||||
|
||||
this.events.onInputOut.add(function () {
|
||||
self.tint = config.arrowTint;
|
||||
self.tint = config.arrow.tint;
|
||||
self.hoverText.visible = false;
|
||||
document.body.style.cursor = "default";
|
||||
});
|
||||
|
||||
@@ -6,43 +6,66 @@ let RENDERER_HEIGHT = (window.innerHeight / 1.40) * window.devicePixelRatio;
|
||||
let DEBUG: boolean = true;
|
||||
|
||||
let config = {
|
||||
portalTint: 0xff43c8,
|
||||
tileTint: 0xFFFFFF,
|
||||
wallTint: 0xDDDDDD,
|
||||
vaultWallTint: 0x3F2D2A,
|
||||
vaultFloorTint: 0x2B1E1C,
|
||||
fluidTint: 0x0ACED6,
|
||||
oreTint: 0xF3F3F3,
|
||||
cubotHoverTint: 0x00FF00,
|
||||
cubotTint: 0xFFFFFF,
|
||||
textFill: "#FFFFFF",
|
||||
textStroke: "#9298a8",
|
||||
biomassTint: 0x63B85F,
|
||||
biomassHoverTint: 0x00FF00,
|
||||
tileHoverTint: 0x00FF00,
|
||||
itemIron: 0x434341,
|
||||
textIron: "#434341",
|
||||
itemCopper: 0xC87D38,
|
||||
textCopper: "#C87D38",
|
||||
hologramFill: "#0aced6",
|
||||
hologramStroke: "#12FFB0",
|
||||
copperFill: "#C87D38",
|
||||
plainSprite: "tiles/tile",
|
||||
magneticSprite: "tiles/magneticTile",
|
||||
wallSprite: "tiles/bigTile",
|
||||
wallSprite2: "tiles/bigTile2",
|
||||
walkDuration: 800, //walk animation duration in ms
|
||||
holoStyle: (fill: string) => {
|
||||
return {
|
||||
fontSize: 32,
|
||||
fill: fill ? fill : config.hologramFill,
|
||||
stroke: config.hologramStroke,
|
||||
strokeThickness: 1,
|
||||
font: "fixedsys"
|
||||
}
|
||||
kbBuffer: {
|
||||
x: 350, ///Position of the keyboard buffer fill on screen
|
||||
y: 35,
|
||||
},
|
||||
cubot: {
|
||||
tint: 0xFFFFFF,
|
||||
hoverTint: 0x00FF00,
|
||||
lowEnergyTint: 0xCC0000,
|
||||
walkDuration: 800, //walk animation duration in ms
|
||||
lowEnergy: 100, //Low energy threshold to change color
|
||||
otherCubotAlpha: 0.6,
|
||||
},
|
||||
biomass: {
|
||||
tint: 0x63B85F,
|
||||
tintHover: 0x00FF00,
|
||||
},
|
||||
tile: {
|
||||
hover: 0x00FF00,
|
||||
vaultWall: 0x3F2D2A,
|
||||
vaultFloor: 0x2B1E1C,
|
||||
fluid: 0x0ACED6,
|
||||
ore: 0xF3F3F3,
|
||||
plain: 0xFFFFFF,
|
||||
wall: 0xDDDDDD,
|
||||
plainSprite: "tiles/tile",
|
||||
magneticSprite: "tiles/magneticTile",
|
||||
wallSprite: "tiles/bigTile",
|
||||
wallSprite2: "tiles/bigTile2",
|
||||
},
|
||||
item: {
|
||||
ironColor: 0x434341,
|
||||
copperColor: 0xC87D38,
|
||||
blueprintColor: 0xaced6,
|
||||
},
|
||||
portal: {
|
||||
tint: 0xff43c8,
|
||||
},
|
||||
text: {
|
||||
textFill: "#FFFFFF",
|
||||
textStroke: "#9298a8",
|
||||
textIron: "#434341",
|
||||
textCopper: "#C87D38",
|
||||
hologramFill: "#0aced6",
|
||||
hologramStroke: "#12FFB0",
|
||||
selfUsername: 0xFB4D0A, //Color of own Cubot's username.
|
||||
bigMessageFill: "#ff803d",
|
||||
holoStyle: (fill: string) => {
|
||||
return {
|
||||
fontSize: 32,
|
||||
fill: fill ? fill : config.text.hologramFill,
|
||||
stroke: config.text.hologramStroke,
|
||||
strokeThickness: 1,
|
||||
font: "fixedsys"
|
||||
}
|
||||
},
|
||||
},
|
||||
arrow: {
|
||||
tint: 0xFFFFFF,
|
||||
tintHover: 0x00FF00,
|
||||
},
|
||||
kbBufferX: 350, ///Position of the keyboard buffer fill on screen
|
||||
kbBufferY: 35,
|
||||
arrowTextStyle: {
|
||||
fontSize: 32,
|
||||
fill: "#ffffff",
|
||||
@@ -50,15 +73,9 @@ let config = {
|
||||
strokeThickness: 1,
|
||||
font: "fixedsys"
|
||||
},
|
||||
lowEnergy: 100, //Low energy threshold to change color
|
||||
lowEnergyTint: 0xCC0000,
|
||||
bigMessageFill: "#ff803d",
|
||||
arrowTint: 0xFFFFFF,
|
||||
arrowHoverTint: 0x00FF00,
|
||||
selfUsernameColor: 0xFB4D0A, //Color of own Cubot's username.
|
||||
otherCubotAlpha: 0.6,
|
||||
defaultWorldSize: 16 //Will fallback to this when server does not provide world width
|
||||
|
||||
world: {
|
||||
defaultSize: 16 //Will fallback to this when server does not provide world width
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -102,18 +119,21 @@ class Util {
|
||||
|
||||
switch (item) {
|
||||
case 1:
|
||||
return config.biomassTint;
|
||||
return config.biomass.tint;
|
||||
case 3:
|
||||
return config.itemIron;
|
||||
return config.item.ironColor;
|
||||
case 4:
|
||||
return config.itemCopper;
|
||||
|
||||
return config.item.copperColor;
|
||||
case 5:
|
||||
return config.item.blueprintColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Debug {
|
||||
|
||||
public static SELF_ID = "";
|
||||
|
||||
public static setTileAt(x, y, newTile) {
|
||||
mar.client.sendDebugCommand({
|
||||
t: "debug", command: "setTileAt", x: x, y: y, newTile: newTile,
|
||||
|
||||
Reference in New Issue
Block a user