warscript 0.0.1-dev.ed60fea → 0.0.1-dev.f955a59
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.
|
@@ -14,6 +14,8 @@ local ____math = require("math")
|
|
|
14
14
|
local MINIMUM_POSITIVE_NORMALIZED_FLOAT = ____math.MINIMUM_POSITIVE_NORMALIZED_FLOAT
|
|
15
15
|
local ____timer = require("core.types.timer")
|
|
16
16
|
local Timer = ____timer.Timer
|
|
17
|
+
local ____unit = require("engine.internal.unit")
|
|
18
|
+
local ignoreEventsItems = ____unit.ignoreEventsItems
|
|
17
19
|
local isItemOwned = IsItemOwned
|
|
18
20
|
local isItemPowerup = IsItemPowerup
|
|
19
21
|
local getItemX = GetItemX
|
|
@@ -86,6 +88,10 @@ ____exports.abilityActionDummy = dummy
|
|
|
86
88
|
---
|
|
87
89
|
-- @internal For use by internal systems only.
|
|
88
90
|
____exports.doAbilityAction = function(handle, action, ...)
|
|
91
|
+
local isAlreadyIgnoredInEvents = ignoreEventsItems[handle] ~= nil
|
|
92
|
+
if not isAlreadyIgnoredInEvents then
|
|
93
|
+
ignoreEventsItems[handle] = true
|
|
94
|
+
end
|
|
89
95
|
local isOwned = isItemOwned(handle)
|
|
90
96
|
local isPowerup
|
|
91
97
|
local x
|
|
@@ -107,6 +113,9 @@ ____exports.doAbilityAction = function(handle, action, ...)
|
|
|
107
113
|
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
108
114
|
end
|
|
109
115
|
end
|
|
116
|
+
if not isAlreadyIgnoredInEvents then
|
|
117
|
+
ignoreEventsItems[handle] = nil
|
|
118
|
+
end
|
|
110
119
|
return result
|
|
111
120
|
end
|
|
112
121
|
---
|
|
@@ -119,6 +128,10 @@ ____exports.doAbilityActionForceDummy = function(handle, owner, action, ...)
|
|
|
119
128
|
if slot == nil then
|
|
120
129
|
return ____exports.doAbilityAction(handle, action, ...)
|
|
121
130
|
end
|
|
131
|
+
local isAlreadyIgnoredInEvents = ignoreEventsItems[handle] ~= nil
|
|
132
|
+
if not isAlreadyIgnoredInEvents then
|
|
133
|
+
ignoreEventsItems[handle] = true
|
|
134
|
+
end
|
|
122
135
|
local isPowerup
|
|
123
136
|
if isItemPowerup(handle) then
|
|
124
137
|
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, false)
|
|
@@ -133,6 +146,9 @@ ____exports.doAbilityActionForceDummy = function(handle, owner, action, ...)
|
|
|
133
146
|
if isPowerup then
|
|
134
147
|
setItemBooleanField(handle, ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED, true)
|
|
135
148
|
end
|
|
149
|
+
if not isAlreadyIgnoredInEvents then
|
|
150
|
+
ignoreEventsItems[handle] = nil
|
|
151
|
+
end
|
|
136
152
|
return result
|
|
137
153
|
end
|
|
138
154
|
return ____exports
|
package/engine/internal/unit.lua
CHANGED
|
@@ -618,6 +618,9 @@ for ____, player in ipairs(Player.all) do
|
|
|
618
618
|
ShowUnit(dummy, false)
|
|
619
619
|
dummies[player] = dummy
|
|
620
620
|
end
|
|
621
|
+
---
|
|
622
|
+
-- @internal For use by internal systems only.
|
|
623
|
+
____exports.ignoreEventsItems = {}
|
|
621
624
|
local function delayHealthChecksCallback(unit)
|
|
622
625
|
local counter = (unit[103] or 0) - 1
|
|
623
626
|
if counter ~= 0 then
|
|
@@ -2518,8 +2521,9 @@ Unit.itemDroppedEvent = __TS__New(
|
|
|
2518
2521
|
EVENT_PLAYER_UNIT_DROP_ITEM,
|
|
2519
2522
|
function()
|
|
2520
2523
|
local unit = getTriggerUnit()
|
|
2521
|
-
|
|
2522
|
-
|
|
2524
|
+
local item = getManipulatedItem()
|
|
2525
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (____exports.ignoreEventsItems[item] ~= nil) then
|
|
2526
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2523
2527
|
end
|
|
2524
2528
|
return IgnoreEvent
|
|
2525
2529
|
end
|
|
@@ -2529,8 +2533,9 @@ Unit.itemPickedUpEvent = __TS__New(
|
|
|
2529
2533
|
EVENT_PLAYER_UNIT_PICKUP_ITEM,
|
|
2530
2534
|
function()
|
|
2531
2535
|
local unit = getTriggerUnit()
|
|
2532
|
-
|
|
2533
|
-
|
|
2536
|
+
local item = getManipulatedItem()
|
|
2537
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (____exports.ignoreEventsItems[item] ~= nil) then
|
|
2538
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2534
2539
|
end
|
|
2535
2540
|
return IgnoreEvent
|
|
2536
2541
|
end
|
|
@@ -2540,8 +2545,9 @@ Unit.itemUsedEvent = __TS__New(
|
|
|
2540
2545
|
EVENT_PLAYER_UNIT_USE_ITEM,
|
|
2541
2546
|
function()
|
|
2542
2547
|
local unit = getTriggerUnit()
|
|
2543
|
-
|
|
2544
|
-
|
|
2548
|
+
local item = getManipulatedItem()
|
|
2549
|
+
if getUnitTypeId(unit) ~= dummyUnitId and not (____exports.ignoreEventsItems[item] ~= nil) then
|
|
2550
|
+
return ____exports.Unit:of(unit), Item:of(item)
|
|
2545
2551
|
end
|
|
2546
2552
|
return IgnoreEvent
|
|
2547
2553
|
end
|
package/package.json
CHANGED