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);
}
}
}
}

View File

@ -5,7 +5,7 @@ import org.bson.Document;
public class ItemCopper extends Item {
public static final int ID = 0x0003;
public static final int ID = 0x0004;
@Override
public int getId() {

View File

@ -4,7 +4,7 @@ import org.bson.Document;
public class ItemIron extends Item {
public static final int ID = 0x0004;
public static final int ID = 0x0003;
@Override
public int getId() {

View File

@ -1,7 +1,14 @@
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({__proto__: []} instanceof Array && function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
};
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }