improved turtle kernel

This commit is contained in:
Djeeberjr 2022-04-13 21:39:59 +02:00
parent 96c6595846
commit 82939e53cc

View File

@ -6,11 +6,11 @@ using tink.CoreApi;
class Turtle { class Turtle {
public static var instance:Turtle; public static var instance:Turtle;
public static var MAX_SLOTS(default, null):Int = 15; public static final MAX_SLOTS:Int = 16;
@:allow(kernel.Init) @:allow(kernel.Init)
private function new() { private function new() {
if (!Turtle.isTurtle()){ if (!Turtle.isTurtle()) {
Log.warn("Tried to initialize Turtle, but it is not available."); Log.warn("Tried to initialize Turtle, but it is not available.");
} }
} }
@ -200,7 +200,8 @@ class Turtle {
return cc.Turtle.compareTo(otherSlot + 1); return cc.Turtle.compareTo(otherSlot + 1);
} }
public function transferToSlot(to:TurtleSlot, ?count:Int):Outcome<Noise, Noise> { public function transfer(from:TurtleSlot, to:TurtleSlot, ?count:Int):Outcome<Noise, Noise> {
this.selectSlot(from);
var r = cc.Turtle.transferTo(to + 1, count); var r = cc.Turtle.transferTo(to + 1, count);
return r ? Outcome.Success(null) : Outcome.Failure(null); return r ? Outcome.Success(null) : Outcome.Failure(null);
} }