warscript 0.0.1-dev.66ce6c9 → 0.0.1-dev.6745db1

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.
Files changed (123) hide show
  1. package/attributes.d.ts +5 -0
  2. package/attributes.lua +8 -1
  3. package/core/types/effect.d.ts +1 -3
  4. package/core/types/effect.lua +26 -29
  5. package/core/types/frame.lua +10 -12
  6. package/core/types/player.lua +3 -1
  7. package/core/types/playerCamera.d.ts +2 -0
  8. package/core/types/playerCamera.lua +79 -5
  9. package/core/types/sound.d.ts +17 -25
  10. package/core/types/sound.lua +85 -44
  11. package/core/types/timer.d.ts +8 -8
  12. package/core/types/timer.lua +25 -23
  13. package/decl/native.d.ts +844 -788
  14. package/engine/behavior.d.ts +2 -0
  15. package/engine/behavior.lua +53 -27
  16. package/engine/behaviour/ability/apply-buff.lua +1 -1
  17. package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
  18. package/engine/behaviour/ability/damage.d.ts +9 -3
  19. package/engine/behaviour/ability/damage.lua +26 -38
  20. package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
  21. package/engine/behaviour/ability/emulate-impact.lua +18 -3
  22. package/engine/behaviour/ability/restore-mana.d.ts +1 -1
  23. package/engine/behaviour/ability/restore-mana.lua +6 -6
  24. package/engine/behaviour/ability.d.ts +4 -1
  25. package/engine/behaviour/ability.lua +14 -21
  26. package/engine/behaviour/unit/stun-immunity.d.ts +5 -3
  27. package/engine/behaviour/unit/stun-immunity.lua +43 -27
  28. package/engine/behaviour/unit.d.ts +28 -0
  29. package/engine/behaviour/unit.lua +163 -4
  30. package/engine/buff.d.ts +15 -9
  31. package/engine/buff.lua +90 -53
  32. package/engine/internal/ability.d.ts +4 -0
  33. package/engine/internal/ability.lua +23 -0
  34. package/engine/internal/item/ability.lua +63 -11
  35. package/engine/internal/item+owner.lua +12 -6
  36. package/engine/internal/item.d.ts +5 -2
  37. package/engine/internal/item.lua +80 -3
  38. package/engine/internal/mechanics/ability-duration.lua +1 -1
  39. package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
  40. package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
  41. package/engine/internal/misc/frame-coordinates.d.ts +2 -0
  42. package/engine/internal/misc/frame-coordinates.lua +21 -0
  43. package/engine/internal/misc/get-terrain-z.d.ts +2 -0
  44. package/engine/internal/misc/get-terrain-z.lua +11 -0
  45. package/engine/internal/misc/player-local-handle.d.ts +2 -0
  46. package/engine/internal/misc/player-local-handle.lua +5 -0
  47. package/engine/internal/unit/ability.d.ts +35 -0
  48. package/engine/internal/unit/ability.lua +62 -0
  49. package/engine/internal/unit/allowed-targets.d.ts +1 -1
  50. package/engine/internal/unit/allowed-targets.lua +9 -1
  51. package/engine/internal/unit/order.d.ts +20 -0
  52. package/engine/internal/unit/order.lua +136 -0
  53. package/engine/internal/unit+ability.lua +10 -1
  54. package/engine/internal/unit+damage.d.ts +2 -11
  55. package/engine/internal/unit+damage.lua +10 -14
  56. package/engine/internal/unit+spellSteal.lua +1 -2
  57. package/engine/internal/unit-missile-launch.lua +9 -2
  58. package/engine/internal/unit.d.ts +30 -8
  59. package/engine/internal/unit.lua +248 -99
  60. package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
  61. package/engine/object-data/auxiliary/armor-type.lua +46 -0
  62. package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -2
  63. package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
  64. package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
  65. package/engine/object-data/auxiliary/attack-type.lua +42 -0
  66. package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
  67. package/engine/object-data/auxiliary/movement-type.lua +22 -0
  68. package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
  69. package/engine/object-data/auxiliary/sound-eax.lua +2 -0
  70. package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
  71. package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
  72. package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
  73. package/engine/object-data/entry/ability-type/berserk.lua +13 -0
  74. package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
  75. package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
  76. package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
  77. package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
  78. package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
  79. package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
  80. package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
  81. package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
  82. package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
  83. package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
  84. package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
  85. package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
  86. package/engine/object-data/entry/ability-type/web.d.ts +12 -0
  87. package/engine/object-data/entry/ability-type/web.lua +52 -0
  88. package/engine/object-data/entry/ability-type.d.ts +11 -11
  89. package/engine/object-data/entry/ability-type.lua +32 -13
  90. package/engine/object-data/entry/buff-type/applicable.lua +5 -0
  91. package/engine/object-data/entry/buff-type.d.ts +5 -11
  92. package/engine/object-data/entry/buff-type.lua +11 -27
  93. package/engine/object-data/entry/sound-preset.d.ts +17 -0
  94. package/engine/object-data/entry/sound-preset.lua +104 -0
  95. package/engine/object-data/entry/unit-type.d.ts +13 -4
  96. package/engine/object-data/entry/unit-type.lua +153 -85
  97. package/engine/object-field/ability.d.ts +1 -1
  98. package/engine/object-field/unit.d.ts +57 -3
  99. package/engine/object-field/unit.lua +207 -7
  100. package/engine/object-field.d.ts +15 -4
  101. package/engine/object-field.lua +184 -90
  102. package/engine/standard/entries/buff-type.d.ts +3 -0
  103. package/engine/standard/entries/buff-type.lua +3 -0
  104. package/engine/standard/fields/unit.d.ts +4 -0
  105. package/engine/standard/fields/unit.lua +7 -0
  106. package/engine/text-tag.d.ts +36 -2
  107. package/engine/text-tag.lua +249 -10
  108. package/engine/unit.d.ts +1 -0
  109. package/engine/unit.lua +1 -0
  110. package/objutil/buff.lua +1 -2
  111. package/package.json +2 -2
  112. package/utility/arrays.d.ts +1 -0
  113. package/utility/arrays.lua +3 -0
  114. package/utility/functions.d.ts +8 -0
  115. package/utility/functions.lua +13 -0
  116. package/utility/linked-set.d.ts +1 -0
  117. package/utility/linked-set.lua +3 -0
  118. package/utility/lua-maps.d.ts +4 -0
  119. package/utility/lua-maps.lua +20 -0
  120. package/utility/lua-sets.d.ts +2 -0
  121. package/utility/lua-sets.lua +7 -0
  122. package/core/types/order.d.ts +0 -25
  123. package/core/types/order.lua +0 -55
@@ -1,6 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__New = ____lualib.__TS__New
3
3
  local __TS__Class = ____lualib.__TS__Class
4
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
5
  local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
6
  local __TS__Promise = ____lualib.__TS__Promise
6
7
  local ____exports = {}
@@ -9,8 +10,8 @@ local Event = ____event.Event
9
10
  local InitializingEvent = ____event.InitializingEvent
10
11
  local ____objectPool = require("util.objectPool")
11
12
  local ObjectPool = ____objectPool.ObjectPool
12
- local ____exception = require("exception")
13
- local IllegalStateException = ____exception.IllegalStateException
13
+ local ____destroyable = require("destroyable")
14
+ local AbstractDestroyable = ____destroyable.AbstractDestroyable
14
15
  local createTimer = CreateTimer
15
16
  local timerStart = TimerStart
16
17
  local pauseTimer = PauseTimer
@@ -23,6 +24,7 @@ local getHandleId = GetHandleId
23
24
  local ____pcall = _G.pcall
24
25
  local ____print = _G.print
25
26
  local select = _G.select
27
+ local ____type = _G.type
26
28
  local safeCall = warpack.safeCall
27
29
  local corunning = coroutine.running
28
30
  local coresume = coroutine.resume
@@ -35,14 +37,14 @@ local timerByHandleId = {}
35
37
  local function timerSafeCall()
36
38
  local timer = timerByHandleId[getHandleId(getExpiredTimer())]
37
39
  if timer ~= nil then
38
- if timer[2] then
40
+ if timer[1] then
39
41
  timer:destroy()
40
42
  end
41
- local callback = timer[3]
43
+ local callback = timer[2]
42
44
  if callback ~= nil then
43
45
  safeCall(
44
46
  callback,
45
- ____unpack(timer, 4 + 1, 4 + (timer[4] or 0))
47
+ ____unpack(timer, 3 + 1, 3 + (timer[3] or 0))
46
48
  )
47
49
  end
48
50
  end
@@ -50,46 +52,46 @@ end
50
52
  ____exports.Timer = __TS__Class()
51
53
  local Timer = ____exports.Timer
52
54
  Timer.name = "Timer"
55
+ __TS__ClassExtends(Timer, AbstractDestroyable)
53
56
  function Timer.prototype.____constructor(self)
57
+ AbstractDestroyable.prototype.____constructor(self)
54
58
  self[0] = get()
55
59
  timerByHandleId[getHandleId(self[0])] = self
56
60
  end
57
61
  function Timer.prototype.start(self, timeout, periodic, callback, ...)
58
- self[3] = callback
62
+ self[2] = callback
59
63
  local argsLength = select("#", ...)
60
- self[4] = argsLength
64
+ self[3] = argsLength
61
65
  for i = 1, argsLength do
62
- self[4 + i] = (select(i, ...))
66
+ self[3 + i] = (select(i, ...))
63
67
  end
64
68
  timerStart(self.handle, timeout, periodic, timerSafeCall)
65
69
  end
70
+ function Timer.prototype.onDestroy(self)
71
+ local handle = self[0]
72
+ timerByHandleId[getHandleId(handle)] = nil
73
+ release(handle)
74
+ return AbstractDestroyable.prototype.onDestroy(self)
75
+ end
66
76
  function Timer.prototype.pause(self)
67
77
  pauseTimer(self[0])
68
78
  end
69
79
  function Timer.prototype.resume(self)
70
80
  resumeTimer(self[0])
71
81
  end
72
- function Timer.prototype.destroy(self)
73
- if self[1] then
74
- error(
75
- __TS__New(IllegalStateException, "Double-destroy run for timer"),
76
- 0
77
- )
78
- end
79
- local handle = self[0]
80
- timerByHandleId[getHandleId(handle)] = nil
81
- release(handle)
82
- self[1] = true
83
- end
84
82
  function Timer.create(self)
85
83
  return __TS__New(____exports.Timer)
86
84
  end
87
- function Timer.run(self, callback, ...)
88
- ____exports.Timer:simple(0, callback, ...)
85
+ function Timer.run(self, objectOrCallback, keyOrFirstArg, ...)
86
+ if ____type(objectOrCallback) == "function" then
87
+ ____exports.Timer:simple(0, objectOrCallback, keyOrFirstArg, ...)
88
+ else
89
+ ____exports.Timer:simple(0, objectOrCallback[keyOrFirstArg], objectOrCallback, ...)
90
+ end
89
91
  end
90
92
  function Timer.simple(self, timeout, callback, ...)
91
93
  local timer = __TS__New(____exports.Timer)
92
- timer[2] = true
94
+ timer[1] = true
93
95
  timer:start(timeout, false, callback, ...)
94
96
  return timer
95
97
  end