mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-13 14:49:03 +00:00
Improved World update performance. Decreased save file size. Added Harvester NPC #19.
This commit is contained in:
@@ -77,8 +77,8 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit {
|
||||
@Override
|
||||
public JSONObject serialise() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("id", getObjectId());
|
||||
json.put("type", ID);
|
||||
json.put("i", getObjectId());
|
||||
json.put("t", ID);
|
||||
json.put("x", getX());
|
||||
json.put("y", getY());
|
||||
json.put("direction", getDirection().ordinal());
|
||||
@@ -98,7 +98,7 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit {
|
||||
public static Cubot deserialize(JSONObject json) {
|
||||
|
||||
Cubot cubot = new Cubot();
|
||||
cubot.setObjectId((int) (long) json.get("id"));
|
||||
cubot.setObjectId((int) (long) json.get("i"));
|
||||
cubot.setX((int) (long) json.get("x"));
|
||||
cubot.setY((int) (long) json.get("y"));
|
||||
cubot.hp = (int) (long) json.get("hp");
|
||||
|
||||
@@ -25,7 +25,7 @@ public class CubotPlugin extends ServerPlugin implements GameObjectDeserializer,
|
||||
@Override
|
||||
public GameObject deserializeObject(JSONObject object) {
|
||||
|
||||
int objType = (int) (long) object.get("type");
|
||||
int objType = (int) (long) object.get("t");
|
||||
|
||||
if (objType == Cubot.ID) {
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ public class UserCreationListener implements GameEventListener {
|
||||
GameServer.INSTANCE.getConfig().getInt("new_user_worldX"),
|
||||
GameServer.INSTANCE.getConfig().getInt("new_user_worldY")));
|
||||
cubot.getWorld().getGameObjects().add(cubot);
|
||||
cubot.getWorld().incUpdatable();
|
||||
|
||||
cubot.setObjectId(GameServer.INSTANCE.getGameUniverse().getNextObjectId());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user