mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-13 14:49:03 +00:00
Move hologram-related fields to proper class. Breaks existing database saves!
This commit is contained in:
@@ -2,11 +2,13 @@ package net.simon987.server.assembly;
|
||||
|
||||
|
||||
import net.simon987.server.game.objects.ControllableUnit;
|
||||
import net.simon987.server.io.JSONSerialisable;
|
||||
import net.simon987.server.io.MongoSerializable;
|
||||
import org.bson.Document;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
|
||||
public abstract class HardwareModule implements MongoSerializable {
|
||||
public abstract class HardwareModule implements MongoSerializable, JSONSerialisable {
|
||||
|
||||
private CPU cpu;
|
||||
|
||||
@@ -35,6 +37,25 @@ public abstract class HardwareModule implements MongoSerializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("{%s}", getClass().getSimpleName());
|
||||
JSONObject hwJson = jsonSerialise();
|
||||
return String.format("{%s: {%s}}", getClass().getSimpleName(), hwJson == null ? "" : hwJson);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
|
||||
}
|
||||
|
||||
public void update() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject jsonSerialise() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject debugJsonSerialise() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
5
Server/src/main/resources/static/js/mar.js
vendored
5
Server/src/main/resources/static/js/mar.js
vendored
@@ -1023,7 +1023,8 @@ var Cubot = (function (_super) {
|
||||
this.makeLaserAttack();
|
||||
}
|
||||
this.updateDirection();
|
||||
this.updateHologram(json.holoMode, json.holoC, json.holo, json.holoStr);
|
||||
var holoHw = json["net.simon987.cubotplugin.CubotHologram"];
|
||||
this.updateHologram(holoHw.mode, holoHw.color, holoHw.value, holoHw.string);
|
||||
this.setShield(this.shield > 0);
|
||||
};
|
||||
Cubot.prototype.updateHologram = function (holoMode, holoColor, holoValue, holoStr) {
|
||||
@@ -1579,7 +1580,6 @@ var FluidTile = (function (_super) {
|
||||
}(Tile));
|
||||
var MagneticTile = (function (_super) {
|
||||
__extends(MagneticTile, _super);
|
||||
|
||||
function MagneticTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.magneticSprite, 0) || this;
|
||||
_this.baseTint = 0xFFFFFF;
|
||||
@@ -1588,7 +1588,6 @@ var MagneticTile = (function (_super) {
|
||||
_this.tileType = "Magnetic tile";
|
||||
return _this;
|
||||
}
|
||||
|
||||
MagneticTile.prototype.onHover = function () {
|
||||
mar.game.add.tween(this).to({isoZ: this.baseZ + 30}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.tileIndicator.tileX = this.tileX;
|
||||
|
||||
@@ -326,7 +326,8 @@ class Cubot extends GameObject {
|
||||
}
|
||||
|
||||
this.updateDirection();
|
||||
this.updateHologram(json.holoMode, json.holoC, json.holo, json.holoStr);
|
||||
let holoHw = json["net.simon987.cubotplugin.CubotHologram"];
|
||||
this.updateHologram(holoHw.mode, holoHw.color, holoHw.value, holoHw.string);
|
||||
|
||||
//Update shield
|
||||
this.setShield(this.shield > 0)
|
||||
|
||||
Reference in New Issue
Block a user