warscript 0.0.1-dev.e196516 → 0.0.1-dev.e3899e3
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 +1 -0
- package/attributes.lua +9 -0
- package/core/types/frame.lua +24 -21
- package/core/types/player.d.ts +16 -0
- package/core/types/player.lua +60 -15
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +123 -5
- package/core/types/tileCell.d.ts +11 -1
- package/core/types/tileCell.lua +97 -0
- package/core/types/timer.d.ts +3 -1
- package/core/types/timer.lua +27 -2
- package/decl/native.d.ts +6 -4
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +14 -1
- package/engine/behavior.lua +230 -70
- package/engine/behaviour/ability/apply-buff.lua +5 -5
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +2 -1
- package/engine/behaviour/ability/remove-buffs.d.ts +9 -0
- package/engine/behaviour/ability/remove-buffs.lua +21 -0
- package/engine/behaviour/ability/restore-mana.d.ts +1 -1
- package/engine/behaviour/ability/restore-mana.lua +6 -6
- package/engine/behaviour/ability.d.ts +2 -1
- package/engine/behaviour/ability.lua +9 -17
- package/engine/behaviour/unit/stun-immunity.d.ts +11 -5
- package/engine/behaviour/unit/stun-immunity.lua +53 -28
- package/engine/behaviour/unit.d.ts +26 -5
- package/engine/behaviour/unit.lua +170 -27
- package/engine/buff.d.ts +17 -6
- package/engine/buff.lua +160 -97
- package/engine/internal/ability.d.ts +3 -1
- package/engine/internal/ability.lua +34 -11
- package/engine/internal/item/ability.lua +51 -1
- package/engine/internal/item+owner.lua +12 -6
- package/engine/internal/item.d.ts +13 -15
- package/engine/internal/item.lua +63 -49
- package/engine/internal/misc/frame-coordinates.d.ts +2 -0
- package/engine/internal/misc/frame-coordinates.lua +21 -0
- package/engine/internal/misc/get-terrain-z.d.ts +2 -0
- package/engine/internal/misc/get-terrain-z.lua +11 -0
- package/engine/internal/misc/player-local-handle.d.ts +2 -0
- package/engine/internal/misc/player-local-handle.lua +5 -0
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.d.ts +2 -0
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +16 -0
- package/engine/internal/unit/ability.d.ts +35 -5
- package/engine/internal/unit/ability.lua +96 -21
- package/engine/internal/unit/bonus.d.ts +2 -0
- package/engine/internal/unit/bonus.lua +10 -0
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/main-selected.lua +12 -27
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit/scale.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit+ability.lua +10 -1
- package/engine/internal/unit-missile-launch.lua +45 -14
- package/engine/internal/unit.d.ts +19 -16
- package/engine/internal/unit.lua +170 -136
- package/engine/local-client.d.ts +2 -0
- package/engine/local-client.lua +30 -0
- package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
- package/engine/object-data/auxiliary/armor-type.lua +46 -0
- package/engine/object-data/auxiliary/health-regeneration-type.d.ts +8 -0
- package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
- package/engine/object-data/entry/ability-type.lua +5 -4
- package/engine/object-data/entry/destructible-type.d.ts +27 -1
- package/engine/object-data/entry/destructible-type.lua +155 -0
- package/engine/object-data/entry/unit-type.d.ts +15 -2
- package/engine/object-data/entry/unit-type.lua +135 -33
- package/engine/object-field/ability.d.ts +3 -3
- package/engine/object-field/ability.lua +7 -6
- package/engine/object-field/unit.d.ts +31 -5
- package/engine/object-field/unit.lua +95 -0
- package/engine/object-field.d.ts +9 -3
- package/engine/object-field.lua +242 -119
- package/engine/random.d.ts +9 -0
- package/engine/random.lua +13 -0
- package/engine/standard/fields/ability.d.ts +2 -2
- package/engine/standard/fields/ability.lua +2 -2
- package/engine/standard/fields/unit.d.ts +7 -0
- package/engine/standard/fields/unit.lua +13 -0
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.d.ts +26 -3
- package/engine/text-tag.lua +217 -11
- package/engine/unit.d.ts +3 -0
- package/engine/unit.lua +3 -0
- package/net/socket.lua +1 -1
- package/objutil/buff.lua +1 -1
- package/package.json +2 -2
- package/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +8 -0
- package/utility/callback-array.d.ts +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/functions.d.ts +7 -0
- package/utility/functions.lua +12 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +19 -1
- package/utility/lua-maps.d.ts +11 -2
- package/utility/lua-maps.lua +33 -2
- package/utility/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +4 -0
- package/utility/types.d.ts +3 -0
- package/core/types/order.d.ts +0 -26
- package/core/types/order.lua +0 -65
package/utility/lua-maps.lua
CHANGED
|
@@ -27,10 +27,41 @@ ____exports.luaMapInvert = function(luaMap)
|
|
|
27
27
|
end
|
|
28
28
|
return invertLuaMap
|
|
29
29
|
end
|
|
30
|
+
____exports.toLuaMap = function(record)
|
|
31
|
+
return record
|
|
32
|
+
end
|
|
33
|
+
____exports.flattenKeys = function(luaMap)
|
|
34
|
+
local result = {}
|
|
35
|
+
for keys, value in pairs(luaMap) do
|
|
36
|
+
for ____, key in ipairs(keys) do
|
|
37
|
+
result[key] = value
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
return result
|
|
41
|
+
end
|
|
42
|
+
____exports.mapKeys = function(luaMap, transform)
|
|
43
|
+
local result = {}
|
|
44
|
+
if type(transform) == "function" then
|
|
45
|
+
for key, value in pairs(luaMap) do
|
|
46
|
+
result[transform(key)] = value
|
|
47
|
+
end
|
|
48
|
+
else
|
|
49
|
+
for key, value in pairs(luaMap) do
|
|
50
|
+
result[key[transform]] = value
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
return result
|
|
54
|
+
end
|
|
30
55
|
____exports.mapValues = function(luaMap, transform)
|
|
31
56
|
local result = {}
|
|
32
|
-
|
|
33
|
-
|
|
57
|
+
if type(transform) == "function" then
|
|
58
|
+
for key, value in pairs(luaMap) do
|
|
59
|
+
result[key] = transform(value)
|
|
60
|
+
end
|
|
61
|
+
else
|
|
62
|
+
for key, value in pairs(luaMap) do
|
|
63
|
+
result[key] = value[transform]
|
|
64
|
+
end
|
|
34
65
|
end
|
|
35
66
|
return result
|
|
36
67
|
end
|
package/utility/lua-sets.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
+
export declare const emptyLuaSet: <T extends AnyNotNil>() => ReadonlyLuaSet<T>;
|
|
2
3
|
export declare const mutableLuaSet: <T extends AnyNotNil>() => LuaSet<T>;
|
|
3
4
|
export declare const luaSetOf: <T extends AnyNotNil>(...elements: readonly T[]) => LuaSet<T>;
|
|
4
5
|
export declare const luaSetOfNotNull: <T extends AnyNotNil>(...elements: readonly (T | undefined | null)[]) => LuaSet<T>;
|
package/utility/lua-sets.lua
CHANGED
package/utility/types.d.ts
CHANGED
|
@@ -37,4 +37,7 @@ export type Flatten<T extends readonly any[], A extends readonly any[] = []> = T
|
|
|
37
37
|
export type Prohibit<T, K extends keyof any> = T & {
|
|
38
38
|
[P in K]?: never;
|
|
39
39
|
};
|
|
40
|
+
type TupleSplit<T, N extends number, O extends readonly any[] = readonly []> = O["length"] extends N ? [O, T] : T extends readonly [infer F, ...infer R] ? TupleSplit<readonly [...R], N, readonly [...O, F]> : [O, T];
|
|
41
|
+
export type TakeFirst<T extends readonly any[], N extends number> = TupleSplit<T, N>[0];
|
|
42
|
+
export type SkipFirst<T extends readonly any[], N extends number> = TupleSplit<T, N>[1];
|
|
40
43
|
export {};
|
package/core/types/order.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/** @noSelfInFile */
|
|
2
|
-
import { Unit } from "./unit";
|
|
3
|
-
import { Item } from "./item";
|
|
4
|
-
import { Destructable } from "./destructable";
|
|
5
|
-
export type Order = {
|
|
6
|
-
id: number;
|
|
7
|
-
startX: number;
|
|
8
|
-
startY: number;
|
|
9
|
-
issueTime: number;
|
|
10
|
-
} & ({
|
|
11
|
-
type: "immediate";
|
|
12
|
-
} | {
|
|
13
|
-
type: "point";
|
|
14
|
-
targetX: number;
|
|
15
|
-
targetY: number;
|
|
16
|
-
} | {
|
|
17
|
-
type: "target";
|
|
18
|
-
target: Unit | Item | Destructable;
|
|
19
|
-
});
|
|
20
|
-
declare module "../../engine/internal/unit" {
|
|
21
|
-
interface Unit {
|
|
22
|
-
readonly currentOrder: Order;
|
|
23
|
-
readonly lastOrder: Order;
|
|
24
|
-
issueOrder(order: Order): void;
|
|
25
|
-
}
|
|
26
|
-
}
|
package/core/types/order.lua
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
3
|
-
local ____exports = {}
|
|
4
|
-
local ____unit = require("core.types.unit")
|
|
5
|
-
local Unit = ____unit.Unit
|
|
6
|
-
local ____game = require("core.game")
|
|
7
|
-
local elapsedTime = ____game.elapsedTime
|
|
8
|
-
local getUnitCurrentOrder = GetUnitCurrentOrder
|
|
9
|
-
local orders = setmetatable({}, {__mode = "k"})
|
|
10
|
-
Unit.onImmediateOrder:addListener(function(unit, orderId)
|
|
11
|
-
orders[unit] = {
|
|
12
|
-
id = orderId,
|
|
13
|
-
startX = unit.x,
|
|
14
|
-
startY = unit.y,
|
|
15
|
-
issueTime = elapsedTime(),
|
|
16
|
-
type = "immediate"
|
|
17
|
-
}
|
|
18
|
-
end)
|
|
19
|
-
Unit.onPointOrder:addListener(function(unit, orderId, x, y)
|
|
20
|
-
orders[unit] = {
|
|
21
|
-
id = orderId,
|
|
22
|
-
startX = unit.x,
|
|
23
|
-
startY = unit.y,
|
|
24
|
-
issueTime = elapsedTime(),
|
|
25
|
-
type = "point",
|
|
26
|
-
targetX = x,
|
|
27
|
-
targetY = y
|
|
28
|
-
}
|
|
29
|
-
end)
|
|
30
|
-
Unit.onTargetOrder:addListener(function(unit, orderId, target)
|
|
31
|
-
orders[unit] = {
|
|
32
|
-
id = orderId,
|
|
33
|
-
startX = unit.x,
|
|
34
|
-
startY = unit.y,
|
|
35
|
-
issueTime = elapsedTime(),
|
|
36
|
-
type = "target",
|
|
37
|
-
target = target
|
|
38
|
-
}
|
|
39
|
-
end)
|
|
40
|
-
__TS__ObjectDefineProperty(
|
|
41
|
-
Unit.prototype,
|
|
42
|
-
"currentOrder",
|
|
43
|
-
{get = function(self)
|
|
44
|
-
local currentOrderId = getUnitCurrentOrder(self.handle)
|
|
45
|
-
local lastOrder = orders[self]
|
|
46
|
-
return lastOrder and (lastOrder.id == currentOrderId or currentOrderId == orderId("patrolAI") and lastOrder.id == orderId("patrol")) and lastOrder or ({id = 0, type = "immediate"})
|
|
47
|
-
end}
|
|
48
|
-
)
|
|
49
|
-
__TS__ObjectDefineProperty(
|
|
50
|
-
Unit.prototype,
|
|
51
|
-
"lastOrder",
|
|
52
|
-
{get = function(self)
|
|
53
|
-
return orders[self] or ({id = 0, type = "immediate"})
|
|
54
|
-
end}
|
|
55
|
-
)
|
|
56
|
-
Unit.prototype.issueOrder = function(self, order)
|
|
57
|
-
if order.type == "immediate" then
|
|
58
|
-
IssueImmediateOrderById(self.handle, order.id)
|
|
59
|
-
elseif order.type == "point" then
|
|
60
|
-
IssuePointOrderById(self.handle, order.id, order.targetX, order.targetY)
|
|
61
|
-
else
|
|
62
|
-
IssueTargetOrderById(self.handle, order.id, order.target.handle)
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
return ____exports
|