@modlock/modlock 0.1.67 → 0.1.68
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/curve.d.ts +18 -9
- package/entities.d.ts +215 -34
- package/entities.js +232 -51
- package/host.gen.d.ts +63 -2
- package/index.js +276 -61
- package/package.json +6 -6
- package/timer.d.ts +2 -1
- package/ui.d.ts +17 -3
package/host.gen.d.ts
CHANGED
|
@@ -18,6 +18,10 @@ export type FieldType = 'bool' | 'int8' | 'int16' | 'int32' | 'uint8' | 'uint16'
|
|
|
18
18
|
export type PickupKind = 'urn' | 'movementBuff';
|
|
19
19
|
/** MovementAction is a movement fact the game announced for a hero. */
|
|
20
20
|
export type MovementAction = 'landed' | 'ziplineAttached' | 'groundDash' | 'slide' | 'bouncePad' | 'dashJump' | 'airJump' | 'wallJump' | 'airDash' | 'meleeStarted' | 'abilityExecuted';
|
|
21
|
+
/**
|
|
22
|
+
* InteractionKind names how a hero completed an interaction with a map object.
|
|
23
|
+
*/
|
|
24
|
+
export type InteractionKind = 'pickupCollected' | 'propBroken';
|
|
21
25
|
/**
|
|
22
26
|
* Lane is one of the map's lanes, numbered as the game numbers them. The
|
|
23
27
|
* three-lane map has yellow, blue and purple ziplines and no green.
|
|
@@ -469,6 +473,44 @@ export interface MovementSample {
|
|
|
469
473
|
* sample, absent before the game ran any of it.
|
|
470
474
|
*/
|
|
471
475
|
readonly command?: MovementCommand;
|
|
476
|
+
/**
|
|
477
|
+
* interactions are the map objects the hero collected or broke since the
|
|
478
|
+
* last tick, as the game's own completion named the hero. A hero who stood
|
|
479
|
+
* by, or only benefited from another's pickup, has none.
|
|
480
|
+
*/
|
|
481
|
+
readonly interactions: Interaction[];
|
|
482
|
+
}
|
|
483
|
+
/** Interaction is one completed interaction with a map object. */
|
|
484
|
+
export interface Interaction {
|
|
485
|
+
readonly kind?: InteractionKind;
|
|
486
|
+
/**
|
|
487
|
+
* entity is the object's entity handle, which names it within this world
|
|
488
|
+
* only; origin and the names identify it across sessions.
|
|
489
|
+
*/
|
|
490
|
+
readonly entity: number;
|
|
491
|
+
/**
|
|
492
|
+
* designerName is the object's entity class, such as citadel_pickup_health,
|
|
493
|
+
* and subclassId the hash of its subclass, such as the healing bat's
|
|
494
|
+
* citadel_pickup_health_float_in_world.
|
|
495
|
+
*/
|
|
496
|
+
readonly designerName: string;
|
|
497
|
+
readonly subclassId: number;
|
|
498
|
+
/**
|
|
499
|
+
* origin is where the object stood before the interaction moved it: a
|
|
500
|
+
* vacuumed pickup's position as its vacuum began, otherwise its origin.
|
|
501
|
+
*/
|
|
502
|
+
readonly origin: Vector;
|
|
503
|
+
/**
|
|
504
|
+
* vacuumStart is the game time the pickup began flying to the hero, absent
|
|
505
|
+
* for a pickup collected on touch and for a prop. The interaction itself
|
|
506
|
+
* completed on the sample's tick.
|
|
507
|
+
*/
|
|
508
|
+
readonly vacuumStart?: number;
|
|
509
|
+
/**
|
|
510
|
+
* inflictor is the entity that broke a prop, such as the hero's projectile,
|
|
511
|
+
* or zero.
|
|
512
|
+
*/
|
|
513
|
+
readonly inflictor: number;
|
|
472
514
|
}
|
|
473
515
|
/**
|
|
474
516
|
* MovementCommand is the movement a player commanded over one tick. The
|
|
@@ -1066,6 +1108,17 @@ export interface SettingChangedEvent {
|
|
|
1066
1108
|
/** value is the new value. */
|
|
1067
1109
|
readonly value: string;
|
|
1068
1110
|
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Wheel reports one wheel step over a slider, anchored to its pointer position.
|
|
1113
|
+
*/
|
|
1114
|
+
export interface Wheel {
|
|
1115
|
+
/**
|
|
1116
|
+
* delta is 1 for up and -1 for down. It never changes the slider's value.
|
|
1117
|
+
*/
|
|
1118
|
+
readonly delta: number;
|
|
1119
|
+
/** fraction is the pointer's horizontal position, bounded from 0 to 1. */
|
|
1120
|
+
readonly fraction: number;
|
|
1121
|
+
}
|
|
1069
1122
|
/** UiPressEvent reports a press on a button in a player's interface. */
|
|
1070
1123
|
export interface UiPressEvent {
|
|
1071
1124
|
/** player is the player who pressed. */
|
|
@@ -1083,7 +1136,7 @@ export interface UiInputEvent {
|
|
|
1083
1136
|
/** node is the id of the input. */
|
|
1084
1137
|
readonly node: string;
|
|
1085
1138
|
/** value is the input's new value, in the kind its control holds. */
|
|
1086
|
-
readonly value?: string | number | boolean | number;
|
|
1139
|
+
readonly value?: string | number | boolean | number | Wheel;
|
|
1087
1140
|
}
|
|
1088
1141
|
/** StartEvent describes the server the mod starts in. */
|
|
1089
1142
|
export interface StartEvent {
|
|
@@ -1124,6 +1177,12 @@ export interface FrameEvent {
|
|
|
1124
1177
|
* new tick, and is empty otherwise.
|
|
1125
1178
|
*/
|
|
1126
1179
|
readonly movement: MovementSample[];
|
|
1180
|
+
/**
|
|
1181
|
+
* interactions names the interaction kinds the host observes, sent with
|
|
1182
|
+
* movement. A kind it lacks, such as on a game build whose completion it
|
|
1183
|
+
* cannot find, is unknown rather than absent from the samples.
|
|
1184
|
+
*/
|
|
1185
|
+
readonly interactions: InteractionKind[];
|
|
1127
1186
|
}
|
|
1128
1187
|
/**
|
|
1129
1188
|
* CommandEvent carries one command line from a player: a chat line that
|
|
@@ -1511,7 +1570,9 @@ export declare class Npc {
|
|
|
1511
1570
|
read(): NpcState | undefined;
|
|
1512
1571
|
/**
|
|
1513
1572
|
* move places the unit and sets its velocity, which drives its walk
|
|
1514
|
-
* animation. It
|
|
1573
|
+
* animation. It sets the pose without a teleport, which would reset the
|
|
1574
|
+
* unit's animation, so a mode can steer its units every frame. It reports
|
|
1575
|
+
* false once the unit is gone.
|
|
1515
1576
|
*/
|
|
1516
1577
|
move(position: Vector, facing?: Angles, velocity?: Vector): boolean;
|
|
1517
1578
|
/**
|
package/index.js
CHANGED
|
@@ -1850,6 +1850,14 @@ var MovementAction_Enum = /* @__PURE__ */ createEnumType(
|
|
|
1850
1850
|
[11, "MOVEMENT_ACTION_ABILITY_EXECUTED"]
|
|
1851
1851
|
]
|
|
1852
1852
|
);
|
|
1853
|
+
var InteractionKind_Enum = /* @__PURE__ */ createEnumType(
|
|
1854
|
+
"modlock.wasm.movement.InteractionKind",
|
|
1855
|
+
[
|
|
1856
|
+
[0, "INTERACTION_KIND_UNKNOWN"],
|
|
1857
|
+
[1, "INTERACTION_KIND_PICKUP_COLLECTED"],
|
|
1858
|
+
[2, "INTERACTION_KIND_PROP_BROKEN"]
|
|
1859
|
+
]
|
|
1860
|
+
);
|
|
1853
1861
|
var Lane_Enum = /* @__PURE__ */ createEnumType(
|
|
1854
1862
|
"modlock.wasm.movement.Lane",
|
|
1855
1863
|
[
|
|
@@ -1883,7 +1891,8 @@ var MovementSample = /* @__PURE__ */ createMessageType(
|
|
|
1883
1891
|
[19, "zipline_time", 2, 4],
|
|
1884
1892
|
[20, "actions", 14, 3, MovementAction_Enum],
|
|
1885
1893
|
[21, "casts", 13, 3],
|
|
1886
|
-
[22, "command", 11, 0, MovementCommand.codec]
|
|
1894
|
+
[22, "command", 11, 0, MovementCommand.codec],
|
|
1895
|
+
[23, "interactions", 11, 1, Interaction.codec]
|
|
1887
1896
|
],
|
|
1888
1897
|
{
|
|
1889
1898
|
decode: (r, end, m) => {
|
|
@@ -1964,6 +1973,12 @@ var MovementSample = /* @__PURE__ */ createMessageType(
|
|
|
1964
1973
|
m.command ?? {}
|
|
1965
1974
|
);
|
|
1966
1975
|
break;
|
|
1976
|
+
case 23:
|
|
1977
|
+
;
|
|
1978
|
+
(m.interactions ??= []).push(
|
|
1979
|
+
Interaction.decode(r, r.delimited(), {})
|
|
1980
|
+
);
|
|
1981
|
+
break;
|
|
1967
1982
|
default:
|
|
1968
1983
|
r.skip(t);
|
|
1969
1984
|
}
|
|
@@ -2063,6 +2078,86 @@ var MovementSample = /* @__PURE__ */ createMessageType(
|
|
|
2063
2078
|
const v = m.command;
|
|
2064
2079
|
if (v != null) MovementCommand.writeField(w, 22, v);
|
|
2065
2080
|
}
|
|
2081
|
+
{
|
|
2082
|
+
const a = m.interactions;
|
|
2083
|
+
if (a != null) for (const e of a) Interaction.writeField(w, 23, e);
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
);
|
|
2088
|
+
var Interaction = /* @__PURE__ */ createMessageType(
|
|
2089
|
+
"modlock.wasm.movement.Interaction",
|
|
2090
|
+
() => [
|
|
2091
|
+
[1, "kind", 14, 0, InteractionKind_Enum],
|
|
2092
|
+
[2, "entity", 13],
|
|
2093
|
+
[3, "designer_name", 9],
|
|
2094
|
+
[4, "subclass_id", 13],
|
|
2095
|
+
[5, "origin", 11, 0, Vec3.codec],
|
|
2096
|
+
[6, "vacuum_start", 2, 4],
|
|
2097
|
+
[7, "inflictor", 13]
|
|
2098
|
+
],
|
|
2099
|
+
{
|
|
2100
|
+
decode: (r, end, m) => {
|
|
2101
|
+
while (r.pos < end) {
|
|
2102
|
+
const t = r.tag();
|
|
2103
|
+
if ((t & 7) === 4) return m;
|
|
2104
|
+
switch (t >>> 3) {
|
|
2105
|
+
case 1:
|
|
2106
|
+
m.kind = r.int32();
|
|
2107
|
+
break;
|
|
2108
|
+
case 2:
|
|
2109
|
+
m.entity = r.uint32();
|
|
2110
|
+
break;
|
|
2111
|
+
case 3:
|
|
2112
|
+
m.designerName = r.string();
|
|
2113
|
+
break;
|
|
2114
|
+
case 4:
|
|
2115
|
+
m.subclassId = r.uint32();
|
|
2116
|
+
break;
|
|
2117
|
+
case 5:
|
|
2118
|
+
m.origin = Vec3.decode(r, r.delimited(), m.origin ?? {});
|
|
2119
|
+
break;
|
|
2120
|
+
case 6:
|
|
2121
|
+
m.vacuumStart = r.float();
|
|
2122
|
+
break;
|
|
2123
|
+
case 7:
|
|
2124
|
+
m.inflictor = r.uint32();
|
|
2125
|
+
break;
|
|
2126
|
+
default:
|
|
2127
|
+
r.skip(t);
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
return m;
|
|
2131
|
+
},
|
|
2132
|
+
encode: (m, w) => {
|
|
2133
|
+
{
|
|
2134
|
+
const v = m.kind;
|
|
2135
|
+
if (v) w.uint32(8).int32(v);
|
|
2136
|
+
}
|
|
2137
|
+
{
|
|
2138
|
+
const v = m.entity;
|
|
2139
|
+
if (v) w.uint32(16).uint32(v);
|
|
2140
|
+
}
|
|
2141
|
+
{
|
|
2142
|
+
const v = m.designerName;
|
|
2143
|
+
if (v) w.uint32(26).string(v);
|
|
2144
|
+
}
|
|
2145
|
+
{
|
|
2146
|
+
const v = m.subclassId;
|
|
2147
|
+
if (v) w.uint32(32).uint32(v);
|
|
2148
|
+
}
|
|
2149
|
+
{
|
|
2150
|
+
const v = m.origin;
|
|
2151
|
+
if (v != null) Vec3.writeField(w, 5, v);
|
|
2152
|
+
}
|
|
2153
|
+
{
|
|
2154
|
+
const v = m.vacuumStart;
|
|
2155
|
+
if (v != null) w.uint32(53).float(v);
|
|
2156
|
+
}
|
|
2157
|
+
{
|
|
2158
|
+
const v = m.inflictor;
|
|
2159
|
+
if (v) w.uint32(56).uint32(v);
|
|
2160
|
+
}
|
|
2066
2161
|
}
|
|
2067
2162
|
}
|
|
2068
2163
|
);
|
|
@@ -2770,7 +2865,8 @@ var FrameEvent = /* @__PURE__ */ createMessageType(
|
|
|
2770
2865
|
() => [
|
|
2771
2866
|
[1, "tick", 4],
|
|
2772
2867
|
[2, "time_seconds", 1],
|
|
2773
|
-
[3, "movement", 11, 1, MovementSample.codec]
|
|
2868
|
+
[3, "movement", 11, 1, MovementSample.codec],
|
|
2869
|
+
[4, "interactions", 14, 3, InteractionKind_Enum]
|
|
2774
2870
|
],
|
|
2775
2871
|
{
|
|
2776
2872
|
decode: (r, end, m) => {
|
|
@@ -2790,6 +2886,10 @@ var FrameEvent = /* @__PURE__ */ createMessageType(
|
|
|
2790
2886
|
MovementSample.decode(r, r.delimited(), {})
|
|
2791
2887
|
);
|
|
2792
2888
|
break;
|
|
2889
|
+
case 4:
|
|
2890
|
+
for (const e = r.run(t), a = m.interactions ??= []; r.pos < e; )
|
|
2891
|
+
a.push(r.int32());
|
|
2892
|
+
break;
|
|
2793
2893
|
default:
|
|
2794
2894
|
r.skip(t);
|
|
2795
2895
|
}
|
|
@@ -2809,6 +2909,14 @@ var FrameEvent = /* @__PURE__ */ createMessageType(
|
|
|
2809
2909
|
const a = m.movement;
|
|
2810
2910
|
if (a != null) for (const e of a) MovementSample.writeField(w, 3, e);
|
|
2811
2911
|
}
|
|
2912
|
+
{
|
|
2913
|
+
const a = m.interactions;
|
|
2914
|
+
if (a != null && a.length > 0) {
|
|
2915
|
+
const s = w.uint32(34).fork();
|
|
2916
|
+
for (const e of a) w.int32(e);
|
|
2917
|
+
w.join(s);
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2812
2920
|
}
|
|
2813
2921
|
}
|
|
2814
2922
|
);
|
|
@@ -10376,7 +10484,8 @@ var Slider = /* @__PURE__ */ createMessageType(
|
|
|
10376
10484
|
[1, "value", 2],
|
|
10377
10485
|
[2, "min", 2],
|
|
10378
10486
|
[3, "max", 2],
|
|
10379
|
-
[4, "step", 2]
|
|
10487
|
+
[4, "step", 2],
|
|
10488
|
+
[5, "wheel", 8]
|
|
10380
10489
|
],
|
|
10381
10490
|
{
|
|
10382
10491
|
decode: (r, end, m) => {
|
|
@@ -10396,6 +10505,9 @@ var Slider = /* @__PURE__ */ createMessageType(
|
|
|
10396
10505
|
case 4:
|
|
10397
10506
|
m.step = r.float();
|
|
10398
10507
|
break;
|
|
10508
|
+
case 5:
|
|
10509
|
+
m.wheel = r.bool();
|
|
10510
|
+
break;
|
|
10399
10511
|
default:
|
|
10400
10512
|
r.skip(t);
|
|
10401
10513
|
}
|
|
@@ -10419,6 +10531,46 @@ var Slider = /* @__PURE__ */ createMessageType(
|
|
|
10419
10531
|
const v = m.step;
|
|
10420
10532
|
if (v != null && v !== 0) w.uint32(37).float(v);
|
|
10421
10533
|
}
|
|
10534
|
+
{
|
|
10535
|
+
const v = m.wheel;
|
|
10536
|
+
if (v) w.uint32(40).bool(v);
|
|
10537
|
+
}
|
|
10538
|
+
}
|
|
10539
|
+
}
|
|
10540
|
+
);
|
|
10541
|
+
var Wheel = /* @__PURE__ */ createMessageType(
|
|
10542
|
+
"modlock.wasm.ui.Wheel",
|
|
10543
|
+
() => [
|
|
10544
|
+
[1, "delta", 2],
|
|
10545
|
+
[2, "fraction", 2]
|
|
10546
|
+
],
|
|
10547
|
+
{
|
|
10548
|
+
decode: (r, end, m) => {
|
|
10549
|
+
while (r.pos < end) {
|
|
10550
|
+
const t = r.tag();
|
|
10551
|
+
if ((t & 7) === 4) return m;
|
|
10552
|
+
switch (t >>> 3) {
|
|
10553
|
+
case 1:
|
|
10554
|
+
m.delta = r.float();
|
|
10555
|
+
break;
|
|
10556
|
+
case 2:
|
|
10557
|
+
m.fraction = r.float();
|
|
10558
|
+
break;
|
|
10559
|
+
default:
|
|
10560
|
+
r.skip(t);
|
|
10561
|
+
}
|
|
10562
|
+
}
|
|
10563
|
+
return m;
|
|
10564
|
+
},
|
|
10565
|
+
encode: (m, w) => {
|
|
10566
|
+
{
|
|
10567
|
+
const v = m.delta;
|
|
10568
|
+
if (v != null && v !== 0) w.uint32(13).float(v);
|
|
10569
|
+
}
|
|
10570
|
+
{
|
|
10571
|
+
const v = m.fraction;
|
|
10572
|
+
if (v != null && v !== 0) w.uint32(21).float(v);
|
|
10573
|
+
}
|
|
10422
10574
|
}
|
|
10423
10575
|
}
|
|
10424
10576
|
);
|
|
@@ -11375,7 +11527,8 @@ var UiInputEvent = /* @__PURE__ */ createMessageType(
|
|
|
11375
11527
|
[3, "text", 9, 0, 0, "value"],
|
|
11376
11528
|
[4, "number", 2, 0, 0, "value"],
|
|
11377
11529
|
[5, "on", 8, 0, 0, "value"],
|
|
11378
|
-
[6, "choice", 13, 0, 0, "value"]
|
|
11530
|
+
[6, "choice", 13, 0, 0, "value"],
|
|
11531
|
+
[7, "wheel", 11, 0, Wheel.codec, "value"]
|
|
11379
11532
|
],
|
|
11380
11533
|
{
|
|
11381
11534
|
decode: (r, end, m) => {
|
|
@@ -11401,6 +11554,16 @@ var UiInputEvent = /* @__PURE__ */ createMessageType(
|
|
|
11401
11554
|
case 6:
|
|
11402
11555
|
m.value = { case: "choice", value: r.uint32() };
|
|
11403
11556
|
break;
|
|
11557
|
+
case 7:
|
|
11558
|
+
m.value = {
|
|
11559
|
+
case: "wheel",
|
|
11560
|
+
value: Wheel.decode(
|
|
11561
|
+
r,
|
|
11562
|
+
r.delimited(),
|
|
11563
|
+
m.value?.case === "wheel" ? m.value.value : {}
|
|
11564
|
+
)
|
|
11565
|
+
};
|
|
11566
|
+
break;
|
|
11404
11567
|
default:
|
|
11405
11568
|
r.skip(t);
|
|
11406
11569
|
}
|
|
@@ -11435,6 +11598,11 @@ var UiInputEvent = /* @__PURE__ */ createMessageType(
|
|
|
11435
11598
|
if (o?.case === "choice" && o.value != null)
|
|
11436
11599
|
w.uint32(48).uint32(o.value);
|
|
11437
11600
|
}
|
|
11601
|
+
{
|
|
11602
|
+
const o = m.value;
|
|
11603
|
+
if (o?.case === "wheel" && o.value != null)
|
|
11604
|
+
Wheel.writeField(w, 7, o.value);
|
|
11605
|
+
}
|
|
11438
11606
|
}
|
|
11439
11607
|
}
|
|
11440
11608
|
);
|
|
@@ -11538,6 +11706,10 @@ var movementActionNames = {
|
|
|
11538
11706
|
10: "meleeStarted",
|
|
11539
11707
|
11: "abilityExecuted"
|
|
11540
11708
|
};
|
|
11709
|
+
var interactionKindNames = {
|
|
11710
|
+
1: "pickupCollected",
|
|
11711
|
+
2: "propBroken"
|
|
11712
|
+
};
|
|
11541
11713
|
var laneValues = {
|
|
11542
11714
|
none: 0,
|
|
11543
11715
|
yellow: 1,
|
|
@@ -11779,7 +11951,19 @@ function fromMovementSample(message) {
|
|
|
11779
11951
|
ziplineTime: message.ziplineTime,
|
|
11780
11952
|
actions: known(message.actions, (v) => movementActionNames[v]),
|
|
11781
11953
|
casts: message.casts ?? [],
|
|
11782
|
-
command: message.command === void 0 ? void 0 : fromMovementCommand(message.command)
|
|
11954
|
+
command: message.command === void 0 ? void 0 : fromMovementCommand(message.command),
|
|
11955
|
+
interactions: (message.interactions ?? []).map((v) => fromInteraction(v))
|
|
11956
|
+
};
|
|
11957
|
+
}
|
|
11958
|
+
function fromInteraction(message) {
|
|
11959
|
+
return {
|
|
11960
|
+
kind: interactionKindNames[message.kind ?? 0],
|
|
11961
|
+
entity: message.entity ?? 0,
|
|
11962
|
+
designerName: message.designerName ?? "",
|
|
11963
|
+
subclassId: message.subclassId ?? 0,
|
|
11964
|
+
origin: vector(message.origin),
|
|
11965
|
+
vacuumStart: message.vacuumStart,
|
|
11966
|
+
inflictor: message.inflictor ?? 0
|
|
11783
11967
|
};
|
|
11784
11968
|
}
|
|
11785
11969
|
function fromMovementCommand(message) {
|
|
@@ -12030,6 +12214,12 @@ function fromSettingChangedEvent(message) {
|
|
|
12030
12214
|
value: message.value ?? ""
|
|
12031
12215
|
};
|
|
12032
12216
|
}
|
|
12217
|
+
function fromWheel(message) {
|
|
12218
|
+
return {
|
|
12219
|
+
delta: message.delta ?? 0,
|
|
12220
|
+
fraction: message.fraction ?? 0
|
|
12221
|
+
};
|
|
12222
|
+
}
|
|
12033
12223
|
function fromUiPressEvent(message) {
|
|
12034
12224
|
return {
|
|
12035
12225
|
player: new Player(message.player ?? 0),
|
|
@@ -12040,7 +12230,7 @@ function fromUiInputEvent(message) {
|
|
|
12040
12230
|
return {
|
|
12041
12231
|
player: new Player(message.player ?? 0),
|
|
12042
12232
|
node: message.node ?? "",
|
|
12043
|
-
value: message.value?.value
|
|
12233
|
+
value: message.value?.case === "wheel" ? fromWheel(message.value.value) : message.value?.value
|
|
12044
12234
|
};
|
|
12045
12235
|
}
|
|
12046
12236
|
function fromStartEvent(message) {
|
|
@@ -12054,7 +12244,8 @@ function fromFrameEvent(message) {
|
|
|
12054
12244
|
return {
|
|
12055
12245
|
tick: message.tick ?? 0n,
|
|
12056
12246
|
timeSeconds: message.timeSeconds ?? 0,
|
|
12057
|
-
movement: (message.movement ?? []).map((v) => fromMovementSample(v))
|
|
12247
|
+
movement: (message.movement ?? []).map((v) => fromMovementSample(v)),
|
|
12248
|
+
interactions: known(message.interactions, (v) => interactionKindNames[v])
|
|
12058
12249
|
};
|
|
12059
12250
|
}
|
|
12060
12251
|
function fromCommandEvent(message) {
|
|
@@ -12546,7 +12737,9 @@ var Npc = class {
|
|
|
12546
12737
|
}
|
|
12547
12738
|
/**
|
|
12548
12739
|
* move places the unit and sets its velocity, which drives its walk
|
|
12549
|
-
* animation. It
|
|
12740
|
+
* animation. It sets the pose without a teleport, which would reset the
|
|
12741
|
+
* unit's animation, so a mode can steer its units every frame. It reports
|
|
12742
|
+
* false once the unit is gone.
|
|
12550
12743
|
*/
|
|
12551
12744
|
move(position, facing, velocity) {
|
|
12552
12745
|
const reply2 = call("MoveNpc", MoveNpcRequest.toBinary({ npc: this.entity, position, facing, velocity }));
|
|
@@ -13248,6 +13441,14 @@ function schedule(delay, run) {
|
|
|
13248
13441
|
return entry;
|
|
13249
13442
|
}
|
|
13250
13443
|
function advance(seconds) {
|
|
13444
|
+
if (now !== void 0 && seconds < now) {
|
|
13445
|
+
const shift = seconds - now;
|
|
13446
|
+
for (const entry of entries) {
|
|
13447
|
+
if (entry.at !== void 0) {
|
|
13448
|
+
entry.at += shift;
|
|
13449
|
+
}
|
|
13450
|
+
}
|
|
13451
|
+
}
|
|
13251
13452
|
now = seconds;
|
|
13252
13453
|
for (const entry of entries) {
|
|
13253
13454
|
entry.start(seconds);
|
|
@@ -13376,6 +13577,10 @@ function press(player, node) {
|
|
|
13376
13577
|
}
|
|
13377
13578
|
}
|
|
13378
13579
|
function change(player, node, value) {
|
|
13580
|
+
if (typeof value === "object" && value !== null) {
|
|
13581
|
+
screens.get(player.slot)?.wheels.get(node)?.handler(player, value);
|
|
13582
|
+
return;
|
|
13583
|
+
}
|
|
13379
13584
|
const changed = screens.get(player.slot)?.changes.get(node);
|
|
13380
13585
|
if (changed) {
|
|
13381
13586
|
changed.handler(player, value);
|
|
@@ -13492,6 +13697,7 @@ var Layout = class {
|
|
|
13492
13697
|
ids: /* @__PURE__ */ new Map(),
|
|
13493
13698
|
presses: /* @__PURE__ */ new Map(),
|
|
13494
13699
|
changes: /* @__PURE__ */ new Map(),
|
|
13700
|
+
wheels: /* @__PURE__ */ new Map(),
|
|
13495
13701
|
next: previous?.next ?? 0
|
|
13496
13702
|
};
|
|
13497
13703
|
}
|
|
@@ -13623,13 +13829,17 @@ function input(layout, node, kind, props) {
|
|
|
13623
13829
|
};
|
|
13624
13830
|
break;
|
|
13625
13831
|
case "slider":
|
|
13832
|
+
if (props.onWheel && !props.disabled) {
|
|
13833
|
+
layout.screen.wheels.set(node.id, { handler: props.onWheel });
|
|
13834
|
+
}
|
|
13626
13835
|
node.input = {
|
|
13627
13836
|
case: "slider",
|
|
13628
13837
|
value: {
|
|
13629
13838
|
value: Number(props.value ?? 0),
|
|
13630
13839
|
min: props.min,
|
|
13631
13840
|
max: props.max,
|
|
13632
|
-
step: props.step
|
|
13841
|
+
step: props.step,
|
|
13842
|
+
wheel: !!props.onWheel && !props.disabled
|
|
13633
13843
|
}
|
|
13634
13844
|
};
|
|
13635
13845
|
break;
|
|
@@ -14076,40 +14286,46 @@ __export(curve_exports, {
|
|
|
14076
14286
|
pingPong: () => pingPong,
|
|
14077
14287
|
repeat: () => repeat,
|
|
14078
14288
|
reverse: () => reverse,
|
|
14289
|
+
shaped: () => shaped,
|
|
14079
14290
|
through: () => through,
|
|
14080
14291
|
valueAt: () => valueAt,
|
|
14081
14292
|
wave: () => wave
|
|
14082
14293
|
});
|
|
14083
14294
|
var ease = {
|
|
14084
14295
|
/** linear moves at an even pace. */
|
|
14085
|
-
linear:
|
|
14296
|
+
linear: shaped((t) => t, {}),
|
|
14086
14297
|
/** bias is the game's bias curve; see LerpShape. */
|
|
14087
|
-
bias: (b) =>
|
|
14298
|
+
bias: (b) => shaped((t) => bias(t, b), { bias: b }),
|
|
14088
14299
|
/** gain is the game's gain curve; see LerpShape. */
|
|
14089
|
-
gain: (g) =>
|
|
14300
|
+
gain: (g) => shaped((t) => gain(t, g), { gain: g }),
|
|
14090
14301
|
/** in starts slow and speeds up. */
|
|
14091
|
-
in: (t) => t * t * t,
|
|
14302
|
+
in: shaped((t) => t * t * t),
|
|
14092
14303
|
/** out starts fast and slows to a stop. */
|
|
14093
|
-
out: (t) => 1 - (1 - t) ** 3,
|
|
14304
|
+
out: shaped((t) => 1 - (1 - t) ** 3),
|
|
14094
14305
|
/** inOut starts and ends slow. */
|
|
14095
|
-
inOut: (t) => t < 0.5 ? 4 * t * t * t : 1 - (2 - 2 * t) ** 3 / 2,
|
|
14306
|
+
inOut: shaped((t) => t < 0.5 ? 4 * t * t * t : 1 - (2 - 2 * t) ** 3 / 2),
|
|
14096
14307
|
/** sine starts and ends slow, more gently than inOut. */
|
|
14097
|
-
sine: (t) => (1 - Math.cos(Math.PI * t)) / 2,
|
|
14308
|
+
sine: shaped((t) => (1 - Math.cos(Math.PI * t)) / 2),
|
|
14098
14309
|
/** back passes its end a little and settles back onto it. */
|
|
14099
|
-
back: (t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2,
|
|
14310
|
+
back: shaped((t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2),
|
|
14100
14311
|
/** elastic overshoots its end and rings down onto it. */
|
|
14101
|
-
elastic: (
|
|
14312
|
+
elastic: shaped(
|
|
14313
|
+
(t) => t <= 0 || t >= 1 ? t : 2 ** (-10 * t) * Math.sin((t * 10 - 0.75) * 2 * Math.PI / 3) + 1
|
|
14314
|
+
),
|
|
14102
14315
|
/** bounce drops onto its end and bounces to rest. */
|
|
14103
|
-
bounce: (t) => {
|
|
14316
|
+
bounce: shaped((t) => {
|
|
14104
14317
|
const k = 7.5625;
|
|
14105
14318
|
if (t < 1 / 2.75) return k * t * t;
|
|
14106
14319
|
if (t < 2 / 2.75) return k * (t - 1.5 / 2.75) ** 2 + 0.75;
|
|
14107
14320
|
if (t < 2.5 / 2.75) return k * (t - 2.25 / 2.75) ** 2 + 0.9375;
|
|
14108
14321
|
return k * (t - 2.625 / 2.75) ** 2 + 0.984375;
|
|
14109
|
-
}
|
|
14322
|
+
})
|
|
14110
14323
|
};
|
|
14324
|
+
function shaped(at2, lerp3) {
|
|
14325
|
+
return { at: at2, lerp: lerp3 };
|
|
14326
|
+
}
|
|
14111
14327
|
function line(from, to, duration, shape = ease.linear) {
|
|
14112
|
-
return [{ duration, lerp: shape.lerp, at: (u) => mix(from, to, shape(u)) }];
|
|
14328
|
+
return [{ duration, lerp: shape.lerp, at: (u) => mix(from, to, shape.at(u)) }];
|
|
14113
14329
|
}
|
|
14114
14330
|
function hold(value, duration) {
|
|
14115
14331
|
return [{ duration, lerp: {}, at: () => value }];
|
|
@@ -14131,7 +14347,7 @@ function keyframes(keys, options = {}) {
|
|
|
14131
14347
|
const after2 = keys[i + 1]?.value ?? to.value;
|
|
14132
14348
|
spans.push({
|
|
14133
14349
|
duration,
|
|
14134
|
-
at: (u) => spline(before, from.value, to.value, after2, shape(u))
|
|
14350
|
+
at: (u) => spline(before, from.value, to.value, after2, shape.at(u))
|
|
14135
14351
|
});
|
|
14136
14352
|
});
|
|
14137
14353
|
return spans;
|
|
@@ -14156,7 +14372,7 @@ function orbit(options) {
|
|
|
14156
14372
|
{
|
|
14157
14373
|
duration,
|
|
14158
14374
|
at: (u) => {
|
|
14159
|
-
const t = shape(u);
|
|
14375
|
+
const t = shape.at(u);
|
|
14160
14376
|
const angle = start + t * turns * 2 * Math.PI;
|
|
14161
14377
|
return {
|
|
14162
14378
|
x: center.x + radius * Math.cos(angle),
|
|
@@ -14204,9 +14420,6 @@ function valueAt(curve, seconds) {
|
|
|
14204
14420
|
}
|
|
14205
14421
|
return curve.at(-1)?.at(1);
|
|
14206
14422
|
}
|
|
14207
|
-
function native(shape, lerp3) {
|
|
14208
|
-
return Object.assign(shape, { lerp: lerp3 });
|
|
14209
|
-
}
|
|
14210
14423
|
function bias(t, b) {
|
|
14211
14424
|
return t ** (Math.log(b) / Math.log(0.5));
|
|
14212
14425
|
}
|
|
@@ -14267,11 +14480,17 @@ function setOrbitCamera(player, enabled) {
|
|
|
14267
14480
|
}
|
|
14268
14481
|
var moves = 0;
|
|
14269
14482
|
function playCamera(player, options) {
|
|
14483
|
+
const tracks = [];
|
|
14484
|
+
for (const [param, curve] of Object.entries(options.tracks)) {
|
|
14485
|
+
if (curve) tracks.push({ param, curve });
|
|
14486
|
+
}
|
|
14487
|
+
return playTracks(player, options, tracks);
|
|
14488
|
+
}
|
|
14489
|
+
function playTracks(player, options, tracks) {
|
|
14270
14490
|
const context = options.context ?? `modlock.camera.${++moves}`;
|
|
14271
|
-
const
|
|
14272
|
-
const length3 = Math.max(0, ...tracks.map(([, curve]) => durationOf(curve)));
|
|
14491
|
+
const length3 = Math.max(0, ...tracks.map((track) => durationOf(track.curve)));
|
|
14273
14492
|
const send2 = (delay) => tracks.every(
|
|
14274
|
-
(
|
|
14493
|
+
({ param, curve }) => sendCurve(player, { ...options, context, param, delay }, curve)
|
|
14275
14494
|
);
|
|
14276
14495
|
let timer;
|
|
14277
14496
|
const stop = () => {
|
|
@@ -14303,11 +14522,7 @@ function cameraPulse(player, options) {
|
|
|
14303
14522
|
hold(by, options.hold),
|
|
14304
14523
|
reverse(line(rest, by, options.out, shape))
|
|
14305
14524
|
);
|
|
14306
|
-
return
|
|
14307
|
-
...options,
|
|
14308
|
-
relative: true,
|
|
14309
|
-
tracks: { [param]: curve }
|
|
14310
|
-
});
|
|
14525
|
+
return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
|
|
14311
14526
|
}
|
|
14312
14527
|
function cameraShake(player, options) {
|
|
14313
14528
|
const { amplitude, duration } = options;
|
|
@@ -14318,11 +14533,7 @@ function cameraShake(player, options) {
|
|
|
14318
14533
|
decay: true
|
|
14319
14534
|
});
|
|
14320
14535
|
const param = options.param ?? "horizontalOffset";
|
|
14321
|
-
return
|
|
14322
|
-
...options,
|
|
14323
|
-
relative: true,
|
|
14324
|
-
tracks: { [param]: curve }
|
|
14325
|
-
});
|
|
14536
|
+
return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
|
|
14326
14537
|
}
|
|
14327
14538
|
function sendCurve(player, options, curve) {
|
|
14328
14539
|
const { context, param, relative, priority, target } = options;
|
|
@@ -15251,21 +15462,8 @@ function rosterRow(row, index) {
|
|
|
15251
15462
|
]
|
|
15252
15463
|
);
|
|
15253
15464
|
const src = portraits.get(row.hero);
|
|
15254
|
-
const badge = row.steamId
|
|
15255
|
-
|
|
15256
|
-
props: {
|
|
15257
|
-
steamId: row.steamId,
|
|
15258
|
-
style: {
|
|
15259
|
-
width: badgeSize,
|
|
15260
|
-
height: badgeSize,
|
|
15261
|
-
horizontalAlign: "left",
|
|
15262
|
-
verticalAlign: "bottom",
|
|
15263
|
-
borderRadius: badgeSize / 2,
|
|
15264
|
-
borderWidth: 1,
|
|
15265
|
-
borderColor: shades.dim
|
|
15266
|
-
}
|
|
15267
|
-
}
|
|
15268
|
-
};
|
|
15465
|
+
const badge = row.steamId === void 0 ? false : avatarBadge(row.steamId);
|
|
15466
|
+
const image = src === void 0 ? false : portraitImage(src);
|
|
15269
15467
|
const portrait = element(
|
|
15270
15468
|
"panel",
|
|
15271
15469
|
{
|
|
@@ -15278,13 +15476,7 @@ function rosterRow(row, index) {
|
|
|
15278
15476
|
element(
|
|
15279
15477
|
"panel",
|
|
15280
15478
|
{ width: "100%", height: "100%", background: shades.raised },
|
|
15281
|
-
[
|
|
15282
|
-
src && {
|
|
15283
|
-
type: "image",
|
|
15284
|
-
props: { src, style: { width: "100%", height: "100%" } }
|
|
15285
|
-
},
|
|
15286
|
-
badge
|
|
15287
|
-
]
|
|
15479
|
+
[image, badge]
|
|
15288
15480
|
)
|
|
15289
15481
|
);
|
|
15290
15482
|
const style = {
|
|
@@ -15310,6 +15502,29 @@ function rosterRow(row, index) {
|
|
|
15310
15502
|
} : element("panel", style, [text2, portrait], `row-${index}`);
|
|
15311
15503
|
return arriving(line2, { translate: [16, 0] });
|
|
15312
15504
|
}
|
|
15505
|
+
function portraitImage(src) {
|
|
15506
|
+
return {
|
|
15507
|
+
type: "image",
|
|
15508
|
+
props: { src, style: { width: "100%", height: "100%" } }
|
|
15509
|
+
};
|
|
15510
|
+
}
|
|
15511
|
+
function avatarBadge(steamId) {
|
|
15512
|
+
return {
|
|
15513
|
+
type: "avatar",
|
|
15514
|
+
props: {
|
|
15515
|
+
steamId,
|
|
15516
|
+
style: {
|
|
15517
|
+
width: badgeSize,
|
|
15518
|
+
height: badgeSize,
|
|
15519
|
+
horizontalAlign: "left",
|
|
15520
|
+
verticalAlign: "bottom",
|
|
15521
|
+
borderRadius: badgeSize / 2,
|
|
15522
|
+
borderWidth: 1,
|
|
15523
|
+
borderColor: shades.dim
|
|
15524
|
+
}
|
|
15525
|
+
}
|
|
15526
|
+
};
|
|
15527
|
+
}
|
|
15313
15528
|
var actionLooks = {
|
|
15314
15529
|
primary: {
|
|
15315
15530
|
idle: { background: tones.text },
|