warscript 0.0.1-dev.e1acea3 → 0.0.1-dev.e27e5b1
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/attributes.d.ts +6 -0
- package/attributes.lua +17 -1
- package/config.d.ts +5 -0
- package/config.lua +10 -0
- package/core/types/effect.d.ts +2 -3
- package/core/types/effect.lua +95 -48
- package/core/types/frame.d.ts +1 -0
- package/core/types/frame.lua +136 -58
- package/core/types/handle.lua +6 -9
- package/core/types/item.d.ts +1 -0
- package/core/types/item.lua +1 -0
- package/core/types/player.d.ts +18 -1
- package/core/types/player.lua +76 -26
- package/core/types/playerCamera.d.ts +2 -0
- package/core/types/playerCamera.lua +123 -5
- package/core/types/playerColor.lua +4 -3
- package/core/types/sound.d.ts +18 -25
- package/core/types/sound.lua +113 -33
- package/core/types/tileCell.d.ts +11 -1
- package/core/types/tileCell.lua +97 -0
- package/core/types/timer.d.ts +9 -8
- package/core/types/timer.lua +45 -23
- package/core/types/unit.d.ts +4 -0
- package/core/types/unit.lua +4 -0
- package/core/util.d.ts +1 -1
- package/core/util.lua +12 -1
- package/decl/native.d.ts +1718 -964
- package/destroyable.d.ts +1 -0
- package/destroyable.lua +9 -0
- package/engine/behavior.d.ts +14 -1
- package/engine/behavior.lua +230 -70
- package/engine/behaviour/ability/always-enabled.d.ts +7 -0
- package/engine/behaviour/ability/always-enabled.lua +31 -0
- package/engine/behaviour/ability/apply-buff.d.ts +5 -0
- package/engine/behaviour/ability/apply-buff.lua +36 -4
- package/engine/behaviour/ability/apply-unit-behavior.lua +1 -0
- package/engine/behaviour/ability/damage.d.ts +12 -3
- package/engine/behaviour/ability/damage.lua +33 -39
- package/engine/behaviour/ability/emulate-impact.d.ts +1 -1
- package/engine/behaviour/ability/emulate-impact.lua +21 -6
- package/engine/behaviour/ability/on-command-impact.lua +7 -0
- package/engine/behaviour/ability/remove-buffs.d.ts +13 -1
- package/engine/behaviour/ability/remove-buffs.lua +29 -2
- package/engine/behaviour/ability/restore-mana.d.ts +1 -1
- package/engine/behaviour/ability/restore-mana.lua +6 -6
- package/engine/behaviour/ability.d.ts +23 -6
- package/engine/behaviour/ability.lua +115 -22
- package/engine/behaviour/unit/stun-immunity.d.ts +12 -6
- package/engine/behaviour/unit/stun-immunity.lua +57 -31
- package/engine/behaviour/unit.d.ts +41 -2
- package/engine/behaviour/unit.lua +270 -6
- package/engine/buff.d.ts +113 -53
- package/engine/buff.lua +544 -288
- package/engine/internal/ability.d.ts +22 -2
- package/engine/internal/ability.lua +151 -27
- package/engine/internal/item/ability.lua +162 -4
- package/engine/internal/item/fields.d.ts +12 -0
- package/engine/internal/item/fields.lua +33 -0
- package/engine/internal/item+owner.d.ts +1 -0
- package/engine/internal/item+owner.lua +19 -6
- package/engine/internal/item.d.ts +30 -18
- package/engine/internal/item.lua +292 -102
- package/engine/internal/mechanics/ability-duration.lua +1 -1
- package/engine/internal/mechanics/cast-ability.lua +6 -3
- package/engine/internal/misc/ability-disable-counter.lua +13 -0
- package/engine/internal/misc/damage-metadata-by-target.d.ts +2 -0
- package/engine/internal/misc/damage-metadata-by-target.lua +5 -0
- package/engine/internal/misc/frame-coordinates.d.ts +2 -0
- package/engine/internal/misc/frame-coordinates.lua +21 -0
- package/engine/internal/misc/get-terrain-z.d.ts +2 -0
- package/engine/internal/misc/get-terrain-z.lua +11 -0
- package/engine/internal/misc/player-local-handle.d.ts +2 -0
- package/engine/internal/misc/player-local-handle.lua +5 -0
- package/engine/internal/object-data/armor-bonus.d.ts +2 -0
- package/engine/internal/object-data/attribute-bonus.lua +2 -2
- package/engine/internal/object-data/auto-attack-speed-increase.d.ts +1 -1
- package/engine/internal/object-data/auto-attack-speed-increase.lua +2 -0
- package/engine/internal/object-data/evasion-probability.d.ts +2 -0
- package/engine/internal/object-data/evasion-probability.lua +16 -0
- package/engine/internal/object-data/health-bonus.d.ts +2 -0
- package/engine/internal/object-data/health-bonus.lua +16 -0
- package/engine/internal/object-data/mana-bonus.d.ts +2 -0
- package/engine/internal/object-data/mana-bonus.lua +16 -0
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.d.ts +2 -0
- package/engine/internal/object-data/mana-regeneration-rate-increase-factor.lua +16 -0
- package/engine/internal/unit/ability.d.ts +35 -0
- package/engine/internal/unit/ability.lua +113 -12
- package/engine/internal/unit/add-item-to-slot-init.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot-init.lua +23 -0
- package/engine/internal/unit/add-item-to-slot.d.ts +2 -0
- package/engine/internal/unit/add-item-to-slot.lua +52 -0
- package/engine/internal/unit/allowed-targets.d.ts +1 -1
- package/engine/internal/unit/allowed-targets.lua +9 -1
- package/engine/internal/unit/appearance.d.ts +15 -0
- package/engine/internal/unit/appearance.lua +85 -0
- package/engine/internal/unit/attributes.d.ts +17 -0
- package/engine/internal/unit/attributes.lua +46 -0
- package/engine/internal/unit/bag.d.ts +18 -0
- package/engine/internal/unit/bag.lua +63 -0
- package/engine/internal/unit/bonus.d.ts +8 -0
- package/engine/internal/unit/bonus.lua +50 -3
- package/engine/internal/unit/buff.d.ts +2 -2
- package/engine/internal/unit/buff.lua +32 -17
- package/engine/internal/unit/equipment.d.ts +36 -0
- package/engine/internal/unit/equipment.lua +169 -0
- package/engine/internal/unit/fly-height.d.ts +7 -0
- package/engine/internal/unit/fly-height.lua +20 -0
- package/engine/internal/unit/ignore-events-items.d.ts +2 -0
- package/engine/internal/unit/ignore-events-items.lua +5 -0
- package/engine/internal/unit/interrupts.d.ts +12 -0
- package/engine/internal/unit/interrupts.lua +28 -0
- package/engine/internal/unit/{item.d.ts → inventory.d.ts} +3 -3
- package/engine/internal/unit/inventory.lua +77 -0
- package/engine/internal/unit/main-selected.lua +12 -27
- package/engine/internal/unit/order.d.ts +20 -0
- package/engine/internal/unit/order.lua +136 -0
- package/engine/internal/unit/pseudo-passive-abilities.d.ts +2 -0
- package/engine/internal/unit/pseudo-passive-abilities.lua +11 -0
- package/engine/internal/unit/range-event.d.ts +12 -0
- package/engine/internal/unit/range-event.lua +90 -0
- package/engine/internal/unit/scale.d.ts +7 -0
- package/engine/internal/unit/scale.lua +20 -0
- package/engine/internal/unit+ability.lua +10 -1
- package/engine/internal/unit+bonus.lua +3 -3
- package/engine/internal/unit+damage.d.ts +2 -11
- package/engine/internal/unit+damage.lua +10 -14
- package/engine/internal/unit+spellSteal.lua +1 -2
- package/engine/internal/unit-missile-launch.lua +52 -14
- package/engine/internal/unit.d.ts +45 -26
- package/engine/internal/unit.lua +443 -274
- package/engine/internal/utility.lua +12 -0
- package/engine/lightning.d.ts +12 -5
- package/engine/lightning.lua +48 -14
- package/engine/local-client.d.ts +21 -0
- package/engine/local-client.lua +150 -7
- package/engine/object-data/auxiliary/animation-name.d.ts +1 -0
- package/engine/object-data/auxiliary/animation-name.lua +16 -0
- package/engine/object-data/auxiliary/armor-type.d.ts +11 -0
- package/engine/object-data/auxiliary/armor-type.lua +46 -0
- package/engine/object-data/auxiliary/attachment-preset.d.ts +7 -2
- package/engine/object-data/auxiliary/attachment-preset.lua +4 -3
- package/engine/object-data/auxiliary/attack-type.d.ts +7 -8
- package/engine/object-data/auxiliary/attack-type.lua +42 -0
- package/engine/object-data/auxiliary/equipment-slot.d.ts +12 -0
- package/engine/object-data/auxiliary/equipment-slot.lua +2 -0
- package/engine/object-data/auxiliary/equipment-type.d.ts +13 -0
- package/engine/object-data/auxiliary/equipment-type.lua +2 -0
- package/engine/object-data/auxiliary/health-regeneration-type.d.ts +8 -0
- package/engine/object-data/auxiliary/health-regeneration-type.lua +2 -0
- package/engine/object-data/auxiliary/item-tag.d.ts +12 -0
- package/engine/object-data/auxiliary/item-tag.lua +2 -0
- package/engine/object-data/auxiliary/movement-type.d.ts +7 -7
- package/engine/object-data/auxiliary/movement-type.lua +22 -0
- package/engine/object-data/auxiliary/sound-eax.d.ts +10 -0
- package/engine/object-data/auxiliary/sound-eax.lua +2 -0
- package/engine/object-data/auxiliary/tech-tree-dependency.d.ts +1 -1
- package/engine/object-data/auxiliary/unit-attribute.d.ts +6 -0
- package/engine/object-data/auxiliary/unit-attribute.lua +9 -0
- package/engine/object-data/entry/ability-type/{armor-increase.d.ts → armor-bonus.d.ts} +3 -3
- package/engine/object-data/entry/ability-type/{armor-increase.lua → armor-bonus.lua} +9 -9
- package/engine/object-data/entry/ability-type/berserk.d.ts +2 -0
- package/engine/object-data/entry/ability-type/berserk.lua +13 -0
- package/engine/object-data/entry/ability-type/blank-configurable.d.ts +3 -0
- package/engine/object-data/entry/ability-type/blank-configurable.lua +42 -1
- package/engine/object-data/entry/ability-type/carrion-swarm.d.ts +14 -0
- package/engine/object-data/entry/ability-type/carrion-swarm.lua +65 -0
- package/engine/object-data/entry/ability-type/disease-cloud.lua +2 -2
- package/engine/object-data/entry/ability-type/engineering-upgrade.lua +2 -2
- package/engine/object-data/entry/ability-type/ensnare.d.ts +12 -0
- package/engine/object-data/entry/ability-type/ensnare.lua +52 -0
- package/engine/object-data/entry/ability-type/feral-spirit.lua +2 -2
- package/engine/object-data/entry/ability-type/health-bonus.d.ts +8 -0
- package/engine/object-data/entry/ability-type/health-bonus.lua +26 -0
- package/engine/object-data/entry/ability-type/mana-bonus.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-bonus.lua +26 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.d.ts +8 -0
- package/engine/object-data/entry/ability-type/mana-regeneration.lua +26 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.d.ts +8 -0
- package/engine/object-data/entry/ability-type/permanent-invisibility.lua +26 -0
- package/engine/object-data/entry/ability-type/phase-shift.d.ts +10 -0
- package/engine/object-data/entry/ability-type/phase-shift.lua +39 -0
- package/engine/object-data/entry/ability-type/phoenix-morph.lua +4 -4
- package/engine/object-data/entry/ability-type/raise-dead.d.ts +17 -0
- package/engine/object-data/entry/ability-type/raise-dead.lua +78 -0
- package/engine/object-data/entry/ability-type/reincarnation.d.ts +8 -0
- package/engine/object-data/entry/ability-type/reincarnation.lua +26 -0
- package/engine/object-data/entry/ability-type/shock-wave.d.ts +4 -0
- package/engine/object-data/entry/ability-type/shock-wave.lua +26 -0
- package/engine/object-data/entry/ability-type/slow-poison.d.ts +10 -0
- package/engine/object-data/entry/ability-type/slow-poison.lua +58 -0
- package/engine/object-data/entry/ability-type/summon-quilbeast.lua +2 -2
- package/engine/object-data/entry/ability-type/summon-water-elemental.lua +2 -2
- package/engine/object-data/entry/ability-type/web.d.ts +12 -0
- package/engine/object-data/entry/ability-type/web.lua +52 -0
- package/engine/object-data/entry/ability-type.d.ts +21 -17
- package/engine/object-data/entry/ability-type.lua +177 -40
- package/engine/object-data/entry/buff-type/applicable.lua +122 -137
- package/engine/object-data/entry/buff-type.d.ts +6 -12
- package/engine/object-data/entry/buff-type.lua +13 -29
- package/engine/object-data/entry/destructible-type.d.ts +28 -2
- package/engine/object-data/entry/destructible-type.lua +155 -0
- package/engine/object-data/entry/item-type.d.ts +3 -1
- package/engine/object-data/entry/item-type.lua +15 -2
- package/engine/object-data/entry/lightning-type.d.ts +1 -1
- package/engine/object-data/entry/sound-preset.d.ts +33 -0
- package/engine/object-data/entry/sound-preset.lua +140 -0
- package/engine/object-data/entry/unit-type.d.ts +25 -5
- package/engine/object-data/entry/unit-type.lua +258 -93
- package/engine/object-data/entry/upgrade.d.ts +1 -1
- package/engine/object-data/entry/upgrade.lua +4 -4
- package/engine/object-data/entry.d.ts +16 -14
- package/engine/object-data/entry.lua +60 -32
- package/engine/object-data/utility/object-data-entry-id-generator.lua +7 -0
- package/engine/object-field/ability.d.ts +12 -6
- package/engine/object-field/ability.lua +10 -6
- package/engine/object-field/item.d.ts +22 -0
- package/engine/object-field/item.lua +118 -0
- package/engine/object-field/unit.d.ts +72 -3
- package/engine/object-field/unit.lua +268 -7
- package/engine/object-field.d.ts +26 -7
- package/engine/object-field.lua +362 -117
- package/engine/random.d.ts +10 -0
- package/engine/random.lua +21 -0
- package/engine/standard/entries/buff-type.d.ts +3 -0
- package/engine/standard/entries/buff-type.lua +3 -0
- package/engine/standard/entries/sound-preset.d.ts +10 -0
- package/engine/standard/entries/sound-preset.lua +10 -0
- package/engine/standard/fields/ability.d.ts +4 -2
- package/engine/standard/fields/ability.lua +4 -2
- package/engine/standard/fields/item.d.ts +4 -0
- package/engine/standard/fields/item.lua +6 -0
- package/engine/standard/fields/unit.d.ts +12 -0
- package/engine/standard/fields/unit.lua +20 -0
- package/engine/synchronization.d.ts +11 -0
- package/engine/synchronization.lua +77 -0
- package/engine/text-tag.d.ts +36 -2
- package/engine/text-tag.lua +250 -10
- package/engine/unit.d.ts +11 -1
- package/engine/unit.lua +11 -1
- package/event.d.ts +1 -1
- package/lualib_bundle.lua +1 -1
- package/math.d.ts +2 -0
- package/math.lua +14 -0
- package/net/socket.lua +1 -1
- package/network.lua +25 -1
- package/objutil/buff.lua +11 -10
- package/objutil/object.lua +1 -1
- package/objutil/unit.lua +8 -0
- package/operation.d.ts +8 -1
- package/operation.lua +38 -18
- package/package.json +5 -5
- package/patch-lua.lua +15 -0
- package/patch-lualib.lua +1 -1
- package/utility/arrays.d.ts +2 -0
- package/utility/arrays.lua +11 -0
- package/utility/callback-array.d.ts +17 -0
- package/utility/callback-array.lua +61 -0
- package/utility/functions.d.ts +8 -0
- package/utility/functions.lua +13 -0
- package/utility/linked-map.d.ts +35 -0
- package/utility/linked-map.lua +107 -0
- package/utility/linked-set.d.ts +5 -1
- package/utility/linked-set.lua +49 -1
- package/utility/lua-maps.d.ts +15 -2
- package/utility/lua-maps.lua +53 -2
- package/utility/lua-sets.d.ts +2 -0
- package/utility/lua-sets.lua +7 -0
- package/utility/random.d.ts +102 -0
- package/utility/random.lua +273 -0
- package/utility/records.lua +20 -1
- package/utility/reflection.lua +11 -7
- package/utility/types.d.ts +3 -0
- package/utility/unordered-map.d.ts +27 -0
- package/utility/unordered-map.lua +99 -0
- package/core/types/order.d.ts +0 -25
- package/core/types/order.lua +0 -55
- package/engine/internal/unit/item.lua +0 -84
- /package/engine/internal/{object-data/armor-increase.d.ts → misc/ability-disable-counter.d.ts} +0 -0
- /package/engine/internal/object-data/{armor-increase.lua → armor-bonus.lua} +0 -0
- /package/engine/object-data/entry/ability-type/{attribute-increase.d.ts → attribute-bonus.d.ts} +0 -0
- /package/engine/object-data/entry/ability-type/{attribute-increase.lua → attribute-bonus.lua} +0 -0
package/core/types/player.d.ts
CHANGED
|
@@ -7,6 +7,18 @@ import { UpgradeId } from "../../engine/object-data/entry/upgrade";
|
|
|
7
7
|
interface Unit {
|
|
8
8
|
handle: junit;
|
|
9
9
|
}
|
|
10
|
+
export declare const enum PlayerAllianceType {
|
|
11
|
+
PASSIVE = 0,
|
|
12
|
+
RESCUABLE = 1,
|
|
13
|
+
HELP_REQUEST = 2,
|
|
14
|
+
HELP_RESPONSE = 3,
|
|
15
|
+
SHARED_XP = 4,
|
|
16
|
+
SHARED_SPELLS = 5,
|
|
17
|
+
SHARED_VISION = 6,
|
|
18
|
+
SHARED_VISION_FORCED = 7,
|
|
19
|
+
SHARED_CONTROL = 8,
|
|
20
|
+
SHARED_ADVANCED_CONTROL = 9
|
|
21
|
+
}
|
|
10
22
|
export declare class Player extends Handle<jplayer> {
|
|
11
23
|
static readonly all: Player[];
|
|
12
24
|
static readonly local: Player;
|
|
@@ -16,6 +28,7 @@ export declare class Player extends Handle<jplayer> {
|
|
|
16
28
|
static readonly neutralExtra: Player;
|
|
17
29
|
private static events;
|
|
18
30
|
readonly id: number;
|
|
31
|
+
readonly slotState: jplayerslotstate;
|
|
19
32
|
constructor(handle: jplayer);
|
|
20
33
|
onDestroy(): HandleDestructor;
|
|
21
34
|
toString(): string;
|
|
@@ -33,15 +46,17 @@ export declare class Player extends Handle<jplayer> {
|
|
|
33
46
|
get isUser(): boolean;
|
|
34
47
|
get isPlaying(): boolean;
|
|
35
48
|
get controller(): jmapcontrol;
|
|
36
|
-
get slotState(): jplayerslotstate;
|
|
37
49
|
clearSelection(): void;
|
|
38
50
|
selectSingle(unit: Unit): void;
|
|
39
51
|
select(unit: Unit): void;
|
|
40
52
|
deselect(unit: Unit): void;
|
|
53
|
+
setRaceSkin(racePreference: jracepreference): void;
|
|
41
54
|
forceUIKey(key: string): void;
|
|
42
55
|
forceUICancel(): void;
|
|
43
56
|
isAllyOf(other: Player): boolean;
|
|
44
57
|
isEnemyOf(other: Player): boolean;
|
|
58
|
+
setAlliance(other: Player, type: PlayerAllianceType, value: boolean): void;
|
|
59
|
+
getAlliance(other: Player, type: PlayerAllianceType): boolean;
|
|
45
60
|
setAbilityAvailable(abilityId: number, available: boolean): void;
|
|
46
61
|
getMaximumUpgradeLevel(upgradeId: UpgradeId): number;
|
|
47
62
|
setMaximumUpgradeLevel(upgradeId: UpgradeId, maximumLevel: number): void;
|
|
@@ -50,6 +65,7 @@ export declare class Player extends Handle<jplayer> {
|
|
|
50
65
|
setUpgradeLevel(upgradeId: UpgradeId, level: number): void;
|
|
51
66
|
private static getEvent;
|
|
52
67
|
private static getMouseEvent;
|
|
68
|
+
static get allianceChangedEvent(): Readonly<Record<PlayerAllianceType, Event<[Player]>>>;
|
|
53
69
|
static get onLeave(): Event<[Player]>;
|
|
54
70
|
static get onMouseDown(): Event<[Player, jmousebuttontype]>;
|
|
55
71
|
static get onMouseUp(): Event<[Player, jmousebuttontype]>;
|
|
@@ -66,6 +82,7 @@ export declare class Player extends Handle<jplayer> {
|
|
|
66
82
|
};
|
|
67
83
|
};
|
|
68
84
|
static get onChat(): Event<[player: Player, message: string]>;
|
|
85
|
+
static readonly colorChangedEvent: Event<[Player]>;
|
|
69
86
|
static byId(id: number): Player | undefined;
|
|
70
87
|
}
|
|
71
88
|
export {};
|
package/core/types/player.lua
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__New = ____lualib.__TS__New
|
|
2
3
|
local __TS__Class = ____lualib.__TS__Class
|
|
3
4
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
-
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
6
6
|
local __TS__ObjectDefineProperty = ____lualib.__TS__ObjectDefineProperty
|
|
7
7
|
local ____exports = {}
|
|
@@ -21,20 +21,43 @@ local ____exception = require("exception")
|
|
|
21
21
|
local IllegalStateException = ____exception.IllegalStateException
|
|
22
22
|
local ____math = require("math")
|
|
23
23
|
local MAXIMUM_INTEGER = ____math.MAXIMUM_INTEGER
|
|
24
|
+
local ____player_2Dlocal_2Dhandle = require("engine.internal.misc.player-local-handle")
|
|
25
|
+
local PLAYER_LOCAL_HANDLE = ____player_2Dlocal_2Dhandle.PLAYER_LOCAL_HANDLE
|
|
26
|
+
local ____lazy = require("utility.lazy")
|
|
27
|
+
local lazyRecord = ____lazy.lazyRecord
|
|
28
|
+
local getPlayerAlliance = GetPlayerAlliance
|
|
24
29
|
local getPlayerColor = GetPlayerColor
|
|
25
30
|
local getPlayerName = GetPlayerName
|
|
26
31
|
local getPlayerTechCount = GetPlayerTechCount
|
|
27
32
|
local getPlayerTechMaxAllowed = GetPlayerTechMaxAllowed
|
|
33
|
+
local getTriggerPlayer = GetTriggerPlayer
|
|
34
|
+
local playerNative = _G.Player
|
|
35
|
+
local setPlayerAbilityAvailable = SetPlayerAbilityAvailable
|
|
36
|
+
local setPlayerAlliance = SetPlayerAlliance
|
|
37
|
+
local setPlayerRaceSkin = SetPlayerRaceSkin
|
|
28
38
|
local setPlayerTechMaxAllowed = SetPlayerTechMaxAllowed
|
|
29
39
|
local setPlayerTechResearched = SetPlayerTechResearched
|
|
30
|
-
local
|
|
31
|
-
local
|
|
40
|
+
local triggerRegisterPlayerAllianceChange = TriggerRegisterPlayerAllianceChange
|
|
41
|
+
local nativeByPlayerAllianceType = {
|
|
42
|
+
[0] = ALLIANCE_PASSIVE,
|
|
43
|
+
[1] = ALLIANCE_RESCUABLE,
|
|
44
|
+
[2] = ALLIANCE_HELP_REQUEST,
|
|
45
|
+
[3] = ALLIANCE_HELP_RESPONSE,
|
|
46
|
+
[4] = ALLIANCE_SHARED_XP,
|
|
47
|
+
[5] = ALLIANCE_SHARED_SPELLS,
|
|
48
|
+
[6] = ALLIANCE_SHARED_VISION,
|
|
49
|
+
[7] = ALLIANCE_SHARED_VISION_FORCED,
|
|
50
|
+
[8] = ALLIANCE_SHARED_CONTROL,
|
|
51
|
+
[9] = ALLIANCE_SHARED_ADVANCED_CONTROL
|
|
52
|
+
}
|
|
53
|
+
local playerColorChangedEvent = __TS__New(Event)
|
|
32
54
|
____exports.Player = __TS__Class()
|
|
33
55
|
local Player = ____exports.Player
|
|
34
56
|
Player.name = "Player"
|
|
35
57
|
__TS__ClassExtends(Player, Handle)
|
|
36
58
|
function Player.prototype.____constructor(self, handle)
|
|
37
59
|
Handle.prototype.____constructor(self, handle)
|
|
60
|
+
self.slotState = GetPlayerSlotState(self.handle)
|
|
38
61
|
self.id = GetPlayerId(handle)
|
|
39
62
|
end
|
|
40
63
|
function Player.prototype.onDestroy(self)
|
|
@@ -67,6 +90,9 @@ function Player.prototype.deselect(self, unit)
|
|
|
67
90
|
SelectUnit(unit.handle, false)
|
|
68
91
|
end
|
|
69
92
|
end
|
|
93
|
+
function Player.prototype.setRaceSkin(self, racePreference)
|
|
94
|
+
setPlayerRaceSkin(self.handle, racePreference)
|
|
95
|
+
end
|
|
70
96
|
function Player.prototype.forceUIKey(self, key)
|
|
71
97
|
if self.isLocal then
|
|
72
98
|
ForceUIKey(key)
|
|
@@ -83,6 +109,12 @@ end
|
|
|
83
109
|
function Player.prototype.isEnemyOf(self, other)
|
|
84
110
|
return IsPlayerEnemy(self.handle, other.handle)
|
|
85
111
|
end
|
|
112
|
+
function Player.prototype.setAlliance(self, other, ____type, value)
|
|
113
|
+
setPlayerAlliance(self.handle, other.handle, nativeByPlayerAllianceType[____type], value)
|
|
114
|
+
end
|
|
115
|
+
function Player.prototype.getAlliance(self, other, ____type)
|
|
116
|
+
return getPlayerAlliance(self.handle, other.handle, nativeByPlayerAllianceType[____type])
|
|
117
|
+
end
|
|
86
118
|
function Player.prototype.setAbilityAvailable(self, abilityId, available)
|
|
87
119
|
setPlayerAbilityAvailable(self.handle, abilityId, available)
|
|
88
120
|
end
|
|
@@ -122,14 +154,11 @@ function Player.getMouseEvent(self, event, collector)
|
|
|
122
154
|
self.events[eventId] = __TS__New(
|
|
123
155
|
TriggerEvent,
|
|
124
156
|
function(trigger)
|
|
125
|
-
Timer:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
for ____, player in ipairs(____exports.Player.all) do
|
|
129
|
-
TriggerRegisterPlayerEvent(trigger, player.handle, event)
|
|
130
|
-
end
|
|
157
|
+
Timer:run(function()
|
|
158
|
+
for ____, player in ipairs(____exports.Player.all) do
|
|
159
|
+
TriggerRegisterPlayerEvent(trigger, player.handle, event)
|
|
131
160
|
end
|
|
132
|
-
)
|
|
161
|
+
end)
|
|
133
162
|
end,
|
|
134
163
|
collector or (function() return {} end)
|
|
135
164
|
)
|
|
@@ -178,7 +207,7 @@ function Player.getKeyEvent(self, isDown)
|
|
|
178
207
|
TriggerAddCondition(
|
|
179
208
|
trigger,
|
|
180
209
|
Condition(function()
|
|
181
|
-
local player = ____exports.Player:of(
|
|
210
|
+
local player = ____exports.Player:of(getTriggerPlayer())
|
|
182
211
|
local key = BlzGetTriggerPlayerKey()
|
|
183
212
|
local metaKey = BlzGetTriggerPlayerMetaKey()
|
|
184
213
|
Event.invoke(event, player, key, metaKey)
|
|
@@ -249,7 +278,7 @@ Player.all = (function()
|
|
|
249
278
|
end
|
|
250
279
|
return all
|
|
251
280
|
end)()
|
|
252
|
-
Player["local"] = ____exports.Player:of(
|
|
281
|
+
Player["local"] = ____exports.Player:of(PLAYER_LOCAL_HANDLE)
|
|
253
282
|
Player.neutralPassive = ____exports.Player.all[PLAYER_NEUTRAL_PASSIVE + 1]
|
|
254
283
|
Player.neutralAggressive = ____exports.Player.all[PLAYER_NEUTRAL_AGGRESSIVE + 1]
|
|
255
284
|
Player.neutralVictim = ____exports.Player.all[bj_PLAYER_NEUTRAL_VICTIM + 1]
|
|
@@ -277,6 +306,7 @@ __TS__SetDescriptor(
|
|
|
277
306
|
end,
|
|
278
307
|
set = function(self, color)
|
|
279
308
|
SetPlayerColor(self.handle, color.handle)
|
|
309
|
+
Event.invoke(playerColorChangedEvent, self)
|
|
280
310
|
end
|
|
281
311
|
},
|
|
282
312
|
true
|
|
@@ -339,7 +369,7 @@ __TS__SetDescriptor(
|
|
|
339
369
|
Player.prototype,
|
|
340
370
|
"isUser",
|
|
341
371
|
{get = function(self)
|
|
342
|
-
return
|
|
372
|
+
return self.controller == MAP_CONTROL_USER
|
|
343
373
|
end},
|
|
344
374
|
true
|
|
345
375
|
)
|
|
@@ -347,7 +377,7 @@ __TS__SetDescriptor(
|
|
|
347
377
|
Player.prototype,
|
|
348
378
|
"isPlaying",
|
|
349
379
|
{get = function(self)
|
|
350
|
-
return
|
|
380
|
+
return self.slotState == PLAYER_SLOT_STATE_PLAYING
|
|
351
381
|
end},
|
|
352
382
|
true
|
|
353
383
|
)
|
|
@@ -355,17 +385,30 @@ __TS__SetDescriptor(
|
|
|
355
385
|
Player.prototype,
|
|
356
386
|
"controller",
|
|
357
387
|
{get = function(self)
|
|
358
|
-
|
|
388
|
+
local controller = GetPlayerController(self.handle)
|
|
389
|
+
rawset(self, "controller", controller)
|
|
390
|
+
return controller
|
|
359
391
|
end},
|
|
360
392
|
true
|
|
361
393
|
)
|
|
362
|
-
|
|
363
|
-
Player
|
|
364
|
-
"
|
|
394
|
+
__TS__ObjectDefineProperty(
|
|
395
|
+
Player,
|
|
396
|
+
"allianceChangedEvent",
|
|
365
397
|
{get = function(self)
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
398
|
+
local event = lazyRecord(function(____type)
|
|
399
|
+
return __TS__New(
|
|
400
|
+
TriggerEvent,
|
|
401
|
+
function(trigger)
|
|
402
|
+
for ____, player in ipairs(____exports.Player.all) do
|
|
403
|
+
triggerRegisterPlayerAllianceChange(trigger, player.handle, nativeByPlayerAllianceType[____type])
|
|
404
|
+
end
|
|
405
|
+
end,
|
|
406
|
+
function() return ____exports.Player:of(getTriggerPlayer()) end
|
|
407
|
+
)
|
|
408
|
+
end)
|
|
409
|
+
rawset(self, "allianceChangedEvent", event)
|
|
410
|
+
return event
|
|
411
|
+
end}
|
|
369
412
|
)
|
|
370
413
|
__TS__ObjectDefineProperty(
|
|
371
414
|
Player,
|
|
@@ -373,7 +416,7 @@ __TS__ObjectDefineProperty(
|
|
|
373
416
|
{get = function(self)
|
|
374
417
|
return ____exports.Player:getEvent(
|
|
375
418
|
EVENT_PLAYER_LEAVE,
|
|
376
|
-
function() return ____exports.Player:of(
|
|
419
|
+
function() return ____exports.Player:of(getTriggerPlayer()) end
|
|
377
420
|
)
|
|
378
421
|
end}
|
|
379
422
|
)
|
|
@@ -383,7 +426,7 @@ __TS__ObjectDefineProperty(
|
|
|
383
426
|
{get = function(self)
|
|
384
427
|
return ____exports.Player:getMouseEvent(
|
|
385
428
|
EVENT_PLAYER_MOUSE_DOWN,
|
|
386
|
-
function() return ____exports.Player:of(
|
|
429
|
+
function() return ____exports.Player:of(getTriggerPlayer()), BlzGetTriggerPlayerMouseButton() end
|
|
387
430
|
)
|
|
388
431
|
end}
|
|
389
432
|
)
|
|
@@ -393,7 +436,7 @@ __TS__ObjectDefineProperty(
|
|
|
393
436
|
{get = function(self)
|
|
394
437
|
return ____exports.Player:getMouseEvent(
|
|
395
438
|
EVENT_PLAYER_MOUSE_UP,
|
|
396
|
-
function() return ____exports.Player:of(
|
|
439
|
+
function() return ____exports.Player:of(getTriggerPlayer()), BlzGetTriggerPlayerMouseButton() end
|
|
397
440
|
)
|
|
398
441
|
end}
|
|
399
442
|
)
|
|
@@ -403,7 +446,7 @@ __TS__ObjectDefineProperty(
|
|
|
403
446
|
{get = function(self)
|
|
404
447
|
return ____exports.Player:getMouseEvent(
|
|
405
448
|
EVENT_PLAYER_MOUSE_MOVE,
|
|
406
|
-
function() return ____exports.Player:of(
|
|
449
|
+
function() return ____exports.Player:of(getTriggerPlayer()), vec2(
|
|
407
450
|
BlzGetTriggerPlayerMouseX(),
|
|
408
451
|
BlzGetTriggerPlayerMouseY()
|
|
409
452
|
) end
|
|
@@ -439,10 +482,17 @@ __TS__ObjectDefineProperty(
|
|
|
439
482
|
TriggerRegisterPlayerChatEvent(trigger, player.handle, "", false)
|
|
440
483
|
end
|
|
441
484
|
end,
|
|
442
|
-
function() return ____exports.Player:of(
|
|
485
|
+
function() return ____exports.Player:of(getTriggerPlayer()), GetEventPlayerChatString() end
|
|
443
486
|
)
|
|
444
487
|
rawset(self, "onChat", event)
|
|
445
488
|
return event
|
|
446
489
|
end}
|
|
447
490
|
)
|
|
491
|
+
Player.colorChangedEvent = playerColorChangedEvent
|
|
492
|
+
____exports.Player.onLeave:addListener(
|
|
493
|
+
999999,
|
|
494
|
+
function(player)
|
|
495
|
+
rawset(player, "slotState", PLAYER_SLOT_STATE_LEFT)
|
|
496
|
+
end
|
|
497
|
+
)
|
|
448
498
|
return ____exports
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
+
import type { Unit } from "../../engine/internal/unit";
|
|
2
3
|
export declare class PlayerCamera {
|
|
3
4
|
private readonly player;
|
|
4
5
|
private readonly isLocal;
|
|
@@ -28,5 +29,6 @@ export declare class PlayerCamera {
|
|
|
28
29
|
get roll(): number;
|
|
29
30
|
set roll(v: number);
|
|
30
31
|
reset(): void;
|
|
32
|
+
static isUnitInView(unit: Unit): boolean;
|
|
31
33
|
static of(player: jplayer): PlayerCamera;
|
|
32
34
|
}
|
|
@@ -3,33 +3,52 @@ local __TS__Class = ____lualib.__TS__Class
|
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local __TS__SetDescriptor = ____lualib.__TS__SetDescriptor
|
|
5
5
|
local ____exports = {}
|
|
6
|
+
local ____timer = require("core.types.timer")
|
|
7
|
+
local Timer = ____timer.Timer
|
|
8
|
+
local ____player_2Dlocal_2Dhandle = require("engine.internal.misc.player-local-handle")
|
|
9
|
+
local PLAYER_LOCAL_HANDLE = ____player_2Dlocal_2Dhandle.PLAYER_LOCAL_HANDLE
|
|
10
|
+
local ____preconditions = require("utility.preconditions")
|
|
11
|
+
local check = ____preconditions.check
|
|
12
|
+
local ____frame_2Dcoordinates = require("engine.internal.misc.frame-coordinates")
|
|
13
|
+
local FRAME_MAX_Y = ____frame_2Dcoordinates.FRAME_MAX_Y
|
|
14
|
+
local FRAME_MIN_Y = ____frame_2Dcoordinates.FRAME_MIN_Y
|
|
15
|
+
local getFrameMinXMaxX = ____frame_2Dcoordinates.getFrameMinXMaxX
|
|
16
|
+
local ____get_2Dterrain_2Dz = require("engine.internal.misc.get-terrain-z")
|
|
17
|
+
local getTerrainZ = ____get_2Dterrain_2Dz.getTerrainZ
|
|
6
18
|
local getHandleId = GetHandleId
|
|
7
19
|
local setCameraField = SetCameraField
|
|
8
20
|
local getCameraField = GetCameraField
|
|
9
21
|
local setCameraPosition = SetCameraPosition
|
|
22
|
+
local getCameraEyePositionX = GetCameraEyePositionX
|
|
23
|
+
local getCameraEyePositionY = GetCameraEyePositionY
|
|
24
|
+
local getCameraEyePositionZ = GetCameraEyePositionZ
|
|
10
25
|
local getCameraTargetPositionX = GetCameraTargetPositionX
|
|
11
26
|
local getCameraTargetPositionY = GetCameraTargetPositionY
|
|
12
27
|
local resetToGameCamera = ResetToGameCamera
|
|
28
|
+
local cos = math.cos
|
|
13
29
|
local deg = math.deg
|
|
14
|
-
local
|
|
30
|
+
local sin = math.sin
|
|
31
|
+
local sqrt = math.sqrt
|
|
15
32
|
local memoized = {}
|
|
16
33
|
____exports.PlayerCamera = __TS__Class()
|
|
17
34
|
local PlayerCamera = ____exports.PlayerCamera
|
|
18
35
|
PlayerCamera.name = "PlayerCamera"
|
|
19
36
|
function PlayerCamera.prototype.____constructor(self, player)
|
|
20
37
|
local id = getHandleId(player)
|
|
21
|
-
|
|
22
|
-
error("Double-constructor run player camera!")
|
|
23
|
-
end
|
|
38
|
+
check(memoized[id] == nil)
|
|
24
39
|
memoized[id] = self
|
|
25
40
|
self.player = player
|
|
26
|
-
self.isLocal = player ==
|
|
41
|
+
self.isLocal = player == PLAYER_LOCAL_HANDLE
|
|
27
42
|
end
|
|
28
43
|
function PlayerCamera.prototype.reset(self)
|
|
29
44
|
if self.isLocal then
|
|
30
45
|
resetToGameCamera(0)
|
|
31
46
|
end
|
|
32
47
|
end
|
|
48
|
+
function PlayerCamera.isUnitInView(self, unit)
|
|
49
|
+
local ____, ____, isInView = ____exports.worldCoordinatesToFrame(unit.x, unit.y, unit.z)
|
|
50
|
+
return isInView
|
|
51
|
+
end
|
|
33
52
|
function PlayerCamera.of(self, player)
|
|
34
53
|
return memoized[getHandleId(player)] or __TS__New(____exports.PlayerCamera, player)
|
|
35
54
|
end
|
|
@@ -159,4 +178,103 @@ __TS__SetDescriptor(
|
|
|
159
178
|
},
|
|
160
179
|
true
|
|
161
180
|
)
|
|
181
|
+
local cameraEyeX = 0
|
|
182
|
+
local cameraEyeY = 0
|
|
183
|
+
local cameraEyeZ = 0
|
|
184
|
+
local cameraAngleOfAttack = 0
|
|
185
|
+
local cameraAngleOfAttackCos = 0
|
|
186
|
+
local cameraAngleOfAttackSin = 0
|
|
187
|
+
local cameraRotation = 0
|
|
188
|
+
local cameraRotationCos = 0
|
|
189
|
+
local cameraRotationSin = 0
|
|
190
|
+
local cameraAngleOfAttackCosRotationCos = 0
|
|
191
|
+
local cameraAngleOfAttackCosRotationSin = 0
|
|
192
|
+
local cameraAngleOfAttackSinRotationCos = 0
|
|
193
|
+
local cameraAngleOfAttackSinRotationSin = 0
|
|
194
|
+
local yCenterScreenShift = 0
|
|
195
|
+
local scaleFactor = 0
|
|
196
|
+
local frameMinX = 0
|
|
197
|
+
local frameMaxX = 0
|
|
198
|
+
local isCameraViewPrecalculated = false
|
|
199
|
+
local function precalculateCameraView()
|
|
200
|
+
cameraEyeX = getCameraEyePositionX()
|
|
201
|
+
cameraEyeY = getCameraEyePositionY()
|
|
202
|
+
cameraEyeZ = getCameraEyePositionZ()
|
|
203
|
+
cameraAngleOfAttack = getCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK)
|
|
204
|
+
cameraAngleOfAttackCos = cos(cameraAngleOfAttack)
|
|
205
|
+
cameraAngleOfAttackSin = sin(cameraAngleOfAttack)
|
|
206
|
+
cameraRotation = getCameraField(CAMERA_FIELD_ROTATION)
|
|
207
|
+
cameraRotationCos = cos(cameraRotation)
|
|
208
|
+
cameraRotationSin = sin(cameraRotation)
|
|
209
|
+
cameraAngleOfAttackCosRotationCos = cameraAngleOfAttackCos * cameraRotationCos
|
|
210
|
+
cameraAngleOfAttackCosRotationSin = cameraAngleOfAttackCos * cameraRotationSin
|
|
211
|
+
cameraAngleOfAttackSinRotationCos = cameraAngleOfAttackSin * cameraRotationCos
|
|
212
|
+
cameraAngleOfAttackSinRotationSin = cameraAngleOfAttackSin * cameraRotationSin
|
|
213
|
+
yCenterScreenShift = 0.1284 * cameraAngleOfAttackCos
|
|
214
|
+
local cameraFieldOfView = getCameraField(CAMERA_FIELD_FIELD_OF_VIEW)
|
|
215
|
+
scaleFactor = 0.0524 * cameraFieldOfView ^ 3 - 0.0283 * cameraFieldOfView ^ 2 + 1.061 * cameraFieldOfView
|
|
216
|
+
frameMinX, frameMaxX = getFrameMinXMaxX()
|
|
217
|
+
isCameraViewPrecalculated = true
|
|
218
|
+
end
|
|
219
|
+
Timer.onPeriod[1 / 64]:addListener(
|
|
220
|
+
4,
|
|
221
|
+
function()
|
|
222
|
+
isCameraViewPrecalculated = false
|
|
223
|
+
end
|
|
224
|
+
)
|
|
225
|
+
---
|
|
226
|
+
-- @internal For use by internal systems only.
|
|
227
|
+
____exports.worldCoordinatesToFrame = function(x, y, z)
|
|
228
|
+
if not isCameraViewPrecalculated then
|
|
229
|
+
precalculateCameraView()
|
|
230
|
+
end
|
|
231
|
+
local dx = x - cameraEyeX
|
|
232
|
+
local dy = y - cameraEyeY
|
|
233
|
+
local dz = z - cameraEyeZ
|
|
234
|
+
local xPrime = scaleFactor * (-cameraAngleOfAttackCosRotationCos * dx - cameraAngleOfAttackCosRotationSin * dy - cameraAngleOfAttackSin * dz)
|
|
235
|
+
local frameX = 0.4 + (cameraRotationCos * dy - cameraRotationSin * dx) / xPrime
|
|
236
|
+
local frameY = 0.42625 - yCenterScreenShift + (cameraAngleOfAttackSinRotationCos * dx + cameraAngleOfAttackSinRotationSin * dy - cameraAngleOfAttackCos * dz) / xPrime
|
|
237
|
+
return frameX, frameY, xPrime < 0 and frameX >= frameMinX and frameX <= frameMaxX and frameY >= FRAME_MIN_Y and frameY <= FRAME_MAX_Y
|
|
238
|
+
end
|
|
239
|
+
---
|
|
240
|
+
-- @internal For use by internal systems only.
|
|
241
|
+
____exports.frameCoordinatesToWorld = function(x, y)
|
|
242
|
+
if not isCameraViewPrecalculated then
|
|
243
|
+
precalculateCameraView()
|
|
244
|
+
end
|
|
245
|
+
local a = (x - 0.4) * scaleFactor
|
|
246
|
+
local b = (0.42625 - yCenterScreenShift - y) * scaleFactor
|
|
247
|
+
local nx = 1 / sqrt(1 + a * a + b * b)
|
|
248
|
+
local ny = sqrt(1 - (1 + b * b) * nx * nx)
|
|
249
|
+
local nz = sqrt(1 - nx * nx - ny * ny)
|
|
250
|
+
if a > 0 then
|
|
251
|
+
ny = -ny
|
|
252
|
+
end
|
|
253
|
+
if b < 0 then
|
|
254
|
+
nz = -nz
|
|
255
|
+
end
|
|
256
|
+
local nxPrime = cameraAngleOfAttackCosRotationCos * nx - cameraRotationSin * ny + cameraAngleOfAttackSinRotationCos * nz
|
|
257
|
+
local nyPrime = cameraAngleOfAttackCosRotationSin * nx + cameraRotationCos * ny + cameraAngleOfAttackSinRotationSin * nz
|
|
258
|
+
local nzPrime = -cameraAngleOfAttackSin * nx + cameraAngleOfAttackCos * nz
|
|
259
|
+
local zGuess = getTerrainZ(cameraEyeX, cameraEyeY)
|
|
260
|
+
local xGuess = cameraEyeX + nxPrime * (cameraEyeZ - zGuess) / nzPrime
|
|
261
|
+
local yGuess = cameraEyeY + nyPrime * (cameraEyeZ - zGuess) / nzPrime
|
|
262
|
+
local zWorld = getTerrainZ(xGuess, yGuess)
|
|
263
|
+
local deltaZ = zWorld - zGuess
|
|
264
|
+
zGuess = zWorld
|
|
265
|
+
local zWorldOld = zWorld
|
|
266
|
+
local deltaZOld = deltaZ
|
|
267
|
+
local i = 0
|
|
268
|
+
while (deltaZ > 1 or deltaZ < -1) and i < 50 do
|
|
269
|
+
xGuess = cameraEyeX + nxPrime * (cameraEyeZ - zGuess) / nzPrime
|
|
270
|
+
yGuess = cameraEyeY + nyPrime * (cameraEyeZ - zGuess) / nzPrime
|
|
271
|
+
zWorld = getTerrainZ(xGuess, yGuess)
|
|
272
|
+
deltaZ = zWorld - zGuess
|
|
273
|
+
zGuess = (deltaZOld * zWorld - deltaZ * zWorldOld) / (deltaZOld - deltaZ)
|
|
274
|
+
zWorldOld = zWorld
|
|
275
|
+
deltaZOld = deltaZ
|
|
276
|
+
i = i + 1
|
|
277
|
+
end
|
|
278
|
+
return xGuess, yGuess, zWorld, i < 50
|
|
279
|
+
end
|
|
162
280
|
return ____exports
|
|
@@ -10,6 +10,7 @@ local ____color = require("core.types.color")
|
|
|
10
10
|
local Color = ____color.Color
|
|
11
11
|
local ____exception = require("exception")
|
|
12
12
|
local IllegalStateException = ____exception.IllegalStateException
|
|
13
|
+
local getHandleId = GetHandleId
|
|
13
14
|
local byId = {}
|
|
14
15
|
local byName = {}
|
|
15
16
|
____exports.PlayerColor = __TS__Class()
|
|
@@ -81,7 +82,7 @@ PlayerColor.data = util.contextFn(
|
|
|
81
82
|
PLAYER_COLOR_SNOW,
|
|
82
83
|
PLAYER_COLOR_EMERALD,
|
|
83
84
|
PLAYER_COLOR_PEANUT,
|
|
84
|
-
|
|
85
|
+
PLAYER_COLOR_BLACK
|
|
85
86
|
}
|
|
86
87
|
local rgbaColors = {
|
|
87
88
|
Color:of(255, 2, 2),
|
|
@@ -141,7 +142,7 @@ PlayerColor.data = util.contextFn(
|
|
|
141
142
|
do
|
|
142
143
|
local i = 0
|
|
143
144
|
while i < #handles do
|
|
144
|
-
data[
|
|
145
|
+
data[getHandleId(handles[i + 1])] = {rgba = rgbaColors[i + 1], name = names[i + 1]}
|
|
145
146
|
i = i + 1
|
|
146
147
|
end
|
|
147
148
|
end
|
|
@@ -172,7 +173,7 @@ PlayerColor.coal = ____exports.PlayerColor:of(PLAYER_COLOR_COAL)
|
|
|
172
173
|
PlayerColor.snow = ____exports.PlayerColor:of(PLAYER_COLOR_SNOW)
|
|
173
174
|
PlayerColor.emerald = ____exports.PlayerColor:of(PLAYER_COLOR_EMERALD)
|
|
174
175
|
PlayerColor.peanut = ____exports.PlayerColor:of(PLAYER_COLOR_PEANUT)
|
|
175
|
-
PlayerColor.black = ____exports.PlayerColor:of(
|
|
176
|
+
PlayerColor.black = ____exports.PlayerColor:of(PLAYER_COLOR_BLACK)
|
|
176
177
|
PlayerColor.all = {
|
|
177
178
|
____exports.PlayerColor.red,
|
|
178
179
|
____exports.PlayerColor.blue,
|
package/core/types/sound.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
import { Handle, HandleDestructor } from "./handle";
|
|
3
3
|
import { Unit } from "./unit";
|
|
4
|
+
import { SoundEax } from "../../engine/object-data/auxiliary/sound-eax";
|
|
4
5
|
export declare enum SoundChannel {
|
|
5
6
|
General = 0,
|
|
6
7
|
UnitSelection = 1,
|
|
@@ -18,16 +19,7 @@ export declare enum SoundChannel {
|
|
|
18
19
|
Birth = 13,
|
|
19
20
|
Fire = 14
|
|
20
21
|
}
|
|
21
|
-
export
|
|
22
|
-
Default = "DefaultEAXON",
|
|
23
|
-
Acknowledgements = "HeroAcksEAX",
|
|
24
|
-
Environment = "DoodadsEAX",
|
|
25
|
-
Drums = "KotoDrumsEAX",
|
|
26
|
-
Attacks = "CombatSoundsEAX",
|
|
27
|
-
Abilities = "SpellsEAX",
|
|
28
|
-
Missiles = "MissilesEAX"
|
|
29
|
-
}
|
|
30
|
-
export type SoundPreset = Readonly<{
|
|
22
|
+
export type SoundSettings = Readonly<{
|
|
31
23
|
channel?: SoundChannel;
|
|
32
24
|
eax?: SoundEax;
|
|
33
25
|
fadeInRate?: number;
|
|
@@ -36,34 +28,35 @@ export type SoundPreset = Readonly<{
|
|
|
36
28
|
volume?: number;
|
|
37
29
|
pitch?: number;
|
|
38
30
|
}>;
|
|
39
|
-
export type
|
|
31
|
+
export type Sound3DSettings = SoundSettings & Readonly<{
|
|
40
32
|
stopWhenOutOfRange?: boolean;
|
|
41
33
|
minDistance?: number;
|
|
42
34
|
maxDistance?: number;
|
|
43
35
|
distanceCutoff?: number;
|
|
44
36
|
}>;
|
|
45
|
-
export declare namespace
|
|
46
|
-
const UI:
|
|
47
|
-
const Music:
|
|
48
|
-
const Attack:
|
|
49
|
-
const Ability:
|
|
50
|
-
const AbilityLooping:
|
|
51
|
-
const Missile:
|
|
37
|
+
export declare namespace SoundSettings {
|
|
38
|
+
const UI: SoundSettings;
|
|
39
|
+
const Music: SoundSettings;
|
|
40
|
+
const Attack: Sound3DSettings;
|
|
41
|
+
const Ability: Sound3DSettings;
|
|
42
|
+
const AbilityLooping: Sound3DSettings;
|
|
43
|
+
const Missile: Sound3DSettings;
|
|
52
44
|
}
|
|
53
45
|
export declare class Sound extends Handle<jsound, [fadeOut?: boolean]> {
|
|
54
46
|
private _volume?;
|
|
55
47
|
protected onDestroy(fadeOut?: boolean): HandleDestructor;
|
|
56
48
|
get volume(): number;
|
|
57
49
|
set volume(v: number);
|
|
58
|
-
start(milliseconds?: number): void;
|
|
50
|
+
start(milliseconds?: number, fadeIn?: boolean): void;
|
|
59
51
|
stop(fadeOut?: boolean): void;
|
|
60
52
|
restart(milliseconds?: number): void;
|
|
61
|
-
static play(fileName: string, preset:
|
|
62
|
-
static create(fileName: string, preset:
|
|
53
|
+
static play(fileName: string, preset: SoundSettings): void;
|
|
54
|
+
static create(fileName: string, preset: SoundSettings): Sound;
|
|
63
55
|
}
|
|
64
56
|
export declare class Sound3D extends Sound {
|
|
65
|
-
static playAtPosition(fileName: string, preset:
|
|
66
|
-
static playOnUnit(fileName: string, preset:
|
|
67
|
-
static
|
|
68
|
-
static
|
|
57
|
+
static playAtPosition(fileName: string, preset: Sound3DSettings, x?: number, y?: number, z?: number): void;
|
|
58
|
+
static playOnUnit(fileName: string, preset: Sound3DSettings, unit: Unit): void;
|
|
59
|
+
static playFromLabel(label: string, preset: Sound3DSettings, ...positionOrUnit: [Unit] | [number, number, number?]): void;
|
|
60
|
+
static createAtPosition(fileName: string, preset: Sound3DSettings, x?: number, y?: number, z?: number): Sound3D;
|
|
61
|
+
static createOnUnit(fileName: string, preset: Sound3DSettings, unit: Unit): Sound3D;
|
|
69
62
|
}
|