mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-13 22:59:02 +00:00
Cubot object id is no longer stored inside every CpuHardware in the database. Renamed some fields in the database to make them more readable
This commit is contained in:
@@ -44,7 +44,7 @@ public class ElectricBox extends GameObject implements Updatable, Attackable {
|
||||
|
||||
public ElectricBox(Document document) {
|
||||
super(document);
|
||||
hp = (int) document.get("hp");
|
||||
hp = document.getInteger("hp");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,11 +53,7 @@ public class Factory extends GameObject implements Updatable {
|
||||
public Factory(Document document) {
|
||||
super(document);
|
||||
|
||||
setObjectId((long) document.get("i"));
|
||||
setX((int) document.get("x"));
|
||||
setY((int) document.get("y"));
|
||||
|
||||
tmpNpcArray = ((ArrayList) document.get("tmpNpcArray")).toArray();
|
||||
tmpNpcArray = ((ArrayList) document.get("npcs")).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,13 +74,12 @@ public class Factory extends GameObject implements Updatable {
|
||||
|
||||
for (Object id : tmpNpcArray) {
|
||||
|
||||
NonPlayerCharacter npc = (NonPlayerCharacter) GameServer.INSTANCE.getGameUniverse().getObject((int) (long) id);
|
||||
NonPlayerCharacter npc = (NonPlayerCharacter) GameServer.INSTANCE.getGameUniverse().getObject((long) id);
|
||||
|
||||
if (npc != null) {
|
||||
npc.setFactory(this);
|
||||
npcs.add(npc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tmpNpcArray = null;
|
||||
@@ -139,7 +134,7 @@ public class Factory extends GameObject implements Updatable {
|
||||
tmpNpcArray.add(npc.getObjectId());
|
||||
}
|
||||
|
||||
dbObject.put("n", tmpNpcArray);
|
||||
dbObject.put("npcs", tmpNpcArray);
|
||||
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ public class HarvesterNPC extends NonPlayerCharacter {
|
||||
public HarvesterNPC(Document document) {
|
||||
super(document);
|
||||
|
||||
setTask(new HarvestTask());
|
||||
|
||||
setDirection(Direction.getDirection(document.getInteger("direction")));
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ public class RadioReceiverHardware extends CpuHardware {
|
||||
this.cubot = cubot;
|
||||
}
|
||||
|
||||
public RadioReceiverHardware(Document document) {
|
||||
super(document);
|
||||
public RadioReceiverHardware(Document document, ControllableUnit unit) {
|
||||
super(document, unit);
|
||||
|
||||
this.cubot = (ControllableUnit) GameServer.INSTANCE.getGameUniverse().getObject((long) document.get("cubot"));
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class VaultDoor extends GameObject implements Programmable, Enterable, Up
|
||||
|
||||
dbObject.put("homeX", getHomeX());
|
||||
dbObject.put("homeY", getHomeY());
|
||||
dbObject.put("pw", new String(password));
|
||||
dbObject.put("password", new String(password));
|
||||
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user