warscript 0.0.1-dev.240d8a6 → 0.0.1-dev.29b3feb
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.
|
@@ -11,7 +11,7 @@ export interface UnitItems extends ReadonlyArray<Item | undefined> {
|
|
|
11
11
|
}
|
|
12
12
|
export declare class UnitItems {
|
|
13
13
|
constructor(handle: junit);
|
|
14
|
-
findSlot(item: Item):
|
|
14
|
+
findSlot(item: Item): 0 | 1 | 2 | 3 | 4 | 5 | undefined;
|
|
15
15
|
protected __newindex(slot: number, item: Item | undefined): void;
|
|
16
16
|
protected __index(key: string | number): unknown;
|
|
17
17
|
protected __len(): number;
|
|
@@ -335,8 +335,8 @@ export declare class Unit extends Handle<junit> {
|
|
|
335
335
|
static get itemMovedEvent(): Event<[
|
|
336
336
|
unit: Unit,
|
|
337
337
|
item: Item,
|
|
338
|
-
slotFrom:
|
|
339
|
-
slotTo:
|
|
338
|
+
slotFrom: 0 | 1 | 2 | 3 | 4 | 5,
|
|
339
|
+
slotTo: 0 | 1 | 2 | 3 | 4 | 5
|
|
340
340
|
]>;
|
|
341
341
|
static get onCreate(): EventDispatcher<[Unit], [Unit]>;
|
|
342
342
|
static get destroyEvent(): EventDispatcher<[Unit], [Unit]>;
|
package/engine/internal/unit.lua
CHANGED
|
@@ -2552,24 +2552,20 @@ __TS__ObjectDefineProperty(
|
|
|
2552
2552
|
"itemMovedEvent",
|
|
2553
2553
|
{get = function(self)
|
|
2554
2554
|
local event = __TS__New(Event)
|
|
2555
|
-
do
|
|
2556
|
-
local
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
end
|
|
2570
|
-
end)
|
|
2571
|
-
order = order + 1
|
|
2572
|
-
end
|
|
2555
|
+
for order = orderId("moveslot1"), orderId("moveslot5") do
|
|
2556
|
+
local slotTo = order - orderId("moveslot1")
|
|
2557
|
+
self.onTargetOrder[order]:addListener(function(unit, item)
|
|
2558
|
+
local slotFrom = unit.items:findSlot(item)
|
|
2559
|
+
if slotFrom ~= nil then
|
|
2560
|
+
invoke(
|
|
2561
|
+
event,
|
|
2562
|
+
unit,
|
|
2563
|
+
item,
|
|
2564
|
+
slotFrom,
|
|
2565
|
+
slotTo
|
|
2566
|
+
)
|
|
2567
|
+
end
|
|
2568
|
+
end)
|
|
2573
2569
|
end
|
|
2574
2570
|
rawset(self, "itemMovedEvent", event)
|
|
2575
2571
|
return event
|
package/package.json
CHANGED