@modlock/modlock 0.1.71 → 0.1.73
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/bystander.d.ts +9 -0
- package/cast.d.ts +12 -1
- package/hook.d.ts +3 -2
- package/host.gen.d.ts +89 -0
- package/index.d.ts +18 -1
- package/index.js +1345 -107
- package/package.json +6 -6
- package/rotation.d.ts +76 -0
- package/scores.d.ts +72 -0
- package/scriptc.d.ts +4 -5
- package/strays.d.ts +17 -0
package/index.js
CHANGED
|
@@ -2814,7 +2814,8 @@ var StartResult = /* @__PURE__ */ createMessageType(
|
|
|
2814
2814
|
[1, "frames", 8],
|
|
2815
2815
|
[2, "damage", 8],
|
|
2816
2816
|
[3, "damaged", 8],
|
|
2817
|
-
[4, "chat", 8]
|
|
2817
|
+
[4, "chat", 8],
|
|
2818
|
+
[5, "joins", 8]
|
|
2818
2819
|
],
|
|
2819
2820
|
{
|
|
2820
2821
|
decode: (r, end, m) => {
|
|
@@ -2834,6 +2835,9 @@ var StartResult = /* @__PURE__ */ createMessageType(
|
|
|
2834
2835
|
case 4:
|
|
2835
2836
|
m.chat = r.bool();
|
|
2836
2837
|
break;
|
|
2838
|
+
case 5:
|
|
2839
|
+
m.joins = r.bool();
|
|
2840
|
+
break;
|
|
2837
2841
|
default:
|
|
2838
2842
|
r.skip(t);
|
|
2839
2843
|
}
|
|
@@ -2857,6 +2861,10 @@ var StartResult = /* @__PURE__ */ createMessageType(
|
|
|
2857
2861
|
const v = m.chat;
|
|
2858
2862
|
if (v) w.uint32(32).bool(v);
|
|
2859
2863
|
}
|
|
2864
|
+
{
|
|
2865
|
+
const v = m.joins;
|
|
2866
|
+
if (v) w.uint32(40).bool(v);
|
|
2867
|
+
}
|
|
2860
2868
|
}
|
|
2861
2869
|
}
|
|
2862
2870
|
);
|
|
@@ -4440,6 +4448,58 @@ var HitOptions = /* @__PURE__ */ createMessageType(
|
|
|
4440
4448
|
}
|
|
4441
4449
|
}
|
|
4442
4450
|
);
|
|
4451
|
+
var KillOptions = /* @__PURE__ */ createMessageType(
|
|
4452
|
+
"modlock.wasm.combat.KillOptions",
|
|
4453
|
+
() => [
|
|
4454
|
+
[1, "victim", 13],
|
|
4455
|
+
[2, "attacker", 13, 4],
|
|
4456
|
+
[3, "inflictor", 13, 4],
|
|
4457
|
+
[4, "ability", 13, 4]
|
|
4458
|
+
],
|
|
4459
|
+
{
|
|
4460
|
+
decode: (r, end, m) => {
|
|
4461
|
+
while (r.pos < end) {
|
|
4462
|
+
const t = r.tag();
|
|
4463
|
+
if ((t & 7) === 4) return m;
|
|
4464
|
+
switch (t >>> 3) {
|
|
4465
|
+
case 1:
|
|
4466
|
+
m.victim = r.uint32();
|
|
4467
|
+
break;
|
|
4468
|
+
case 2:
|
|
4469
|
+
m.attacker = r.uint32();
|
|
4470
|
+
break;
|
|
4471
|
+
case 3:
|
|
4472
|
+
m.inflictor = r.uint32();
|
|
4473
|
+
break;
|
|
4474
|
+
case 4:
|
|
4475
|
+
m.ability = r.uint32();
|
|
4476
|
+
break;
|
|
4477
|
+
default:
|
|
4478
|
+
r.skip(t);
|
|
4479
|
+
}
|
|
4480
|
+
}
|
|
4481
|
+
return m;
|
|
4482
|
+
},
|
|
4483
|
+
encode: (m, w) => {
|
|
4484
|
+
{
|
|
4485
|
+
const v = m.victim;
|
|
4486
|
+
if (v) w.uint32(8).uint32(v);
|
|
4487
|
+
}
|
|
4488
|
+
{
|
|
4489
|
+
const v = m.attacker;
|
|
4490
|
+
if (v != null) w.uint32(16).uint32(v);
|
|
4491
|
+
}
|
|
4492
|
+
{
|
|
4493
|
+
const v = m.inflictor;
|
|
4494
|
+
if (v != null) w.uint32(24).uint32(v);
|
|
4495
|
+
}
|
|
4496
|
+
{
|
|
4497
|
+
const v = m.ability;
|
|
4498
|
+
if (v != null) w.uint32(32).uint32(v);
|
|
4499
|
+
}
|
|
4500
|
+
}
|
|
4501
|
+
}
|
|
4502
|
+
);
|
|
4443
4503
|
var TraceOptions = /* @__PURE__ */ createMessageType(
|
|
4444
4504
|
"modlock.wasm.combat.TraceOptions",
|
|
4445
4505
|
() => [
|
|
@@ -7989,6 +8049,132 @@ var ShowObjectOnlyToRequest = /* @__PURE__ */ createMessageType(
|
|
|
7989
8049
|
);
|
|
7990
8050
|
|
|
7991
8051
|
// src/wasm/players/players.pb.ts
|
|
8052
|
+
var DisconnectReason_Enum = /* @__PURE__ */ createEnumType(
|
|
8053
|
+
"modlock.wasm.players.DisconnectReason",
|
|
8054
|
+
[
|
|
8055
|
+
[0, "DISCONNECT_REASON_UNKNOWN"],
|
|
8056
|
+
[1, "DISCONNECT_REASON_SHUTDOWN"],
|
|
8057
|
+
[2, "DISCONNECT_REASON_DISCONNECT_BY_USER"],
|
|
8058
|
+
[3, "DISCONNECT_REASON_DISCONNECT_BY_SERVER"],
|
|
8059
|
+
[4, "DISCONNECT_REASON_LOST"],
|
|
8060
|
+
[5, "DISCONNECT_REASON_OVERFLOW"],
|
|
8061
|
+
[6, "DISCONNECT_REASON_STEAM_BANNED"],
|
|
8062
|
+
[7, "DISCONNECT_REASON_STEAM_INUSE"],
|
|
8063
|
+
[8, "DISCONNECT_REASON_STEAM_TICKET"],
|
|
8064
|
+
[9, "DISCONNECT_REASON_STEAM_LOGON"],
|
|
8065
|
+
[10, "DISCONNECT_REASON_STEAM_AUTHCANCELLED"],
|
|
8066
|
+
[11, "DISCONNECT_REASON_STEAM_AUTHALREADYUSED"],
|
|
8067
|
+
[12, "DISCONNECT_REASON_STEAM_AUTHINVALID"],
|
|
8068
|
+
[13, "DISCONNECT_REASON_STEAM_VACBANSTATE"],
|
|
8069
|
+
[14, "DISCONNECT_REASON_STEAM_LOGGED_IN_ELSEWHERE"],
|
|
8070
|
+
[15, "DISCONNECT_REASON_STEAM_VAC_CHECK_TIMEDOUT"],
|
|
8071
|
+
[16, "DISCONNECT_REASON_STEAM_DROPPED"],
|
|
8072
|
+
[17, "DISCONNECT_REASON_STEAM_OWNERSHIP"],
|
|
8073
|
+
[18, "DISCONNECT_REASON_SERVERINFO_OVERFLOW"],
|
|
8074
|
+
[19, "DISCONNECT_REASON_TICKMSG_OVERFLOW"],
|
|
8075
|
+
[20, "DISCONNECT_REASON_STRINGTABLEMSG_OVERFLOW"],
|
|
8076
|
+
[21, "DISCONNECT_REASON_DELTAENTMSG_OVERFLOW"],
|
|
8077
|
+
[22, "DISCONNECT_REASON_TEMPENTMSG_OVERFLOW"],
|
|
8078
|
+
[23, "DISCONNECT_REASON_SOUNDSMSG_OVERFLOW"],
|
|
8079
|
+
[24, "DISCONNECT_REASON_SNAPSHOTOVERFLOW"],
|
|
8080
|
+
[25, "DISCONNECT_REASON_SNAPSHOTERROR"],
|
|
8081
|
+
[26, "DISCONNECT_REASON_RELIABLEOVERFLOW"],
|
|
8082
|
+
[27, "DISCONNECT_REASON_BADDELTATICK"],
|
|
8083
|
+
[28, "DISCONNECT_REASON_NOMORESPLITS"],
|
|
8084
|
+
[29, "DISCONNECT_REASON_TIMEDOUT"],
|
|
8085
|
+
[30, "DISCONNECT_REASON_DISCONNECTED"],
|
|
8086
|
+
[31, "DISCONNECT_REASON_LEAVINGSPLIT"],
|
|
8087
|
+
[32, "DISCONNECT_REASON_DIFFERENTCLASSTABLES"],
|
|
8088
|
+
[33, "DISCONNECT_REASON_BADRELAYPASSWORD"],
|
|
8089
|
+
[34, "DISCONNECT_REASON_BADSPECTATORPASSWORD"],
|
|
8090
|
+
[35, "DISCONNECT_REASON_HLTVRESTRICTED"],
|
|
8091
|
+
[36, "DISCONNECT_REASON_NOSPECTATORS"],
|
|
8092
|
+
[37, "DISCONNECT_REASON_HLTVUNAVAILABLE"],
|
|
8093
|
+
[38, "DISCONNECT_REASON_HLTVSTOP"],
|
|
8094
|
+
[39, "DISCONNECT_REASON_KICKED"],
|
|
8095
|
+
[40, "DISCONNECT_REASON_BANADDED"],
|
|
8096
|
+
[41, "DISCONNECT_REASON_KICKBANADDED"],
|
|
8097
|
+
[42, "DISCONNECT_REASON_HLTVDIRECT"],
|
|
8098
|
+
[43, "DISCONNECT_REASON_PURESERVER_CLIENTEXTRA"],
|
|
8099
|
+
[44, "DISCONNECT_REASON_PURESERVER_MISMATCH"],
|
|
8100
|
+
[45, "DISCONNECT_REASON_USERCMD"],
|
|
8101
|
+
[46, "DISCONNECT_REASON_REJECTED_BY_GAME"],
|
|
8102
|
+
[47, "DISCONNECT_REASON_MESSAGE_PARSE_ERROR"],
|
|
8103
|
+
[48, "DISCONNECT_REASON_INVALID_MESSAGE_ERROR"],
|
|
8104
|
+
[49, "DISCONNECT_REASON_BAD_SERVER_PASSWORD"],
|
|
8105
|
+
[50, "DISCONNECT_REASON_DIRECT_CONNECT_RESERVATION"],
|
|
8106
|
+
[51, "DISCONNECT_REASON_CONNECTION_FAILURE"],
|
|
8107
|
+
[52, "DISCONNECT_REASON_NO_PEER_GROUP_HANDLERS"],
|
|
8108
|
+
[53, "DISCONNECT_REASON_RECONNECTION"],
|
|
8109
|
+
[54, "DISCONNECT_REASON_LOOPSHUTDOWN"],
|
|
8110
|
+
[55, "DISCONNECT_REASON_LOOPDEACTIVATE"],
|
|
8111
|
+
[56, "DISCONNECT_REASON_HOST_ENDGAME"],
|
|
8112
|
+
[57, "DISCONNECT_REASON_LOOP_LEVELLOAD_ACTIVATE"],
|
|
8113
|
+
[58, "DISCONNECT_REASON_CREATE_SERVER_FAILED"],
|
|
8114
|
+
[59, "DISCONNECT_REASON_EXITING"],
|
|
8115
|
+
[60, "DISCONNECT_REASON_REQUEST_HOSTSTATE_IDLE"],
|
|
8116
|
+
[61, "DISCONNECT_REASON_REQUEST_HOSTSTATE_HLTVRELAY"],
|
|
8117
|
+
[62, "DISCONNECT_REASON_CLIENT_CONSISTENCY_FAIL"],
|
|
8118
|
+
[63, "DISCONNECT_REASON_CLIENT_UNABLE_TO_CRC_MAP"],
|
|
8119
|
+
[64, "DISCONNECT_REASON_CLIENT_NO_MAP"],
|
|
8120
|
+
[65, "DISCONNECT_REASON_CLIENT_DIFFERENT_MAP"],
|
|
8121
|
+
[66, "DISCONNECT_REASON_SERVER_REQUIRES_STEAM"],
|
|
8122
|
+
[67, "DISCONNECT_REASON_STEAM_DENY_MISC"],
|
|
8123
|
+
[68, "DISCONNECT_REASON_STEAM_DENY_BAD_ANTI_CHEAT"],
|
|
8124
|
+
[69, "DISCONNECT_REASON_SERVER_SHUTDOWN"],
|
|
8125
|
+
[71, "DISCONNECT_REASON_REPLAY_INCOMPATIBLE"],
|
|
8126
|
+
[72, "DISCONNECT_REASON_CONNECT_REQUEST_TIMEDOUT"],
|
|
8127
|
+
[73, "DISCONNECT_REASON_SERVER_INCOMPATIBLE"],
|
|
8128
|
+
[74, "DISCONNECT_REASON_LOCALPROBLEM_MANYRELAYS"],
|
|
8129
|
+
[75, "DISCONNECT_REASON_LOCALPROBLEM_HOSTEDSERVERPRIMARYRELAY"],
|
|
8130
|
+
[76, "DISCONNECT_REASON_LOCALPROBLEM_NETWORKCONFIG"],
|
|
8131
|
+
[77, "DISCONNECT_REASON_LOCALPROBLEM_OTHER"],
|
|
8132
|
+
[79, "DISCONNECT_REASON_REMOTE_TIMEOUT"],
|
|
8133
|
+
[80, "DISCONNECT_REASON_REMOTE_TIMEOUT_CONNECTING"],
|
|
8134
|
+
[81, "DISCONNECT_REASON_REMOTE_OTHER"],
|
|
8135
|
+
[82, "DISCONNECT_REASON_REMOTE_BADCRYPT"],
|
|
8136
|
+
[83, "DISCONNECT_REASON_REMOTE_CERTNOTTRUSTED"],
|
|
8137
|
+
[84, "DISCONNECT_REASON_UNUSUAL"],
|
|
8138
|
+
[85, "DISCONNECT_REASON_INTERNAL_ERROR"],
|
|
8139
|
+
[128, "DISCONNECT_REASON_REJECT_BADCHALLENGE"],
|
|
8140
|
+
[129, "DISCONNECT_REASON_REJECT_NOLOBBY"],
|
|
8141
|
+
[130, "DISCONNECT_REASON_REJECT_BACKGROUND_MAP"],
|
|
8142
|
+
[131, "DISCONNECT_REASON_REJECT_SINGLE_PLAYER"],
|
|
8143
|
+
[132, "DISCONNECT_REASON_REJECT_HIDDEN_GAME"],
|
|
8144
|
+
[133, "DISCONNECT_REASON_REJECT_LANRESTRICT"],
|
|
8145
|
+
[134, "DISCONNECT_REASON_REJECT_BADPASSWORD"],
|
|
8146
|
+
[135, "DISCONNECT_REASON_REJECT_SERVERFULL"],
|
|
8147
|
+
[136, "DISCONNECT_REASON_REJECT_INVALIDRESERVATION"],
|
|
8148
|
+
[137, "DISCONNECT_REASON_REJECT_FAILEDCHANNEL"],
|
|
8149
|
+
[138, "DISCONNECT_REASON_REJECT_CONNECT_FROM_LOBBY"],
|
|
8150
|
+
[139, "DISCONNECT_REASON_REJECT_RESERVED_FOR_LOBBY"],
|
|
8151
|
+
[140, "DISCONNECT_REASON_REJECT_INVALIDKEYLENGTH"],
|
|
8152
|
+
[141, "DISCONNECT_REASON_REJECT_OLDPROTOCOL"],
|
|
8153
|
+
[142, "DISCONNECT_REASON_REJECT_NEWPROTOCOL"],
|
|
8154
|
+
[143, "DISCONNECT_REASON_REJECT_INVALIDCONNECTION"],
|
|
8155
|
+
[144, "DISCONNECT_REASON_REJECT_INVALIDCERTLEN"],
|
|
8156
|
+
[145, "DISCONNECT_REASON_REJECT_INVALIDSTEAMCERTLEN"],
|
|
8157
|
+
[146, "DISCONNECT_REASON_REJECT_STEAM"],
|
|
8158
|
+
[147, "DISCONNECT_REASON_REJECT_SERVERAUTHDISABLED"],
|
|
8159
|
+
[148, "DISCONNECT_REASON_REJECT_SERVERCDKEYAUTHINVALID"],
|
|
8160
|
+
[149, "DISCONNECT_REASON_REJECT_BANNED"],
|
|
8161
|
+
[150, "DISCONNECT_REASON_KICKED_TEAMKILLING"],
|
|
8162
|
+
[151, "DISCONNECT_REASON_KICKED_TK_START"],
|
|
8163
|
+
[152, "DISCONNECT_REASON_KICKED_UNTRUSTEDACCOUNT"],
|
|
8164
|
+
[153, "DISCONNECT_REASON_KICKED_CONVICTEDACCOUNT"],
|
|
8165
|
+
[154, "DISCONNECT_REASON_KICKED_COMPETITIVECOOLDOWN"],
|
|
8166
|
+
[155, "DISCONNECT_REASON_KICKED_TEAMHURTING"],
|
|
8167
|
+
[156, "DISCONNECT_REASON_KICKED_HOSTAGEKILLING"],
|
|
8168
|
+
[157, "DISCONNECT_REASON_KICKED_VOTEDOFF"],
|
|
8169
|
+
[158, "DISCONNECT_REASON_KICKED_IDLE"],
|
|
8170
|
+
[159, "DISCONNECT_REASON_KICKED_SUICIDE"],
|
|
8171
|
+
[160, "DISCONNECT_REASON_KICKED_NOSTEAMLOGIN"],
|
|
8172
|
+
[161, "DISCONNECT_REASON_KICKED_NOSTEAMTICKET"],
|
|
8173
|
+
[162, "DISCONNECT_REASON_KICKED_INPUTAUTOMATION"],
|
|
8174
|
+
[163, "DISCONNECT_REASON_KICKED_VACNETABNORMALBEHAVIOR"],
|
|
8175
|
+
[164, "DISCONNECT_REASON_KICKED_INSECURECLIENT"]
|
|
8176
|
+
]
|
|
8177
|
+
);
|
|
7992
8178
|
var ModRole_Enum = /* @__PURE__ */ createEnumType(
|
|
7993
8179
|
"modlock.wasm.players.ModRole",
|
|
7994
8180
|
[
|
|
@@ -8070,6 +8256,84 @@ var PlayersChangedEvent = /* @__PURE__ */ createMessageType(
|
|
|
8070
8256
|
}
|
|
8071
8257
|
}
|
|
8072
8258
|
);
|
|
8259
|
+
var PlayerJoinedEvent = /* @__PURE__ */ createMessageType(
|
|
8260
|
+
"modlock.wasm.players.PlayerJoinedEvent",
|
|
8261
|
+
() => [[1, "connection", 11, 0, Connection.codec]],
|
|
8262
|
+
{
|
|
8263
|
+
decode: (r, end, m) => {
|
|
8264
|
+
while (r.pos < end) {
|
|
8265
|
+
const t = r.tag();
|
|
8266
|
+
if ((t & 7) === 4) return m;
|
|
8267
|
+
switch (t >>> 3) {
|
|
8268
|
+
case 1:
|
|
8269
|
+
m.connection = Connection.decode(
|
|
8270
|
+
r,
|
|
8271
|
+
r.delimited(),
|
|
8272
|
+
m.connection ?? {}
|
|
8273
|
+
);
|
|
8274
|
+
break;
|
|
8275
|
+
default:
|
|
8276
|
+
r.skip(t);
|
|
8277
|
+
}
|
|
8278
|
+
}
|
|
8279
|
+
return m;
|
|
8280
|
+
},
|
|
8281
|
+
encode: (m, w) => {
|
|
8282
|
+
{
|
|
8283
|
+
const v = m.connection;
|
|
8284
|
+
if (v != null) Connection.writeField(w, 1, v);
|
|
8285
|
+
}
|
|
8286
|
+
}
|
|
8287
|
+
}
|
|
8288
|
+
);
|
|
8289
|
+
var PlayerLeftEvent = /* @__PURE__ */ createMessageType(
|
|
8290
|
+
"modlock.wasm.players.PlayerLeftEvent",
|
|
8291
|
+
() => [
|
|
8292
|
+
[1, "connection", 11, 0, Connection.codec],
|
|
8293
|
+
[2, "disconnected", 8],
|
|
8294
|
+
[3, "reason", 14, 4, DisconnectReason_Enum]
|
|
8295
|
+
],
|
|
8296
|
+
{
|
|
8297
|
+
decode: (r, end, m) => {
|
|
8298
|
+
while (r.pos < end) {
|
|
8299
|
+
const t = r.tag();
|
|
8300
|
+
if ((t & 7) === 4) return m;
|
|
8301
|
+
switch (t >>> 3) {
|
|
8302
|
+
case 1:
|
|
8303
|
+
m.connection = Connection.decode(
|
|
8304
|
+
r,
|
|
8305
|
+
r.delimited(),
|
|
8306
|
+
m.connection ?? {}
|
|
8307
|
+
);
|
|
8308
|
+
break;
|
|
8309
|
+
case 2:
|
|
8310
|
+
m.disconnected = r.bool();
|
|
8311
|
+
break;
|
|
8312
|
+
case 3:
|
|
8313
|
+
m.reason = r.int32();
|
|
8314
|
+
break;
|
|
8315
|
+
default:
|
|
8316
|
+
r.skip(t);
|
|
8317
|
+
}
|
|
8318
|
+
}
|
|
8319
|
+
return m;
|
|
8320
|
+
},
|
|
8321
|
+
encode: (m, w) => {
|
|
8322
|
+
{
|
|
8323
|
+
const v = m.connection;
|
|
8324
|
+
if (v != null) Connection.writeField(w, 1, v);
|
|
8325
|
+
}
|
|
8326
|
+
{
|
|
8327
|
+
const v = m.disconnected;
|
|
8328
|
+
if (v) w.uint32(16).bool(v);
|
|
8329
|
+
}
|
|
8330
|
+
{
|
|
8331
|
+
const v = m.reason;
|
|
8332
|
+
if (v != null) w.uint32(24).int32(v);
|
|
8333
|
+
}
|
|
8334
|
+
}
|
|
8335
|
+
}
|
|
8336
|
+
);
|
|
8073
8337
|
var PlayerRequest = /* @__PURE__ */ createMessageType(
|
|
8074
8338
|
"modlock.wasm.players.PlayerRequest",
|
|
8075
8339
|
() => [[1, "player", 5]],
|
|
@@ -11451,7 +11715,8 @@ var Change = /* @__PURE__ */ createMessageType(
|
|
|
11451
11715
|
() => [
|
|
11452
11716
|
[1, "reset", 8],
|
|
11453
11717
|
[2, "set", 11, 1, Node.codec],
|
|
11454
|
-
[3, "removed", 9, 1]
|
|
11718
|
+
[3, "removed", 9, 1],
|
|
11719
|
+
[4, "generation", 4]
|
|
11455
11720
|
],
|
|
11456
11721
|
{
|
|
11457
11722
|
decode: (r, end, m) => {
|
|
@@ -11470,6 +11735,9 @@ var Change = /* @__PURE__ */ createMessageType(
|
|
|
11470
11735
|
;
|
|
11471
11736
|
(m.removed ??= []).push(r.string());
|
|
11472
11737
|
break;
|
|
11738
|
+
case 4:
|
|
11739
|
+
m.generation = r.uint64();
|
|
11740
|
+
break;
|
|
11473
11741
|
default:
|
|
11474
11742
|
r.skip(t);
|
|
11475
11743
|
}
|
|
@@ -11489,6 +11757,10 @@ var Change = /* @__PURE__ */ createMessageType(
|
|
|
11489
11757
|
const a = m.removed;
|
|
11490
11758
|
if (a != null) for (const e of a) w.uint32(26).string(e);
|
|
11491
11759
|
}
|
|
11760
|
+
{
|
|
11761
|
+
const v = m.generation;
|
|
11762
|
+
if (v) w.uint32(32).uint64(v);
|
|
11763
|
+
}
|
|
11492
11764
|
}
|
|
11493
11765
|
}
|
|
11494
11766
|
);
|
|
@@ -11736,6 +12008,128 @@ var textVerticalAlignValues = {
|
|
|
11736
12008
|
center: 1,
|
|
11737
12009
|
top: 2
|
|
11738
12010
|
};
|
|
12011
|
+
var disconnectReasonNames = {
|
|
12012
|
+
1: "shutdown",
|
|
12013
|
+
2: "disconnectByUser",
|
|
12014
|
+
3: "disconnectByServer",
|
|
12015
|
+
4: "lost",
|
|
12016
|
+
5: "overflow",
|
|
12017
|
+
6: "steamBanned",
|
|
12018
|
+
7: "steamInuse",
|
|
12019
|
+
8: "steamTicket",
|
|
12020
|
+
9: "steamLogon",
|
|
12021
|
+
10: "steamAuthcancelled",
|
|
12022
|
+
11: "steamAuthalreadyused",
|
|
12023
|
+
12: "steamAuthinvalid",
|
|
12024
|
+
13: "steamVacbanstate",
|
|
12025
|
+
14: "steamLoggedInElsewhere",
|
|
12026
|
+
15: "steamVacCheckTimedout",
|
|
12027
|
+
16: "steamDropped",
|
|
12028
|
+
17: "steamOwnership",
|
|
12029
|
+
18: "serverinfoOverflow",
|
|
12030
|
+
19: "tickmsgOverflow",
|
|
12031
|
+
20: "stringtablemsgOverflow",
|
|
12032
|
+
21: "deltaentmsgOverflow",
|
|
12033
|
+
22: "tempentmsgOverflow",
|
|
12034
|
+
23: "soundsmsgOverflow",
|
|
12035
|
+
24: "snapshotoverflow",
|
|
12036
|
+
25: "snapshoterror",
|
|
12037
|
+
26: "reliableoverflow",
|
|
12038
|
+
27: "baddeltatick",
|
|
12039
|
+
28: "nomoresplits",
|
|
12040
|
+
29: "timedout",
|
|
12041
|
+
30: "disconnected",
|
|
12042
|
+
31: "leavingsplit",
|
|
12043
|
+
32: "differentclasstables",
|
|
12044
|
+
33: "badrelaypassword",
|
|
12045
|
+
34: "badspectatorpassword",
|
|
12046
|
+
35: "hltvrestricted",
|
|
12047
|
+
36: "nospectators",
|
|
12048
|
+
37: "hltvunavailable",
|
|
12049
|
+
38: "hltvstop",
|
|
12050
|
+
39: "kicked",
|
|
12051
|
+
40: "banadded",
|
|
12052
|
+
41: "kickbanadded",
|
|
12053
|
+
42: "hltvdirect",
|
|
12054
|
+
43: "pureserverClientextra",
|
|
12055
|
+
44: "pureserverMismatch",
|
|
12056
|
+
45: "usercmd",
|
|
12057
|
+
46: "rejectedByGame",
|
|
12058
|
+
47: "messageParseError",
|
|
12059
|
+
48: "invalidMessageError",
|
|
12060
|
+
49: "badServerPassword",
|
|
12061
|
+
50: "directConnectReservation",
|
|
12062
|
+
51: "connectionFailure",
|
|
12063
|
+
52: "noPeerGroupHandlers",
|
|
12064
|
+
53: "reconnection",
|
|
12065
|
+
54: "loopshutdown",
|
|
12066
|
+
55: "loopdeactivate",
|
|
12067
|
+
56: "hostEndgame",
|
|
12068
|
+
57: "loopLevelloadActivate",
|
|
12069
|
+
58: "createServerFailed",
|
|
12070
|
+
59: "exiting",
|
|
12071
|
+
60: "requestHoststateIdle",
|
|
12072
|
+
61: "requestHoststateHltvrelay",
|
|
12073
|
+
62: "clientConsistencyFail",
|
|
12074
|
+
63: "clientUnableToCrcMap",
|
|
12075
|
+
64: "clientNoMap",
|
|
12076
|
+
65: "clientDifferentMap",
|
|
12077
|
+
66: "serverRequiresSteam",
|
|
12078
|
+
67: "steamDenyMisc",
|
|
12079
|
+
68: "steamDenyBadAntiCheat",
|
|
12080
|
+
69: "serverShutdown",
|
|
12081
|
+
71: "replayIncompatible",
|
|
12082
|
+
72: "connectRequestTimedout",
|
|
12083
|
+
73: "serverIncompatible",
|
|
12084
|
+
74: "localproblemManyrelays",
|
|
12085
|
+
75: "localproblemHostedserverprimaryrelay",
|
|
12086
|
+
76: "localproblemNetworkconfig",
|
|
12087
|
+
77: "localproblemOther",
|
|
12088
|
+
79: "remoteTimeout",
|
|
12089
|
+
80: "remoteTimeoutConnecting",
|
|
12090
|
+
81: "remoteOther",
|
|
12091
|
+
82: "remoteBadcrypt",
|
|
12092
|
+
83: "remoteCertnottrusted",
|
|
12093
|
+
84: "unusual",
|
|
12094
|
+
85: "internalError",
|
|
12095
|
+
128: "rejectBadchallenge",
|
|
12096
|
+
129: "rejectNolobby",
|
|
12097
|
+
130: "rejectBackgroundMap",
|
|
12098
|
+
131: "rejectSinglePlayer",
|
|
12099
|
+
132: "rejectHiddenGame",
|
|
12100
|
+
133: "rejectLanrestrict",
|
|
12101
|
+
134: "rejectBadpassword",
|
|
12102
|
+
135: "rejectServerfull",
|
|
12103
|
+
136: "rejectInvalidreservation",
|
|
12104
|
+
137: "rejectFailedchannel",
|
|
12105
|
+
138: "rejectConnectFromLobby",
|
|
12106
|
+
139: "rejectReservedForLobby",
|
|
12107
|
+
140: "rejectInvalidkeylength",
|
|
12108
|
+
141: "rejectOldprotocol",
|
|
12109
|
+
142: "rejectNewprotocol",
|
|
12110
|
+
143: "rejectInvalidconnection",
|
|
12111
|
+
144: "rejectInvalidcertlen",
|
|
12112
|
+
145: "rejectInvalidsteamcertlen",
|
|
12113
|
+
146: "rejectSteam",
|
|
12114
|
+
147: "rejectServerauthdisabled",
|
|
12115
|
+
148: "rejectServercdkeyauthinvalid",
|
|
12116
|
+
149: "rejectBanned",
|
|
12117
|
+
150: "kickedTeamkilling",
|
|
12118
|
+
151: "kickedTkStart",
|
|
12119
|
+
152: "kickedUntrustedaccount",
|
|
12120
|
+
153: "kickedConvictedaccount",
|
|
12121
|
+
154: "kickedCompetitivecooldown",
|
|
12122
|
+
155: "kickedTeamhurting",
|
|
12123
|
+
156: "kickedHostagekilling",
|
|
12124
|
+
157: "kickedVotedoff",
|
|
12125
|
+
158: "kickedIdle",
|
|
12126
|
+
159: "kickedSuicide",
|
|
12127
|
+
160: "kickedNosteamlogin",
|
|
12128
|
+
161: "kickedNosteamticket",
|
|
12129
|
+
162: "kickedInputautomation",
|
|
12130
|
+
163: "kickedVacnetabnormalbehavior",
|
|
12131
|
+
164: "kickedInsecureclient"
|
|
12132
|
+
};
|
|
11739
12133
|
var modRoleNames = {
|
|
11740
12134
|
0: "unspecified",
|
|
11741
12135
|
1: "developer",
|
|
@@ -11813,7 +12207,7 @@ function fromLaunchEvent(message) {
|
|
|
11813
12207
|
entity: message.entity ?? 0,
|
|
11814
12208
|
name: message.name ?? "",
|
|
11815
12209
|
owner: message.owner ?? 0,
|
|
11816
|
-
player:
|
|
12210
|
+
player: Player.of(message.player ?? 0),
|
|
11817
12211
|
position: vector(message.position)
|
|
11818
12212
|
};
|
|
11819
12213
|
}
|
|
@@ -11822,7 +12216,7 @@ function fromImpactEvent(message) {
|
|
|
11822
12216
|
entity: message.entity ?? 0,
|
|
11823
12217
|
name: message.name ?? "",
|
|
11824
12218
|
owner: message.owner ?? 0,
|
|
11825
|
-
player:
|
|
12219
|
+
player: Player.of(message.player ?? 0),
|
|
11826
12220
|
start: vector(message.start),
|
|
11827
12221
|
end: vector(message.end),
|
|
11828
12222
|
position: vector(message.position),
|
|
@@ -11863,7 +12257,7 @@ function fromTraceHit(message) {
|
|
|
11863
12257
|
};
|
|
11864
12258
|
}
|
|
11865
12259
|
function toFieldValue(value) {
|
|
11866
|
-
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 } : { case: "vector", value } };
|
|
12260
|
+
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 };
|
|
11867
12261
|
}
|
|
11868
12262
|
function fromFieldValue(message) {
|
|
11869
12263
|
const value = message?.value;
|
|
@@ -11923,7 +12317,7 @@ function toEntityValue(value) {
|
|
|
11923
12317
|
}
|
|
11924
12318
|
function fromInputEvent(message) {
|
|
11925
12319
|
return {
|
|
11926
|
-
player:
|
|
12320
|
+
player: Player.of(message.player ?? 0),
|
|
11927
12321
|
pressed: message.pressed ?? 0n,
|
|
11928
12322
|
released: message.released ?? 0n
|
|
11929
12323
|
};
|
|
@@ -11940,7 +12334,7 @@ function fromRiftState(message) {
|
|
|
11940
12334
|
}
|
|
11941
12335
|
function fromMovementSample(message) {
|
|
11942
12336
|
return {
|
|
11943
|
-
player:
|
|
12337
|
+
player: Player.of(message.player ?? 0),
|
|
11944
12338
|
pawn: message.pawn ?? 0,
|
|
11945
12339
|
position: vector(message.position),
|
|
11946
12340
|
velocity: vector(message.velocity),
|
|
@@ -11988,7 +12382,7 @@ function fromMovementCommand(message) {
|
|
|
11988
12382
|
}
|
|
11989
12383
|
function fromLandedEvent(message) {
|
|
11990
12384
|
return {
|
|
11991
|
-
player:
|
|
12385
|
+
player: Player.of(message.player ?? 0),
|
|
11992
12386
|
on: message.on ?? 0,
|
|
11993
12387
|
speed: message.speed ?? 0
|
|
11994
12388
|
};
|
|
@@ -12073,7 +12467,7 @@ function toParticlePoint(value) {
|
|
|
12073
12467
|
}
|
|
12074
12468
|
function fromRestoredEvent(message) {
|
|
12075
12469
|
return {
|
|
12076
|
-
player:
|
|
12470
|
+
player: Player.of(message.player ?? 0),
|
|
12077
12471
|
error: message.error ?? ""
|
|
12078
12472
|
};
|
|
12079
12473
|
}
|
|
@@ -12082,9 +12476,21 @@ function fromPlayersChangedEvent(message) {
|
|
|
12082
12476
|
players: (message.players ?? []).map((v) => fromConnection(v))
|
|
12083
12477
|
};
|
|
12084
12478
|
}
|
|
12479
|
+
function fromPlayerJoinedEvent(message) {
|
|
12480
|
+
return {
|
|
12481
|
+
connection: fromConnection(message.connection ?? {})
|
|
12482
|
+
};
|
|
12483
|
+
}
|
|
12484
|
+
function fromPlayerLeftEvent(message) {
|
|
12485
|
+
return {
|
|
12486
|
+
connection: fromConnection(message.connection ?? {}),
|
|
12487
|
+
disconnected: message.disconnected ?? false,
|
|
12488
|
+
reason: message.reason === void 0 ? void 0 : disconnectReasonNames[message.reason]
|
|
12489
|
+
};
|
|
12490
|
+
}
|
|
12085
12491
|
function fromConnection(message) {
|
|
12086
12492
|
return {
|
|
12087
|
-
player:
|
|
12493
|
+
player: Player.of(message.player ?? 0),
|
|
12088
12494
|
steamId: message.steamId ?? 0n,
|
|
12089
12495
|
name: message.name ?? "",
|
|
12090
12496
|
bot: message.bot ?? false,
|
|
@@ -12128,7 +12534,7 @@ function fromScore(message) {
|
|
|
12128
12534
|
};
|
|
12129
12535
|
}
|
|
12130
12536
|
function toCameraValue(value) {
|
|
12131
|
-
return { value: typeof value === "number" ? { case: "number", value } : { case: "position", value } };
|
|
12537
|
+
return { value: typeof value === "number" ? { case: "number", value } : typeof value === "object" ? { case: "position", value } : void 0 };
|
|
12132
12538
|
}
|
|
12133
12539
|
function toCameraMotion(value) {
|
|
12134
12540
|
if ("hold" in value) return { motion: { case: "hold", value: value.hold } };
|
|
@@ -12212,13 +12618,13 @@ function toBotOptions(value) {
|
|
|
12212
12618
|
return {
|
|
12213
12619
|
name: value.name,
|
|
12214
12620
|
team: int32(value.team),
|
|
12215
|
-
hero: value.hero === void 0 ? void 0 : typeof value.hero === "string" ? { case: "heroName", value: value.hero } : { case: "heroId", value: value.hero },
|
|
12621
|
+
hero: value.hero === void 0 ? void 0 : typeof value.hero === "string" ? { case: "heroName", value: value.hero } : typeof value.hero === "number" ? { case: "heroId", value: value.hero } : void 0,
|
|
12216
12622
|
position: value.position
|
|
12217
12623
|
};
|
|
12218
12624
|
}
|
|
12219
12625
|
function fromSettingChangedEvent(message) {
|
|
12220
12626
|
return {
|
|
12221
|
-
player:
|
|
12627
|
+
player: Player.of(message.player ?? 0),
|
|
12222
12628
|
key: message.key ?? "",
|
|
12223
12629
|
value: message.value ?? ""
|
|
12224
12630
|
};
|
|
@@ -12231,13 +12637,13 @@ function fromWheel(message) {
|
|
|
12231
12637
|
}
|
|
12232
12638
|
function fromUiPressEvent(message) {
|
|
12233
12639
|
return {
|
|
12234
|
-
player:
|
|
12640
|
+
player: Player.of(message.player ?? 0),
|
|
12235
12641
|
node: message.node ?? ""
|
|
12236
12642
|
};
|
|
12237
12643
|
}
|
|
12238
12644
|
function fromUiInputEvent(message) {
|
|
12239
12645
|
return {
|
|
12240
|
-
player:
|
|
12646
|
+
player: Player.of(message.player ?? 0),
|
|
12241
12647
|
node: message.node ?? "",
|
|
12242
12648
|
value: message.value?.case === "wheel" ? fromWheel(message.value.value) : message.value?.value
|
|
12243
12649
|
};
|
|
@@ -12259,13 +12665,13 @@ function fromFrameEvent(message) {
|
|
|
12259
12665
|
}
|
|
12260
12666
|
function fromCommandEvent(message) {
|
|
12261
12667
|
return {
|
|
12262
|
-
player:
|
|
12668
|
+
player: Player.of(message.player ?? 0),
|
|
12263
12669
|
line: message.line ?? ""
|
|
12264
12670
|
};
|
|
12265
12671
|
}
|
|
12266
12672
|
function fromChatEvent(message) {
|
|
12267
12673
|
return {
|
|
12268
|
-
player:
|
|
12674
|
+
player: Player.of(message.player ?? 0),
|
|
12269
12675
|
text: message.text ?? "",
|
|
12270
12676
|
all: message.all ?? false,
|
|
12271
12677
|
lane: message.lane ?? 0
|
|
@@ -12289,12 +12695,31 @@ function toPrecacheOptions(value) {
|
|
|
12289
12695
|
resources: value.resources?.slice()
|
|
12290
12696
|
};
|
|
12291
12697
|
}
|
|
12292
|
-
var
|
|
12698
|
+
var playerObjects = /* @__PURE__ */ new Map();
|
|
12699
|
+
var Player = class _Player {
|
|
12293
12700
|
/** slot identifies the player on the server. */
|
|
12294
12701
|
slot;
|
|
12295
12702
|
constructor(slot) {
|
|
12296
12703
|
this.slot = slot;
|
|
12297
12704
|
}
|
|
12705
|
+
/**
|
|
12706
|
+
* of returns the Player for slot, the same object each time until release
|
|
12707
|
+
* forgets it, so === tells whether two values are the same player.
|
|
12708
|
+
*/
|
|
12709
|
+
static of(slot) {
|
|
12710
|
+
let object = playerObjects.get(slot);
|
|
12711
|
+
if (object === void 0) {
|
|
12712
|
+
object = new _Player(slot);
|
|
12713
|
+
playerObjects.set(slot, object);
|
|
12714
|
+
}
|
|
12715
|
+
return object;
|
|
12716
|
+
}
|
|
12717
|
+
/**
|
|
12718
|
+
* release forgets the Player for slot, so the next Player.of makes a new one.
|
|
12719
|
+
*/
|
|
12720
|
+
static release(slot) {
|
|
12721
|
+
playerObjects.delete(slot);
|
|
12722
|
+
}
|
|
12298
12723
|
/** chat sends a server chat line to the player. */
|
|
12299
12724
|
chat(text2) {
|
|
12300
12725
|
return call("Chat", ChatRequest.toBinary({ player: this.slot, text: text2 })) !== void 0;
|
|
@@ -12366,7 +12791,7 @@ var Player = class {
|
|
|
12366
12791
|
* frame.
|
|
12367
12792
|
*/
|
|
12368
12793
|
selectHero(hero, team) {
|
|
12369
|
-
const reply2 = call("SelectHero", SelectHeroRequest.toBinary({ player: this.slot, hero: typeof hero === "string" ? { case: "heroName", value: hero } : { case: "heroId", value: hero }, team: int32(team) }));
|
|
12794
|
+
const reply2 = call("SelectHero", SelectHeroRequest.toBinary({ player: this.slot, hero: typeof hero === "string" ? { case: "heroName", value: hero } : typeof hero === "number" ? { case: "heroId", value: hero } : void 0, team: int32(team) }));
|
|
12370
12795
|
if (reply2 === void 0) return void 0;
|
|
12371
12796
|
const response = HeroResponse.fromBinary(reply2);
|
|
12372
12797
|
return response.hero ?? 0;
|
|
@@ -12925,7 +13350,7 @@ function addBot(options) {
|
|
|
12925
13350
|
const reply2 = call("AddBot", BotOptions.toBinary(toBotOptions(options)));
|
|
12926
13351
|
if (reply2 === void 0) return void 0;
|
|
12927
13352
|
const response = BotResponse.fromBinary(reply2);
|
|
12928
|
-
return
|
|
13353
|
+
return Player.of(response.player ?? 0);
|
|
12929
13354
|
}
|
|
12930
13355
|
function blockInput(buttons) {
|
|
12931
13356
|
return call("BlockInput", InputRequest.toBinary({ buttons })) !== void 0;
|
|
@@ -12936,8 +13361,8 @@ function watchInput(buttons) {
|
|
|
12936
13361
|
function remapInput(from, to, repeat2) {
|
|
12937
13362
|
return call("RemapInput", RemapInputRequest.toBinary({ from, to, repeat: repeat2 })) !== void 0;
|
|
12938
13363
|
}
|
|
12939
|
-
function callService(
|
|
12940
|
-
const reply2 = call("CallService", ServiceCall.toBinary({ service, method, payload }));
|
|
13364
|
+
function callService(service2, method, payload) {
|
|
13365
|
+
const reply2 = call("CallService", ServiceCall.toBinary({ service: service2, method, payload }));
|
|
12941
13366
|
if (reply2 === void 0) return void 0;
|
|
12942
13367
|
const response = ServiceReply.fromBinary(reply2);
|
|
12943
13368
|
return response.payload ?? new Uint8Array();
|
|
@@ -13002,6 +13427,9 @@ function clearMap() {
|
|
|
13002
13427
|
function damage(options) {
|
|
13003
13428
|
return call("Damage", HitOptions.toBinary(toHitOptions(options))) !== void 0;
|
|
13004
13429
|
}
|
|
13430
|
+
function killEntity(options) {
|
|
13431
|
+
return call("KillEntity", KillOptions.toBinary(options)) !== void 0;
|
|
13432
|
+
}
|
|
13005
13433
|
function trace(options) {
|
|
13006
13434
|
const reply2 = call("Trace", TraceOptions.toBinary(toTraceOptions(options)));
|
|
13007
13435
|
if (reply2 === void 0) return void 0;
|
|
@@ -13096,6 +13524,12 @@ function serveMod(handlers2, bytes) {
|
|
|
13096
13524
|
case "SettingChanged":
|
|
13097
13525
|
handlers2.settingChanged(fromSettingChangedEvent(SettingChangedEvent.fromBinary(input2)));
|
|
13098
13526
|
return reply();
|
|
13527
|
+
case "PlayerJoined":
|
|
13528
|
+
handlers2.playerJoined(fromPlayerJoinedEvent(PlayerJoinedEvent.fromBinary(input2)));
|
|
13529
|
+
return reply();
|
|
13530
|
+
case "PlayerLeft":
|
|
13531
|
+
handlers2.playerLeft(fromPlayerLeftEvent(PlayerLeftEvent.fromBinary(input2)));
|
|
13532
|
+
return reply();
|
|
13099
13533
|
case "PlayersChanged":
|
|
13100
13534
|
handlers2.playersChanged(fromPlayersChangedEvent(PlayersChangedEvent.fromBinary(input2)));
|
|
13101
13535
|
return reply();
|
|
@@ -13108,12 +13542,25 @@ function serveMod(handlers2, bytes) {
|
|
|
13108
13542
|
|
|
13109
13543
|
// js/src/players.ts
|
|
13110
13544
|
var roster = void 0;
|
|
13545
|
+
var generations = /* @__PURE__ */ new Map();
|
|
13111
13546
|
var watchers = [];
|
|
13112
13547
|
function keepPlayers(players2) {
|
|
13113
|
-
roster = players2;
|
|
13548
|
+
roster = adopt(players2);
|
|
13114
13549
|
for (const watcher of watchers) {
|
|
13115
|
-
watcher(
|
|
13550
|
+
watcher(roster);
|
|
13551
|
+
}
|
|
13552
|
+
}
|
|
13553
|
+
function adopt(players2) {
|
|
13554
|
+
const current = new Map(players2.map((c) => [c.player.slot, c.generation]));
|
|
13555
|
+
for (const [slot, generation] of generations) {
|
|
13556
|
+
if (current.get(slot) !== generation) Player.release(slot);
|
|
13116
13557
|
}
|
|
13558
|
+
generations.clear();
|
|
13559
|
+
return players2.map((c) => {
|
|
13560
|
+
generations.set(c.player.slot, c.generation);
|
|
13561
|
+
const player = Player.of(c.player.slot);
|
|
13562
|
+
return player === c.player ? c : { ...c, player };
|
|
13563
|
+
});
|
|
13117
13564
|
}
|
|
13118
13565
|
function watchPlayers(watcher) {
|
|
13119
13566
|
watchers.push(watcher);
|
|
@@ -13123,15 +13570,17 @@ function players() {
|
|
|
13123
13570
|
if (roster !== void 0) return roster.slice();
|
|
13124
13571
|
const reply2 = call("Players", new Uint8Array());
|
|
13125
13572
|
if (reply2 === void 0) return [];
|
|
13126
|
-
return (
|
|
13127
|
-
|
|
13128
|
-
|
|
13129
|
-
|
|
13130
|
-
|
|
13131
|
-
|
|
13132
|
-
|
|
13133
|
-
|
|
13134
|
-
|
|
13573
|
+
return adopt(
|
|
13574
|
+
(PlayersResponse.fromBinary(reply2).players ?? []).map((c) => ({
|
|
13575
|
+
player: Player.of(c.player ?? 0),
|
|
13576
|
+
steamId: c.steamId ?? 0n,
|
|
13577
|
+
name: c.name ?? "",
|
|
13578
|
+
bot: c.bot ?? false,
|
|
13579
|
+
ready: c.ready ?? false,
|
|
13580
|
+
generation: c.generation ?? 0,
|
|
13581
|
+
roles: (c.roles ?? []).flatMap((role) => roleNames[role] ?? [])
|
|
13582
|
+
}))
|
|
13583
|
+
);
|
|
13135
13584
|
}
|
|
13136
13585
|
var roleNames = {
|
|
13137
13586
|
[1 /* DEVELOPER */]: "developer",
|
|
@@ -13743,10 +14192,8 @@ var Layout = class {
|
|
|
13743
14192
|
}
|
|
13744
14193
|
/** add records a node. */
|
|
13745
14194
|
add(node) {
|
|
13746
|
-
const
|
|
13747
|
-
|
|
13748
|
-
(_, value) => typeof value === "bigint" ? String(value) : value
|
|
13749
|
-
);
|
|
14195
|
+
const value = node.steamId === void 0 ? node : { ...node, steamId: String(node.steamId) };
|
|
14196
|
+
const encoded = JSON.stringify(value);
|
|
13750
14197
|
this.screen.nodes.set(node.id, { node, encoded });
|
|
13751
14198
|
}
|
|
13752
14199
|
/** id returns the node id for the element at place. */
|
|
@@ -15132,10 +15579,11 @@ var Hook = class {
|
|
|
15132
15579
|
/**
|
|
15133
15580
|
* update reads the thrower's hook at game time now, keeps it fully upgraded
|
|
15134
15581
|
* and sets the length of any cooldown a throw started. It reports nothing
|
|
15135
|
-
* for a hero without the hook.
|
|
15582
|
+
* for a hero without the hook. A caller that already read this frame's
|
|
15583
|
+
* abilities passes them to avoid another read.
|
|
15136
15584
|
*/
|
|
15137
|
-
update(player, now4) {
|
|
15138
|
-
const ability =
|
|
15585
|
+
update(player, now4, abilities = player.abilities()) {
|
|
15586
|
+
const ability = abilities.find((a) => a.name === hookAbility);
|
|
15139
15587
|
if (!ability) {
|
|
15140
15588
|
return void 0;
|
|
15141
15589
|
}
|
|
@@ -15464,7 +15912,7 @@ var badgeSize = 18;
|
|
|
15464
15912
|
var portraits = new Map(heroes.map((hero) => [hero.id, hero.portrait]));
|
|
15465
15913
|
function rosterKey(rows) {
|
|
15466
15914
|
return rows.slice(0, rosterRows).map(
|
|
15467
|
-
(
|
|
15915
|
+
(row2) => `${row2.self ? "*" : ""}${row2.selected ? "+" : ""}${row2.onPress ? ">" : ""}${row2.name} ${row2.hero} ${row2.activity} ${row2.steamId ?? ""}`
|
|
15468
15916
|
).join("\n");
|
|
15469
15917
|
}
|
|
15470
15918
|
function Roster(props) {
|
|
@@ -15482,7 +15930,7 @@ function Roster(props) {
|
|
|
15482
15930
|
props.rows.slice(0, rosterRows).map(rosterRow)
|
|
15483
15931
|
);
|
|
15484
15932
|
}
|
|
15485
|
-
function rosterRow(
|
|
15933
|
+
function rosterRow(row2, index) {
|
|
15486
15934
|
const right = { horizontalAlign: "right", textAlign: "right" };
|
|
15487
15935
|
const text2 = element(
|
|
15488
15936
|
"panel",
|
|
@@ -15492,18 +15940,18 @@ function rosterRow(row, index) {
|
|
|
15492
15940
|
role: "label",
|
|
15493
15941
|
tone: "text",
|
|
15494
15942
|
style: right,
|
|
15495
|
-
children: clip(
|
|
15943
|
+
children: clip(row2.name.toUpperCase(), rosterName)
|
|
15496
15944
|
}),
|
|
15497
15945
|
Text({
|
|
15498
15946
|
role: "caption",
|
|
15499
15947
|
tone: "muted",
|
|
15500
15948
|
style: { ...right, margin: [1, 0, 0, 0] },
|
|
15501
|
-
children:
|
|
15949
|
+
children: row2.activity
|
|
15502
15950
|
})
|
|
15503
15951
|
]
|
|
15504
15952
|
);
|
|
15505
|
-
const src = portraits.get(
|
|
15506
|
-
const badge =
|
|
15953
|
+
const src = portraits.get(row2.hero);
|
|
15954
|
+
const badge = row2.steamId === void 0 ? false : avatarBadge(row2.steamId);
|
|
15507
15955
|
const image = src === void 0 ? false : portraitImage(src);
|
|
15508
15956
|
const portrait = element(
|
|
15509
15957
|
"panel",
|
|
@@ -15512,7 +15960,7 @@ function rosterRow(row, index) {
|
|
|
15512
15960
|
height: portraitSize,
|
|
15513
15961
|
padding: 1,
|
|
15514
15962
|
verticalAlign: "center",
|
|
15515
|
-
background:
|
|
15963
|
+
background: row2.self || row2.selected ? tones.accent : shades.dim
|
|
15516
15964
|
},
|
|
15517
15965
|
element(
|
|
15518
15966
|
"panel",
|
|
@@ -15525,7 +15973,7 @@ function rosterRow(row, index) {
|
|
|
15525
15973
|
horizontalAlign: "right",
|
|
15526
15974
|
margin: [0, 0, 8, 0]
|
|
15527
15975
|
};
|
|
15528
|
-
const line2 =
|
|
15976
|
+
const line2 = row2.onPress ? {
|
|
15529
15977
|
type: "button",
|
|
15530
15978
|
props: {
|
|
15531
15979
|
style: {
|
|
@@ -15536,7 +15984,7 @@ function rosterRow(row, index) {
|
|
|
15536
15984
|
hover: { background: shades.raised },
|
|
15537
15985
|
hoverSound: sounds.hover,
|
|
15538
15986
|
sound: sounds.press,
|
|
15539
|
-
onPress:
|
|
15987
|
+
onPress: row2.onPress,
|
|
15540
15988
|
children: [text2, portrait]
|
|
15541
15989
|
},
|
|
15542
15990
|
key: `row-${index}`
|
|
@@ -15688,15 +16136,18 @@ var Cast = class {
|
|
|
15688
16136
|
*/
|
|
15689
16137
|
frame(seconds) {
|
|
15690
16138
|
if (this.reported !== void 0) {
|
|
15691
|
-
this.settle(this.reported);
|
|
16139
|
+
this.settle(this.reported, seconds);
|
|
15692
16140
|
this.reported = void 0;
|
|
15693
16141
|
}
|
|
15694
16142
|
for (const seat of this.seats.values()) {
|
|
15695
16143
|
this.reconcile(seat, seconds);
|
|
15696
16144
|
}
|
|
15697
16145
|
}
|
|
15698
|
-
/**
|
|
15699
|
-
|
|
16146
|
+
/**
|
|
16147
|
+
* settle ends the members whose connection left and makes the new ones,
|
|
16148
|
+
* joined at now.
|
|
16149
|
+
*/
|
|
16150
|
+
settle(players2, now4) {
|
|
15700
16151
|
const present = new Map(players2.map((c) => [c.player.slot, c]));
|
|
15701
16152
|
for (const [slot, seat] of this.seats) {
|
|
15702
16153
|
if (present.get(slot)?.generation !== seat.connection.generation) {
|
|
@@ -15720,6 +16171,7 @@ var Cast = class {
|
|
|
15720
16171
|
fellAt: -Infinity,
|
|
15721
16172
|
hero: 0,
|
|
15722
16173
|
heroLostAt: -Infinity,
|
|
16174
|
+
joinedAt: now4,
|
|
15723
16175
|
askedAt: -Infinity
|
|
15724
16176
|
});
|
|
15725
16177
|
}
|
|
@@ -15744,7 +16196,8 @@ var Cast = class {
|
|
|
15744
16196
|
const changing = had === 0 && now4 - seat.heroLostAt < changeSeconds;
|
|
15745
16197
|
if (now4 - seat.askedAt < 1 || changing) return;
|
|
15746
16198
|
const want = this.wantOf(seat);
|
|
15747
|
-
const {
|
|
16199
|
+
const { respawn } = want;
|
|
16200
|
+
const hero = want.hero ?? this.stranded(seat, now4);
|
|
15748
16201
|
if (hero !== void 0 && !this.seated(seat, want, hero)) {
|
|
15749
16202
|
seat.askedAt = now4;
|
|
15750
16203
|
this.seat(seat, want, hero);
|
|
@@ -15753,6 +16206,19 @@ var Cast = class {
|
|
|
15753
16206
|
seat.connection.player.respawn();
|
|
15754
16207
|
}
|
|
15755
16208
|
}
|
|
16209
|
+
/**
|
|
16210
|
+
* stranded returns 'any' for a human whose hero is free when the game has
|
|
16211
|
+
* left them on a team without one for changeSeconds since they joined, and
|
|
16212
|
+
* otherwise leaves the hero free. Such a pawn never gets a hero on its own,
|
|
16213
|
+
* while a player still choosing one has no pawn and a spectator stands on
|
|
16214
|
+
* team 1. A bot is left to the game, which seats it.
|
|
16215
|
+
*/
|
|
16216
|
+
stranded(seat, now4) {
|
|
16217
|
+
const { pawn } = seat;
|
|
16218
|
+
const team = pawn?.team;
|
|
16219
|
+
const heroless = pawn?.hero === 0 && (team === 2 || team === 3);
|
|
16220
|
+
return heroless && !seat.connection.bot && now4 - seat.joinedAt >= changeSeconds ? "any" : void 0;
|
|
16221
|
+
}
|
|
15756
16222
|
/** wantOf is what the member in seat wants now. */
|
|
15757
16223
|
wantOf(seat) {
|
|
15758
16224
|
const { want = noWant } = this.options;
|
|
@@ -15891,6 +16357,217 @@ function ground(point, {
|
|
|
15891
16357
|
return hit && !hit.startSolid ? hit.position : void 0;
|
|
15892
16358
|
}
|
|
15893
16359
|
|
|
16360
|
+
// js/src/rotation.ts
|
|
16361
|
+
var startingRating = 1e3;
|
|
16362
|
+
var ratingStep = 32;
|
|
16363
|
+
var Standings = class {
|
|
16364
|
+
constructor(extra = () => ({})) {
|
|
16365
|
+
this.extra = extra;
|
|
16366
|
+
}
|
|
16367
|
+
extra;
|
|
16368
|
+
bySteamId = /* @__PURE__ */ new Map();
|
|
16369
|
+
/**
|
|
16370
|
+
* join is steamId's standing, made at the starting rating on their first
|
|
16371
|
+
* join. Its matches played rise to the fewest anyone present has played,
|
|
16372
|
+
* so joining late or rejoining never puts a player ahead of the line.
|
|
16373
|
+
*/
|
|
16374
|
+
join(steamId, present) {
|
|
16375
|
+
const least = fewestPlayed(present);
|
|
16376
|
+
let standing = this.bySteamId.get(steamId);
|
|
16377
|
+
if (!standing) {
|
|
16378
|
+
standing = {
|
|
16379
|
+
played: least,
|
|
16380
|
+
rating: startingRating,
|
|
16381
|
+
wins: 0,
|
|
16382
|
+
losses: 0,
|
|
16383
|
+
streak: 0,
|
|
16384
|
+
...this.extra()
|
|
16385
|
+
};
|
|
16386
|
+
this.bySteamId.set(steamId, standing);
|
|
16387
|
+
}
|
|
16388
|
+
standing.played = Math.max(standing.played, least);
|
|
16389
|
+
return standing;
|
|
16390
|
+
}
|
|
16391
|
+
/** get is steamId's standing, or undefined before they join. */
|
|
16392
|
+
get(steamId) {
|
|
16393
|
+
return this.bySteamId.get(steamId);
|
|
16394
|
+
}
|
|
16395
|
+
};
|
|
16396
|
+
function fewestPlayed(standings) {
|
|
16397
|
+
let least = Infinity;
|
|
16398
|
+
for (const standing of standings) {
|
|
16399
|
+
least = Math.min(least, standing.played);
|
|
16400
|
+
}
|
|
16401
|
+
return least === Infinity ? 0 : least;
|
|
16402
|
+
}
|
|
16403
|
+
function nextMatch(line2, size, standing) {
|
|
16404
|
+
const seated = [...line2].sort((a, b) => standing(a).played - standing(b).played).slice(0, 2 * size);
|
|
16405
|
+
if (size < 1 || seated.length < 2 * size) {
|
|
16406
|
+
return void 0;
|
|
16407
|
+
}
|
|
16408
|
+
const ranked = seated.sort((a, b) => standing(b).rating - standing(a).rating);
|
|
16409
|
+
const sides = [[], []];
|
|
16410
|
+
for (const [i, player] of ranked.entries()) {
|
|
16411
|
+
const round = Math.floor(i / 2);
|
|
16412
|
+
const first = i % 2 === 0 ? round % 2 === 0 : round % 2 === 1;
|
|
16413
|
+
sides[first ? 0 : 1].push(player);
|
|
16414
|
+
}
|
|
16415
|
+
return sides;
|
|
16416
|
+
}
|
|
16417
|
+
function afterMatch(line2, fought) {
|
|
16418
|
+
const fighters = new Set(fought);
|
|
16419
|
+
return [
|
|
16420
|
+
...line2.filter((player) => !fighters.has(player)),
|
|
16421
|
+
...line2.filter((player) => fighters.has(player))
|
|
16422
|
+
];
|
|
16423
|
+
}
|
|
16424
|
+
function ratingChange(winners, losers, step = ratingStep) {
|
|
16425
|
+
const expected = 1 / (1 + 10 ** ((losers - winners) / 400));
|
|
16426
|
+
return Math.round(step * (1 - expected));
|
|
16427
|
+
}
|
|
16428
|
+
function settle(winners, losers, step = ratingStep) {
|
|
16429
|
+
const change2 = winners.length > 0 && losers.length > 0 ? ratingChange(average(winners), average(losers), step) : 0;
|
|
16430
|
+
for (const standing of winners) {
|
|
16431
|
+
standing.rating += change2;
|
|
16432
|
+
standing.wins++;
|
|
16433
|
+
standing.streak++;
|
|
16434
|
+
}
|
|
16435
|
+
for (const standing of losers) {
|
|
16436
|
+
standing.rating -= change2;
|
|
16437
|
+
standing.losses++;
|
|
16438
|
+
standing.streak = 0;
|
|
16439
|
+
}
|
|
16440
|
+
return change2;
|
|
16441
|
+
}
|
|
16442
|
+
function average(standings) {
|
|
16443
|
+
let sum = 0;
|
|
16444
|
+
for (const standing of standings) {
|
|
16445
|
+
sum += standing.rating;
|
|
16446
|
+
}
|
|
16447
|
+
return sum / standings.length;
|
|
16448
|
+
}
|
|
16449
|
+
function leastUsed(counts, prefer = 0) {
|
|
16450
|
+
const least = Math.min(...counts);
|
|
16451
|
+
if (counts[prefer] === least) {
|
|
16452
|
+
return prefer;
|
|
16453
|
+
}
|
|
16454
|
+
return counts.indexOf(least);
|
|
16455
|
+
}
|
|
16456
|
+
function leaderboard(players2, standing, rows, viewer) {
|
|
16457
|
+
const ranked = [...players2].sort(
|
|
16458
|
+
(a, b) => standing(b).wins - standing(a).wins || standing(b).rating - standing(a).rating
|
|
16459
|
+
);
|
|
16460
|
+
const shown = ranked.slice(0, rows);
|
|
16461
|
+
if (viewer !== void 0 && shown.length > 0 && players2.includes(viewer) && !shown.includes(viewer)) {
|
|
16462
|
+
shown[shown.length - 1] = viewer;
|
|
16463
|
+
}
|
|
16464
|
+
return shown;
|
|
16465
|
+
}
|
|
16466
|
+
|
|
16467
|
+
// js/src/bystander.ts
|
|
16468
|
+
var bystanderStates = [
|
|
16469
|
+
"MODIFIER_STATE_IMMOBILIZED",
|
|
16470
|
+
"MODIFIER_STATE_DISARMED",
|
|
16471
|
+
"MODIFIER_STATE_MELEE_DISABLED",
|
|
16472
|
+
"MODIFIER_STATE_SILENCED",
|
|
16473
|
+
"MODIFIER_STATE_INVULNERABLE",
|
|
16474
|
+
"MODIFIER_STATE_TECH_UNTARGETABLE_BY_ENEMIES",
|
|
16475
|
+
"MODIFIER_STATE_TECH_UNTARGETABLE_BY_TEAMMATES",
|
|
16476
|
+
"MODIFIER_STATE_DISPLACEMENT_IMMUNE",
|
|
16477
|
+
"MODIFIER_STATE_IGNORE_BULLETS",
|
|
16478
|
+
"MODIFIER_STATE_IGNORE_MELEE",
|
|
16479
|
+
"MODIFIER_STATE_IN_ABILITY_DISABLE_ZOOM"
|
|
16480
|
+
];
|
|
16481
|
+
function holdBystander(entity, active = true) {
|
|
16482
|
+
let held = true;
|
|
16483
|
+
for (const state of bystanderStates) {
|
|
16484
|
+
held = holdModifierState(entity, state, active) && held;
|
|
16485
|
+
}
|
|
16486
|
+
return held;
|
|
16487
|
+
}
|
|
16488
|
+
|
|
16489
|
+
// js/src/strays.ts
|
|
16490
|
+
var strayGraceSeconds = 3;
|
|
16491
|
+
var strayRespawnTime = 1e9;
|
|
16492
|
+
var strayBlow = 1e6;
|
|
16493
|
+
var Strays = class {
|
|
16494
|
+
/** since maps each stray pawn to when it was first seen with no player. */
|
|
16495
|
+
since = /* @__PURE__ */ new Map();
|
|
16496
|
+
sweptAt = -Infinity;
|
|
16497
|
+
/**
|
|
16498
|
+
* sweep lays down each hero pawn that has belonged to no player for
|
|
16499
|
+
* strayGraceSeconds, at most once a second. The game sets a dead pawn's
|
|
16500
|
+
* respawn when it dies, so the hold repeats on each sweep.
|
|
16501
|
+
*/
|
|
16502
|
+
sweep(now4) {
|
|
16503
|
+
if (now4 - this.sweptAt < 1) {
|
|
16504
|
+
return;
|
|
16505
|
+
}
|
|
16506
|
+
this.sweptAt = now4;
|
|
16507
|
+
const held = /* @__PURE__ */ new Set();
|
|
16508
|
+
for (const { player } of players()) {
|
|
16509
|
+
const pawn = player.pawn();
|
|
16510
|
+
if (pawn) {
|
|
16511
|
+
held.add(pawn.entity);
|
|
16512
|
+
}
|
|
16513
|
+
}
|
|
16514
|
+
const since = /* @__PURE__ */ new Map();
|
|
16515
|
+
for (const entity of findEntities("player")) {
|
|
16516
|
+
if (held.has(entity) || ownHero(entity)) {
|
|
16517
|
+
continue;
|
|
16518
|
+
}
|
|
16519
|
+
const first = this.since.get(entity) ?? now4;
|
|
16520
|
+
since.set(entity, first);
|
|
16521
|
+
if (now4 - first >= strayGraceSeconds) {
|
|
16522
|
+
layDown(entity);
|
|
16523
|
+
}
|
|
16524
|
+
}
|
|
16525
|
+
this.since = since;
|
|
16526
|
+
}
|
|
16527
|
+
};
|
|
16528
|
+
function ownHero(entity) {
|
|
16529
|
+
const controller = readField(
|
|
16530
|
+
entity,
|
|
16531
|
+
"CBasePlayerPawn",
|
|
16532
|
+
"m_hController",
|
|
16533
|
+
"handle"
|
|
16534
|
+
);
|
|
16535
|
+
if (typeof controller !== "number") {
|
|
16536
|
+
return false;
|
|
16537
|
+
}
|
|
16538
|
+
const connected = readField(
|
|
16539
|
+
controller,
|
|
16540
|
+
"CBasePlayerController",
|
|
16541
|
+
"m_iConnected",
|
|
16542
|
+
"int32"
|
|
16543
|
+
);
|
|
16544
|
+
if (connected === 3 || connected === 4) {
|
|
16545
|
+
return false;
|
|
16546
|
+
}
|
|
16547
|
+
const hero = readField(
|
|
16548
|
+
controller,
|
|
16549
|
+
"CCitadelPlayerController",
|
|
16550
|
+
"m_hHeroPawn",
|
|
16551
|
+
"handle"
|
|
16552
|
+
);
|
|
16553
|
+
return hero === entity;
|
|
16554
|
+
}
|
|
16555
|
+
function layDown(entity) {
|
|
16556
|
+
holdBystander(entity, false);
|
|
16557
|
+
const health = readField(entity, "CBaseEntity", "m_iHealth", "int32");
|
|
16558
|
+
if (typeof health === "number" && health > 0) {
|
|
16559
|
+
damage({ victim: entity, amount: strayBlow });
|
|
16560
|
+
log(`laid down a stray hero pawn ${entity}`);
|
|
16561
|
+
}
|
|
16562
|
+
writeField(
|
|
16563
|
+
entity,
|
|
16564
|
+
"CCitadelPlayerPawn",
|
|
16565
|
+
"m_flRespawnTime",
|
|
16566
|
+
"float32",
|
|
16567
|
+
strayRespawnTime
|
|
16568
|
+
);
|
|
16569
|
+
}
|
|
16570
|
+
|
|
15894
16571
|
// js/src/probe.ts
|
|
15895
16572
|
var ProbeRun = class {
|
|
15896
16573
|
/**
|
|
@@ -15915,13 +16592,13 @@ var ProbeRun = class {
|
|
|
15915
16592
|
* tick runs check for the frame at now until the run ends. step names what
|
|
15916
16593
|
* the probe waits on, and describe adds the probe's state to a timeout.
|
|
15917
16594
|
*/
|
|
15918
|
-
tick(now4, step, check,
|
|
16595
|
+
tick(now4, step, check, describe2) {
|
|
15919
16596
|
if (this.finished) {
|
|
15920
16597
|
return;
|
|
15921
16598
|
}
|
|
15922
16599
|
let result;
|
|
15923
16600
|
if (this.elapsed(now4) > this.timeout) {
|
|
15924
|
-
const state =
|
|
16601
|
+
const state = describe2 ? `: ${describe2()}` : "";
|
|
15925
16602
|
result = `timed out waiting for ${step}${state}`;
|
|
15926
16603
|
} else {
|
|
15927
16604
|
result = check();
|
|
@@ -16634,55 +17311,578 @@ function snap(value) {
|
|
|
16634
17311
|
return Math.round(value / grid) * grid;
|
|
16635
17312
|
}
|
|
16636
17313
|
|
|
16637
|
-
//
|
|
16638
|
-
|
|
16639
|
-
|
|
16640
|
-
|
|
16641
|
-
|
|
16642
|
-
|
|
16643
|
-
|
|
16644
|
-
|
|
16645
|
-
|
|
16646
|
-
|
|
16647
|
-
|
|
16648
|
-
|
|
16649
|
-
|
|
16650
|
-
|
|
16651
|
-
|
|
16652
|
-
|
|
16653
|
-
|
|
16654
|
-
|
|
16655
|
-
|
|
16656
|
-
|
|
16657
|
-
|
|
16658
|
-
|
|
16659
|
-
|
|
16660
|
-
|
|
16661
|
-
|
|
16662
|
-
|
|
16663
|
-
|
|
16664
|
-
|
|
16665
|
-
|
|
16666
|
-
|
|
16667
|
-
|
|
16668
|
-
|
|
16669
|
-
|
|
16670
|
-
|
|
16671
|
-
|
|
16672
|
-
|
|
16673
|
-
|
|
16674
|
-
|
|
16675
|
-
|
|
16676
|
-
|
|
16677
|
-
|
|
16678
|
-
|
|
16679
|
-
|
|
16680
|
-
|
|
16681
|
-
|
|
16682
|
-
|
|
16683
|
-
|
|
16684
|
-
|
|
16685
|
-
|
|
17314
|
+
// src/wasm/scores/scores.pb.ts
|
|
17315
|
+
var Window_Enum = /* @__PURE__ */ createEnumType(
|
|
17316
|
+
"modlock.wasm.scores.Window",
|
|
17317
|
+
[
|
|
17318
|
+
[0, "WINDOW_UNKNOWN"],
|
|
17319
|
+
[1, "WINDOW_ALL_TIME"],
|
|
17320
|
+
[2, "WINDOW_DAY"],
|
|
17321
|
+
[3, "WINDOW_WEEK"]
|
|
17322
|
+
]
|
|
17323
|
+
);
|
|
17324
|
+
var ScoreReport = /* @__PURE__ */ createMessageType(
|
|
17325
|
+
"modlock.wasm.scores.ScoreReport",
|
|
17326
|
+
() => [
|
|
17327
|
+
[1, "board", 9],
|
|
17328
|
+
[2, "player", 5],
|
|
17329
|
+
[3, "value", 3],
|
|
17330
|
+
[4, "tiebreak", 3],
|
|
17331
|
+
[5, "partition", 9, 584],
|
|
17332
|
+
[6, "key", 9],
|
|
17333
|
+
[7, "earned_at_unix_millis", 3],
|
|
17334
|
+
[8, "evidence", 9]
|
|
17335
|
+
],
|
|
17336
|
+
{
|
|
17337
|
+
decode: (r, end, m) => {
|
|
17338
|
+
while (r.pos < end) {
|
|
17339
|
+
const t = r.tag();
|
|
17340
|
+
if ((t & 7) === 4) return m;
|
|
17341
|
+
switch (t >>> 3) {
|
|
17342
|
+
case 1:
|
|
17343
|
+
m.board = r.string();
|
|
17344
|
+
break;
|
|
17345
|
+
case 2:
|
|
17346
|
+
m.player = r.int32();
|
|
17347
|
+
break;
|
|
17348
|
+
case 3:
|
|
17349
|
+
m.value = r.int64();
|
|
17350
|
+
break;
|
|
17351
|
+
case 4:
|
|
17352
|
+
m.tiebreak = r.int64();
|
|
17353
|
+
break;
|
|
17354
|
+
case 5: {
|
|
17355
|
+
const [k, v] = r.entry(
|
|
17356
|
+
(r2) => r2.string(),
|
|
17357
|
+
(r2) => r2.string(),
|
|
17358
|
+
"",
|
|
17359
|
+
""
|
|
17360
|
+
);
|
|
17361
|
+
m.partition ??= newMap();
|
|
17362
|
+
m.partition[k] = v;
|
|
17363
|
+
break;
|
|
17364
|
+
}
|
|
17365
|
+
case 6:
|
|
17366
|
+
m.key = r.string();
|
|
17367
|
+
break;
|
|
17368
|
+
case 7:
|
|
17369
|
+
m.earnedAtUnixMillis = r.int64();
|
|
17370
|
+
break;
|
|
17371
|
+
case 8:
|
|
17372
|
+
m.evidence = r.string();
|
|
17373
|
+
break;
|
|
17374
|
+
default:
|
|
17375
|
+
r.skip(t);
|
|
17376
|
+
}
|
|
17377
|
+
}
|
|
17378
|
+
return m;
|
|
17379
|
+
},
|
|
17380
|
+
encode: (m, w) => {
|
|
17381
|
+
{
|
|
17382
|
+
const v = m.board;
|
|
17383
|
+
if (v) w.uint32(10).string(v);
|
|
17384
|
+
}
|
|
17385
|
+
{
|
|
17386
|
+
const v = m.player;
|
|
17387
|
+
if (v) w.uint32(16).int32(v);
|
|
17388
|
+
}
|
|
17389
|
+
{
|
|
17390
|
+
const v = m.value;
|
|
17391
|
+
if (v) w.uint32(24).int64(v);
|
|
17392
|
+
}
|
|
17393
|
+
{
|
|
17394
|
+
const v = m.tiebreak;
|
|
17395
|
+
if (v) w.uint32(32).int64(v);
|
|
17396
|
+
}
|
|
17397
|
+
{
|
|
17398
|
+
const o = m.partition;
|
|
17399
|
+
if (o != null)
|
|
17400
|
+
for (const [k, v] of Object.entries(o)) {
|
|
17401
|
+
const s = w.uint32(42).fork();
|
|
17402
|
+
w.uint32(10).string(k);
|
|
17403
|
+
w.uint32(18).string(v);
|
|
17404
|
+
w.join(s);
|
|
17405
|
+
}
|
|
17406
|
+
}
|
|
17407
|
+
{
|
|
17408
|
+
const v = m.key;
|
|
17409
|
+
if (v) w.uint32(50).string(v);
|
|
17410
|
+
}
|
|
17411
|
+
{
|
|
17412
|
+
const v = m.earnedAtUnixMillis;
|
|
17413
|
+
if (v) w.uint32(56).int64(v);
|
|
17414
|
+
}
|
|
17415
|
+
{
|
|
17416
|
+
const v = m.evidence;
|
|
17417
|
+
if (v) w.uint32(66).string(v);
|
|
17418
|
+
}
|
|
17419
|
+
}
|
|
17420
|
+
}
|
|
17421
|
+
);
|
|
17422
|
+
var MatchReport = /* @__PURE__ */ createMessageType(
|
|
17423
|
+
"modlock.wasm.scores.MatchReport",
|
|
17424
|
+
() => [
|
|
17425
|
+
[1, "board", 9],
|
|
17426
|
+
[2, "places", 11, 1, Place.codec],
|
|
17427
|
+
[3, "partition", 9, 584],
|
|
17428
|
+
[4, "key", 9],
|
|
17429
|
+
[5, "earned_at_unix_millis", 3],
|
|
17430
|
+
[6, "evidence", 9]
|
|
17431
|
+
],
|
|
17432
|
+
{
|
|
17433
|
+
decode: (r, end, m) => {
|
|
17434
|
+
while (r.pos < end) {
|
|
17435
|
+
const t = r.tag();
|
|
17436
|
+
if ((t & 7) === 4) return m;
|
|
17437
|
+
switch (t >>> 3) {
|
|
17438
|
+
case 1:
|
|
17439
|
+
m.board = r.string();
|
|
17440
|
+
break;
|
|
17441
|
+
case 2:
|
|
17442
|
+
;
|
|
17443
|
+
(m.places ??= []).push(Place.decode(r, r.delimited(), {}));
|
|
17444
|
+
break;
|
|
17445
|
+
case 3: {
|
|
17446
|
+
const [k, v] = r.entry(
|
|
17447
|
+
(r2) => r2.string(),
|
|
17448
|
+
(r2) => r2.string(),
|
|
17449
|
+
"",
|
|
17450
|
+
""
|
|
17451
|
+
);
|
|
17452
|
+
m.partition ??= newMap();
|
|
17453
|
+
m.partition[k] = v;
|
|
17454
|
+
break;
|
|
17455
|
+
}
|
|
17456
|
+
case 4:
|
|
17457
|
+
m.key = r.string();
|
|
17458
|
+
break;
|
|
17459
|
+
case 5:
|
|
17460
|
+
m.earnedAtUnixMillis = r.int64();
|
|
17461
|
+
break;
|
|
17462
|
+
case 6:
|
|
17463
|
+
m.evidence = r.string();
|
|
17464
|
+
break;
|
|
17465
|
+
default:
|
|
17466
|
+
r.skip(t);
|
|
17467
|
+
}
|
|
17468
|
+
}
|
|
17469
|
+
return m;
|
|
17470
|
+
},
|
|
17471
|
+
encode: (m, w) => {
|
|
17472
|
+
{
|
|
17473
|
+
const v = m.board;
|
|
17474
|
+
if (v) w.uint32(10).string(v);
|
|
17475
|
+
}
|
|
17476
|
+
{
|
|
17477
|
+
const a = m.places;
|
|
17478
|
+
if (a != null) for (const e of a) Place.writeField(w, 2, e);
|
|
17479
|
+
}
|
|
17480
|
+
{
|
|
17481
|
+
const o = m.partition;
|
|
17482
|
+
if (o != null)
|
|
17483
|
+
for (const [k, v] of Object.entries(o)) {
|
|
17484
|
+
const s = w.uint32(26).fork();
|
|
17485
|
+
w.uint32(10).string(k);
|
|
17486
|
+
w.uint32(18).string(v);
|
|
17487
|
+
w.join(s);
|
|
17488
|
+
}
|
|
17489
|
+
}
|
|
17490
|
+
{
|
|
17491
|
+
const v = m.key;
|
|
17492
|
+
if (v) w.uint32(34).string(v);
|
|
17493
|
+
}
|
|
17494
|
+
{
|
|
17495
|
+
const v = m.earnedAtUnixMillis;
|
|
17496
|
+
if (v) w.uint32(40).int64(v);
|
|
17497
|
+
}
|
|
17498
|
+
{
|
|
17499
|
+
const v = m.evidence;
|
|
17500
|
+
if (v) w.uint32(50).string(v);
|
|
17501
|
+
}
|
|
17502
|
+
}
|
|
17503
|
+
}
|
|
17504
|
+
);
|
|
17505
|
+
var Place = /* @__PURE__ */ createMessageType(
|
|
17506
|
+
"modlock.wasm.scores.Place",
|
|
17507
|
+
() => [
|
|
17508
|
+
[1, "player", 5],
|
|
17509
|
+
[2, "place", 13],
|
|
17510
|
+
[3, "value", 3]
|
|
17511
|
+
],
|
|
17512
|
+
{
|
|
17513
|
+
decode: (r, end, m) => {
|
|
17514
|
+
while (r.pos < end) {
|
|
17515
|
+
const t = r.tag();
|
|
17516
|
+
if ((t & 7) === 4) return m;
|
|
17517
|
+
switch (t >>> 3) {
|
|
17518
|
+
case 1:
|
|
17519
|
+
m.player = r.int32();
|
|
17520
|
+
break;
|
|
17521
|
+
case 2:
|
|
17522
|
+
m.place = r.uint32();
|
|
17523
|
+
break;
|
|
17524
|
+
case 3:
|
|
17525
|
+
m.value = r.int64();
|
|
17526
|
+
break;
|
|
17527
|
+
default:
|
|
17528
|
+
r.skip(t);
|
|
17529
|
+
}
|
|
17530
|
+
}
|
|
17531
|
+
return m;
|
|
17532
|
+
},
|
|
17533
|
+
encode: (m, w) => {
|
|
17534
|
+
{
|
|
17535
|
+
const v = m.player;
|
|
17536
|
+
if (v) w.uint32(8).int32(v);
|
|
17537
|
+
}
|
|
17538
|
+
{
|
|
17539
|
+
const v = m.place;
|
|
17540
|
+
if (v) w.uint32(16).uint32(v);
|
|
17541
|
+
}
|
|
17542
|
+
{
|
|
17543
|
+
const v = m.value;
|
|
17544
|
+
if (v) w.uint32(24).int64(v);
|
|
17545
|
+
}
|
|
17546
|
+
}
|
|
17547
|
+
}
|
|
17548
|
+
);
|
|
17549
|
+
var BoardQuery = /* @__PURE__ */ createMessageType(
|
|
17550
|
+
"modlock.wasm.scores.BoardQuery",
|
|
17551
|
+
() => [
|
|
17552
|
+
[1, "board", 9],
|
|
17553
|
+
[2, "partition", 9, 584],
|
|
17554
|
+
[3, "window", 14, 0, Window_Enum],
|
|
17555
|
+
[4, "offset", 13],
|
|
17556
|
+
[5, "limit", 13],
|
|
17557
|
+
[6, "player", 5, 4]
|
|
17558
|
+
],
|
|
17559
|
+
{
|
|
17560
|
+
decode: (r, end, m) => {
|
|
17561
|
+
while (r.pos < end) {
|
|
17562
|
+
const t = r.tag();
|
|
17563
|
+
if ((t & 7) === 4) return m;
|
|
17564
|
+
switch (t >>> 3) {
|
|
17565
|
+
case 1:
|
|
17566
|
+
m.board = r.string();
|
|
17567
|
+
break;
|
|
17568
|
+
case 2: {
|
|
17569
|
+
const [k, v] = r.entry(
|
|
17570
|
+
(r2) => r2.string(),
|
|
17571
|
+
(r2) => r2.string(),
|
|
17572
|
+
"",
|
|
17573
|
+
""
|
|
17574
|
+
);
|
|
17575
|
+
m.partition ??= newMap();
|
|
17576
|
+
m.partition[k] = v;
|
|
17577
|
+
break;
|
|
17578
|
+
}
|
|
17579
|
+
case 3:
|
|
17580
|
+
m.window = r.int32();
|
|
17581
|
+
break;
|
|
17582
|
+
case 4:
|
|
17583
|
+
m.offset = r.uint32();
|
|
17584
|
+
break;
|
|
17585
|
+
case 5:
|
|
17586
|
+
m.limit = r.uint32();
|
|
17587
|
+
break;
|
|
17588
|
+
case 6:
|
|
17589
|
+
m.player = r.int32();
|
|
17590
|
+
break;
|
|
17591
|
+
default:
|
|
17592
|
+
r.skip(t);
|
|
17593
|
+
}
|
|
17594
|
+
}
|
|
17595
|
+
return m;
|
|
17596
|
+
},
|
|
17597
|
+
encode: (m, w) => {
|
|
17598
|
+
{
|
|
17599
|
+
const v = m.board;
|
|
17600
|
+
if (v) w.uint32(10).string(v);
|
|
17601
|
+
}
|
|
17602
|
+
{
|
|
17603
|
+
const o = m.partition;
|
|
17604
|
+
if (o != null)
|
|
17605
|
+
for (const [k, v] of Object.entries(o)) {
|
|
17606
|
+
const s = w.uint32(18).fork();
|
|
17607
|
+
w.uint32(10).string(k);
|
|
17608
|
+
w.uint32(18).string(v);
|
|
17609
|
+
w.join(s);
|
|
17610
|
+
}
|
|
17611
|
+
}
|
|
17612
|
+
{
|
|
17613
|
+
const v = m.window;
|
|
17614
|
+
if (v) w.uint32(24).int32(v);
|
|
17615
|
+
}
|
|
17616
|
+
{
|
|
17617
|
+
const v = m.offset;
|
|
17618
|
+
if (v) w.uint32(32).uint32(v);
|
|
17619
|
+
}
|
|
17620
|
+
{
|
|
17621
|
+
const v = m.limit;
|
|
17622
|
+
if (v) w.uint32(40).uint32(v);
|
|
17623
|
+
}
|
|
17624
|
+
{
|
|
17625
|
+
const v = m.player;
|
|
17626
|
+
if (v != null) w.uint32(48).int32(v);
|
|
17627
|
+
}
|
|
17628
|
+
}
|
|
17629
|
+
}
|
|
17630
|
+
);
|
|
17631
|
+
var BoardPage = /* @__PURE__ */ createMessageType(
|
|
17632
|
+
"modlock.wasm.scores.BoardPage",
|
|
17633
|
+
() => [
|
|
17634
|
+
[1, "rows", 11, 1, Standing.codec],
|
|
17635
|
+
[2, "player", 11, 0, Standing.codec],
|
|
17636
|
+
[3, "loading", 8]
|
|
17637
|
+
],
|
|
17638
|
+
{
|
|
17639
|
+
decode: (r, end, m) => {
|
|
17640
|
+
while (r.pos < end) {
|
|
17641
|
+
const t = r.tag();
|
|
17642
|
+
if ((t & 7) === 4) return m;
|
|
17643
|
+
switch (t >>> 3) {
|
|
17644
|
+
case 1:
|
|
17645
|
+
;
|
|
17646
|
+
(m.rows ??= []).push(Standing.decode(r, r.delimited(), {}));
|
|
17647
|
+
break;
|
|
17648
|
+
case 2:
|
|
17649
|
+
m.player = Standing.decode(r, r.delimited(), m.player ?? {});
|
|
17650
|
+
break;
|
|
17651
|
+
case 3:
|
|
17652
|
+
m.loading = r.bool();
|
|
17653
|
+
break;
|
|
17654
|
+
default:
|
|
17655
|
+
r.skip(t);
|
|
17656
|
+
}
|
|
17657
|
+
}
|
|
17658
|
+
return m;
|
|
17659
|
+
},
|
|
17660
|
+
encode: (m, w) => {
|
|
17661
|
+
{
|
|
17662
|
+
const a = m.rows;
|
|
17663
|
+
if (a != null) for (const e of a) Standing.writeField(w, 1, e);
|
|
17664
|
+
}
|
|
17665
|
+
{
|
|
17666
|
+
const v = m.player;
|
|
17667
|
+
if (v != null) Standing.writeField(w, 2, v);
|
|
17668
|
+
}
|
|
17669
|
+
{
|
|
17670
|
+
const v = m.loading;
|
|
17671
|
+
if (v) w.uint32(24).bool(v);
|
|
17672
|
+
}
|
|
17673
|
+
}
|
|
17674
|
+
}
|
|
17675
|
+
);
|
|
17676
|
+
var Standing = /* @__PURE__ */ createMessageType(
|
|
17677
|
+
"modlock.wasm.scores.Standing",
|
|
17678
|
+
() => [
|
|
17679
|
+
[1, "rank", 13],
|
|
17680
|
+
[2, "steam_id", 4],
|
|
17681
|
+
[3, "name", 9],
|
|
17682
|
+
[4, "value", 3],
|
|
17683
|
+
[5, "tiebreak", 3],
|
|
17684
|
+
[6, "count", 13]
|
|
17685
|
+
],
|
|
17686
|
+
{
|
|
17687
|
+
decode: (r, end, m) => {
|
|
17688
|
+
while (r.pos < end) {
|
|
17689
|
+
const t = r.tag();
|
|
17690
|
+
if ((t & 7) === 4) return m;
|
|
17691
|
+
switch (t >>> 3) {
|
|
17692
|
+
case 1:
|
|
17693
|
+
m.rank = r.uint32();
|
|
17694
|
+
break;
|
|
17695
|
+
case 2:
|
|
17696
|
+
m.steamId = r.uint64();
|
|
17697
|
+
break;
|
|
17698
|
+
case 3:
|
|
17699
|
+
m.name = r.string();
|
|
17700
|
+
break;
|
|
17701
|
+
case 4:
|
|
17702
|
+
m.value = r.int64();
|
|
17703
|
+
break;
|
|
17704
|
+
case 5:
|
|
17705
|
+
m.tiebreak = r.int64();
|
|
17706
|
+
break;
|
|
17707
|
+
case 6:
|
|
17708
|
+
m.count = r.uint32();
|
|
17709
|
+
break;
|
|
17710
|
+
default:
|
|
17711
|
+
r.skip(t);
|
|
17712
|
+
}
|
|
17713
|
+
}
|
|
17714
|
+
return m;
|
|
17715
|
+
},
|
|
17716
|
+
encode: (m, w) => {
|
|
17717
|
+
{
|
|
17718
|
+
const v = m.rank;
|
|
17719
|
+
if (v) w.uint32(8).uint32(v);
|
|
17720
|
+
}
|
|
17721
|
+
{
|
|
17722
|
+
const v = m.steamId;
|
|
17723
|
+
if (v) w.uint32(16).uint64(v);
|
|
17724
|
+
}
|
|
17725
|
+
{
|
|
17726
|
+
const v = m.name;
|
|
17727
|
+
if (v) w.uint32(26).string(v);
|
|
17728
|
+
}
|
|
17729
|
+
{
|
|
17730
|
+
const v = m.value;
|
|
17731
|
+
if (v) w.uint32(32).int64(v);
|
|
17732
|
+
}
|
|
17733
|
+
{
|
|
17734
|
+
const v = m.tiebreak;
|
|
17735
|
+
if (v) w.uint32(40).int64(v);
|
|
17736
|
+
}
|
|
17737
|
+
{
|
|
17738
|
+
const v = m.count;
|
|
17739
|
+
if (v) w.uint32(48).uint32(v);
|
|
17740
|
+
}
|
|
17741
|
+
}
|
|
17742
|
+
}
|
|
17743
|
+
);
|
|
17744
|
+
|
|
17745
|
+
// js/src/scores.ts
|
|
17746
|
+
var service = "scores";
|
|
17747
|
+
var windowValues = {
|
|
17748
|
+
allTime: 1 /* ALL_TIME */,
|
|
17749
|
+
day: 2 /* DAY */,
|
|
17750
|
+
week: 3 /* WEEK */
|
|
17751
|
+
};
|
|
17752
|
+
function reportScore(player, board, value, options = {}) {
|
|
17753
|
+
const report = ScoreReport.toBinary({
|
|
17754
|
+
board,
|
|
17755
|
+
player: player.slot,
|
|
17756
|
+
value: int64(value),
|
|
17757
|
+
tiebreak: int64(options.tiebreak ?? 0),
|
|
17758
|
+
partition: options.partition,
|
|
17759
|
+
key: options.key,
|
|
17760
|
+
earnedAtUnixMillis: int64(options.earnedAt ?? 0),
|
|
17761
|
+
evidence: options.evidence
|
|
17762
|
+
});
|
|
17763
|
+
return taken(
|
|
17764
|
+
"Report",
|
|
17765
|
+
report,
|
|
17766
|
+
`${board}${describe(options.partition)}: player ${player.slot} ${value}`
|
|
17767
|
+
);
|
|
17768
|
+
}
|
|
17769
|
+
function reportMatch(board, places, options = {}) {
|
|
17770
|
+
const report = MatchReport.toBinary({
|
|
17771
|
+
board,
|
|
17772
|
+
places: places.map((p) => ({
|
|
17773
|
+
player: p.player.slot,
|
|
17774
|
+
place: p.place,
|
|
17775
|
+
value: int64(p.value ?? 0)
|
|
17776
|
+
})),
|
|
17777
|
+
partition: options.partition,
|
|
17778
|
+
key: options.key,
|
|
17779
|
+
earnedAtUnixMillis: int64(options.earnedAt ?? 0),
|
|
17780
|
+
evidence: options.evidence
|
|
17781
|
+
});
|
|
17782
|
+
const line2 = places.map((p) => `player ${p.player.slot} #${p.place}`).join(", ");
|
|
17783
|
+
return taken(
|
|
17784
|
+
"Match",
|
|
17785
|
+
report,
|
|
17786
|
+
`${board}${describe(options.partition)}: ${line2}`
|
|
17787
|
+
);
|
|
17788
|
+
}
|
|
17789
|
+
function readBoard(board, read = {}) {
|
|
17790
|
+
const query = BoardQuery.toBinary({
|
|
17791
|
+
board,
|
|
17792
|
+
partition: read.partition,
|
|
17793
|
+
window: read.window === void 0 ? void 0 : windowValues[read.window],
|
|
17794
|
+
offset: read.offset,
|
|
17795
|
+
limit: read.limit,
|
|
17796
|
+
player: read.player?.slot
|
|
17797
|
+
});
|
|
17798
|
+
const reply2 = callService(service, "Read", query);
|
|
17799
|
+
if (reply2 === void 0) return void 0;
|
|
17800
|
+
const page = BoardPage.fromBinary(reply2);
|
|
17801
|
+
return {
|
|
17802
|
+
rows: (page.rows ?? []).map(row),
|
|
17803
|
+
player: page.player ? row(page.player) : void 0,
|
|
17804
|
+
loading: page.loading ?? false
|
|
17805
|
+
};
|
|
17806
|
+
}
|
|
17807
|
+
function taken(method, report, line2) {
|
|
17808
|
+
if (callService(service, method, report) !== void 0) return true;
|
|
17809
|
+
log(`score ${line2} (not reported: the host keeps no scores)`);
|
|
17810
|
+
return false;
|
|
17811
|
+
}
|
|
17812
|
+
function row(standing) {
|
|
17813
|
+
return {
|
|
17814
|
+
rank: standing.rank ?? 0,
|
|
17815
|
+
steamId: standing.steamId ?? 0n,
|
|
17816
|
+
name: standing.name ?? "",
|
|
17817
|
+
value: Number(standing.value ?? 0n),
|
|
17818
|
+
tiebreak: Number(standing.tiebreak ?? 0n),
|
|
17819
|
+
count: standing.count ?? 0
|
|
17820
|
+
};
|
|
17821
|
+
}
|
|
17822
|
+
function int64(value) {
|
|
17823
|
+
return BigInt(Math.round(value));
|
|
17824
|
+
}
|
|
17825
|
+
function describe(partition) {
|
|
17826
|
+
const names = Object.keys(partition ?? {}).sort();
|
|
17827
|
+
if (!names.length) return "";
|
|
17828
|
+
return `[${names.map((name) => `${name}=${partition[name]}`).join(" ")}]`;
|
|
17829
|
+
}
|
|
17830
|
+
|
|
17831
|
+
// js/src/index.ts
|
|
17832
|
+
function log2(...parts) {
|
|
17833
|
+
log(parts.map((part) => String(part)).join(" "));
|
|
17834
|
+
}
|
|
17835
|
+
function serve(service2, handler) {
|
|
17836
|
+
services.set(service2, { handler });
|
|
17837
|
+
}
|
|
17838
|
+
function command(name, handler) {
|
|
17839
|
+
commands.set(name, { handler });
|
|
17840
|
+
}
|
|
17841
|
+
function onStart(handler) {
|
|
17842
|
+
starts.push(handler);
|
|
17843
|
+
}
|
|
17844
|
+
function onChat(handler) {
|
|
17845
|
+
chats.push(handler);
|
|
17846
|
+
}
|
|
17847
|
+
function onPlayerJoin(handler) {
|
|
17848
|
+
joins.push(handler);
|
|
17849
|
+
}
|
|
17850
|
+
function onPlayerLeave(handler) {
|
|
17851
|
+
leaves.push(handler);
|
|
17852
|
+
}
|
|
17853
|
+
function onFrame(handler) {
|
|
17854
|
+
frames.push(handler);
|
|
17855
|
+
}
|
|
17856
|
+
function onWorld(handler) {
|
|
17857
|
+
worlds.push(handler);
|
|
17858
|
+
}
|
|
17859
|
+
function onInput(handler) {
|
|
17860
|
+
inputs.push(handler);
|
|
17861
|
+
}
|
|
17862
|
+
function onRestored(handler) {
|
|
17863
|
+
restoreds.push(handler);
|
|
17864
|
+
}
|
|
17865
|
+
function onNpcsRestored(handler) {
|
|
17866
|
+
npcsRestoreds.push(handler);
|
|
17867
|
+
}
|
|
17868
|
+
function onDamage(handler) {
|
|
17869
|
+
damages.push(handler);
|
|
17870
|
+
}
|
|
17871
|
+
function onDamaged(handler) {
|
|
17872
|
+
damageds.push(handler);
|
|
17873
|
+
}
|
|
17874
|
+
function onLaunch(handler) {
|
|
17875
|
+
launches.push(handler);
|
|
17876
|
+
}
|
|
17877
|
+
function onImpact(handler) {
|
|
17878
|
+
impacts.push(handler);
|
|
17879
|
+
}
|
|
17880
|
+
function onLanded(handler) {
|
|
17881
|
+
landeds.push(handler);
|
|
17882
|
+
}
|
|
17883
|
+
function onSettingChanged(handler) {
|
|
17884
|
+
settingChanges.push(handler);
|
|
17885
|
+
}
|
|
16686
17886
|
function settingOn(player, key) {
|
|
16687
17887
|
const value = player.setting(key);
|
|
16688
17888
|
return value === void 0 ? void 0 : value === "true";
|
|
@@ -16696,6 +17896,8 @@ var services = /* @__PURE__ */ new Map();
|
|
|
16696
17896
|
var starts = [];
|
|
16697
17897
|
var frames = [];
|
|
16698
17898
|
var chats = [];
|
|
17899
|
+
var joins = [];
|
|
17900
|
+
var leaves = [];
|
|
16699
17901
|
var worlds = [];
|
|
16700
17902
|
var inputs = [];
|
|
16701
17903
|
var restoreds = [];
|
|
@@ -16715,7 +17917,8 @@ var handlers = {
|
|
|
16715
17917
|
frames: true,
|
|
16716
17918
|
damage: damages.length !== 0,
|
|
16717
17919
|
damaged: damageds.length !== 0,
|
|
16718
|
-
chat: chats.length !== 0
|
|
17920
|
+
chat: chats.length !== 0,
|
|
17921
|
+
joins: joins.length !== 0 || leaves.length !== 0
|
|
16719
17922
|
};
|
|
16720
17923
|
},
|
|
16721
17924
|
frame(event) {
|
|
@@ -16818,14 +18021,29 @@ var handlers = {
|
|
|
16818
18021
|
},
|
|
16819
18022
|
playersChanged(event) {
|
|
16820
18023
|
keepPlayers(event.players);
|
|
18024
|
+
},
|
|
18025
|
+
// A join and a leave run at once, so the leaving player's hero still reads.
|
|
18026
|
+
playerJoined(event) {
|
|
18027
|
+
for (const handler of joins) {
|
|
18028
|
+
handler(event);
|
|
18029
|
+
}
|
|
18030
|
+
},
|
|
18031
|
+
playerLeft(event) {
|
|
18032
|
+
for (const handler of leaves) {
|
|
18033
|
+
handler(event);
|
|
18034
|
+
}
|
|
16821
18035
|
}
|
|
16822
18036
|
};
|
|
16823
18037
|
serveEvents((call2) => serveMod(handlers, call2));
|
|
16824
18038
|
|
|
16825
18039
|
// js/src/quickjs.ts
|
|
16826
18040
|
var bridge = globalThis.__modlock;
|
|
16827
|
-
|
|
16828
|
-
|
|
18041
|
+
var host = (call2) => bridge.hostCall(call2);
|
|
18042
|
+
bind(host);
|
|
18043
|
+
bridge.event = (call2) => {
|
|
18044
|
+
bind(host);
|
|
18045
|
+
return deliver(call2);
|
|
18046
|
+
};
|
|
16829
18047
|
export {
|
|
16830
18048
|
Action,
|
|
16831
18049
|
Banner,
|
|
@@ -16847,13 +18065,17 @@ export {
|
|
|
16847
18065
|
Puppet,
|
|
16848
18066
|
Roster,
|
|
16849
18067
|
Score2 as Score,
|
|
18068
|
+
Standings,
|
|
18069
|
+
Strays,
|
|
16850
18070
|
Tag,
|
|
16851
18071
|
Text,
|
|
16852
18072
|
TopStrip,
|
|
16853
18073
|
WorldObject,
|
|
16854
18074
|
addBot,
|
|
16855
18075
|
after,
|
|
18076
|
+
afterMatch,
|
|
16856
18077
|
blockInput,
|
|
18078
|
+
bystanderStates,
|
|
16857
18079
|
callService,
|
|
16858
18080
|
cameraPulse,
|
|
16859
18081
|
cameraShake,
|
|
@@ -16876,6 +18098,7 @@ export {
|
|
|
16876
18098
|
entityName,
|
|
16877
18099
|
entityPosition,
|
|
16878
18100
|
every,
|
|
18101
|
+
fewestPlayed,
|
|
16879
18102
|
findEntities,
|
|
16880
18103
|
findEntitiesByName,
|
|
16881
18104
|
findHero,
|
|
@@ -16892,6 +18115,7 @@ export {
|
|
|
16892
18115
|
heroes,
|
|
16893
18116
|
hide,
|
|
16894
18117
|
hideHud,
|
|
18118
|
+
holdBystander,
|
|
16895
18119
|
holdMatchClock,
|
|
16896
18120
|
holdModifierState,
|
|
16897
18121
|
holdReload,
|
|
@@ -16902,11 +18126,15 @@ export {
|
|
|
16902
18126
|
items,
|
|
16903
18127
|
jsx,
|
|
16904
18128
|
jsxs,
|
|
18129
|
+
killEntity,
|
|
18130
|
+
leaderboard,
|
|
18131
|
+
leastUsed,
|
|
16905
18132
|
loadSpot,
|
|
16906
18133
|
log2 as log,
|
|
16907
18134
|
matchClock,
|
|
16908
18135
|
modifierState,
|
|
16909
18136
|
moveEntity,
|
|
18137
|
+
nextMatch,
|
|
16910
18138
|
onChat,
|
|
16911
18139
|
onDamage,
|
|
16912
18140
|
onDamaged,
|
|
@@ -16916,6 +18144,8 @@ export {
|
|
|
16916
18144
|
onLanded,
|
|
16917
18145
|
onLaunch,
|
|
16918
18146
|
onNpcsRestored,
|
|
18147
|
+
onPlayerJoin,
|
|
18148
|
+
onPlayerLeave,
|
|
16919
18149
|
onRestored,
|
|
16920
18150
|
onSettingChanged,
|
|
16921
18151
|
onStart,
|
|
@@ -16926,6 +18156,9 @@ export {
|
|
|
16926
18156
|
poseAt,
|
|
16927
18157
|
precache,
|
|
16928
18158
|
pushEntity,
|
|
18159
|
+
ratingChange,
|
|
18160
|
+
ratingStep,
|
|
18161
|
+
readBoard,
|
|
16929
18162
|
readField,
|
|
16930
18163
|
readFieldList,
|
|
16931
18164
|
readFile,
|
|
@@ -16934,6 +18167,8 @@ export {
|
|
|
16934
18167
|
removeEntities,
|
|
16935
18168
|
removeEntity,
|
|
16936
18169
|
replayDamage,
|
|
18170
|
+
reportMatch,
|
|
18171
|
+
reportScore,
|
|
16937
18172
|
restoreHero,
|
|
16938
18173
|
restoreNpcs,
|
|
16939
18174
|
rift,
|
|
@@ -16949,12 +18184,15 @@ export {
|
|
|
16949
18184
|
setTeamSeating,
|
|
16950
18185
|
settingNumber,
|
|
16951
18186
|
settingOn,
|
|
18187
|
+
settle,
|
|
16952
18188
|
sheet,
|
|
16953
18189
|
show,
|
|
16954
18190
|
showEntityOnlyTo,
|
|
16955
18191
|
showEntityToAll,
|
|
16956
18192
|
spawnNpc,
|
|
16957
18193
|
startRift,
|
|
18194
|
+
startingRating,
|
|
18195
|
+
strayGraceSeconds,
|
|
16958
18196
|
theme_exports as theme,
|
|
16959
18197
|
ticksPerSecond,
|
|
16960
18198
|
toast,
|