@modlock/modlock 0.1.82 → 0.1.83

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/host.gen.d.ts CHANGED
@@ -101,6 +101,18 @@ export interface AbilityOptions {
101
101
  * are not removed; set them with charges.
102
102
  */
103
103
  maxCharges?: number;
104
+ /**
105
+ * cooldown makes every cooldown the ability starts from now on last this
106
+ * many seconds, in place of the game's own length. An ability that holds
107
+ * charges waits this long between casts. 0 leaves the ability always
108
+ * ready, and a negative value returns it to the game's own. The game asks
109
+ * for the length as it starts each cooldown and applies the hero's cooldown
110
+ * reduction to it, so it holds for every later cast and the hero's screen
111
+ * shows it; a cooldown already running keeps its end, which cooldown_end
112
+ * moves. It holds for this ability of this hero until the mod stops, so
113
+ * set it again after a hero change or a replaced ability.
114
+ */
115
+ cooldown?: number;
104
116
  }
105
117
  /** Modifier is one modifier an entity holds, as the game keeps it. */
106
118
  export interface Modifier {
@@ -159,6 +171,31 @@ export interface BuildItem {
159
171
  /** annotation is the author's note on the item. */
160
172
  readonly annotation: string;
161
173
  }
174
+ /**
175
+ * AbilityCastEvent reports one ability the game executed: the moment the
176
+ * cast takes effect, after any cast time, for a hero's abilities and the
177
+ * items a player activates.
178
+ */
179
+ export interface AbilityCastEvent {
180
+ /** caster is the entity that cast it, a hero for a player's cast. */
181
+ readonly caster: number;
182
+ /** player is the slot of the player whose hero cast it, or -1. */
183
+ readonly player: Player;
184
+ /** ability is the ability's entity handle, as ability.entity reports it. */
185
+ readonly ability: number;
186
+ /**
187
+ * name is the ability's name, such as citadel_ability_hornet_snipe, when
188
+ * a player's hero cast it.
189
+ */
190
+ readonly name: string;
191
+ /**
192
+ * slot is the ability's place on the hero, as ability.slot reports it, or
193
+ * -1 when the caster is not a player's hero.
194
+ */
195
+ readonly slot: number;
196
+ /** target is the entity the cast was aimed at, or zero without one. */
197
+ readonly target: number;
198
+ }
162
199
  /**
163
200
  * DamageEvent is one hit before the game applies it. Handles are zero when
164
201
  * the game names no such entity.
@@ -213,6 +250,27 @@ export interface DamagedEvent {
213
250
  */
214
251
  readonly dealt: number;
215
252
  }
253
+ /** KillEvent reports one hero or unit that a hit killed. */
254
+ export interface KillEvent {
255
+ /** victim is the entity that died. */
256
+ readonly victim: number;
257
+ /**
258
+ * victimPlayer is the slot of the player whose hero died, or -1 for a unit.
259
+ */
260
+ readonly victimPlayer: Player;
261
+ /**
262
+ * attacker is the entity credited with the killing hit, or zero for a
263
+ * hazard.
264
+ */
265
+ readonly attacker: number;
266
+ /**
267
+ * attackerPlayer is the slot of the player whose hero is the attacker, or
268
+ * -1. It is the victim's own slot when a hero killed itself.
269
+ */
270
+ readonly attackerPlayer: Player;
271
+ /** ability is the ability that dealt the killing hit, or zero. */
272
+ readonly ability: number;
273
+ }
216
274
  /** LaunchEvent is a watched projectile's first frame. */
217
275
  export interface LaunchEvent {
218
276
  /** entity is the projectile's entity handle. */
@@ -338,6 +396,32 @@ export interface TraceHit {
338
396
  /** entity is the entity hit, or zero for the world. */
339
397
  readonly entity: number;
340
398
  }
399
+ /**
400
+ * ModifierFiredEvent reports one of the game's modifier events the mod
401
+ * watches, with the entities the game fired it with. Which of them an event
402
+ * fills depends on the event.
403
+ */
404
+ export interface ModifierFiredEvent {
405
+ /** name is the event as the mod named it in StartResult.modifier_events. */
406
+ readonly name: string;
407
+ /**
408
+ * caster is the entity the event is about, such as the hero that parried
409
+ * or respawned, or zero.
410
+ */
411
+ readonly caster: number;
412
+ /** player is the slot of the player whose hero the caster is, or -1. */
413
+ readonly player: Player;
414
+ /**
415
+ * target is the other entity of the event, such as the victim of a kill,
416
+ * or zero.
417
+ */
418
+ readonly target: number;
419
+ /**
420
+ * ability is the ability or other entity the event names as its source, or
421
+ * zero.
422
+ */
423
+ readonly ability: number;
424
+ }
341
425
  /**
342
426
  * SoundOptions shape one sound; the zero value plays it to every player as
343
427
  * the game made it.
@@ -1300,6 +1384,23 @@ export interface StartResult {
1300
1384
  * and a PlayerLeft event as each leaves.
1301
1385
  */
1302
1386
  joins: boolean;
1387
+ /**
1388
+ * casts asks for an AbilityCast event after each ability the game
1389
+ * executes.
1390
+ */
1391
+ casts: boolean;
1392
+ /**
1393
+ * modifierEvents asks for a ModifierFired event for each of the game's
1394
+ * modifier events with these EModifierEvent names, such as
1395
+ * MODIFIER_EVENT_ABILITY_CAST_STARTED or, without the prefix,
1396
+ * ABILITY_CAST_STARTED. A name the running game lacks is logged and never
1397
+ * fires.
1398
+ */
1399
+ modifierEvents?: readonly string[];
1400
+ /**
1401
+ * kills asks for a Killed event after each hit that kills a hero or unit.
1402
+ */
1403
+ kills: boolean;
1303
1404
  }
1304
1405
  /** FrameEvent identifies one server frame. */
1305
1406
  export interface FrameEvent {
@@ -2214,6 +2315,21 @@ export interface ModHandlers {
2214
2315
  * damage reports. Hits arrive before the next frame.
2215
2316
  */
2216
2317
  damaged(event: DamagedEvent): void;
2318
+ /**
2319
+ * killed reports one hero or unit a hit killed, while the mod asked for
2320
+ * kills, after the hit's Damaged event and before the next frame.
2321
+ */
2322
+ killed(event: KillEvent): void;
2323
+ /**
2324
+ * abilityCast reports one ability the game executed, while the mod asked
2325
+ * for casts, before the next frame.
2326
+ */
2327
+ abilityCast(event: AbilityCastEvent): void;
2328
+ /**
2329
+ * modifierFired reports one modifier event the mod watches, before the
2330
+ * next frame.
2331
+ */
2332
+ modifierFired(event: ModifierFiredEvent): void;
2217
2333
  /**
2218
2334
  * input reports one player's presses of watched buttons, before the next
2219
2335
  * frame. A block in place still withholds them from the hero.
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference path="./globals.d.ts" />
2
- import { type DamageEvent, type ChatEvent, type DamagedEvent, type DamageResult, type FrameEvent, type ImpactEvent, type LandedEvent, type LaunchEvent, type Pawn, Player, type PlayerJoinedEvent, type PlayerLeftEvent } from './host.gen.js';
2
+ import { type AbilityCastEvent, type KillEvent, type DamageEvent, type ChatEvent, type DamagedEvent, type DamageResult, type FrameEvent, type ImpactEvent, type LandedEvent, type LaunchEvent, type ModifierFiredEvent, type Pawn, Player, type PlayerJoinedEvent, type PlayerLeftEvent } from './host.gen.js';
3
3
  export * as vector from './vector.js';
4
4
  export { Buttons, Layers } from './bits.js';
5
5
  export { after, every, sequence, type Timer } from './timer.js';
@@ -159,6 +159,25 @@ export declare function onNpcsRestored(handler: (error: string | undefined) => v
159
159
  export declare function onDamage(handler: (hit: DamageEvent) => DamageResult | void): void;
160
160
  /** onDamaged calls handler on the frame after each hit lands. */
161
161
  export declare function onDamaged(handler: (hit: DamagedEvent) => void): void;
162
+ /**
163
+ * onKill calls handler after each hit that kills a hero or a unit, before the
164
+ * next frame. The kill names both entities and the player of each: a slot of
165
+ * -1 is a unit's, or a hazard's for the attacker.
166
+ */
167
+ export declare function onKill(handler: (kill: KillEvent) => void): void;
168
+ /**
169
+ * onAbilityCast calls handler after each ability the game executes, before
170
+ * the next frame: a hero's abilities and the items a player activates, at
171
+ * the moment the cast takes effect.
172
+ */
173
+ export declare function onAbilityCast(handler: (cast: AbilityCastEvent) => void): void;
174
+ /**
175
+ * onModifierEvent calls handler each time the game fires the modifier event
176
+ * with this EModifierEvent name, such as ABILITY_CAST_STARTED, PARRY_SUCCESS
177
+ * or PLAYER_RESPAWNED, before the next frame. Register before the mod starts.
178
+ * A name the running game lacks is logged once and never fires.
179
+ */
180
+ export declare function onModifierEvent(name: string, handler: (event: ModifierFiredEvent) => void): void;
162
181
  /**
163
182
  * onLaunch calls handler with each watched projectile's first frame, before
164
183
  * the next frame. watchProjectiles names the projectiles.
package/index.js CHANGED
@@ -2815,7 +2815,10 @@ var StartResult = /* @__PURE__ */ createMessageType(
2815
2815
  [2, "damage", 8],
2816
2816
  [3, "damaged", 8],
2817
2817
  [4, "chat", 8],
2818
- [5, "joins", 8]
2818
+ [5, "joins", 8],
2819
+ [6, "casts", 8],
2820
+ [7, "modifier_events", 9, 1],
2821
+ [8, "kills", 8]
2819
2822
  ],
2820
2823
  {
2821
2824
  decode: (r, end, m) => {
@@ -2838,6 +2841,16 @@ var StartResult = /* @__PURE__ */ createMessageType(
2838
2841
  case 5:
2839
2842
  m.joins = r.bool();
2840
2843
  break;
2844
+ case 6:
2845
+ m.casts = r.bool();
2846
+ break;
2847
+ case 7:
2848
+ ;
2849
+ (m.modifierEvents ??= []).push(r.string());
2850
+ break;
2851
+ case 8:
2852
+ m.kills = r.bool();
2853
+ break;
2841
2854
  default:
2842
2855
  r.skip(t);
2843
2856
  }
@@ -2865,6 +2878,18 @@ var StartResult = /* @__PURE__ */ createMessageType(
2865
2878
  const v = m.joins;
2866
2879
  if (v) w.uint32(40).bool(v);
2867
2880
  }
2881
+ {
2882
+ const v = m.casts;
2883
+ if (v) w.uint32(48).bool(v);
2884
+ }
2885
+ {
2886
+ const a = m.modifierEvents;
2887
+ if (a != null) for (const e of a) w.uint32(58).string(e);
2888
+ }
2889
+ {
2890
+ const v = m.kills;
2891
+ if (v) w.uint32(64).bool(v);
2892
+ }
2868
2893
  }
2869
2894
  }
2870
2895
  );
@@ -3532,7 +3557,8 @@ var AbilityOptions = /* @__PURE__ */ createMessageType(
3532
3557
  [4, "charges", 5, 4],
3533
3558
  [5, "cooldown_end", 2, 4],
3534
3559
  [6, "recharge_end", 2, 4],
3535
- [7, "max_charges", 5, 4]
3560
+ [7, "max_charges", 5, 4],
3561
+ [8, "cooldown", 2, 4]
3536
3562
  ],
3537
3563
  {
3538
3564
  decode: (r, end, m) => {
@@ -3561,6 +3587,9 @@ var AbilityOptions = /* @__PURE__ */ createMessageType(
3561
3587
  case 7:
3562
3588
  m.maxCharges = r.int32();
3563
3589
  break;
3590
+ case 8:
3591
+ m.cooldown = r.float();
3592
+ break;
3564
3593
  default:
3565
3594
  r.skip(t);
3566
3595
  }
@@ -3596,6 +3625,10 @@ var AbilityOptions = /* @__PURE__ */ createMessageType(
3596
3625
  const v = m.maxCharges;
3597
3626
  if (v != null) w.uint32(56).int32(v);
3598
3627
  }
3628
+ {
3629
+ const v = m.cooldown;
3630
+ if (v != null) w.uint32(69).float(v);
3631
+ }
3599
3632
  }
3600
3633
  }
3601
3634
  );
@@ -4328,6 +4361,74 @@ var GiveEntityModifierRequest = /* @__PURE__ */ createMessageType(
4328
4361
  }
4329
4362
  }
4330
4363
  );
4364
+ var AbilityCastEvent = /* @__PURE__ */ createMessageType(
4365
+ "modlock.wasm.abilities.AbilityCastEvent",
4366
+ () => [
4367
+ [1, "caster", 13],
4368
+ [2, "player", 5],
4369
+ [3, "ability", 13],
4370
+ [4, "name", 9],
4371
+ [5, "slot", 5],
4372
+ [6, "target", 13]
4373
+ ],
4374
+ {
4375
+ decode: (r, end, m) => {
4376
+ while (r.pos < end) {
4377
+ const t = r.tag();
4378
+ if ((t & 7) === 4) return m;
4379
+ switch (t >>> 3) {
4380
+ case 1:
4381
+ m.caster = r.uint32();
4382
+ break;
4383
+ case 2:
4384
+ m.player = r.int32();
4385
+ break;
4386
+ case 3:
4387
+ m.ability = r.uint32();
4388
+ break;
4389
+ case 4:
4390
+ m.name = r.string();
4391
+ break;
4392
+ case 5:
4393
+ m.slot = r.int32();
4394
+ break;
4395
+ case 6:
4396
+ m.target = r.uint32();
4397
+ break;
4398
+ default:
4399
+ r.skip(t);
4400
+ }
4401
+ }
4402
+ return m;
4403
+ },
4404
+ encode: (m, w) => {
4405
+ {
4406
+ const v = m.caster;
4407
+ if (v) w.uint32(8).uint32(v);
4408
+ }
4409
+ {
4410
+ const v = m.player;
4411
+ if (v) w.uint32(16).int32(v);
4412
+ }
4413
+ {
4414
+ const v = m.ability;
4415
+ if (v) w.uint32(24).uint32(v);
4416
+ }
4417
+ {
4418
+ const v = m.name;
4419
+ if (v) w.uint32(34).string(v);
4420
+ }
4421
+ {
4422
+ const v = m.slot;
4423
+ if (v) w.uint32(40).int32(v);
4424
+ }
4425
+ {
4426
+ const v = m.target;
4427
+ if (v) w.uint32(48).uint32(v);
4428
+ }
4429
+ }
4430
+ }
4431
+ );
4331
4432
 
4332
4433
  // src/wasm/combat/combat.pb.ts
4333
4434
  var DamageEvent = /* @__PURE__ */ createMessageType(
@@ -4510,6 +4611,66 @@ var DamagedEvent = /* @__PURE__ */ createMessageType(
4510
4611
  }
4511
4612
  }
4512
4613
  );
4614
+ var KillEvent = /* @__PURE__ */ createMessageType(
4615
+ "modlock.wasm.combat.KillEvent",
4616
+ () => [
4617
+ [1, "victim", 13],
4618
+ [2, "victim_player", 5],
4619
+ [3, "attacker", 13],
4620
+ [4, "attacker_player", 5],
4621
+ [5, "ability", 13]
4622
+ ],
4623
+ {
4624
+ decode: (r, end, m) => {
4625
+ while (r.pos < end) {
4626
+ const t = r.tag();
4627
+ if ((t & 7) === 4) return m;
4628
+ switch (t >>> 3) {
4629
+ case 1:
4630
+ m.victim = r.uint32();
4631
+ break;
4632
+ case 2:
4633
+ m.victimPlayer = r.int32();
4634
+ break;
4635
+ case 3:
4636
+ m.attacker = r.uint32();
4637
+ break;
4638
+ case 4:
4639
+ m.attackerPlayer = r.int32();
4640
+ break;
4641
+ case 5:
4642
+ m.ability = r.uint32();
4643
+ break;
4644
+ default:
4645
+ r.skip(t);
4646
+ }
4647
+ }
4648
+ return m;
4649
+ },
4650
+ encode: (m, w) => {
4651
+ {
4652
+ const v = m.victim;
4653
+ if (v) w.uint32(8).uint32(v);
4654
+ }
4655
+ {
4656
+ const v = m.victimPlayer;
4657
+ if (v) w.uint32(16).int32(v);
4658
+ }
4659
+ {
4660
+ const v = m.attacker;
4661
+ if (v) w.uint32(24).uint32(v);
4662
+ }
4663
+ {
4664
+ const v = m.attackerPlayer;
4665
+ if (v) w.uint32(32).int32(v);
4666
+ }
4667
+ {
4668
+ const v = m.ability;
4669
+ if (v) w.uint32(40).uint32(v);
4670
+ }
4671
+ }
4672
+ }
4673
+ );
4513
4674
  var LaunchEvent = /* @__PURE__ */ createMessageType(
4514
4675
  "modlock.wasm.combat.LaunchEvent",
4515
4676
  () => [
@@ -4954,6 +5115,66 @@ var TraceHit = /* @__PURE__ */ createMessageType(
4954
5115
  }
4955
5116
  }
4956
5117
  );
5118
+ var ModifierFiredEvent = /* @__PURE__ */ createMessageType(
5119
+ "modlock.wasm.combat.ModifierFiredEvent",
5120
+ () => [
5121
+ [1, "name", 9],
5122
+ [2, "caster", 13],
5123
+ [3, "player", 5],
5124
+ [4, "target", 13],
5125
+ [5, "ability", 13]
5126
+ ],
5127
+ {
5128
+ decode: (r, end, m) => {
5129
+ while (r.pos < end) {
5130
+ const t = r.tag();
5131
+ if ((t & 7) === 4) return m;
5132
+ switch (t >>> 3) {
5133
+ case 1:
5134
+ m.name = r.string();
5135
+ break;
5136
+ case 2:
5137
+ m.caster = r.uint32();
5138
+ break;
5139
+ case 3:
5140
+ m.player = r.int32();
5141
+ break;
5142
+ case 4:
5143
+ m.target = r.uint32();
5144
+ break;
5145
+ case 5:
5146
+ m.ability = r.uint32();
5147
+ break;
5148
+ default:
5149
+ r.skip(t);
5150
+ }
5151
+ }
5152
+ return m;
5153
+ },
5154
+ encode: (m, w) => {
5155
+ {
5156
+ const v = m.name;
5157
+ if (v) w.uint32(10).string(v);
5158
+ }
5159
+ {
5160
+ const v = m.caster;
5161
+ if (v) w.uint32(16).uint32(v);
5162
+ }
5163
+ {
5164
+ const v = m.player;
5165
+ if (v) w.uint32(24).int32(v);
5166
+ }
5167
+ {
5168
+ const v = m.target;
5169
+ if (v) w.uint32(32).uint32(v);
5170
+ }
5171
+ {
5172
+ const v = m.ability;
5173
+ if (v) w.uint32(40).uint32(v);
5174
+ }
5175
+ }
5176
+ }
5177
+ );
4957
5178
 
4958
5179
  // src/wasm/effects/effects.pb.ts
4959
5180
  var ScreenEffect_Enum = /* @__PURE__ */ createEnumType(
@@ -13252,7 +13473,8 @@ function toAbilityOptions(value) {
13252
13473
  charges: value.charges === void 0 ? void 0 : int32(value.charges),
13253
13474
  cooldownEnd: value.cooldownEnd,
13254
13475
  rechargeEnd: value.rechargeEnd,
13255
- maxCharges: value.maxCharges === void 0 ? void 0 : int32(value.maxCharges)
13476
+ maxCharges: value.maxCharges === void 0 ? void 0 : int32(value.maxCharges),
13477
+ cooldown: value.cooldown
13256
13478
  };
13257
13479
  }
13258
13480
  function fromModifier(message) {
@@ -13282,6 +13504,16 @@ function fromBuildItem(message) {
13282
13504
  annotation: message.annotation ?? ""
13283
13505
  };
13284
13506
  }
13507
+ function fromAbilityCastEvent(message) {
13508
+ return {
13509
+ caster: message.caster ?? 0,
13510
+ player: Player.of(message.player ?? 0),
13511
+ ability: message.ability ?? 0,
13512
+ name: message.name ?? "",
13513
+ slot: message.slot ?? 0,
13514
+ target: message.target ?? 0
13515
+ };
13516
+ }
13285
13517
  function fromDamageEvent(message) {
13286
13518
  return {
13287
13519
  victim: message.victim ?? 0,
@@ -13303,6 +13535,15 @@ function fromDamagedEvent(message) {
13303
13535
  dealt: message.dealt ?? 0
13304
13536
  };
13305
13537
  }
13538
+ function fromKillEvent(message) {
13539
+ return {
13540
+ victim: message.victim ?? 0,
13541
+ victimPlayer: Player.of(message.victimPlayer ?? 0),
13542
+ attacker: message.attacker ?? 0,
13543
+ attackerPlayer: Player.of(message.attackerPlayer ?? 0),
13544
+ ability: message.ability ?? 0
13545
+ };
13546
+ }
13306
13547
  function fromLaunchEvent(message) {
13307
13548
  return {
13308
13549
  entity: message.entity ?? 0,
@@ -13357,6 +13598,15 @@ function fromTraceHit(message) {
13357
13598
  entity: message.entity ?? 0
13358
13599
  };
13359
13600
  }
13601
+ function fromModifierFiredEvent(message) {
13602
+ return {
13603
+ name: message.name ?? "",
13604
+ caster: message.caster ?? 0,
13605
+ player: Player.of(message.player ?? 0),
13606
+ target: message.target ?? 0,
13607
+ ability: message.ability ?? 0
13608
+ };
13609
+ }
13360
13610
  function toSoundOptions(value) {
13361
13611
  return {
13362
13612
  volume: value.volume,
@@ -13765,6 +14015,18 @@ function fromStartEvent(message) {
13765
14015
  source: message.source ?? new Uint8Array()
13766
14016
  };
13767
14017
  }
14018
+ function toStartResult(value) {
14019
+ return {
14020
+ frames: value.frames,
14021
+ damage: value.damage,
14022
+ damaged: value.damaged,
14023
+ chat: value.chat,
14024
+ joins: value.joins,
14025
+ casts: value.casts,
14026
+ modifierEvents: value.modifierEvents?.slice(),
14027
+ kills: value.kills
14028
+ };
14029
+ }
13768
14030
  function fromFrameEvent(message) {
13769
14031
  return {
13770
14032
  tick: message.tick ?? 0n,
@@ -14672,7 +14934,7 @@ function serveMod(handlers2, bytes) {
14672
14934
  try {
14673
14935
  switch (request.method) {
14674
14936
  case "Start":
14675
- return reply(StartResult.toBinary(handlers2.start(fromStartEvent(StartEvent.fromBinary(input2)))));
14937
+ return reply(StartResult.toBinary(toStartResult(handlers2.start(fromStartEvent(StartEvent.fromBinary(input2))))));
14676
14938
  case "Frame":
14677
14939
  handlers2.frame(fromFrameEvent(FrameEvent.fromBinary(input2)));
14678
14940
  return reply();
@@ -14697,6 +14959,15 @@ function serveMod(handlers2, bytes) {
14697
14959
  case "Damaged":
14698
14960
  handlers2.damaged(fromDamagedEvent(DamagedEvent.fromBinary(input2)));
14699
14961
  return reply();
14962
+ case "Killed":
14963
+ handlers2.killed(fromKillEvent(KillEvent.fromBinary(input2)));
14964
+ return reply();
14965
+ case "AbilityCast":
14966
+ handlers2.abilityCast(fromAbilityCastEvent(AbilityCastEvent.fromBinary(input2)));
14967
+ return reply();
14968
+ case "ModifierFired":
14969
+ handlers2.modifierFired(fromModifierFiredEvent(ModifierFiredEvent.fromBinary(input2)));
14970
+ return reply();
14700
14971
  case "Input":
14701
14972
  handlers2.input(fromInputEvent(InputEvent.fromBinary(input2)));
14702
14973
  return reply();
@@ -19125,6 +19396,17 @@ function onDamage(handler) {
19125
19396
  function onDamaged(handler) {
19126
19397
  damageds.push(handler);
19127
19398
  }
19399
+ function onKill(handler) {
19400
+ kills.push(handler);
19401
+ }
19402
+ function onAbilityCast(handler) {
19403
+ abilityCasts.push(handler);
19404
+ }
19405
+ function onModifierEvent(name, handler) {
19406
+ const handlers2 = modifierEvents.get(name) ?? [];
19407
+ handlers2.push(handler);
19408
+ modifierEvents.set(name, handlers2);
19409
+ }
19128
19410
  function onLaunch(handler) {
19129
19411
  launches.push(handler);
19130
19412
  }
@@ -19159,6 +19441,9 @@ var restoreds = [];
19159
19441
  var npcsRestoreds = [];
19160
19442
  var damages = [];
19161
19443
  var damageds = [];
19444
+ var kills = [];
19445
+ var abilityCasts = [];
19446
+ var modifierEvents = /* @__PURE__ */ new Map();
19162
19447
  var launches = [];
19163
19448
  var impacts = [];
19164
19449
  var landeds = [];
@@ -19173,7 +19458,10 @@ var handlers = {
19173
19458
  damage: damages.length !== 0,
19174
19459
  damaged: damageds.length !== 0,
19175
19460
  chat: chats.length !== 0,
19176
- joins: joins.length !== 0 || leaves.length !== 0
19461
+ joins: joins.length !== 0 || leaves.length !== 0,
19462
+ casts: abilityCasts.length !== 0,
19463
+ kills: kills.length !== 0,
19464
+ modifierEvents: [...modifierEvents.keys()]
19177
19465
  };
19178
19466
  },
19179
19467
  frame(event) {
@@ -19241,6 +19529,21 @@ var handlers = {
19241
19529
  handler(event);
19242
19530
  }
19243
19531
  },
19532
+ killed(event) {
19533
+ for (const handler of kills) {
19534
+ handler(event);
19535
+ }
19536
+ },
19537
+ abilityCast(event) {
19538
+ for (const handler of abilityCasts) {
19539
+ handler(event);
19540
+ }
19541
+ },
19542
+ modifierFired(event) {
19543
+ for (const handler of modifierEvents.get(event.name) ?? []) {
19544
+ handler(event);
19545
+ }
19546
+ },
19244
19547
  input(event) {
19245
19548
  for (const handler of inputs) {
19246
19549
  handler(event.player, event.pressed, event.released);
@@ -19402,14 +19705,17 @@ export {
19402
19705
  modifiers,
19403
19706
  moveEntity,
19404
19707
  nextMatch,
19708
+ onAbilityCast,
19405
19709
  onChat,
19406
19710
  onDamage,
19407
19711
  onDamaged,
19408
19712
  onFrame,
19409
19713
  onImpact,
19410
19714
  onInput,
19715
+ onKill,
19411
19716
  onLanded,
19412
19717
  onLaunch,
19718
+ onModifierEvent,
19413
19719
  onNpcsRestored,
19414
19720
  onPlayerJoin,
19415
19721
  onPlayerLeave,
package/package.json CHANGED
@@ -7,11 +7,11 @@
7
7
  "license": "MIT",
8
8
  "name": "@modlock/modlock",
9
9
  "optionalDependencies": {
10
- "@modlock/darwin-arm64": "0.1.82",
11
- "@modlock/darwin-x64": "0.1.82",
12
- "@modlock/linux-arm64": "0.1.82",
13
- "@modlock/linux-x64": "0.1.82",
14
- "@modlock/win32-x64": "0.1.82"
10
+ "@modlock/darwin-arm64": "0.1.83",
11
+ "@modlock/darwin-x64": "0.1.83",
12
+ "@modlock/linux-arm64": "0.1.83",
13
+ "@modlock/linux-x64": "0.1.83",
14
+ "@modlock/win32-x64": "0.1.83"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
@@ -20,5 +20,5 @@
20
20
  "sideEffects": false,
21
21
  "type": "module",
22
22
  "types": "index.d.ts",
23
- "version": "0.1.82"
23
+ "version": "0.1.83"
24
24
  }