warscript 0.0.1-dev.748f04c → 0.0.1-dev.75f6e33
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.
- package/core/types/sound.d.ts +1 -1
- package/core/types/sound.lua +6 -2
- package/core/util.lua +6 -1
- package/engine/object-data/entry/ability-type/blank-configurable.lua +0 -9
- package/engine/object-data/entry/ability-type.d.ts +2 -0
- package/engine/object-data/entry/ability-type.lua +38 -0
- package/engine/object-data/entry/unit-type.lua +3 -3
- package/objutil/unit.lua +2 -2
- package/package.json +2 -2
package/core/types/sound.d.ts
CHANGED
|
@@ -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,
|
|
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
|
}
|
package/core/types/sound.lua
CHANGED
|
@@ -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,
|
|
252
|
+
function Sound3D.playFromLabel(self, label, preset, unitOrX, y, z)
|
|
253
253
|
local sound = createPreset3DSoundFromLabel(label, preset)
|
|
254
|
-
|
|
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
|
package/core/util.lua
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__StringPadEnd = ____lualib.__TS__StringPadEnd
|
|
1
3
|
local ____exports = {}
|
|
2
4
|
local ns = {}
|
|
3
5
|
do
|
|
@@ -14,7 +16,10 @@ do
|
|
|
14
16
|
if type(id) == "number" then
|
|
15
17
|
return id
|
|
16
18
|
else
|
|
17
|
-
local numid = string.unpack(
|
|
19
|
+
local numid = string.unpack(
|
|
20
|
+
">I4",
|
|
21
|
+
__TS__StringPadEnd(id, 4, "\0")
|
|
22
|
+
)
|
|
18
23
|
return numid
|
|
19
24
|
end
|
|
20
25
|
end
|
|
@@ -23,9 +23,6 @@ local ALLOWED_TARGETS_ABILITY_COMBAT_CLASSIFICATIONS_LEVEL_FIELD = ____ability.A
|
|
|
23
23
|
local AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD = ____ability.AREA_OF_EFFECT_ABILITY_FLOAT_LEVEL_FIELD
|
|
24
24
|
local ____linked_2Dset = require("utility.linked-set")
|
|
25
25
|
local LinkedSet = ____linked_2Dset.LinkedSet
|
|
26
|
-
local ____sound = require("core.types.sound")
|
|
27
|
-
local Sound3D = ____sound.Sound3D
|
|
28
|
-
local SoundPreset = ____sound.SoundPreset
|
|
29
26
|
local isChannelingAbilityTypeIds = {}
|
|
30
27
|
local usesAttackAnimationByAbilityTypeId = {}
|
|
31
28
|
____exports.BlankConfigurableAbilityType = __TS__Class()
|
|
@@ -230,12 +227,6 @@ for abilityTypeId, usesAttackAnimation in pairs(postcompile(function()
|
|
|
230
227
|
end
|
|
231
228
|
return usesAttackAnimationByAbilityTypeId
|
|
232
229
|
end)) do
|
|
233
|
-
Unit.abilityCastingFinishEvent[abilityTypeId]:addListener(function(caster, ability)
|
|
234
|
-
local effectSound = ability:getField(ABILITY_SF_EFFECT_SOUND)
|
|
235
|
-
if effectSound ~= "" then
|
|
236
|
-
Sound3D:playFromLabel(effectSound, SoundPreset.Ability, caster)
|
|
237
|
-
end
|
|
238
|
-
end)
|
|
239
230
|
if usesAttackAnimation then
|
|
240
231
|
Unit.abilityCastingStartEvent[abilityTypeId]:addListener(
|
|
241
232
|
4,
|
|
@@ -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,
|
|
@@ -810,7 +810,7 @@ __TS__SetDescriptor(
|
|
|
810
810
|
set = function(self, modelPath)
|
|
811
811
|
self:setStringField("umdl", modelPath)
|
|
812
812
|
if not self.isPortraitModelPathSet and WarscriptConfig.AUTOMATICALLY_SET_UNIT_TYPE_PORTRAIT_MODEL_PATH then
|
|
813
|
-
self:setStringField("upor",
|
|
813
|
+
self:setStringField("upor", "")
|
|
814
814
|
end
|
|
815
815
|
end
|
|
816
816
|
},
|
|
@@ -826,7 +826,7 @@ __TS__SetDescriptor(
|
|
|
826
826
|
set = function(self, modelPathSD)
|
|
827
827
|
self:setStringField("umdl:sd", modelPathSD)
|
|
828
828
|
if not self.isPortraitModelPathSet and WarscriptConfig.AUTOMATICALLY_SET_UNIT_TYPE_PORTRAIT_MODEL_PATH then
|
|
829
|
-
self:setStringField("upor:sd",
|
|
829
|
+
self:setStringField("upor:sd", "")
|
|
830
830
|
end
|
|
831
831
|
end
|
|
832
832
|
},
|
|
@@ -842,7 +842,7 @@ __TS__SetDescriptor(
|
|
|
842
842
|
set = function(self, modelPathHD)
|
|
843
843
|
self:setStringField("umdl:hd", modelPathHD)
|
|
844
844
|
if not self.isPortraitModelPathSet and WarscriptConfig.AUTOMATICALLY_SET_UNIT_TYPE_PORTRAIT_MODEL_PATH then
|
|
845
|
-
self:setStringField("upor:hd",
|
|
845
|
+
self:setStringField("upor:hd", "")
|
|
846
846
|
end
|
|
847
847
|
end
|
|
848
848
|
},
|
package/objutil/unit.lua
CHANGED
|
@@ -596,7 +596,7 @@ __TS__SetDescriptor(
|
|
|
596
596
|
set = function(self, v)
|
|
597
597
|
self:setStringField("umdl", v)
|
|
598
598
|
if WarscriptConfig.AUTOMATICALLY_SET_UNIT_TYPE_PORTRAIT_MODEL_PATH then
|
|
599
|
-
self:setStringField("upor",
|
|
599
|
+
self:setStringField("upor", "")
|
|
600
600
|
end
|
|
601
601
|
end
|
|
602
602
|
},
|
|
@@ -612,7 +612,7 @@ __TS__SetDescriptor(
|
|
|
612
612
|
set = function(self, v)
|
|
613
613
|
self.object:setField("umdl:hd", v)
|
|
614
614
|
if WarscriptConfig.AUTOMATICALLY_SET_UNIT_TYPE_PORTRAIT_MODEL_PATH then
|
|
615
|
-
self.object:setField("upor:hd",
|
|
615
|
+
self.object:setField("upor:hd", "")
|
|
616
616
|
end
|
|
617
617
|
end
|
|
618
618
|
},
|
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.
|
|
4
|
+
"version": "0.0.1-dev.75f6e33",
|
|
5
5
|
"description": "A typescript library for Warcraft III using Warpack.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"warcraft",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@warscript/language-extensions": "^0.0.1",
|
|
25
25
|
"@warscript/tstl-plugin": "^0.0.4",
|
|
26
26
|
"lua-types": "^2.13.1",
|
|
27
|
-
"warpack": "0.0.1-dev.
|
|
27
|
+
"warpack": "0.0.1-dev.519fc14"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@typescript-eslint/eslint-plugin": "^8.13.0",
|