Cubot drill module now functional

This commit is contained in:
Simon
2018-11-15 12:24:37 -05:00
parent 4be1bf2e8a
commit 6a9cfb3acb
4 changed files with 21 additions and 8 deletions

View File

@@ -1,8 +1,10 @@
package net.simon987.cubotplugin;
import net.simon987.server.assembly.Status;
import net.simon987.server.game.item.Item;
import net.simon987.server.game.objects.Action;
import net.simon987.server.game.objects.ControllableUnit;
import net.simon987.server.game.world.Tile;
import org.bson.Document;
public class CubotDrill extends CubotHardwareModule {
@@ -43,9 +45,13 @@ public class CubotDrill extends CubotHardwareModule {
if (cubot.spendEnergy(1400)) {
if (cubot.getCurrentAction() == Action.IDLE) {
//TODO: Get Tile instance and call onDig()
//int tile = cubot.getWorld().getTileMap().getTileIdAt(cubot.getX(), cubot.getY());
//cubot.setCurrentAction(Action.DIGGING);
Tile tile = cubot.getWorld().getTileMap().getTileAt(cubot.getX(), cubot.getY());
Item newItem = tile.drill();
if (newItem != null) {
cubot.setCurrentAction(Action.DIGGING);
cubot.giveItem(newItem);
}
}
}
}