From dcad97c81b826954b3cb3e2e8abc582ad312de4c Mon Sep 17 00:00:00 2001 From: Ramon Gonzalez Fernandez Date: Mon, 12 Apr 2021 13:38:27 -0400 Subject: [PATCH] update periphs to not be static --- src/cc/periphs/Command.hx | 6 ++-- src/cc/periphs/Computer.hx | 12 ++++---- src/cc/periphs/Disk.hx | 22 +++++++------- src/cc/periphs/EnergyStorage.hx | 4 +-- src/cc/periphs/FluidStorage.hx | 6 ++-- src/cc/periphs/ItemStorage.hx | 11 +++---- src/cc/periphs/Modem.hx | 22 +++++++------- src/cc/periphs/Monitor.hx | 52 ++++++++++++++++----------------- src/cc/periphs/Printer.hx | 18 ++++++------ src/cc/periphs/Speaker.hx | 4 +-- 10 files changed, 79 insertions(+), 78 deletions(-) diff --git a/src/cc/periphs/Command.hx b/src/cc/periphs/Command.hx index 0e36688..efad9f4 100644 --- a/src/cc/periphs/Command.hx +++ b/src/cc/periphs/Command.hx @@ -7,9 +7,9 @@ extern class CommandResult { } 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; } diff --git a/src/cc/periphs/Computer.hx b/src/cc/periphs/Computer.hx index e41666a..2e46354 100644 --- a/src/cc/periphs/Computer.hx +++ b/src/cc/periphs/Computer.hx @@ -1,10 +1,10 @@ package cc.periphs; extern class Computer { - public static function turnOn():Void; // Turn the other computer on. - public static function shutdown():Void; // Shutdown the other computer. - public static function reboot():Void; // Reboot or turn on the other computer. - public static function getID():Int; // Get the other computer's ID. - public static function isOn():Bool; // Determine if the other computer is on. - public static function getLabel():Null; // Get the other computer's label. + public function turnOn():Void; // Turn the other computer on. + public function shutdown():Void; // Shutdown the other computer. + public function reboot():Void; // Reboot or turn on the other computer. + public function getID():Int; // Get the other computer's ID. + public function isOn():Bool; // Determine if the other computer is on. + public function getLabel():Null; // Get the other computer's label. } diff --git a/src/cc/periphs/Disk.hx b/src/cc/periphs/Disk.hx index 5ec992d..8e975e5 100644 --- a/src/cc/periphs/Disk.hx +++ b/src/cc/periphs/Disk.hx @@ -1,15 +1,15 @@ package cc.periphs; extern class Disk { - public static function isDiskPresent():Bool; // Returns whether a disk is currently inserted in the drive. - public static function getDiskLabel():Null; // 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 static function hasData():Bool; // Returns whether a disk with data is inserted. - public static function getMountPath():Null; // Returns the mount path for the inserted disk. - public static function hasAudio():Bool; // Returns whether a disk with audio is inserted. - public static function getAudioTitle():Null; // Returns the title of the inserted audio disk. - public static 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 static 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 isDiskPresent():Bool; // Returns whether a disk is currently inserted in the drive. + public function getDiskLabel():Null; // Returns the label of the disk in the drive if available. + public function setDiskLabel(?label:String):Void; // Sets or clears the label for a disk. + public function hasData():Bool; // Returns whether a disk with data is inserted. + public function getMountPath():Null; // Returns the mount path for the inserted disk. + public function hasAudio():Bool; // Returns whether a disk with audio is inserted. + public function getAudioTitle():Null; // Returns the title of the inserted audio disk. + public function playAudio():Void; // Plays the audio in the inserted disk, if available. + public function stopAudio():Void; // Stops any audio that may be playing. + public function ejectDisk():Void; // Ejects any disk that may be in the drive. + public function getDiskID():Int; // Returns the ID of the disk inserted in the drive. } diff --git a/src/cc/periphs/EnergyStorage.hx b/src/cc/periphs/EnergyStorage.hx index 43c7d3d..71fc7a5 100644 --- a/src/cc/periphs/EnergyStorage.hx +++ b/src/cc/periphs/EnergyStorage.hx @@ -1,6 +1,6 @@ package cc.periphs; extern class EnergyStorage { - public static 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 getEnergy():Int; // Get the energy of this block. + public function getEnergyCapacity():Int; // Get the maximum amount of energy this block can store. } diff --git a/src/cc/periphs/FluidStorage.hx b/src/cc/periphs/FluidStorage.hx index 672d7ea..67edb45 100644 --- a/src/cc/periphs/FluidStorage.hx +++ b/src/cc/periphs/FluidStorage.hx @@ -3,7 +3,7 @@ package cc.periphs; import lua.Table; extern class FluidStorage { - public static function tanks():Table>; - public static function pushFluid(toName:String, ?limit:Float, ?fluidName:String):Float; - public static function pullFluid(fromName:String, ?limit:Float, ?fluidName:String):Float; + public function tanks():Table>; + public function pushFluid(toName:String, ?limit:Float, ?fluidName:String):Float; + public function pullFluid(fromName:String, ?limit:Float, ?fluidName:String):Float; } diff --git a/src/cc/periphs/ItemStorage.hx b/src/cc/periphs/ItemStorage.hx index 970e6db..a0ef116 100644 --- a/src/cc/periphs/ItemStorage.hx +++ b/src/cc/periphs/ItemStorage.hx @@ -9,14 +9,15 @@ interface ReducedItemInfo { interface DetailedItemInfo extends ReducedItemInfo { public var displayName:String; + public var tag:Null; public var maxCount:Int; public var tags:Table; } extern class ItemStorage { - public static function size():Int; // Get the size of this inventory. - public static function list():Table; // List all items in this inventory. - public static 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 static function pullItems(fromName:String, fromSlot:Int, ?limit:Int, ?toSlot:Int):Int; // Pull items from a connected inventory into this one. + public function size():Int; // Get the size of this inventory. + public function list():Table; // List all items in this inventory. + public function getItemDetail(slot:Int):DetailedItemInfo; // Get detailed information about an item. + public function pushItems(toName:String, fromSlot:Int, ?limit:Int, ?toSlot:Int):Int; // Push items from one inventory to another connected one. + public function pullItems(fromName:String, fromSlot:Int, ?limit:Int, ?toSlot:Int):Int; // Pull items from a connected inventory into this one. } diff --git a/src/cc/periphs/Modem.hx b/src/cc/periphs/Modem.hx index a042cf3..7d20693 100644 --- a/src/cc/periphs/Modem.hx +++ b/src/cc/periphs/Modem.hx @@ -3,15 +3,15 @@ package cc.periphs; import lua.Table; extern class Modem { - public static 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 static 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 static 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 static function getNamesRemote():Table; // 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 static function getTypeRemote(name:String):String; // Get the type of a peripheral is available on this wired network. - public static function getMethodsRemote(name:String):Table; // 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 open(channel:Int):Void; // Open a channel on a modem. + public function isOpen(channel:Int):Bool; // Check if a channel is open. + public function close(channel:Int):Void; // Close an open channel, meaning it will no longer receive messages. + public function closeAll():Void; // Close all open channels. + public function transmit(channel:Int, replyChannel:Int, payload:Any):Void; // Sends a modem message on a certain channel. + public function isWireless():Bool; // Determine if this is a wired or wireless modem. + public function getNamesRemote():Table; // List all remote peripherals on the wired network. + public function isPresentRemote(name:String):Bool; // Determine if 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 function getMethodsRemote(name:String):Table; // Get all available methods for the remote peripheral with the given name. + public function getNameLocal():String; // Returns the network name of the current computer, if the modem is on. } diff --git a/src/cc/periphs/Monitor.hx b/src/cc/periphs/Monitor.hx index 44dd2d6..2ea2ee7 100644 --- a/src/cc/periphs/Monitor.hx +++ b/src/cc/periphs/Monitor.hx @@ -16,31 +16,31 @@ extern class ColorData { } extern class Monitor { - public static function setTextScale(scale:Float):Void; // Set the scale of this monitor. - public static 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 static 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 static 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 static 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 static 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 static 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 static 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 static function getBackgroundColour():Color; // Return the current background colour. - public static function getBackgroundColor():Color; // Return the current background colour. - public static function setBackgroundColour(colour:Color):Void; // Set the current background colour. - public static function setBackgroundColor(colour:Color):Void; // Set the current background colour. - public static function isColour():Bool; // Determine if this terminal supports colour. - public static function isColor():Bool; // Determine if this terminal supports colour. - public static function blit(text:String, textColour:String, + public function setTextScale(scale:Float):Void; // Set the scale of this monitor. + public function getTextScale():Float; // Get the monitor's current text scale. + public function write(text:String):Void; // Write text at the current cursor position, moving the cursor to the end of the text. + public function scroll(y:Int):Void; // Move all positions up (or down) by y pixels. + public function getCursorPos():Position; // Get the position of the cursor. + public function setCursorPos(x:Int, y:Int):Void; // et the position of the cursor. + public function getCursorBlink():Bool; // Checks if the cursor is currently blinking. + public function setCursorBlink(blink:Bool):Void; // Sets whether the cursor should be visible (and blinking) at the current cursor position. + public function getSize():Int; // Get the size of the terminal. + public function clear():Void; // Clears the terminal, 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 function getTextColour():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 function setTextColour(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 function getBackgroundColour():Color; // Return the current background colour. + public function getBackgroundColor():Color; // Return the current background colour. + public function setBackgroundColour(colour:Color):Void; // Set the current background colour. + public function setBackgroundColor(colour:Color):Void; // Set the current background colour. + public function isColour():Bool; // Determine if this terminal supports colour. + public function isColor():Bool; // Determine if this terminal supports colour. + public function blit(text:String, textColour:String, 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 static 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 static function getPaletteColor(colour:Color):ColorData; // Get the current palette for a specific colour. + public function setPaletteColour(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 function getPaletteColour(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. } diff --git a/src/cc/periphs/Printer.hx b/src/cc/periphs/Printer.hx index 97f7746..e2305a1 100644 --- a/src/cc/periphs/Printer.hx +++ b/src/cc/periphs/Printer.hx @@ -7,13 +7,13 @@ extern class Position { } extern class Printer { - public static 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 static 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 static 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 static 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 static function getPaperLevel():Int; // Returns the amount of paper left in the printer. + public function write(text:String):Void; // Writes text to the current page. + public function getCursorPos():Position; // Returns the current 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 function getPageSize():Position; // Returns the size of the current page. + public function newPage():Bool; // Starts printing a new page. + public function endPage():Bool; // Finalizes printing of the current page and outputs it to the tray. + public function setPageTitle(?title:String):Void; // Sets the title of the current page. + public function getInkLevel():Float; // Returns the amount of ink left in the printer. + public function getPaperLevel():Int; // Returns the amount of paper left in the printer. } diff --git a/src/cc/periphs/Speaker.hx b/src/cc/periphs/Speaker.hx index 7578b99..84fee3f 100644 --- a/src/cc/periphs/Speaker.hx +++ b/src/cc/periphs/Speaker.hx @@ -1,6 +1,6 @@ package cc.periphs; extern class Speaker { - public static 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 playSound(name:String, ?volume:Float, ?pitch:Float):Bool; // Plays a sound through the speaker. + public function playNote(name:String, ?volume:Float, ?pitch:Float):Bool; // Plays a note block note through the speaker. }