diff --git a/Plugin Cubot/src/main/java/net/simon987/cubotplugin/Cubot.java b/Plugin Cubot/src/main/java/net/simon987/cubotplugin/Cubot.java index 69aebbb..e153c9e 100644 --- a/Plugin Cubot/src/main/java/net/simon987/cubotplugin/Cubot.java +++ b/Plugin Cubot/src/main/java/net/simon987/cubotplugin/Cubot.java @@ -34,6 +34,8 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit { private int energy; private int maxEnergy; + private static final float SOLAR_PANEL_MULTIPLIER = 1; + public Cubot() { } @@ -46,6 +48,8 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit { @Override public void update() { + storeEnergy((int) (SOLAR_PANEL_MULTIPLIER * GameServer.INSTANCE.getDayNightCycle().getSunIntensity())); + if (currentAction == Action.WALKING) { if (spendEnergy(100)) { if (!incrementLocation()) { @@ -170,7 +174,11 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit { energy -= spent; return true; } + } + public void storeEnergy(int qty) { + + energy = Math.min(energy + qty, maxEnergy); } diff --git a/Server/src/main/java/net/simon987/server/game/World.java b/Server/src/main/java/net/simon987/server/game/World.java index 6d8ef82..dfea379 100644 --- a/Server/src/main/java/net/simon987/server/game/World.java +++ b/Server/src/main/java/net/simon987/server/game/World.java @@ -5,7 +5,6 @@ import net.simon987.server.event.GameEvent; import net.simon987.server.event.WorldUpdateEvent; import net.simon987.server.game.pathfinding.Pathfinder; import net.simon987.server.io.JSONSerialisable; -import net.simon987.server.logging.LogManager; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -99,7 +98,7 @@ public class World implements JSONSerialisable { //Clean up dead objects if (object.isDead()) { gameObjects.remove(object); - LogManager.LOGGER.fine("Removed object " + object + " id: " + object.getObjectId()); + //LogManager.LOGGER.fine("Removed object " + object + " id: " + object.getObjectId()); } else if (object instanceof Updatable) { ((Updatable) object).update(); } diff --git a/plugins/Cubot.jar b/plugins/Cubot.jar index 9d3d984..3c676ff 100644 Binary files a/plugins/Cubot.jar and b/plugins/Cubot.jar differ