reformat and squash errors
This commit is contained in:
parent
f8a788f91c
commit
0066b81461
@ -1 +1,2 @@
|
||||
--lua main.lua
|
||||
--lua main.lua
|
||||
--class-path src
|
@ -8,8 +8,7 @@ extern class ComputerCraft {
|
||||
public static function write(text:String):Void;
|
||||
public static function print(text:String):Void;
|
||||
public static function printError(message:String):Void;
|
||||
public static function read(?replaceChar:String, ?history:Table<Int, String>, ?completeFn:String->Table<Int, String>, ?default: String
|
||||
):String;
|
||||
public static function read(?replaceChar:String, ?history:Table<Int, String>, ?completeFn:String->Table<Int, String>, ?defaultValue:String):String;
|
||||
public static var _HOST:String;
|
||||
public static var _CC_DEFAULT_SETTINGS:String;
|
||||
}
|
||||
|
236
src/cc/Keys.hx
236
src/cc/Keys.hx
@ -2,126 +2,126 @@ package cc;
|
||||
|
||||
@:native("keys")
|
||||
extern class Keys {
|
||||
public static function getName(code: Int): String;
|
||||
public static inline function getCode(name: String): Int {
|
||||
public static function getName(code:Int):String;
|
||||
public static inline function getCode(name:String):Int {
|
||||
// i know this is bad please don't judge me
|
||||
return (cast Keys)[cast name];
|
||||
}
|
||||
|
||||
public static var a: Int;
|
||||
public static var c: Int;
|
||||
public static var b: Int;
|
||||
public static var e: Int;
|
||||
public static var pageUp: Int;
|
||||
public static var g: Int;
|
||||
public static var f: Int;
|
||||
public static var i: Int;
|
||||
public static var h: Int;
|
||||
public static var k: Int;
|
||||
public static var j: Int;
|
||||
public static var space: Int;
|
||||
public static var l: Int;
|
||||
public static var o: Int;
|
||||
public static var n: Int;
|
||||
public static var q: Int;
|
||||
public static var f1: Int;
|
||||
public static var s: Int;
|
||||
public static var a:Int;
|
||||
public static var c:Int;
|
||||
public static var b:Int;
|
||||
public static var e:Int;
|
||||
public static var pageUp:Int;
|
||||
public static var g:Int;
|
||||
public static var f:Int;
|
||||
public static var i:Int;
|
||||
public static var h:Int;
|
||||
public static var k:Int;
|
||||
public static var j:Int;
|
||||
public static var space:Int;
|
||||
public static var l:Int;
|
||||
public static var o:Int;
|
||||
public static var n:Int;
|
||||
public static var q:Int;
|
||||
public static var f1:Int;
|
||||
public static var s:Int;
|
||||
// public static var return: Int;
|
||||
public static var f5: Int;
|
||||
public static var seven: Int;
|
||||
public static var w: Int;
|
||||
public static var numPadEnter: Int;
|
||||
public static var y: Int;
|
||||
public static var x: Int;
|
||||
public static var numPad6: Int;
|
||||
public static var z: Int;
|
||||
public static var backslash: Int;
|
||||
public static var rightBracket: Int;
|
||||
public static var f9: Int;
|
||||
public static var yen: Int;
|
||||
public static var left: Int;
|
||||
public static var numPadSubtract: Int;
|
||||
public static var noconvert: Int;
|
||||
public static var leftCtrl: Int;
|
||||
public static var rightCtrl: Int;
|
||||
public static var numPad2: Int;
|
||||
public static var insert: Int;
|
||||
public static var delete: Int;
|
||||
public static var f4: Int;
|
||||
public static var grave: Int;
|
||||
public static var leftAlt: Int;
|
||||
public static var numPad8: Int;
|
||||
public static var numLock: Int;
|
||||
public static var four: Int;
|
||||
public static var rightAlt: Int;
|
||||
public static var pause: Int;
|
||||
public static var numPad0: Int;
|
||||
public static var numPadEquals: Int;
|
||||
public static var enter: Int;
|
||||
public static var down: Int;
|
||||
public static var eight: Int;
|
||||
public static var f11: Int;
|
||||
public static var six: Int;
|
||||
public static var r: Int;
|
||||
public static var rightShift: Int;
|
||||
public static var t: Int;
|
||||
public static var u: Int;
|
||||
public static var pageDown: Int;
|
||||
public static var nine: Int;
|
||||
public static var zero: Int;
|
||||
public static var capsLock: Int;
|
||||
public static var p: Int;
|
||||
public static var leftBracket: Int;
|
||||
public static var underscore: Int;
|
||||
public static var scollLock: Int;
|
||||
public static var minus: Int;
|
||||
public static var f14: Int;
|
||||
public static var m: Int;
|
||||
public static var cimcumflex: Int;
|
||||
public static var one: Int;
|
||||
public static var up: Int;
|
||||
public static var equals: Int;
|
||||
public static var d: Int;
|
||||
public static var f7: Int;
|
||||
public static var apostrophe: Int;
|
||||
public static var numPad9: Int;
|
||||
public static var f15: Int;
|
||||
public static var stop: Int;
|
||||
public static var f10: Int;
|
||||
public static var numPad7: Int;
|
||||
public static var numPad3: Int;
|
||||
public static var comma: Int;
|
||||
public static var numPadAdd: Int;
|
||||
public static var tab: Int;
|
||||
public static var numPad4: Int;
|
||||
public static var f3: Int;
|
||||
public static var kana: Int;
|
||||
public static var numPad1: Int;
|
||||
public static var right: Int;
|
||||
public static var numPadDecimal: Int;
|
||||
public static var f2: Int;
|
||||
public static var leftShift: Int;
|
||||
public static var backspace: Int;
|
||||
public static var convert: Int;
|
||||
public static var end: Int;
|
||||
public static var three: Int;
|
||||
public static var kanji: Int;
|
||||
public static var v: Int;
|
||||
public static var colon: Int;
|
||||
public static var semiColon: Int;
|
||||
public static var two: Int;
|
||||
public static var f13: Int;
|
||||
public static var multiply: Int;
|
||||
public static var period: Int;
|
||||
public static var ax: Int;
|
||||
public static var slash: Int;
|
||||
public static var f6: Int;
|
||||
public static var at: Int;
|
||||
public static var numPadDivide: Int;
|
||||
public static var numPad5: Int;
|
||||
public static var f12: Int;
|
||||
public static var f8: Int;
|
||||
public static var home: Int;
|
||||
public static var five: Int;
|
||||
public static var numPadComma: Int;
|
||||
}
|
||||
public static var f5:Int;
|
||||
public static var seven:Int;
|
||||
public static var w:Int;
|
||||
public static var numPadEnter:Int;
|
||||
public static var y:Int;
|
||||
public static var x:Int;
|
||||
public static var numPad6:Int;
|
||||
public static var z:Int;
|
||||
public static var backslash:Int;
|
||||
public static var rightBracket:Int;
|
||||
public static var f9:Int;
|
||||
public static var yen:Int;
|
||||
public static var left:Int;
|
||||
public static var numPadSubtract:Int;
|
||||
public static var noconvert:Int;
|
||||
public static var leftCtrl:Int;
|
||||
public static var rightCtrl:Int;
|
||||
public static var numPad2:Int;
|
||||
public static var insert:Int;
|
||||
public static var delete:Int;
|
||||
public static var f4:Int;
|
||||
public static var grave:Int;
|
||||
public static var leftAlt:Int;
|
||||
public static var numPad8:Int;
|
||||
public static var numLock:Int;
|
||||
public static var four:Int;
|
||||
public static var rightAlt:Int;
|
||||
public static var pause:Int;
|
||||
public static var numPad0:Int;
|
||||
public static var numPadEquals:Int;
|
||||
public static var enter:Int;
|
||||
public static var down:Int;
|
||||
public static var eight:Int;
|
||||
public static var f11:Int;
|
||||
public static var six:Int;
|
||||
public static var r:Int;
|
||||
public static var rightShift:Int;
|
||||
public static var t:Int;
|
||||
public static var u:Int;
|
||||
public static var pageDown:Int;
|
||||
public static var nine:Int;
|
||||
public static var zero:Int;
|
||||
public static var capsLock:Int;
|
||||
public static var p:Int;
|
||||
public static var leftBracket:Int;
|
||||
public static var underscore:Int;
|
||||
public static var scollLock:Int;
|
||||
public static var minus:Int;
|
||||
public static var f14:Int;
|
||||
public static var m:Int;
|
||||
public static var cimcumflex:Int;
|
||||
public static var one:Int;
|
||||
public static var up:Int;
|
||||
public static var equals:Int;
|
||||
public static var d:Int;
|
||||
public static var f7:Int;
|
||||
public static var apostrophe:Int;
|
||||
public static var numPad9:Int;
|
||||
public static var f15:Int;
|
||||
public static var stop:Int;
|
||||
public static var f10:Int;
|
||||
public static var numPad7:Int;
|
||||
public static var numPad3:Int;
|
||||
public static var comma:Int;
|
||||
public static var numPadAdd:Int;
|
||||
public static var tab:Int;
|
||||
public static var numPad4:Int;
|
||||
public static var f3:Int;
|
||||
public static var kana:Int;
|
||||
public static var numPad1:Int;
|
||||
public static var right:Int;
|
||||
public static var numPadDecimal:Int;
|
||||
public static var f2:Int;
|
||||
public static var leftShift:Int;
|
||||
public static var backspace:Int;
|
||||
public static var convert:Int;
|
||||
public static var end:Int;
|
||||
public static var three:Int;
|
||||
public static var kanji:Int;
|
||||
public static var v:Int;
|
||||
public static var colon:Int;
|
||||
public static var semiColon:Int;
|
||||
public static var two:Int;
|
||||
public static var f13:Int;
|
||||
public static var multiply:Int;
|
||||
public static var period:Int;
|
||||
public static var ax:Int;
|
||||
public static var slash:Int;
|
||||
public static var f6:Int;
|
||||
public static var at:Int;
|
||||
public static var numPadDivide:Int;
|
||||
public static var numPad5:Int;
|
||||
public static var f12:Int;
|
||||
public static var f8:Int;
|
||||
public static var home:Int;
|
||||
public static var five:Int;
|
||||
public static var numPadComma:Int;
|
||||
}
|
||||
|
@ -5,11 +5,11 @@ import haxe.extern.Rest;
|
||||
|
||||
@:native("multishell")
|
||||
extern class Multishell {
|
||||
public static function getCurrent(): Int;
|
||||
public static function getCount(): Int;
|
||||
public static function launch(environment: Table<Dynamic, Dynamic>, path: String, args: Rest<String>): Int;
|
||||
public static function setFocus(id: Int): Void;
|
||||
public static function setTitle(id: Int, title: String): Void;
|
||||
public static function getTitle(id: Int): String;
|
||||
public static function getFocus(): Int;
|
||||
}
|
||||
public static function getCurrent():Int;
|
||||
public static function getCount():Int;
|
||||
public static function launch(environment:Table<Dynamic, Dynamic>, path:String, args:Rest<String>):Int;
|
||||
public static function setFocus(id:Int):Void;
|
||||
public static function setTitle(id:Int, title:String):Void;
|
||||
public static function getTitle(id:Int):String;
|
||||
public static function getFocus():Int;
|
||||
}
|
||||
|
46
src/cc/OS.hx
46
src/cc/OS.hx
@ -6,33 +6,33 @@ import haxe.extern.Rest;
|
||||
|
||||
@:native("os")
|
||||
extern class OS {
|
||||
public static function version(): String;
|
||||
public static function getComputerID(): Int;
|
||||
public static function getComputerLabel(): String;
|
||||
public static function setComputerLabel(label: String): Void;
|
||||
public static function run(environment: Table<Dynamic, Dynamic>, path: String, args: Rest<String>): Bool;
|
||||
public static function loadAPI(path: String): Bool;
|
||||
public static function unloadAPI(path: String): Void;
|
||||
public static function queueEvent(type: String, data: Rest<Dynamic>): Void;
|
||||
public static function clock(): Float;
|
||||
public static function startTimer(timeout: Int): Int;
|
||||
public static function cancelTimer(id: Int): Void;
|
||||
public static function time(): Float;
|
||||
public static function sleep(timeout: Float): Void;
|
||||
public static function day(): Int;
|
||||
public static function setAlarm(time: Float): Int;
|
||||
public static function cancelAlarm(id: Int): Void;
|
||||
public static function shutdown(): Void;
|
||||
public static function reboot(): Void;
|
||||
public static function version():String;
|
||||
public static function getComputerID():Int;
|
||||
public static function getComputerLabel():String;
|
||||
public static function setComputerLabel(label:String):Void;
|
||||
public static function run(environment:Table<Dynamic, Dynamic>, path:String, args:Rest<String>):Bool;
|
||||
public static function loadAPI(path:String):Bool;
|
||||
public static function unloadAPI(path:String):Void;
|
||||
public static function queueEvent(type:String, data:Rest<Dynamic>):Void;
|
||||
public static function clock():Float;
|
||||
public static function startTimer(timeout:Int):Int;
|
||||
public static function cancelTimer(id:Int):Void;
|
||||
public static function time():Float;
|
||||
public static function sleep(timeout:Float):Void;
|
||||
public static function day():Int;
|
||||
public static function setAlarm(time:Float):Int;
|
||||
public static function cancelAlarm(id:Int):Void;
|
||||
public static function shutdown():Void;
|
||||
public static function reboot():Void;
|
||||
|
||||
@:native("pullEvent") private static function _pullEvent(?type: String): Dynamic;
|
||||
@:native("pullEventRaw") private static function _pullEventRaw(?type: String): Dynamic;
|
||||
@:native("pullEvent") private static function _pullEvent(?type:String):Dynamic;
|
||||
@:native("pullEventRaw") private static function _pullEventRaw(?type:String):Dynamic;
|
||||
|
||||
public static inline function pullEvent(?type: String): Table<Int, Dynamic> {
|
||||
public static inline function pullEvent(?type:String):Table<Int, Dynamic> {
|
||||
return cast TableTools.pack(_pullEvent(type));
|
||||
}
|
||||
|
||||
public static inline function pullEventRaw(?type: String): Table<Int, Dynamic> {
|
||||
public static inline function pullEventRaw(?type:String):Table<Int, Dynamic> {
|
||||
return cast TableTools.pack(_pullEventRaw(type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ typedef Image = Table<Int, Table<Int, Int>>;
|
||||
|
||||
@:native("paintutils")
|
||||
extern class PaintUtils {
|
||||
public static function loadImage(path: String): Image;
|
||||
public static function drawImage(image: Image, x: Int, y: Int): Void;
|
||||
public static function drawPixel(x: Int, y: Int, ?color: Color): Void;
|
||||
public static function drawLine(startX: Int, startY: Int, endX: Int, endY: Int, ?color: Color): Void;
|
||||
public static function drawBox(startX: Int, startY: Int, endX: Int, endY: Int, ?color: Color): Void;
|
||||
public static function drawFilledBox(startX: Int, startY: Int, endX: Int, endY: Int, ?color: Color): Void;
|
||||
}
|
||||
public static function loadImage(path:String):Image;
|
||||
public static function drawImage(image:Image, x:Int, y:Int):Void;
|
||||
public static function drawPixel(x:Int, y:Int, ?color:Color):Void;
|
||||
public static function drawLine(startX:Int, startY:Int, endX:Int, endY:Int, ?color:Color):Void;
|
||||
public static function drawBox(startX:Int, startY:Int, endX:Int, endY:Int, ?color:Color):Void;
|
||||
public static function drawFilledBox(startX:Int, startY:Int, endX:Int, endY:Int, ?color:Color):Void;
|
||||
}
|
||||
|
@ -5,6 +5,6 @@ import haxe.extern.Rest;
|
||||
|
||||
@:native("parallel")
|
||||
extern class Parallel {
|
||||
public static function waitForAny(f1: Function, funcs: Rest<Function>): Int;
|
||||
public static function waitForAll(f1: Function, funcs: Rest<Function>): Int;
|
||||
}
|
||||
public static function waitForAny(f1:Function, funcs:Rest<Function>):Int;
|
||||
public static function waitForAll(f1:Function, funcs:Rest<Function>):Int;
|
||||
}
|
||||
|
@ -6,11 +6,11 @@ import haxe.extern.Rest;
|
||||
|
||||
@:native("peripheral")
|
||||
extern class Peripheral {
|
||||
public static function isPresent(name: String): Bool;
|
||||
public static function getType(name: String): String;
|
||||
public static function getMethods(name: String): Table<String, Function>;
|
||||
public static function call<T>(name: String, method: String, args: Rest<Dynamic>): T;
|
||||
public static function wrap<T>(name: String): T;
|
||||
public static function find<T>(type: String, ?filter: (String, T) -> Bool): Table<Int, T>;
|
||||
public static function getNames(): Table<Int, String>;
|
||||
}
|
||||
public static function isPresent(name:String):Bool;
|
||||
public static function getType(name:String):String;
|
||||
public static function getMethods(name:String):Table<String, Function>;
|
||||
public static function call<T>(name:String, method:String, args:Rest<Dynamic>):T;
|
||||
public static function wrap<T>(name:String):T;
|
||||
public static function find<T>(type:String, ?filter:(String, T) -> Bool):Table<Int, T>;
|
||||
public static function getNames():Table<Int, String>;
|
||||
}
|
||||
|
@ -6,30 +6,30 @@ import lua.TableTools;
|
||||
typedef MessageData = Dynamic;
|
||||
|
||||
@:multiReturn
|
||||
extern class ReceivedMessage<T : MessageData> {
|
||||
public var senderID: Int;
|
||||
public var message: T;
|
||||
public var distance: Float;
|
||||
public var protocol: String;
|
||||
extern class ReceivedMessage<T:MessageData> {
|
||||
public var senderID:Int;
|
||||
public var message:T;
|
||||
public var distance:Float;
|
||||
public var protocol:String;
|
||||
}
|
||||
|
||||
@:native("rednet")
|
||||
extern class Rednet {
|
||||
public static function open(modem: String): Void;
|
||||
public static function close(modem: String): Void;
|
||||
public static function send(to: Int, data: MessageData, ?protocol: String): Void;
|
||||
public static function broadcast(data: MessageData, ?protocol: String): Void;
|
||||
public static function receive<T : MessageData>(?protocol: String, ?timeout: Int): ReceivedMessage<T>;
|
||||
public static function isOpen(modem: String): Bool;
|
||||
public static function host(protocol: String, hostname: String): Void;
|
||||
public static function unhost(protocol: String, hostname: String): Void;
|
||||
public static function open(modem:String):Void;
|
||||
public static function close(modem:String):Void;
|
||||
public static function send(to:Int, data:MessageData, ?protocol:String):Void;
|
||||
public static function broadcast(data:MessageData, ?protocol:String):Void;
|
||||
public static function receive<T:MessageData>(?protocol:String, ?timeout:Int):ReceivedMessage<T>;
|
||||
public static function isOpen(modem:String):Bool;
|
||||
public static function host(protocol:String, hostname:String):Void;
|
||||
public static function unhost(protocol:String, hostname:String):Void;
|
||||
|
||||
@:native("lookup")
|
||||
private static function _lookup(protocol: String, ?hostname: String): Dynamic;
|
||||
private static function _lookup(protocol:String, ?hostname:String):Dynamic;
|
||||
|
||||
public static inline function lookup(protocol: String, ?hostname: String): Table<Int, Int> {
|
||||
public static inline function lookup(protocol:String, ?hostname:String):Table<Int, Int> {
|
||||
return TableTools.pack(_lookup(protocol, hostname));
|
||||
}
|
||||
|
||||
public static function run(): Void;
|
||||
}
|
||||
public static function run():Void;
|
||||
}
|
||||
|
@ -5,15 +5,15 @@ import cc.Colors;
|
||||
|
||||
@:native("redstone")
|
||||
extern class Redstone {
|
||||
public static function getSides(): Table<Int, String>;
|
||||
public static function getInput(side: String): Bool;
|
||||
public static function setOutput(side: String, state: Bool): Void;
|
||||
public static function getOutput(side: String): Bool;
|
||||
public static function getAnalogInput(side: String): Int;
|
||||
public static function setAnalogOutput(side: String, strength: Int): Void;
|
||||
public static function getAnalogOutput(side: String): Int;
|
||||
public static function getBundledInput(side: String): Color;
|
||||
public static function setBundledOutput(side: String, state: Color): Void;
|
||||
public static function getBundledOutput(side: String): Color;
|
||||
public static function testBundledInput(side: String, value: Color): Bool;
|
||||
}
|
||||
public static function getSides():Table<Int, String>;
|
||||
public static function getInput(side:String):Bool;
|
||||
public static function setOutput(side:String, state:Bool):Void;
|
||||
public static function getOutput(side:String):Bool;
|
||||
public static function getAnalogInput(side:String):Int;
|
||||
public static function setAnalogOutput(side:String, strength:Int):Void;
|
||||
public static function getAnalogOutput(side:String):Int;
|
||||
public static function getBundledInput(side:String):Color;
|
||||
public static function setBundledOutput(side:String, state:Color):Void;
|
||||
public static function getBundledOutput(side:String):Color;
|
||||
public static function testBundledInput(side:String, value:Color):Bool;
|
||||
}
|
||||
|
@ -6,11 +6,11 @@ typedef SettingData = Dynamic;
|
||||
|
||||
@:native("settings")
|
||||
extern class Settings {
|
||||
public static function set(name: String, value: SettingData): Void;
|
||||
public static function get(name: String, ?defaultValue: SettingData): SettingData;
|
||||
public static function unset(name: String): Void;
|
||||
public static function clear(): Void;
|
||||
public static function getNames(): Table<Int, String>;
|
||||
public static function load(path: String): Bool;
|
||||
public static function save(path: String): Bool;
|
||||
}
|
||||
public static function set(name:String, value:SettingData):Void;
|
||||
public static function get(name:String, ?defaultValue:SettingData):SettingData;
|
||||
public static function unset(name:String):Void;
|
||||
public static function clear():Void;
|
||||
public static function getNames():Table<Int, String>;
|
||||
public static function load(path:String):Bool;
|
||||
public static function save(path:String):Bool;
|
||||
}
|
||||
|
@ -5,20 +5,20 @@ import haxe.extern.Rest;
|
||||
|
||||
@:native("shell")
|
||||
extern class Shell {
|
||||
public static function exit(): Void;
|
||||
public static function dir(): String;
|
||||
public static function setDir(path: String): Void;
|
||||
public static function path(): String;
|
||||
public static function setPath(path: String): Void;
|
||||
public static function resolve(localPath: String): String;
|
||||
public static function resolveProgram(name: String): String;
|
||||
public static function aliases(): Table<String, String>;
|
||||
public static function setAlias(alias: String, program: String): Void;
|
||||
public static function clearAlias(alias: String): Void;
|
||||
public static function programs(?showHidden: Bool): Table<Int, String>;
|
||||
public static function getRunningProgram(): String;
|
||||
public static function run(command: String, args: Rest<String>): Bool;
|
||||
public static function openTab(command: String, args: Rest<String>): Int;
|
||||
public static function switchTab(tabID: Int): Void;
|
||||
public static function exit():Void;
|
||||
public static function dir():String;
|
||||
public static function setDir(path:String):Void;
|
||||
public static function path():String;
|
||||
public static function setPath(path:String):Void;
|
||||
public static function resolve(localPath:String):String;
|
||||
public static function resolveProgram(name:String):String;
|
||||
public static function aliases():Table<String, String>;
|
||||
public static function setAlias(alias:String, program:String):Void;
|
||||
public static function clearAlias(alias:String):Void;
|
||||
public static function programs(?showHidden:Bool):Table<Int, String>;
|
||||
public static function getRunningProgram():String;
|
||||
public static function run(command:String, args:Rest<String>):Bool;
|
||||
public static function openTab(command:String, args:Rest<String>):Int;
|
||||
public static function switchTab(tabID:Int):Void;
|
||||
// todo: completion functions
|
||||
}
|
||||
|
@ -4,52 +4,52 @@ import cc.Colors;
|
||||
|
||||
@:multiReturn
|
||||
extern class TerminalPosition {
|
||||
public var x: Int;
|
||||
public var y: Int;
|
||||
public var x:Int;
|
||||
public var y:Int;
|
||||
}
|
||||
|
||||
@:multiReturn
|
||||
extern class TerminalSize {
|
||||
public var width: Int;
|
||||
public var height: Int;
|
||||
public var width:Int;
|
||||
public var height:Int;
|
||||
}
|
||||
|
||||
@:luaDotMethod
|
||||
extern class TerminalObject {
|
||||
public function write(text: String): Void;
|
||||
public function blit(text: String, colors: String, background: String): Void;
|
||||
public function clear(): Void;
|
||||
public function clearLine(): Void;
|
||||
public function getCursorPos(): TerminalPosition;
|
||||
public function setCursorPos(x: Int, y: Int): Void;
|
||||
public function setCursorBlink(value: Bool): Void;
|
||||
public function isColor(): Bool;
|
||||
public function getSize(): TerminalSize;
|
||||
public function scroll(lines: Int): Void;
|
||||
public function setTextColor(color: Color): Void;
|
||||
public function getTextColor(): Color;
|
||||
public function setBackgroundColor(color: Color): Void;
|
||||
public function getBackgroundColor(): Color;
|
||||
public function write(text:String):Void;
|
||||
public function blit(text:String, colors:String, background:String):Void;
|
||||
public function clear():Void;
|
||||
public function clearLine():Void;
|
||||
public function getCursorPos():TerminalPosition;
|
||||
public function setCursorPos(x:Int, y:Int):Void;
|
||||
public function setCursorBlink(value:Bool):Void;
|
||||
public function isColor():Bool;
|
||||
public function getSize():TerminalSize;
|
||||
public function scroll(lines:Int):Void;
|
||||
public function setTextColor(color:Color):Void;
|
||||
public function getTextColor():Color;
|
||||
public function setBackgroundColor(color:Color):Void;
|
||||
public function getBackgroundColor():Color;
|
||||
}
|
||||
|
||||
@:native("term")
|
||||
extern class Term {
|
||||
public static function write(text: String): Void;
|
||||
public static function blit(text: String, colors: String, background: String): Void;
|
||||
public static function clear(): Void;
|
||||
public static function clearLine(): Void;
|
||||
public static function getCursorPos(): TerminalPosition;
|
||||
public static function setCursorPos(x: Int, y: Int): Void;
|
||||
public static function setCursorBlink(value: Bool): Void;
|
||||
public static function isColor(): Bool;
|
||||
public static function getSize(): TerminalSize;
|
||||
public static function scroll(lines: Int): Void;
|
||||
public static function setTextColor(color: Color): Void;
|
||||
public static function getTextColor(): Color;
|
||||
public static function setBackgroundColor(color: Color): Void;
|
||||
public static function getBackgroundColor(): Color;
|
||||
public static function write(text:String):Void;
|
||||
public static function blit(text:String, colors:String, background:String):Void;
|
||||
public static function clear():Void;
|
||||
public static function clearLine():Void;
|
||||
public static function getCursorPos():TerminalPosition;
|
||||
public static function setCursorPos(x:Int, y:Int):Void;
|
||||
public static function setCursorBlink(value:Bool):Void;
|
||||
public static function isColor():Bool;
|
||||
public static function getSize():TerminalSize;
|
||||
public static function scroll(lines:Int):Void;
|
||||
public static function setTextColor(color:Color):Void;
|
||||
public static function getTextColor():Color;
|
||||
public static function setBackgroundColor(color:Color):Void;
|
||||
public static function getBackgroundColor():Color;
|
||||
|
||||
public static function redirect(target: TerminalObject): TerminalObject;
|
||||
public static function current(): TerminalObject;
|
||||
public static function native(): TerminalObject;
|
||||
}
|
||||
public static function redirect(target:TerminalObject):TerminalObject;
|
||||
public static function current():TerminalObject;
|
||||
public static function native():TerminalObject;
|
||||
}
|
||||
|
@ -4,14 +4,14 @@ typedef TextUtilsSerializable = Dynamic;
|
||||
|
||||
@:native("textutils")
|
||||
extern class TextUtils {
|
||||
public static function slowWrite(text: String, ?rate: Float): Void;
|
||||
public static function slowPrint(text: String, ?rate: Float): Void;
|
||||
public static function formatTime(time: Float, ?twentyFourHour: Bool): String;
|
||||
public static function slowWrite(text:String, ?rate:Float):Void;
|
||||
public static function slowPrint(text:String, ?rate:Float):Void;
|
||||
public static function formatTime(time:Float, ?twentyFourHour:Bool):String;
|
||||
// todo: tabulate, paged tabulate
|
||||
public static function pagedPrint(text: String, freeLines: Int): Int;
|
||||
public static function serialize(data: TextUtilsSerializable): String;
|
||||
public static function unserialize<T : TextUtilsSerializable>(from: String): T;
|
||||
public static function serializeJSON(data: TextUtilsSerializable, ?unquoteKeys: Bool): String;
|
||||
public static function urlEncode(data: String): String;
|
||||
public static function pagedPrint(text:String, freeLines:Int):Int;
|
||||
public static function serialize(data:TextUtilsSerializable):String;
|
||||
public static function unserialize<T:TextUtilsSerializable>(from:String):T;
|
||||
public static function serializeJSON(data:TextUtilsSerializable, ?unquoteKeys:Bool):String;
|
||||
public static function urlEncode(data:String):String;
|
||||
// todo: complete
|
||||
}
|
||||
}
|
||||
|
108
src/cc/Turtle.hx
108
src/cc/Turtle.hx
@ -4,71 +4,71 @@ import haxe.extern.EitherType;
|
||||
|
||||
@:multiReturn
|
||||
extern class TurtleActionResult {
|
||||
public var successful: Bool;
|
||||
public var error: String;
|
||||
public var successful:Bool;
|
||||
public var error:String;
|
||||
}
|
||||
|
||||
extern class TurtleItemDetail {
|
||||
public var name: String;
|
||||
public var damage: Int;
|
||||
public var count: Int;
|
||||
public var name:String;
|
||||
public var damage:Int;
|
||||
public var count:Int;
|
||||
}
|
||||
|
||||
extern class TurtleBlockDetail {
|
||||
public var name: String;
|
||||
public var metadata: Int;
|
||||
public var state: Dynamic;
|
||||
public var name:String;
|
||||
public var metadata:Int;
|
||||
public var state:Dynamic;
|
||||
}
|
||||
|
||||
@:multiReturn
|
||||
extern class TurtleInspectResult {
|
||||
public var successful: Bool;
|
||||
public var result: EitherType<String, TurtleBlockDetail>;
|
||||
public var successful:Bool;
|
||||
public var result:EitherType<String, TurtleBlockDetail>;
|
||||
}
|
||||
|
||||
@:native("turtle")
|
||||
extern class Turtle {
|
||||
public static function craft(qty: Int): TurtleActionResult;
|
||||
public static function forward(): TurtleActionResult;
|
||||
public static function back(): TurtleActionResult;
|
||||
public static function up(): TurtleActionResult;
|
||||
public static function down(): TurtleActionResult;
|
||||
public static function turnLeft(): TurtleActionResult;
|
||||
public static function turnRight(): TurtleActionResult;
|
||||
public static function select(slot: Int): Bool;
|
||||
public static function getSelectedSlot(): Int;
|
||||
public static function getItemCount(?slot: Int): Int;
|
||||
public static function getItemSpace(?slot: Int): Int;
|
||||
public static function getItemDetail(?slot: Int): TurtleItemDetail;
|
||||
public static function equipLeft(): TurtleActionResult;
|
||||
public static function equipRight(): TurtleActionResult;
|
||||
public static function attack(): TurtleActionResult;
|
||||
public static function attackUp(): TurtleActionResult;
|
||||
public static function attackDown(): TurtleActionResult;
|
||||
public static function dig(): TurtleActionResult;
|
||||
public static function digUp(): TurtleActionResult;
|
||||
public static function digDown(): TurtleActionResult;
|
||||
public static function place(?signText: String): TurtleActionResult;
|
||||
public static function placeUp(): TurtleActionResult;
|
||||
public static function placeDown(): TurtleActionResult;
|
||||
public static function detect(): Bool;
|
||||
public static function detectUp(): Bool;
|
||||
public static function detectDown(): Bool;
|
||||
public static function inspect(): TurtleInspectResult;
|
||||
public static function inspectUp(): TurtleInspectResult;
|
||||
public static function inspectDown(): TurtleInspectResult;
|
||||
public static function compare(): Bool;
|
||||
public static function compareUp(): Bool;
|
||||
public static function compareDown(): Bool;
|
||||
public static function compareTo(slot: Int): Bool;
|
||||
public static function drop(?count: Int): TurtleActionResult;
|
||||
public static function dropUp(?count: Int): TurtleActionResult;
|
||||
public static function dropDown(?count: Int): TurtleActionResult;
|
||||
public static function suck(?amount: Int): TurtleActionResult;
|
||||
public static function suckUp(?amount: Int): TurtleActionResult;
|
||||
public static function suckDown(?amount: Int): TurtleActionResult;
|
||||
public static function refuel(?qty: Int): TurtleActionResult;
|
||||
public static function getFuelLevel(): Int;
|
||||
public static function getFuelLimit(): Int;
|
||||
public static function transferTo(to: Int, ?qty: Int): Bool;
|
||||
}
|
||||
public static function craft(qty:Int):TurtleActionResult;
|
||||
public static function forward():TurtleActionResult;
|
||||
public static function back():TurtleActionResult;
|
||||
public static function up():TurtleActionResult;
|
||||
public static function down():TurtleActionResult;
|
||||
public static function turnLeft():TurtleActionResult;
|
||||
public static function turnRight():TurtleActionResult;
|
||||
public static function select(slot:Int):Bool;
|
||||
public static function getSelectedSlot():Int;
|
||||
public static function getItemCount(?slot:Int):Int;
|
||||
public static function getItemSpace(?slot:Int):Int;
|
||||
public static function getItemDetail(?slot:Int):TurtleItemDetail;
|
||||
public static function equipLeft():TurtleActionResult;
|
||||
public static function equipRight():TurtleActionResult;
|
||||
public static function attack():TurtleActionResult;
|
||||
public static function attackUp():TurtleActionResult;
|
||||
public static function attackDown():TurtleActionResult;
|
||||
public static function dig():TurtleActionResult;
|
||||
public static function digUp():TurtleActionResult;
|
||||
public static function digDown():TurtleActionResult;
|
||||
public static function place(?signText:String):TurtleActionResult;
|
||||
public static function placeUp():TurtleActionResult;
|
||||
public static function placeDown():TurtleActionResult;
|
||||
public static function detect():Bool;
|
||||
public static function detectUp():Bool;
|
||||
public static function detectDown():Bool;
|
||||
public static function inspect():TurtleInspectResult;
|
||||
public static function inspectUp():TurtleInspectResult;
|
||||
public static function inspectDown():TurtleInspectResult;
|
||||
public static function compare():Bool;
|
||||
public static function compareUp():Bool;
|
||||
public static function compareDown():Bool;
|
||||
public static function compareTo(slot:Int):Bool;
|
||||
public static function drop(?count:Int):TurtleActionResult;
|
||||
public static function dropUp(?count:Int):TurtleActionResult;
|
||||
public static function dropDown(?count:Int):TurtleActionResult;
|
||||
public static function suck(?amount:Int):TurtleActionResult;
|
||||
public static function suckUp(?amount:Int):TurtleActionResult;
|
||||
public static function suckDown(?amount:Int):TurtleActionResult;
|
||||
public static function refuel(?qty:Int):TurtleActionResult;
|
||||
public static function getFuelLevel():Int;
|
||||
public static function getFuelLimit():Int;
|
||||
public static function transferTo(to:Int, ?qty:Int):Bool;
|
||||
}
|
||||
|
@ -2,15 +2,15 @@ package cc;
|
||||
|
||||
@:native("vector")
|
||||
extern class Vector {
|
||||
@:native("new") public static function create(x: Int, y: Int, z: Int): Vector;
|
||||
@:native("new") public static function create(x:Int, y:Int, z:Int):Vector;
|
||||
|
||||
public function add(other: Vector): Vector;
|
||||
public function sub(other: Vector): Vector;
|
||||
public function mul(n: Float): Vector;
|
||||
public function dot(other: Vector): Float;
|
||||
public function cross(other: Vector): Float;
|
||||
public function length(): Float;
|
||||
public function normalize(): Vector;
|
||||
public function round(): Vector;
|
||||
@:native("tostring") public function toString(): String;
|
||||
public function add(other:Vector):Vector;
|
||||
public function sub(other:Vector):Vector;
|
||||
public function mul(n:Float):Vector;
|
||||
public function dot(other:Vector):Float;
|
||||
public function cross(other:Vector):Float;
|
||||
public function length():Float;
|
||||
public function normalize():Vector;
|
||||
public function round():Vector;
|
||||
@:native("tostring") public function toString():String;
|
||||
}
|
||||
|
@ -5,11 +5,11 @@ import cc.Term;
|
||||
@:native("window")
|
||||
@:luaDotMethod
|
||||
extern class Window extends TerminalObject {
|
||||
public static function create(parent: TerminalObject, x: Int, y: Int, width: Int, height: Int, ?visible: Bool): Window;
|
||||
public static function create(parent:TerminalObject, x:Int, y:Int, width:Int, height:Int, ?visible:Bool):Window;
|
||||
|
||||
public function setVisible(visible: Bool): Void;
|
||||
public function redraw(): Void;
|
||||
public function restoreCursor(): Void;
|
||||
public function getPosition(): TerminalPosition;
|
||||
public function reposition(x: Int, y: Int, ?width: Int, ?height: Int): Void;
|
||||
}
|
||||
public function setVisible(visible:Bool):Void;
|
||||
public function redraw():Void;
|
||||
public function restoreCursor():Void;
|
||||
public function getPosition():TerminalPosition;
|
||||
public function reposition(x:Int, y:Int, ?width:Int, ?height:Int):Void;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user