warscript 0.0.1-dev.d7e0522 → 0.0.1-dev.da5fb2e
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/frame.lua +10 -12
- package/core/types/player.lua +3 -1
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +79 -5
- package/core/types/timer.d.ts +2 -1
- package/core/types/timer.lua +21 -2
- package/decl/native.d.ts +4 -2
- package/engine/behavior.d.ts +5 -0
- package/engine/behavior.lua +106 -27
- package/engine/behaviour/ability/apply-buff.lua +1 -1
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +11 -3
- package/engine/behaviour/ability/restore-mana.d.ts +1 -1
- package/engine/behaviour/ability/restore-mana.lua +6 -6
- package/engine/behaviour/ability.lua +8 -17
- 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 +19 -2
- package/engine/behaviour/unit.lua +88 -7
- package/engine/buff.d.ts +2 -4
- package/engine/buff.lua +68 -83
- package/engine/internal/ability.d.ts +5 -1
- package/engine/internal/ability.lua +43 -11
- package/engine/internal/item/ability.lua +51 -1
- package/engine/internal/item+owner.lua +12 -6
- package/engine/internal/item.d.ts +1 -0
- package/engine/internal/item.lua +20 -11
- 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/unit/ability.d.ts +35 -0
- package/engine/internal/unit/ability.lua +62 -0
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit+ability.lua +10 -1
- package/engine/internal/unit-missile-launch.lua +8 -1
- package/engine/internal/unit.d.ts +4 -4
- package/engine/internal/unit.lua +84 -70
- 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/entry/ability-type.lua +1 -3
- package/engine/object-data/entry/unit-type.d.ts +11 -2
- package/engine/object-data/entry/unit-type.lua +59 -1
- package/engine/object-field/ability.d.ts +3 -3
- package/engine/object-field/ability.lua +7 -6
- package/engine/object-field/unit.d.ts +11 -0
- package/engine/object-field/unit.lua +34 -0
- package/engine/object-field.d.ts +8 -5
- package/engine/object-field.lua +90 -76
- package/engine/standard/fields/unit.d.ts +4 -0
- package/engine/standard/fields/unit.lua +7 -0
- package/engine/text-tag.d.ts +36 -2
- package/engine/text-tag.lua +249 -10
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/package.json +2 -2
- package/patch-lualib.lua +1 -1
- package/utility/callback-array.d.ts +13 -0
- package/utility/callback-array.lua +46 -0
- package/utility/functions.d.ts +7 -0
- package/utility/functions.lua +12 -0
- package/utility/lua-maps.d.ts +1 -0
- package/utility/lua-maps.lua +4 -0
- package/utility/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +4 -0
- package/core/types/order.d.ts +0 -26
- package/core/types/order.lua +0 -65
|
@@ -18,6 +18,8 @@ local convertUnitStringField = ConvertUnitStringField
|
|
|
18
18
|
local convertUnitWeaponIntegerField = ConvertUnitWeaponIntegerField
|
|
19
19
|
local getUnitWeaponIntegerField = BlzGetUnitWeaponIntegerField
|
|
20
20
|
local setUnitWeaponIntegerField = BlzSetUnitWeaponIntegerField
|
|
21
|
+
local getUnitPropulsionWindow = GetUnitPropWindow
|
|
22
|
+
local setUnitPropulsionWindow = SetUnitPropWindow
|
|
21
23
|
____exports.UnitField = __TS__Class()
|
|
22
24
|
local UnitField = ____exports.UnitField
|
|
23
25
|
UnitField.name = "UnitField"
|
|
@@ -215,4 +217,36 @@ function UnitAttackTypeWeaponField.prototype.____constructor(self, ...)
|
|
|
215
217
|
6
|
|
216
218
|
)
|
|
217
219
|
end
|
|
220
|
+
____exports.UnitClassificationsField = __TS__Class()
|
|
221
|
+
local UnitClassificationsField = ____exports.UnitClassificationsField
|
|
222
|
+
UnitClassificationsField.name = "UnitClassificationsField"
|
|
223
|
+
__TS__ClassExtends(UnitClassificationsField, ____exports.UnitField)
|
|
224
|
+
function UnitClassificationsField.prototype.getNativeFieldById(self, id)
|
|
225
|
+
return convertUnitIntegerField(id)
|
|
226
|
+
end
|
|
227
|
+
function UnitClassificationsField.prototype.getNativeFieldValue(self, instance)
|
|
228
|
+
return instance:getField(self.nativeField)
|
|
229
|
+
end
|
|
230
|
+
function UnitClassificationsField.prototype.setNativeFieldValue(self, instance, value)
|
|
231
|
+
return instance:setField(self.nativeField, value)
|
|
232
|
+
end
|
|
233
|
+
__TS__SetDescriptor(
|
|
234
|
+
UnitClassificationsField.prototype,
|
|
235
|
+
"defaultValue",
|
|
236
|
+
{get = function(self)
|
|
237
|
+
return 0
|
|
238
|
+
end},
|
|
239
|
+
true
|
|
240
|
+
)
|
|
241
|
+
____exports.UnitPropulsionWindowField = __TS__Class()
|
|
242
|
+
local UnitPropulsionWindowField = ____exports.UnitPropulsionWindowField
|
|
243
|
+
UnitPropulsionWindowField.name = "UnitPropulsionWindowField"
|
|
244
|
+
__TS__ClassExtends(UnitPropulsionWindowField, ____exports.UnitFloatField)
|
|
245
|
+
function UnitPropulsionWindowField.prototype.getNativeFieldValue(self, instance)
|
|
246
|
+
return getUnitPropulsionWindow(instance.handle)
|
|
247
|
+
end
|
|
248
|
+
function UnitPropulsionWindowField.prototype.setNativeFieldValue(self, instance, value)
|
|
249
|
+
setUnitPropulsionWindow(instance.handle, value)
|
|
250
|
+
return true
|
|
251
|
+
end
|
|
218
252
|
return ____exports
|
package/engine/object-field.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ import { ObjectDataEntry, ObjectDataEntryIdType, ObjectDataEntryLevelFieldValueS
|
|
|
5
5
|
export type ObjectFieldId = number & {
|
|
6
6
|
readonly __objectDataEntryFieldId: unique symbol;
|
|
7
7
|
};
|
|
8
|
-
export type ObjectFieldConstructor<T extends ObjectFieldBase<any, any, any, any>> = OmitConstructor<typeof ObjectFieldBase> & (new (id: number) => T);
|
|
8
|
+
export type ObjectFieldConstructor<T extends ObjectFieldBase<any, any, any, any>> = OmitConstructor<typeof ObjectFieldBase> & (new (id: number, isGlobal?: boolean) => T);
|
|
9
9
|
export type ObjectFieldAbstractConstructor<T extends ObjectFieldBase<any, any, any, any>> = OmitConstructor<typeof ObjectFieldBase> & (abstract new (id: number) => T);
|
|
10
10
|
declare abstract class ObjectFieldBase<ObjectDataEntryType extends ObjectDataEntry, InstanceType extends AnyNotNil, ValueType, NativeFieldType> {
|
|
11
|
+
readonly isGlobal: boolean;
|
|
11
12
|
protected abstract readonly instanceClass: AbstractConstructor<InstanceType> | Function;
|
|
12
13
|
supports(instance: AnyNotNil): instance is InstanceType & {
|
|
13
14
|
readonly __oneSidedTypeGuard: unique symbol;
|
|
@@ -16,10 +17,10 @@ declare abstract class ObjectFieldBase<ObjectDataEntryType extends ObjectDataEnt
|
|
|
16
17
|
readonly id: ObjectFieldId;
|
|
17
18
|
protected abstract getNativeFieldById(id: number): NativeFieldType;
|
|
18
19
|
protected abstract getObjectDataEntryId(instance: InstanceType): ObjectDataEntryIdType<ObjectDataEntryType>;
|
|
19
|
-
protected abstract hasNativeFieldValue(
|
|
20
|
-
hasValue(
|
|
21
|
-
constructor(id: number);
|
|
22
|
-
static create<T extends ObjectFieldBase<any, any, any, any>>(this: ObjectFieldConstructor<T>, id?: number): T & symbol;
|
|
20
|
+
protected abstract hasNativeFieldValue(objectDataEntryId: ObjectDataEntryIdType<ObjectDataEntryType>): boolean;
|
|
21
|
+
hasValue(objectDataEntryId: ObjectDataEntryIdType<ObjectDataEntryType>): boolean;
|
|
22
|
+
constructor(id: number, isGlobal?: boolean);
|
|
23
|
+
static create<T extends ObjectFieldBase<any, any, any, any>>(this: ObjectFieldConstructor<T>, id?: number, isGlobal?: boolean): T & symbol;
|
|
23
24
|
static of<T extends ObjectFieldBase<any, any, any, any>>(this: ObjectFieldAbstractConstructor<T>, id: number): T | undefined;
|
|
24
25
|
}
|
|
25
26
|
export type ObjectFieldValueChangeEvent<T extends ObjectField<any, any, any, any> | ReadonlyObjectFieldType<ObjectField<any, any, any, any>>> = T extends ObjectField<any, infer InstanceType, infer ValueType, any> ? DispatchingEvent<[
|
|
@@ -79,6 +80,8 @@ export declare abstract class ObjectArrayField<ObjectDataEntryType extends Objec
|
|
|
79
80
|
setValue(entry: ObjectDataEntryType | InstanceType, value: ValueType[]): boolean;
|
|
80
81
|
}
|
|
81
82
|
export declare abstract class ObjectLevelField<ObjectDataEntryType extends ObjectDataEntry = ObjectDataEntry, InstanceType extends AnyNotNil = AnyNotNil, ValueType extends number | string | boolean = number | string | boolean, InputValueType extends ValueType = never, NativeFieldType = unknown> extends ObjectFieldBase<ObjectDataEntryType, InstanceType, ValueType[], NativeFieldType> {
|
|
83
|
+
private originalValueByLevelByInstance?;
|
|
84
|
+
private modifiersByInstance?;
|
|
82
85
|
protected abstract readonly defaultValue: ValueType;
|
|
83
86
|
protected abstract getNativeFieldValue(instance: InstanceType, level: number): ValueType;
|
|
84
87
|
protected abstract setNativeFieldValue(instance: InstanceType, level: number, value: ValueType): boolean;
|
package/engine/object-field.lua
CHANGED
|
@@ -23,8 +23,11 @@ local ObjectDataEntryIdGenerator = ____object_2Ddata_2Dentry_2Did_2Dgenerator.Ob
|
|
|
23
23
|
local ____linked_2Dset = require("utility.linked-set")
|
|
24
24
|
local mutableLinkedSet = ____linked_2Dset.mutableLinkedSet
|
|
25
25
|
local ____lua_2Dmaps = require("utility.lua-maps")
|
|
26
|
+
local emptyLuaMap = ____lua_2Dmaps.emptyLuaMap
|
|
26
27
|
local getOrPut = ____lua_2Dmaps.getOrPut
|
|
27
28
|
local mutableWeakLuaMap = ____lua_2Dmaps.mutableWeakLuaMap
|
|
29
|
+
local ____arrays = require("utility.arrays")
|
|
30
|
+
local emptyArray = ____arrays.emptyArray
|
|
28
31
|
local compiletimeDefaultValueByObjectDataEntryIdByObjectFieldId = {}
|
|
29
32
|
local defaultValueByObjectDataEntryIdByObjectFieldId = postcompile(function() return compiletimeDefaultValueByObjectDataEntryIdByObjectFieldId end)
|
|
30
33
|
local objectFieldById = {}
|
|
@@ -34,7 +37,11 @@ local idGenerator = __TS__New(
|
|
|
34
37
|
)
|
|
35
38
|
local ObjectFieldBase = __TS__Class()
|
|
36
39
|
ObjectFieldBase.name = "ObjectFieldBase"
|
|
37
|
-
function ObjectFieldBase.prototype.____constructor(self, id)
|
|
40
|
+
function ObjectFieldBase.prototype.____constructor(self, id, isGlobal)
|
|
41
|
+
if isGlobal == nil then
|
|
42
|
+
isGlobal = false
|
|
43
|
+
end
|
|
44
|
+
self.isGlobal = isGlobal
|
|
38
45
|
self.valueByInstance = setmetatable({}, {__mode = "k"})
|
|
39
46
|
if objectFieldById[id] ~= nil then
|
|
40
47
|
error(
|
|
@@ -51,14 +58,15 @@ end
|
|
|
51
58
|
function ObjectFieldBase.prototype.supports(self, instance)
|
|
52
59
|
return __TS__InstanceOf(instance, self.instanceClass)
|
|
53
60
|
end
|
|
54
|
-
function ObjectFieldBase.prototype.hasValue(self,
|
|
61
|
+
function ObjectFieldBase.prototype.hasValue(self, objectDataEntryId)
|
|
55
62
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
56
|
-
return defaultValueByObjectDataEntryId ~= nil and defaultValueByObjectDataEntryId[
|
|
63
|
+
return self.isGlobal or defaultValueByObjectDataEntryId ~= nil and defaultValueByObjectDataEntryId[objectDataEntryId] ~= nil or self:hasNativeFieldValue(objectDataEntryId)
|
|
57
64
|
end
|
|
58
|
-
function ObjectFieldBase.create(self, id)
|
|
65
|
+
function ObjectFieldBase.create(self, id, isGlobal)
|
|
59
66
|
return __TS__New(
|
|
60
67
|
self,
|
|
61
|
-
id or idGenerator:next()
|
|
68
|
+
id or idGenerator:next(),
|
|
69
|
+
isGlobal
|
|
62
70
|
)
|
|
63
71
|
end
|
|
64
72
|
function ObjectFieldBase.of(self, id)
|
|
@@ -185,36 +193,41 @@ function ObjectField.prototype.trySetValue(self, entry, value)
|
|
|
185
193
|
end
|
|
186
194
|
function ObjectField.prototype.getActualValue(self, instance)
|
|
187
195
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
188
|
-
if defaultValueByObjectDataEntryId ~= nil then
|
|
189
|
-
local defaultValue = defaultValueByObjectDataEntryId[self:getObjectDataEntryId(instance)]
|
|
190
|
-
if defaultValue ~= nil then
|
|
196
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
197
|
+
local defaultValue = (defaultValueByObjectDataEntryId or emptyLuaMap())[self:getObjectDataEntryId(instance)]
|
|
198
|
+
if defaultValue ~= nil or self.isGlobal then
|
|
191
199
|
local ____self_valueByInstance_instance_0 = self.valueByInstance[instance]
|
|
192
200
|
if ____self_valueByInstance_instance_0 == nil then
|
|
193
201
|
____self_valueByInstance_instance_0 = defaultValue
|
|
194
202
|
end
|
|
195
|
-
|
|
203
|
+
local ____self_valueByInstance_instance_0_1 = ____self_valueByInstance_instance_0
|
|
204
|
+
if ____self_valueByInstance_instance_0_1 == nil then
|
|
205
|
+
____self_valueByInstance_instance_0_1 = self.defaultValue
|
|
206
|
+
end
|
|
207
|
+
return ____self_valueByInstance_instance_0_1
|
|
196
208
|
end
|
|
197
209
|
end
|
|
198
|
-
local
|
|
199
|
-
if
|
|
200
|
-
|
|
210
|
+
local ____temp_2 = self:getNativeFieldValue(instance)
|
|
211
|
+
if ____temp_2 == nil then
|
|
212
|
+
____temp_2 = self.defaultValue
|
|
201
213
|
end
|
|
202
|
-
return
|
|
214
|
+
return ____temp_2
|
|
203
215
|
end
|
|
204
216
|
function ObjectField.prototype.setActualValue(self, instance, value)
|
|
205
217
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
218
|
+
local objectDataEntryId = self:getObjectDataEntryId(instance)
|
|
219
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
220
|
+
local defaultValue = (defaultValueByObjectDataEntryId or emptyLuaMap())[objectDataEntryId]
|
|
221
|
+
if defaultValue ~= nil or self.isGlobal then
|
|
222
|
+
local ____self_valueByInstance_instance_3 = self.valueByInstance[instance]
|
|
223
|
+
if ____self_valueByInstance_instance_3 == nil then
|
|
224
|
+
____self_valueByInstance_instance_3 = defaultValue
|
|
212
225
|
end
|
|
213
|
-
local
|
|
214
|
-
if
|
|
215
|
-
|
|
226
|
+
local ____self_valueByInstance_instance_3_4 = ____self_valueByInstance_instance_3
|
|
227
|
+
if ____self_valueByInstance_instance_3_4 == nil then
|
|
228
|
+
____self_valueByInstance_instance_3_4 = self.defaultValue
|
|
216
229
|
end
|
|
217
|
-
local previousValue =
|
|
230
|
+
local previousValue = ____self_valueByInstance_instance_3_4
|
|
218
231
|
if value ~= previousValue then
|
|
219
232
|
self.valueByInstance[instance] = value
|
|
220
233
|
self:invokeValueChangeEvent(instance, self, previousValue, value)
|
|
@@ -222,7 +235,7 @@ function ObjectField.prototype.setActualValue(self, instance, value)
|
|
|
222
235
|
return true
|
|
223
236
|
end
|
|
224
237
|
end
|
|
225
|
-
if not self:hasNativeFieldValue(
|
|
238
|
+
if not self:hasNativeFieldValue(objectDataEntryId) then
|
|
226
239
|
return false
|
|
227
240
|
end
|
|
228
241
|
local previousValue = self:getNativeFieldValue(instance)
|
|
@@ -235,10 +248,10 @@ function ObjectField.prototype.setActualValue(self, instance, value)
|
|
|
235
248
|
return true
|
|
236
249
|
end
|
|
237
250
|
function ObjectField.prototype.calculateActualValue(self, instance)
|
|
238
|
-
local
|
|
239
|
-
local originalValue =
|
|
240
|
-
local
|
|
241
|
-
local modifiers =
|
|
251
|
+
local ____opt_5 = self.originalValueByInstance
|
|
252
|
+
local originalValue = ____opt_5 and ____opt_5[instance]
|
|
253
|
+
local ____opt_7 = self.modifiersByInstance
|
|
254
|
+
local modifiers = ____opt_7 and ____opt_7[instance]
|
|
242
255
|
if originalValue ~= nil then
|
|
243
256
|
local value = originalValue
|
|
244
257
|
if modifiers ~= nil then
|
|
@@ -303,37 +316,37 @@ function ObjectArrayField.prototype.getValue(self, entry, index)
|
|
|
303
316
|
if defaultValueByObjectDataEntryId ~= nil then
|
|
304
317
|
local value = defaultValueByObjectDataEntryId[entry.id]
|
|
305
318
|
if value ~= nil then
|
|
306
|
-
local
|
|
319
|
+
local ____temp_10
|
|
307
320
|
if index == nil then
|
|
308
|
-
|
|
321
|
+
____temp_10 = value
|
|
309
322
|
else
|
|
310
|
-
local
|
|
311
|
-
if
|
|
312
|
-
|
|
323
|
+
local ____value_index_9 = value[index + 1]
|
|
324
|
+
if ____value_index_9 == nil then
|
|
325
|
+
____value_index_9 = self.defaultValue
|
|
313
326
|
end
|
|
314
|
-
|
|
327
|
+
____temp_10 = ____value_index_9
|
|
315
328
|
end
|
|
316
|
-
return
|
|
329
|
+
return ____temp_10
|
|
317
330
|
end
|
|
318
331
|
end
|
|
319
332
|
return index == nil and ({}) or self.defaultValue
|
|
320
333
|
end
|
|
321
334
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
322
|
-
if defaultValueByObjectDataEntryId ~= nil then
|
|
323
|
-
local defaultValue = defaultValueByObjectDataEntryId[self:getObjectDataEntryId(entry)]
|
|
324
|
-
if defaultValue ~= nil then
|
|
325
|
-
local value = self.valueByInstance[entry] or defaultValue
|
|
326
|
-
local
|
|
335
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
336
|
+
local defaultValue = (defaultValueByObjectDataEntryId or emptyLuaMap())[self:getObjectDataEntryId(entry)]
|
|
337
|
+
if defaultValue ~= nil or self.isGlobal then
|
|
338
|
+
local value = self.valueByInstance[entry] or defaultValue or emptyArray()
|
|
339
|
+
local ____temp_12
|
|
327
340
|
if index == nil then
|
|
328
|
-
|
|
341
|
+
____temp_12 = value
|
|
329
342
|
else
|
|
330
|
-
local
|
|
331
|
-
if
|
|
332
|
-
|
|
343
|
+
local ____value_index_11 = value[index + 1]
|
|
344
|
+
if ____value_index_11 == nil then
|
|
345
|
+
____value_index_11 = self.defaultValue
|
|
333
346
|
end
|
|
334
|
-
|
|
347
|
+
____temp_12 = ____value_index_11
|
|
335
348
|
end
|
|
336
|
-
return
|
|
349
|
+
return ____temp_12
|
|
337
350
|
end
|
|
338
351
|
end
|
|
339
352
|
if index ~= nil then
|
|
@@ -378,36 +391,36 @@ function ObjectLevelField.prototype.getValue(self, entry, level)
|
|
|
378
391
|
if defaultValueByObjectDataEntryId ~= nil then
|
|
379
392
|
local valueByLevel = defaultValueByObjectDataEntryId[entry.id]
|
|
380
393
|
if valueByLevel ~= nil then
|
|
381
|
-
local
|
|
382
|
-
if
|
|
383
|
-
|
|
394
|
+
local ____valueByLevel_index_13 = valueByLevel[level + 1]
|
|
395
|
+
if ____valueByLevel_index_13 == nil then
|
|
396
|
+
____valueByLevel_index_13 = self.defaultValue
|
|
384
397
|
end
|
|
385
|
-
return
|
|
398
|
+
return ____valueByLevel_index_13
|
|
386
399
|
end
|
|
387
400
|
end
|
|
388
401
|
return self.defaultValue
|
|
389
402
|
end
|
|
390
403
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
391
|
-
if defaultValueByObjectDataEntryId ~= nil then
|
|
392
|
-
local defaultValueByLevel = defaultValueByObjectDataEntryId[self:getObjectDataEntryId(entry)]
|
|
393
|
-
if defaultValueByLevel ~= nil then
|
|
394
|
-
local
|
|
395
|
-
local
|
|
396
|
-
if
|
|
397
|
-
|
|
404
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
405
|
+
local defaultValueByLevel = (defaultValueByObjectDataEntryId or emptyLuaMap())[self:getObjectDataEntryId(entry)]
|
|
406
|
+
if defaultValueByLevel ~= nil or self.isGlobal then
|
|
407
|
+
local ____opt_14 = self.valueByInstance[entry]
|
|
408
|
+
local ____temp_16 = ____opt_14 and ____opt_14[level + 1]
|
|
409
|
+
if ____temp_16 == nil then
|
|
410
|
+
____temp_16 = (defaultValueByLevel or emptyArray())[level + 1]
|
|
398
411
|
end
|
|
399
|
-
local
|
|
400
|
-
if
|
|
401
|
-
|
|
412
|
+
local ____temp_16_17 = ____temp_16
|
|
413
|
+
if ____temp_16_17 == nil then
|
|
414
|
+
____temp_16_17 = self.defaultValue
|
|
402
415
|
end
|
|
403
|
-
return
|
|
416
|
+
return ____temp_16_17
|
|
404
417
|
end
|
|
405
418
|
end
|
|
406
|
-
local
|
|
407
|
-
if
|
|
408
|
-
|
|
419
|
+
local ____temp_18 = self:getNativeFieldValue(entry, level)
|
|
420
|
+
if ____temp_18 == nil then
|
|
421
|
+
____temp_18 = self.defaultValue
|
|
409
422
|
end
|
|
410
|
-
return
|
|
423
|
+
return ____temp_18
|
|
411
424
|
end
|
|
412
425
|
function ObjectLevelField.prototype.setValue(self, entry, levelOrValue, value)
|
|
413
426
|
if value == nil then
|
|
@@ -448,23 +461,24 @@ function ObjectLevelField.prototype.setValue(self, entry, levelOrValue, value)
|
|
|
448
461
|
return true
|
|
449
462
|
end
|
|
450
463
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
464
|
+
local objectDataEntryId = self:getObjectDataEntryId(entry)
|
|
465
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
466
|
+
local defaultValueByLevel = (defaultValueByObjectDataEntryId or emptyLuaMap())[objectDataEntryId]
|
|
467
|
+
if defaultValueByLevel ~= nil or self.isGlobal then
|
|
454
468
|
local valueByLevel = self.valueByInstance[entry]
|
|
455
469
|
if valueByLevel == nil then
|
|
456
470
|
valueByLevel = {}
|
|
457
471
|
self.valueByInstance[entry] = valueByLevel
|
|
458
472
|
end
|
|
459
|
-
local
|
|
460
|
-
if
|
|
461
|
-
|
|
473
|
+
local ____valueByLevel_index_19 = valueByLevel[level + 1]
|
|
474
|
+
if ____valueByLevel_index_19 == nil then
|
|
475
|
+
____valueByLevel_index_19 = (defaultValueByLevel or emptyArray())[level + 1]
|
|
462
476
|
end
|
|
463
|
-
local
|
|
464
|
-
if
|
|
465
|
-
|
|
477
|
+
local ____valueByLevel_index_19_20 = ____valueByLevel_index_19
|
|
478
|
+
if ____valueByLevel_index_19_20 == nil then
|
|
479
|
+
____valueByLevel_index_19_20 = self.defaultValue
|
|
466
480
|
end
|
|
467
|
-
local previousValue =
|
|
481
|
+
local previousValue = ____valueByLevel_index_19_20
|
|
468
482
|
if value ~= previousValue then
|
|
469
483
|
valueByLevel[level + 1] = value
|
|
470
484
|
self:invokeValueChangeEvent(
|
|
@@ -478,7 +492,7 @@ function ObjectLevelField.prototype.setValue(self, entry, levelOrValue, value)
|
|
|
478
492
|
return true
|
|
479
493
|
end
|
|
480
494
|
end
|
|
481
|
-
if not self:hasNativeFieldValue(
|
|
495
|
+
if not self:hasNativeFieldValue(objectDataEntryId) then
|
|
482
496
|
return false
|
|
483
497
|
end
|
|
484
498
|
local previousValue = self:getNativeFieldValue(entry, level)
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
import { UnitClassificationsField, UnitPropulsionWindowField } from "../../object-field/unit";
|
|
3
|
+
export declare const PROPULSION_WINDOW_UNIT_FLOAT_FIELD: UnitPropulsionWindowField & symbol;
|
|
4
|
+
export declare const UNIT_CLASSIFICATIONS_FIELD: UnitClassificationsField & symbol;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____unit = require("engine.object-field.unit")
|
|
3
|
+
local UnitClassificationsField = ____unit.UnitClassificationsField
|
|
4
|
+
local UnitPropulsionWindowField = ____unit.UnitPropulsionWindowField
|
|
5
|
+
____exports.PROPULSION_WINDOW_UNIT_FLOAT_FIELD = UnitPropulsionWindowField:create(fourCC("urpw"))
|
|
6
|
+
____exports.UNIT_CLASSIFICATIONS_FIELD = UnitClassificationsField:create(fourCC("utyp"))
|
|
7
|
+
return ____exports
|
package/engine/text-tag.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Color } from "../core/types/color";
|
|
3
|
+
import { Unit } from "./internal/unit";
|
|
4
|
+
import { AbstractDestroyable, Destructor } from "../destroyable";
|
|
3
5
|
export type TextTagPreset = {
|
|
4
6
|
fadepoint: number;
|
|
5
7
|
lifespan: number;
|
|
@@ -10,9 +12,39 @@ export type TextTagPreset = {
|
|
|
10
12
|
velocityY: number;
|
|
11
13
|
color: Color;
|
|
12
14
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
declare const enum TextTagPropertyKey {
|
|
16
|
+
UNIT = 100,
|
|
17
|
+
HANDLE = 101,
|
|
18
|
+
CONFIGURATION = 102,
|
|
19
|
+
TEXT = 103,
|
|
20
|
+
FONT_SIZE = 104,
|
|
21
|
+
COLOR = 105,
|
|
22
|
+
X = 106,
|
|
23
|
+
Y = 107
|
|
24
|
+
}
|
|
25
|
+
export declare class TextTag extends AbstractDestroyable {
|
|
26
|
+
private [TextTagPropertyKey.HANDLE]?;
|
|
27
|
+
private [TextTagPropertyKey.CONFIGURATION]?;
|
|
28
|
+
private [TextTagPropertyKey.TEXT]?;
|
|
29
|
+
private [TextTagPropertyKey.FONT_SIZE]?;
|
|
30
|
+
private [TextTagPropertyKey.COLOR]?;
|
|
31
|
+
private [TextTagPropertyKey.UNIT]?;
|
|
32
|
+
private [TextTagPropertyKey.X]?;
|
|
33
|
+
private [TextTagPropertyKey.Y]?;
|
|
15
34
|
private constructor();
|
|
35
|
+
protected onDestroy(): Destructor;
|
|
36
|
+
get text(): string;
|
|
37
|
+
set text(text: string);
|
|
38
|
+
get fontSize(): number;
|
|
39
|
+
set fontSize(fontSize: number);
|
|
40
|
+
get color(): Color;
|
|
41
|
+
set color(color: Color);
|
|
42
|
+
get unit(): Unit | undefined;
|
|
43
|
+
set unit(unit: Unit | undefined);
|
|
44
|
+
get x(): number;
|
|
45
|
+
set x(x: number);
|
|
46
|
+
get y(): number;
|
|
47
|
+
set y(y: number);
|
|
16
48
|
static BASE: Readonly<TextTagPreset>;
|
|
17
49
|
static BASH: Readonly<TextTagPreset>;
|
|
18
50
|
static CRITICAL_STRIKE: Readonly<TextTagPreset>;
|
|
@@ -22,4 +54,6 @@ export declare class TextTag {
|
|
|
22
54
|
static MISS: Readonly<TextTagPreset>;
|
|
23
55
|
static SHADOW_STRIKE: Readonly<TextTagPreset>;
|
|
24
56
|
static flash(configuration: Readonly<TextTagPreset>, text: string, x: number, y: number, z?: number): void;
|
|
57
|
+
static create(configuration: Readonly<TextTagPreset>, text: string, unit: Unit): TextTag;
|
|
25
58
|
}
|
|
59
|
+
export {};
|