mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-13 14:49:03 +00:00
Merge branch 'master' into vaults
# Conflicts: # Server/src/main/java/net/simon987/server/GameServer.java # Server/src/main/java/net/simon987/server/game/World.java
This commit is contained in:
@@ -74,7 +74,7 @@ public class Factory extends GameObject implements Updatable {
|
||||
npc.setObjectId(GameServer.INSTANCE.getGameUniverse().getNextObjectId());
|
||||
npc.setX(p.x);
|
||||
npc.setY(p.y);
|
||||
getWorld().getGameObjects().add(npc);
|
||||
getWorld().addObject(npc);
|
||||
getWorld().incUpdatable();
|
||||
npc.setFactory(this);
|
||||
|
||||
|
||||
@@ -33,14 +33,9 @@ public class HarvestTask extends NPCTask {
|
||||
|
||||
if (pause == 0) {
|
||||
//Get biomass
|
||||
ArrayList<GameObject> biomass = new ArrayList<>(10);
|
||||
|
||||
for (GameObject object : npc.getWorld().getGameObjects()) {
|
||||
//Plant MAP_INFO
|
||||
if ((object.getMapInfo() & 0x4000) == 0x4000) {
|
||||
biomass.add(object);
|
||||
}
|
||||
}
|
||||
/* todo replace by some sort of .collect call with object
|
||||
id (See https://github.com/simon987/Much-Assembly-Required/pull/66)*/
|
||||
ArrayList<GameObject> biomass = npc.getWorld().findObjects(0x4000);
|
||||
|
||||
//Get closest one
|
||||
int minDist = Integer.MAX_VALUE;
|
||||
|
||||
@@ -48,7 +48,9 @@ public class HarvesterNPC extends NonPlayerCharacter {
|
||||
@Override
|
||||
public void onDeadCallback() {
|
||||
|
||||
getFactory().getNpcs().remove(this);
|
||||
if (getFactory() != null && getFactory().getNpcs() != null) {
|
||||
getFactory().getNpcs().remove(this);
|
||||
}
|
||||
|
||||
GameServer.INSTANCE.getEventDispatcher().dispatch(
|
||||
new ObjectDeathEvent(this, ID));
|
||||
|
||||
@@ -53,7 +53,7 @@ public class WorldCreationListener implements GameEventListener {
|
||||
continue;
|
||||
}
|
||||
|
||||
world.getGameObjects().add(factory);
|
||||
world.addObject(factory);
|
||||
world.incUpdatable();
|
||||
|
||||
LogManager.LOGGER.info("Spawned Factory at (" + world.getX() + ", " + world.getY() +
|
||||
@@ -84,7 +84,7 @@ public class WorldCreationListener implements GameEventListener {
|
||||
|
||||
if (radioTower.getAdjacentTile() != null) {
|
||||
//Radio Tower has adjacent tiles
|
||||
world.getGameObjects().add(radioTower);
|
||||
world.addObject(radioTower);
|
||||
world.incUpdatable(); //In case the Factory couldn't be spawned.
|
||||
|
||||
NpcPlugin.getRadioTowers().add(radioTower);
|
||||
|
||||
Reference in New Issue
Block a user