@modlock/modlock 0.1.76 → 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.
- package/host.gen.d.ts +71 -8
- package/index.d.ts +1 -0
- package/index.js +580 -45
- package/package.json +6 -6
- package/racegate.d.ts +33 -0
package/host.gen.d.ts
CHANGED
|
@@ -300,6 +300,21 @@ export interface TraceHit {
|
|
|
300
300
|
/** entity is the entity hit, or zero for the world. */
|
|
301
301
|
readonly entity: number;
|
|
302
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* SoundOptions shape one sound; the zero value plays it to every player as
|
|
305
|
+
* the game made it.
|
|
306
|
+
*/
|
|
307
|
+
export interface SoundOptions {
|
|
308
|
+
/** volume scales the sound's loudness; 1 plays it as the game made it. */
|
|
309
|
+
volume?: number;
|
|
310
|
+
/** pitch scales the sound's pitch; 1 plays it as the game made it. */
|
|
311
|
+
pitch?: number;
|
|
312
|
+
/**
|
|
313
|
+
* listeners are the player slots that hear the sound; empty means every
|
|
314
|
+
* player.
|
|
315
|
+
*/
|
|
316
|
+
listeners?: readonly number[];
|
|
317
|
+
}
|
|
303
318
|
/** ScreenTiming is a screen effect's timing in seconds. */
|
|
304
319
|
export interface ScreenTiming {
|
|
305
320
|
/** delay is the time before the effect starts. */
|
|
@@ -1606,9 +1621,10 @@ export declare class Player {
|
|
|
1606
1621
|
heal(amount: number): boolean;
|
|
1607
1622
|
/**
|
|
1608
1623
|
* sound plays a game sound event, such as Damage.Send.Crit, on the
|
|
1609
|
-
* player's hero.
|
|
1624
|
+
* player's hero, and returns its ID. It follows the hero as it moves.
|
|
1625
|
+
* Volume and pitch scale the sound, and listeners limit who hears it.
|
|
1610
1626
|
*/
|
|
1611
|
-
sound(sound: string):
|
|
1627
|
+
sound(sound: string, options?: SoundOptions): number | undefined;
|
|
1612
1628
|
/**
|
|
1613
1629
|
* restoreHero gives the player's live hero target over the next few
|
|
1614
1630
|
* seconds: the build first, then health, stamina and pose once it settles,
|
|
@@ -1628,6 +1644,11 @@ export declare class Player {
|
|
|
1628
1644
|
* view.
|
|
1629
1645
|
*/
|
|
1630
1646
|
clearScreenEffect(effect: ScreenEffect): boolean;
|
|
1647
|
+
/**
|
|
1648
|
+
* silenceVoice keeps the player's hero from speaking the named voice
|
|
1649
|
+
* concepts until called again, on top of those silenced for everyone.
|
|
1650
|
+
*/
|
|
1651
|
+
silenceVoice(concepts?: readonly string[]): boolean;
|
|
1631
1652
|
/** removeBot removes a bot the mod added. */
|
|
1632
1653
|
removeBot(): boolean;
|
|
1633
1654
|
/**
|
|
@@ -1798,6 +1819,13 @@ export declare function handedOff(): string | undefined;
|
|
|
1798
1819
|
* world.
|
|
1799
1820
|
*/
|
|
1800
1821
|
export declare function heroBuild(hero: string): BuildCategory[];
|
|
1822
|
+
/**
|
|
1823
|
+
* silenceVoice keeps every hero from speaking the named voice concepts,
|
|
1824
|
+
* until called again. A hero still hears the game's other sounds. Stopping
|
|
1825
|
+
* the mod lets them speak; a name the game does not know fails the call
|
|
1826
|
+
* and the known ones still apply.
|
|
1827
|
+
*/
|
|
1828
|
+
export declare function silenceVoice(concepts?: readonly string[]): boolean;
|
|
1801
1829
|
/**
|
|
1802
1830
|
* readField reads one schema field of a live entity, such as the int32
|
|
1803
1831
|
* m_iHealth of CBaseEntity. The host finds the field by name, so it
|
|
@@ -1831,7 +1859,9 @@ export declare function readModifierField(entity: number, modifier: string, clas
|
|
|
1831
1859
|
* entity's panel only when it creates the entity, so a write to
|
|
1832
1860
|
* m_DialogXMLName sends every client a full update on the next frame, which
|
|
1833
1861
|
* creates every entity again; the players' game stalls briefly, so write a
|
|
1834
|
-
* layout when it changes, not every frame.
|
|
1862
|
+
* layout when it changes, not every frame. It refuses the fields that
|
|
1863
|
+
* name a console line or a script, such as m_iszPrivateVScripts, here and
|
|
1864
|
+
* among the fields CreateEntity writes before spawn.
|
|
1835
1865
|
*/
|
|
1836
1866
|
export declare function writeField(entity: number, className: string, field: string, type: FieldType, value: FieldValue): boolean;
|
|
1837
1867
|
/**
|
|
@@ -1945,17 +1975,22 @@ export declare function remapInput(from: bigint, to: bigint, repeat?: boolean):
|
|
|
1945
1975
|
*/
|
|
1946
1976
|
export declare function callService(service: string, method: string, payload: Uint8Array): Uint8Array | undefined;
|
|
1947
1977
|
/**
|
|
1948
|
-
* createEntity creates
|
|
1978
|
+
* createEntity creates an entity the server knows by its designer name,
|
|
1949
1979
|
* such as npc_trooper_boss or prop_dynamic, with spawn key values and fields
|
|
1950
1980
|
* written before it spawns. The world removes it when the world ends;
|
|
1951
1981
|
* stopping the mod removes it too. It refuses an ability, item or weapon,
|
|
1952
|
-
* which only a hero holds: GiveItem and ReplaceAbility give one.
|
|
1982
|
+
* which only a hero holds: GiveItem and ReplaceAbility give one. It refuses
|
|
1983
|
+
* a class that runs console lines or loads scripts or entities past a mod's
|
|
1984
|
+
* checks, such as point_servercommand, and key values that name a console
|
|
1985
|
+
* line or a script, such as vscripts.
|
|
1953
1986
|
*/
|
|
1954
1987
|
export declare function createEntity(options: EntityOptions): number | undefined;
|
|
1955
1988
|
/**
|
|
1956
1989
|
* fireInput sends an input to a live entity, as a map's output would, such
|
|
1957
1990
|
* as Skin with the integer 1. The value must have the type the input reads.
|
|
1958
|
-
* It reports false once the entity is gone.
|
|
1991
|
+
* It reports false once the entity is gone. It refuses AddOutput and the
|
|
1992
|
+
* script inputs on every entity, and any input to an entity of a class
|
|
1993
|
+
* CreateEntity refuses.
|
|
1959
1994
|
*/
|
|
1960
1995
|
export declare function fireInput(entity: number, input: string, value?: EntityValue, activator?: number): boolean;
|
|
1961
1996
|
/**
|
|
@@ -2064,14 +2099,42 @@ export declare function moveEntity(entity: number, position?: Vector, facing?: A
|
|
|
2064
2099
|
* impulse that the simulation carries on.
|
|
2065
2100
|
*/
|
|
2066
2101
|
export declare function pushEntity(entity: number, velocity: Vector, spin?: Vector): boolean;
|
|
2067
|
-
/**
|
|
2068
|
-
|
|
2102
|
+
/**
|
|
2103
|
+
* emitSound plays one game sound on any entity, such as a projectile, and
|
|
2104
|
+
* returns its ID. Volume and pitch scale the sound, and listeners limit who
|
|
2105
|
+
* hears it.
|
|
2106
|
+
*/
|
|
2107
|
+
export declare function emitSound(entity: number, sound: string, options?: SoundOptions): number | undefined;
|
|
2108
|
+
/**
|
|
2109
|
+
* adjustSound changes the volume or pitch of a sound Sound or EmitSound
|
|
2110
|
+
* started, while it plays.
|
|
2111
|
+
*/
|
|
2112
|
+
export declare function adjustSound(id: number, volume?: number, pitch?: number): boolean;
|
|
2113
|
+
/**
|
|
2114
|
+
* stopSound stops a sound Sound or EmitSound started. A sound that already
|
|
2115
|
+
* ended is not an error.
|
|
2116
|
+
*/
|
|
2117
|
+
export declare function stopSound(id: number): boolean;
|
|
2069
2118
|
/**
|
|
2070
2119
|
* watchProjectiles reports the projectiles with these designer names, such
|
|
2071
2120
|
* as rocket_launcher_rocket_projectile, in Launch and Impact events. A new
|
|
2072
2121
|
* call replaces the list; an empty list stops watching.
|
|
2073
2122
|
*/
|
|
2074
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;
|
|
2075
2138
|
/** ModHandlers handles the events the game delivers to the mod. */
|
|
2076
2139
|
export interface ModHandlers {
|
|
2077
2140
|
/** start begins the mod's active lifetime, once, before any other event. */
|
package/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from './host.gen.js';
|
|
|
16
16
|
export { Cast, type CastOptions, type Want } from './cast.js';
|
|
17
17
|
export { frameClock } from './frameclock.js';
|
|
18
18
|
export { ground, type GroundOptions } from './ground.js';
|
|
19
|
+
export { RaceGate, type RaceGateOptions, raceGateResources, } from './racegate.js';
|
|
19
20
|
export { players } from './players.js';
|
|
20
21
|
export { afterMatch, fewestPlayed, leaderboard, leastUsed, nextMatch, ratingChange, ratingStep, settle, type Standing, Standings, startingRating, } from './rotation.js';
|
|
21
22
|
export { bystanderStates, holdBystander } from './bystander.js';
|
package/index.js
CHANGED
|
@@ -44,14 +44,14 @@ var BinaryWriter = class {
|
|
|
44
44
|
this.reserve(size);
|
|
45
45
|
this.buf.copyWithin(start + size, start, this.pos);
|
|
46
46
|
this.pos += size;
|
|
47
|
-
let
|
|
47
|
+
let at3 = start;
|
|
48
48
|
let rest = length3;
|
|
49
49
|
while (rest > 127) {
|
|
50
|
-
this.buf[
|
|
51
|
-
|
|
50
|
+
this.buf[at3] = rest & 127 | 128;
|
|
51
|
+
at3 += 1;
|
|
52
52
|
rest >>>= 7;
|
|
53
53
|
}
|
|
54
|
-
this.buf[
|
|
54
|
+
this.buf[at3] = rest;
|
|
55
55
|
return this;
|
|
56
56
|
}
|
|
57
57
|
/** Write a field's tag: its number and wire type. */
|
|
@@ -3274,37 +3274,37 @@ function encodeCall(method, request) {
|
|
|
3274
3274
|
prefix.length + 1 + varintSize(request.length) + request.length
|
|
3275
3275
|
);
|
|
3276
3276
|
out.set(prefix, 0);
|
|
3277
|
-
let
|
|
3278
|
-
out[
|
|
3277
|
+
let at3 = prefix.length;
|
|
3278
|
+
out[at3++] = 18;
|
|
3279
3279
|
let size = request.length;
|
|
3280
|
-
for (; size > 127; size >>>= 7) out[
|
|
3281
|
-
out[
|
|
3282
|
-
out.set(request,
|
|
3280
|
+
for (; size > 127; size >>>= 7) out[at3++] = size & 127 | 128;
|
|
3281
|
+
out[at3++] = size;
|
|
3282
|
+
out.set(request, at3);
|
|
3283
3283
|
return out;
|
|
3284
3284
|
}
|
|
3285
3285
|
var empty = new Uint8Array();
|
|
3286
3286
|
function decodeReply(reply2) {
|
|
3287
3287
|
let response = empty;
|
|
3288
|
-
let
|
|
3289
|
-
while (
|
|
3290
|
-
const tag = reply2[
|
|
3288
|
+
let at3 = 0;
|
|
3289
|
+
while (at3 < reply2.length) {
|
|
3290
|
+
const tag = reply2[at3++] ?? 255;
|
|
3291
3291
|
if (tag > 127) return fallbackReply(reply2);
|
|
3292
3292
|
let value = 0;
|
|
3293
3293
|
let shift = 0;
|
|
3294
3294
|
for (; ; ) {
|
|
3295
|
-
if (
|
|
3296
|
-
const b = reply2[
|
|
3295
|
+
if (at3 >= reply2.length || shift > 28) return fallbackReply(reply2);
|
|
3296
|
+
const b = reply2[at3++] ?? 0;
|
|
3297
3297
|
value += (b & 127) * 2 ** shift;
|
|
3298
3298
|
shift += 7;
|
|
3299
3299
|
if (b < 128) break;
|
|
3300
3300
|
}
|
|
3301
3301
|
const wire = tag & 7;
|
|
3302
3302
|
if (wire === 0) continue;
|
|
3303
|
-
if (wire !== 2 ||
|
|
3303
|
+
if (wire !== 2 || at3 + value > reply2.length) return fallbackReply(reply2);
|
|
3304
3304
|
const field = tag >>> 3;
|
|
3305
3305
|
if (field === 1 && value > 0) return void 0;
|
|
3306
|
-
if (field === 2) response = reply2.subarray(
|
|
3307
|
-
|
|
3306
|
+
if (field === 2) response = reply2.subarray(at3, at3 + value);
|
|
3307
|
+
at3 += value;
|
|
3308
3308
|
}
|
|
3309
3309
|
return response;
|
|
3310
3310
|
}
|
|
@@ -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(
|
|
@@ -4867,11 +4955,61 @@ var AnnounceRequest = /* @__PURE__ */ createMessageType(
|
|
|
4867
4955
|
}
|
|
4868
4956
|
}
|
|
4869
4957
|
);
|
|
4958
|
+
var SoundOptions = /* @__PURE__ */ createMessageType(
|
|
4959
|
+
"modlock.wasm.effects.SoundOptions",
|
|
4960
|
+
() => [
|
|
4961
|
+
[1, "volume", 2, 4],
|
|
4962
|
+
[2, "pitch", 2, 4],
|
|
4963
|
+
[3, "listeners", 5, 3]
|
|
4964
|
+
],
|
|
4965
|
+
{
|
|
4966
|
+
decode: (r, end, m) => {
|
|
4967
|
+
while (r.pos < end) {
|
|
4968
|
+
const t = r.tag();
|
|
4969
|
+
if ((t & 7) === 4) return m;
|
|
4970
|
+
switch (t >>> 3) {
|
|
4971
|
+
case 1:
|
|
4972
|
+
m.volume = r.float();
|
|
4973
|
+
break;
|
|
4974
|
+
case 2:
|
|
4975
|
+
m.pitch = r.float();
|
|
4976
|
+
break;
|
|
4977
|
+
case 3:
|
|
4978
|
+
for (const e = r.run(t), a = m.listeners ??= []; r.pos < e; )
|
|
4979
|
+
a.push(r.int32());
|
|
4980
|
+
break;
|
|
4981
|
+
default:
|
|
4982
|
+
r.skip(t);
|
|
4983
|
+
}
|
|
4984
|
+
}
|
|
4985
|
+
return m;
|
|
4986
|
+
},
|
|
4987
|
+
encode: (m, w) => {
|
|
4988
|
+
{
|
|
4989
|
+
const v = m.volume;
|
|
4990
|
+
if (v != null) w.uint32(13).float(v);
|
|
4991
|
+
}
|
|
4992
|
+
{
|
|
4993
|
+
const v = m.pitch;
|
|
4994
|
+
if (v != null) w.uint32(21).float(v);
|
|
4995
|
+
}
|
|
4996
|
+
{
|
|
4997
|
+
const a = m.listeners;
|
|
4998
|
+
if (a != null && a.length > 0) {
|
|
4999
|
+
const s = w.uint32(26).fork();
|
|
5000
|
+
for (const e of a) w.int32(e);
|
|
5001
|
+
w.join(s);
|
|
5002
|
+
}
|
|
5003
|
+
}
|
|
5004
|
+
}
|
|
5005
|
+
}
|
|
5006
|
+
);
|
|
4870
5007
|
var SoundRequest = /* @__PURE__ */ createMessageType(
|
|
4871
5008
|
"modlock.wasm.effects.SoundRequest",
|
|
4872
5009
|
() => [
|
|
4873
5010
|
[1, "player", 5],
|
|
4874
|
-
[2, "sound", 9]
|
|
5011
|
+
[2, "sound", 9],
|
|
5012
|
+
[3, "options", 11, 0, SoundOptions.codec]
|
|
4875
5013
|
],
|
|
4876
5014
|
{
|
|
4877
5015
|
decode: (r, end, m) => {
|
|
@@ -4885,6 +5023,9 @@ var SoundRequest = /* @__PURE__ */ createMessageType(
|
|
|
4885
5023
|
case 2:
|
|
4886
5024
|
m.sound = r.string();
|
|
4887
5025
|
break;
|
|
5026
|
+
case 3:
|
|
5027
|
+
m.options = SoundOptions.decode(r, r.delimited(), m.options ?? {});
|
|
5028
|
+
break;
|
|
4888
5029
|
default:
|
|
4889
5030
|
r.skip(t);
|
|
4890
5031
|
}
|
|
@@ -4900,6 +5041,10 @@ var SoundRequest = /* @__PURE__ */ createMessageType(
|
|
|
4900
5041
|
const v = m.sound;
|
|
4901
5042
|
if (v) w.uint32(18).string(v);
|
|
4902
5043
|
}
|
|
5044
|
+
{
|
|
5045
|
+
const v = m.options;
|
|
5046
|
+
if (v != null) SoundOptions.writeField(w, 3, v);
|
|
5047
|
+
}
|
|
4903
5048
|
}
|
|
4904
5049
|
}
|
|
4905
5050
|
);
|
|
@@ -4907,7 +5052,8 @@ var EmitSoundRequest = /* @__PURE__ */ createMessageType(
|
|
|
4907
5052
|
"modlock.wasm.effects.EmitSoundRequest",
|
|
4908
5053
|
() => [
|
|
4909
5054
|
[1, "entity", 13],
|
|
4910
|
-
[2, "sound", 9]
|
|
5055
|
+
[2, "sound", 9],
|
|
5056
|
+
[3, "options", 11, 0, SoundOptions.codec]
|
|
4911
5057
|
],
|
|
4912
5058
|
{
|
|
4913
5059
|
decode: (r, end, m) => {
|
|
@@ -4921,6 +5067,9 @@ var EmitSoundRequest = /* @__PURE__ */ createMessageType(
|
|
|
4921
5067
|
case 2:
|
|
4922
5068
|
m.sound = r.string();
|
|
4923
5069
|
break;
|
|
5070
|
+
case 3:
|
|
5071
|
+
m.options = SoundOptions.decode(r, r.delimited(), m.options ?? {});
|
|
5072
|
+
break;
|
|
4924
5073
|
default:
|
|
4925
5074
|
r.skip(t);
|
|
4926
5075
|
}
|
|
@@ -4936,6 +5085,106 @@ var EmitSoundRequest = /* @__PURE__ */ createMessageType(
|
|
|
4936
5085
|
const v = m.sound;
|
|
4937
5086
|
if (v) w.uint32(18).string(v);
|
|
4938
5087
|
}
|
|
5088
|
+
{
|
|
5089
|
+
const v = m.options;
|
|
5090
|
+
if (v != null) SoundOptions.writeField(w, 3, v);
|
|
5091
|
+
}
|
|
5092
|
+
}
|
|
5093
|
+
}
|
|
5094
|
+
);
|
|
5095
|
+
var SoundResponse = /* @__PURE__ */ createMessageType(
|
|
5096
|
+
"modlock.wasm.effects.SoundResponse",
|
|
5097
|
+
() => [[1, "id", 13]],
|
|
5098
|
+
{
|
|
5099
|
+
decode: (r, end, m) => {
|
|
5100
|
+
while (r.pos < end) {
|
|
5101
|
+
const t = r.tag();
|
|
5102
|
+
if ((t & 7) === 4) return m;
|
|
5103
|
+
switch (t >>> 3) {
|
|
5104
|
+
case 1:
|
|
5105
|
+
m.id = r.uint32();
|
|
5106
|
+
break;
|
|
5107
|
+
default:
|
|
5108
|
+
r.skip(t);
|
|
5109
|
+
}
|
|
5110
|
+
}
|
|
5111
|
+
return m;
|
|
5112
|
+
},
|
|
5113
|
+
encode: (m, w) => {
|
|
5114
|
+
{
|
|
5115
|
+
const v = m.id;
|
|
5116
|
+
if (v) w.uint32(8).uint32(v);
|
|
5117
|
+
}
|
|
5118
|
+
}
|
|
5119
|
+
}
|
|
5120
|
+
);
|
|
5121
|
+
var AdjustSoundRequest = /* @__PURE__ */ createMessageType(
|
|
5122
|
+
"modlock.wasm.effects.AdjustSoundRequest",
|
|
5123
|
+
() => [
|
|
5124
|
+
[1, "id", 13],
|
|
5125
|
+
[2, "volume", 2, 4],
|
|
5126
|
+
[3, "pitch", 2, 4]
|
|
5127
|
+
],
|
|
5128
|
+
{
|
|
5129
|
+
decode: (r, end, m) => {
|
|
5130
|
+
while (r.pos < end) {
|
|
5131
|
+
const t = r.tag();
|
|
5132
|
+
if ((t & 7) === 4) return m;
|
|
5133
|
+
switch (t >>> 3) {
|
|
5134
|
+
case 1:
|
|
5135
|
+
m.id = r.uint32();
|
|
5136
|
+
break;
|
|
5137
|
+
case 2:
|
|
5138
|
+
m.volume = r.float();
|
|
5139
|
+
break;
|
|
5140
|
+
case 3:
|
|
5141
|
+
m.pitch = r.float();
|
|
5142
|
+
break;
|
|
5143
|
+
default:
|
|
5144
|
+
r.skip(t);
|
|
5145
|
+
}
|
|
5146
|
+
}
|
|
5147
|
+
return m;
|
|
5148
|
+
},
|
|
5149
|
+
encode: (m, w) => {
|
|
5150
|
+
{
|
|
5151
|
+
const v = m.id;
|
|
5152
|
+
if (v) w.uint32(8).uint32(v);
|
|
5153
|
+
}
|
|
5154
|
+
{
|
|
5155
|
+
const v = m.volume;
|
|
5156
|
+
if (v != null) w.uint32(21).float(v);
|
|
5157
|
+
}
|
|
5158
|
+
{
|
|
5159
|
+
const v = m.pitch;
|
|
5160
|
+
if (v != null) w.uint32(29).float(v);
|
|
5161
|
+
}
|
|
5162
|
+
}
|
|
5163
|
+
}
|
|
5164
|
+
);
|
|
5165
|
+
var StopSoundRequest = /* @__PURE__ */ createMessageType(
|
|
5166
|
+
"modlock.wasm.effects.StopSoundRequest",
|
|
5167
|
+
() => [[1, "id", 13]],
|
|
5168
|
+
{
|
|
5169
|
+
decode: (r, end, m) => {
|
|
5170
|
+
while (r.pos < end) {
|
|
5171
|
+
const t = r.tag();
|
|
5172
|
+
if ((t & 7) === 4) return m;
|
|
5173
|
+
switch (t >>> 3) {
|
|
5174
|
+
case 1:
|
|
5175
|
+
m.id = r.uint32();
|
|
5176
|
+
break;
|
|
5177
|
+
default:
|
|
5178
|
+
r.skip(t);
|
|
5179
|
+
}
|
|
5180
|
+
}
|
|
5181
|
+
return m;
|
|
5182
|
+
},
|
|
5183
|
+
encode: (m, w) => {
|
|
5184
|
+
{
|
|
5185
|
+
const v = m.id;
|
|
5186
|
+
if (v) w.uint32(8).uint32(v);
|
|
5187
|
+
}
|
|
4939
5188
|
}
|
|
4940
5189
|
}
|
|
4941
5190
|
);
|
|
@@ -5071,6 +5320,70 @@ var ClearScreenEffectRequest = /* @__PURE__ */ createMessageType(
|
|
|
5071
5320
|
}
|
|
5072
5321
|
}
|
|
5073
5322
|
);
|
|
5323
|
+
var SilenceVoiceRequest = /* @__PURE__ */ createMessageType(
|
|
5324
|
+
"modlock.wasm.effects.SilenceVoiceRequest",
|
|
5325
|
+
() => [[1, "concepts", 9, 1]],
|
|
5326
|
+
{
|
|
5327
|
+
decode: (r, end, m) => {
|
|
5328
|
+
while (r.pos < end) {
|
|
5329
|
+
const t = r.tag();
|
|
5330
|
+
if ((t & 7) === 4) return m;
|
|
5331
|
+
switch (t >>> 3) {
|
|
5332
|
+
case 1:
|
|
5333
|
+
;
|
|
5334
|
+
(m.concepts ??= []).push(r.string());
|
|
5335
|
+
break;
|
|
5336
|
+
default:
|
|
5337
|
+
r.skip(t);
|
|
5338
|
+
}
|
|
5339
|
+
}
|
|
5340
|
+
return m;
|
|
5341
|
+
},
|
|
5342
|
+
encode: (m, w) => {
|
|
5343
|
+
{
|
|
5344
|
+
const a = m.concepts;
|
|
5345
|
+
if (a != null) for (const e of a) w.uint32(10).string(e);
|
|
5346
|
+
}
|
|
5347
|
+
}
|
|
5348
|
+
}
|
|
5349
|
+
);
|
|
5350
|
+
var SilencePlayerVoiceRequest = /* @__PURE__ */ createMessageType(
|
|
5351
|
+
"modlock.wasm.effects.SilencePlayerVoiceRequest",
|
|
5352
|
+
() => [
|
|
5353
|
+
[1, "player", 5],
|
|
5354
|
+
[2, "concepts", 9, 1]
|
|
5355
|
+
],
|
|
5356
|
+
{
|
|
5357
|
+
decode: (r, end, m) => {
|
|
5358
|
+
while (r.pos < end) {
|
|
5359
|
+
const t = r.tag();
|
|
5360
|
+
if ((t & 7) === 4) return m;
|
|
5361
|
+
switch (t >>> 3) {
|
|
5362
|
+
case 1:
|
|
5363
|
+
m.player = r.int32();
|
|
5364
|
+
break;
|
|
5365
|
+
case 2:
|
|
5366
|
+
;
|
|
5367
|
+
(m.concepts ??= []).push(r.string());
|
|
5368
|
+
break;
|
|
5369
|
+
default:
|
|
5370
|
+
r.skip(t);
|
|
5371
|
+
}
|
|
5372
|
+
}
|
|
5373
|
+
return m;
|
|
5374
|
+
},
|
|
5375
|
+
encode: (m, w) => {
|
|
5376
|
+
{
|
|
5377
|
+
const v = m.player;
|
|
5378
|
+
if (v) w.uint32(8).int32(v);
|
|
5379
|
+
}
|
|
5380
|
+
{
|
|
5381
|
+
const a = m.concepts;
|
|
5382
|
+
if (a != null) for (const e of a) w.uint32(18).string(e);
|
|
5383
|
+
}
|
|
5384
|
+
}
|
|
5385
|
+
}
|
|
5386
|
+
);
|
|
5074
5387
|
|
|
5075
5388
|
// src/wasm/fields/fields.pb.ts
|
|
5076
5389
|
var FieldType_Enum = /* @__PURE__ */ createEnumType(
|
|
@@ -12610,6 +12923,13 @@ function fromTraceHit(message) {
|
|
|
12610
12923
|
entity: message.entity ?? 0
|
|
12611
12924
|
};
|
|
12612
12925
|
}
|
|
12926
|
+
function toSoundOptions(value) {
|
|
12927
|
+
return {
|
|
12928
|
+
volume: value.volume,
|
|
12929
|
+
pitch: value.pitch,
|
|
12930
|
+
listeners: value.listeners?.map((v) => int32(v))
|
|
12931
|
+
};
|
|
12932
|
+
}
|
|
12613
12933
|
function toFieldValue(value) {
|
|
12614
12934
|
return { value: typeof value === "boolean" ? { case: "boolean", value } : typeof value === "number" ? { case: "number", value } : typeof value === "bigint" ? { case: "integer", value } : typeof value === "string" ? { case: "text", value } : typeof value === "object" ? { case: "vector", value } : void 0 };
|
|
12615
12935
|
}
|
|
@@ -13426,10 +13746,14 @@ var Player = class _Player {
|
|
|
13426
13746
|
}
|
|
13427
13747
|
/**
|
|
13428
13748
|
* sound plays a game sound event, such as Damage.Send.Crit, on the
|
|
13429
|
-
* player's hero.
|
|
13749
|
+
* player's hero, and returns its ID. It follows the hero as it moves.
|
|
13750
|
+
* Volume and pitch scale the sound, and listeners limit who hears it.
|
|
13430
13751
|
*/
|
|
13431
|
-
sound(sound) {
|
|
13432
|
-
|
|
13752
|
+
sound(sound, options) {
|
|
13753
|
+
const reply2 = call("Sound", SoundRequest.toBinary({ player: this.slot, sound, options: options === void 0 ? void 0 : toSoundOptions(options) }));
|
|
13754
|
+
if (reply2 === void 0) return void 0;
|
|
13755
|
+
const response = SoundResponse.fromBinary(reply2);
|
|
13756
|
+
return response.id ?? 0;
|
|
13433
13757
|
}
|
|
13434
13758
|
/**
|
|
13435
13759
|
* restoreHero gives the player's live hero target over the next few
|
|
@@ -13456,6 +13780,13 @@ var Player = class _Player {
|
|
|
13456
13780
|
clearScreenEffect(effect) {
|
|
13457
13781
|
return call("ClearScreenEffect", ClearScreenEffectRequest.toBinary({ player: this.slot, effect: screenEffectValues[effect] })) !== void 0;
|
|
13458
13782
|
}
|
|
13783
|
+
/**
|
|
13784
|
+
* silenceVoice keeps the player's hero from speaking the named voice
|
|
13785
|
+
* concepts until called again, on top of those silenced for everyone.
|
|
13786
|
+
*/
|
|
13787
|
+
silenceVoice(concepts) {
|
|
13788
|
+
return call("SilencePlayerVoice", SilencePlayerVoiceRequest.toBinary({ player: this.slot, concepts: concepts?.slice() })) !== void 0;
|
|
13789
|
+
}
|
|
13459
13790
|
/** removeBot removes a bot the mod added. */
|
|
13460
13791
|
removeBot() {
|
|
13461
13792
|
return call("RemoveBot", PlayerRequest.toBinary({ player: this.slot })) !== void 0;
|
|
@@ -13670,6 +14001,9 @@ function heroBuild(hero) {
|
|
|
13670
14001
|
const response = HeroBuildResponse.fromBinary(reply2);
|
|
13671
14002
|
return (response.categories ?? []).map((v) => fromBuildCategory(v));
|
|
13672
14003
|
}
|
|
14004
|
+
function silenceVoice(concepts) {
|
|
14005
|
+
return call("SilenceVoice", SilenceVoiceRequest.toBinary({ concepts: concepts?.slice() })) !== void 0;
|
|
14006
|
+
}
|
|
13673
14007
|
function readField(entity, className, field, type) {
|
|
13674
14008
|
const reply2 = call("ReadField", ReadFieldRequest.toBinary({ entity, className, field, type: fieldTypeValues[type] }));
|
|
13675
14009
|
if (reply2 === void 0) return void 0;
|
|
@@ -13871,12 +14205,27 @@ function moveEntity(entity, position, facing, velocity) {
|
|
|
13871
14205
|
function pushEntity(entity, velocity, spin) {
|
|
13872
14206
|
return call("PushEntity", PushEntityRequest.toBinary({ entity, velocity, spin })) !== void 0;
|
|
13873
14207
|
}
|
|
13874
|
-
function emitSound(entity, sound) {
|
|
13875
|
-
|
|
14208
|
+
function emitSound(entity, sound, options) {
|
|
14209
|
+
const reply2 = call("EmitSound", EmitSoundRequest.toBinary({ entity, sound, options: options === void 0 ? void 0 : toSoundOptions(options) }));
|
|
14210
|
+
if (reply2 === void 0) return void 0;
|
|
14211
|
+
const response = SoundResponse.fromBinary(reply2);
|
|
14212
|
+
return response.id ?? 0;
|
|
14213
|
+
}
|
|
14214
|
+
function adjustSound(id, volume, pitch) {
|
|
14215
|
+
return call("AdjustSound", AdjustSoundRequest.toBinary({ id, volume, pitch })) !== void 0;
|
|
14216
|
+
}
|
|
14217
|
+
function stopSound(id) {
|
|
14218
|
+
return call("StopSound", StopSoundRequest.toBinary({ id })) !== void 0;
|
|
13876
14219
|
}
|
|
13877
14220
|
function watchProjectiles(options) {
|
|
13878
14221
|
return call("WatchProjectiles", ProjectileOptions.toBinary(toProjectileOptions(options))) !== void 0;
|
|
13879
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
|
+
}
|
|
13880
14229
|
function serveMod(handlers2, bytes) {
|
|
13881
14230
|
const request = Call.fromBinary(bytes);
|
|
13882
14231
|
const input2 = request.request ?? new Uint8Array();
|
|
@@ -14007,10 +14356,10 @@ function lerpAngle(a, b, t) {
|
|
|
14007
14356
|
function poseAt(track, tick2) {
|
|
14008
14357
|
const last = track.x.length - 1;
|
|
14009
14358
|
if (last < 0) return void 0;
|
|
14010
|
-
const
|
|
14011
|
-
const i = Math.min(Math.floor(
|
|
14359
|
+
const at3 = Math.min(Math.max(tick2 / track.stepTicks, 0), last);
|
|
14360
|
+
const i = Math.min(Math.floor(at3), Math.max(last - 1, 0));
|
|
14012
14361
|
const j = Math.min(i + 1, last);
|
|
14013
|
-
const t =
|
|
14362
|
+
const t = at3 - i;
|
|
14014
14363
|
const seconds = track.stepTicks / ticksPerSecond;
|
|
14015
14364
|
const blend = (column) => lerp(sample(column, i), sample(column, j), t);
|
|
14016
14365
|
const slope = (column) => (sample(column, j) - sample(column, i)) / seconds;
|
|
@@ -14191,12 +14540,12 @@ var Puppet = class _Puppet {
|
|
|
14191
14540
|
const pose = poseAt(this.track, this.tickAt);
|
|
14192
14541
|
if (!pawn || !pose) return;
|
|
14193
14542
|
this.syncLook(pawn.entity);
|
|
14194
|
-
const
|
|
14543
|
+
const gap2 = Math.hypot(
|
|
14195
14544
|
pose.position.x - pawn.position.x,
|
|
14196
14545
|
pose.position.y - pawn.position.y,
|
|
14197
14546
|
pose.position.z - pawn.position.z
|
|
14198
14547
|
);
|
|
14199
|
-
const placed =
|
|
14548
|
+
const placed = gap2 > this.snapUnits || this.current !== "playing" ? this.player.teleport(pose.position, pose.facing) : this.player.move(pose.position, pose.facing, pose.velocity);
|
|
14200
14549
|
if (placed) this.drawn = true;
|
|
14201
14550
|
this.setHealth(pawn.entity, pose.health);
|
|
14202
14551
|
}
|
|
@@ -14341,7 +14690,7 @@ function advance(seconds) {
|
|
|
14341
14690
|
function itemId(name) {
|
|
14342
14691
|
const m = 1540483477;
|
|
14343
14692
|
const data = new TextEncoder().encode(name);
|
|
14344
|
-
const byte = (
|
|
14693
|
+
const byte = (at3) => data[at3] ?? 0;
|
|
14345
14694
|
let h = (826366246 ^ data.length) >>> 0;
|
|
14346
14695
|
let i = 0;
|
|
14347
14696
|
for (; data.length - i >= 4; i += 4) {
|
|
@@ -14950,7 +15299,7 @@ var Layout = class {
|
|
|
14950
15299
|
return found;
|
|
14951
15300
|
}
|
|
14952
15301
|
};
|
|
14953
|
-
function place(layout, child,
|
|
15302
|
+
function place(layout, child, at3) {
|
|
14954
15303
|
if (child === null || child === void 0 || typeof child === "boolean") {
|
|
14955
15304
|
return [];
|
|
14956
15305
|
}
|
|
@@ -14960,13 +15309,13 @@ function place(layout, child, at2) {
|
|
|
14960
15309
|
return place(
|
|
14961
15310
|
layout,
|
|
14962
15311
|
item2,
|
|
14963
|
-
key === void 0 ? `${
|
|
15312
|
+
key === void 0 ? `${at3},${index}` : `${at3},=${key}`
|
|
14964
15313
|
);
|
|
14965
15314
|
});
|
|
14966
15315
|
}
|
|
14967
15316
|
if (!isElement(child)) {
|
|
14968
15317
|
const node2 = {
|
|
14969
|
-
id: layout.id(
|
|
15318
|
+
id: layout.id(at3),
|
|
14970
15319
|
kind: 1 /* LABEL */,
|
|
14971
15320
|
text: String(child)
|
|
14972
15321
|
};
|
|
@@ -14974,11 +15323,11 @@ function place(layout, child, at2) {
|
|
|
14974
15323
|
return [node2.id];
|
|
14975
15324
|
}
|
|
14976
15325
|
if (child.type === fragment) {
|
|
14977
|
-
return place(layout, child.props.children, `${
|
|
15326
|
+
return place(layout, child.props.children, `${at3}>`);
|
|
14978
15327
|
}
|
|
14979
15328
|
const props = child.props;
|
|
14980
15329
|
const node = {
|
|
14981
|
-
id: layout.id(
|
|
15330
|
+
id: layout.id(at3),
|
|
14982
15331
|
style: wireStyle(props.style),
|
|
14983
15332
|
hover: wireStyle(props.hover),
|
|
14984
15333
|
tooltip: props.tooltip,
|
|
@@ -15026,7 +15375,7 @@ function place(layout, child, at2) {
|
|
|
15026
15375
|
if (props.onPress && !props.disabled) {
|
|
15027
15376
|
layout.screen.presses.set(node.id, { handler: props.onPress });
|
|
15028
15377
|
}
|
|
15029
|
-
node.children = place(layout, props.children, `${
|
|
15378
|
+
node.children = place(layout, props.children, `${at3}/`);
|
|
15030
15379
|
break;
|
|
15031
15380
|
case "layout":
|
|
15032
15381
|
node.kind = 4 /* LAYOUT */;
|
|
@@ -15035,7 +15384,7 @@ function place(layout, child, at2) {
|
|
|
15035
15384
|
break;
|
|
15036
15385
|
default:
|
|
15037
15386
|
node.kind = 0 /* PANEL */;
|
|
15038
|
-
node.children = place(layout, props.children, `${
|
|
15387
|
+
node.children = place(layout, props.children, `${at3}/`);
|
|
15039
15388
|
}
|
|
15040
15389
|
layout.add(node);
|
|
15041
15390
|
return [node.id];
|
|
@@ -15558,8 +15907,8 @@ var ease = {
|
|
|
15558
15907
|
return k * (t - 2.625 / 2.75) ** 2 + 0.984375;
|
|
15559
15908
|
})
|
|
15560
15909
|
};
|
|
15561
|
-
function shaped(
|
|
15562
|
-
return { at:
|
|
15910
|
+
function shaped(at3, lerp3) {
|
|
15911
|
+
return { at: at3, lerp: lerp3 };
|
|
15563
15912
|
}
|
|
15564
15913
|
function line(from, to, duration, shape = ease.linear) {
|
|
15565
15914
|
return [{ duration, lerp: shape.lerp, at: (u) => mix(from, to, shape.at(u)) }];
|
|
@@ -15590,12 +15939,12 @@ function keyframes(keys, options = {}) {
|
|
|
15590
15939
|
return spans;
|
|
15591
15940
|
}
|
|
15592
15941
|
function through(points, options) {
|
|
15593
|
-
let
|
|
15942
|
+
let at3 = 0;
|
|
15594
15943
|
let last = points[0];
|
|
15595
15944
|
const keys = points.map((value) => {
|
|
15596
|
-
if (last !== void 0)
|
|
15945
|
+
if (last !== void 0) at3 += distance2(last, value) / options.speed;
|
|
15597
15946
|
last = value;
|
|
15598
|
-
return { at:
|
|
15947
|
+
return { at: at3, value, ease: options.ease };
|
|
15599
15948
|
});
|
|
15600
15949
|
return keyframes(keys, options);
|
|
15601
15950
|
}
|
|
@@ -16329,7 +16678,7 @@ function Banner(props) {
|
|
|
16329
16678
|
return arriving(banner, { scale: 0.92 });
|
|
16330
16679
|
}
|
|
16331
16680
|
function TopStrip(props) {
|
|
16332
|
-
const
|
|
16681
|
+
const block2 = [
|
|
16333
16682
|
props.heading && Text({
|
|
16334
16683
|
role: "label",
|
|
16335
16684
|
style: { letterSpacing: 1 },
|
|
@@ -16348,9 +16697,9 @@ function TopStrip(props) {
|
|
|
16348
16697
|
{ flow: "down", horizontalAlign: "center", margin: [top, 0, 0, 0] },
|
|
16349
16698
|
children
|
|
16350
16699
|
);
|
|
16351
|
-
if (!props.keepTeamBar) return column(14, [...
|
|
16700
|
+
if (!props.keepTeamBar) return column(14, [...block2, line2]);
|
|
16352
16701
|
return element("panel", { width: "fill", height: "fill" }, [
|
|
16353
|
-
column(teamBarBottom,
|
|
16702
|
+
column(teamBarBottom, block2),
|
|
16354
16703
|
line2 && column(objectiveBarBottom, line2)
|
|
16355
16704
|
]);
|
|
16356
16705
|
}
|
|
@@ -16827,6 +17176,185 @@ function ground(point, {
|
|
|
16827
17176
|
return hit && !hit.startSolid ? hit.position : void 0;
|
|
16828
17177
|
}
|
|
16829
17178
|
|
|
17179
|
+
// js/src/racegate.ts
|
|
17180
|
+
var cell = 8;
|
|
17181
|
+
var margin = 3;
|
|
17182
|
+
var block = "\u25A0";
|
|
17183
|
+
var gap = "\u3000";
|
|
17184
|
+
var blockScale = 4.05;
|
|
17185
|
+
var inkSpread = 0.6;
|
|
17186
|
+
var inkDepth = 0.15;
|
|
17187
|
+
var columnRise = 1.75;
|
|
17188
|
+
var rowAcross = -1.2;
|
|
17189
|
+
var rowRise = 0.5;
|
|
17190
|
+
var frameWidth = 2;
|
|
17191
|
+
var railInset = 8;
|
|
17192
|
+
var railAlpha = 96;
|
|
17193
|
+
var tron = 1056243711;
|
|
17194
|
+
var tronFaded = 342915839;
|
|
17195
|
+
var anchorParticle = "particles/generic/null.vpcf";
|
|
17196
|
+
var beamMaterial = "materials/physics/wireframe_basic.vmat";
|
|
17197
|
+
var raceGateResources = [anchorParticle, beamMaterial];
|
|
17198
|
+
var nextPoint = 0;
|
|
17199
|
+
var RaceGate = class _RaceGate {
|
|
17200
|
+
constructor(objects, entities) {
|
|
17201
|
+
this.objects = objects;
|
|
17202
|
+
this.entities = entities;
|
|
17203
|
+
}
|
|
17204
|
+
objects;
|
|
17205
|
+
entities;
|
|
17206
|
+
/**
|
|
17207
|
+
* stand stands a gate across yaw at foot. A part the world refuses is left
|
|
17208
|
+
* out, so the gate stands whatever the world made.
|
|
17209
|
+
*/
|
|
17210
|
+
static stand(options) {
|
|
17211
|
+
const radians = options.yaw * Math.PI / 180;
|
|
17212
|
+
const halfWidth = Math.round((options.width ?? 112) / cell / 2) * cell;
|
|
17213
|
+
const height = Math.round((options.height ?? 144) / cell) * cell;
|
|
17214
|
+
const color2 = options.color ?? tron;
|
|
17215
|
+
const plane = {
|
|
17216
|
+
foot: options.foot,
|
|
17217
|
+
yaw: radians,
|
|
17218
|
+
across: { x: -Math.sin(radians), y: Math.cos(radians) }
|
|
17219
|
+
};
|
|
17220
|
+
const made = { objects: [], entities: [] };
|
|
17221
|
+
const rail = (color2 & ~255 | railAlpha) >>> 0;
|
|
17222
|
+
outline(plane, halfWidth, height, 0, color2, frameWidth, made);
|
|
17223
|
+
outline(plane, halfWidth, height, railInset, rail, frameWidth / 2, made);
|
|
17224
|
+
band(plane, halfWidth, height, color2, options.faded ?? tronFaded, made);
|
|
17225
|
+
if (options.viewer !== void 0) {
|
|
17226
|
+
const viewers = [options.viewer];
|
|
17227
|
+
made.objects.forEach((object) => object.showOnlyTo(viewers));
|
|
17228
|
+
made.entities.forEach((entity) => showEntityOnlyTo(entity, viewers));
|
|
17229
|
+
}
|
|
17230
|
+
return new _RaceGate(made.objects, made.entities);
|
|
17231
|
+
}
|
|
17232
|
+
/** remove takes every part of the gate out of the world. */
|
|
17233
|
+
remove() {
|
|
17234
|
+
this.entities.forEach((entity) => removeEntity(entity));
|
|
17235
|
+
this.objects.forEach((object) => object.remove());
|
|
17236
|
+
this.objects.length = 0;
|
|
17237
|
+
this.entities.length = 0;
|
|
17238
|
+
}
|
|
17239
|
+
};
|
|
17240
|
+
function at2(plane, side, up, deep = 0) {
|
|
17241
|
+
return {
|
|
17242
|
+
x: plane.foot.x + side * plane.across.x + Math.cos(plane.yaw) * deep,
|
|
17243
|
+
y: plane.foot.y + side * plane.across.y + Math.sin(plane.yaw) * deep,
|
|
17244
|
+
z: plane.foot.z + up
|
|
17245
|
+
};
|
|
17246
|
+
}
|
|
17247
|
+
function band(plane, halfWidth, height, lit, faded, made) {
|
|
17248
|
+
const width = halfWidth + margin * cell;
|
|
17249
|
+
const columns = width * 2 / cell;
|
|
17250
|
+
const openingRows = height / cell;
|
|
17251
|
+
const rows = openingRows + margin;
|
|
17252
|
+
for (let column = 0; column < columns; column++) {
|
|
17253
|
+
if (column >= margin && column < columns - margin) continue;
|
|
17254
|
+
const first = rows - 2 - (column + rows - 2) % 2;
|
|
17255
|
+
const count2 = Math.floor(first / 2) + 1;
|
|
17256
|
+
const outer = column === 0 || column === columns - 1;
|
|
17257
|
+
strip(plane, {
|
|
17258
|
+
text: Array(count2).fill(block).join(gap),
|
|
17259
|
+
side: -width + (column + 0.5) * cell,
|
|
17260
|
+
up: (first + 1) * cell + columnRise,
|
|
17261
|
+
pitch: 90,
|
|
17262
|
+
color: outer ? faded : lit,
|
|
17263
|
+
made
|
|
17264
|
+
});
|
|
17265
|
+
}
|
|
17266
|
+
for (let row2 = openingRows; row2 < rows; row2++) {
|
|
17267
|
+
const outer = row2 === rows - 1;
|
|
17268
|
+
const start = outer ? 0 : margin;
|
|
17269
|
+
const end = outer ? columns : columns - margin;
|
|
17270
|
+
const first = start + (start + row2) % 2;
|
|
17271
|
+
const count2 = Math.ceil((end - first) / 2);
|
|
17272
|
+
strip(plane, {
|
|
17273
|
+
text: Array(count2).fill(block).join(gap),
|
|
17274
|
+
side: -width + (first + count2 - 0.5) * cell + rowAcross,
|
|
17275
|
+
up: (row2 + 0.5) * cell + rowRise,
|
|
17276
|
+
pitch: 0,
|
|
17277
|
+
color: outer ? faded : lit,
|
|
17278
|
+
made
|
|
17279
|
+
});
|
|
17280
|
+
}
|
|
17281
|
+
}
|
|
17282
|
+
function strip(plane, { text: text2, side, up, pitch, color: color2, made }) {
|
|
17283
|
+
const yaw = plane.yaw * 180 / Math.PI - 90;
|
|
17284
|
+
for (const dx of [-1, 1]) {
|
|
17285
|
+
for (const dy of [-1, 1]) {
|
|
17286
|
+
const shown = createText({
|
|
17287
|
+
text: text2,
|
|
17288
|
+
position: at2(
|
|
17289
|
+
plane,
|
|
17290
|
+
side + dx * inkSpread,
|
|
17291
|
+
up + dy * inkSpread,
|
|
17292
|
+
inkDepth * (dx + 2 * dy + 3) / 2
|
|
17293
|
+
),
|
|
17294
|
+
facing: { pitch, yaw, roll: 90 },
|
|
17295
|
+
fontSize: 100,
|
|
17296
|
+
scale: blockScale,
|
|
17297
|
+
color: color2,
|
|
17298
|
+
align: pitch === 90 ? "left" : "center",
|
|
17299
|
+
verticalAlign: "center"
|
|
17300
|
+
});
|
|
17301
|
+
if (shown) made.objects.push(shown);
|
|
17302
|
+
}
|
|
17303
|
+
}
|
|
17304
|
+
}
|
|
17305
|
+
function outline(plane, halfWidth, height, inset, color2, width, made) {
|
|
17306
|
+
const corners = [
|
|
17307
|
+
at2(plane, -(halfWidth - inset), inset),
|
|
17308
|
+
at2(plane, halfWidth - inset, inset),
|
|
17309
|
+
at2(plane, halfWidth - inset, height - inset),
|
|
17310
|
+
at2(plane, -(halfWidth - inset), height - inset)
|
|
17311
|
+
];
|
|
17312
|
+
const names = corners.map((corner) => anchor(corner, made));
|
|
17313
|
+
if (names.some((name) => name === void 0)) return;
|
|
17314
|
+
corners.forEach((corner, index) => {
|
|
17315
|
+
const beam = createEntity({
|
|
17316
|
+
designerName: "env_beam",
|
|
17317
|
+
subclass: "",
|
|
17318
|
+
team: 0,
|
|
17319
|
+
position: corner,
|
|
17320
|
+
keyValues: [
|
|
17321
|
+
{ key: "LightningStart", value: { text: names[index] } },
|
|
17322
|
+
{ key: "LightningEnd", value: { text: names[(index + 1) % 4] } },
|
|
17323
|
+
{ key: "texture", value: { text: beamMaterial } },
|
|
17324
|
+
{ key: "BoltWidth", value: { number: width } },
|
|
17325
|
+
{ key: "NoiseAmplitude", value: { number: 0 } },
|
|
17326
|
+
{ key: "TextureScroll", value: { integer: 0 } },
|
|
17327
|
+
{ key: "life", value: { number: 0 } },
|
|
17328
|
+
{ key: "rendercolor", value: { color: color2 } },
|
|
17329
|
+
{ key: "renderamt", value: { integer: 255 } },
|
|
17330
|
+
{ key: "spawnflags", value: { integer: 1 } }
|
|
17331
|
+
]
|
|
17332
|
+
});
|
|
17333
|
+
if (beam) made.entities.push(beam);
|
|
17334
|
+
});
|
|
17335
|
+
}
|
|
17336
|
+
function anchor(position, made) {
|
|
17337
|
+
const carrier = createParticle({ resource: anchorParticle, position });
|
|
17338
|
+
const host2 = carrier?.entity();
|
|
17339
|
+
if (!carrier || !host2) {
|
|
17340
|
+
carrier?.remove();
|
|
17341
|
+
return void 0;
|
|
17342
|
+
}
|
|
17343
|
+
made.objects.push(carrier);
|
|
17344
|
+
const name = `racegate_${host2}_${nextPoint++}`;
|
|
17345
|
+
const point = createEntity({
|
|
17346
|
+
designerName: "info_particle_system",
|
|
17347
|
+
subclass: "",
|
|
17348
|
+
team: 0,
|
|
17349
|
+
position,
|
|
17350
|
+
keyValues: [{ key: "targetname", value: { text: name } }]
|
|
17351
|
+
});
|
|
17352
|
+
if (!point) return void 0;
|
|
17353
|
+
made.entities.push(point);
|
|
17354
|
+
fireInput(point, "SetParent", { text: "!activator" }, host2);
|
|
17355
|
+
return name;
|
|
17356
|
+
}
|
|
17357
|
+
|
|
16830
17358
|
// js/src/rotation.ts
|
|
16831
17359
|
var startingRating = 1e3;
|
|
16832
17360
|
var ratingStep = 32;
|
|
@@ -18533,6 +19061,7 @@ export {
|
|
|
18533
19061
|
Player,
|
|
18534
19062
|
ProbeRun,
|
|
18535
19063
|
Puppet,
|
|
19064
|
+
RaceGate,
|
|
18536
19065
|
Roster,
|
|
18537
19066
|
Score2 as Score,
|
|
18538
19067
|
Standings,
|
|
@@ -18544,6 +19073,7 @@ export {
|
|
|
18544
19073
|
abilityBarPresses,
|
|
18545
19074
|
abilityDisplay,
|
|
18546
19075
|
addBot,
|
|
19076
|
+
adjustSound,
|
|
18547
19077
|
after,
|
|
18548
19078
|
afterMatch,
|
|
18549
19079
|
blockInput,
|
|
@@ -18580,6 +19110,7 @@ export {
|
|
|
18580
19110
|
frameClock,
|
|
18581
19111
|
freeCursor,
|
|
18582
19112
|
ghostStates,
|
|
19113
|
+
giveEntityModifier,
|
|
18583
19114
|
ground,
|
|
18584
19115
|
handedOff,
|
|
18585
19116
|
handoff,
|
|
@@ -18588,6 +19119,7 @@ export {
|
|
|
18588
19119
|
hide,
|
|
18589
19120
|
hideHud,
|
|
18590
19121
|
holdBystander,
|
|
19122
|
+
holdEntityModifier,
|
|
18591
19123
|
holdMatchClock,
|
|
18592
19124
|
holdModifierState,
|
|
18593
19125
|
holdReload,
|
|
@@ -18628,6 +19160,7 @@ export {
|
|
|
18628
19160
|
poseAt,
|
|
18629
19161
|
precache,
|
|
18630
19162
|
pushEntity,
|
|
19163
|
+
raceGateResources,
|
|
18631
19164
|
ratingChange,
|
|
18632
19165
|
ratingStep,
|
|
18633
19166
|
readBoard,
|
|
@@ -18661,9 +19194,11 @@ export {
|
|
|
18661
19194
|
show,
|
|
18662
19195
|
showEntityOnlyTo,
|
|
18663
19196
|
showEntityToAll,
|
|
19197
|
+
silenceVoice,
|
|
18664
19198
|
spawnNpc,
|
|
18665
19199
|
startRift,
|
|
18666
19200
|
startingRating,
|
|
19201
|
+
stopSound,
|
|
18667
19202
|
strayGraceSeconds,
|
|
18668
19203
|
theme_exports as theme,
|
|
18669
19204
|
ticksPerSecond,
|
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.
|
|
11
|
-
"@modlock/darwin-x64": "0.1.
|
|
12
|
-
"@modlock/linux-arm64": "0.1.
|
|
13
|
-
"@modlock/linux-x64": "0.1.
|
|
14
|
-
"@modlock/win32-x64": "0.1.
|
|
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.
|
|
23
|
+
"version": "0.1.78"
|
|
24
24
|
}
|
package/racegate.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Vector } from './host.gen.js';
|
|
2
|
+
/** RaceGateOptions place a gate and choose its look; most have a default. */
|
|
3
|
+
export interface RaceGateOptions {
|
|
4
|
+
/** foot is the road point under the middle of the gate's opening. */
|
|
5
|
+
readonly foot: Vector;
|
|
6
|
+
/** yaw is the direction a runner passes through the gate, in degrees. */
|
|
7
|
+
readonly yaw: number;
|
|
8
|
+
/** width is the opening's width, 112 units by default, in whole cells. */
|
|
9
|
+
readonly width?: number;
|
|
10
|
+
/** height is the opening's height, 144 units by default, in whole cells. */
|
|
11
|
+
readonly height?: number;
|
|
12
|
+
/** color lights the window and the band, 0xRRGGBBAA, Tron cyan by default. */
|
|
13
|
+
readonly color?: number;
|
|
14
|
+
/** faded colors the band's outer ring, a darker cyan by default. */
|
|
15
|
+
readonly faded?: number;
|
|
16
|
+
/** viewer is the one player slot that sees the gate; everyone when unset. */
|
|
17
|
+
readonly viewer?: number;
|
|
18
|
+
}
|
|
19
|
+
/** raceGateResources are what a gate draws with, for a mod's precache. */
|
|
20
|
+
export declare const raceGateResources: string[];
|
|
21
|
+
/** RaceGate is a gate standing in the world, which remove takes down. */
|
|
22
|
+
export declare class RaceGate {
|
|
23
|
+
private readonly objects;
|
|
24
|
+
private readonly entities;
|
|
25
|
+
private constructor();
|
|
26
|
+
/**
|
|
27
|
+
* stand stands a gate across yaw at foot. A part the world refuses is left
|
|
28
|
+
* out, so the gate stands whatever the world made.
|
|
29
|
+
*/
|
|
30
|
+
static stand(options: RaceGateOptions): RaceGate;
|
|
31
|
+
/** remove takes every part of the gate out of the world. */
|
|
32
|
+
remove(): void;
|
|
33
|
+
}
|