warscript 0.0.1-dev.632c807 → 0.0.1-dev.7411206
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/attributes.d.ts +13 -0
- package/attributes.lua +16 -0
- package/core/types/handle.d.ts +2 -1
- package/core/types/handle.lua +5 -0
- package/engine/behaviour/ability/apply-unit-behavior.d.ts +8 -4
- package/engine/behaviour/ability/apply-unit-behavior.lua +31 -9
- package/engine/internal/ability.d.ts +1 -1
- package/engine/internal/mechanics/ability-duration.d.ts +1 -3
- package/engine/internal/mechanics/ability-duration.lua +2 -0
- package/engine/internal/mechanics/cast-ability.d.ts +2 -0
- package/engine/internal/mechanics/cast-ability.lua +86 -0
- package/engine/internal/unit/detach-missiles.d.ts +7 -0
- package/engine/internal/unit/detach-missiles.lua +30 -0
- package/engine/object-data/entry/ability-type/blink.d.ts +10 -0
- package/engine/object-data/entry/ability-type/blink.lua +39 -0
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
- package/engine/object-data/entry/ability-type.d.ts +1 -0
- package/engine/object-data/entry/ability-type.lua +1 -0
- package/engine/object-data/entry/buff-type/applicable.lua +27 -71
- package/engine/object-data/entry/unit-type.d.ts +21 -0
- package/engine/object-data/entry/unit-type.lua +198 -44
- package/engine/object-field/ability.d.ts +7 -5
- package/engine/object-field/ability.lua +6 -0
- package/engine/object-field/unit.d.ts +1 -0
- package/engine/object-field/unit.lua +3 -0
- package/engine/object-field.d.ts +6 -3
- package/engine/object-field.lua +38 -12
- package/engine/standard/entries/unit-type.d.ts +3 -0
- package/engine/standard/entries/unit-type.lua +3 -0
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/exception.d.ts +2 -0
- package/exception.lua +4 -0
- package/global/vec2.lua +1 -0
- package/package.json +3 -3
- package/utility/arrays.d.ts +1 -1
- package/utility/arrays.lua +4 -1
- package/utility/linked-set.d.ts +20 -6
- package/utility/linked-set.lua +16 -0
- package/utility/types.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "warscript",
|
|
4
|
-
"version": "0.0.1-dev.
|
|
4
|
+
"version": "0.0.1-dev.7411206",
|
|
5
5
|
"description": "A typescript library for Warcraft III using Warpack.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"warcraft",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@warscript/language-extensions": "^0.0.1",
|
|
25
|
-
"@warscript/tstl-plugin": "^0.0.
|
|
25
|
+
"@warscript/tstl-plugin": "^0.0.2",
|
|
26
26
|
"typescript-to-lua": "^1.24.1",
|
|
27
27
|
"lua-types": "^2.13.1",
|
|
28
|
-
"warpack": "0.0.1-dev.
|
|
28
|
+
"warpack": "0.0.1-dev.5bdabe5"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@typescript-eslint/eslint-plugin": "^5.59.11",
|
package/utility/arrays.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
2
|
/** @noSelfInFile */
|
|
3
3
|
import { TupleOf } from "./types";
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const emptyArray: <T>() => readonly T[];
|
|
5
5
|
export declare const joinToString: <T>(array: readonly T[], separator: string, transform?: (element: T) => string) => string;
|
|
6
6
|
export declare const arrayOfNotNull: <T>(...elements: readonly (T | null | undefined)[]) => T[];
|
|
7
7
|
export declare const array: <T, N extends number>(length: N, initialize: (index: number) => T) => TupleOf<T, N>;
|
package/utility/arrays.lua
CHANGED
|
@@ -8,7 +8,10 @@ local mathMin = math.min
|
|
|
8
8
|
local select = _G.select
|
|
9
9
|
local tableConcat = table.concat
|
|
10
10
|
local tableSort = table.sort
|
|
11
|
-
|
|
11
|
+
local EMPTY_ARRAY = {}
|
|
12
|
+
____exports.emptyArray = function()
|
|
13
|
+
return EMPTY_ARRAY
|
|
14
|
+
end
|
|
12
15
|
____exports.joinToString = function(array, separator, transform)
|
|
13
16
|
if transform == nil then
|
|
14
17
|
transform = tostring
|
package/utility/linked-set.d.ts
CHANGED
|
@@ -4,10 +4,25 @@ type IteratorState<T extends AnyNotNil> = {
|
|
|
4
4
|
t: LuaMap<T, T>;
|
|
5
5
|
n?: T;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
readonly
|
|
7
|
+
type OneSidedTypeGuard = {
|
|
8
|
+
readonly __oneSidedTypeGuard: unique symbol;
|
|
9
|
+
};
|
|
10
|
+
export interface ReadonlyLinkedSet<T extends AnyNotNil> extends LuaPairsKeyIterable<T> {
|
|
11
|
+
copyOf(): LinkedSet<T>;
|
|
12
|
+
first(): T | undefined;
|
|
13
|
+
last(): T | undefined;
|
|
14
|
+
next(key: T): T | undefined;
|
|
15
|
+
previous(key: T): T | undefined;
|
|
16
|
+
contains(key: AnyNotNil): key is T & OneSidedTypeGuard;
|
|
17
|
+
size: number;
|
|
18
|
+
forEach<Args extends any[]>(action: (value: T, ...args: Args) => void, ...args: Args): void;
|
|
19
|
+
toArray(): T[];
|
|
20
|
+
sumOf(selector: ((value: T) => number) | KeysOfType<T, number>): number;
|
|
21
|
+
}
|
|
22
|
+
export interface LinkedSet<T extends AnyNotNil> extends LuaPairsKeyIterable<T> {
|
|
23
|
+
readonly __linkedSet: unique symbol;
|
|
9
24
|
}
|
|
10
|
-
export declare class LinkedSet<T extends AnyNotNil> {
|
|
25
|
+
export declare class LinkedSet<T extends AnyNotNil> implements ReadonlyLinkedSet<T> {
|
|
11
26
|
private n;
|
|
12
27
|
private p;
|
|
13
28
|
private f?;
|
|
@@ -20,9 +35,7 @@ export declare class LinkedSet<T extends AnyNotNil> {
|
|
|
20
35
|
previous(key: T): T | undefined;
|
|
21
36
|
add(key: T): boolean;
|
|
22
37
|
remove(key: T): boolean;
|
|
23
|
-
contains(key: AnyNotNil): key is T &
|
|
24
|
-
readonly __oneSidedTypeGuard: unique symbol;
|
|
25
|
-
};
|
|
38
|
+
contains(key: AnyNotNil): key is T & OneSidedTypeGuard;
|
|
26
39
|
clear(): void;
|
|
27
40
|
get size(): number;
|
|
28
41
|
forEach<Args extends any[]>(action: (value: T, ...args: Args) => void, ...args: Args): void;
|
|
@@ -31,6 +44,7 @@ export declare class LinkedSet<T extends AnyNotNil> {
|
|
|
31
44
|
sortBy<R>(selector: ((value: T) => R) | KeysOfType<T, R>): void;
|
|
32
45
|
protected __pairs(this: LinkedSet<T>): LuaIterator<T | undefined, IteratorState<T>>;
|
|
33
46
|
}
|
|
47
|
+
export declare const emptyLinkedSet: <T extends AnyNotNil>() => ReadonlyLinkedSet<T>;
|
|
34
48
|
export declare const linkedSetOf: <T extends AnyNotNil>(...elements: readonly T[]) => LinkedSet<T>;
|
|
35
49
|
export declare const linkedSetOfNotNull: <T extends AnyNotNil>(...elements: readonly (T | null | undefined)[]) => LinkedSet<T>;
|
|
36
50
|
export {};
|
package/utility/linked-set.lua
CHANGED
|
@@ -2,9 +2,12 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
|
+
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
5
6
|
local ____exports = {}
|
|
6
7
|
local ____arrays = require("utility.arrays")
|
|
7
8
|
local sortBy = ____arrays.sortBy
|
|
9
|
+
local ____exception = require("exception")
|
|
10
|
+
local UnsupportedOperationException = ____exception.UnsupportedOperationException
|
|
8
11
|
local function linkedSetNext(state)
|
|
9
12
|
local n = state.n
|
|
10
13
|
state.n = state.t[n]
|
|
@@ -161,6 +164,19 @@ __TS__SetDescriptor(
|
|
|
161
164
|
end},
|
|
162
165
|
true
|
|
163
166
|
)
|
|
167
|
+
local EmptyLinkedSet = __TS__Class()
|
|
168
|
+
EmptyLinkedSet.name = "EmptyLinkedSet"
|
|
169
|
+
__TS__ClassExtends(EmptyLinkedSet, ____exports.LinkedSet)
|
|
170
|
+
function EmptyLinkedSet.prototype.add(self)
|
|
171
|
+
error(
|
|
172
|
+
__TS__New(UnsupportedOperationException),
|
|
173
|
+
0
|
|
174
|
+
)
|
|
175
|
+
end
|
|
176
|
+
local EMPTY_LINKED_SET = __TS__New(EmptyLinkedSet)
|
|
177
|
+
____exports.emptyLinkedSet = function()
|
|
178
|
+
return EMPTY_LINKED_SET
|
|
179
|
+
end
|
|
164
180
|
____exports.linkedSetOf = function(...)
|
|
165
181
|
local linkedSet = __TS__New(____exports.LinkedSet)
|
|
166
182
|
for i = 1, select("#", ...) do
|
package/utility/types.d.ts
CHANGED
|
@@ -12,14 +12,14 @@ export type ValueOf<T> = T[keyof T];
|
|
|
12
12
|
export type EntryOf<T> = ValueOf<{
|
|
13
13
|
[K in keyof T]: [K, T[K]];
|
|
14
14
|
}>;
|
|
15
|
-
export type MutableKeys<T extends object> = {
|
|
15
|
+
export type MutableKeys<T extends object> = keyof T & {
|
|
16
16
|
[P in keyof T]-?: IfEquals<{
|
|
17
17
|
[Q in P]: T[P];
|
|
18
18
|
}, {
|
|
19
19
|
-readonly [Q in P]: T[P];
|
|
20
20
|
}, P>;
|
|
21
21
|
}[keyof T];
|
|
22
|
-
export type ReadonlyKeys<T extends object> = {
|
|
22
|
+
export type ReadonlyKeys<T extends object> = keyof T & {
|
|
23
23
|
[P in keyof T]-?: IfEquals<{
|
|
24
24
|
[Q in P]: T[P];
|
|
25
25
|
}, {
|