warscript 0.0.1-dev.83957b1 → 0.0.1-dev.83ffb73
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 +2 -1
- package/core/types/timer.lua +7 -2
- package/decl/native.d.ts +4 -2
- package/engine/behavior.d.ts +2 -0
- package/engine/behavior.lua +53 -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 +2 -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 +3 -3
- package/engine/internal/unit.lua +70 -57
- 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/unit.d.ts +11 -0
- package/engine/object-field/unit.lua +34 -0
- package/engine/object-field.d.ts +2 -0
- package/engine/object-field.lua +76 -69
- 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 +175 -10
- package/engine/unit.d.ts +1 -0
- package/engine/unit.lua +1 -0
- package/package.json +2 -2
- package/utility/functions.d.ts +5 -0
- package/utility/functions.lua +5 -0
- package/utility/lua-maps.d.ts +1 -0
- package/utility/lua-maps.lua +4 -0
- package/core/types/order.d.ts +0 -26
- package/core/types/order.lua +0 -65
|
@@ -27,6 +27,9 @@ local attackTypeToString = ____attack_2Dtype.attackTypeToString
|
|
|
27
27
|
local stringToAttackType = ____attack_2Dtype.stringToAttackType
|
|
28
28
|
local ____config = require("config")
|
|
29
29
|
local WarscriptConfig = ____config.WarscriptConfig
|
|
30
|
+
local ____armor_2Dtype = require("engine.object-data.auxiliary.armor-type")
|
|
31
|
+
local armorTypeToString = ____armor_2Dtype.armorTypeToString
|
|
32
|
+
local stringToArmorType = ____armor_2Dtype.stringToArmorType
|
|
30
33
|
local getOrCreateUnitTypeWeapons
|
|
31
34
|
____exports.UnitTypeWeapon = __TS__Class()
|
|
32
35
|
local UnitTypeWeapon = ____exports.UnitTypeWeapon
|
|
@@ -936,6 +939,19 @@ __TS__SetDescriptor(
|
|
|
936
939
|
},
|
|
937
940
|
true
|
|
938
941
|
)
|
|
942
|
+
__TS__SetDescriptor(
|
|
943
|
+
UnitType.prototype,
|
|
944
|
+
"selectionCircleHeight",
|
|
945
|
+
{
|
|
946
|
+
get = function(self)
|
|
947
|
+
return self:getNumberField("uslz")
|
|
948
|
+
end,
|
|
949
|
+
set = function(self, height)
|
|
950
|
+
self:setNumberField("uslz", height)
|
|
951
|
+
end
|
|
952
|
+
},
|
|
953
|
+
true
|
|
954
|
+
)
|
|
939
955
|
__TS__SetDescriptor(
|
|
940
956
|
UnitType.prototype,
|
|
941
957
|
"selectionCircleScale",
|
|
@@ -1183,6 +1199,19 @@ __TS__SetDescriptor(
|
|
|
1183
1199
|
},
|
|
1184
1200
|
true
|
|
1185
1201
|
)
|
|
1202
|
+
__TS__SetDescriptor(
|
|
1203
|
+
UnitType.prototype,
|
|
1204
|
+
"armor",
|
|
1205
|
+
{
|
|
1206
|
+
get = function(self)
|
|
1207
|
+
return self:getNumberField("udef")
|
|
1208
|
+
end,
|
|
1209
|
+
set = function(self, armor)
|
|
1210
|
+
self:setNumberField("udef", armor)
|
|
1211
|
+
end
|
|
1212
|
+
},
|
|
1213
|
+
true
|
|
1214
|
+
)
|
|
1186
1215
|
__TS__SetDescriptor(
|
|
1187
1216
|
UnitType.prototype,
|
|
1188
1217
|
"armorSoundType",
|
|
@@ -1222,6 +1251,22 @@ __TS__SetDescriptor(
|
|
|
1222
1251
|
},
|
|
1223
1252
|
true
|
|
1224
1253
|
)
|
|
1254
|
+
__TS__SetDescriptor(
|
|
1255
|
+
UnitType.prototype,
|
|
1256
|
+
"armorType",
|
|
1257
|
+
{
|
|
1258
|
+
get = function(self)
|
|
1259
|
+
return stringToArmorType(self:getStringField("udty"))
|
|
1260
|
+
end,
|
|
1261
|
+
set = function(self, armorType)
|
|
1262
|
+
self:setStringField(
|
|
1263
|
+
"udty",
|
|
1264
|
+
armorTypeToString(armorType)
|
|
1265
|
+
)
|
|
1266
|
+
end
|
|
1267
|
+
},
|
|
1268
|
+
true
|
|
1269
|
+
)
|
|
1225
1270
|
__TS__SetDescriptor(
|
|
1226
1271
|
UnitType.prototype,
|
|
1227
1272
|
"combatClassifications",
|
|
@@ -1240,7 +1285,7 @@ __TS__SetDescriptor(
|
|
|
1240
1285
|
)
|
|
1241
1286
|
__TS__SetDescriptor(
|
|
1242
1287
|
UnitType.prototype,
|
|
1243
|
-
"
|
|
1288
|
+
"classifications",
|
|
1244
1289
|
{
|
|
1245
1290
|
get = function(self)
|
|
1246
1291
|
return stringArrayToUnitClassifications(self:getStringsField("utyp"))
|
|
@@ -1476,6 +1521,19 @@ __TS__SetDescriptor(
|
|
|
1476
1521
|
},
|
|
1477
1522
|
true
|
|
1478
1523
|
)
|
|
1524
|
+
__TS__SetDescriptor(
|
|
1525
|
+
UnitType.prototype,
|
|
1526
|
+
"level",
|
|
1527
|
+
{
|
|
1528
|
+
get = function(self)
|
|
1529
|
+
return self:getNumberField("ulev")
|
|
1530
|
+
end,
|
|
1531
|
+
set = function(self, level)
|
|
1532
|
+
self:setNumberField("ulev", level)
|
|
1533
|
+
end
|
|
1534
|
+
},
|
|
1535
|
+
true
|
|
1536
|
+
)
|
|
1479
1537
|
__TS__SetDescriptor(
|
|
1480
1538
|
UnitType.prototype,
|
|
1481
1539
|
"manaRegenerationRate",
|
|
@@ -4,6 +4,7 @@ import { ObjectField, ObjectLevelField, ObjectLevelFieldValueChangeEvent, Readon
|
|
|
4
4
|
import { UnitType, UnitTypeId } from "../object-data/entry/unit-type";
|
|
5
5
|
import { ReadonlyNonEmptyLinkedSet } from "../../utility/linked-set";
|
|
6
6
|
import { AttackType } from "../object-data/auxiliary/attack-type";
|
|
7
|
+
import { UnitClassifications } from "../object-data/auxiliary/unit-classification";
|
|
7
8
|
export declare abstract class UnitField<ValueType extends number | string | boolean = number | string | boolean, NativeFieldType = any> extends ObjectField<UnitType, Unit, ValueType, NativeFieldType> {
|
|
8
9
|
protected get instanceClass(): typeof Unit;
|
|
9
10
|
protected getObjectDataEntryId(instance: Unit): UnitTypeId;
|
|
@@ -56,4 +57,14 @@ export declare abstract class UnitEnumWeaponField<T extends number> extends Unit
|
|
|
56
57
|
export declare class UnitAttackTypeWeaponField extends UnitEnumWeaponField<AttackType> {
|
|
57
58
|
protected values: ReadonlyNonEmptyLinkedSet<AttackType>;
|
|
58
59
|
}
|
|
60
|
+
export declare class UnitClassificationsField extends UnitField<UnitClassifications, junitintegerfield> {
|
|
61
|
+
protected get defaultValue(): UnitClassifications;
|
|
62
|
+
protected getNativeFieldById(id: number): junitintegerfield;
|
|
63
|
+
protected getNativeFieldValue(instance: Unit): UnitClassifications;
|
|
64
|
+
protected setNativeFieldValue(instance: Unit, value: UnitClassifications): boolean;
|
|
65
|
+
}
|
|
66
|
+
export declare class UnitPropulsionWindowField extends UnitFloatField {
|
|
67
|
+
protected getNativeFieldValue(instance: Unit): number;
|
|
68
|
+
protected setNativeFieldValue(instance: Unit, value: number): boolean;
|
|
69
|
+
}
|
|
59
70
|
export {};
|
|
@@ -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
|
@@ -80,6 +80,8 @@ export declare abstract class ObjectArrayField<ObjectDataEntryType extends Objec
|
|
|
80
80
|
setValue(entry: ObjectDataEntryType | InstanceType, value: ValueType[]): boolean;
|
|
81
81
|
}
|
|
82
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?;
|
|
83
85
|
protected abstract readonly defaultValue: ValueType;
|
|
84
86
|
protected abstract getNativeFieldValue(instance: InstanceType, level: number): ValueType;
|
|
85
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 = {}
|
|
@@ -36,7 +39,7 @@ local ObjectFieldBase = __TS__Class()
|
|
|
36
39
|
ObjectFieldBase.name = "ObjectFieldBase"
|
|
37
40
|
function ObjectFieldBase.prototype.____constructor(self, id, isGlobal)
|
|
38
41
|
if isGlobal == nil then
|
|
39
|
-
isGlobal =
|
|
42
|
+
isGlobal = false
|
|
40
43
|
end
|
|
41
44
|
self.isGlobal = isGlobal
|
|
42
45
|
self.valueByInstance = setmetatable({}, {__mode = "k"})
|
|
@@ -190,36 +193,40 @@ function ObjectField.prototype.trySetValue(self, entry, value)
|
|
|
190
193
|
end
|
|
191
194
|
function ObjectField.prototype.getActualValue(self, instance)
|
|
192
195
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
193
|
-
if defaultValueByObjectDataEntryId ~= nil then
|
|
194
|
-
local defaultValue = defaultValueByObjectDataEntryId[self:getObjectDataEntryId(instance)]
|
|
195
|
-
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
|
|
196
199
|
local ____self_valueByInstance_instance_0 = self.valueByInstance[instance]
|
|
197
200
|
if ____self_valueByInstance_instance_0 == nil then
|
|
198
201
|
____self_valueByInstance_instance_0 = defaultValue
|
|
199
202
|
end
|
|
200
|
-
|
|
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
|
|
201
208
|
end
|
|
202
209
|
end
|
|
203
|
-
local
|
|
204
|
-
if
|
|
205
|
-
|
|
210
|
+
local ____temp_2 = self:getNativeFieldValue(instance)
|
|
211
|
+
if ____temp_2 == nil then
|
|
212
|
+
____temp_2 = self.defaultValue
|
|
206
213
|
end
|
|
207
|
-
return
|
|
214
|
+
return ____temp_2
|
|
208
215
|
end
|
|
209
216
|
function ObjectField.prototype.setActualValue(self, instance, value)
|
|
210
217
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
211
|
-
if defaultValueByObjectDataEntryId ~= nil then
|
|
212
|
-
local defaultValue = defaultValueByObjectDataEntryId[self:getObjectDataEntryId(instance)]
|
|
218
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
219
|
+
local defaultValue = (defaultValueByObjectDataEntryId or emptyLuaMap())[self:getObjectDataEntryId(instance)]
|
|
213
220
|
if defaultValue ~= nil or self.isGlobal then
|
|
214
|
-
local
|
|
215
|
-
if
|
|
216
|
-
|
|
221
|
+
local ____self_valueByInstance_instance_3 = self.valueByInstance[instance]
|
|
222
|
+
if ____self_valueByInstance_instance_3 == nil then
|
|
223
|
+
____self_valueByInstance_instance_3 = defaultValue
|
|
217
224
|
end
|
|
218
|
-
local
|
|
219
|
-
if
|
|
220
|
-
|
|
225
|
+
local ____self_valueByInstance_instance_3_4 = ____self_valueByInstance_instance_3
|
|
226
|
+
if ____self_valueByInstance_instance_3_4 == nil then
|
|
227
|
+
____self_valueByInstance_instance_3_4 = self.defaultValue
|
|
221
228
|
end
|
|
222
|
-
local previousValue =
|
|
229
|
+
local previousValue = ____self_valueByInstance_instance_3_4
|
|
223
230
|
if value ~= previousValue then
|
|
224
231
|
self.valueByInstance[instance] = value
|
|
225
232
|
self:invokeValueChangeEvent(instance, self, previousValue, value)
|
|
@@ -240,10 +247,10 @@ function ObjectField.prototype.setActualValue(self, instance, value)
|
|
|
240
247
|
return true
|
|
241
248
|
end
|
|
242
249
|
function ObjectField.prototype.calculateActualValue(self, instance)
|
|
243
|
-
local
|
|
244
|
-
local originalValue =
|
|
245
|
-
local
|
|
246
|
-
local modifiers =
|
|
250
|
+
local ____opt_5 = self.originalValueByInstance
|
|
251
|
+
local originalValue = ____opt_5 and ____opt_5[instance]
|
|
252
|
+
local ____opt_7 = self.modifiersByInstance
|
|
253
|
+
local modifiers = ____opt_7 and ____opt_7[instance]
|
|
247
254
|
if originalValue ~= nil then
|
|
248
255
|
local value = originalValue
|
|
249
256
|
if modifiers ~= nil then
|
|
@@ -308,37 +315,37 @@ function ObjectArrayField.prototype.getValue(self, entry, index)
|
|
|
308
315
|
if defaultValueByObjectDataEntryId ~= nil then
|
|
309
316
|
local value = defaultValueByObjectDataEntryId[entry.id]
|
|
310
317
|
if value ~= nil then
|
|
311
|
-
local
|
|
318
|
+
local ____temp_10
|
|
312
319
|
if index == nil then
|
|
313
|
-
|
|
320
|
+
____temp_10 = value
|
|
314
321
|
else
|
|
315
|
-
local
|
|
316
|
-
if
|
|
317
|
-
|
|
322
|
+
local ____value_index_9 = value[index + 1]
|
|
323
|
+
if ____value_index_9 == nil then
|
|
324
|
+
____value_index_9 = self.defaultValue
|
|
318
325
|
end
|
|
319
|
-
|
|
326
|
+
____temp_10 = ____value_index_9
|
|
320
327
|
end
|
|
321
|
-
return
|
|
328
|
+
return ____temp_10
|
|
322
329
|
end
|
|
323
330
|
end
|
|
324
331
|
return index == nil and ({}) or self.defaultValue
|
|
325
332
|
end
|
|
326
333
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
327
|
-
if defaultValueByObjectDataEntryId ~= nil then
|
|
328
|
-
local defaultValue = defaultValueByObjectDataEntryId[self:getObjectDataEntryId(entry)]
|
|
329
|
-
if defaultValue ~= nil then
|
|
330
|
-
local value = self.valueByInstance[entry] or defaultValue
|
|
331
|
-
local
|
|
334
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
335
|
+
local defaultValue = (defaultValueByObjectDataEntryId or emptyLuaMap())[self:getObjectDataEntryId(entry)]
|
|
336
|
+
if defaultValue ~= nil or self.isGlobal then
|
|
337
|
+
local value = self.valueByInstance[entry] or defaultValue or emptyArray()
|
|
338
|
+
local ____temp_12
|
|
332
339
|
if index == nil then
|
|
333
|
-
|
|
340
|
+
____temp_12 = value
|
|
334
341
|
else
|
|
335
|
-
local
|
|
336
|
-
if
|
|
337
|
-
|
|
342
|
+
local ____value_index_11 = value[index + 1]
|
|
343
|
+
if ____value_index_11 == nil then
|
|
344
|
+
____value_index_11 = self.defaultValue
|
|
338
345
|
end
|
|
339
|
-
|
|
346
|
+
____temp_12 = ____value_index_11
|
|
340
347
|
end
|
|
341
|
-
return
|
|
348
|
+
return ____temp_12
|
|
342
349
|
end
|
|
343
350
|
end
|
|
344
351
|
if index ~= nil then
|
|
@@ -383,36 +390,36 @@ function ObjectLevelField.prototype.getValue(self, entry, level)
|
|
|
383
390
|
if defaultValueByObjectDataEntryId ~= nil then
|
|
384
391
|
local valueByLevel = defaultValueByObjectDataEntryId[entry.id]
|
|
385
392
|
if valueByLevel ~= nil then
|
|
386
|
-
local
|
|
387
|
-
if
|
|
388
|
-
|
|
393
|
+
local ____valueByLevel_index_13 = valueByLevel[level + 1]
|
|
394
|
+
if ____valueByLevel_index_13 == nil then
|
|
395
|
+
____valueByLevel_index_13 = self.defaultValue
|
|
389
396
|
end
|
|
390
|
-
return
|
|
397
|
+
return ____valueByLevel_index_13
|
|
391
398
|
end
|
|
392
399
|
end
|
|
393
400
|
return self.defaultValue
|
|
394
401
|
end
|
|
395
402
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
396
|
-
if defaultValueByObjectDataEntryId ~= nil then
|
|
397
|
-
local defaultValueByLevel = defaultValueByObjectDataEntryId[self:getObjectDataEntryId(entry)]
|
|
398
|
-
if defaultValueByLevel ~= nil then
|
|
399
|
-
local
|
|
400
|
-
local
|
|
401
|
-
if
|
|
402
|
-
|
|
403
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
404
|
+
local defaultValueByLevel = (defaultValueByObjectDataEntryId or emptyLuaMap())[self:getObjectDataEntryId(entry)]
|
|
405
|
+
if defaultValueByLevel ~= nil or self.isGlobal then
|
|
406
|
+
local ____opt_14 = self.valueByInstance[entry]
|
|
407
|
+
local ____temp_16 = ____opt_14 and ____opt_14[level + 1]
|
|
408
|
+
if ____temp_16 == nil then
|
|
409
|
+
____temp_16 = (defaultValueByLevel or emptyArray())[level + 1]
|
|
403
410
|
end
|
|
404
|
-
local
|
|
405
|
-
if
|
|
406
|
-
|
|
411
|
+
local ____temp_16_17 = ____temp_16
|
|
412
|
+
if ____temp_16_17 == nil then
|
|
413
|
+
____temp_16_17 = self.defaultValue
|
|
407
414
|
end
|
|
408
|
-
return
|
|
415
|
+
return ____temp_16_17
|
|
409
416
|
end
|
|
410
417
|
end
|
|
411
|
-
local
|
|
412
|
-
if
|
|
413
|
-
|
|
418
|
+
local ____temp_18 = self:getNativeFieldValue(entry, level)
|
|
419
|
+
if ____temp_18 == nil then
|
|
420
|
+
____temp_18 = self.defaultValue
|
|
414
421
|
end
|
|
415
|
-
return
|
|
422
|
+
return ____temp_18
|
|
416
423
|
end
|
|
417
424
|
function ObjectLevelField.prototype.setValue(self, entry, levelOrValue, value)
|
|
418
425
|
if value == nil then
|
|
@@ -453,23 +460,23 @@ function ObjectLevelField.prototype.setValue(self, entry, levelOrValue, value)
|
|
|
453
460
|
return true
|
|
454
461
|
end
|
|
455
462
|
local defaultValueByObjectDataEntryId = defaultValueByObjectDataEntryIdByObjectFieldId[self.id]
|
|
456
|
-
if defaultValueByObjectDataEntryId ~= nil then
|
|
457
|
-
local defaultValueByLevel = defaultValueByObjectDataEntryId[self:getObjectDataEntryId(entry)]
|
|
458
|
-
if defaultValueByLevel ~= nil then
|
|
463
|
+
if defaultValueByObjectDataEntryId ~= nil or self.isGlobal then
|
|
464
|
+
local defaultValueByLevel = (defaultValueByObjectDataEntryId or emptyLuaMap())[self:getObjectDataEntryId(entry)]
|
|
465
|
+
if defaultValueByLevel ~= nil or self.isGlobal then
|
|
459
466
|
local valueByLevel = self.valueByInstance[entry]
|
|
460
467
|
if valueByLevel == nil then
|
|
461
468
|
valueByLevel = {}
|
|
462
469
|
self.valueByInstance[entry] = valueByLevel
|
|
463
470
|
end
|
|
464
|
-
local
|
|
465
|
-
if
|
|
466
|
-
|
|
471
|
+
local ____valueByLevel_index_19 = valueByLevel[level + 1]
|
|
472
|
+
if ____valueByLevel_index_19 == nil then
|
|
473
|
+
____valueByLevel_index_19 = (defaultValueByLevel or emptyArray())[level + 1]
|
|
467
474
|
end
|
|
468
|
-
local
|
|
469
|
-
if
|
|
470
|
-
|
|
475
|
+
local ____valueByLevel_index_19_20 = ____valueByLevel_index_19
|
|
476
|
+
if ____valueByLevel_index_19_20 == nil then
|
|
477
|
+
____valueByLevel_index_19_20 = self.defaultValue
|
|
471
478
|
end
|
|
472
|
-
local previousValue =
|
|
479
|
+
local previousValue = ____valueByLevel_index_19_20
|
|
473
480
|
if value ~= previousValue then
|
|
474
481
|
valueByLevel[level + 1] = value
|
|
475
482
|
self:invokeValueChangeEvent(
|
|
@@ -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 readonly [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 {};
|