11local expect = require (" cc.expect" )
22
33local eturtle = {} do
4- local position , bearing , equipment
4+ local position , bearing , equipment , options
55
66 -- Constants
77 eturtle .SOUTH = 0.0
@@ -12,7 +12,7 @@ local eturtle = {} do
1212 -- Settings
1313 settings .define (" eturtle.statefile" , {description = " The path in which to store the turtle's state." , default = " .turtle" , type = " string" })
1414
15- -- Calibration Methods
15+ -- Calibration and Configuration Methods
1616 function eturtle .calibrateEquipment (automatically , defaultLeft , defaultRight )
1717 expect (1 , automatically , " nil" , " boolean" )
1818 if type (automatically ) == " boolean" then
@@ -380,4 +380,26 @@ local eturtle = {} do
380380 equipment = {success = calibrateEquipmentSuccess , message = calibrateEquipmentMessage }
381381 }
382382 end
383+
384+ -- Introspection Methods
385+ function eturtle .getPosition ()
386+ return vector .new (position .x , position .y , position .z )
387+ end
388+
389+ function eturtle .getBearing ()
390+ return bearing * math.pi
391+ end
392+
393+ function eturtle .getEquipment ()
394+ return {left = equipment .left , right = equipment .right }
395+ end
396+
397+ function eturtle .getSelectedSlot ()
398+ return turtle .getSelectedSlot ()
399+ end
400+
401+ function eturtle .getFuelLevel ()
402+ local fuelLevel = turtle .getFuelLevel ()
403+ return fuelLevel == " unlimited" and math.huge or fuelLevel
404+ end
383405end return eturtle
0 commit comments