:3
This commit is contained in:
parent
9ef462c104
commit
53dd38aba9
7
patch.sh
Executable file
7
patch.sh
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
function patch() {
|
||||||
|
sed -i $1 rOSs.lua
|
||||||
|
}
|
||||||
|
|
||||||
|
patch "s/peripheral:/peripheral\./g"
|
2
rOSs.lua
2
rOSs.lua
|
@ -27,7 +27,7 @@ ____modules = {
|
||||||
local ____exports = {}
|
local ____exports = {}
|
||||||
local basalt = require("src.libs.basalt.basalt")
|
local basalt = require("src.libs.basalt.basalt")
|
||||||
local function main(self)
|
local function main(self)
|
||||||
local d = peripheral:find("monitor")[1]
|
local d = peripheral.find("monitor")[1]
|
||||||
local main = basalt:addMonitor()
|
local main = basalt:addMonitor()
|
||||||
main:setMonitor(d)
|
main:setMonitor(d)
|
||||||
main:addLabel():setText("uwu")
|
main:addLabel():setText("uwu")
|
||||||
|
|
102
src/types/cct.d.ts
vendored
102
src/types/cct.d.ts
vendored
|
@ -97,7 +97,9 @@ declare class commands {
|
||||||
|
|
||||||
type AnyPeripheral = command | computer | drive | modem | Monitor | printer | speaker | BigReactors;
|
type AnyPeripheral = command | computer | drive | modem | Monitor | printer | speaker | BigReactors;
|
||||||
|
|
||||||
declare class peripheral {
|
declare class Peripheral {}
|
||||||
|
|
||||||
|
declare namespace peripheral {
|
||||||
/**
|
/**
|
||||||
* Provides a list of all peripherals available.
|
* Provides a list of all peripherals available.
|
||||||
* If a device is located directly next to the system,
|
* If a device is located directly next to the system,
|
||||||
|
@ -105,45 +107,45 @@ declare class peripheral {
|
||||||
* If a device is attached via a Wired Modem,
|
* If a device is attached via a Wired Modem,
|
||||||
* then it'll be reported according to its name on the wired network.
|
* then it'll be reported according to its name on the wired network.
|
||||||
*/
|
*/
|
||||||
static getNames(): string[];
|
function getNames(): string[];
|
||||||
/**
|
/**
|
||||||
* Determines if a peripheral is present with the given name.
|
* Determines if a peripheral is present with the given name.
|
||||||
*/
|
*/
|
||||||
static isPresent(name: string): boolean;
|
function isPresent(name: string): boolean;
|
||||||
|
|
||||||
static getType(peripheral: string|peripheral): string|null;
|
function getType(peripheral: string|Peripheral): string|null;
|
||||||
|
|
||||||
static hasType(peripheral: string|peripheral, peripheral_type: string): boolean|null;
|
function hasType(peripheral: string|Peripheral, peripheral_type: string): boolean|null;
|
||||||
|
|
||||||
static getMethods(name: string): string[]|null;
|
function getMethods(name: string): string[]|null;
|
||||||
|
|
||||||
static getName(peripheral: peripheral): string;
|
function getName(peripheral: Peripheral): string;
|
||||||
|
|
||||||
static call(name: string, method: string, ...arguments: unknown[]): unknown;
|
function call(name: string, method: string, ...arguments: unknown[]): unknown;
|
||||||
|
|
||||||
static wrap(name: string): peripheral| null;
|
function wrap<T extends Peripheral>(name: string): T | null;
|
||||||
|
|
||||||
static find(ty: string,
|
function find<T extends Peripheral>(ty: string,
|
||||||
filter?: (name: string, wrapped: peripheral) => boolean
|
filter?: (name: string, wrapped: Peripheral) => boolean
|
||||||
): [peripheral, peripheral|null, peripheral|null, peripheral|null];
|
): [T, T|null, T|null, T|null];
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class inventory {
|
declare class inventory extends Peripheral {
|
||||||
static size(): number;
|
size(): number;
|
||||||
static list(): Map<number, ItemInfo>;
|
list(): Map<number, ItemInfo>;
|
||||||
static getItemDetail(slot: number): ItemInfo|null;
|
getItemDetail(slot: number): ItemInfo|null;
|
||||||
static getItemLimit(slot: number): number;
|
getItemLimit(slot: number): number;
|
||||||
static pushItems(toName: string, fromSlot: number, limit: number, toSlot: number): number;
|
pushItems(toName: string, fromSlot: number, limit: number, toSlot: number): number;
|
||||||
static pullItems(fromName: string, fromSlot: number, limit: number, toSlot: number): number;
|
pullItems(fromName: string, fromSlot: number, limit: number, toSlot: number): number;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class fluid_storage {
|
declare class fluid_storage extends Peripheral{
|
||||||
static tanks(): Map<number, object>;
|
tanks(): Map<number, object>;
|
||||||
static pushFluid(toName: string, limit?: number, fluidName?: string): number;
|
pushFluid(toName: string, limit?: number, fluidName?: string): number;
|
||||||
static pullFluid(fromName: string, limit?: number, fluidName?: string): number;
|
pullFluid(fromName: string, limit?: number, fluidName?: string): number;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class energy_storage {
|
declare class energy_storage extends Peripheral {
|
||||||
static getEnergy(): number;
|
static getEnergy(): number;
|
||||||
static getEnergyCapacity(): number;
|
static getEnergyCapacity(): number;
|
||||||
}
|
}
|
||||||
|
@ -151,42 +153,42 @@ declare class energy_storage {
|
||||||
type Instrument = "harp" | "basedrum" | "snare" | "hat" | "bass" | "flute" | "bell" | "guitar" | "chime" | "xylophone" |
|
type Instrument = "harp" | "basedrum" | "snare" | "hat" | "bass" | "flute" | "bell" | "guitar" | "chime" | "xylophone" |
|
||||||
"iron_xylophone" | "cow_bell" | "didgeridoo" | "bit" | "banjo" | "pling";
|
"iron_xylophone" | "cow_bell" | "didgeridoo" | "bit" | "banjo" | "pling";
|
||||||
|
|
||||||
declare class speaker {
|
declare class speaker extends Peripheral {
|
||||||
static playNote(instrument: Instrument, volume?: number, pitch?: number): boolean;
|
playNote(instrument: Instrument, volume?: number, pitch?: number): boolean;
|
||||||
static playSound(name: string, volume?: number, pitch?: number): boolean;
|
playSound(name: string, volume?: number, pitch?: number): boolean;
|
||||||
static playAudio(audio: number[], volume?: number): boolean;
|
playAudio(audio: number[], volume?: number): boolean;
|
||||||
static stop(): void;
|
stop(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class printer {
|
declare class printer extends Peripheral {
|
||||||
static write(...args: (string|number)[]): void;
|
write(...args: (string|number)[]): void;
|
||||||
static getCursorPos(): [number, number];
|
getCursorPos(): [number, number];
|
||||||
static setCursorPos(x: number, y: number): void;
|
setCursorPos(x: number, y: number): void;
|
||||||
static getPageSize(): number;
|
getPageSize(): number;
|
||||||
static newPaget(): void;
|
newPaget(): void;
|
||||||
static endPage(): boolean;
|
endPage(): boolean;
|
||||||
static setPageTitle(s: string): void;
|
setPageTitle(s: string): void;
|
||||||
static getInkLevel(): number;
|
getInkLevel(): number;
|
||||||
static getPaperLevel(): number;
|
getPaperLevel(): number;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class Monitor extends Redirect {
|
declare class Monitor extends Redirect {
|
||||||
static getNames(): string[];
|
static getNames(): string[];
|
||||||
static isPresent(name: string): boolean;
|
static isPresent(name: string): boolean;
|
||||||
static getType(peripheral: string|peripheral): string|null;
|
static getType(peripheral: string|Peripheral): string|null;
|
||||||
static hasType(peripheral: string|peripheral, peripheral_type: string): boolean|null;
|
static hasType(peripheral: string|Peripheral, peripheral_type: string): boolean|null;
|
||||||
static getMethods(name: string): string[]|null;
|
static getMethods(name: string): string[]|null;
|
||||||
static getName(peripheral: peripheral): string;
|
static getName(Peripheral: Peripheral): string;
|
||||||
static call(name: string, method: string, ...arguments: unknown[]): unknown;
|
static call(name: string, method: string, ...arguments: unknown[]): unknown;
|
||||||
static wrap(name: string): peripheral| null;
|
static wrap(name: string): Peripheral| null;
|
||||||
static find(ty: string,
|
static find<T extends Peripheral>(ty: string,
|
||||||
filter: (name: string, wrapped: peripheral) => boolean
|
filter: (name: string, wrapped: Peripheral) => boolean
|
||||||
): [peripheral, peripheral|null, peripheral|null, peripheral|null];
|
): [T, T|null, T|null, T|null];
|
||||||
setTextScale(scale: number): void;
|
setTextScale(scale: number): void;
|
||||||
getTextScale(): number;
|
getTextScale(): number;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class modem {
|
declare class modem extends Peripheral {
|
||||||
static open(channel: number): void;
|
static open(channel: number): void;
|
||||||
static isOpen(channel: number): boolean;
|
static isOpen(channel: number): boolean;
|
||||||
static close(channel: number): void;
|
static close(channel: number): void;
|
||||||
|
@ -202,7 +204,7 @@ declare class modem {
|
||||||
static getNameLocal(): string|null;
|
static getNameLocal(): string|null;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class drive {
|
declare class drive extends Peripheral {
|
||||||
static isDiskPresent(): boolean;
|
static isDiskPresent(): boolean;
|
||||||
static getDiskLabel(): string|null;
|
static getDiskLabel(): string|null;
|
||||||
static setDiskLabel(l?: string): null;
|
static setDiskLabel(l?: string): null;
|
||||||
|
@ -216,7 +218,7 @@ declare class drive {
|
||||||
static getDiskID(name: string): string|null;
|
static getDiskID(name: string): string|null;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class disk {
|
declare class disk extends Peripheral {
|
||||||
static getLabel(name: string): string|null;
|
static getLabel(name: string): string|null;
|
||||||
static setLabel(name: string, label?: string): void;
|
static setLabel(name: string, label?: string): void;
|
||||||
static hasData(name: string): boolean;
|
static hasData(name: string): boolean;
|
||||||
|
@ -231,7 +233,7 @@ declare class disk {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
declare class computer {
|
declare class computer extends Peripheral {
|
||||||
static turnOn(): void;
|
static turnOn(): void;
|
||||||
static shutdown(): void;
|
static shutdown(): void;
|
||||||
static reboot(): void;
|
static reboot(): void;
|
||||||
|
|
|
@ -16,6 +16,6 @@
|
||||||
"luaTarget": "universal",
|
"luaTarget": "universal",
|
||||||
"luaBundleEntry": "src/index.ts",
|
"luaBundleEntry": "src/index.ts",
|
||||||
"luaBundle": "rOSs.lua",
|
"luaBundle": "rOSs.lua",
|
||||||
"luaLibImport": "inline",
|
"luaLibImport": "require",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user