@siredvin/craftos-types 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/craftos.d.ts +1073 -0
- package/package.json +37 -0
package/craftos.d.ts
ADDED
|
@@ -0,0 +1,1073 @@
|
|
|
1
|
+
/** @noSelfInFile **/
|
|
2
|
+
|
|
3
|
+
// Latest CC version: 1.102.2
|
|
4
|
+
|
|
5
|
+
type Color = number;
|
|
6
|
+
type Colour = Color;
|
|
7
|
+
|
|
8
|
+
/** @noSelf **/
|
|
9
|
+
declare namespace colors {
|
|
10
|
+
var white: Color;
|
|
11
|
+
var orange: Color;
|
|
12
|
+
var magenta: Color;
|
|
13
|
+
var lightBlue: Color;
|
|
14
|
+
var yellow: Color;
|
|
15
|
+
var lime: Color;
|
|
16
|
+
var pink: Color;
|
|
17
|
+
var gray: Color;
|
|
18
|
+
var lightGray: Color;
|
|
19
|
+
var cyan: Color;
|
|
20
|
+
var purple: Color;
|
|
21
|
+
var blue: Color;
|
|
22
|
+
var brown: Color;
|
|
23
|
+
var green: Color;
|
|
24
|
+
var red: Color;
|
|
25
|
+
var black: Color;
|
|
26
|
+
function combine(c1: Color, ...c2: Color[]): Color;
|
|
27
|
+
function subtract(c1: Color, ...c2: Color[]): Color;
|
|
28
|
+
function test(colors: Color, color: Color): boolean;
|
|
29
|
+
function packRGB(r: number, g: number, b: number): number;
|
|
30
|
+
function unpackRGB(rgb: number): LuaMultiReturn<[number, number, number]>;
|
|
31
|
+
function toBlit(color: Color): string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** @noSelf **/
|
|
35
|
+
declare namespace colours {
|
|
36
|
+
var white: Colour;
|
|
37
|
+
var orange: Colour;
|
|
38
|
+
var magenta: Colour;
|
|
39
|
+
var lightBlue: Colour;
|
|
40
|
+
var yellow: Colour;
|
|
41
|
+
var lime: Colour;
|
|
42
|
+
var pink: Colour;
|
|
43
|
+
var grey: Colour;
|
|
44
|
+
var lightGrey: Colour;
|
|
45
|
+
var cyan: Colour;
|
|
46
|
+
var purple: Colour;
|
|
47
|
+
var blue: Colour;
|
|
48
|
+
var brown: Colour;
|
|
49
|
+
var green: Colour;
|
|
50
|
+
var red: Colour;
|
|
51
|
+
var black: Colour;
|
|
52
|
+
function combine(c1: Colour, ...c2: Colour[]): Colour;
|
|
53
|
+
function subtract(c1: Colour, ...c2: Colour[]): Colour;
|
|
54
|
+
function test(colors: Colour, color: Colour): boolean;
|
|
55
|
+
function packRGB(r: number, g: number, b: number): number;
|
|
56
|
+
function unpackRGB(rgb: number): LuaMultiReturn<[number, number, number]>;
|
|
57
|
+
function toBlit(color: Colour): string;
|
|
58
|
+
}
|
|
59
|
+
/** @noSelf **/
|
|
60
|
+
declare namespace commands {
|
|
61
|
+
function exec(
|
|
62
|
+
command: string
|
|
63
|
+
): LuaMultiReturn<[boolean, LuaTable | Object]>;
|
|
64
|
+
function execAsync(command: string): number;
|
|
65
|
+
function list(command: string): LuaTable | Object;
|
|
66
|
+
function getBlockPosition(): LuaMultiReturn<[number, number, number]>;
|
|
67
|
+
function getBlockInfo(x: number, y: number, z: number): LuaTable | Object;
|
|
68
|
+
function getBlockInfos(
|
|
69
|
+
x1: number,
|
|
70
|
+
y1: number,
|
|
71
|
+
z1: number,
|
|
72
|
+
x2: number,
|
|
73
|
+
y2: number,
|
|
74
|
+
z2: number
|
|
75
|
+
): LuaTable | Object;
|
|
76
|
+
}
|
|
77
|
+
/** @noSelf **/
|
|
78
|
+
declare namespace disk {
|
|
79
|
+
function isPresent(name: string): boolean;
|
|
80
|
+
function getLabel(name: string): string | null;
|
|
81
|
+
function setLabel(name: string, label?: string | null): void;
|
|
82
|
+
function hasData(name: string): boolean;
|
|
83
|
+
function getMountPath(name: string): string | null;
|
|
84
|
+
function hasAudio(name: string): boolean;
|
|
85
|
+
function getAudioTitle(name: string): string | null;
|
|
86
|
+
function playAudio(name: string): void;
|
|
87
|
+
function stopAudio(name: string): void;
|
|
88
|
+
function eject(name: string): void;
|
|
89
|
+
function getID(name: string): number;
|
|
90
|
+
}
|
|
91
|
+
/** @noSelf */
|
|
92
|
+
declare class FileHandle {
|
|
93
|
+
public close(): void;
|
|
94
|
+
public seek(whence?: string, offset?: number): number;
|
|
95
|
+
public read(count?: number): string | number;
|
|
96
|
+
public readLine(withTrailing?: boolean): string;
|
|
97
|
+
public readAll(): string;
|
|
98
|
+
public write(value: any): void;
|
|
99
|
+
public writeLine(value: string): void;
|
|
100
|
+
public flush(): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
type FileAttributes = {
|
|
104
|
+
size: number;
|
|
105
|
+
isDir: boolean;
|
|
106
|
+
isReadOnly: boolean;
|
|
107
|
+
created: number;
|
|
108
|
+
modified: number;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
declare const fs: {
|
|
112
|
+
list(this: void, path: string): string[];
|
|
113
|
+
exists(this: void, path: string): boolean;
|
|
114
|
+
isDir(this: void, path: string): boolean;
|
|
115
|
+
isReadOnly(this: void, path: string): boolean;
|
|
116
|
+
getName(this: void, path: string): string;
|
|
117
|
+
getDrive(this: void, path: string): string;
|
|
118
|
+
getSize(this: void, path: string): number;
|
|
119
|
+
getFreeSpace(this: void, path: string): number;
|
|
120
|
+
makeDir(this: void, path: string): void;
|
|
121
|
+
move(this: void, from: string, to: string): void;
|
|
122
|
+
copy(this: void, from: string, to: string): void;
|
|
123
|
+
"delete"(this: void, path: string): void;
|
|
124
|
+
combine(this: void, base: string, ...local: string[]): string;
|
|
125
|
+
open(
|
|
126
|
+
this: void,
|
|
127
|
+
path: string,
|
|
128
|
+
mode: string
|
|
129
|
+
): LuaMultiReturn<[FileHandle] | [null, string]>;
|
|
130
|
+
find(this: void, wildcard: string): string[];
|
|
131
|
+
getDir(this: void, path: string): string;
|
|
132
|
+
complete(
|
|
133
|
+
this: void,
|
|
134
|
+
partial: string,
|
|
135
|
+
path: string,
|
|
136
|
+
includeFiles?: boolean,
|
|
137
|
+
includeSlashes?: boolean
|
|
138
|
+
): string[];
|
|
139
|
+
complete(
|
|
140
|
+
this: void,
|
|
141
|
+
partial: string,
|
|
142
|
+
path: string,
|
|
143
|
+
options: {
|
|
144
|
+
include_dirs?: boolean;
|
|
145
|
+
include_files?: boolean;
|
|
146
|
+
include_hidden?: boolean;
|
|
147
|
+
}
|
|
148
|
+
): string[];
|
|
149
|
+
getCapacity(this: void, path: string): number;
|
|
150
|
+
attributes(this: void, path: string): FileAttributes;
|
|
151
|
+
isDriveRoot(this: void, path: string): boolean;
|
|
152
|
+
};
|
|
153
|
+
declare function sleep(time: number): void;
|
|
154
|
+
declare function write(str: string): number;
|
|
155
|
+
declare function print(...str: any[]): number;
|
|
156
|
+
declare function printError(...str: any[]): void;
|
|
157
|
+
declare function read(
|
|
158
|
+
replaceChar?: string,
|
|
159
|
+
history?: string[],
|
|
160
|
+
completeFn?: (partial: string) => string[],
|
|
161
|
+
defaultValue?: string
|
|
162
|
+
): string;
|
|
163
|
+
declare var _CC_DEFAULT_SETTINGS: string;
|
|
164
|
+
declare var _CC_DISABLE_LUA51_FEATURES: boolean;
|
|
165
|
+
declare var _HOST: string;
|
|
166
|
+
/** @noSelf **/
|
|
167
|
+
declare namespace gps {
|
|
168
|
+
var CHANNEL_GPS: number;
|
|
169
|
+
function locate(
|
|
170
|
+
timeout?: number,
|
|
171
|
+
debug?: boolean
|
|
172
|
+
): LuaMultiReturn<[number, number, number]>;
|
|
173
|
+
}
|
|
174
|
+
/** @noSelf **/
|
|
175
|
+
declare namespace help {
|
|
176
|
+
function path(): string;
|
|
177
|
+
function setPath(path: string): void;
|
|
178
|
+
function lookup(topic: string): string;
|
|
179
|
+
function topics(): string[];
|
|
180
|
+
function completeTopic(prefix: string): string[];
|
|
181
|
+
}
|
|
182
|
+
type RequestOptions = {
|
|
183
|
+
url: string;
|
|
184
|
+
body: string | null;
|
|
185
|
+
headers: Map<string, string> | null;
|
|
186
|
+
binary: boolean | null;
|
|
187
|
+
method: string | null;
|
|
188
|
+
redirect: boolean | null;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/** @noSelf */
|
|
192
|
+
declare class HTTPResponse {
|
|
193
|
+
public getResponseCode(): number;
|
|
194
|
+
public getResponseHeaders(): Map<string, string>;
|
|
195
|
+
public read(count?: number): string | number | null;
|
|
196
|
+
public readLine(withTrailing: boolean): string | null;
|
|
197
|
+
public readAll(): string | null;
|
|
198
|
+
public close(): void;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** @noSelf */
|
|
202
|
+
declare class WebSocket {
|
|
203
|
+
public receive(timeout?: number): string | null;
|
|
204
|
+
public send(message: string, binary?: boolean): void;
|
|
205
|
+
public close(): void;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** @noSelf **/
|
|
209
|
+
declare namespace http {
|
|
210
|
+
function request(
|
|
211
|
+
url: string,
|
|
212
|
+
body?: string,
|
|
213
|
+
headers?: LuaTable<string, string>,
|
|
214
|
+
binary?: boolean
|
|
215
|
+
): void;
|
|
216
|
+
function get(
|
|
217
|
+
url: string,
|
|
218
|
+
headers?: LuaTable<string, string>,
|
|
219
|
+
binary?: boolean
|
|
220
|
+
): LuaMultiReturn<[HTTPResponse] | [boolean, string, HTTPResponse?]>;
|
|
221
|
+
function get(
|
|
222
|
+
options: RequestOptions
|
|
223
|
+
): LuaMultiReturn<[HTTPResponse] | [boolean, string, HTTPResponse?]>;
|
|
224
|
+
function post(
|
|
225
|
+
url: string,
|
|
226
|
+
body?: string,
|
|
227
|
+
headers?: LuaTable<string, string>,
|
|
228
|
+
binary?: boolean
|
|
229
|
+
): LuaMultiReturn<[HTTPResponse] | [boolean, string, HTTPResponse?]>;
|
|
230
|
+
function post(
|
|
231
|
+
options: RequestOptions
|
|
232
|
+
): LuaMultiReturn<[HTTPResponse] | [boolean, string, HTTPResponse?]>;
|
|
233
|
+
function checkURLAsync(url: string): void;
|
|
234
|
+
function checkURL(url: string): boolean;
|
|
235
|
+
function websocket(
|
|
236
|
+
url: string,
|
|
237
|
+
headers?: LuaTable<string, string>
|
|
238
|
+
): LuaMultiReturn<[WebSocket] | [boolean, string]>;
|
|
239
|
+
function websocketAsync(
|
|
240
|
+
url: string,
|
|
241
|
+
headers?: LuaTable<string, string>
|
|
242
|
+
): void;
|
|
243
|
+
}
|
|
244
|
+
type Key = number;
|
|
245
|
+
|
|
246
|
+
declare const keys: {
|
|
247
|
+
a: Key;
|
|
248
|
+
apostrophe: Key;
|
|
249
|
+
at: Key;
|
|
250
|
+
ax: Key;
|
|
251
|
+
b: Key;
|
|
252
|
+
backslash: Key;
|
|
253
|
+
backspace: Key;
|
|
254
|
+
c: Key;
|
|
255
|
+
capsLock: Key;
|
|
256
|
+
cimcumflex: Key;
|
|
257
|
+
colon: Key;
|
|
258
|
+
comma: Key;
|
|
259
|
+
convert: Key;
|
|
260
|
+
d: Key;
|
|
261
|
+
delete: Key;
|
|
262
|
+
down: Key;
|
|
263
|
+
e: Key;
|
|
264
|
+
eight: Key;
|
|
265
|
+
end: Key;
|
|
266
|
+
enter: Key;
|
|
267
|
+
equals: Key;
|
|
268
|
+
f: Key;
|
|
269
|
+
f1: Key;
|
|
270
|
+
f10: Key;
|
|
271
|
+
f11: Key;
|
|
272
|
+
f12: Key;
|
|
273
|
+
f13: Key;
|
|
274
|
+
f14: Key;
|
|
275
|
+
f15: Key;
|
|
276
|
+
f2: Key;
|
|
277
|
+
f3: Key;
|
|
278
|
+
f4: Key;
|
|
279
|
+
f5: Key;
|
|
280
|
+
f6: Key;
|
|
281
|
+
f7: Key;
|
|
282
|
+
f8: Key;
|
|
283
|
+
f9: Key;
|
|
284
|
+
five: Key;
|
|
285
|
+
four: Key;
|
|
286
|
+
g: Key;
|
|
287
|
+
grave: Key;
|
|
288
|
+
h: Key;
|
|
289
|
+
home: Key;
|
|
290
|
+
i: Key;
|
|
291
|
+
insert: Key;
|
|
292
|
+
j: Key;
|
|
293
|
+
k: Key;
|
|
294
|
+
kana: Key;
|
|
295
|
+
kanji: Key;
|
|
296
|
+
l: Key;
|
|
297
|
+
left: Key;
|
|
298
|
+
leftAlt: Key;
|
|
299
|
+
leftBracket: Key;
|
|
300
|
+
leftCtrl: Key;
|
|
301
|
+
leftShift: Key;
|
|
302
|
+
m: Key;
|
|
303
|
+
minus: Key;
|
|
304
|
+
multiply: Key;
|
|
305
|
+
n: Key;
|
|
306
|
+
nine: Key;
|
|
307
|
+
noconvert: Key;
|
|
308
|
+
numLock: Key;
|
|
309
|
+
numPad0: Key;
|
|
310
|
+
numPad1: Key;
|
|
311
|
+
numPad2: Key;
|
|
312
|
+
numPad3: Key;
|
|
313
|
+
numPad4: Key;
|
|
314
|
+
numPad5: Key;
|
|
315
|
+
numPad6: Key;
|
|
316
|
+
numPad7: Key;
|
|
317
|
+
numPad8: Key;
|
|
318
|
+
numPad9: Key;
|
|
319
|
+
numPadAdd: Key;
|
|
320
|
+
numPadComma: Key;
|
|
321
|
+
numPadDecimal: Key;
|
|
322
|
+
numPadDivide: Key;
|
|
323
|
+
numPadEnter: Key;
|
|
324
|
+
numPadEquals: Key;
|
|
325
|
+
numPadSubtract: Key;
|
|
326
|
+
o: Key;
|
|
327
|
+
one: Key;
|
|
328
|
+
p: Key;
|
|
329
|
+
pageDown: Key;
|
|
330
|
+
pageUp: Key;
|
|
331
|
+
pause: Key;
|
|
332
|
+
period: Key;
|
|
333
|
+
q: Key;
|
|
334
|
+
r: Key;
|
|
335
|
+
returnKey: Key;
|
|
336
|
+
right: Key;
|
|
337
|
+
rightAlt: Key;
|
|
338
|
+
rightBracket: Key;
|
|
339
|
+
rightCtrl: Key;
|
|
340
|
+
rightShift: Key;
|
|
341
|
+
s: Key;
|
|
342
|
+
scollLock: Key;
|
|
343
|
+
semiColon: Key;
|
|
344
|
+
seven: Key;
|
|
345
|
+
six: Key;
|
|
346
|
+
slash: Key;
|
|
347
|
+
space: Key;
|
|
348
|
+
stop: Key;
|
|
349
|
+
t: Key;
|
|
350
|
+
tab: Key;
|
|
351
|
+
three: Key;
|
|
352
|
+
two: Key;
|
|
353
|
+
u: Key;
|
|
354
|
+
underscore: Key;
|
|
355
|
+
up: Key;
|
|
356
|
+
v: Key;
|
|
357
|
+
w: Key;
|
|
358
|
+
x: Key;
|
|
359
|
+
y: Key;
|
|
360
|
+
yen: Key;
|
|
361
|
+
z: Key;
|
|
362
|
+
zero: Key;
|
|
363
|
+
getName(this: void, k: Key): string;
|
|
364
|
+
};
|
|
365
|
+
/** @noSelf **/
|
|
366
|
+
declare namespace multishell {
|
|
367
|
+
function getFocus(): number;
|
|
368
|
+
function setFocus(n: number): void;
|
|
369
|
+
function getTitle(n: number): string | null;
|
|
370
|
+
function setTitle(n: number, title: string): void;
|
|
371
|
+
function getCurrent(): number;
|
|
372
|
+
function launch(env: LuaTable, path: string, ...args: string[]): number;
|
|
373
|
+
function getCount(): number;
|
|
374
|
+
}
|
|
375
|
+
declare type LuaDate = {
|
|
376
|
+
year: number;
|
|
377
|
+
month: number;
|
|
378
|
+
day: number;
|
|
379
|
+
hour: number;
|
|
380
|
+
min: number;
|
|
381
|
+
sec: number;
|
|
382
|
+
wday: number;
|
|
383
|
+
yday: number;
|
|
384
|
+
isdst: boolean;
|
|
385
|
+
};
|
|
386
|
+
/** @noSelf **/
|
|
387
|
+
declare namespace os {
|
|
388
|
+
function version(): string;
|
|
389
|
+
function getComputerID(): number;
|
|
390
|
+
function computerID(): number;
|
|
391
|
+
function getComputerLabel(): string | null;
|
|
392
|
+
function computerLabel(): string | null;
|
|
393
|
+
function setComputerLabel(label?: string | null): void;
|
|
394
|
+
function run(env: LuaTable, path: string, ...args: string[]): boolean;
|
|
395
|
+
function queueEvent(type: string, ...param: any[]): void;
|
|
396
|
+
function clock(): number;
|
|
397
|
+
function startTimer(timeout: number): number;
|
|
398
|
+
function cancelTimer(id: number): void;
|
|
399
|
+
function time(mode?: string | null): number;
|
|
400
|
+
function sleep(timeout: number): void;
|
|
401
|
+
function day(mode?: string | null): number;
|
|
402
|
+
function setAlarm(time: number): number;
|
|
403
|
+
function cancelAlarm(id: number): void;
|
|
404
|
+
function shutdown(): void;
|
|
405
|
+
function reboot(): void;
|
|
406
|
+
function epoch(mode?: string | null): number;
|
|
407
|
+
function date(
|
|
408
|
+
format?: string | null,
|
|
409
|
+
time?: number | null
|
|
410
|
+
): string | LuaDate;
|
|
411
|
+
function pullEvent(
|
|
412
|
+
filter?: string | null
|
|
413
|
+
): LuaMultiReturn<[string, ...any[]]>;
|
|
414
|
+
function pullEventRaw(
|
|
415
|
+
filter?: string | null
|
|
416
|
+
): LuaMultiReturn<[string, ...any[]]>;
|
|
417
|
+
}
|
|
418
|
+
/** @noSelf **/
|
|
419
|
+
declare namespace paintutils {
|
|
420
|
+
function parseImage(image: string): number[][] | null;
|
|
421
|
+
function loadImage(path: string): number[][] | null;
|
|
422
|
+
function drawPixel(x: number, y: number, color?: Color): void;
|
|
423
|
+
function drawLine(
|
|
424
|
+
startX: number,
|
|
425
|
+
startY: number,
|
|
426
|
+
endX: number,
|
|
427
|
+
endY: number,
|
|
428
|
+
color?: Color
|
|
429
|
+
): void;
|
|
430
|
+
function drawBox(
|
|
431
|
+
startX: number,
|
|
432
|
+
startY: number,
|
|
433
|
+
endX: number,
|
|
434
|
+
endY: number,
|
|
435
|
+
color?: Color
|
|
436
|
+
): void;
|
|
437
|
+
function drawFilledBox(
|
|
438
|
+
startX: number,
|
|
439
|
+
startY: number,
|
|
440
|
+
endX: number,
|
|
441
|
+
endY: number,
|
|
442
|
+
color?: Color
|
|
443
|
+
): void;
|
|
444
|
+
function drawImage(image: number[][], x: number, y: number): void;
|
|
445
|
+
}
|
|
446
|
+
/** @noSelf **/
|
|
447
|
+
declare namespace parallel {
|
|
448
|
+
function waitForAny(...args: (() => void)[]): void;
|
|
449
|
+
function waitForAll(...args: (() => void)[]): void;
|
|
450
|
+
}
|
|
451
|
+
/** @noSelf */
|
|
452
|
+
interface IPeripheral {}
|
|
453
|
+
|
|
454
|
+
/** @noSelf */
|
|
455
|
+
declare class CommandPeripheral implements IPeripheral {
|
|
456
|
+
getCommand(): string;
|
|
457
|
+
setCommand(command: string): void;
|
|
458
|
+
runCommand(): LuaMultiReturn<[boolean, string | null]>;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/** @noSelf */
|
|
462
|
+
declare class ComputerPeripheral implements IPeripheral {
|
|
463
|
+
turnOn(): void;
|
|
464
|
+
shutdown(): void;
|
|
465
|
+
reboot(): void;
|
|
466
|
+
getID(): number;
|
|
467
|
+
isOn(): boolean;
|
|
468
|
+
getLabel(): string;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/** @noSelf */
|
|
472
|
+
declare class DrivePeripheral implements IPeripheral {
|
|
473
|
+
isDiskPresent(): boolean;
|
|
474
|
+
getDiskLabel(): string;
|
|
475
|
+
setDiskLabel(label?: string | null): void;
|
|
476
|
+
hasData(): boolean;
|
|
477
|
+
getMountPath(): string;
|
|
478
|
+
hasAudio(): boolean;
|
|
479
|
+
getAudioTitle(): string;
|
|
480
|
+
playAudio(): void;
|
|
481
|
+
stopAudio(): void;
|
|
482
|
+
ejectDisk(): void;
|
|
483
|
+
getDiskID(): number;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/** @noSelf */
|
|
487
|
+
declare class ModemPeripheral implements IPeripheral {
|
|
488
|
+
open(channel: number): void;
|
|
489
|
+
isOpen(channel: number): boolean;
|
|
490
|
+
close(channel: number): void;
|
|
491
|
+
closeAll(): void;
|
|
492
|
+
transmit(channel: number, replyChannel: number, payload: any): void;
|
|
493
|
+
isWireless(): boolean;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/** @noSelf */
|
|
497
|
+
declare class WiredModemPeripheral extends ModemPeripheral {
|
|
498
|
+
getNamesRemote(): string[];
|
|
499
|
+
isPresentRemote(name: string): boolean;
|
|
500
|
+
getTypeRemote(name: string): string;
|
|
501
|
+
getMethodsRemote(name: string): string[];
|
|
502
|
+
callRemote(
|
|
503
|
+
name: string,
|
|
504
|
+
method: string,
|
|
505
|
+
...args: string[]
|
|
506
|
+
): LuaMultiReturn<[...any[]]>;
|
|
507
|
+
getNameLocal(): string;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** @noSelf */
|
|
511
|
+
declare class MonitorPeripheral implements IPeripheral, ITerminal {
|
|
512
|
+
write(text: string): void;
|
|
513
|
+
blit(text: string, textColors: string, backgroundColors: string): void;
|
|
514
|
+
clear(): void;
|
|
515
|
+
clearLine(): void;
|
|
516
|
+
getCursorPos(): LuaMultiReturn<[number, number]>;
|
|
517
|
+
setCursorPos(x: number, y: number): void;
|
|
518
|
+
getCursorBlink(): boolean;
|
|
519
|
+
setCursorBlink(blink: boolean): void;
|
|
520
|
+
isColor(): boolean;
|
|
521
|
+
isColour(): boolean;
|
|
522
|
+
getSize(): LuaMultiReturn<[number, number]>;
|
|
523
|
+
scroll(n: number): void;
|
|
524
|
+
getTextColor(): Color;
|
|
525
|
+
getTextColour(): Colour;
|
|
526
|
+
setTextColor(color: Color): void;
|
|
527
|
+
setTextColour(color: Colour): void;
|
|
528
|
+
getBackgroundColor(): Color;
|
|
529
|
+
getBackgroundColour(): Colour;
|
|
530
|
+
setBackgroundColor(color: Color): void;
|
|
531
|
+
setBackgroundColour(color: Colour): void;
|
|
532
|
+
getPaletteColor(color: Color): LuaMultiReturn<[Color, Color, Color]>;
|
|
533
|
+
getPaletteColour(color: Colour): LuaMultiReturn<[Colour, Colour, Colour]>;
|
|
534
|
+
setPaletteColor(color: Color, rgb: number): void;
|
|
535
|
+
setPaletteColor(color: Color, r: number, g: number, b: number): void;
|
|
536
|
+
setPaletteColour(color: Colour, rgb: number): void;
|
|
537
|
+
setPaletteColour(color: Colour, r: number, g: number, b: number): void;
|
|
538
|
+
getGraphicsMode(): boolean | number;
|
|
539
|
+
setGraphicsMode(mode: boolean | number): void;
|
|
540
|
+
getPixel(x: number, y: number): number;
|
|
541
|
+
setPixel(x: number, y: number, color: Color): void;
|
|
542
|
+
getPixels(
|
|
543
|
+
x: number,
|
|
544
|
+
y: number,
|
|
545
|
+
width: number,
|
|
546
|
+
height: number,
|
|
547
|
+
asString?: boolean
|
|
548
|
+
): (string | Color[])[];
|
|
549
|
+
setPixels(x: number, y: number, data: Color | (string | Color[])[]): void;
|
|
550
|
+
getFrozen(): boolean;
|
|
551
|
+
setFrozen(frozen: boolean): void;
|
|
552
|
+
setTextScale(scale: number): void;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/** @noSelf */
|
|
556
|
+
declare class PrinterPeripheral implements IPeripheral {
|
|
557
|
+
write(...args: (string | number)[]): void;
|
|
558
|
+
getCursorPos(): LuaMultiReturn<[number, number]>;
|
|
559
|
+
setCursorPos(x: number, y: number): void;
|
|
560
|
+
getPageSize(): LuaMultiReturn<[number, number]>;
|
|
561
|
+
newPage(): void;
|
|
562
|
+
endPage(): void;
|
|
563
|
+
setPageTitle(title?: string | null): void;
|
|
564
|
+
getInkLevel(): number;
|
|
565
|
+
getPaperLevel(): number;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/** @noSelf */
|
|
569
|
+
declare class SpeakerPeripheral implements IPeripheral {
|
|
570
|
+
playSound(name: string, volume?: number, pitch?: number): void;
|
|
571
|
+
playNote(name: string, volume?: number, pitch?: number): void;
|
|
572
|
+
playAudio(data: number[], volume?: number): boolean;
|
|
573
|
+
stop(): void;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/** @noSelf */
|
|
577
|
+
declare class EnergyStoragePeripheral implements IPeripheral {
|
|
578
|
+
getEnergy(): number;
|
|
579
|
+
getEnergyCapacity(): number;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/** @noSelf */
|
|
583
|
+
declare class FluidStoragePeripheral implements IPeripheral {
|
|
584
|
+
tanks(): { [index: number]: { name: string; amount: number } };
|
|
585
|
+
pushFluid(to: string, limit?: number, name?: string): number;
|
|
586
|
+
pullFluid(from: string, limit?: number, name?: string): number;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
declare type ItemDetail = {
|
|
590
|
+
name: string;
|
|
591
|
+
count: number;
|
|
592
|
+
nbt?: string;
|
|
593
|
+
displayName: string;
|
|
594
|
+
maxCount: number;
|
|
595
|
+
damage?: number;
|
|
596
|
+
maxDamage?: number;
|
|
597
|
+
durability?: number;
|
|
598
|
+
tags: { [key: string]: true };
|
|
599
|
+
lore?: string[]; //?
|
|
600
|
+
enchantments?: { name: string; level: number; displayName: string }[];
|
|
601
|
+
unbreakable?: boolean;
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
/** @noSelf */
|
|
605
|
+
declare class InventoryPeripheral implements IPeripheral {
|
|
606
|
+
size(): number;
|
|
607
|
+
list(): { [index: number]: { name: string; count: number; nbt?: string } };
|
|
608
|
+
getItemDetail(slot: number): ItemDetail | null;
|
|
609
|
+
getItemLimit(slot: number): number;
|
|
610
|
+
pushItems(
|
|
611
|
+
to: string,
|
|
612
|
+
slot: number,
|
|
613
|
+
limit?: number,
|
|
614
|
+
toSlot?: number
|
|
615
|
+
): number;
|
|
616
|
+
pullItems(
|
|
617
|
+
from: string,
|
|
618
|
+
slot: number,
|
|
619
|
+
limit?: number,
|
|
620
|
+
fromSlot?: number
|
|
621
|
+
): number;
|
|
622
|
+
}
|
|
623
|
+
/** @noSelf **/
|
|
624
|
+
declare namespace peripheral {
|
|
625
|
+
function getNames(): string[];
|
|
626
|
+
function isPresent(name: string): boolean;
|
|
627
|
+
function getType(
|
|
628
|
+
peripheral: IPeripheral | string
|
|
629
|
+
): LuaMultiReturn<[...string[]]>;
|
|
630
|
+
function hasType(
|
|
631
|
+
peripheral: IPeripheral | string,
|
|
632
|
+
type: string
|
|
633
|
+
): boolean | null;
|
|
634
|
+
function getMethods(name: string): string[] | null;
|
|
635
|
+
function getName(peripheral: IPeripheral): string;
|
|
636
|
+
function call(
|
|
637
|
+
side: string,
|
|
638
|
+
method: string,
|
|
639
|
+
...args: any[]
|
|
640
|
+
): LuaMultiReturn<[...any[]]>;
|
|
641
|
+
function wrap(name: string): IPeripheral;
|
|
642
|
+
function find(
|
|
643
|
+
type: string,
|
|
644
|
+
filter?: (name: string, peripheral: IPeripheral) => boolean
|
|
645
|
+
): LuaMultiReturn<[...IPeripheral[]]>;
|
|
646
|
+
}
|
|
647
|
+
/** @noSelf **/
|
|
648
|
+
declare namespace pocket {
|
|
649
|
+
function equipBack(): LuaMultiReturn<[boolean, string | null]>;
|
|
650
|
+
function unequipBack(): LuaMultiReturn<[boolean, string | null]>;
|
|
651
|
+
}
|
|
652
|
+
/** @noSelf **/
|
|
653
|
+
declare namespace rednet {
|
|
654
|
+
var CHANNEL_BROADCAST: number;
|
|
655
|
+
var CHANNEL_REPEAT: number;
|
|
656
|
+
function open(modem: string): void;
|
|
657
|
+
function close(modem?: string): void;
|
|
658
|
+
function isOpen(modem?: string): boolean;
|
|
659
|
+
function send(recipient: number, message: any, protocol?: string): void;
|
|
660
|
+
function broadcast(message: any, protocol?: string): void;
|
|
661
|
+
function receive(
|
|
662
|
+
filter?: string | null,
|
|
663
|
+
timeout?: number
|
|
664
|
+
): LuaMultiReturn<[number, any, string | null] | [null]>;
|
|
665
|
+
function host(protocol: string, hostname: string): void;
|
|
666
|
+
function unhost(protocol: string): void;
|
|
667
|
+
function lookup(protocol: string, hostname?: string): number | null;
|
|
668
|
+
function run(): void;
|
|
669
|
+
}
|
|
670
|
+
/** @noSelf **/
|
|
671
|
+
declare namespace redstone {
|
|
672
|
+
function getSides(): string[];
|
|
673
|
+
function setOutput(side: string, on: boolean): void;
|
|
674
|
+
function getOutput(side: string): boolean;
|
|
675
|
+
function getInput(side: string): boolean;
|
|
676
|
+
function setAnalogOutput(side: string, value: number): void;
|
|
677
|
+
function getAnalogOutput(side: string): number;
|
|
678
|
+
function getAnalogInput(side: string): number;
|
|
679
|
+
function setAnalogueOutput(side: string, value: number): void;
|
|
680
|
+
function getAnalogueOutput(side: string): number;
|
|
681
|
+
function getAnalogueInput(side: string): number;
|
|
682
|
+
function setBundledOutput(side: string, value: Color): void;
|
|
683
|
+
function getBundledOutput(side: string): Color;
|
|
684
|
+
function getBundledInput(side: string): Color;
|
|
685
|
+
function testBundledInput(side: string, mask: number): boolean;
|
|
686
|
+
}
|
|
687
|
+
type SettingOptions = {
|
|
688
|
+
description?: string;
|
|
689
|
+
default?: any;
|
|
690
|
+
type?: string;
|
|
691
|
+
};
|
|
692
|
+
/** @noSelf **/
|
|
693
|
+
declare namespace settings {
|
|
694
|
+
function define(name: string, options?: SettingOptions): void;
|
|
695
|
+
function undefine(name: string): void;
|
|
696
|
+
function set(name: string, value: any): void;
|
|
697
|
+
function get(name: string, defaultValue?: any): any;
|
|
698
|
+
function getDetails(name: string): SettingOptions;
|
|
699
|
+
function unset(name: string): void;
|
|
700
|
+
function clear(): void;
|
|
701
|
+
function getNames(): string[];
|
|
702
|
+
function load(path?: string): void;
|
|
703
|
+
function save(path?: string): void;
|
|
704
|
+
}
|
|
705
|
+
/** @noSelf **/
|
|
706
|
+
declare namespace shell {
|
|
707
|
+
function exit(): void;
|
|
708
|
+
function dir(): string;
|
|
709
|
+
function setDir(path: string): void;
|
|
710
|
+
function path(): string;
|
|
711
|
+
function setPath(path: string): void;
|
|
712
|
+
function resolve(path: string): string;
|
|
713
|
+
function resolveProgram(name: string): string;
|
|
714
|
+
function aliases(): { [name: string]: string };
|
|
715
|
+
function setAlias(name: string, program: string): void;
|
|
716
|
+
function clearAlias(name: string): void;
|
|
717
|
+
function programs(showHidden?: boolean): string[];
|
|
718
|
+
function getRunningProgram(): string;
|
|
719
|
+
function run(command: string, ...args: string[]): boolean;
|
|
720
|
+
function execute(command: string, ...args: string[]): boolean;
|
|
721
|
+
function openTab(command: string, ...args: string[]): number;
|
|
722
|
+
function switchTab(id: number): void;
|
|
723
|
+
function complete(prefix: string): string[];
|
|
724
|
+
function completeProgram(prefix: string): string[];
|
|
725
|
+
function setCompletionFunction(
|
|
726
|
+
path: string,
|
|
727
|
+
completion: (
|
|
728
|
+
shell: LuaTable | Object,
|
|
729
|
+
index: number,
|
|
730
|
+
partial: string,
|
|
731
|
+
previous: string[]
|
|
732
|
+
) => string[]
|
|
733
|
+
): void;
|
|
734
|
+
function getCompletionInfo(): {
|
|
735
|
+
fnComplete: (
|
|
736
|
+
shell: LuaTable | Object,
|
|
737
|
+
index: number,
|
|
738
|
+
partial: string,
|
|
739
|
+
previous: string[]
|
|
740
|
+
) => string[];
|
|
741
|
+
}[];
|
|
742
|
+
}
|
|
743
|
+
/** @noSelf */
|
|
744
|
+
interface ITerminal {
|
|
745
|
+
write(text: string): void;
|
|
746
|
+
blit(text: string, textColors: string, backgroundColors: string): void;
|
|
747
|
+
clear(): void;
|
|
748
|
+
clearLine(): void;
|
|
749
|
+
getCursorPos(): LuaMultiReturn<[number, number]>;
|
|
750
|
+
setCursorPos(x: number, y: number): void;
|
|
751
|
+
getCursorBlink(): boolean;
|
|
752
|
+
setCursorBlink(blink: boolean): void;
|
|
753
|
+
isColor(): boolean;
|
|
754
|
+
isColour(): boolean;
|
|
755
|
+
getSize(mode?: boolean | number): LuaMultiReturn<[number, number]>;
|
|
756
|
+
scroll(n: number): void;
|
|
757
|
+
getTextColor(): Color;
|
|
758
|
+
getTextColour(): Colour;
|
|
759
|
+
setTextColor(color: Color): void;
|
|
760
|
+
setTextColour(color: Colour): void;
|
|
761
|
+
getBackgroundColor(): Color;
|
|
762
|
+
getBackgroundColour(): Colour;
|
|
763
|
+
setBackgroundColor(color: Color): void;
|
|
764
|
+
setBackgroundColour(color: Colour): void;
|
|
765
|
+
getPaletteColor(color: Color): LuaMultiReturn<[number, number, number]>;
|
|
766
|
+
getPaletteColour(color: Colour): LuaMultiReturn<[number, number, number]>;
|
|
767
|
+
setPaletteColor(color: Color, rgb: number): void;
|
|
768
|
+
setPaletteColor(color: Color, r: number, g: number, b: number): void;
|
|
769
|
+
setPaletteColour(color: Colour, rgb: number): void;
|
|
770
|
+
setPaletteColour(color: Colour, r: number, g: number, b: number): void;
|
|
771
|
+
getGraphicsMode(): boolean | number;
|
|
772
|
+
setGraphicsMode(mode: boolean | number): void;
|
|
773
|
+
getPixel(x: number, y: number): number;
|
|
774
|
+
setPixel(x: number, y: number, color: Color): void;
|
|
775
|
+
getPixels(
|
|
776
|
+
x: number,
|
|
777
|
+
y: number,
|
|
778
|
+
width: number,
|
|
779
|
+
height: number,
|
|
780
|
+
asString?: boolean
|
|
781
|
+
): (string | Color[])[];
|
|
782
|
+
setPixels(x: number, y: number, data: Color | (string | Color[])[]): void;
|
|
783
|
+
getFrozen(): boolean;
|
|
784
|
+
setFrozen(frozen: boolean): void;
|
|
785
|
+
}
|
|
786
|
+
/** @noSelf **/
|
|
787
|
+
declare namespace term {
|
|
788
|
+
function redirect(term: ITerminal): ITerminal;
|
|
789
|
+
function current(): ITerminal;
|
|
790
|
+
function native(): ITerminal;
|
|
791
|
+
function screenshot(): void;
|
|
792
|
+
function showMouse(mouse: boolean): void;
|
|
793
|
+
function write(text: string): void;
|
|
794
|
+
function blit(
|
|
795
|
+
text: string,
|
|
796
|
+
textColors: string,
|
|
797
|
+
backgroundColors: string
|
|
798
|
+
): void;
|
|
799
|
+
function clear(): void;
|
|
800
|
+
function clearLine(): void;
|
|
801
|
+
function getCursorPos(): LuaMultiReturn<[number, number]>;
|
|
802
|
+
function setCursorPos(x: number, y: number): void;
|
|
803
|
+
function getCursorBlink(): boolean;
|
|
804
|
+
function setCursorBlink(blink: boolean): void;
|
|
805
|
+
function isColor(): boolean;
|
|
806
|
+
function isColour(): boolean;
|
|
807
|
+
function getSize(mode?: boolean | number): LuaMultiReturn<[number, number]>;
|
|
808
|
+
function scroll(n: number): void;
|
|
809
|
+
function getTextColor(): Color;
|
|
810
|
+
function getTextColour(): Colour;
|
|
811
|
+
function setTextColor(color: Color): void;
|
|
812
|
+
function setTextColour(color: Colour): void;
|
|
813
|
+
function getBackgroundColor(): Color;
|
|
814
|
+
function getBackgroundColour(): Colour;
|
|
815
|
+
function setBackgroundColor(color: Color): void;
|
|
816
|
+
function setBackgroundColour(color: Colour): void;
|
|
817
|
+
function getPaletteColor(
|
|
818
|
+
color: Color
|
|
819
|
+
): LuaMultiReturn<[number, number, number]>;
|
|
820
|
+
function getPaletteColour(
|
|
821
|
+
color: Colour
|
|
822
|
+
): LuaMultiReturn<[number, number, number]>;
|
|
823
|
+
function setPaletteColor(color: Color, rgb: number): void;
|
|
824
|
+
function setPaletteColor(
|
|
825
|
+
color: Color,
|
|
826
|
+
r: number,
|
|
827
|
+
g: number,
|
|
828
|
+
b: number
|
|
829
|
+
): void;
|
|
830
|
+
function setPaletteColour(color: Colour, rgb: number): void;
|
|
831
|
+
function setPaletteColour(
|
|
832
|
+
color: Colour,
|
|
833
|
+
r: number,
|
|
834
|
+
g: number,
|
|
835
|
+
b: number
|
|
836
|
+
): void;
|
|
837
|
+
function getGraphicsMode(): boolean | number;
|
|
838
|
+
function setGraphicsMode(mode: boolean | number): void;
|
|
839
|
+
function getPixel(x: number, y: number): number;
|
|
840
|
+
function setPixel(x: number, y: number, color: Color): void;
|
|
841
|
+
function getPixels(
|
|
842
|
+
x: number,
|
|
843
|
+
y: number,
|
|
844
|
+
width: number,
|
|
845
|
+
height: number,
|
|
846
|
+
asString?: boolean
|
|
847
|
+
): (string | Color[])[];
|
|
848
|
+
function setPixels(
|
|
849
|
+
x: number,
|
|
850
|
+
y: number,
|
|
851
|
+
data: Color | (string | Color[])[]
|
|
852
|
+
): void;
|
|
853
|
+
function getFrozen(): boolean;
|
|
854
|
+
function setFrozen(frozen: boolean): void;
|
|
855
|
+
}
|
|
856
|
+
type UnserializeJSONOptions = {
|
|
857
|
+
nbt_style?: boolean;
|
|
858
|
+
parse_null?: boolean;
|
|
859
|
+
};
|
|
860
|
+
type SerializeOptions = {
|
|
861
|
+
compact?: boolean;
|
|
862
|
+
allow_repetitions?: boolean;
|
|
863
|
+
};
|
|
864
|
+
/** @noSelf **/
|
|
865
|
+
declare namespace textutils {
|
|
866
|
+
var empty_json_array: Object;
|
|
867
|
+
var json_null: Object;
|
|
868
|
+
function slowWrite(text: string, rate?: number): void;
|
|
869
|
+
function slowPrint(text: string, rate?: number): void;
|
|
870
|
+
function formatTime(time: number, hour24?: boolean): string;
|
|
871
|
+
function pagedPrint(text: string, freeLines?: number): number;
|
|
872
|
+
function tabulate(...args: (LuaTable | Object | Color)[]): void;
|
|
873
|
+
function pagedTabulate(...args: (LuaTable | Object | Color)[]): void;
|
|
874
|
+
function serialize(tab: any, options?: SerializeOptions): string;
|
|
875
|
+
function serialise(tab: any, options?: SerializeOptions): string;
|
|
876
|
+
function serializeJSON(tab: any, nbtStyle?: boolean): string;
|
|
877
|
+
function serialiseJSON(tab: any, nbtStyle?: boolean): string;
|
|
878
|
+
function unserialize(str: string): any;
|
|
879
|
+
function unserialise(str: string): any;
|
|
880
|
+
function unserializeJSON(
|
|
881
|
+
str: string,
|
|
882
|
+
options?: UnserializeJSONOptions
|
|
883
|
+
): any;
|
|
884
|
+
function unserialiseJSON(
|
|
885
|
+
str: string,
|
|
886
|
+
options?: UnserializeJSONOptions
|
|
887
|
+
): any;
|
|
888
|
+
function urlEncode(url: string): string;
|
|
889
|
+
function complete(searchText: string, searchTable?: any): string[];
|
|
890
|
+
}
|
|
891
|
+
/** @noSelf **/
|
|
892
|
+
declare namespace turtle {
|
|
893
|
+
function craft(quantity: number): boolean;
|
|
894
|
+
function forward(): boolean;
|
|
895
|
+
function back(): boolean;
|
|
896
|
+
function up(): boolean;
|
|
897
|
+
function down(): boolean;
|
|
898
|
+
function turnLeft(): boolean;
|
|
899
|
+
function turnRight(): boolean;
|
|
900
|
+
function select(slotNum: number): boolean;
|
|
901
|
+
function getSelectedSlot(): number;
|
|
902
|
+
|
|
903
|
+
function getItemCount(slotNum?: number): number;
|
|
904
|
+
|
|
905
|
+
function getItemSpace(slotNum?: number): number;
|
|
906
|
+
|
|
907
|
+
function getItemDetail(slotNum?: number): { name: string; count: number };
|
|
908
|
+
function getItemDetail(
|
|
909
|
+
slotNum: number,
|
|
910
|
+
detailed: false
|
|
911
|
+
): { name: string; count: number };
|
|
912
|
+
function getItemDetail(slotNum: number, detailed: true): LuaTable;
|
|
913
|
+
|
|
914
|
+
function equipLeft(): boolean;
|
|
915
|
+
function equipRight(): boolean;
|
|
916
|
+
|
|
917
|
+
function attack(toolSide?: string): boolean;
|
|
918
|
+
function attackUp(toolSide?: string): boolean;
|
|
919
|
+
function attackDown(toolSide?: string): boolean;
|
|
920
|
+
|
|
921
|
+
function dig(toolSide?: string): boolean;
|
|
922
|
+
function digUp(toolSide?: string): boolean;
|
|
923
|
+
function digDown(toolSide?: string): boolean;
|
|
924
|
+
|
|
925
|
+
function place(toolSide?: string): boolean;
|
|
926
|
+
function placeUp(toolSide?: string): boolean;
|
|
927
|
+
function placeDown(toolSide?: string): boolean;
|
|
928
|
+
|
|
929
|
+
function detect(toolSide?: string): boolean;
|
|
930
|
+
function detectUp(toolSide?: string): boolean;
|
|
931
|
+
function detectDown(toolSide?: string): boolean;
|
|
932
|
+
|
|
933
|
+
function inspect(
|
|
934
|
+
toolSide?: string
|
|
935
|
+
): LuaMultiReturn<[true, LuaTable] | [false, string]>;
|
|
936
|
+
function inspectUp(
|
|
937
|
+
toolSide?: string
|
|
938
|
+
): LuaMultiReturn<[true, LuaTable] | [false, string]>;
|
|
939
|
+
function inspectDown(
|
|
940
|
+
toolSide?: string
|
|
941
|
+
): LuaMultiReturn<[true, LuaTable] | [false, string]>;
|
|
942
|
+
|
|
943
|
+
function compare(): boolean;
|
|
944
|
+
function compareUp(): boolean;
|
|
945
|
+
function compareDown(): boolean;
|
|
946
|
+
|
|
947
|
+
function drop(
|
|
948
|
+
count?: number
|
|
949
|
+
): LuaMultiReturn<[true, LuaTable] | [false, string]>;
|
|
950
|
+
function dropUp(
|
|
951
|
+
count?: number
|
|
952
|
+
): LuaMultiReturn<[true, LuaTable] | [false, string]>;
|
|
953
|
+
function dropDown(
|
|
954
|
+
count?: number
|
|
955
|
+
): LuaMultiReturn<[true, LuaTable] | [false, string]>;
|
|
956
|
+
|
|
957
|
+
function suck(
|
|
958
|
+
count?: number
|
|
959
|
+
): LuaMultiReturn<[true, LuaTable] | [false, string]>;
|
|
960
|
+
function suckUp(
|
|
961
|
+
count?: number
|
|
962
|
+
): LuaMultiReturn<[true, LuaTable] | [false, string]>;
|
|
963
|
+
function suckDown(
|
|
964
|
+
count?: number
|
|
965
|
+
): LuaMultiReturn<[true, LuaTable] | [false, string]>;
|
|
966
|
+
|
|
967
|
+
function refuel(): boolean;
|
|
968
|
+
function refuel(quantity: number): boolean;
|
|
969
|
+
function getFuelLevel(): number;
|
|
970
|
+
function getFuelLimit(): number;
|
|
971
|
+
|
|
972
|
+
function transferTo(slotNum: number, quantity?: number): boolean;
|
|
973
|
+
}
|
|
974
|
+
/** @customConstructor vector.new */
|
|
975
|
+
declare class Vector {
|
|
976
|
+
constructor(x: number, y: number, z: number);
|
|
977
|
+
public x: number;
|
|
978
|
+
public y: number;
|
|
979
|
+
public z: number;
|
|
980
|
+
public add(this: Vector, o: Vector): Vector;
|
|
981
|
+
public sub(this: Vector, o: Vector): Vector;
|
|
982
|
+
public mul(this: Vector, o: number): Vector;
|
|
983
|
+
public div(this: Vector, o: number): Vector;
|
|
984
|
+
public unm(this: Vector): Vector;
|
|
985
|
+
public dot(this: Vector, o: Vector): Vector;
|
|
986
|
+
public cross(this: Vector, o: Vector): Vector;
|
|
987
|
+
public length(this: Vector): number;
|
|
988
|
+
public normalize(this: Vector): Vector;
|
|
989
|
+
public round(this: Vector, tolerance?: number): Vector;
|
|
990
|
+
public tostring(this: Vector): string;
|
|
991
|
+
public equals(this: Vector, o: Vector): boolean;
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* @customConstructor window.create
|
|
995
|
+
* @noSelf */
|
|
996
|
+
declare class Window implements ITerminal {
|
|
997
|
+
constructor(
|
|
998
|
+
parent: ITerminal,
|
|
999
|
+
x: number,
|
|
1000
|
+
y: number,
|
|
1001
|
+
width: number,
|
|
1002
|
+
height: number,
|
|
1003
|
+
visible?: boolean
|
|
1004
|
+
);
|
|
1005
|
+
public write(text: string): void;
|
|
1006
|
+
public blit(
|
|
1007
|
+
text: string,
|
|
1008
|
+
textColors: string,
|
|
1009
|
+
backgroundColors: string
|
|
1010
|
+
): void;
|
|
1011
|
+
public clear(): void;
|
|
1012
|
+
public clearLine(): void;
|
|
1013
|
+
public getCursorPos(): LuaMultiReturn<[number, number]>;
|
|
1014
|
+
public setCursorPos(x: number, y: number): void;
|
|
1015
|
+
public getCursorBlink(): boolean;
|
|
1016
|
+
public setCursorBlink(blink: boolean): void;
|
|
1017
|
+
public isColor(): boolean;
|
|
1018
|
+
public isColour(): boolean;
|
|
1019
|
+
public getSize(mode?: boolean | number): LuaMultiReturn<[number, number]>;
|
|
1020
|
+
public scroll(n: number): void;
|
|
1021
|
+
public getTextColor(): Color;
|
|
1022
|
+
public getTextColour(): Colour;
|
|
1023
|
+
public setTextColor(color: Color): void;
|
|
1024
|
+
public setTextColour(color: Colour): void;
|
|
1025
|
+
public getBackgroundColor(): Color;
|
|
1026
|
+
public getBackgroundColour(): Colour;
|
|
1027
|
+
public setBackgroundColor(color: Color): void;
|
|
1028
|
+
public setBackgroundColour(color: Colour): void;
|
|
1029
|
+
public getPaletteColor(
|
|
1030
|
+
color: Color
|
|
1031
|
+
): LuaMultiReturn<[number, number, number]>;
|
|
1032
|
+
public getPaletteColour(
|
|
1033
|
+
color: Colour
|
|
1034
|
+
): LuaMultiReturn<[number, number, number]>;
|
|
1035
|
+
public setPaletteColor(color: Color, rgb: number): void;
|
|
1036
|
+
public setPaletteColor(color: Color, r: number, g: number, b: number): void;
|
|
1037
|
+
public setPaletteColour(color: Colour, rgb: number): void;
|
|
1038
|
+
public setPaletteColour(
|
|
1039
|
+
color: Colour,
|
|
1040
|
+
r: number,
|
|
1041
|
+
g: number,
|
|
1042
|
+
b: number
|
|
1043
|
+
): void;
|
|
1044
|
+
public getGraphicsMode(): boolean | number;
|
|
1045
|
+
public setGraphicsMode(mode: boolean | number): void;
|
|
1046
|
+
public getPixel(x: number, y: number): number;
|
|
1047
|
+
public setPixel(x: number, y: number, color: Color): void;
|
|
1048
|
+
public getPixels(
|
|
1049
|
+
x: number,
|
|
1050
|
+
y: number,
|
|
1051
|
+
width: number,
|
|
1052
|
+
height: number,
|
|
1053
|
+
asString?: boolean
|
|
1054
|
+
): (string | Color[])[];
|
|
1055
|
+
public setPixels(
|
|
1056
|
+
x: number,
|
|
1057
|
+
y: number,
|
|
1058
|
+
data: Color | (string | Color[])[]
|
|
1059
|
+
): void;
|
|
1060
|
+
public getFrozen(): boolean;
|
|
1061
|
+
public setFrozen(frozen: boolean): void;
|
|
1062
|
+
public getVisible(): boolean;
|
|
1063
|
+
public setVisible(visible: boolean): void;
|
|
1064
|
+
public redraw(): void;
|
|
1065
|
+
public restoreCursor(): void;
|
|
1066
|
+
public getPosition(): LuaMultiReturn<[number, number]>;
|
|
1067
|
+
public reposition(
|
|
1068
|
+
x: number,
|
|
1069
|
+
y: number,
|
|
1070
|
+
width?: number,
|
|
1071
|
+
height?: number
|
|
1072
|
+
): void;
|
|
1073
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@siredvin/craftos-types",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "TypeScript type definitions for base CraftOS APIs.",
|
|
5
|
+
"types": "./craftos.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"./craftos.d.ts"
|
|
8
|
+
],
|
|
9
|
+
"author": "JackMacWindows",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"lint": "eslint . --ext .ts,.js",
|
|
13
|
+
"depcheck": "depcheck"
|
|
14
|
+
},
|
|
15
|
+
"nx": {
|
|
16
|
+
"targets": {
|
|
17
|
+
"lint": {
|
|
18
|
+
"executor": "@nx/linter:eslint",
|
|
19
|
+
"outputs": [
|
|
20
|
+
"{options.outputFile}"
|
|
21
|
+
],
|
|
22
|
+
"options": {
|
|
23
|
+
"lintFilePatterns": [
|
|
24
|
+
"packages/craftos/**/*.{ts,tsx,js,jsx}"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"depcheck": {
|
|
29
|
+
"executor": "nx:run-commands",
|
|
30
|
+
"options": {
|
|
31
|
+
"command": "depcheck",
|
|
32
|
+
"cwd": "packages/craftos"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|