mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-13 14:49:03 +00:00
Added biomass respawn feature #22
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package net.simon987.npcplugin;
|
||||
|
||||
import net.simon987.npcplugin.event.WorldUpdateListener;
|
||||
import net.simon987.server.ServerConfiguration;
|
||||
import net.simon987.server.game.GameObject;
|
||||
import net.simon987.server.io.GameObjectDeserializer;
|
||||
import net.simon987.server.logging.LogManager;
|
||||
@@ -11,7 +12,7 @@ public class NpcPlugin extends ServerPlugin implements GameObjectDeserializer {
|
||||
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
public void init(ServerConfiguration configuration) {
|
||||
|
||||
listeners.add(new WorldUpdateListener());
|
||||
|
||||
|
||||
@@ -35,19 +35,17 @@ public class WorldUpdateListener implements GameEventListener {
|
||||
|
||||
NonPlayerCharacter npc = new HarvesterNPC();
|
||||
|
||||
//todo set max iteration
|
||||
Point p = null;
|
||||
while (p == null) {
|
||||
p = world.getRandomPassableTile();
|
||||
Point p = world.getRandomPassableTile();
|
||||
|
||||
if (p != null) {
|
||||
npc.setWorld(world);
|
||||
npc.setObjectId(GameServer.INSTANCE.getGameUniverse().getNextObjectId());
|
||||
npc.setX(p.x);
|
||||
npc.setY(p.y);
|
||||
world.getGameObjects().add(npc);
|
||||
}
|
||||
|
||||
|
||||
npc.setWorld(world);
|
||||
npc.setObjectId(GameServer.INSTANCE.getGameUniverse().getNextObjectId());
|
||||
npc.setX(p.x);
|
||||
npc.setY(p.y);
|
||||
|
||||
world.getGameObjects().add(npc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user