make turtle slot 0 based in kernel
This commit is contained in:
parent
8339c69ecc
commit
96c6595846
@ -6,6 +6,7 @@ using tink.CoreApi;
|
||||
|
||||
class Turtle {
|
||||
public static var instance:Turtle;
|
||||
public static var MAX_SLOTS(default, null):Int = 15;
|
||||
|
||||
@:allow(kernel.Init)
|
||||
private function new() {
|
||||
@ -109,7 +110,7 @@ class Turtle {
|
||||
public function selectSlot(slot:TurtleSlot):Outcome<Noise, Noise> {
|
||||
// TODO: slot in bounds?
|
||||
|
||||
var r = cc.Turtle.select(slot);
|
||||
var r = cc.Turtle.select(slot + 1);
|
||||
|
||||
return (r) ? Outcome.Success(null) : Outcome.Failure("Slot out of bounds");
|
||||
}
|
||||
@ -117,13 +118,13 @@ class Turtle {
|
||||
public function getItemCount(?slot:TurtleSlot):Int {
|
||||
// TODO: slot in bounds?
|
||||
|
||||
return cc.Turtle.getItemCount(slot);
|
||||
return cc.Turtle.getItemCount(slot + 1);
|
||||
}
|
||||
|
||||
public function getItemSpace(?slot:TurtleSlot):Int {
|
||||
// TODO: slot in bounds?
|
||||
|
||||
return cc.Turtle.getItemSpace(slot);
|
||||
return cc.Turtle.getItemSpace(slot + 1);
|
||||
}
|
||||
|
||||
public function detect(dir:InteractDirections):Bool {
|
||||
@ -196,16 +197,16 @@ class Turtle {
|
||||
}
|
||||
|
||||
public function compareSlot(otherSlot:TurtleSlot):Bool {
|
||||
return cc.Turtle.compareTo(otherSlot);
|
||||
return cc.Turtle.compareTo(otherSlot + 1);
|
||||
}
|
||||
|
||||
public function transferToSlot(to:TurtleSlot, ?count:Int):Outcome<Noise, Noise> {
|
||||
var r = cc.Turtle.transferTo(to, count);
|
||||
var r = cc.Turtle.transferTo(to + 1, count);
|
||||
return r ? Outcome.Success(null) : Outcome.Failure(null);
|
||||
}
|
||||
|
||||
public function getSelectedSlot():TurtleSlot {
|
||||
return cc.Turtle.getSelectedSlot();
|
||||
return cc.Turtle.getSelectedSlot() - 1;
|
||||
}
|
||||
|
||||
public function getFuelLimit():Int {
|
||||
@ -245,7 +246,7 @@ class Turtle {
|
||||
}
|
||||
|
||||
public function getItemDetail(?detailed:Bool = false, ?slot:TurtleSlot):Option<ItemInspect> {
|
||||
var r = cc.Turtle.getItemDetail(slot); // FIXME: can take detailed as flag. Has to be fixed upstream
|
||||
var r = cc.Turtle.getItemDetail(slot + 1); // FIXME: can take detailed as flag. Has to be fixed upstream
|
||||
|
||||
if (r == null) {
|
||||
return None;
|
||||
|
Loading…
Reference in New Issue
Block a user