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): number | undefined;
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: number,
339
- slotTo: number
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]>;
@@ -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 order = orderId("moveslot1")
2557
- while order <= orderId("moveslot5") do
2558
- self.onTargetOrder[order]:addListener(function(unit, item)
2559
- local slotFrom = unit.items:findSlot(item)
2560
- if slotFrom ~= nil then
2561
- local slotTo = order - orderId("moveslot1")
2562
- invoke(
2563
- event,
2564
- unit,
2565
- item,
2566
- slotFrom,
2567
- slotTo
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "warscript",
4
- "version": "0.0.1-dev.240d8a6",
4
+ "version": "0.0.1-dev.29b3feb",
5
5
  "description": "A typescript library for Warcraft III using Warpack.",
6
6
  "keywords": [
7
7
  "warcraft",