warscript 0.0.1-dev.fd21394 → 0.0.1-dev.fe0aeea
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/binaryreader.d.ts +1 -0
- package/binaryreader.lua +3 -0
- package/config.d.ts +5 -0
- package/config.lua +10 -0
- package/core/types/effect.d.ts +14 -6
- package/core/types/effect.lua +131 -35
- package/core/types/frame.d.ts +8 -0
- package/core/types/frame.lua +93 -1
- package/core/types/sound.d.ts +17 -24
- package/core/types/sound.lua +94 -24
- package/core/util.d.ts +1 -1
- package/core/util.lua +18 -1
- package/engine/behavior.d.ts +2 -2
- package/engine/behavior.lua +6 -6
- package/engine/behaviour/ability/always-enabled.d.ts +7 -0
- package/engine/behaviour/ability/always-enabled.lua +31 -0
- package/engine/behaviour/ability/apply-buff.d.ts +8 -5
- package/engine/behaviour/ability/apply-buff.lua +32 -0
- package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
- package/engine/behaviour/ability/damage.d.ts +36 -11
- package/engine/behaviour/ability/damage.lua +90 -32
- package/engine/behaviour/ability/emulate-impact.d.ts +6 -0
- package/engine/behaviour/ability/emulate-impact.lua +28 -0
- package/engine/behaviour/ability/heal.d.ts +33 -6
- package/engine/behaviour/ability/heal.lua +89 -10
- package/engine/behaviour/ability/instant-impact.d.ts +2 -2
- package/engine/behaviour/ability/instant-impact.lua +4 -19
- package/engine/behaviour/ability/on-command-impact.d.ts +8 -0
- package/engine/behaviour/ability/on-command-impact.lua +25 -0
- package/engine/behaviour/ability/remove-buffs.d.ts +16 -0
- package/engine/behaviour/ability/remove-buffs.lua +28 -0
- package/engine/behaviour/ability/restore-mana.d.ts +15 -0
- package/engine/behaviour/ability/restore-mana.lua +29 -0
- package/engine/behaviour/ability.d.ts +20 -4
- package/engine/behaviour/ability.lua +111 -38
- package/engine/behaviour/unit.d.ts +7 -0
- package/engine/behaviour/unit.lua +20 -0
- package/engine/buff.d.ts +101 -39
- package/engine/buff.lua +458 -203
- package/engine/game-map.d.ts +7 -0
- package/engine/game-map.lua +32 -0
- package/engine/internal/ability.d.ts +16 -13
- package/engine/internal/ability.lua +80 -76
- package/engine/internal/item/ability.lua +106 -0
- package/engine/internal/item+owner.lua +2 -2
- package/engine/internal/item.d.ts +2 -2
- package/engine/internal/item.lua +56 -25
- package/engine/internal/mechanics/ability-duration.lua +1 -1
- package/engine/internal/misc/ability-disable-counter.d.ts +2 -0
- package/engine/internal/misc/ability-disable-counter.lua +13 -0
- package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
- package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
- package/engine/internal/object-data/evasion-probability.d.ts +2 -0
- package/engine/internal/object-data/evasion-probability.lua +16 -0
- package/engine/internal/unit/ability.d.ts +10 -1
- package/engine/internal/unit/ability.lua +36 -14
- package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
- package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot.lua +52 -0
- package/engine/internal/unit/bonus.d.ts +6 -2
- package/engine/internal/unit/bonus.lua +23 -1
- package/engine/internal/unit/ignore-events-items.d.ts +2 -0
- package/engine/internal/unit/ignore-events-items.lua +5 -0
- package/engine/internal/unit/item.d.ts +24 -0
- package/engine/internal/unit/item.lua +78 -0
- package/engine/internal/unit/main-selected.d.ts +13 -0
- package/engine/internal/unit/main-selected.lua +51 -0
- package/engine/internal/unit+ability.lua +2 -2
- package/engine/internal/unit+transport.lua +4 -10
- package/engine/internal/unit-missile-launch.lua +24 -5
- package/engine/internal/unit.d.ts +31 -10
- package/engine/internal/unit.lua +170 -83
- package/engine/internal/utility.lua +12 -0
- package/engine/lightning.d.ts +12 -5
- package/engine/lightning.lua +48 -14
- package/engine/local-client.d.ts +7 -2
- package/engine/local-client.lua +82 -0
- package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
- package/engine/object-data/auxiliary/animation-name.lua +16 -0
- package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -2
- package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
- package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
- package/engine/object-data/auxiliary/sound-eax.lua +2 -0
- package/engine/object-data/auxiliary/sound-preset-name.d.ts +5 -1
- package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
- package/engine/object-data/entry/ability-type/blank-configurable.lua +12 -1
- package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
- package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
- package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
- package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
- package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
- package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
- package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
- package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
- package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
- package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
- package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
- package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
- package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
- package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
- package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
- package/engine/object-data/entry/ability-type/web.d.ts +12 -0
- package/engine/object-data/entry/ability-type/web.lua +52 -0
- package/engine/object-data/entry/ability-type.d.ts +19 -17
- package/engine/object-data/entry/ability-type.lua +82 -33
- package/engine/object-data/entry/buff-type/applicable.lua +13 -37
- package/engine/object-data/entry/buff-type.d.ts +1 -1
- package/engine/object-data/entry/buff-type.lua +2 -2
- package/engine/object-data/entry/destructible-type.d.ts +1 -1
- package/engine/object-data/entry/item-type.d.ts +15 -1
- package/engine/object-data/entry/item-type.lua +93 -2
- package/engine/object-data/entry/lightning-type.d.ts +1 -1
- package/engine/object-data/entry/sound-preset.d.ts +33 -0
- package/engine/object-data/entry/sound-preset.lua +140 -0
- package/engine/object-data/entry/unit-type.d.ts +8 -1
- package/engine/object-data/entry/unit-type.lua +61 -8
- package/engine/object-data/entry/upgrade.d.ts +1 -1
- package/engine/object-data/entry/upgrade.lua +4 -4
- package/engine/object-data/entry.d.ts +16 -14
- package/engine/object-data/entry.lua +60 -32
- package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
- package/engine/object-field/ability.d.ts +26 -3
- package/engine/object-field/ability.lua +54 -1
- package/engine/object-field.d.ts +2 -2
- package/engine/object-field.lua +4 -0
- package/engine/standard/entries/sound-preset.d.ts +10 -0
- package/engine/standard/entries/sound-preset.lua +10 -0
- package/engine/standard/fields/ability.d.ts +2 -0
- package/engine/standard/fields/ability.lua +2 -0
- package/engine/unit.d.ts +3 -0
- package/engine/unit.lua +3 -0
- package/index.d.ts +1 -0
- package/index.lua +1 -0
- package/lualib_bundle.lua +7 -2
- package/net/socket.d.ts +7 -1
- package/net/socket.lua +45 -4
- package/network.d.ts +1 -0
- package/network.lua +3 -2
- package/objutil/buff.lua +1 -1
- package/objutil/unit.lua +8 -0
- package/package.json +2 -2
- package/patch-lua.d.ts +0 -0
- package/patch-lua.lua +10 -0
- package/property.d.ts +55 -0
- package/property.lua +374 -0
- package/utility/arrays.d.ts +8 -1
- package/utility/arrays.lua +34 -3
- package/utility/lazy.d.ts +2 -0
- package/utility/lazy.lua +14 -0
- package/utility/linked-set.d.ts +11 -2
- package/utility/linked-set.lua +5 -2
- package/utility/reflection.lua +11 -7
- package/utility/types.d.ts +1 -0
- package/core/mapbounds.d.ts +0 -8
- package/core/mapbounds.lua +0 -12
package/utility/arrays.lua
CHANGED
|
@@ -178,9 +178,16 @@ ____exports.associate = function(array, keySelector, valueSelector)
|
|
|
178
178
|
end
|
|
179
179
|
____exports.associateBy = function(array, keySelector)
|
|
180
180
|
local result = {}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
if type(keySelector) == "function" then
|
|
182
|
+
for i = 1, #array do
|
|
183
|
+
local value = array[i]
|
|
184
|
+
result[keySelector(value)] = value
|
|
185
|
+
end
|
|
186
|
+
else
|
|
187
|
+
for i = 1, #array do
|
|
188
|
+
local value = array[i]
|
|
189
|
+
result[value[keySelector]] = value
|
|
190
|
+
end
|
|
184
191
|
end
|
|
185
192
|
return result
|
|
186
193
|
end
|
|
@@ -251,6 +258,30 @@ ____exports.max = function(array)
|
|
|
251
258
|
end
|
|
252
259
|
return mathMax(table.unpack(array))
|
|
253
260
|
end
|
|
261
|
+
____exports.maxBy = function(array, selector, ...)
|
|
262
|
+
local result = nil
|
|
263
|
+
local maxValue = -math.huge
|
|
264
|
+
if type(selector) == "function" then
|
|
265
|
+
for i = 1, #array do
|
|
266
|
+
local element = array[i]
|
|
267
|
+
local value = selector(element, ...)
|
|
268
|
+
if value > maxValue then
|
|
269
|
+
result = element
|
|
270
|
+
maxValue = value
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
else
|
|
274
|
+
for i = 1, #array do
|
|
275
|
+
local element = array[i]
|
|
276
|
+
local value = element[selector]
|
|
277
|
+
if value > maxValue then
|
|
278
|
+
result = element
|
|
279
|
+
maxValue = value
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
return result
|
|
284
|
+
end
|
|
254
285
|
____exports.intersperse = function(array, delimiter)
|
|
255
286
|
local result = {}
|
|
256
287
|
local length = #array
|
package/utility/lazy.lua
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local rawset = _G.rawset
|
|
3
|
+
local setmetatable = _G.setmetatable
|
|
4
|
+
____exports.lazyRecord = function(initializer)
|
|
5
|
+
return setmetatable(
|
|
6
|
+
{},
|
|
7
|
+
{__index = function(self, key)
|
|
8
|
+
local value = initializer(key)
|
|
9
|
+
rawset(self, key, value)
|
|
10
|
+
return value
|
|
11
|
+
end}
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
return ____exports
|
package/utility/linked-set.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
+
import { NonEmptyArray, ReadonlyNonEmptyArray } from "./types";
|
|
2
3
|
type IteratorState<T extends AnyNotNil> = {
|
|
3
4
|
t: LuaMap<T, T>;
|
|
4
5
|
n?: T;
|
|
@@ -18,6 +19,11 @@ export interface ReadonlyLinkedSet<T extends AnyNotNil> extends LuaPairsKeyItera
|
|
|
18
19
|
toArray(): T[];
|
|
19
20
|
sumOf(selector: ((value: T) => number) | KeysOfType<T, number>): number;
|
|
20
21
|
}
|
|
22
|
+
export interface ReadonlyNonEmptyLinkedSet<T extends AnyNotNil> extends ReadonlyLinkedSet<T> {
|
|
23
|
+
first(): T;
|
|
24
|
+
last(): T;
|
|
25
|
+
toArray(): NonEmptyArray<T>;
|
|
26
|
+
}
|
|
21
27
|
export interface LinkedSet<T extends AnyNotNil> extends LuaPairsKeyIterable<T> {
|
|
22
28
|
readonly __linkedSet: unique symbol;
|
|
23
29
|
}
|
|
@@ -44,6 +50,9 @@ export declare class LinkedSet<T extends AnyNotNil> implements ReadonlyLinkedSet
|
|
|
44
50
|
protected __pairs(this: LinkedSet<T>): LuaIterator<T | undefined, IteratorState<T>>;
|
|
45
51
|
}
|
|
46
52
|
export declare const emptyLinkedSet: <T extends AnyNotNil>() => ReadonlyLinkedSet<T>;
|
|
47
|
-
export declare const
|
|
48
|
-
export declare const
|
|
53
|
+
export declare const mutableLinkedSetOf: <T extends AnyNotNil>(...elements: ReadonlyArray<T>) => LinkedSet<T>;
|
|
54
|
+
export declare const mutableLinkedSetOfNotNull: <T extends AnyNotNil>(...elements: readonly (T | undefined | null)[]) => LinkedSet<T>;
|
|
55
|
+
export declare const linkedSetOf: <T extends AnyNotNil>(...elements: ReadonlyArray<T>) => ReadonlyLinkedSet<T>;
|
|
56
|
+
export declare const linkedSetOfNotNull: <T extends AnyNotNil>(...elements: ReadonlyArray<T>) => ReadonlyLinkedSet<T>;
|
|
57
|
+
export declare const nonEmptyLinkedSetOf: <T extends AnyNotNil>(...elements: ReadonlyNonEmptyArray<T>) => ReadonlyNonEmptyLinkedSet<T>;
|
|
49
58
|
export {};
|
package/utility/linked-set.lua
CHANGED
|
@@ -177,14 +177,14 @@ local EMPTY_LINKED_SET = __TS__New(EmptyLinkedSet)
|
|
|
177
177
|
____exports.emptyLinkedSet = function()
|
|
178
178
|
return EMPTY_LINKED_SET
|
|
179
179
|
end
|
|
180
|
-
____exports.
|
|
180
|
+
____exports.mutableLinkedSetOf = function(...)
|
|
181
181
|
local linkedSet = __TS__New(____exports.LinkedSet)
|
|
182
182
|
for i = 1, select("#", ...) do
|
|
183
183
|
linkedSet:add((select(i, ...)))
|
|
184
184
|
end
|
|
185
185
|
return linkedSet
|
|
186
186
|
end
|
|
187
|
-
____exports.
|
|
187
|
+
____exports.mutableLinkedSetOfNotNull = function(...)
|
|
188
188
|
local linkedSet = __TS__New(____exports.LinkedSet)
|
|
189
189
|
for i = 1, select("#", ...) do
|
|
190
190
|
local element = (select(i, ...))
|
|
@@ -194,4 +194,7 @@ ____exports.linkedSetOfNotNull = function(...)
|
|
|
194
194
|
end
|
|
195
195
|
return linkedSet
|
|
196
196
|
end
|
|
197
|
+
____exports.linkedSetOf = function(...) return ____exports.mutableLinkedSetOf(...) end
|
|
198
|
+
____exports.linkedSetOfNotNull = function(...) return ____exports.mutableLinkedSetOfNotNull(...) end
|
|
199
|
+
____exports.nonEmptyLinkedSetOf = function(...) return ____exports.linkedSetOf(...) end
|
|
197
200
|
return ____exports
|
package/utility/reflection.lua
CHANGED
|
@@ -5,21 +5,25 @@ local checkNotNull = ____preconditions.checkNotNull
|
|
|
5
5
|
-- @internal For use by internal systems only.
|
|
6
6
|
____exports.implementReadonlyNumberIndexSupplier = function(clazz, supplier)
|
|
7
7
|
local metatable = checkNotNull(getmetatable(clazz))
|
|
8
|
-
local originalIndex = checkNotNull(metatable
|
|
8
|
+
local originalIndex = checkNotNull(rawget(metatable, "__index"))
|
|
9
9
|
local memoizedValueByKey = {}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
rawset(
|
|
11
|
+
metatable,
|
|
12
|
+
"__index",
|
|
13
|
+
function(self, key)
|
|
13
14
|
if type(key) == "number" then
|
|
14
|
-
local value =
|
|
15
|
-
|
|
15
|
+
local value = memoizedValueByKey[key]
|
|
16
|
+
if value == nil then
|
|
17
|
+
value = supplier(key)
|
|
18
|
+
memoizedValueByKey[key] = value
|
|
19
|
+
end
|
|
16
20
|
return value
|
|
17
21
|
end
|
|
18
22
|
if type(originalIndex) == "function" then
|
|
19
23
|
return originalIndex(self, key)
|
|
20
24
|
end
|
|
21
25
|
return originalIndex[key]
|
|
22
|
-
end
|
|
26
|
+
end
|
|
23
27
|
)
|
|
24
28
|
end
|
|
25
29
|
____exports.getClass = function(object)
|
package/utility/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export type AnyNonNullable = {};
|
|
3
3
|
export type IsExactlyAny<T> = boolean extends (T extends never ? true : false) ? true : false;
|
|
4
4
|
export type NonEmptyArray<T> = [T, ...T[]];
|
|
5
|
+
export type ReadonlyNonEmptyArray<T> = readonly [T, ...T[]];
|
|
5
6
|
export type InvertRecordType<T extends Record<PropertyKey, PropertyKey | null | undefined>> = {
|
|
6
7
|
[P in keyof T as NonNullable<T[P]>]: P;
|
|
7
8
|
};
|
package/core/mapbounds.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** @noSelfInFile */
|
|
2
|
-
import { Rect } from "./types/rect";
|
|
3
|
-
import { Region } from "./types/region";
|
|
4
|
-
export declare const boundRect: Rect;
|
|
5
|
-
export declare const boundRegion: Region;
|
|
6
|
-
export declare const boundMin: Readonly<Vec2>;
|
|
7
|
-
export declare const boundMax: Readonly<Vec2>;
|
|
8
|
-
export declare const boundCenter: Readonly<Vec2>;
|
package/core/mapbounds.lua
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
local ____exports = {}
|
|
2
|
-
local ____rect = require("core.types.rect")
|
|
3
|
-
local Rect = ____rect.Rect
|
|
4
|
-
local ____region = require("core.types.region")
|
|
5
|
-
local Region = ____region.Region
|
|
6
|
-
____exports.boundRect = Rect:of(GetWorldBounds())
|
|
7
|
-
____exports.boundRegion = Region:create()
|
|
8
|
-
____exports.boundRegion:addRect(____exports.boundRect)
|
|
9
|
-
____exports.boundMin = vec2(____exports.boundRect.minX, ____exports.boundRect.minY)
|
|
10
|
-
____exports.boundMax = vec2(____exports.boundRect.maxX, ____exports.boundRect.maxY)
|
|
11
|
-
____exports.boundCenter = (____exports.boundMin + ____exports.boundMax) * 0.5
|
|
12
|
-
return ____exports
|