update periphs to not be static

This commit is contained in:
Ramon Gonzalez Fernandez 2021-04-12 13:38:27 -04:00
parent 3faf729045
commit dcad97c81b
10 changed files with 79 additions and 78 deletions

View File

@ -7,9 +7,9 @@ extern class CommandResult {
} }
extern class Command { extern class Command {
public static function getCommand():String; public function getCommand():String;
public static function setCommand(command:String):Void; public function setCommand(command:String):Void;
public static function runCommand():CommandResult; public function runCommand():CommandResult;
} }

View File

@ -1,10 +1,10 @@
package cc.periphs; package cc.periphs;
extern class Computer { extern class Computer {
public static function turnOn():Void; // Turn the other computer on. public function turnOn():Void; // Turn the other computer on.
public static function shutdown():Void; // Shutdown the other computer. public function shutdown():Void; // Shutdown the other computer.
public static function reboot():Void; // Reboot or turn on the other computer. public function reboot():Void; // Reboot or turn on the other computer.
public static function getID():Int; // Get the other computer's ID. public function getID():Int; // Get the other computer's ID.
public static function isOn():Bool; // Determine if the other computer is on. public function isOn():Bool; // Determine if the other computer is on.
public static function getLabel():Null<String>; // Get the other computer's label. public function getLabel():Null<String>; // Get the other computer's label.
} }

View File

@ -1,15 +1,15 @@
package cc.periphs; package cc.periphs;
extern class Disk { extern class Disk {
public static function isDiskPresent():Bool; // Returns whether a disk is currently inserted in the drive. public function isDiskPresent():Bool; // Returns whether a disk is currently inserted in the drive.
public static function getDiskLabel():Null<String>; // Returns the label of the disk in the drive if available. public function getDiskLabel():Null<String>; // Returns the label of the disk in the drive if available.
public static function setDiskLabel(?label:String):Void; // Sets or clears the label for a disk. public function setDiskLabel(?label:String):Void; // Sets or clears the label for a disk.
public static function hasData():Bool; // Returns whether a disk with data is inserted. public function hasData():Bool; // Returns whether a disk with data is inserted.
public static function getMountPath():Null<String>; // Returns the mount path for the inserted disk. public function getMountPath():Null<String>; // Returns the mount path for the inserted disk.
public static function hasAudio():Bool; // Returns whether a disk with audio is inserted. public function hasAudio():Bool; // Returns whether a disk with audio is inserted.
public static function getAudioTitle():Null<String>; // Returns the title of the inserted audio disk. public function getAudioTitle():Null<String>; // Returns the title of the inserted audio disk.
public static function playAudio():Void; // Plays the audio in the inserted disk, if available. public function playAudio():Void; // Plays the audio in the inserted disk, if available.
public static function stopAudio():Void; // Stops any audio that may be playing. public function stopAudio():Void; // Stops any audio that may be playing.
public static function ejectDisk():Void; // Ejects any disk that may be in the drive. public function ejectDisk():Void; // Ejects any disk that may be in the drive.
public static function getDiskID():Int; // Returns the ID of the disk inserted in the drive. public function getDiskID():Int; // Returns the ID of the disk inserted in the drive.
} }

View File

@ -1,6 +1,6 @@
package cc.periphs; package cc.periphs;
extern class EnergyStorage { extern class EnergyStorage {
public static function getEnergy():Int; // Get the energy of this block. public function getEnergy():Int; // Get the energy of this block.
public static function getEnergyCapacity():Int; // Get the maximum amount of energy this block can store. public function getEnergyCapacity():Int; // Get the maximum amount of energy this block can store.
} }

View File

@ -3,7 +3,7 @@ package cc.periphs;
import lua.Table; import lua.Table;
extern class FluidStorage { extern class FluidStorage {
public static function tanks():Table<Int, Table<String, Any>>; public function tanks():Table<Int, Table<String, Any>>;
public static function pushFluid(toName:String, ?limit:Float, ?fluidName:String):Float; public function pushFluid(toName:String, ?limit:Float, ?fluidName:String):Float;
public static function pullFluid(fromName:String, ?limit:Float, ?fluidName:String):Float; public function pullFluid(fromName:String, ?limit:Float, ?fluidName:String):Float;
} }

View File

@ -9,14 +9,15 @@ interface ReducedItemInfo {
interface DetailedItemInfo extends ReducedItemInfo { interface DetailedItemInfo extends ReducedItemInfo {
public var displayName:String; public var displayName:String;
public var tag:Null<String>;
public var maxCount:Int; public var maxCount:Int;
public var tags:Table<String, Bool>; public var tags:Table<String, Bool>;
} }
extern class ItemStorage { extern class ItemStorage {
public static function size():Int; // Get the size of this inventory. public function size():Int; // Get the size of this inventory.
public static function list():Table<Int, ReducedItemInfo>; // List all items in this inventory. public function list():Table<Int, ReducedItemInfo>; // List all items in this inventory.
public static function getItemDetail(slot:Int):DetailedItemInfo; // Get detailed information about an item. public function getItemDetail(slot:Int):DetailedItemInfo; // Get detailed information about an item.
public static function pushItems(toName:String, fromSlot:Int, ?limit:Int, ?toSlot:Int):Int; // Push items from one inventory to another connected one. public function pushItems(toName:String, fromSlot:Int, ?limit:Int, ?toSlot:Int):Int; // Push items from one inventory to another connected one.
public static function pullItems(fromName:String, fromSlot:Int, ?limit:Int, ?toSlot:Int):Int; // Pull items from a connected inventory into this one. public function pullItems(fromName:String, fromSlot:Int, ?limit:Int, ?toSlot:Int):Int; // Pull items from a connected inventory into this one.
} }

View File

@ -3,15 +3,15 @@ package cc.periphs;
import lua.Table; import lua.Table;
extern class Modem { extern class Modem {
public static function open(channel:Int):Void; // Open a channel on a modem. public function open(channel:Int):Void; // Open a channel on a modem.
public static function isOpen(channel:Int):Bool; // Check if a channel is open. public function isOpen(channel:Int):Bool; // Check if a channel is open.
public static function close(channel:Int):Void; // Close an open channel, meaning it will no longer receive messages. public function close(channel:Int):Void; // Close an open channel, meaning it will no longer receive messages.
public static function closeAll():Void; // Close all open channels. public function closeAll():Void; // Close all open channels.
public static function transmit(channel:Int, replyChannel:Int, payload:Any):Void; // Sends a modem message on a certain channel. public function transmit(channel:Int, replyChannel:Int, payload:Any):Void; // Sends a modem message on a certain channel.
public static function isWireless():Bool; // Determine if this is a wired or wireless modem. public function isWireless():Bool; // Determine if this is a wired or wireless modem.
public static function getNamesRemote():Table<Int, String>; // List all remote peripherals on the wired network. public function getNamesRemote():Table<Int, String>; // List all remote peripherals on the wired network.
public static function isPresentRemote(name:String):Bool; // Determine if a peripheral is available on this wired network. public function isPresentRemote(name:String):Bool; // Determine if a peripheral is available on this wired network.
public static function getTypeRemote(name:String):String; // Get the type of a peripheral is available on this wired network. public function getTypeRemote(name:String):String; // Get the type of a peripheral is available on this wired network.
public static function getMethodsRemote(name:String):Table<Int, String>; // Get all available methods for the remote peripheral with the given name. public function getMethodsRemote(name:String):Table<Int, String>; // Get all available methods for the remote peripheral with the given name.
public static function getNameLocal():String; // Returns the network name of the current computer, if the modem is on. public function getNameLocal():String; // Returns the network name of the current computer, if the modem is on.
} }

View File

@ -16,31 +16,31 @@ extern class ColorData {
} }
extern class Monitor { extern class Monitor {
public static function setTextScale(scale:Float):Void; // Set the scale of this monitor. public function setTextScale(scale:Float):Void; // Set the scale of this monitor.
public static function getTextScale():Float; // Get the monitor's current text scale. public function getTextScale():Float; // Get the monitor's current text scale.
public static function write(text:String):Void; // Write text at the current cursor position, moving the cursor to the end of the text. public function write(text:String):Void; // Write text at the current cursor position, moving the cursor to the end of the text.
public static function scroll(y:Int):Void; // Move all positions up (or down) by y pixels. public function scroll(y:Int):Void; // Move all positions up (or down) by y pixels.
public static function getCursorPos():Position; // Get the position of the cursor. public function getCursorPos():Position; // Get the position of the cursor.
public static function setCursorPos(x:Int, y:Int):Void; // et the position of the cursor. public function setCursorPos(x:Int, y:Int):Void; // et the position of the cursor.
public static function getCursorBlink():Bool; // Checks if the cursor is currently blinking. public function getCursorBlink():Bool; // Checks if the cursor is currently blinking.
public static function setCursorBlink(blink:Bool):Void; // Sets whether the cursor should be visible (and blinking) at the current cursor position. public function setCursorBlink(blink:Bool):Void; // Sets whether the cursor should be visible (and blinking) at the current cursor position.
public static function getSize():Int; // Get the size of the terminal. public function getSize():Int; // Get the size of the terminal.
public static function clear():Void; // Clears the terminal, filling it with the current background colour. public function clear():Void; // Clears the terminal, filling it with the current background colour.
public static function clearLine():Void; // Clears the line the cursor is currently on, filling it with the current background colour. public function clearLine():Void; // Clears the line the cursor is currently on, filling it with the current background colour.
public static function getTextColour():Color; // Return the colour that new text will be written as. public function getTextColour():Color; // Return the colour that new text will be written as.
public static function getTextColor():Color; // Return the colour that new text will be written as. public function getTextColor():Color; // Return the colour that new text will be written as.
public static function setTextColour(colour:Color):Void; // Set the colour that new text will be written as. public function setTextColour(colour:Color):Void; // Set the colour that new text will be written as.
public static function setTextColor(colour:Color):Void; // Set the colour that new text will be written as. public function setTextColor(colour:Color):Void; // Set the colour that new text will be written as.
public static function getBackgroundColour():Color; // Return the current background colour. public function getBackgroundColour():Color; // Return the current background colour.
public static function getBackgroundColor():Color; // Return the current background colour. public function getBackgroundColor():Color; // Return the current background colour.
public static function setBackgroundColour(colour:Color):Void; // Set the current background colour. public function setBackgroundColour(colour:Color):Void; // Set the current background colour.
public static function setBackgroundColor(colour:Color):Void; // Set the current background colour. public function setBackgroundColor(colour:Color):Void; // Set the current background colour.
public static function isColour():Bool; // Determine if this terminal supports colour. public function isColour():Bool; // Determine if this terminal supports colour.
public static function isColor():Bool; // Determine if this terminal supports colour. public function isColor():Bool; // Determine if this terminal supports colour.
public static function blit(text:String, textColour:String, public function blit(text:String, textColour:String,
backgroundColour:String):Void; // Writes text to the terminal with the specific foreground and background characters. backgroundColour:String):Void; // Writes text to the terminal with the specific foreground and background characters.
public static function setPaletteColour(index:Color, packedColour:Int):Void; // Set the palette for a specific colour. public function setPaletteColour(index:Color, packedColour:Int):Void; // Set the palette for a specific colour.
public static function setPaletteColor(index:Color, packedColour:Int):Void; // Set the palette for a specific colour. public function setPaletteColor(index:Color, packedColour:Int):Void; // Set the palette for a specific colour.
public static function getPaletteColour(colour:Color):ColorData; // Get the current palette for a specific colour. public function getPaletteColour(colour:Color):ColorData; // Get the current palette for a specific colour.
public static function getPaletteColor(colour:Color):ColorData; // Get the current palette for a specific colour. public function getPaletteColor(colour:Color):ColorData; // Get the current palette for a specific colour.
} }

View File

@ -7,13 +7,13 @@ extern class Position {
} }
extern class Printer { extern class Printer {
public static function write(text:String):Void; // Writes text to the current page. public function write(text:String):Void; // Writes text to the current page.
public static function getCursorPos():Position; // Returns the current position of the cursor on the page. public function getCursorPos():Position; // Returns the current position of the cursor on the page.
public static function setCursorPos(x:Int, y:Int):Void; // Sets the position of the cursor on the page. public function setCursorPos(x:Int, y:Int):Void; // Sets the position of the cursor on the page.
public static function getPageSize():Position; // Returns the size of the current page. public function getPageSize():Position; // Returns the size of the current page.
public static function newPage():Bool; // Starts printing a new page. public function newPage():Bool; // Starts printing a new page.
public static function endPage():Bool; // Finalizes printing of the current page and outputs it to the tray. public function endPage():Bool; // Finalizes printing of the current page and outputs it to the tray.
public static function setPageTitle(?title:String):Void; // Sets the title of the current page. public function setPageTitle(?title:String):Void; // Sets the title of the current page.
public static function getInkLevel():Float; // Returns the amount of ink left in the printer. public function getInkLevel():Float; // Returns the amount of ink left in the printer.
public static function getPaperLevel():Int; // Returns the amount of paper left in the printer. public function getPaperLevel():Int; // Returns the amount of paper left in the printer.
} }

View File

@ -1,6 +1,6 @@
package cc.periphs; package cc.periphs;
extern class Speaker { extern class Speaker {
public static function playSound(name:String, ?volume:Float, ?pitch:Float):Bool; // Plays a sound through the speaker. public function playSound(name:String, ?volume:Float, ?pitch:Float):Bool; // Plays a sound through the speaker.
public static function playNote(name:String, ?volume:Float, ?pitch:Float):Bool; // Plays a note block note through the speaker. public function playNote(name:String, ?volume:Float, ?pitch:Float):Bool; // Plays a note block note through the speaker.
} }