warscript 0.0.1-dev.3987da9 → 0.0.1-dev.39d8e49

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.
@@ -64,7 +64,7 @@ export declare class Sound extends Handle<jsound, [fadeOut?: boolean]> {
64
64
  export declare class Sound3D extends Sound {
65
65
  static playAtPosition(fileName: string, preset: Sound3DPreset, x?: number, y?: number, z?: number): void;
66
66
  static playOnUnit(fileName: string, preset: Sound3DPreset, unit: Unit): void;
67
- static playFromLabel(label: string, preset: Sound3DPreset, unit: Unit): void;
67
+ static playFromLabel(label: string, preset: Sound3DPreset, ...positionOrUnit: [Unit] | [number, number, number?]): void;
68
68
  static createAtPosition(fileName: string, preset: Sound3DPreset, x?: number, y?: number, z?: number): Sound3D;
69
69
  static createOnUnit(fileName: string, preset: Sound3DPreset, unit: Unit): Sound3D;
70
70
  }
@@ -249,9 +249,13 @@ function Sound3D.playOnUnit(self, fileName, preset, unit)
249
249
  startSound(sound)
250
250
  killSoundWhenDone(sound)
251
251
  end
252
- function Sound3D.playFromLabel(self, label, preset, unit)
252
+ function Sound3D.playFromLabel(self, label, preset, unitOrX, y, z)
253
253
  local sound = createPreset3DSoundFromLabel(label, preset)
254
- attachSoundToUnit(sound, unit.handle)
254
+ if type(unitOrX) ~= "number" then
255
+ attachSoundToUnit(sound, unitOrX.handle)
256
+ else
257
+ setSoundPosition(sound, unitOrX, y or 0, z or 0)
258
+ end
255
259
  startSound(sound)
256
260
  killSoundWhenDone(sound)
257
261
  end
@@ -115,6 +115,8 @@ export declare abstract class AbilityType extends ObjectDataEntry<AbilityTypeId>
115
115
  set casterEffectSoundPresetId(casterEffectSoundPresetId: SoundPresetId | undefined);
116
116
  get casterEffectLoopingSoundPresetId(): SoundPresetId;
117
117
  set casterEffectLoopingSoundPresetId(casterEffectLoopingSoundPresetId: SoundPresetId);
118
+ get targetEffectSoundPresetId(): SoundPresetId | undefined;
119
+ set targetEffectSoundPresetId(targetEffectSoundPresetId: SoundPresetId | undefined);
118
120
  get allowedTargetCombatClassifications(): CombatClassifications[];
119
121
  set allowedTargetCombatClassifications(allowedTargetCombatClassifications: ObjectDataEntryLevelFieldValueSupplier<CombatClassifications>);
120
122
  get areaOfEffect(): number[];
@@ -2,6 +2,7 @@ local ____lualib = require("lualib_bundle")
2
2
  local __TS__Class = ____lualib.__TS__Class
3
3
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
4
  local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
5
+ local __TS__InstanceOf = ____lualib.__TS__InstanceOf
5
6
  local ____exports = {}
6
7
  local ____unit = require("engine.internal.unit")
7
8
  local Unit = ____unit.Unit
@@ -33,11 +34,15 @@ local ____object_2Ddata_2Dentry_2Did_2Dgenerator = require("engine.object-data.u
33
34
  local abilityTypeIdGenerator = ____object_2Ddata_2Dentry_2Did_2Dgenerator.abilityTypeIdGenerator
34
35
  local ____upgrade = require("engine.object-data.entry.upgrade")
35
36
  local Upgrade = ____upgrade.Upgrade
37
+ local ____sound = require("core.types.sound")
38
+ local Sound3D = ____sound.Sound3D
39
+ local SoundPreset = ____sound.SoundPreset
36
40
  local castAnimationFQNByAbilityTypeId = {}
37
41
  local isButtonVisibleFalseAbilityTypes = {}
38
42
  local casterCastingEffectPresetsByAbilityTypeId = {}
39
43
  local casterChannelingEffectPresetsByAbilityTypeId = {}
40
44
  local targetCastingEffectPresetsByAbilityTypeId = {}
45
+ local targetEffectSoundPresetByAbilityTypeId = {}
41
46
  ____exports.AbilityType = __TS__Class()
42
47
  local AbilityType = ____exports.AbilityType
43
48
  AbilityType.name = "AbilityType"
@@ -743,6 +748,19 @@ __TS__SetDescriptor(
743
748
  },
744
749
  true
745
750
  )
751
+ __TS__SetDescriptor(
752
+ AbilityType.prototype,
753
+ "targetEffectSoundPresetId",
754
+ {
755
+ get = function(self)
756
+ return targetEffectSoundPresetByAbilityTypeId[self.id]
757
+ end,
758
+ set = function(self, targetEffectSoundPresetId)
759
+ targetEffectSoundPresetByAbilityTypeId[self.id] = targetEffectSoundPresetId
760
+ end
761
+ },
762
+ true
763
+ )
746
764
  __TS__SetDescriptor(
747
765
  AbilityType.prototype,
748
766
  "allowedTargetCombatClassifications",
@@ -967,6 +985,26 @@ for abilityTypeId, animationFQN in pairs(postcompile(function() return castAnima
967
985
  end
968
986
  )
969
987
  end
988
+ for abilityTypeId, soundPresetId in pairs(postcompile(function() return targetEffectSoundPresetByAbilityTypeId end)) do
989
+ if soundPresetId ~= nil then
990
+ Unit.abilityWidgetTargetChannelingStartEvent[abilityTypeId]:addListener(
991
+ 4,
992
+ function(caster, ability, target)
993
+ if __TS__InstanceOf(target, Unit) then
994
+ Sound3D:playFromLabel(soundPresetId, SoundPreset.Ability, target)
995
+ else
996
+ Sound3D:playFromLabel(soundPresetId, SoundPreset.Ability, target.x, target.y)
997
+ end
998
+ end
999
+ )
1000
+ Unit.abilityPointTargetChannelingStartEvent[abilityTypeId]:addListener(
1001
+ 4,
1002
+ function(caster, ability, x, y)
1003
+ Sound3D:playFromLabel(soundPresetId, SoundPreset.Ability, x, y)
1004
+ end
1005
+ )
1006
+ end
1007
+ end
970
1008
  local casterCastingEffectModelPathsByAbilityTypeId = postcompile(function()
971
1009
  return mapValues(
972
1010
  casterCastingEffectPresetsByAbilityTypeId,
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.3987da9",
4
+ "version": "0.0.1-dev.39d8e49",
5
5
  "description": "A typescript library for Warcraft III using Warpack.",
6
6
  "keywords": [
7
7
  "warcraft",