warscript 0.0.1-dev.e196516 → 0.0.1-dev.e49ec00
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/core/types/timer.d.ts +1 -1
- package/engine/behaviour/ability/apply-buff.lua +1 -1
- package/engine/behaviour/ability.lua +7 -16
- package/engine/behaviour/unit/stun-immunity.d.ts +5 -3
- package/engine/behaviour/unit/stun-immunity.lua +43 -27
- package/engine/behaviour/unit.d.ts +12 -1
- package/engine/behaviour/unit.lua +56 -7
- package/engine/buff.d.ts +2 -1
- package/engine/buff.lua +9 -3
- package/engine/internal/ability.lua +8 -2
- package/engine/internal/item/ability.lua +51 -1
- package/engine/internal/unit/ability.d.ts +30 -0
- package/engine/internal/unit/ability.lua +48 -0
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit.d.ts +2 -1
- package/engine/internal/unit.lua +70 -57
- package/engine/object-field/unit.d.ts +11 -0
- package/engine/object-field/unit.lua +34 -0
- package/engine/object-field.lua +5 -5
- package/engine/standard/fields/unit.d.ts +4 -0
- package/engine/standard/fields/unit.lua +7 -0
- package/engine/text-tag.d.ts +26 -3
- package/engine/text-tag.lua +136 -5
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/package.json +1 -1
- package/utility/functions.d.ts +3 -0
- package/utility/functions.lua +3 -0
- package/core/types/order.d.ts +0 -26
- package/core/types/order.lua +0 -65
package/engine/text-tag.lua
CHANGED
|
@@ -2,6 +2,7 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
3
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
6
|
local __TS__ObjectAssign = ____lualib.__TS__ObjectAssign
|
|
6
7
|
local ____exports = {}
|
|
7
8
|
local ____color = require("core.types.color")
|
|
@@ -46,10 +47,10 @@ TextTag.name = "TextTag"
|
|
|
46
47
|
__TS__ClassExtends(TextTag, AbstractDestroyable)
|
|
47
48
|
function TextTag.prototype.____constructor(self, handle)
|
|
48
49
|
AbstractDestroyable.prototype.____constructor(self)
|
|
49
|
-
self
|
|
50
|
+
self[101] = handle
|
|
50
51
|
end
|
|
51
52
|
function TextTag.prototype.onDestroy(self)
|
|
52
|
-
destroyTextTag(self
|
|
53
|
+
destroyTextTag(self[101])
|
|
53
54
|
unitTextTags[self] = nil
|
|
54
55
|
return AbstractDestroyable.prototype.onDestroy(self)
|
|
55
56
|
end
|
|
@@ -66,11 +67,141 @@ function TextTag.create(self, configuration, text, unit)
|
|
|
66
67
|
applyConfiguration(handle, configuration)
|
|
67
68
|
setTextTagPermanent(handle, true)
|
|
68
69
|
local textTag = __TS__New(____exports.TextTag, handle)
|
|
69
|
-
textTag[100] = unit
|
|
70
|
-
textTag[
|
|
70
|
+
textTag[100] = unit
|
|
71
|
+
textTag[102] = configuration
|
|
71
72
|
unitTextTags[textTag] = true
|
|
72
73
|
return textTag
|
|
73
74
|
end
|
|
75
|
+
__TS__SetDescriptor(
|
|
76
|
+
TextTag.prototype,
|
|
77
|
+
"text",
|
|
78
|
+
{
|
|
79
|
+
get = function(self)
|
|
80
|
+
return self[103] or ""
|
|
81
|
+
end,
|
|
82
|
+
set = function(self, text)
|
|
83
|
+
setTextTagText(self[101], text, self[104] or DEFAULT_FONT_SIZE)
|
|
84
|
+
self[103] = text
|
|
85
|
+
end
|
|
86
|
+
},
|
|
87
|
+
true
|
|
88
|
+
)
|
|
89
|
+
__TS__SetDescriptor(
|
|
90
|
+
TextTag.prototype,
|
|
91
|
+
"fontSize",
|
|
92
|
+
{
|
|
93
|
+
get = function(self)
|
|
94
|
+
return self[104] or DEFAULT_FONT_SIZE
|
|
95
|
+
end,
|
|
96
|
+
set = function(self, fontSize)
|
|
97
|
+
setTextTagText(self[101], self[103] or "", DEFAULT_FONT_SIZE)
|
|
98
|
+
self[104] = fontSize
|
|
99
|
+
end
|
|
100
|
+
},
|
|
101
|
+
true
|
|
102
|
+
)
|
|
103
|
+
__TS__SetDescriptor(
|
|
104
|
+
TextTag.prototype,
|
|
105
|
+
"color",
|
|
106
|
+
{
|
|
107
|
+
get = function(self)
|
|
108
|
+
return self[105] or Color.white
|
|
109
|
+
end,
|
|
110
|
+
set = function(self, color)
|
|
111
|
+
setTextTagColor(
|
|
112
|
+
self[101],
|
|
113
|
+
color.r,
|
|
114
|
+
color.g,
|
|
115
|
+
color.b,
|
|
116
|
+
color.a
|
|
117
|
+
)
|
|
118
|
+
self[105] = color
|
|
119
|
+
end
|
|
120
|
+
},
|
|
121
|
+
true
|
|
122
|
+
)
|
|
123
|
+
__TS__SetDescriptor(
|
|
124
|
+
TextTag.prototype,
|
|
125
|
+
"unit",
|
|
126
|
+
{
|
|
127
|
+
get = function(self)
|
|
128
|
+
return self[100]
|
|
129
|
+
end,
|
|
130
|
+
set = function(self, unit)
|
|
131
|
+
if unit ~= nil then
|
|
132
|
+
setTextTagPosUnit(self[101], unit.handle, 0)
|
|
133
|
+
self[106] = nil
|
|
134
|
+
self[107] = nil
|
|
135
|
+
unitTextTags[self] = true
|
|
136
|
+
elseif self[100] ~= nil then
|
|
137
|
+
local unit = self[100]
|
|
138
|
+
local x = unit.x
|
|
139
|
+
local y = unit.y
|
|
140
|
+
setTextTagPos(self[101], x, y, 0)
|
|
141
|
+
self[106] = x
|
|
142
|
+
self[107] = y
|
|
143
|
+
unitTextTags[self] = nil
|
|
144
|
+
end
|
|
145
|
+
self[100] = unit
|
|
146
|
+
end
|
|
147
|
+
},
|
|
148
|
+
true
|
|
149
|
+
)
|
|
150
|
+
__TS__SetDescriptor(
|
|
151
|
+
TextTag.prototype,
|
|
152
|
+
"x",
|
|
153
|
+
{
|
|
154
|
+
get = function(self)
|
|
155
|
+
local ____self__106_2 = self[106]
|
|
156
|
+
if ____self__106_2 == nil then
|
|
157
|
+
local ____opt_0 = self[100]
|
|
158
|
+
____self__106_2 = ____opt_0 and ____opt_0.x
|
|
159
|
+
end
|
|
160
|
+
return ____self__106_2 or 0
|
|
161
|
+
end,
|
|
162
|
+
set = function(self, x)
|
|
163
|
+
local ____self__101_6 = self[101]
|
|
164
|
+
local ____x_7 = x
|
|
165
|
+
local ____self__107_5 = self[107]
|
|
166
|
+
if ____self__107_5 == nil then
|
|
167
|
+
local ____opt_3 = self[100]
|
|
168
|
+
____self__107_5 = ____opt_3 and ____opt_3.y
|
|
169
|
+
end
|
|
170
|
+
setTextTagPos(____self__101_6, ____x_7, ____self__107_5 or 0, 0)
|
|
171
|
+
self[106] = x
|
|
172
|
+
self[100] = nil
|
|
173
|
+
unitTextTags[self] = nil
|
|
174
|
+
end
|
|
175
|
+
},
|
|
176
|
+
true
|
|
177
|
+
)
|
|
178
|
+
__TS__SetDescriptor(
|
|
179
|
+
TextTag.prototype,
|
|
180
|
+
"y",
|
|
181
|
+
{
|
|
182
|
+
get = function(self)
|
|
183
|
+
local ____self__107_10 = self[107]
|
|
184
|
+
if ____self__107_10 == nil then
|
|
185
|
+
local ____opt_8 = self[100]
|
|
186
|
+
____self__107_10 = ____opt_8 and ____opt_8.y
|
|
187
|
+
end
|
|
188
|
+
return ____self__107_10 or 0
|
|
189
|
+
end,
|
|
190
|
+
set = function(self, y)
|
|
191
|
+
local ____self__101_14 = self[101]
|
|
192
|
+
local ____self__106_13 = self[106]
|
|
193
|
+
if ____self__106_13 == nil then
|
|
194
|
+
local ____opt_11 = self[100]
|
|
195
|
+
____self__106_13 = ____opt_11 and ____opt_11.x
|
|
196
|
+
end
|
|
197
|
+
setTextTagPos(____self__101_14, ____self__106_13 or 0, y, 0)
|
|
198
|
+
self[107] = y
|
|
199
|
+
self[100] = nil
|
|
200
|
+
unitTextTags[self] = nil
|
|
201
|
+
end
|
|
202
|
+
},
|
|
203
|
+
true
|
|
204
|
+
)
|
|
74
205
|
TextTag.BASE = {
|
|
75
206
|
fadepoint = 2,
|
|
76
207
|
lifespan = 3,
|
|
@@ -137,7 +268,7 @@ TextTag.SHADOW_STRIKE = __TS__ObjectAssign(
|
|
|
137
268
|
)
|
|
138
269
|
Timer.onPeriod[1 / 64]:addListener(function()
|
|
139
270
|
for textTag in pairs(unitTextTags) do
|
|
140
|
-
setTextTagPosUnit(textTag
|
|
271
|
+
setTextTagPosUnit(textTag[101], textTag[100].handle, textTag[102].offsetZ)
|
|
141
272
|
end
|
|
142
273
|
end)
|
|
143
274
|
return ____exports
|
package/engine/unit.d.ts
CHANGED
package/engine/unit.lua
CHANGED
package/package.json
CHANGED
package/utility/functions.d.ts
CHANGED
|
@@ -4,3 +4,6 @@ export declare const apply: {
|
|
|
4
4
|
<T, ConsumerParameters extends any[], K extends KeysOfType<T, (...parameters: ConsumerParameters) => void>>(object: T, key: K, ...parameters: ConsumerParameters): T;
|
|
5
5
|
};
|
|
6
6
|
export declare const identity: <T>(value: T) => T;
|
|
7
|
+
export declare const firstArgument: <T>(value: T) => T;
|
|
8
|
+
export declare const secondArgument: <T>(_: unknown, value: T) => T;
|
|
9
|
+
export declare const thirdArgument: <T>(_first: unknown, _second: unknown, value: T) => T;
|
package/utility/functions.lua
CHANGED
|
@@ -88,4 +88,7 @@ ____exports.apply = function(object, transform, ...)
|
|
|
88
88
|
return object
|
|
89
89
|
end
|
|
90
90
|
____exports.identity = function(value) return value end
|
|
91
|
+
____exports.firstArgument = ____exports.identity
|
|
92
|
+
____exports.secondArgument = function(_, value) return value end
|
|
93
|
+
____exports.thirdArgument = function(_first, _second, value) return value end
|
|
91
94
|
return ____exports
|
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
|