diff --git a/src/kernel/Init.hx b/src/kernel/Init.hx index 53f92d4..fe976aa 100644 --- a/src/kernel/Init.hx +++ b/src/kernel/Init.hx @@ -1,5 +1,6 @@ package kernel; +import kernel.turtle.Turtle; import haxe.MainLoop; import kernel.net.Routing; import cc.OS; @@ -18,6 +19,10 @@ class Init { MainTerm.instance = new MainTerm(); Log.init(); + if (Turtle.isTurtle()){ + Turtle.instance = new Turtle(); + } + Routing.instance = new Routing(); Net.instance = new Net(); diff --git a/src/kernel/turtle/Turtle.hx b/src/kernel/turtle/Turtle.hx index 80f55af..be1e6f3 100644 --- a/src/kernel/turtle/Turtle.hx +++ b/src/kernel/turtle/Turtle.hx @@ -4,9 +4,16 @@ import kernel.turtle.Types; using tink.CoreApi; -typedef TurtleSlot = Int; - class Turtle { + public static var instance:Turtle; + + @:allow(kernel.Init) + private function new() { + if (!Turtle.isTurtle()){ + Log.warn("Tried to initialize Turtle, but it is not available."); + } + } + public static function isTurtle():Bool { return true; // TODO: Implement } diff --git a/src/kernel/turtle/Types.hx b/src/kernel/turtle/Types.hx index 0d80521..928eaea 100644 --- a/src/kernel/turtle/Types.hx +++ b/src/kernel/turtle/Types.hx @@ -22,3 +22,5 @@ typedef ItemInspect = { public var damage:Int; public var count:Int; } + +typedef TurtleSlot = Int;