@modlock/modlock 0.1.77 → 0.1.78

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 (3) hide show
  1. package/host.gen.d.ts +14 -0
  2. package/index.js +96 -0
  3. package/package.json +6 -6
package/host.gen.d.ts CHANGED
@@ -2121,6 +2121,20 @@ export declare function stopSound(id: number): boolean;
2121
2121
  * call replaces the list; an empty list stops watching.
2122
2122
  */
2123
2123
  export declare function watchProjectiles(options: ProjectileOptions): boolean;
2124
+ /**
2125
+ * holdEntityModifier keeps a modifier, named as GiveModifier names it, on a
2126
+ * live entity with no expiry, giving it back whenever the game removes it
2127
+ * while the entity lives. The hold ends with the entity or when active is
2128
+ * false.
2129
+ */
2130
+ export declare function holdEntityModifier(entity: number, modifier: string, active?: boolean): boolean;
2131
+ /**
2132
+ * giveEntityModifier gives a live entity, such as Npc.entity or Pawn.entity,
2133
+ * a modifier for seconds. An ability's modifier, named
2134
+ * "<ability>/<modifier>", resolves its parent ability subclass even when the
2135
+ * entity owns no abilities.
2136
+ */
2137
+ export declare function giveEntityModifier(entity: number, modifier: string, seconds: number): boolean;
2124
2138
  /** ModHandlers handles the events the game delivers to the mod. */
2125
2139
  export interface ModHandlers {
2126
2140
  /** start begins the mod's active lifetime, once, before any other event. */
package/index.js CHANGED
@@ -4113,6 +4113,94 @@ var BuildItem = /* @__PURE__ */ createMessageType(
4113
4113
  }
4114
4114
  }
4115
4115
  );
4116
+ var HoldEntityModifierRequest = /* @__PURE__ */ createMessageType(
4117
+ "modlock.wasm.abilities.HoldEntityModifierRequest",
4118
+ () => [
4119
+ [1, "entity", 13],
4120
+ [2, "modifier", 9],
4121
+ [3, "active", 8, 4]
4122
+ ],
4123
+ {
4124
+ decode: (r, end, m) => {
4125
+ while (r.pos < end) {
4126
+ const t = r.tag();
4127
+ if ((t & 7) === 4) return m;
4128
+ switch (t >>> 3) {
4129
+ case 1:
4130
+ m.entity = r.uint32();
4131
+ break;
4132
+ case 2:
4133
+ m.modifier = r.string();
4134
+ break;
4135
+ case 3:
4136
+ m.active = r.bool();
4137
+ break;
4138
+ default:
4139
+ r.skip(t);
4140
+ }
4141
+ }
4142
+ return m;
4143
+ },
4144
+ encode: (m, w) => {
4145
+ {
4146
+ const v = m.entity;
4147
+ if (v) w.uint32(8).uint32(v);
4148
+ }
4149
+ {
4150
+ const v = m.modifier;
4151
+ if (v) w.uint32(18).string(v);
4152
+ }
4153
+ {
4154
+ const v = m.active;
4155
+ if (v != null) w.uint32(24).bool(v);
4156
+ }
4157
+ }
4158
+ }
4159
+ );
4160
+ var GiveEntityModifierRequest = /* @__PURE__ */ createMessageType(
4161
+ "modlock.wasm.abilities.GiveEntityModifierRequest",
4162
+ () => [
4163
+ [1, "entity", 13],
4164
+ [2, "modifier", 9],
4165
+ [3, "seconds", 2]
4166
+ ],
4167
+ {
4168
+ decode: (r, end, m) => {
4169
+ while (r.pos < end) {
4170
+ const t = r.tag();
4171
+ if ((t & 7) === 4) return m;
4172
+ switch (t >>> 3) {
4173
+ case 1:
4174
+ m.entity = r.uint32();
4175
+ break;
4176
+ case 2:
4177
+ m.modifier = r.string();
4178
+ break;
4179
+ case 3:
4180
+ m.seconds = r.float();
4181
+ break;
4182
+ default:
4183
+ r.skip(t);
4184
+ }
4185
+ }
4186
+ return m;
4187
+ },
4188
+ encode: (m, w) => {
4189
+ {
4190
+ const v = m.entity;
4191
+ if (v) w.uint32(8).uint32(v);
4192
+ }
4193
+ {
4194
+ const v = m.modifier;
4195
+ if (v) w.uint32(18).string(v);
4196
+ }
4197
+ {
4198
+ const v = m.seconds;
4199
+ if (v != null && v !== 0) w.uint32(29).float(v);
4200
+ }
4201
+ }
4202
+ }
4203
+ );
4116
4204
 
4117
4205
  // src/wasm/combat/combat.pb.ts
4118
4206
  var DamageEvent = /* @__PURE__ */ createMessageType(
@@ -14132,6 +14220,12 @@ function stopSound(id) {
14132
14220
  function watchProjectiles(options) {
14133
14221
  return call("WatchProjectiles", ProjectileOptions.toBinary(toProjectileOptions(options))) !== void 0;
14134
14222
  }
14223
+ function holdEntityModifier(entity, modifier, active) {
14224
+ return call("HoldEntityModifier", HoldEntityModifierRequest.toBinary({ entity, modifier, active })) !== void 0;
14225
+ }
14226
+ function giveEntityModifier(entity, modifier, seconds) {
14227
+ return call("GiveEntityModifier", GiveEntityModifierRequest.toBinary({ entity, modifier, seconds })) !== void 0;
14228
+ }
14135
14229
  function serveMod(handlers2, bytes) {
14136
14230
  const request = Call.fromBinary(bytes);
14137
14231
  const input2 = request.request ?? new Uint8Array();
@@ -19016,6 +19110,7 @@ export {
19016
19110
  frameClock,
19017
19111
  freeCursor,
19018
19112
  ghostStates,
19113
+ giveEntityModifier,
19019
19114
  ground,
19020
19115
  handedOff,
19021
19116
  handoff,
@@ -19024,6 +19119,7 @@ export {
19024
19119
  hide,
19025
19120
  hideHud,
19026
19121
  holdBystander,
19122
+ holdEntityModifier,
19027
19123
  holdMatchClock,
19028
19124
  holdModifierState,
19029
19125
  holdReload,
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.77",
11
- "@modlock/darwin-x64": "0.1.77",
12
- "@modlock/linux-arm64": "0.1.77",
13
- "@modlock/linux-x64": "0.1.77",
14
- "@modlock/win32-x64": "0.1.77"
10
+ "@modlock/darwin-arm64": "0.1.78",
11
+ "@modlock/darwin-x64": "0.1.78",
12
+ "@modlock/linux-arm64": "0.1.78",
13
+ "@modlock/linux-x64": "0.1.78",
14
+ "@modlock/win32-x64": "0.1.78"
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.77"
23
+ "version": "0.1.78"
24
24
  }