warscript 0.0.1-dev.b9bd489 → 0.0.1-dev.bad60be
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 +5 -0
- package/attributes.lua +8 -1
- package/config.d.ts +5 -0
- package/config.lua +10 -0
- package/core/types/effect.d.ts +2 -3
- package/core/types/effect.lua +95 -48
- package/core/types/sound.d.ts +17 -24
- package/core/types/sound.lua +99 -24
- package/core/types/timer.d.ts +7 -8
- package/core/types/timer.lua +18 -21
- package/core/util.lua +6 -1
- package/decl/native.d.ts +840 -786
- package/engine/behaviour/ability/apply-buff.d.ts +5 -0
- 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 +9 -3
- package/engine/behaviour/ability/damage.lua +26 -38
- package/engine/behaviour/ability/emulate-impact.lua +20 -8
- package/engine/behaviour/ability/on-command-impact.lua +7 -0
- package/engine/behaviour/ability.d.ts +12 -3
- package/engine/behaviour/ability.lua +74 -24
- 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 +28 -0
- package/engine/behaviour/unit.lua +160 -4
- package/engine/buff.d.ts +57 -41
- package/engine/buff.lua +301 -228
- package/engine/internal/ability.d.ts +15 -1
- package/engine/internal/ability.lua +84 -2
- package/engine/internal/item/ability.lua +161 -4
- package/engine/internal/item.d.ts +7 -4
- package/engine/internal/item.lua +131 -28
- package/engine/internal/mechanics/ability-duration.lua +1 -1
- package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -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 +35 -0
- package/engine/internal/unit/ability.lua +62 -0
- 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/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit/bonus.d.ts +2 -0
- package/engine/internal/unit/bonus.lua +17 -0
- 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.lua +6 -12
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit+damage.d.ts +2 -11
- package/engine/internal/unit+damage.lua +10 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit-missile-launch.lua +1 -1
- package/engine/internal/unit.d.ts +29 -5
- package/engine/internal/unit.lua +284 -87
- package/engine/internal/utility.lua +12 -0
- package/engine/lightning.d.ts +12 -5
- package/engine/lightning.lua +48 -14
- 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/attack-type.d.ts +7 -8
- package/engine/object-data/auxiliary/attack-type.lua +42 -0
- package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
- package/engine/object-data/auxiliary/movement-type.lua +22 -0
- 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/tech-tree-dependency.d.ts +1 -1
- package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
- package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
- package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
- package/engine/object-data/entry/ability-type/berserk.lua +13 -0
- 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/permanent-invisibility.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
- 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/slow-poison.d.ts +10 -0
- package/engine/object-data/entry/ability-type/slow-poison.lua +58 -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 +89 -33
- package/engine/object-data/entry/buff-type/applicable.lua +18 -37
- package/engine/object-data/entry/buff-type.d.ts +6 -12
- package/engine/object-data/entry/buff-type.lua +13 -29
- package/engine/object-data/entry/destructible-type.d.ts +1 -1
- package/engine/object-data/entry/item-type.d.ts +3 -1
- package/engine/object-data/entry/item-type.lua +15 -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 +10 -3
- package/engine/object-data/entry/unit-type.lua +155 -92
- 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 +6 -3
- package/engine/object-field/ability.lua +3 -0
- package/engine/object-field/unit.d.ts +50 -3
- package/engine/object-field/unit.lua +186 -7
- package/engine/object-field.d.ts +17 -6
- package/engine/object-field.lua +187 -89
- package/engine/standard/entries/buff-type.d.ts +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- package/engine/standard/entries/sound-preset.d.ts +10 -0
- package/engine/standard/entries/sound-preset.lua +10 -0
- package/engine/standard/fields/unit.d.ts +3 -0
- package/engine/standard/fields/unit.lua +5 -0
- package/engine/text-tag.d.ts +36 -2
- package/engine/text-tag.lua +175 -10
- package/engine/unit.d.ts +2 -0
- package/engine/unit.lua +2 -0
- package/objutil/buff.lua +1 -2
- package/objutil/unit.lua +8 -0
- package/package.json +2 -2
- package/utility/arrays.d.ts +1 -0
- package/utility/arrays.lua +3 -0
- package/utility/functions.d.ts +1 -0
- package/utility/functions.lua +1 -0
- package/utility/linked-set.d.ts +1 -0
- package/utility/linked-set.lua +3 -0
- package/utility/lua-maps.d.ts +4 -0
- package/utility/lua-maps.lua +20 -0
- package/utility/lua-sets.d.ts +1 -0
- package/utility/lua-sets.lua +3 -0
- package/utility/reflection.lua +11 -7
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
package/engine/internal/unit.lua
CHANGED
|
@@ -51,12 +51,21 @@ local ____arrays = require("utility.arrays")
|
|
|
51
51
|
local forEach = ____arrays.forEach
|
|
52
52
|
local ____math = require("math")
|
|
53
53
|
local min = ____math.min
|
|
54
|
+
local ____ignore_2Devents_2Ditems = require("engine.internal.unit.ignore-events-items")
|
|
55
|
+
local ignoreEventsItems = ____ignore_2Devents_2Ditems.ignoreEventsItems
|
|
56
|
+
local ____attack_2Dtype = require("engine.object-data.auxiliary.attack-type")
|
|
57
|
+
local attackTypeToNative = ____attack_2Dtype.attackTypeToNative
|
|
58
|
+
local nativeToAttackType = ____attack_2Dtype.nativeToAttackType
|
|
59
|
+
local ____damage_2Dmetadata_2Dby_2Dtarget = require("engine.internal.misc.damage-metadata-by-target")
|
|
60
|
+
local damageMetadataByTarget = ____damage_2Dmetadata_2Dby_2Dtarget.damageMetadataByTarget
|
|
61
|
+
local ____attributes = require("attributes")
|
|
62
|
+
local isAttribute = ____attributes.isAttribute
|
|
63
|
+
local ____ability = require("engine.internal.item.ability")
|
|
64
|
+
local doUnitAbilityAction = ____ability.doUnitAbilityAction
|
|
54
65
|
local match = string.match
|
|
55
66
|
local ____tostring = _G.tostring
|
|
56
67
|
local setUnitAnimation = SetUnitAnimation
|
|
57
|
-
local setUnitAnimationWithRarity = SetUnitAnimationWithRarity
|
|
58
68
|
local setUnitAnimationByIndex = SetUnitAnimationByIndex
|
|
59
|
-
local queueUnitAnimation = QueueUnitAnimation
|
|
60
69
|
local getUnitIntegerField = BlzGetUnitIntegerField
|
|
61
70
|
local getUnitRealField = BlzGetUnitRealField
|
|
62
71
|
local getHeroStr = GetHeroStr
|
|
@@ -75,9 +84,9 @@ local setUnitScale = SetUnitScale
|
|
|
75
84
|
local setUnitPosition = SetUnitPosition
|
|
76
85
|
local setUnitTimeScale = SetUnitTimeScale
|
|
77
86
|
local getHandleId = GetHandleId
|
|
87
|
+
local getUnitCurrentOrder = GetUnitCurrentOrder
|
|
78
88
|
local createUnit = CreateUnit
|
|
79
89
|
local killUnit = KillUnit
|
|
80
|
-
local setUnitExploded = SetUnitExploded
|
|
81
90
|
local removeUnit = RemoveUnit
|
|
82
91
|
local getUnitTypeId = GetUnitTypeId
|
|
83
92
|
local isHeroUnitId = IsHeroUnitId
|
|
@@ -93,8 +102,6 @@ local getSpellTargetItem = GetSpellTargetItem
|
|
|
93
102
|
local getSpellTargetDestructable = GetSpellTargetDestructable
|
|
94
103
|
local isUnitInRangeXY = IsUnitInRangeXY
|
|
95
104
|
local isUnitInRange = IsUnitInRange
|
|
96
|
-
local setResourceAmount = SetResourceAmount
|
|
97
|
-
local getResourceAmount = GetResourceAmount
|
|
98
105
|
local getUnitWeaponRealField = BlzGetUnitWeaponRealField
|
|
99
106
|
local setUnitWeaponRealField = BlzSetUnitWeaponRealField
|
|
100
107
|
local getUnitWeaponStringField = BlzGetUnitWeaponStringField
|
|
@@ -118,15 +125,9 @@ local getOrderedUnit = GetOrderedUnit
|
|
|
118
125
|
local getIssuedOrderId = GetIssuedOrderId
|
|
119
126
|
local isUnitInvulnerable = BlzIsUnitInvulnerable
|
|
120
127
|
local unitAlive = UnitAlive
|
|
121
|
-
local unitAddType = UnitAddType
|
|
122
|
-
local unitRemoveType = UnitRemoveType
|
|
123
|
-
local isUnitIllusion = IsUnitIllusion
|
|
124
|
-
local isUnitType = IsUnitType
|
|
125
128
|
local isUnitAlly = IsUnitAlly
|
|
126
129
|
local isUnitEnemy = IsUnitEnemy
|
|
127
130
|
local getOwningPlayer = GetOwningPlayer
|
|
128
|
-
local setUnitColor = SetUnitColor
|
|
129
|
-
local showUnitTeamGlow = BlzShowUnitTeamGlow
|
|
130
131
|
____exports.UnitClassification = {}
|
|
131
132
|
local UnitClassification = ____exports.UnitClassification
|
|
132
133
|
do
|
|
@@ -136,6 +137,7 @@ do
|
|
|
136
137
|
UnitClassification.GROUND = UNIT_TYPE_GROUND
|
|
137
138
|
UnitClassification.SUMMONED = UNIT_TYPE_SUMMONED
|
|
138
139
|
UnitClassification.MECHANICAL = UNIT_TYPE_MECHANICAL
|
|
140
|
+
UnitClassification.WORKER = UNIT_TYPE_PEON
|
|
139
141
|
UnitClassification.ANCIENT = UNIT_TYPE_ANCIENT
|
|
140
142
|
UnitClassification.SUICIDAL = UNIT_TYPE_SAPPER
|
|
141
143
|
UnitClassification.TAUREN = UNIT_TYPE_TAUREN
|
|
@@ -343,6 +345,9 @@ local function dispatchAbility(event)
|
|
|
343
345
|
}
|
|
344
346
|
)
|
|
345
347
|
end
|
|
348
|
+
local function damagingEventPreventRetaliation(self)
|
|
349
|
+
self[0] = true
|
|
350
|
+
end
|
|
346
351
|
local function damageEventPreventDeath(self, callback, ...)
|
|
347
352
|
if self[0] ~= nil then
|
|
348
353
|
return
|
|
@@ -354,7 +359,14 @@ local function damageEventPreventDeath(self, callback, ...)
|
|
|
354
359
|
rawset(self, 1 + i, (select(i, ...)))
|
|
355
360
|
end
|
|
356
361
|
end
|
|
357
|
-
local damageSetters = {
|
|
362
|
+
local damageSetters = {
|
|
363
|
+
amount = BlzSetEventDamage,
|
|
364
|
+
attackType = function(attackType)
|
|
365
|
+
return BlzSetEventAttackType(attackTypeToNative(attackType))
|
|
366
|
+
end,
|
|
367
|
+
damageType = BlzSetEventDamageType,
|
|
368
|
+
weaponType = BlzSetEventWeaponType
|
|
369
|
+
}
|
|
358
370
|
local jlimitopByOperator = {
|
|
359
371
|
[0] = LESS_THAN_OR_EQUAL,
|
|
360
372
|
[1] = LESS_THAN_OR_EQUAL,
|
|
@@ -432,6 +444,19 @@ __TS__SetDescriptor(
|
|
|
432
444
|
},
|
|
433
445
|
true
|
|
434
446
|
)
|
|
447
|
+
__TS__SetDescriptor(
|
|
448
|
+
UnitWeapon.prototype,
|
|
449
|
+
"allowedTargetCombatClassifications",
|
|
450
|
+
{
|
|
451
|
+
get = function(self)
|
|
452
|
+
return BlzGetUnitWeaponIntegerField(self.unit.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, self.index)
|
|
453
|
+
end,
|
|
454
|
+
set = function(self, allowedTargetCombatClassifications)
|
|
455
|
+
BlzSetUnitWeaponIntegerField(self.unit.handle, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, self.index, allowedTargetCombatClassifications)
|
|
456
|
+
end
|
|
457
|
+
},
|
|
458
|
+
true
|
|
459
|
+
)
|
|
435
460
|
__TS__SetDescriptor(
|
|
436
461
|
UnitWeapon.prototype,
|
|
437
462
|
"damageBase",
|
|
@@ -636,7 +661,43 @@ local function delayHealthChecksCallback(unit)
|
|
|
636
661
|
end
|
|
637
662
|
end
|
|
638
663
|
local nextSyncId = 1
|
|
639
|
-
local unitBySyncId = setmetatable({}, {__mode = "
|
|
664
|
+
local unitBySyncId = setmetatable({}, {__mode = "v"})
|
|
665
|
+
local damagingEventByTarget = setmetatable({}, {__mode = "k"})
|
|
666
|
+
local function addAbility(unit, abilityTypeId)
|
|
667
|
+
local handle = unit.handle
|
|
668
|
+
if unitAddAbility(handle, abilityTypeId) then
|
|
669
|
+
local ability = UnitAbility:of(
|
|
670
|
+
checkNotNull(getUnitAbility(handle, abilityTypeId)),
|
|
671
|
+
abilityTypeId,
|
|
672
|
+
unit
|
|
673
|
+
)
|
|
674
|
+
local abilities = unit.abilities
|
|
675
|
+
abilities[#abilities + 1] = ability
|
|
676
|
+
return ability
|
|
677
|
+
end
|
|
678
|
+
return nil
|
|
679
|
+
end
|
|
680
|
+
local function getAbility(unit, abilityTypeId)
|
|
681
|
+
return UnitAbility:of(
|
|
682
|
+
getUnitAbility(unit.handle, abilityTypeId),
|
|
683
|
+
abilityTypeId,
|
|
684
|
+
unit
|
|
685
|
+
)
|
|
686
|
+
end
|
|
687
|
+
local function removeAbility(unit, abilityTypeId)
|
|
688
|
+
if unitRemoveAbility(unit.handle, abilityTypeId) then
|
|
689
|
+
local abilities = unit.abilities
|
|
690
|
+
for i = 1, #abilities do
|
|
691
|
+
if abilities[i].typeId == abilityTypeId then
|
|
692
|
+
abilities[i]:destroy()
|
|
693
|
+
tremove(abilities, i)
|
|
694
|
+
return true
|
|
695
|
+
end
|
|
696
|
+
end
|
|
697
|
+
return true
|
|
698
|
+
end
|
|
699
|
+
return false
|
|
700
|
+
end
|
|
640
701
|
____exports.Unit = __TS__Class()
|
|
641
702
|
local Unit = ____exports.Unit
|
|
642
703
|
Unit.name = "Unit"
|
|
@@ -677,6 +738,8 @@ function Unit.prototype.getEvent(self, event, collector)
|
|
|
677
738
|
end
|
|
678
739
|
function Unit.prototype.onDestroy(self)
|
|
679
740
|
local handle = self.handle
|
|
741
|
+
self[107] = getUnitX(handle)
|
|
742
|
+
self[108] = getUnitY(handle)
|
|
680
743
|
if not self._owner then
|
|
681
744
|
self._owner = Player:of(getOwningPlayer(handle))
|
|
682
745
|
end
|
|
@@ -748,13 +811,13 @@ function Unit.prototype.hasCombatClassification(self, combatClassification)
|
|
|
748
811
|
return getUnitIntegerField(self.handle, UNIT_IF_TARGETED_AS) & ____combatClassification_1 == ____combatClassification_1
|
|
749
812
|
end
|
|
750
813
|
function Unit.prototype.addClassification(self, classification)
|
|
751
|
-
return
|
|
814
|
+
return UnitAddType(self.handle, classification)
|
|
752
815
|
end
|
|
753
816
|
function Unit.prototype.removeClassification(self, classification)
|
|
754
|
-
return
|
|
817
|
+
return UnitRemoveType(self.handle, classification)
|
|
755
818
|
end
|
|
756
819
|
function Unit.prototype.hasClassification(self, classification)
|
|
757
|
-
return
|
|
820
|
+
return IsUnitType(self.handle, classification)
|
|
758
821
|
end
|
|
759
822
|
function Unit.prototype.isVisibleTo(self, player)
|
|
760
823
|
return isUnitVisible(self.handle, player.handle)
|
|
@@ -787,13 +850,25 @@ function Unit.prototype.playAnimation(self, animation, rarity)
|
|
|
787
850
|
if type(animation) == "number" then
|
|
788
851
|
setUnitAnimationByIndex(self.handle, animation)
|
|
789
852
|
elseif rarity then
|
|
790
|
-
|
|
853
|
+
SetUnitAnimationWithRarity(self.handle, animation, rarity)
|
|
791
854
|
else
|
|
792
855
|
setUnitAnimation(self.handle, animation)
|
|
793
856
|
end
|
|
794
857
|
end
|
|
858
|
+
function Unit.prototype.resetAnimation(self)
|
|
859
|
+
ResetUnitAnimation(self.handle)
|
|
860
|
+
end
|
|
795
861
|
function Unit.prototype.queueAnimation(self, animation)
|
|
796
|
-
|
|
862
|
+
QueueUnitAnimation(self.handle, animation)
|
|
863
|
+
end
|
|
864
|
+
function Unit.prototype.chooseWeapon(self, target)
|
|
865
|
+
if target:isAllowedTarget(self, self.firstWeapon.allowedTargetCombatClassifications) then
|
|
866
|
+
return self.firstWeapon
|
|
867
|
+
end
|
|
868
|
+
if target:isAllowedTarget(target, self.secondWeapon.allowedTargetCombatClassifications) then
|
|
869
|
+
return self.secondWeapon
|
|
870
|
+
end
|
|
871
|
+
return nil
|
|
797
872
|
end
|
|
798
873
|
function Unit.prototype.delayHealthChecks(self)
|
|
799
874
|
self[103] = (self[103] or 0) + 1
|
|
@@ -806,7 +881,7 @@ function Unit.prototype.isSelected(self, player)
|
|
|
806
881
|
return IsUnitSelected(self.handle, player.handle)
|
|
807
882
|
end
|
|
808
883
|
function Unit.prototype.explode(self)
|
|
809
|
-
|
|
884
|
+
SetUnitExploded(self.handle, true)
|
|
810
885
|
killUnit(self.handle)
|
|
811
886
|
end
|
|
812
887
|
function Unit.prototype.kill(self)
|
|
@@ -863,17 +938,13 @@ function Unit.prototype.itemInSlot(self, slot)
|
|
|
863
938
|
return Item:of(unitItemInSlot(self.handle, slot))
|
|
864
939
|
end
|
|
865
940
|
function Unit.prototype.addAbility(self, abilityId)
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
abilities[#abilities + 1] = ability
|
|
874
|
-
return ability
|
|
875
|
-
end
|
|
876
|
-
return nil
|
|
941
|
+
return doUnitAbilityAction(
|
|
942
|
+
self.handle,
|
|
943
|
+
abilityId,
|
|
944
|
+
addAbility,
|
|
945
|
+
self,
|
|
946
|
+
abilityId
|
|
947
|
+
)
|
|
877
948
|
end
|
|
878
949
|
function Unit.prototype.makeAbilityPermanent(self, abilityId, permanent)
|
|
879
950
|
return UnitMakeAbilityPermanent(self.handle, permanent, abilityId)
|
|
@@ -888,30 +959,22 @@ function Unit.prototype.hasAbility(self, abilityId)
|
|
|
888
959
|
return getUnitAbilityLevel(self.handle, abilityId) > 0
|
|
889
960
|
end
|
|
890
961
|
function Unit.prototype.getAbilityById(self, abilityId)
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
assert(unitRemoveAbility(handle, abilityId))
|
|
894
|
-
return nil
|
|
895
|
-
end
|
|
896
|
-
return UnitAbility:of(
|
|
897
|
-
getUnitAbility(self.handle, abilityId),
|
|
962
|
+
return doUnitAbilityAction(
|
|
963
|
+
self.handle,
|
|
898
964
|
abilityId,
|
|
899
|
-
|
|
965
|
+
getAbility,
|
|
966
|
+
self,
|
|
967
|
+
abilityId
|
|
900
968
|
)
|
|
901
969
|
end
|
|
902
970
|
function Unit.prototype.removeAbility(self, abilityId)
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
end
|
|
911
|
-
end
|
|
912
|
-
return true
|
|
913
|
-
end
|
|
914
|
-
return false
|
|
971
|
+
return doUnitAbilityAction(
|
|
972
|
+
self.handle,
|
|
973
|
+
abilityId,
|
|
974
|
+
removeAbility,
|
|
975
|
+
self,
|
|
976
|
+
abilityId
|
|
977
|
+
)
|
|
915
978
|
end
|
|
916
979
|
function Unit.prototype.hideAbility(self, abilityId, flag)
|
|
917
980
|
BlzUnitHideAbility(self.handle, abilityId, flag)
|
|
@@ -925,12 +988,34 @@ end
|
|
|
925
988
|
function Unit.prototype.endAbilityCooldown(self, abilityId)
|
|
926
989
|
BlzEndUnitAbilityCooldown(self.handle, abilityId)
|
|
927
990
|
end
|
|
991
|
+
function Unit.prototype.interruptMovement(self)
|
|
992
|
+
local handle = self.handle
|
|
993
|
+
unitDisableAbility(
|
|
994
|
+
handle,
|
|
995
|
+
fourCC("Amov"),
|
|
996
|
+
true,
|
|
997
|
+
false
|
|
998
|
+
)
|
|
999
|
+
unitDisableAbility(
|
|
1000
|
+
handle,
|
|
1001
|
+
fourCC("Amov"),
|
|
1002
|
+
false,
|
|
1003
|
+
false
|
|
1004
|
+
)
|
|
1005
|
+
end
|
|
928
1006
|
function Unit.prototype.interruptAttack(self)
|
|
929
1007
|
unitInterruptAttack(self.handle)
|
|
930
1008
|
end
|
|
931
1009
|
function Unit.prototype.interruptCast(self, abilityId)
|
|
932
|
-
|
|
933
|
-
unitDisableAbility(
|
|
1010
|
+
local handle = self.handle
|
|
1011
|
+
unitDisableAbility(handle, abilityId, true, false)
|
|
1012
|
+
Timer:run(
|
|
1013
|
+
unitDisableAbility,
|
|
1014
|
+
handle,
|
|
1015
|
+
abilityId,
|
|
1016
|
+
false,
|
|
1017
|
+
false
|
|
1018
|
+
)
|
|
934
1019
|
end
|
|
935
1020
|
function Unit.prototype.getDistanceTo(self, target)
|
|
936
1021
|
local handle = self.handle
|
|
@@ -1191,7 +1276,15 @@ __TS__SetDescriptor(
|
|
|
1191
1276
|
Unit.prototype,
|
|
1192
1277
|
"isIllusion",
|
|
1193
1278
|
{get = function(self)
|
|
1194
|
-
return
|
|
1279
|
+
return IsUnitIllusion(self.handle)
|
|
1280
|
+
end},
|
|
1281
|
+
true
|
|
1282
|
+
)
|
|
1283
|
+
__TS__SetDescriptor(
|
|
1284
|
+
Unit.prototype,
|
|
1285
|
+
"isStunned",
|
|
1286
|
+
{get = function(self)
|
|
1287
|
+
return getUnitCurrentOrder(self.handle) == orderId("stunned")
|
|
1195
1288
|
end},
|
|
1196
1289
|
true
|
|
1197
1290
|
)
|
|
@@ -1268,6 +1361,19 @@ __TS__SetDescriptor(
|
|
|
1268
1361
|
},
|
|
1269
1362
|
true
|
|
1270
1363
|
)
|
|
1364
|
+
__TS__SetDescriptor(
|
|
1365
|
+
Unit.prototype,
|
|
1366
|
+
"primaryAttribute",
|
|
1367
|
+
{
|
|
1368
|
+
get = function(self)
|
|
1369
|
+
return getUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE)
|
|
1370
|
+
end,
|
|
1371
|
+
set = function(self, primaryAttribute)
|
|
1372
|
+
setUnitIntegerField(self.handle, UNIT_IF_PRIMARY_ATTRIBUTE, primaryAttribute)
|
|
1373
|
+
end
|
|
1374
|
+
},
|
|
1375
|
+
true
|
|
1376
|
+
)
|
|
1271
1377
|
__TS__SetDescriptor(
|
|
1272
1378
|
Unit.prototype,
|
|
1273
1379
|
"strengthBase",
|
|
@@ -1392,7 +1498,7 @@ __TS__SetDescriptor(
|
|
|
1392
1498
|
return not self[106]
|
|
1393
1499
|
end,
|
|
1394
1500
|
set = function(self, isTeamGlowVisible)
|
|
1395
|
-
|
|
1501
|
+
BlzShowUnitTeamGlow(self.handle, isTeamGlowVisible)
|
|
1396
1502
|
local ____temp_6
|
|
1397
1503
|
if not isTeamGlowVisible then
|
|
1398
1504
|
____temp_6 = true
|
|
@@ -1408,9 +1514,9 @@ __TS__SetDescriptor(
|
|
|
1408
1514
|
Unit.prototype,
|
|
1409
1515
|
"color",
|
|
1410
1516
|
{set = function(self, color)
|
|
1411
|
-
|
|
1517
|
+
SetUnitColor(self.handle, color.handle)
|
|
1412
1518
|
if self[106] then
|
|
1413
|
-
|
|
1519
|
+
BlzShowUnitTeamGlow(self.handle, false)
|
|
1414
1520
|
end
|
|
1415
1521
|
end},
|
|
1416
1522
|
true
|
|
@@ -1579,7 +1685,7 @@ __TS__SetDescriptor(
|
|
|
1579
1685
|
"x",
|
|
1580
1686
|
{
|
|
1581
1687
|
get = function(self)
|
|
1582
|
-
return getUnitX(self.handle)
|
|
1688
|
+
return self[107] or getUnitX(self.handle)
|
|
1583
1689
|
end,
|
|
1584
1690
|
set = function(self, v)
|
|
1585
1691
|
SetUnitX(self.handle, v)
|
|
@@ -1592,7 +1698,7 @@ __TS__SetDescriptor(
|
|
|
1592
1698
|
"y",
|
|
1593
1699
|
{
|
|
1594
1700
|
get = function(self)
|
|
1595
|
-
return getUnitY(self.handle)
|
|
1701
|
+
return self[108] or getUnitY(self.handle)
|
|
1596
1702
|
end,
|
|
1597
1703
|
set = function(self, v)
|
|
1598
1704
|
SetUnitY(self.handle, v)
|
|
@@ -1678,10 +1784,10 @@ __TS__SetDescriptor(
|
|
|
1678
1784
|
"gold",
|
|
1679
1785
|
{
|
|
1680
1786
|
get = function(self)
|
|
1681
|
-
return
|
|
1787
|
+
return GetResourceAmount(self.handle)
|
|
1682
1788
|
end,
|
|
1683
1789
|
set = function(self, gold)
|
|
1684
|
-
|
|
1790
|
+
SetResourceAmount(self.handle, gold)
|
|
1685
1791
|
end
|
|
1686
1792
|
},
|
|
1687
1793
|
true
|
|
@@ -1809,6 +1915,19 @@ __TS__SetDescriptor(
|
|
|
1809
1915
|
end},
|
|
1810
1916
|
true
|
|
1811
1917
|
)
|
|
1918
|
+
__TS__SetDescriptor(
|
|
1919
|
+
Unit.prototype,
|
|
1920
|
+
"movementType",
|
|
1921
|
+
{
|
|
1922
|
+
get = function(self)
|
|
1923
|
+
return getUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE)
|
|
1924
|
+
end,
|
|
1925
|
+
set = function(self, movementType)
|
|
1926
|
+
setUnitIntegerField(self.handle, UNIT_IF_MOVE_TYPE, movementType)
|
|
1927
|
+
end
|
|
1928
|
+
},
|
|
1929
|
+
true
|
|
1930
|
+
)
|
|
1812
1931
|
__TS__SetDescriptor(
|
|
1813
1932
|
Unit.prototype,
|
|
1814
1933
|
"pathing",
|
|
@@ -1990,6 +2109,14 @@ __TS__SetDescriptor(
|
|
|
1990
2109
|
end},
|
|
1991
2110
|
true
|
|
1992
2111
|
)
|
|
2112
|
+
__TS__SetDescriptor(
|
|
2113
|
+
Unit.prototype,
|
|
2114
|
+
"targetAcquiredEvent",
|
|
2115
|
+
{get = function(self)
|
|
2116
|
+
return self:getEvent(EVENT_UNIT_ACQUIRED_TARGET)
|
|
2117
|
+
end},
|
|
2118
|
+
true
|
|
2119
|
+
)
|
|
1993
2120
|
__TS__SetDescriptor(
|
|
1994
2121
|
Unit.prototype,
|
|
1995
2122
|
"onSelect",
|
|
@@ -2315,10 +2442,12 @@ Unit.onImmediateOrder = dispatchId(__TS__New(
|
|
|
2315
2442
|
____exports.UnitTriggerEvent,
|
|
2316
2443
|
EVENT_PLAYER_UNIT_ISSUED_ORDER,
|
|
2317
2444
|
function()
|
|
2318
|
-
local
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2445
|
+
local handle = getOrderedUnit()
|
|
2446
|
+
if handle ~= nil and getUnitTypeId(handle) ~= dummyUnitId then
|
|
2447
|
+
local unit = ____exports.Unit:of(handle)
|
|
2448
|
+
if unit.state == 1 then
|
|
2449
|
+
return unit, getIssuedOrderId()
|
|
2450
|
+
end
|
|
2322
2451
|
end
|
|
2323
2452
|
return IgnoreEvent
|
|
2324
2453
|
end
|
|
@@ -2349,13 +2478,19 @@ Unit.onDamaging = (function()
|
|
|
2349
2478
|
if source and source.typeId == dummyUnitId then
|
|
2350
2479
|
source = nil
|
|
2351
2480
|
end
|
|
2352
|
-
local target = BlzGetEventDamageTarget()
|
|
2481
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2482
|
+
local metadata = damageMetadataByTarget[target]
|
|
2483
|
+
damageMetadataByTarget[target] = nil
|
|
2353
2484
|
local data = {
|
|
2354
2485
|
amount = GetEventDamage(),
|
|
2355
|
-
attackType = BlzGetEventAttackType(),
|
|
2486
|
+
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2356
2487
|
damageType = BlzGetEventDamageType(),
|
|
2357
2488
|
weaponType = BlzGetEventWeaponType(),
|
|
2358
|
-
|
|
2489
|
+
metadata = metadata,
|
|
2490
|
+
isAttack = BlzGetEventIsAttack(),
|
|
2491
|
+
originalAmount = GetEventDamage(),
|
|
2492
|
+
originalMetadata = metadata,
|
|
2493
|
+
preventRetaliation = damagingEventPreventRetaliation
|
|
2359
2494
|
}
|
|
2360
2495
|
if data.isAttack and source then
|
|
2361
2496
|
local weapon = BlzGetUnitWeaponBooleanField(source.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, 1) and (BlzGetUnitWeaponBooleanField(source.handle, UNIT_WEAPON_BF_ATTACKS_ENABLED, 0) and -1 or 1) or 0
|
|
@@ -2369,18 +2504,36 @@ Unit.onDamaging = (function()
|
|
|
2369
2504
|
invoke(
|
|
2370
2505
|
event,
|
|
2371
2506
|
source,
|
|
2372
|
-
|
|
2507
|
+
target,
|
|
2373
2508
|
setmetatable(
|
|
2374
2509
|
{},
|
|
2375
2510
|
{
|
|
2376
2511
|
__index = data,
|
|
2377
2512
|
__newindex = function(self, key, value)
|
|
2378
|
-
damageSetters[key]
|
|
2513
|
+
local damageSetter = damageSetters[key]
|
|
2514
|
+
if damageSetter ~= nil then
|
|
2515
|
+
damageSetter(value)
|
|
2516
|
+
end
|
|
2379
2517
|
data[key] = value
|
|
2380
2518
|
end
|
|
2381
2519
|
}
|
|
2382
2520
|
)
|
|
2383
2521
|
)
|
|
2522
|
+
if data[0] and source then
|
|
2523
|
+
local sourceOwner = source.owner.handle
|
|
2524
|
+
data[1] = sourceOwner
|
|
2525
|
+
local targetOwner = target.owner.handle
|
|
2526
|
+
data[2] = targetOwner
|
|
2527
|
+
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2528
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2529
|
+
data[3] = true
|
|
2530
|
+
end
|
|
2531
|
+
if not GetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE) then
|
|
2532
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, true)
|
|
2533
|
+
data[4] = true
|
|
2534
|
+
end
|
|
2535
|
+
end
|
|
2536
|
+
damagingEventByTarget[target] = data
|
|
2384
2537
|
return
|
|
2385
2538
|
end
|
|
2386
2539
|
BlzSetEventDamage(0)
|
|
@@ -2388,7 +2541,7 @@ Unit.onDamaging = (function()
|
|
|
2388
2541
|
BlzSetEventDamageType(DAMAGE_TYPE_UNKNOWN)
|
|
2389
2542
|
BlzSetEventWeaponType(WEAPON_TYPE_WHOKNOWS)
|
|
2390
2543
|
local sourceOwner = source.owner.handle
|
|
2391
|
-
local targetOwner =
|
|
2544
|
+
local targetOwner = target.owner.handle
|
|
2392
2545
|
if not GetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE) then
|
|
2393
2546
|
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, true)
|
|
2394
2547
|
Timer:run(function()
|
|
@@ -2404,23 +2557,19 @@ Unit.onDamaging = (function()
|
|
|
2404
2557
|
for ____, ____value in ipairs(source._attackHandlers) do
|
|
2405
2558
|
local condition = ____value[1]
|
|
2406
2559
|
local action = ____value[2]
|
|
2407
|
-
if condition(
|
|
2408
|
-
source,
|
|
2409
|
-
____exports.Unit:of(target),
|
|
2410
|
-
data
|
|
2411
|
-
) then
|
|
2560
|
+
if condition(source, target, data) then
|
|
2412
2561
|
action(
|
|
2413
2562
|
source,
|
|
2414
|
-
|
|
2563
|
+
target,
|
|
2415
2564
|
setmetatable(
|
|
2416
2565
|
{fire = function()
|
|
2417
2566
|
UnitDamageTarget(
|
|
2418
2567
|
source.handle,
|
|
2419
|
-
target,
|
|
2568
|
+
target.handle,
|
|
2420
2569
|
data.amount,
|
|
2421
2570
|
true,
|
|
2422
2571
|
true,
|
|
2423
|
-
data.attackType,
|
|
2572
|
+
attackTypeToNative(data.attackType),
|
|
2424
2573
|
data.damageType,
|
|
2425
2574
|
data.weaponType
|
|
2426
2575
|
)
|
|
@@ -2447,26 +2596,50 @@ Unit.onDamage = __TS__New(
|
|
|
2447
2596
|
if source and source.typeId == dummyUnitId then
|
|
2448
2597
|
source = nil
|
|
2449
2598
|
end
|
|
2599
|
+
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2600
|
+
local damagingEvent = damagingEventByTarget[target]
|
|
2601
|
+
damagingEventByTarget[target] = nil
|
|
2450
2602
|
local data = {
|
|
2451
2603
|
amount = GetEventDamage(),
|
|
2452
|
-
attackType = BlzGetEventAttackType(),
|
|
2604
|
+
attackType = nativeToAttackType(BlzGetEventAttackType()),
|
|
2453
2605
|
damageType = BlzGetEventDamageType(),
|
|
2454
2606
|
weaponType = BlzGetEventWeaponType(),
|
|
2607
|
+
metadata = damagingEvent and damagingEvent.metadata,
|
|
2455
2608
|
isAttack = BlzGetEventIsAttack(),
|
|
2456
|
-
originalAmount = GetEventDamage(),
|
|
2609
|
+
originalAmount = damagingEvent and damagingEvent.originalAmount or GetEventDamage(),
|
|
2610
|
+
originalMetadata = damagingEvent and damagingEvent.originalMetadata,
|
|
2457
2611
|
preventDeath = damageEventPreventDeath
|
|
2458
2612
|
}
|
|
2613
|
+
if damagingEvent then
|
|
2614
|
+
for key, value in pairs(damagingEvent) do
|
|
2615
|
+
if isAttribute(key) then
|
|
2616
|
+
data[key] = value
|
|
2617
|
+
end
|
|
2618
|
+
end
|
|
2619
|
+
local sourceOwner = damagingEvent[1]
|
|
2620
|
+
if sourceOwner then
|
|
2621
|
+
local targetOwner = damagingEvent[2]
|
|
2622
|
+
if damagingEvent[3] then
|
|
2623
|
+
SetPlayerAlliance(sourceOwner, targetOwner, ALLIANCE_PASSIVE, false)
|
|
2624
|
+
end
|
|
2625
|
+
if damagingEvent[4] then
|
|
2626
|
+
SetPlayerAlliance(targetOwner, sourceOwner, ALLIANCE_PASSIVE, false)
|
|
2627
|
+
end
|
|
2628
|
+
end
|
|
2629
|
+
end
|
|
2459
2630
|
local evData = setmetatable(
|
|
2460
2631
|
{},
|
|
2461
2632
|
{
|
|
2462
2633
|
__index = data,
|
|
2463
2634
|
__newindex = function(self, key, value)
|
|
2464
|
-
damageSetters[key]
|
|
2635
|
+
local damageSetter = damageSetters[key]
|
|
2636
|
+
if damageSetter ~= nil then
|
|
2637
|
+
damageSetter(value)
|
|
2638
|
+
end
|
|
2465
2639
|
data[key] = value
|
|
2466
2640
|
end
|
|
2467
2641
|
}
|
|
2468
2642
|
)
|
|
2469
|
-
local target = ____exports.Unit:of(BlzGetEventDamageTarget())
|
|
2470
2643
|
invoke(event, source, target, evData)
|
|
2471
2644
|
if evData[0] ~= nil and target.health - evData.amount < 0.405 then
|
|
2472
2645
|
local bonusHealth = math.ceil(evData.amount)
|
|
@@ -2509,8 +2682,9 @@ Unit.itemDroppedEvent = __TS__New(
|
|
|
2509
2682
|
EVENT_PLAYER_UNIT_DROP_ITEM,
|
|
2510
2683
|
function()
|
|
2511
2684
|
local unit = getTriggerUnit()
|
|
2512
|
-
|
|
2513
|
-
|
|
2685
|
+
local item = getManipulatedItem()
|
|
2686
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2687
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2514
2688
|
end
|
|
2515
2689
|
return IgnoreEvent
|
|
2516
2690
|
end
|
|
@@ -2520,8 +2694,9 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2520
2694
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2521
2695
|
function()
|
|
2522
2696
|
local unit = getTriggerUnit()
|
|
2523
|
-
|
|
2524
|
-
|
|
2697
|
+
local item = getManipulatedItem()
|
|
2698
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2699
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2525
2700
|
end
|
|
2526
2701
|
return IgnoreEvent
|
|
2527
2702
|
end
|
|
@@ -2529,13 +2704,35 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2529
2704
|
Unit.itemUsedEvent = __TS__New(
|
|
2530
2705
|
____exports.UnitTriggerEvent,
|
|
2531
2706
|
EVENT_PLAYER_UNIT_USE_ITEM,
|
|
2532
|
-
function()
|
|
2707
|
+
function()
|
|
2708
|
+
local unit = getTriggerUnit()
|
|
2709
|
+
local item = getManipulatedItem()
|
|
2710
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (ignoreEventsItems[item] ~= nil) then
|
|
2711
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2712
|
+
end
|
|
2713
|
+
return IgnoreEvent
|
|
2714
|
+
end
|
|
2533
2715
|
)
|
|
2534
2716
|
Unit.itemStackedEvent = __TS__New(
|
|
2535
2717
|
____exports.UnitTriggerEvent,
|
|
2536
2718
|
EVENT_PLAYER_UNIT_STACK_ITEM,
|
|
2537
2719
|
function() return ____exports.Unit:of(getTriggerUnit()), Item:of(getManipulatedItem()) end
|
|
2538
2720
|
)
|
|
2721
|
+
__TS__ObjectDefineProperty(
|
|
2722
|
+
Unit,
|
|
2723
|
+
"itemChargesChangedEvent",
|
|
2724
|
+
{get = function(self)
|
|
2725
|
+
local event = __TS__New(Event)
|
|
2726
|
+
Item.chargesChangedEvent:addListener(function(item)
|
|
2727
|
+
local unit = item.owner
|
|
2728
|
+
if unit ~= nil then
|
|
2729
|
+
invoke(event, unit, item)
|
|
2730
|
+
end
|
|
2731
|
+
end)
|
|
2732
|
+
rawset(self, "itemChargesChangedEvent", event)
|
|
2733
|
+
return event
|
|
2734
|
+
end}
|
|
2735
|
+
)
|
|
2539
2736
|
__TS__ObjectDefineProperty(
|
|
2540
2737
|
Unit,
|
|
2541
2738
|
"itemUseOrderEvent",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local getUnitAbility = BlzGetUnitAbility
|
|
3
3
|
local unitAddAbility = UnitAddAbility
|
|
4
|
+
local unitInventorySize = UnitInventorySize
|
|
5
|
+
local unitItemInSlot = UnitItemInSlot
|
|
4
6
|
local unitMakeAbilityPermanent = UnitMakeAbilityPermanent
|
|
5
7
|
---
|
|
6
8
|
-- @internal For use by internal systems only.
|
|
@@ -10,4 +12,14 @@ ____exports.addInternalAbility = function(unit, abilityTypeId)
|
|
|
10
12
|
end
|
|
11
13
|
return getUnitAbility(unit, abilityTypeId)
|
|
12
14
|
end
|
|
15
|
+
---
|
|
16
|
+
-- @internal For use by internal systems only.
|
|
17
|
+
____exports.findUnitItemSlot = function(unit, item)
|
|
18
|
+
for slot = 0, unitInventorySize(unit) - 1 do
|
|
19
|
+
if item == unitItemInSlot(unit, slot) then
|
|
20
|
+
return slot
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
return nil
|
|
24
|
+
end
|
|
13
25
|
return ____exports
|