mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-14 07:09:04 +00:00
wip
This commit is contained in:
@@ -94,6 +94,23 @@ public class Memory implements Target, MongoSerializable {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read count words from the memory
|
||||
*
|
||||
* @return null if out of bounds
|
||||
*/
|
||||
public char[] read(int offset, int count) {
|
||||
|
||||
if (offset + count > this.words.length || count < 0 || offset < 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
char[] chars = new char[count];
|
||||
System.arraycopy(words, offset, chars, 0, count);
|
||||
|
||||
return chars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value at an address
|
||||
*
|
||||
|
||||
@@ -20,4 +20,9 @@ public interface InventoryHolder {
|
||||
* @return true if the InventoryHolder can provide this item
|
||||
*/
|
||||
boolean canTakeItem(int itemId);
|
||||
|
||||
/**
|
||||
* @return true if the InventoryHolder can receive this item
|
||||
*/
|
||||
boolean canPlaceItem(int itemId);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ItemsContainer extends GameObject implements InventoryHolder {
|
||||
|
||||
@Override
|
||||
public boolean placeItem(Item item) {
|
||||
if (items.size() < containerCapacity) {
|
||||
if (canPlaceItem(item.getId())) {
|
||||
items.add(item);
|
||||
return true;
|
||||
} else {
|
||||
@@ -40,6 +40,11 @@ public class ItemsContainer extends GameObject implements InventoryHolder {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceItem(int itemId) {
|
||||
return (items.size() < containerCapacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void takeItem(int itemId) {
|
||||
Optional<Item> first = items.stream()
|
||||
|
||||
@@ -11376,120 +11376,24 @@
|
||||
"y": 0.5
|
||||
}
|
||||
},
|
||||
"objects/GOURD_PLANT": {
|
||||
"objects/obstacle": {
|
||||
"frame": {
|
||||
"x": 768,
|
||||
"y": 1050,
|
||||
"w": 32,
|
||||
"h": 32
|
||||
"w": 128,
|
||||
"h": 114
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 32,
|
||||
"h": 32
|
||||
"w": 128,
|
||||
"h": 114
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 32,
|
||||
"h": 32
|
||||
},
|
||||
"pivot": {
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
}
|
||||
},
|
||||
"objects/kiln": {
|
||||
"frame": {
|
||||
"x": 800,
|
||||
"y": 1050,
|
||||
"w": 116,
|
||||
"h": 117
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 116,
|
||||
"h": 117
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 116,
|
||||
"h": 117
|
||||
},
|
||||
"pivot": {
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
}
|
||||
},
|
||||
"objects/kiln_s": {
|
||||
"frame": {
|
||||
"x": 916,
|
||||
"y": 1050,
|
||||
"w": 116,
|
||||
"h": 117
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 116,
|
||||
"h": 117
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 116,
|
||||
"h": 117
|
||||
},
|
||||
"pivot": {
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
}
|
||||
},
|
||||
"objects/plant1": {
|
||||
"frame": {
|
||||
"x": 1032,
|
||||
"y": 1050,
|
||||
"w": 64,
|
||||
"h": 64
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 64,
|
||||
"h": 64
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 64,
|
||||
"h": 64
|
||||
},
|
||||
"pivot": {
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
}
|
||||
},
|
||||
"objects/plant1_s": {
|
||||
"frame": {
|
||||
"x": 1096,
|
||||
"y": 1050,
|
||||
"w": 64,
|
||||
"h": 64
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 64,
|
||||
"h": 64
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 64,
|
||||
"h": 64
|
||||
"w": 128,
|
||||
"h": 114
|
||||
},
|
||||
"pivot": {
|
||||
"x": 0.5,
|
||||
@@ -11498,7 +11402,7 @@
|
||||
},
|
||||
"objects/portal": {
|
||||
"frame": {
|
||||
"x": 1160,
|
||||
"x": 896,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 110
|
||||
@@ -11522,7 +11426,7 @@
|
||||
},
|
||||
"objects/RadioTower": {
|
||||
"frame": {
|
||||
"x": 1288,
|
||||
"x": 1024,
|
||||
"y": 1050,
|
||||
"w": 168,
|
||||
"h": 237
|
||||
@@ -11546,7 +11450,7 @@
|
||||
},
|
||||
"objects/rocket": {
|
||||
"frame": {
|
||||
"x": 1456,
|
||||
"x": 1192,
|
||||
"y": 1050,
|
||||
"w": 135,
|
||||
"h": 189
|
||||
@@ -11570,7 +11474,7 @@
|
||||
},
|
||||
"objects/shieldBack": {
|
||||
"frame": {
|
||||
"x": 1591,
|
||||
"x": 1327,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 70
|
||||
@@ -11594,7 +11498,7 @@
|
||||
},
|
||||
"objects/shieldFront": {
|
||||
"frame": {
|
||||
"x": 1719,
|
||||
"x": 1455,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 70
|
||||
@@ -11618,7 +11522,7 @@
|
||||
},
|
||||
"objects/VaultDoor": {
|
||||
"frame": {
|
||||
"x": 1847,
|
||||
"x": 1583,
|
||||
"y": 1050,
|
||||
"w": 213,
|
||||
"h": 170
|
||||
@@ -11642,7 +11546,7 @@
|
||||
},
|
||||
"objects/VaultDoor1": {
|
||||
"frame": {
|
||||
"x": 2060,
|
||||
"x": 1796,
|
||||
"y": 1050,
|
||||
"w": 139,
|
||||
"h": 150
|
||||
@@ -11666,7 +11570,7 @@
|
||||
},
|
||||
"objects/VaultDoorCrop": {
|
||||
"frame": {
|
||||
"x": 2199,
|
||||
"x": 1935,
|
||||
"y": 1050,
|
||||
"w": 137,
|
||||
"h": 150
|
||||
@@ -11690,7 +11594,7 @@
|
||||
},
|
||||
"objects/VaultDoorScreen/1": {
|
||||
"frame": {
|
||||
"x": 2336,
|
||||
"x": 2072,
|
||||
"y": 1050,
|
||||
"w": 20,
|
||||
"h": 18
|
||||
@@ -11714,7 +11618,7 @@
|
||||
},
|
||||
"objects/VaultDoorScreen/2": {
|
||||
"frame": {
|
||||
"x": 2356,
|
||||
"x": 2092,
|
||||
"y": 1050,
|
||||
"w": 20,
|
||||
"h": 18
|
||||
@@ -11738,7 +11642,7 @@
|
||||
},
|
||||
"objects/VaultDoorScreen/3": {
|
||||
"frame": {
|
||||
"x": 2376,
|
||||
"x": 2112,
|
||||
"y": 1050,
|
||||
"w": 20,
|
||||
"h": 18
|
||||
@@ -11762,7 +11666,7 @@
|
||||
},
|
||||
"objects/VaultDoorScreen/4": {
|
||||
"frame": {
|
||||
"x": 2396,
|
||||
"x": 2132,
|
||||
"y": 1050,
|
||||
"w": 20,
|
||||
"h": 18
|
||||
@@ -11786,7 +11690,7 @@
|
||||
},
|
||||
"objects/VaultDoorScreen/5": {
|
||||
"frame": {
|
||||
"x": 2416,
|
||||
"x": 2152,
|
||||
"y": 1050,
|
||||
"w": 20,
|
||||
"h": 18
|
||||
@@ -11810,7 +11714,7 @@
|
||||
},
|
||||
"objects/VaultDoorScreen/6": {
|
||||
"frame": {
|
||||
"x": 2436,
|
||||
"x": 2172,
|
||||
"y": 1050,
|
||||
"w": 20,
|
||||
"h": 18
|
||||
@@ -11834,7 +11738,7 @@
|
||||
},
|
||||
"tiles/bigTile": {
|
||||
"frame": {
|
||||
"x": 2456,
|
||||
"x": 2192,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 140
|
||||
@@ -11858,7 +11762,7 @@
|
||||
},
|
||||
"tiles/bigTile2": {
|
||||
"frame": {
|
||||
"x": 2584,
|
||||
"x": 2320,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 153
|
||||
@@ -11882,7 +11786,7 @@
|
||||
},
|
||||
"tiles/magneticTile": {
|
||||
"frame": {
|
||||
"x": 2712,
|
||||
"x": 2448,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 114
|
||||
@@ -11906,7 +11810,7 @@
|
||||
},
|
||||
"tiles/tile": {
|
||||
"frame": {
|
||||
"x": 2840,
|
||||
"x": 2576,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 114
|
||||
@@ -11930,7 +11834,7 @@
|
||||
},
|
||||
"ui/arrow_east": {
|
||||
"frame": {
|
||||
"x": 2968,
|
||||
"x": 2704,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
@@ -11954,7 +11858,7 @@
|
||||
},
|
||||
"ui/arrow_east_s": {
|
||||
"frame": {
|
||||
"x": 3070,
|
||||
"x": 2806,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
@@ -11978,7 +11882,7 @@
|
||||
},
|
||||
"ui/arrow_north": {
|
||||
"frame": {
|
||||
"x": 3172,
|
||||
"x": 2908,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
@@ -12002,7 +11906,7 @@
|
||||
},
|
||||
"ui/arrow_north_s": {
|
||||
"frame": {
|
||||
"x": 3274,
|
||||
"x": 3010,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
@@ -12026,7 +11930,7 @@
|
||||
},
|
||||
"ui/arrow_south": {
|
||||
"frame": {
|
||||
"x": 3376,
|
||||
"x": 3112,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
@@ -12050,7 +11954,7 @@
|
||||
},
|
||||
"ui/arrow_south_s": {
|
||||
"frame": {
|
||||
"x": 3478,
|
||||
"x": 3214,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
@@ -12074,7 +11978,7 @@
|
||||
},
|
||||
"ui/arrow_west": {
|
||||
"frame": {
|
||||
"x": 3580,
|
||||
"x": 3316,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
@@ -12098,7 +12002,7 @@
|
||||
},
|
||||
"ui/arrow_west_s": {
|
||||
"frame": {
|
||||
"x": 3682,
|
||||
"x": 3418,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
@@ -12122,7 +12026,7 @@
|
||||
},
|
||||
"ui/compass": {
|
||||
"frame": {
|
||||
"x": 3784,
|
||||
"x": 3520,
|
||||
"y": 1050,
|
||||
"w": 162,
|
||||
"h": 147
|
||||
@@ -12155,6 +12059,6 @@
|
||||
"h": 1287
|
||||
},
|
||||
"scale": "1",
|
||||
"smartupdate": "$TexturePacker:SmartUpdate:73c963294f55ee095af7f9f7c60b9d3d:93610d7ee804aa39ff18e2974a508abb:1eabdf11f75e3a4fe3147baf7b5be24b$"
|
||||
"smartupdate": "$TexturePacker:SmartUpdate:cabd9bbebff623bfa01a63c764edf16e:8b226981e250398faa4378b63606c23e:1eabdf11f75e3a4fe3147baf7b5be24b$"
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 581 KiB After Width: | Height: | Size: 573 KiB |
95
Server/src/main/resources/static/js/mar.js
vendored
95
Server/src/main/resources/static/js/mar.js
vendored
@@ -8,7 +8,7 @@ var __extends = (this && this.__extends) || (function () {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
};
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
@@ -336,6 +336,12 @@ var config = {
|
||||
},
|
||||
world: {
|
||||
defaultSize: 16
|
||||
},
|
||||
obstacle: {
|
||||
tint: 0x0aced6,
|
||||
},
|
||||
constructionSite: {
|
||||
tint: 0x0aced6,
|
||||
}
|
||||
};
|
||||
var Util = (function () {
|
||||
@@ -822,6 +828,7 @@ var GameClient = (function () {
|
||||
};
|
||||
return GameClient;
|
||||
}());
|
||||
var game = PIXI.game;
|
||||
var ObjectType;
|
||||
(function (ObjectType) {
|
||||
ObjectType["CUBOT"] = "net.simon987.cubotplugin.Cubot";
|
||||
@@ -830,10 +837,11 @@ var ObjectType;
|
||||
ObjectType["FACTORY"] = "net.simon987.npcplugin.Factory";
|
||||
ObjectType["RADIO_TOWER"] = "net.simon987.npcplugin.RadioTower";
|
||||
ObjectType["VAULT_DOOR"] = "net.simon987.npcplugin.VaultDoor";
|
||||
ObjectType["OBSTACLE"] = "net.simon987.npcplugin.Obstacle";
|
||||
ObjectType["OBSTACLE"] = "net.simon987.constructionplugin.Obstacle";
|
||||
ObjectType["ELECTRIC_BOX"] = "net.simon987.npcplugin.ElectricBox";
|
||||
ObjectType["PORTAL"] = "net.simon987.npcplugin.Portal";
|
||||
ObjectType["HACKED_NPC"] = "net.simon987.npcplugin.HackedNPC";
|
||||
ObjectType["CONSTRUCTION_SITE"] = "net.simon987.constructionplugin.ConstructionSite";
|
||||
})(ObjectType || (ObjectType = {}));
|
||||
var ItemType;
|
||||
(function (ItemType) {
|
||||
@@ -872,13 +880,15 @@ var GameObject = (function (_super) {
|
||||
case ObjectType.VAULT_DOOR:
|
||||
return new VaultDoor(json);
|
||||
case ObjectType.OBSTACLE:
|
||||
return null;
|
||||
return new Obstacle(json);
|
||||
case ObjectType.ELECTRIC_BOX:
|
||||
return new ElectricBox(json);
|
||||
case ObjectType.PORTAL:
|
||||
return new Portal(json);
|
||||
case ObjectType.HACKED_NPC:
|
||||
return new HackedNPC(json);
|
||||
case ObjectType.CONSTRUCTION_SITE:
|
||||
return new ConstructionSite(json);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -1287,7 +1297,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.biomass.tintHover;
|
||||
this.tint = config.biomass.tint;
|
||||
this.text.visible = false;
|
||||
};
|
||||
BiomassBlob.prototype.updateObject = function (json) {
|
||||
@@ -1446,6 +1456,83 @@ var ElectricBox = (function (_super) {
|
||||
};
|
||||
return ElectricBox;
|
||||
}(GameObject));
|
||||
var Obstacle = (function (_super) {
|
||||
__extends(Obstacle, _super);
|
||||
|
||||
function Obstacle(json) {
|
||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/obstacle") || this;
|
||||
_this.anchor.set(0.5, 0.3);
|
||||
_this.tint = config.obstacle.tint;
|
||||
_this.setText("Obstacle");
|
||||
_this.text.visible = false;
|
||||
_this.id = json.i;
|
||||
_this.tileX = json.x;
|
||||
_this.tileY = json.y;
|
||||
return _this;
|
||||
}
|
||||
|
||||
Obstacle.prototype.updateObject = function (json) {
|
||||
};
|
||||
Obstacle.prototype.onTileHover = function () {
|
||||
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.1, y: 1.1}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubot.hoverTint;
|
||||
this.text.visible = true;
|
||||
};
|
||||
Obstacle.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.portal.tint;
|
||||
this.text.visible = false;
|
||||
};
|
||||
return Obstacle;
|
||||
}(GameObject));
|
||||
var ConstructionSite = (function (_super) {
|
||||
__extends(ConstructionSite, _super);
|
||||
|
||||
function ConstructionSite(json) {
|
||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", ConstructionSite.getTargetSprite(json.blueprint.target)) || this;
|
||||
_this.anchor.set(0.5, 0.31);
|
||||
_this.tint = config.constructionSite.tint;
|
||||
_this.setText("Construction site");
|
||||
_this.text.visible = false;
|
||||
_this.setUpAlphaTween();
|
||||
_this.id = json.i;
|
||||
_this.tileX = json.x;
|
||||
_this.tileY = json.y;
|
||||
return _this;
|
||||
}
|
||||
|
||||
ConstructionSite.getTargetSprite = function (targetType) {
|
||||
switch (targetType) {
|
||||
case ObjectType.OBSTACLE:
|
||||
return "objects/obstacle";
|
||||
}
|
||||
};
|
||||
ConstructionSite.prototype.updateObject = function (json) {
|
||||
};
|
||||
ConstructionSite.prototype.setUpAlphaTween = function () {
|
||||
var alphaTween = mar.game.add.tween(this).to({alpha: 0.5}, 2000, Phaser.Easing.Linear.None, true, 0, -1);
|
||||
alphaTween.yoyo(true, 3000);
|
||||
};
|
||||
ConstructionSite.prototype.onTileHover = function () {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 19}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1.03, y: 1.03}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.setUpAlphaTween();
|
||||
this.text.visible = true;
|
||||
};
|
||||
ConstructionSite.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.03, y: 1.03}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.setUpAlphaTween();
|
||||
this.text.visible = false;
|
||||
};
|
||||
return ConstructionSite;
|
||||
}(GameObject));
|
||||
var Portal = (function (_super) {
|
||||
__extends(Portal, _super);
|
||||
function Portal(json) {
|
||||
|
||||
@@ -5,10 +5,11 @@ enum ObjectType {
|
||||
FACTORY = "net.simon987.npcplugin.Factory",
|
||||
RADIO_TOWER = "net.simon987.npcplugin.RadioTower",
|
||||
VAULT_DOOR = "net.simon987.npcplugin.VaultDoor",
|
||||
OBSTACLE = "net.simon987.npcplugin.Obstacle",
|
||||
OBSTACLE = "net.simon987.constructionplugin.Obstacle",
|
||||
ELECTRIC_BOX = "net.simon987.npcplugin.ElectricBox",
|
||||
PORTAL = "net.simon987.npcplugin.Portal",
|
||||
HACKED_NPC = "net.simon987.npcplugin.HackedNPC"
|
||||
HACKED_NPC = "net.simon987.npcplugin.HackedNPC",
|
||||
CONSTRUCTION_SITE = "net.simon987.constructionplugin.ConstructionSite"
|
||||
}
|
||||
|
||||
enum ItemType {
|
||||
@@ -71,13 +72,15 @@ abstract class GameObject extends Phaser.Plugin.Isometric.IsoSprite {
|
||||
case ObjectType.VAULT_DOOR:
|
||||
return new VaultDoor(json);
|
||||
case ObjectType.OBSTACLE:
|
||||
return null;
|
||||
return new Obstacle(json);
|
||||
case ObjectType.ELECTRIC_BOX:
|
||||
return new ElectricBox(json);
|
||||
case ObjectType.PORTAL:
|
||||
return new Portal(json);
|
||||
case ObjectType.HACKED_NPC:
|
||||
return new HackedNPC(json);
|
||||
case ObjectType.CONSTRUCTION_SITE:
|
||||
return new ConstructionSite(json);
|
||||
|
||||
default:
|
||||
return null;
|
||||
@@ -622,7 +625,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.biomass.tintHover;
|
||||
this.tint = config.biomass.tint;
|
||||
|
||||
this.text.visible = false;
|
||||
}
|
||||
@@ -848,6 +851,97 @@ class ElectricBox extends GameObject {
|
||||
}
|
||||
}
|
||||
|
||||
class Obstacle extends GameObject {
|
||||
|
||||
constructor(json) {
|
||||
super(Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/obstacle");
|
||||
this.anchor.set(0.5, 0.3);
|
||||
this.tint = config.obstacle.tint;
|
||||
|
||||
this.setText("Obstacle");
|
||||
this.text.visible = false;
|
||||
|
||||
this.id = json.i;
|
||||
this.tileX = json.x;
|
||||
this.tileY = json.y;
|
||||
}
|
||||
|
||||
updateObject(json): void {
|
||||
//noop
|
||||
}
|
||||
|
||||
public onTileHover() {
|
||||
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.1, y: 1.1}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubot.hoverTint;
|
||||
|
||||
this.text.visible = true;
|
||||
}
|
||||
|
||||
public onTileExit() {
|
||||
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.portal.tint;
|
||||
|
||||
this.text.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
class ConstructionSite extends GameObject {
|
||||
|
||||
private static getTargetSprite(targetType: string): string {
|
||||
switch (targetType) {
|
||||
case ObjectType.OBSTACLE:
|
||||
return "objects/obstacle";
|
||||
}
|
||||
}
|
||||
|
||||
constructor(json) {
|
||||
|
||||
super(Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", ConstructionSite.getTargetSprite(json.blueprint.target));
|
||||
this.anchor.set(0.5, 0.31);
|
||||
this.tint = config.constructionSite.tint;
|
||||
|
||||
this.setText("Construction site");
|
||||
this.text.visible = false;
|
||||
|
||||
this.setUpAlphaTween();
|
||||
|
||||
this.id = json.i;
|
||||
this.tileX = json.x;
|
||||
this.tileY = json.y;
|
||||
}
|
||||
|
||||
updateObject(json): void {
|
||||
//noop
|
||||
}
|
||||
|
||||
private setUpAlphaTween() {
|
||||
let alphaTween = mar.game.add.tween(this).to({alpha: 0.5},
|
||||
2000, Phaser.Easing.Linear.None, true, 0, -1);
|
||||
alphaTween.yoyo(true, 3000);
|
||||
}
|
||||
|
||||
public onTileHover() {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 19}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1.03, y: 1.03}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.setUpAlphaTween();
|
||||
|
||||
this.text.visible = true;
|
||||
}
|
||||
|
||||
public onTileExit() {
|
||||
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.03, y: 1.03}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.setUpAlphaTween();
|
||||
|
||||
this.text.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
class Portal extends GameObject {
|
||||
public onTileHover() {
|
||||
|
||||
@@ -78,6 +78,12 @@ let config = {
|
||||
},
|
||||
world: {
|
||||
defaultSize: 16 //Will fallback to this when server does not provide world width
|
||||
},
|
||||
obstacle: {
|
||||
tint: 0x0aced6, //todo
|
||||
},
|
||||
constructionSite: {
|
||||
tint: 0x0aced6, //todo
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user