@modlock/modlock 0.1.75 → 0.1.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/host.gen.d.ts +77 -8
- package/index.d.ts +2 -1
- package/index.js +2054 -1237
- package/package.json +6 -6
- package/racegate.d.ts +33 -0
- package/ui.d.ts +71 -5
package/index.js
CHANGED
|
@@ -44,14 +44,14 @@ var BinaryWriter = class {
|
|
|
44
44
|
this.reserve(size);
|
|
45
45
|
this.buf.copyWithin(start + size, start, this.pos);
|
|
46
46
|
this.pos += size;
|
|
47
|
-
let
|
|
47
|
+
let at3 = start;
|
|
48
48
|
let rest = length3;
|
|
49
49
|
while (rest > 127) {
|
|
50
|
-
this.buf[
|
|
51
|
-
|
|
50
|
+
this.buf[at3] = rest & 127 | 128;
|
|
51
|
+
at3 += 1;
|
|
52
52
|
rest >>>= 7;
|
|
53
53
|
}
|
|
54
|
-
this.buf[
|
|
54
|
+
this.buf[at3] = rest;
|
|
55
55
|
return this;
|
|
56
56
|
}
|
|
57
57
|
/** Write a field's tag: its number and wire type. */
|
|
@@ -3274,37 +3274,37 @@ function encodeCall(method, request) {
|
|
|
3274
3274
|
prefix.length + 1 + varintSize(request.length) + request.length
|
|
3275
3275
|
);
|
|
3276
3276
|
out.set(prefix, 0);
|
|
3277
|
-
let
|
|
3278
|
-
out[
|
|
3277
|
+
let at3 = prefix.length;
|
|
3278
|
+
out[at3++] = 18;
|
|
3279
3279
|
let size = request.length;
|
|
3280
|
-
for (; size > 127; size >>>= 7) out[
|
|
3281
|
-
out[
|
|
3282
|
-
out.set(request,
|
|
3280
|
+
for (; size > 127; size >>>= 7) out[at3++] = size & 127 | 128;
|
|
3281
|
+
out[at3++] = size;
|
|
3282
|
+
out.set(request, at3);
|
|
3283
3283
|
return out;
|
|
3284
3284
|
}
|
|
3285
3285
|
var empty = new Uint8Array();
|
|
3286
3286
|
function decodeReply(reply2) {
|
|
3287
3287
|
let response = empty;
|
|
3288
|
-
let
|
|
3289
|
-
while (
|
|
3290
|
-
const tag = reply2[
|
|
3288
|
+
let at3 = 0;
|
|
3289
|
+
while (at3 < reply2.length) {
|
|
3290
|
+
const tag = reply2[at3++] ?? 255;
|
|
3291
3291
|
if (tag > 127) return fallbackReply(reply2);
|
|
3292
3292
|
let value = 0;
|
|
3293
3293
|
let shift = 0;
|
|
3294
3294
|
for (; ; ) {
|
|
3295
|
-
if (
|
|
3296
|
-
const b = reply2[
|
|
3295
|
+
if (at3 >= reply2.length || shift > 28) return fallbackReply(reply2);
|
|
3296
|
+
const b = reply2[at3++] ?? 0;
|
|
3297
3297
|
value += (b & 127) * 2 ** shift;
|
|
3298
3298
|
shift += 7;
|
|
3299
3299
|
if (b < 128) break;
|
|
3300
3300
|
}
|
|
3301
3301
|
const wire = tag & 7;
|
|
3302
3302
|
if (wire === 0) continue;
|
|
3303
|
-
if (wire !== 2 ||
|
|
3303
|
+
if (wire !== 2 || at3 + value > reply2.length) return fallbackReply(reply2);
|
|
3304
3304
|
const field = tag >>> 3;
|
|
3305
3305
|
if (field === 1 && value > 0) return void 0;
|
|
3306
|
-
if (field === 2) response = reply2.subarray(
|
|
3307
|
-
|
|
3306
|
+
if (field === 2) response = reply2.subarray(at3, at3 + value);
|
|
3307
|
+
at3 += value;
|
|
3308
3308
|
}
|
|
3309
3309
|
return response;
|
|
3310
3310
|
}
|
|
@@ -3643,6 +3643,94 @@ var GiveItemRequest = /* @__PURE__ */ createMessageType(
|
|
|
3643
3643
|
}
|
|
3644
3644
|
}
|
|
3645
3645
|
);
|
|
3646
|
+
var BuyItemRequest = /* @__PURE__ */ createMessageType(
|
|
3647
|
+
"modlock.wasm.abilities.BuyItemRequest",
|
|
3648
|
+
() => [
|
|
3649
|
+
[1, "player", 5],
|
|
3650
|
+
[2, "item", 9],
|
|
3651
|
+
[3, "imbue", 13, 4],
|
|
3652
|
+
[4, "source", 13, 4]
|
|
3653
|
+
],
|
|
3654
|
+
{
|
|
3655
|
+
decode: (r, end, m) => {
|
|
3656
|
+
while (r.pos < end) {
|
|
3657
|
+
const t = r.tag();
|
|
3658
|
+
if ((t & 7) === 4) return m;
|
|
3659
|
+
switch (t >>> 3) {
|
|
3660
|
+
case 1:
|
|
3661
|
+
m.player = r.int32();
|
|
3662
|
+
break;
|
|
3663
|
+
case 2:
|
|
3664
|
+
m.item = r.string();
|
|
3665
|
+
break;
|
|
3666
|
+
case 3:
|
|
3667
|
+
m.imbue = r.uint32();
|
|
3668
|
+
break;
|
|
3669
|
+
case 4:
|
|
3670
|
+
m.source = r.uint32();
|
|
3671
|
+
break;
|
|
3672
|
+
default:
|
|
3673
|
+
r.skip(t);
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3676
|
+
return m;
|
|
3677
|
+
},
|
|
3678
|
+
encode: (m, w) => {
|
|
3679
|
+
{
|
|
3680
|
+
const v = m.player;
|
|
3681
|
+
if (v) w.uint32(8).int32(v);
|
|
3682
|
+
}
|
|
3683
|
+
{
|
|
3684
|
+
const v = m.item;
|
|
3685
|
+
if (v) w.uint32(18).string(v);
|
|
3686
|
+
}
|
|
3687
|
+
{
|
|
3688
|
+
const v = m.imbue;
|
|
3689
|
+
if (v != null) w.uint32(24).uint32(v);
|
|
3690
|
+
}
|
|
3691
|
+
{
|
|
3692
|
+
const v = m.source;
|
|
3693
|
+
if (v != null) w.uint32(32).uint32(v);
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
}
|
|
3697
|
+
);
|
|
3698
|
+
var TrainAbilityRequest = /* @__PURE__ */ createMessageType(
|
|
3699
|
+
"modlock.wasm.abilities.TrainAbilityRequest",
|
|
3700
|
+
() => [
|
|
3701
|
+
[1, "player", 5],
|
|
3702
|
+
[2, "slot", 13]
|
|
3703
|
+
],
|
|
3704
|
+
{
|
|
3705
|
+
decode: (r, end, m) => {
|
|
3706
|
+
while (r.pos < end) {
|
|
3707
|
+
const t = r.tag();
|
|
3708
|
+
if ((t & 7) === 4) return m;
|
|
3709
|
+
switch (t >>> 3) {
|
|
3710
|
+
case 1:
|
|
3711
|
+
m.player = r.int32();
|
|
3712
|
+
break;
|
|
3713
|
+
case 2:
|
|
3714
|
+
m.slot = r.uint32();
|
|
3715
|
+
break;
|
|
3716
|
+
default:
|
|
3717
|
+
r.skip(t);
|
|
3718
|
+
}
|
|
3719
|
+
}
|
|
3720
|
+
return m;
|
|
3721
|
+
},
|
|
3722
|
+
encode: (m, w) => {
|
|
3723
|
+
{
|
|
3724
|
+
const v = m.player;
|
|
3725
|
+
if (v) w.uint32(8).int32(v);
|
|
3726
|
+
}
|
|
3727
|
+
{
|
|
3728
|
+
const v = m.slot;
|
|
3729
|
+
if (v) w.uint32(16).uint32(v);
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
);
|
|
3646
3734
|
var ReplaceAbilityRequest = /* @__PURE__ */ createMessageType(
|
|
3647
3735
|
"modlock.wasm.abilities.ReplaceAbilityRequest",
|
|
3648
3736
|
() => [
|
|
@@ -4779,11 +4867,61 @@ var AnnounceRequest = /* @__PURE__ */ createMessageType(
|
|
|
4779
4867
|
}
|
|
4780
4868
|
}
|
|
4781
4869
|
);
|
|
4870
|
+
var SoundOptions = /* @__PURE__ */ createMessageType(
|
|
4871
|
+
"modlock.wasm.effects.SoundOptions",
|
|
4872
|
+
() => [
|
|
4873
|
+
[1, "volume", 2, 4],
|
|
4874
|
+
[2, "pitch", 2, 4],
|
|
4875
|
+
[3, "listeners", 5, 3]
|
|
4876
|
+
],
|
|
4877
|
+
{
|
|
4878
|
+
decode: (r, end, m) => {
|
|
4879
|
+
while (r.pos < end) {
|
|
4880
|
+
const t = r.tag();
|
|
4881
|
+
if ((t & 7) === 4) return m;
|
|
4882
|
+
switch (t >>> 3) {
|
|
4883
|
+
case 1:
|
|
4884
|
+
m.volume = r.float();
|
|
4885
|
+
break;
|
|
4886
|
+
case 2:
|
|
4887
|
+
m.pitch = r.float();
|
|
4888
|
+
break;
|
|
4889
|
+
case 3:
|
|
4890
|
+
for (const e = r.run(t), a = m.listeners ??= []; r.pos < e; )
|
|
4891
|
+
a.push(r.int32());
|
|
4892
|
+
break;
|
|
4893
|
+
default:
|
|
4894
|
+
r.skip(t);
|
|
4895
|
+
}
|
|
4896
|
+
}
|
|
4897
|
+
return m;
|
|
4898
|
+
},
|
|
4899
|
+
encode: (m, w) => {
|
|
4900
|
+
{
|
|
4901
|
+
const v = m.volume;
|
|
4902
|
+
if (v != null) w.uint32(13).float(v);
|
|
4903
|
+
}
|
|
4904
|
+
{
|
|
4905
|
+
const v = m.pitch;
|
|
4906
|
+
if (v != null) w.uint32(21).float(v);
|
|
4907
|
+
}
|
|
4908
|
+
{
|
|
4909
|
+
const a = m.listeners;
|
|
4910
|
+
if (a != null && a.length > 0) {
|
|
4911
|
+
const s = w.uint32(26).fork();
|
|
4912
|
+
for (const e of a) w.int32(e);
|
|
4913
|
+
w.join(s);
|
|
4914
|
+
}
|
|
4915
|
+
}
|
|
4916
|
+
}
|
|
4917
|
+
}
|
|
4918
|
+
);
|
|
4782
4919
|
var SoundRequest = /* @__PURE__ */ createMessageType(
|
|
4783
4920
|
"modlock.wasm.effects.SoundRequest",
|
|
4784
4921
|
() => [
|
|
4785
4922
|
[1, "player", 5],
|
|
4786
|
-
[2, "sound", 9]
|
|
4923
|
+
[2, "sound", 9],
|
|
4924
|
+
[3, "options", 11, 0, SoundOptions.codec]
|
|
4787
4925
|
],
|
|
4788
4926
|
{
|
|
4789
4927
|
decode: (r, end, m) => {
|
|
@@ -4797,6 +4935,9 @@ var SoundRequest = /* @__PURE__ */ createMessageType(
|
|
|
4797
4935
|
case 2:
|
|
4798
4936
|
m.sound = r.string();
|
|
4799
4937
|
break;
|
|
4938
|
+
case 3:
|
|
4939
|
+
m.options = SoundOptions.decode(r, r.delimited(), m.options ?? {});
|
|
4940
|
+
break;
|
|
4800
4941
|
default:
|
|
4801
4942
|
r.skip(t);
|
|
4802
4943
|
}
|
|
@@ -4812,6 +4953,10 @@ var SoundRequest = /* @__PURE__ */ createMessageType(
|
|
|
4812
4953
|
const v = m.sound;
|
|
4813
4954
|
if (v) w.uint32(18).string(v);
|
|
4814
4955
|
}
|
|
4956
|
+
{
|
|
4957
|
+
const v = m.options;
|
|
4958
|
+
if (v != null) SoundOptions.writeField(w, 3, v);
|
|
4959
|
+
}
|
|
4815
4960
|
}
|
|
4816
4961
|
}
|
|
4817
4962
|
);
|
|
@@ -4819,7 +4964,8 @@ var EmitSoundRequest = /* @__PURE__ */ createMessageType(
|
|
|
4819
4964
|
"modlock.wasm.effects.EmitSoundRequest",
|
|
4820
4965
|
() => [
|
|
4821
4966
|
[1, "entity", 13],
|
|
4822
|
-
[2, "sound", 9]
|
|
4967
|
+
[2, "sound", 9],
|
|
4968
|
+
[3, "options", 11, 0, SoundOptions.codec]
|
|
4823
4969
|
],
|
|
4824
4970
|
{
|
|
4825
4971
|
decode: (r, end, m) => {
|
|
@@ -4833,6 +4979,9 @@ var EmitSoundRequest = /* @__PURE__ */ createMessageType(
|
|
|
4833
4979
|
case 2:
|
|
4834
4980
|
m.sound = r.string();
|
|
4835
4981
|
break;
|
|
4982
|
+
case 3:
|
|
4983
|
+
m.options = SoundOptions.decode(r, r.delimited(), m.options ?? {});
|
|
4984
|
+
break;
|
|
4836
4985
|
default:
|
|
4837
4986
|
r.skip(t);
|
|
4838
4987
|
}
|
|
@@ -4848,6 +4997,106 @@ var EmitSoundRequest = /* @__PURE__ */ createMessageType(
|
|
|
4848
4997
|
const v = m.sound;
|
|
4849
4998
|
if (v) w.uint32(18).string(v);
|
|
4850
4999
|
}
|
|
5000
|
+
{
|
|
5001
|
+
const v = m.options;
|
|
5002
|
+
if (v != null) SoundOptions.writeField(w, 3, v);
|
|
5003
|
+
}
|
|
5004
|
+
}
|
|
5005
|
+
}
|
|
5006
|
+
);
|
|
5007
|
+
var SoundResponse = /* @__PURE__ */ createMessageType(
|
|
5008
|
+
"modlock.wasm.effects.SoundResponse",
|
|
5009
|
+
() => [[1, "id", 13]],
|
|
5010
|
+
{
|
|
5011
|
+
decode: (r, end, m) => {
|
|
5012
|
+
while (r.pos < end) {
|
|
5013
|
+
const t = r.tag();
|
|
5014
|
+
if ((t & 7) === 4) return m;
|
|
5015
|
+
switch (t >>> 3) {
|
|
5016
|
+
case 1:
|
|
5017
|
+
m.id = r.uint32();
|
|
5018
|
+
break;
|
|
5019
|
+
default:
|
|
5020
|
+
r.skip(t);
|
|
5021
|
+
}
|
|
5022
|
+
}
|
|
5023
|
+
return m;
|
|
5024
|
+
},
|
|
5025
|
+
encode: (m, w) => {
|
|
5026
|
+
{
|
|
5027
|
+
const v = m.id;
|
|
5028
|
+
if (v) w.uint32(8).uint32(v);
|
|
5029
|
+
}
|
|
5030
|
+
}
|
|
5031
|
+
}
|
|
5032
|
+
);
|
|
5033
|
+
var AdjustSoundRequest = /* @__PURE__ */ createMessageType(
|
|
5034
|
+
"modlock.wasm.effects.AdjustSoundRequest",
|
|
5035
|
+
() => [
|
|
5036
|
+
[1, "id", 13],
|
|
5037
|
+
[2, "volume", 2, 4],
|
|
5038
|
+
[3, "pitch", 2, 4]
|
|
5039
|
+
],
|
|
5040
|
+
{
|
|
5041
|
+
decode: (r, end, m) => {
|
|
5042
|
+
while (r.pos < end) {
|
|
5043
|
+
const t = r.tag();
|
|
5044
|
+
if ((t & 7) === 4) return m;
|
|
5045
|
+
switch (t >>> 3) {
|
|
5046
|
+
case 1:
|
|
5047
|
+
m.id = r.uint32();
|
|
5048
|
+
break;
|
|
5049
|
+
case 2:
|
|
5050
|
+
m.volume = r.float();
|
|
5051
|
+
break;
|
|
5052
|
+
case 3:
|
|
5053
|
+
m.pitch = r.float();
|
|
5054
|
+
break;
|
|
5055
|
+
default:
|
|
5056
|
+
r.skip(t);
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
5059
|
+
return m;
|
|
5060
|
+
},
|
|
5061
|
+
encode: (m, w) => {
|
|
5062
|
+
{
|
|
5063
|
+
const v = m.id;
|
|
5064
|
+
if (v) w.uint32(8).uint32(v);
|
|
5065
|
+
}
|
|
5066
|
+
{
|
|
5067
|
+
const v = m.volume;
|
|
5068
|
+
if (v != null) w.uint32(21).float(v);
|
|
5069
|
+
}
|
|
5070
|
+
{
|
|
5071
|
+
const v = m.pitch;
|
|
5072
|
+
if (v != null) w.uint32(29).float(v);
|
|
5073
|
+
}
|
|
5074
|
+
}
|
|
5075
|
+
}
|
|
5076
|
+
);
|
|
5077
|
+
var StopSoundRequest = /* @__PURE__ */ createMessageType(
|
|
5078
|
+
"modlock.wasm.effects.StopSoundRequest",
|
|
5079
|
+
() => [[1, "id", 13]],
|
|
5080
|
+
{
|
|
5081
|
+
decode: (r, end, m) => {
|
|
5082
|
+
while (r.pos < end) {
|
|
5083
|
+
const t = r.tag();
|
|
5084
|
+
if ((t & 7) === 4) return m;
|
|
5085
|
+
switch (t >>> 3) {
|
|
5086
|
+
case 1:
|
|
5087
|
+
m.id = r.uint32();
|
|
5088
|
+
break;
|
|
5089
|
+
default:
|
|
5090
|
+
r.skip(t);
|
|
5091
|
+
}
|
|
5092
|
+
}
|
|
5093
|
+
return m;
|
|
5094
|
+
},
|
|
5095
|
+
encode: (m, w) => {
|
|
5096
|
+
{
|
|
5097
|
+
const v = m.id;
|
|
5098
|
+
if (v) w.uint32(8).uint32(v);
|
|
5099
|
+
}
|
|
4851
5100
|
}
|
|
4852
5101
|
}
|
|
4853
5102
|
);
|
|
@@ -4983,36 +5232,9 @@ var ClearScreenEffectRequest = /* @__PURE__ */ createMessageType(
|
|
|
4983
5232
|
}
|
|
4984
5233
|
}
|
|
4985
5234
|
);
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
"modlock.wasm.fields.FieldType",
|
|
4990
|
-
[
|
|
4991
|
-
[0, "FIELD_TYPE_UNKNOWN"],
|
|
4992
|
-
[1, "FIELD_TYPE_BOOL"],
|
|
4993
|
-
[2, "FIELD_TYPE_INT8"],
|
|
4994
|
-
[3, "FIELD_TYPE_INT16"],
|
|
4995
|
-
[4, "FIELD_TYPE_INT32"],
|
|
4996
|
-
[5, "FIELD_TYPE_UINT8"],
|
|
4997
|
-
[6, "FIELD_TYPE_UINT16"],
|
|
4998
|
-
[7, "FIELD_TYPE_UINT32"],
|
|
4999
|
-
[8, "FIELD_TYPE_INT64"],
|
|
5000
|
-
[9, "FIELD_TYPE_UINT64"],
|
|
5001
|
-
[10, "FIELD_TYPE_FLOAT32"],
|
|
5002
|
-
[11, "FIELD_TYPE_FLOAT64"],
|
|
5003
|
-
[12, "FIELD_TYPE_VECTOR"],
|
|
5004
|
-
[13, "FIELD_TYPE_HANDLE"],
|
|
5005
|
-
[14, "FIELD_TYPE_STRING"]
|
|
5006
|
-
]
|
|
5007
|
-
);
|
|
5008
|
-
var ReadFieldRequest = /* @__PURE__ */ createMessageType(
|
|
5009
|
-
"modlock.wasm.fields.ReadFieldRequest",
|
|
5010
|
-
() => [
|
|
5011
|
-
[1, "entity", 13],
|
|
5012
|
-
[2, "class_name", 9],
|
|
5013
|
-
[3, "field", 9],
|
|
5014
|
-
[4, "type", 14, 0, FieldType_Enum]
|
|
5015
|
-
],
|
|
5235
|
+
var SilenceVoiceRequest = /* @__PURE__ */ createMessageType(
|
|
5236
|
+
"modlock.wasm.effects.SilenceVoiceRequest",
|
|
5237
|
+
() => [[1, "concepts", 9, 1]],
|
|
5016
5238
|
{
|
|
5017
5239
|
decode: (r, end, m) => {
|
|
5018
5240
|
while (r.pos < end) {
|
|
@@ -5020,16 +5242,8 @@ var ReadFieldRequest = /* @__PURE__ */ createMessageType(
|
|
|
5020
5242
|
if ((t & 7) === 4) return m;
|
|
5021
5243
|
switch (t >>> 3) {
|
|
5022
5244
|
case 1:
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
case 2:
|
|
5026
|
-
m.className = r.string();
|
|
5027
|
-
break;
|
|
5028
|
-
case 3:
|
|
5029
|
-
m.field = r.string();
|
|
5030
|
-
break;
|
|
5031
|
-
case 4:
|
|
5032
|
-
m.type = r.int32();
|
|
5245
|
+
;
|
|
5246
|
+
(m.concepts ??= []).push(r.string());
|
|
5033
5247
|
break;
|
|
5034
5248
|
default:
|
|
5035
5249
|
r.skip(t);
|
|
@@ -5039,10 +5253,109 @@ var ReadFieldRequest = /* @__PURE__ */ createMessageType(
|
|
|
5039
5253
|
},
|
|
5040
5254
|
encode: (m, w) => {
|
|
5041
5255
|
{
|
|
5042
|
-
const
|
|
5043
|
-
if (
|
|
5256
|
+
const a = m.concepts;
|
|
5257
|
+
if (a != null) for (const e of a) w.uint32(10).string(e);
|
|
5044
5258
|
}
|
|
5045
|
-
|
|
5259
|
+
}
|
|
5260
|
+
}
|
|
5261
|
+
);
|
|
5262
|
+
var SilencePlayerVoiceRequest = /* @__PURE__ */ createMessageType(
|
|
5263
|
+
"modlock.wasm.effects.SilencePlayerVoiceRequest",
|
|
5264
|
+
() => [
|
|
5265
|
+
[1, "player", 5],
|
|
5266
|
+
[2, "concepts", 9, 1]
|
|
5267
|
+
],
|
|
5268
|
+
{
|
|
5269
|
+
decode: (r, end, m) => {
|
|
5270
|
+
while (r.pos < end) {
|
|
5271
|
+
const t = r.tag();
|
|
5272
|
+
if ((t & 7) === 4) return m;
|
|
5273
|
+
switch (t >>> 3) {
|
|
5274
|
+
case 1:
|
|
5275
|
+
m.player = r.int32();
|
|
5276
|
+
break;
|
|
5277
|
+
case 2:
|
|
5278
|
+
;
|
|
5279
|
+
(m.concepts ??= []).push(r.string());
|
|
5280
|
+
break;
|
|
5281
|
+
default:
|
|
5282
|
+
r.skip(t);
|
|
5283
|
+
}
|
|
5284
|
+
}
|
|
5285
|
+
return m;
|
|
5286
|
+
},
|
|
5287
|
+
encode: (m, w) => {
|
|
5288
|
+
{
|
|
5289
|
+
const v = m.player;
|
|
5290
|
+
if (v) w.uint32(8).int32(v);
|
|
5291
|
+
}
|
|
5292
|
+
{
|
|
5293
|
+
const a = m.concepts;
|
|
5294
|
+
if (a != null) for (const e of a) w.uint32(18).string(e);
|
|
5295
|
+
}
|
|
5296
|
+
}
|
|
5297
|
+
}
|
|
5298
|
+
);
|
|
5299
|
+
|
|
5300
|
+
// src/wasm/fields/fields.pb.ts
|
|
5301
|
+
var FieldType_Enum = /* @__PURE__ */ createEnumType(
|
|
5302
|
+
"modlock.wasm.fields.FieldType",
|
|
5303
|
+
[
|
|
5304
|
+
[0, "FIELD_TYPE_UNKNOWN"],
|
|
5305
|
+
[1, "FIELD_TYPE_BOOL"],
|
|
5306
|
+
[2, "FIELD_TYPE_INT8"],
|
|
5307
|
+
[3, "FIELD_TYPE_INT16"],
|
|
5308
|
+
[4, "FIELD_TYPE_INT32"],
|
|
5309
|
+
[5, "FIELD_TYPE_UINT8"],
|
|
5310
|
+
[6, "FIELD_TYPE_UINT16"],
|
|
5311
|
+
[7, "FIELD_TYPE_UINT32"],
|
|
5312
|
+
[8, "FIELD_TYPE_INT64"],
|
|
5313
|
+
[9, "FIELD_TYPE_UINT64"],
|
|
5314
|
+
[10, "FIELD_TYPE_FLOAT32"],
|
|
5315
|
+
[11, "FIELD_TYPE_FLOAT64"],
|
|
5316
|
+
[12, "FIELD_TYPE_VECTOR"],
|
|
5317
|
+
[13, "FIELD_TYPE_HANDLE"],
|
|
5318
|
+
[14, "FIELD_TYPE_STRING"]
|
|
5319
|
+
]
|
|
5320
|
+
);
|
|
5321
|
+
var ReadFieldRequest = /* @__PURE__ */ createMessageType(
|
|
5322
|
+
"modlock.wasm.fields.ReadFieldRequest",
|
|
5323
|
+
() => [
|
|
5324
|
+
[1, "entity", 13],
|
|
5325
|
+
[2, "class_name", 9],
|
|
5326
|
+
[3, "field", 9],
|
|
5327
|
+
[4, "type", 14, 0, FieldType_Enum]
|
|
5328
|
+
],
|
|
5329
|
+
{
|
|
5330
|
+
decode: (r, end, m) => {
|
|
5331
|
+
while (r.pos < end) {
|
|
5332
|
+
const t = r.tag();
|
|
5333
|
+
if ((t & 7) === 4) return m;
|
|
5334
|
+
switch (t >>> 3) {
|
|
5335
|
+
case 1:
|
|
5336
|
+
m.entity = r.uint32();
|
|
5337
|
+
break;
|
|
5338
|
+
case 2:
|
|
5339
|
+
m.className = r.string();
|
|
5340
|
+
break;
|
|
5341
|
+
case 3:
|
|
5342
|
+
m.field = r.string();
|
|
5343
|
+
break;
|
|
5344
|
+
case 4:
|
|
5345
|
+
m.type = r.int32();
|
|
5346
|
+
break;
|
|
5347
|
+
default:
|
|
5348
|
+
r.skip(t);
|
|
5349
|
+
}
|
|
5350
|
+
}
|
|
5351
|
+
return m;
|
|
5352
|
+
},
|
|
5353
|
+
encode: (m, w) => {
|
|
5354
|
+
{
|
|
5355
|
+
const v = m.entity;
|
|
5356
|
+
if (v) w.uint32(8).uint32(v);
|
|
5357
|
+
}
|
|
5358
|
+
{
|
|
5046
5359
|
const v = m.className;
|
|
5047
5360
|
if (v) w.uint32(18).string(v);
|
|
5048
5361
|
}
|
|
@@ -10334,7 +10647,10 @@ var HudPart_Enum = /* @__PURE__ */ createEnumType(
|
|
|
10334
10647
|
[6, "HUD_PART_MINIMAP"],
|
|
10335
10648
|
[7, "HUD_PART_ABILITIES"],
|
|
10336
10649
|
[8, "HUD_PART_STATUS"],
|
|
10337
|
-
[9, "HUD_PART_STATS"]
|
|
10650
|
+
[9, "HUD_PART_STATS"],
|
|
10651
|
+
[10, "HUD_PART_HERO_PICKER"],
|
|
10652
|
+
[11, "HUD_PART_BROKER_COUNTDOWN"],
|
|
10653
|
+
[12, "HUD_PART_ALL"]
|
|
10338
10654
|
]
|
|
10339
10655
|
);
|
|
10340
10656
|
var Kind_Enum = /* @__PURE__ */ createEnumType(
|
|
@@ -10472,7 +10788,12 @@ var Node = /* @__PURE__ */ createMessageType(
|
|
|
10472
10788
|
[30, "sheets", 9, 1],
|
|
10473
10789
|
[31, "free_cursor", 8],
|
|
10474
10790
|
[32, "item", 13],
|
|
10475
|
-
[33, "free_cursor_asks", 13]
|
|
10791
|
+
[33, "free_cursor_asks", 13],
|
|
10792
|
+
[34, "ability", 13],
|
|
10793
|
+
[35, "ability_player", 13],
|
|
10794
|
+
[36, "cues", 11, 1, Cue.codec],
|
|
10795
|
+
[37, "ability_bar_presses", 8],
|
|
10796
|
+
[38, "ability_display", 11, 1, AbilityRow.codec]
|
|
10476
10797
|
],
|
|
10477
10798
|
{
|
|
10478
10799
|
decode: (r, end, m) => {
|
|
@@ -10619,6 +10940,25 @@ var Node = /* @__PURE__ */ createMessageType(
|
|
|
10619
10940
|
case 33:
|
|
10620
10941
|
m.freeCursorAsks = r.uint32();
|
|
10621
10942
|
break;
|
|
10943
|
+
case 34:
|
|
10944
|
+
m.ability = r.uint32();
|
|
10945
|
+
break;
|
|
10946
|
+
case 35:
|
|
10947
|
+
m.abilityPlayer = r.uint32();
|
|
10948
|
+
break;
|
|
10949
|
+
case 36:
|
|
10950
|
+
;
|
|
10951
|
+
(m.cues ??= []).push(Cue.decode(r, r.delimited(), {}));
|
|
10952
|
+
break;
|
|
10953
|
+
case 37:
|
|
10954
|
+
m.abilityBarPresses = r.bool();
|
|
10955
|
+
break;
|
|
10956
|
+
case 38:
|
|
10957
|
+
;
|
|
10958
|
+
(m.abilityDisplay ??= []).push(
|
|
10959
|
+
AbilityRow.decode(r, r.delimited(), {})
|
|
10960
|
+
);
|
|
10961
|
+
break;
|
|
10622
10962
|
default:
|
|
10623
10963
|
r.skip(t);
|
|
10624
10964
|
}
|
|
@@ -10772,6 +11112,177 @@ var Node = /* @__PURE__ */ createMessageType(
|
|
|
10772
11112
|
const v = m.freeCursorAsks;
|
|
10773
11113
|
if (v) w.uint32(264).uint32(v);
|
|
10774
11114
|
}
|
|
11115
|
+
{
|
|
11116
|
+
const v = m.ability;
|
|
11117
|
+
if (v) w.uint32(272).uint32(v);
|
|
11118
|
+
}
|
|
11119
|
+
{
|
|
11120
|
+
const v = m.abilityPlayer;
|
|
11121
|
+
if (v) w.uint32(280).uint32(v);
|
|
11122
|
+
}
|
|
11123
|
+
{
|
|
11124
|
+
const a = m.cues;
|
|
11125
|
+
if (a != null) for (const e of a) Cue.writeField(w, 36, e);
|
|
11126
|
+
}
|
|
11127
|
+
{
|
|
11128
|
+
const v = m.abilityBarPresses;
|
|
11129
|
+
if (v) w.uint32(296).bool(v);
|
|
11130
|
+
}
|
|
11131
|
+
{
|
|
11132
|
+
const a = m.abilityDisplay;
|
|
11133
|
+
if (a != null) for (const e of a) AbilityRow.writeField(w, 38, e);
|
|
11134
|
+
}
|
|
11135
|
+
}
|
|
11136
|
+
}
|
|
11137
|
+
);
|
|
11138
|
+
var AbilityRow = /* @__PURE__ */ createMessageType(
|
|
11139
|
+
"modlock.wasm.ui.AbilityRow",
|
|
11140
|
+
() => [
|
|
11141
|
+
[1, "player", 13],
|
|
11142
|
+
[2, "name", 9],
|
|
11143
|
+
[3, "hero", 9],
|
|
11144
|
+
[4, "own", 8],
|
|
11145
|
+
[5, "abilities", 11, 1, ShownAbility.codec]
|
|
11146
|
+
],
|
|
11147
|
+
{
|
|
11148
|
+
decode: (r, end, m) => {
|
|
11149
|
+
while (r.pos < end) {
|
|
11150
|
+
const t = r.tag();
|
|
11151
|
+
if ((t & 7) === 4) return m;
|
|
11152
|
+
switch (t >>> 3) {
|
|
11153
|
+
case 1:
|
|
11154
|
+
m.player = r.uint32();
|
|
11155
|
+
break;
|
|
11156
|
+
case 2:
|
|
11157
|
+
m.name = r.string();
|
|
11158
|
+
break;
|
|
11159
|
+
case 3:
|
|
11160
|
+
m.hero = r.string();
|
|
11161
|
+
break;
|
|
11162
|
+
case 4:
|
|
11163
|
+
m.own = r.bool();
|
|
11164
|
+
break;
|
|
11165
|
+
case 5:
|
|
11166
|
+
;
|
|
11167
|
+
(m.abilities ??= []).push(
|
|
11168
|
+
ShownAbility.decode(r, r.delimited(), {})
|
|
11169
|
+
);
|
|
11170
|
+
break;
|
|
11171
|
+
default:
|
|
11172
|
+
r.skip(t);
|
|
11173
|
+
}
|
|
11174
|
+
}
|
|
11175
|
+
return m;
|
|
11176
|
+
},
|
|
11177
|
+
encode: (m, w) => {
|
|
11178
|
+
{
|
|
11179
|
+
const v = m.player;
|
|
11180
|
+
if (v) w.uint32(8).uint32(v);
|
|
11181
|
+
}
|
|
11182
|
+
{
|
|
11183
|
+
const v = m.name;
|
|
11184
|
+
if (v) w.uint32(18).string(v);
|
|
11185
|
+
}
|
|
11186
|
+
{
|
|
11187
|
+
const v = m.hero;
|
|
11188
|
+
if (v) w.uint32(26).string(v);
|
|
11189
|
+
}
|
|
11190
|
+
{
|
|
11191
|
+
const v = m.own;
|
|
11192
|
+
if (v) w.uint32(32).bool(v);
|
|
11193
|
+
}
|
|
11194
|
+
{
|
|
11195
|
+
const a = m.abilities;
|
|
11196
|
+
if (a != null) for (const e of a) ShownAbility.writeField(w, 5, e);
|
|
11197
|
+
}
|
|
11198
|
+
}
|
|
11199
|
+
}
|
|
11200
|
+
);
|
|
11201
|
+
var ShownAbility = /* @__PURE__ */ createMessageType(
|
|
11202
|
+
"modlock.wasm.ui.ShownAbility",
|
|
11203
|
+
() => [
|
|
11204
|
+
[1, "ability", 13],
|
|
11205
|
+
[2, "image", 9],
|
|
11206
|
+
[3, "upgrades", 13]
|
|
11207
|
+
],
|
|
11208
|
+
{
|
|
11209
|
+
decode: (r, end, m) => {
|
|
11210
|
+
while (r.pos < end) {
|
|
11211
|
+
const t = r.tag();
|
|
11212
|
+
if ((t & 7) === 4) return m;
|
|
11213
|
+
switch (t >>> 3) {
|
|
11214
|
+
case 1:
|
|
11215
|
+
m.ability = r.uint32();
|
|
11216
|
+
break;
|
|
11217
|
+
case 2:
|
|
11218
|
+
m.image = r.string();
|
|
11219
|
+
break;
|
|
11220
|
+
case 3:
|
|
11221
|
+
m.upgrades = r.uint32();
|
|
11222
|
+
break;
|
|
11223
|
+
default:
|
|
11224
|
+
r.skip(t);
|
|
11225
|
+
}
|
|
11226
|
+
}
|
|
11227
|
+
return m;
|
|
11228
|
+
},
|
|
11229
|
+
encode: (m, w) => {
|
|
11230
|
+
{
|
|
11231
|
+
const v = m.ability;
|
|
11232
|
+
if (v) w.uint32(8).uint32(v);
|
|
11233
|
+
}
|
|
11234
|
+
{
|
|
11235
|
+
const v = m.image;
|
|
11236
|
+
if (v) w.uint32(18).string(v);
|
|
11237
|
+
}
|
|
11238
|
+
{
|
|
11239
|
+
const v = m.upgrades;
|
|
11240
|
+
if (v) w.uint32(24).uint32(v);
|
|
11241
|
+
}
|
|
11242
|
+
}
|
|
11243
|
+
}
|
|
11244
|
+
);
|
|
11245
|
+
var Cue = /* @__PURE__ */ createMessageType(
|
|
11246
|
+
"modlock.wasm.ui.Cue",
|
|
11247
|
+
() => [
|
|
11248
|
+
[1, "number", 13],
|
|
11249
|
+
[2, "sound", 9],
|
|
11250
|
+
[3, "seconds", 2]
|
|
11251
|
+
],
|
|
11252
|
+
{
|
|
11253
|
+
decode: (r, end, m) => {
|
|
11254
|
+
while (r.pos < end) {
|
|
11255
|
+
const t = r.tag();
|
|
11256
|
+
if ((t & 7) === 4) return m;
|
|
11257
|
+
switch (t >>> 3) {
|
|
11258
|
+
case 1:
|
|
11259
|
+
m.number = r.uint32();
|
|
11260
|
+
break;
|
|
11261
|
+
case 2:
|
|
11262
|
+
m.sound = r.string();
|
|
11263
|
+
break;
|
|
11264
|
+
case 3:
|
|
11265
|
+
m.seconds = r.float();
|
|
11266
|
+
break;
|
|
11267
|
+
default:
|
|
11268
|
+
r.skip(t);
|
|
11269
|
+
}
|
|
11270
|
+
}
|
|
11271
|
+
return m;
|
|
11272
|
+
},
|
|
11273
|
+
encode: (m, w) => {
|
|
11274
|
+
{
|
|
11275
|
+
const v = m.number;
|
|
11276
|
+
if (v) w.uint32(8).uint32(v);
|
|
11277
|
+
}
|
|
11278
|
+
{
|
|
11279
|
+
const v = m.sound;
|
|
11280
|
+
if (v) w.uint32(18).string(v);
|
|
11281
|
+
}
|
|
11282
|
+
{
|
|
11283
|
+
const v = m.seconds;
|
|
11284
|
+
if (v != null && v !== 0) w.uint32(29).float(v);
|
|
11285
|
+
}
|
|
10775
11286
|
}
|
|
10776
11287
|
}
|
|
10777
11288
|
);
|
|
@@ -12324,6 +12835,13 @@ function fromTraceHit(message) {
|
|
|
12324
12835
|
entity: message.entity ?? 0
|
|
12325
12836
|
};
|
|
12326
12837
|
}
|
|
12838
|
+
function toSoundOptions(value) {
|
|
12839
|
+
return {
|
|
12840
|
+
volume: value.volume,
|
|
12841
|
+
pitch: value.pitch,
|
|
12842
|
+
listeners: value.listeners?.map((v) => int32(v))
|
|
12843
|
+
};
|
|
12844
|
+
}
|
|
12327
12845
|
function toFieldValue(value) {
|
|
12328
12846
|
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 };
|
|
12329
12847
|
}
|
|
@@ -12996,10 +13514,34 @@ var Player = class _Player {
|
|
|
12996
13514
|
return call("GiveItem", GiveItemRequest.toBinary({ player: this.slot, item: item2, imbue })) !== void 0;
|
|
12997
13515
|
}
|
|
12998
13516
|
/**
|
|
12999
|
-
*
|
|
13000
|
-
*
|
|
13001
|
-
*
|
|
13002
|
-
*
|
|
13517
|
+
* buyItem buys an item for the hero as the shop does, under the shop's own
|
|
13518
|
+
* rules and for the souls it charges, or fails and charges nothing when the
|
|
13519
|
+
* shop refuses, as away from the shop or without the souls. With imbue, an
|
|
13520
|
+
* imbuing item strengthens whatever ability the hero holds in that slot, 0
|
|
13521
|
+
* to 3, including one ReplaceAbility put there, which the game's own
|
|
13522
|
+
* buydependentitem refuses; the call fails, buying nothing, when the
|
|
13523
|
+
* ability does not accept it.
|
|
13524
|
+
*/
|
|
13525
|
+
buyItem(item2, imbue, source) {
|
|
13526
|
+
return call("BuyItem", BuyItemRequest.toBinary({ player: this.slot, item: item2, imbue, source })) !== void 0;
|
|
13527
|
+
}
|
|
13528
|
+
/**
|
|
13529
|
+
* trainAbility trains or upgrades whatever ability the hero holds in a
|
|
13530
|
+
* slot, 0 to 3, as the player holding the upgrade key and pressing the
|
|
13531
|
+
* slot's ability key does: an untrained ability trains for an ability
|
|
13532
|
+
* unlock, and a trained one buys its next tier for ability points. It works
|
|
13533
|
+
* on an ability ReplaceAbility put there, which the game's own commands for
|
|
13534
|
+
* a slot do not reach. When the game refuses, as without an unlock or the
|
|
13535
|
+
* points, the call fails and nothing is spent.
|
|
13536
|
+
*/
|
|
13537
|
+
trainAbility(slot) {
|
|
13538
|
+
return call("TrainAbility", TrainAbilityRequest.toBinary({ player: this.slot, slot })) !== void 0;
|
|
13539
|
+
}
|
|
13540
|
+
/**
|
|
13541
|
+
* replaceAbility puts the ability named ability, untrained unless keep
|
|
13542
|
+
* carries the old one's progress, in the hero's ability slot index, as
|
|
13543
|
+
* Ability.slot, removing the ability there. The game trains and upgrades an
|
|
13544
|
+
* ability in slots 0 to 3 by its slot, so a player holds the upgrade key and
|
|
13003
13545
|
* presses the slot's ability key to spend ability points on it, and training
|
|
13004
13546
|
* an untrained one costs an ability unlock. A hero change or ResetHero gives
|
|
13005
13547
|
* the hero its own abilities again, so a mod that keeps a swap replaces
|
|
@@ -13116,10 +13658,14 @@ var Player = class _Player {
|
|
|
13116
13658
|
}
|
|
13117
13659
|
/**
|
|
13118
13660
|
* sound plays a game sound event, such as Damage.Send.Crit, on the
|
|
13119
|
-
* player's hero.
|
|
13661
|
+
* player's hero, and returns its ID. It follows the hero as it moves.
|
|
13662
|
+
* Volume and pitch scale the sound, and listeners limit who hears it.
|
|
13120
13663
|
*/
|
|
13121
|
-
sound(sound) {
|
|
13122
|
-
|
|
13664
|
+
sound(sound, options) {
|
|
13665
|
+
const reply2 = call("Sound", SoundRequest.toBinary({ player: this.slot, sound, options: options === void 0 ? void 0 : toSoundOptions(options) }));
|
|
13666
|
+
if (reply2 === void 0) return void 0;
|
|
13667
|
+
const response = SoundResponse.fromBinary(reply2);
|
|
13668
|
+
return response.id ?? 0;
|
|
13123
13669
|
}
|
|
13124
13670
|
/**
|
|
13125
13671
|
* restoreHero gives the player's live hero target over the next few
|
|
@@ -13146,6 +13692,13 @@ var Player = class _Player {
|
|
|
13146
13692
|
clearScreenEffect(effect) {
|
|
13147
13693
|
return call("ClearScreenEffect", ClearScreenEffectRequest.toBinary({ player: this.slot, effect: screenEffectValues[effect] })) !== void 0;
|
|
13148
13694
|
}
|
|
13695
|
+
/**
|
|
13696
|
+
* silenceVoice keeps the player's hero from speaking the named voice
|
|
13697
|
+
* concepts until called again, on top of those silenced for everyone.
|
|
13698
|
+
*/
|
|
13699
|
+
silenceVoice(concepts) {
|
|
13700
|
+
return call("SilencePlayerVoice", SilencePlayerVoiceRequest.toBinary({ player: this.slot, concepts: concepts?.slice() })) !== void 0;
|
|
13701
|
+
}
|
|
13149
13702
|
/** removeBot removes a bot the mod added. */
|
|
13150
13703
|
removeBot() {
|
|
13151
13704
|
return call("RemoveBot", PlayerRequest.toBinary({ player: this.slot })) !== void 0;
|
|
@@ -13360,6 +13913,9 @@ function heroBuild(hero) {
|
|
|
13360
13913
|
const response = HeroBuildResponse.fromBinary(reply2);
|
|
13361
13914
|
return (response.categories ?? []).map((v) => fromBuildCategory(v));
|
|
13362
13915
|
}
|
|
13916
|
+
function silenceVoice(concepts) {
|
|
13917
|
+
return call("SilenceVoice", SilenceVoiceRequest.toBinary({ concepts: concepts?.slice() })) !== void 0;
|
|
13918
|
+
}
|
|
13363
13919
|
function readField(entity, className, field, type) {
|
|
13364
13920
|
const reply2 = call("ReadField", ReadFieldRequest.toBinary({ entity, className, field, type: fieldTypeValues[type] }));
|
|
13365
13921
|
if (reply2 === void 0) return void 0;
|
|
@@ -13561,8 +14117,17 @@ function moveEntity(entity, position, facing, velocity) {
|
|
|
13561
14117
|
function pushEntity(entity, velocity, spin) {
|
|
13562
14118
|
return call("PushEntity", PushEntityRequest.toBinary({ entity, velocity, spin })) !== void 0;
|
|
13563
14119
|
}
|
|
13564
|
-
function emitSound(entity, sound) {
|
|
13565
|
-
|
|
14120
|
+
function emitSound(entity, sound, options) {
|
|
14121
|
+
const reply2 = call("EmitSound", EmitSoundRequest.toBinary({ entity, sound, options: options === void 0 ? void 0 : toSoundOptions(options) }));
|
|
14122
|
+
if (reply2 === void 0) return void 0;
|
|
14123
|
+
const response = SoundResponse.fromBinary(reply2);
|
|
14124
|
+
return response.id ?? 0;
|
|
14125
|
+
}
|
|
14126
|
+
function adjustSound(id, volume, pitch) {
|
|
14127
|
+
return call("AdjustSound", AdjustSoundRequest.toBinary({ id, volume, pitch })) !== void 0;
|
|
14128
|
+
}
|
|
14129
|
+
function stopSound(id) {
|
|
14130
|
+
return call("StopSound", StopSoundRequest.toBinary({ id })) !== void 0;
|
|
13566
14131
|
}
|
|
13567
14132
|
function watchProjectiles(options) {
|
|
13568
14133
|
return call("WatchProjectiles", ProjectileOptions.toBinary(toProjectileOptions(options))) !== void 0;
|
|
@@ -13697,10 +14262,10 @@ function lerpAngle(a, b, t) {
|
|
|
13697
14262
|
function poseAt(track, tick2) {
|
|
13698
14263
|
const last = track.x.length - 1;
|
|
13699
14264
|
if (last < 0) return void 0;
|
|
13700
|
-
const
|
|
13701
|
-
const i = Math.min(Math.floor(
|
|
14265
|
+
const at3 = Math.min(Math.max(tick2 / track.stepTicks, 0), last);
|
|
14266
|
+
const i = Math.min(Math.floor(at3), Math.max(last - 1, 0));
|
|
13702
14267
|
const j = Math.min(i + 1, last);
|
|
13703
|
-
const t =
|
|
14268
|
+
const t = at3 - i;
|
|
13704
14269
|
const seconds = track.stepTicks / ticksPerSecond;
|
|
13705
14270
|
const blend = (column) => lerp(sample(column, i), sample(column, j), t);
|
|
13706
14271
|
const slope = (column) => (sample(column, j) - sample(column, i)) / seconds;
|
|
@@ -13881,12 +14446,12 @@ var Puppet = class _Puppet {
|
|
|
13881
14446
|
const pose = poseAt(this.track, this.tickAt);
|
|
13882
14447
|
if (!pawn || !pose) return;
|
|
13883
14448
|
this.syncLook(pawn.entity);
|
|
13884
|
-
const
|
|
14449
|
+
const gap2 = Math.hypot(
|
|
13885
14450
|
pose.position.x - pawn.position.x,
|
|
13886
14451
|
pose.position.y - pawn.position.y,
|
|
13887
14452
|
pose.position.z - pawn.position.z
|
|
13888
14453
|
);
|
|
13889
|
-
const placed =
|
|
14454
|
+
const placed = gap2 > this.snapUnits || this.current !== "playing" ? this.player.teleport(pose.position, pose.facing) : this.player.move(pose.position, pose.facing, pose.velocity);
|
|
13890
14455
|
if (placed) this.drawn = true;
|
|
13891
14456
|
this.setHealth(pawn.entity, pose.health);
|
|
13892
14457
|
}
|
|
@@ -14031,7 +14596,7 @@ function advance(seconds) {
|
|
|
14031
14596
|
function itemId(name) {
|
|
14032
14597
|
const m = 1540483477;
|
|
14033
14598
|
const data = new TextEncoder().encode(name);
|
|
14034
|
-
const byte = (
|
|
14599
|
+
const byte = (at3) => data[at3] ?? 0;
|
|
14035
14600
|
let h = (826366246 ^ data.length) >>> 0;
|
|
14036
14601
|
let i = 0;
|
|
14037
14602
|
for (; data.length - i >= 4; i += 4) {
|
|
@@ -14054,1153 +14619,6 @@ function itemId(name) {
|
|
|
14054
14619
|
return (h ^ h >>> 15) >>> 0;
|
|
14055
14620
|
}
|
|
14056
14621
|
|
|
14057
|
-
// js/src/ui.ts
|
|
14058
|
-
function jsx(type, props, key) {
|
|
14059
|
-
const named = key === void 0 ? void 0 : String(key);
|
|
14060
|
-
if (typeof type === "function") {
|
|
14061
|
-
return { type: fragment, props: { children: type(props) }, key: named };
|
|
14062
|
-
}
|
|
14063
|
-
return { type, props, key: named };
|
|
14064
|
-
}
|
|
14065
|
-
var fragment = "fragment";
|
|
14066
|
-
var jsxs = jsx;
|
|
14067
|
-
function Fragment(props) {
|
|
14068
|
-
return props.children;
|
|
14069
|
-
}
|
|
14070
|
-
function show(player, root) {
|
|
14071
|
-
views.set(player.slot, { ...view(player), root });
|
|
14072
|
-
return draw(player);
|
|
14073
|
-
}
|
|
14074
|
-
function hideHud(player, parts) {
|
|
14075
|
-
views.set(player.slot, { ...view(player), hud: parts });
|
|
14076
|
-
return draw(player);
|
|
14077
|
-
}
|
|
14078
|
-
function freeCursor(player, free) {
|
|
14079
|
-
const current = view(player);
|
|
14080
|
-
views.set(player.slot, {
|
|
14081
|
-
...current,
|
|
14082
|
-
cursor: free,
|
|
14083
|
-
asks: free ? current.asks + 1 : current.asks
|
|
14084
|
-
});
|
|
14085
|
-
return draw(player);
|
|
14086
|
-
}
|
|
14087
|
-
function cursorFree(player) {
|
|
14088
|
-
const pawn = player.pawn();
|
|
14089
|
-
if (pawn === void 0) return void 0;
|
|
14090
|
-
return readField(
|
|
14091
|
-
pawn.entity,
|
|
14092
|
-
"CCitadelPlayer_MovementServices",
|
|
14093
|
-
"m_bHasFreeCursor",
|
|
14094
|
-
"bool"
|
|
14095
|
-
);
|
|
14096
|
-
}
|
|
14097
|
-
function sheet(path) {
|
|
14098
|
-
if (!path.endsWith(".css") || !path.split("/").every((part) => sheetPart.test(part) && part !== "..")) {
|
|
14099
|
-
return false;
|
|
14100
|
-
}
|
|
14101
|
-
if (sheets.includes(path)) {
|
|
14102
|
-
return true;
|
|
14103
|
-
}
|
|
14104
|
-
sheets.push(path);
|
|
14105
|
-
for (const current of views.values()) {
|
|
14106
|
-
draw(current.player);
|
|
14107
|
-
}
|
|
14108
|
-
return true;
|
|
14109
|
-
}
|
|
14110
|
-
var sheetPart = /^[\w.-]+$/;
|
|
14111
|
-
var sheets = [];
|
|
14112
|
-
function route(player, name, value) {
|
|
14113
|
-
const routes = new Map(view(player).routes);
|
|
14114
|
-
const encoded = value === void 0 ? void 0 : JSON.stringify(value);
|
|
14115
|
-
if (!routeName.test(name) || value !== void 0 && encoded === void 0) {
|
|
14116
|
-
return false;
|
|
14117
|
-
}
|
|
14118
|
-
if (encoded === void 0) {
|
|
14119
|
-
routes.delete(name);
|
|
14120
|
-
} else {
|
|
14121
|
-
routes.set(name, encoded);
|
|
14122
|
-
}
|
|
14123
|
-
views.set(player.slot, { ...view(player), routes });
|
|
14124
|
-
return draw(player);
|
|
14125
|
-
}
|
|
14126
|
-
var routeName = /^[\w.-]+$/;
|
|
14127
|
-
function hide(player) {
|
|
14128
|
-
views.delete(player.slot);
|
|
14129
|
-
screens.delete(player.slot);
|
|
14130
|
-
return send(player.slot, { reset: true });
|
|
14131
|
-
}
|
|
14132
|
-
function toast(player, text2, seconds = 4) {
|
|
14133
|
-
const current = view(player);
|
|
14134
|
-
const notice = { id: nextNotice++, text: text2, until: now2 + seconds };
|
|
14135
|
-
views.set(player.slot, {
|
|
14136
|
-
...current,
|
|
14137
|
-
notices: [...current.notices, notice].slice(-maxNotices)
|
|
14138
|
-
});
|
|
14139
|
-
return draw(player);
|
|
14140
|
-
}
|
|
14141
|
-
function press(player, node) {
|
|
14142
|
-
const pressed = screens.get(player.slot)?.presses.get(node);
|
|
14143
|
-
if (pressed) {
|
|
14144
|
-
pressed.handler(player);
|
|
14145
|
-
}
|
|
14146
|
-
}
|
|
14147
|
-
function change(player, node, value) {
|
|
14148
|
-
if (typeof value === "object" && value !== null) {
|
|
14149
|
-
screens.get(player.slot)?.wheels.get(node)?.handler(player, value);
|
|
14150
|
-
return;
|
|
14151
|
-
}
|
|
14152
|
-
const changed = screens.get(player.slot)?.changes.get(node);
|
|
14153
|
-
if (changed) {
|
|
14154
|
-
changed.handler(player, value);
|
|
14155
|
-
}
|
|
14156
|
-
}
|
|
14157
|
-
function tick(seconds) {
|
|
14158
|
-
now2 = seconds;
|
|
14159
|
-
for (const current of views.values()) {
|
|
14160
|
-
if (current.notices.length === 0) {
|
|
14161
|
-
continue;
|
|
14162
|
-
}
|
|
14163
|
-
current.notices = current.notices.filter((notice) => notice.until > now2);
|
|
14164
|
-
draw(current.player);
|
|
14165
|
-
}
|
|
14166
|
-
}
|
|
14167
|
-
var views = /* @__PURE__ */ new Map();
|
|
14168
|
-
var now2 = 0;
|
|
14169
|
-
var nextNotice = 0;
|
|
14170
|
-
var maxNotices = 4;
|
|
14171
|
-
var noticeMotion = {
|
|
14172
|
-
enter: { opacity: 0, translate: [-16, 0] },
|
|
14173
|
-
exit: { opacity: 0 },
|
|
14174
|
-
transition: { seconds: 0.25, easing: "out" }
|
|
14175
|
-
};
|
|
14176
|
-
function view(player) {
|
|
14177
|
-
return views.get(player.slot) ?? {
|
|
14178
|
-
player,
|
|
14179
|
-
root: void 0,
|
|
14180
|
-
hud: [],
|
|
14181
|
-
cursor: false,
|
|
14182
|
-
asks: 0,
|
|
14183
|
-
routes: /* @__PURE__ */ new Map(),
|
|
14184
|
-
notices: []
|
|
14185
|
-
};
|
|
14186
|
-
}
|
|
14187
|
-
function draw(player) {
|
|
14188
|
-
const current = view(player);
|
|
14189
|
-
const root = [
|
|
14190
|
-
current.root,
|
|
14191
|
-
current.notices.length !== 0 && notices(current.notices)
|
|
14192
|
-
];
|
|
14193
|
-
const previous = screens.get(player.slot);
|
|
14194
|
-
const hud = current.hud.map((part) => hudParts[part]);
|
|
14195
|
-
const next = render(
|
|
14196
|
-
previous,
|
|
14197
|
-
root,
|
|
14198
|
-
hud,
|
|
14199
|
-
current.cursor,
|
|
14200
|
-
current.asks,
|
|
14201
|
-
current.routes
|
|
14202
|
-
);
|
|
14203
|
-
const change2 = diff(previous, next);
|
|
14204
|
-
if (change2 && !send(player.slot, change2)) {
|
|
14205
|
-
const whole = render(
|
|
14206
|
-
void 0,
|
|
14207
|
-
root,
|
|
14208
|
-
hud,
|
|
14209
|
-
current.cursor,
|
|
14210
|
-
current.asks,
|
|
14211
|
-
current.routes
|
|
14212
|
-
);
|
|
14213
|
-
if (!send(player.slot, diff(void 0, whole))) {
|
|
14214
|
-
screens.delete(player.slot);
|
|
14215
|
-
return false;
|
|
14216
|
-
}
|
|
14217
|
-
screens.set(player.slot, whole);
|
|
14218
|
-
return true;
|
|
14219
|
-
}
|
|
14220
|
-
screens.set(player.slot, next);
|
|
14221
|
-
return true;
|
|
14222
|
-
}
|
|
14223
|
-
function notices(stack) {
|
|
14224
|
-
const style = {
|
|
14225
|
-
width: "fit",
|
|
14226
|
-
height: "fit",
|
|
14227
|
-
flow: "down",
|
|
14228
|
-
horizontalAlign: "left",
|
|
14229
|
-
verticalAlign: "bottom",
|
|
14230
|
-
margin: [0, 0, 260, 24],
|
|
14231
|
-
transition: noticeMotion.transition
|
|
14232
|
-
};
|
|
14233
|
-
const labels = stack.map(
|
|
14234
|
-
(notice) => jsx(
|
|
14235
|
-
"label",
|
|
14236
|
-
{
|
|
14237
|
-
style: {
|
|
14238
|
-
horizontalAlign: "left",
|
|
14239
|
-
margin: [4, 0, 0, 0],
|
|
14240
|
-
padding: [5, 10],
|
|
14241
|
-
background: "#101418d8",
|
|
14242
|
-
color: "#f2f2f2",
|
|
14243
|
-
fontSize: 16,
|
|
14244
|
-
borderRadius: 4,
|
|
14245
|
-
transition: noticeMotion.transition
|
|
14246
|
-
},
|
|
14247
|
-
enter: noticeMotion.enter,
|
|
14248
|
-
exit: noticeMotion.exit,
|
|
14249
|
-
children: notice.text
|
|
14250
|
-
},
|
|
14251
|
-
notice.id
|
|
14252
|
-
)
|
|
14253
|
-
);
|
|
14254
|
-
return jsx("panel", { style, exit: noticeMotion.exit, children: labels });
|
|
14255
|
-
}
|
|
14256
|
-
var screens = /* @__PURE__ */ new Map();
|
|
14257
|
-
function render(previous, root, hud, cursor, asks, routes) {
|
|
14258
|
-
const layout = new Layout(previous);
|
|
14259
|
-
layout.add({
|
|
14260
|
-
id: "",
|
|
14261
|
-
kind: 0 /* PANEL */,
|
|
14262
|
-
children: place(layout, root, "/"),
|
|
14263
|
-
hideHud: [...hud],
|
|
14264
|
-
freeCursor: cursor,
|
|
14265
|
-
freeCursorAsks: asks,
|
|
14266
|
-
sheets: [...sheets]
|
|
14267
|
-
});
|
|
14268
|
-
for (const [name, data] of routes) {
|
|
14269
|
-
layout.add({ id: `route:${name}`, kind: 5 /* ROUTE */, route: name, data });
|
|
14270
|
-
}
|
|
14271
|
-
return layout.screen;
|
|
14272
|
-
}
|
|
14273
|
-
var Layout = class {
|
|
14274
|
-
screen;
|
|
14275
|
-
previous;
|
|
14276
|
-
/** The layout continues previous's id counter and keeps its ids. */
|
|
14277
|
-
constructor(previous) {
|
|
14278
|
-
this.previous = previous;
|
|
14279
|
-
this.screen = {
|
|
14280
|
-
nodes: /* @__PURE__ */ new Map(),
|
|
14281
|
-
ids: /* @__PURE__ */ new Map(),
|
|
14282
|
-
presses: /* @__PURE__ */ new Map(),
|
|
14283
|
-
changes: /* @__PURE__ */ new Map(),
|
|
14284
|
-
wheels: /* @__PURE__ */ new Map(),
|
|
14285
|
-
next: previous?.next ?? 0
|
|
14286
|
-
};
|
|
14287
|
-
}
|
|
14288
|
-
/** add records a node. */
|
|
14289
|
-
add(node) {
|
|
14290
|
-
const value = node.steamId === void 0 ? node : { ...node, steamId: String(node.steamId) };
|
|
14291
|
-
const encoded = JSON.stringify(value);
|
|
14292
|
-
this.screen.nodes.set(node.id, { node, encoded });
|
|
14293
|
-
}
|
|
14294
|
-
/** id returns the node id for the element at place. */
|
|
14295
|
-
id(place2) {
|
|
14296
|
-
let found = this.previous?.ids.get(place2);
|
|
14297
|
-
if (found === void 0) {
|
|
14298
|
-
found = (this.screen.next++).toString(36);
|
|
14299
|
-
}
|
|
14300
|
-
this.screen.ids.set(place2, found);
|
|
14301
|
-
return found;
|
|
14302
|
-
}
|
|
14303
|
-
};
|
|
14304
|
-
function place(layout, child, at2) {
|
|
14305
|
-
if (child === null || child === void 0 || typeof child === "boolean") {
|
|
14306
|
-
return [];
|
|
14307
|
-
}
|
|
14308
|
-
if (isList(child)) {
|
|
14309
|
-
return child.flatMap((item2, index) => {
|
|
14310
|
-
const key = isElement(item2) ? item2.key : void 0;
|
|
14311
|
-
return place(
|
|
14312
|
-
layout,
|
|
14313
|
-
item2,
|
|
14314
|
-
key === void 0 ? `${at2},${index}` : `${at2},=${key}`
|
|
14315
|
-
);
|
|
14316
|
-
});
|
|
14317
|
-
}
|
|
14318
|
-
if (!isElement(child)) {
|
|
14319
|
-
const node2 = {
|
|
14320
|
-
id: layout.id(at2),
|
|
14321
|
-
kind: 1 /* LABEL */,
|
|
14322
|
-
text: String(child)
|
|
14323
|
-
};
|
|
14324
|
-
layout.add(node2);
|
|
14325
|
-
return [node2.id];
|
|
14326
|
-
}
|
|
14327
|
-
if (child.type === fragment) {
|
|
14328
|
-
return place(layout, child.props.children, `${at2}>`);
|
|
14329
|
-
}
|
|
14330
|
-
const props = child.props;
|
|
14331
|
-
const node = {
|
|
14332
|
-
id: layout.id(at2),
|
|
14333
|
-
style: wireStyle(props.style),
|
|
14334
|
-
hover: wireStyle(props.hover),
|
|
14335
|
-
tooltip: props.tooltip,
|
|
14336
|
-
item: props.item ? itemId(props.item) : void 0,
|
|
14337
|
-
hoverSound: props.hoverSound,
|
|
14338
|
-
enter: wireStyle(props.enter),
|
|
14339
|
-
exit: wireStyle(props.exit),
|
|
14340
|
-
cycle: cycle(props.cycle),
|
|
14341
|
-
classes: classes(props.class)
|
|
14342
|
-
};
|
|
14343
|
-
switch (child.type) {
|
|
14344
|
-
case "label":
|
|
14345
|
-
node.kind = 1 /* LABEL */;
|
|
14346
|
-
node.text = text(props.children);
|
|
14347
|
-
node.token = props.token;
|
|
14348
|
-
node.variables = variables(props.variables);
|
|
14349
|
-
break;
|
|
14350
|
-
case "avatar":
|
|
14351
|
-
node.kind = 8 /* AVATAR */;
|
|
14352
|
-
node.steamId = props.steamId;
|
|
14353
|
-
break;
|
|
14354
|
-
case "entry":
|
|
14355
|
-
case "slider":
|
|
14356
|
-
case "toggle":
|
|
14357
|
-
case "dropdown":
|
|
14358
|
-
input(layout, node, child.type, props);
|
|
14359
|
-
break;
|
|
14360
|
-
case "image":
|
|
14361
|
-
node.kind = 2 /* IMAGE */;
|
|
14362
|
-
node.image = props.src ?? "";
|
|
14363
|
-
node.scaling = scaling(props.scaling);
|
|
14364
|
-
break;
|
|
14365
|
-
case "hero":
|
|
14366
|
-
node.kind = 6 /* HERO_IMAGE */;
|
|
14367
|
-
node.hero = props.hero;
|
|
14368
|
-
node.heroLook = props.look === void 0 ? void 0 : looks[props.look];
|
|
14369
|
-
node.scaling = scaling(props.scaling);
|
|
14370
|
-
break;
|
|
14371
|
-
case "button":
|
|
14372
|
-
node.kind = 3 /* BUTTON */;
|
|
14373
|
-
node.sound = props.sound;
|
|
14374
|
-
node.disabled = props.disabled;
|
|
14375
|
-
if (props.onPress && !props.disabled) {
|
|
14376
|
-
layout.screen.presses.set(node.id, { handler: props.onPress });
|
|
14377
|
-
}
|
|
14378
|
-
node.children = place(layout, props.children, `${at2}/`);
|
|
14379
|
-
break;
|
|
14380
|
-
case "layout":
|
|
14381
|
-
node.kind = 4 /* LAYOUT */;
|
|
14382
|
-
node.layout = props.src ?? "";
|
|
14383
|
-
node.data = props.data === void 0 ? "" : JSON.stringify(props.data) ?? "";
|
|
14384
|
-
break;
|
|
14385
|
-
default:
|
|
14386
|
-
node.kind = 0 /* PANEL */;
|
|
14387
|
-
node.children = place(layout, props.children, `${at2}/`);
|
|
14388
|
-
}
|
|
14389
|
-
layout.add(node);
|
|
14390
|
-
return [node.id];
|
|
14391
|
-
}
|
|
14392
|
-
function classes(names) {
|
|
14393
|
-
const list = (names ?? "").split(" ").filter((name) => name !== "");
|
|
14394
|
-
return list.length === 0 ? void 0 : list;
|
|
14395
|
-
}
|
|
14396
|
-
function input(layout, node, kind, props) {
|
|
14397
|
-
node.kind = 7 /* INPUT */;
|
|
14398
|
-
node.disabled = props.disabled;
|
|
14399
|
-
if (props.onChange && !props.disabled) {
|
|
14400
|
-
layout.screen.changes.set(node.id, { handler: props.onChange });
|
|
14401
|
-
}
|
|
14402
|
-
switch (kind) {
|
|
14403
|
-
case "entry":
|
|
14404
|
-
node.input = {
|
|
14405
|
-
case: "textEntry",
|
|
14406
|
-
value: {
|
|
14407
|
-
text: String(props.value ?? ""),
|
|
14408
|
-
placeholder: props.placeholder,
|
|
14409
|
-
maxLength: props.maxLength
|
|
14410
|
-
}
|
|
14411
|
-
};
|
|
14412
|
-
break;
|
|
14413
|
-
case "slider":
|
|
14414
|
-
if (props.onWheel && !props.disabled) {
|
|
14415
|
-
layout.screen.wheels.set(node.id, { handler: props.onWheel });
|
|
14416
|
-
}
|
|
14417
|
-
node.input = {
|
|
14418
|
-
case: "slider",
|
|
14419
|
-
value: {
|
|
14420
|
-
value: Number(props.value ?? 0),
|
|
14421
|
-
min: props.min,
|
|
14422
|
-
max: props.max,
|
|
14423
|
-
step: props.step,
|
|
14424
|
-
wheel: !!props.onWheel && !props.disabled
|
|
14425
|
-
}
|
|
14426
|
-
};
|
|
14427
|
-
break;
|
|
14428
|
-
case "toggle":
|
|
14429
|
-
node.text = text(props.children);
|
|
14430
|
-
node.input = { case: "toggle", value: { on: props.on } };
|
|
14431
|
-
break;
|
|
14432
|
-
case "dropdown":
|
|
14433
|
-
node.input = {
|
|
14434
|
-
case: "dropdown",
|
|
14435
|
-
value: {
|
|
14436
|
-
options: [...props.options ?? []],
|
|
14437
|
-
selected: props.selected
|
|
14438
|
-
}
|
|
14439
|
-
};
|
|
14440
|
-
}
|
|
14441
|
-
}
|
|
14442
|
-
function variables(value) {
|
|
14443
|
-
if (!value) {
|
|
14444
|
-
return void 0;
|
|
14445
|
-
}
|
|
14446
|
-
const encoded = {};
|
|
14447
|
-
for (const [name, filled] of Object.entries(value)) {
|
|
14448
|
-
encoded[name] = String(filled);
|
|
14449
|
-
}
|
|
14450
|
-
return encoded;
|
|
14451
|
-
}
|
|
14452
|
-
function cycle(value) {
|
|
14453
|
-
if (!value) {
|
|
14454
|
-
return void 0;
|
|
14455
|
-
}
|
|
14456
|
-
return {
|
|
14457
|
-
style: wireStyle(value.style),
|
|
14458
|
-
seconds: value.seconds,
|
|
14459
|
-
count: value.count
|
|
14460
|
-
};
|
|
14461
|
-
}
|
|
14462
|
-
function diff(previous, next) {
|
|
14463
|
-
const set = [...next.nodes.values()].filter(
|
|
14464
|
-
({ node, encoded }) => previous?.nodes.get(node.id)?.encoded !== encoded
|
|
14465
|
-
).map(({ node }) => node);
|
|
14466
|
-
const removed = [...previous?.nodes.keys() ?? []].filter(
|
|
14467
|
-
(id) => !next.nodes.has(id)
|
|
14468
|
-
);
|
|
14469
|
-
if (previous && set.length === 0 && removed.length === 0) {
|
|
14470
|
-
return void 0;
|
|
14471
|
-
}
|
|
14472
|
-
return { reset: !previous, set, removed };
|
|
14473
|
-
}
|
|
14474
|
-
function send(slot, change2) {
|
|
14475
|
-
return call("Ui", UiRequest.toBinary({ player: slot, change: change2 })) !== void 0;
|
|
14476
|
-
}
|
|
14477
|
-
function isElement(child) {
|
|
14478
|
-
return typeof child === "object" && child !== null && !Array.isArray(child);
|
|
14479
|
-
}
|
|
14480
|
-
function isList(child) {
|
|
14481
|
-
return Array.isArray(child);
|
|
14482
|
-
}
|
|
14483
|
-
function text(children) {
|
|
14484
|
-
if (children === null || children === void 0 || typeof children === "boolean") {
|
|
14485
|
-
return "";
|
|
14486
|
-
}
|
|
14487
|
-
if (isList(children)) {
|
|
14488
|
-
return children.map(text).join("");
|
|
14489
|
-
}
|
|
14490
|
-
return isElement(children) ? "" : String(children);
|
|
14491
|
-
}
|
|
14492
|
-
var aligns = {
|
|
14493
|
-
left: 0 /* START */,
|
|
14494
|
-
top: 0 /* START */,
|
|
14495
|
-
center: 1 /* CENTER */,
|
|
14496
|
-
right: 2 /* END */,
|
|
14497
|
-
bottom: 2 /* END */
|
|
14498
|
-
};
|
|
14499
|
-
function align(value) {
|
|
14500
|
-
return value === void 0 ? void 0 : aligns[value];
|
|
14501
|
-
}
|
|
14502
|
-
var hudParts = {
|
|
14503
|
-
levelUp: 1 /* LEVEL_UP */,
|
|
14504
|
-
ownHealth: 2 /* OWN_HEALTH */,
|
|
14505
|
-
topBar: 3 /* TOP_BAR */,
|
|
14506
|
-
ammo: 4 /* AMMO */,
|
|
14507
|
-
souls: 5 /* SOULS */,
|
|
14508
|
-
minimap: 6 /* MINIMAP */,
|
|
14509
|
-
abilities: 7 /* ABILITIES */,
|
|
14510
|
-
status: 8 /* STATUS */,
|
|
14511
|
-
stats: 9 /* STATS */
|
|
14512
|
-
};
|
|
14513
|
-
var faces = {
|
|
14514
|
-
body: 1 /* BODY */,
|
|
14515
|
-
block: 2 /* BLOCK */,
|
|
14516
|
-
serif: 3 /* SERIF */
|
|
14517
|
-
};
|
|
14518
|
-
var looks = {
|
|
14519
|
-
small: 0 /* SMALL */,
|
|
14520
|
-
card: 1 /* CARD */,
|
|
14521
|
-
icon: 2 /* ICON */,
|
|
14522
|
-
vertical: 3 /* VERTICAL */,
|
|
14523
|
-
topBar: 4 /* TOP_BAR */,
|
|
14524
|
-
minimap: 5 /* MINIMAP */
|
|
14525
|
-
};
|
|
14526
|
-
var scalings = {
|
|
14527
|
-
fit: 1 /* FIT */,
|
|
14528
|
-
cover: 2 /* COVER */,
|
|
14529
|
-
stretch: 3 /* STRETCH */,
|
|
14530
|
-
fitWidth: 4 /* FIT_WIDTH */,
|
|
14531
|
-
fitHeight: 5 /* FIT_HEIGHT */,
|
|
14532
|
-
none: 6 /* NONE */
|
|
14533
|
-
};
|
|
14534
|
-
function scaling(value) {
|
|
14535
|
-
return value === void 0 ? void 0 : scalings[value];
|
|
14536
|
-
}
|
|
14537
|
-
var flows = {
|
|
14538
|
-
down: 1 /* DOWN */,
|
|
14539
|
-
right: 2 /* RIGHT */,
|
|
14540
|
-
downWrap: 3 /* DOWN_WRAP */,
|
|
14541
|
-
rightWrap: 4 /* RIGHT_WRAP */
|
|
14542
|
-
};
|
|
14543
|
-
var overflows = {
|
|
14544
|
-
squish: 1 /* SQUISH */,
|
|
14545
|
-
clip: 2 /* CLIP */,
|
|
14546
|
-
scroll: 3 /* SCROLL */,
|
|
14547
|
-
show: 4 /* SHOW */
|
|
14548
|
-
};
|
|
14549
|
-
function overflow(value) {
|
|
14550
|
-
return value === void 0 ? void 0 : overflows[value];
|
|
14551
|
-
}
|
|
14552
|
-
var shapes = {
|
|
14553
|
-
down: 0 /* DOWN */,
|
|
14554
|
-
right: 1 /* RIGHT */,
|
|
14555
|
-
up: 2 /* UP */,
|
|
14556
|
-
left: 3 /* LEFT */,
|
|
14557
|
-
radial: 4 /* RADIAL */
|
|
14558
|
-
};
|
|
14559
|
-
var weights = {
|
|
14560
|
-
thin: 1 /* THIN */,
|
|
14561
|
-
light: 2 /* LIGHT */,
|
|
14562
|
-
normal: 3 /* NORMAL */,
|
|
14563
|
-
medium: 4 /* MEDIUM */,
|
|
14564
|
-
semiBold: 5 /* SEMI_BOLD */,
|
|
14565
|
-
bold: 6 /* BOLD */,
|
|
14566
|
-
black: 7 /* BLACK */
|
|
14567
|
-
};
|
|
14568
|
-
var textOverflows = {
|
|
14569
|
-
ellipsis: 1 /* ELLIPSIS */,
|
|
14570
|
-
shrink: 2 /* SHRINK */,
|
|
14571
|
-
clip: 3 /* CLIP */
|
|
14572
|
-
};
|
|
14573
|
-
var decorations = {
|
|
14574
|
-
underline: 1 /* UNDERLINE */,
|
|
14575
|
-
strike: 2 /* STRIKE */
|
|
14576
|
-
};
|
|
14577
|
-
var easings = {
|
|
14578
|
-
out: 0 /* EASE_OUT */,
|
|
14579
|
-
in: 1 /* EASE_IN */,
|
|
14580
|
-
inOut: 2 /* EASE_IN_OUT */,
|
|
14581
|
-
linear: 3 /* LINEAR */
|
|
14582
|
-
};
|
|
14583
|
-
function wireStyle(style) {
|
|
14584
|
-
if (!style) {
|
|
14585
|
-
return void 0;
|
|
14586
|
-
}
|
|
14587
|
-
return {
|
|
14588
|
-
width: length(style.width),
|
|
14589
|
-
height: length(style.height),
|
|
14590
|
-
flow: style.flow === void 0 ? void 0 : flows[style.flow],
|
|
14591
|
-
horizontalAlign: align(style.horizontalAlign),
|
|
14592
|
-
verticalAlign: align(style.verticalAlign),
|
|
14593
|
-
margin: edges(style.margin),
|
|
14594
|
-
padding: edges(style.padding),
|
|
14595
|
-
background: color(style.background),
|
|
14596
|
-
color: color(style.color),
|
|
14597
|
-
fontSize: style.fontSize,
|
|
14598
|
-
bold: style.bold,
|
|
14599
|
-
textAlign: align(style.textAlign),
|
|
14600
|
-
borderRadius: style.borderRadius,
|
|
14601
|
-
opacity: style.opacity,
|
|
14602
|
-
face: style.face === void 0 ? void 0 : faces[style.face],
|
|
14603
|
-
uppercase: style.uppercase,
|
|
14604
|
-
letterSpacing: style.letterSpacing,
|
|
14605
|
-
shadow: style.shadow,
|
|
14606
|
-
borderWidth: style.borderWidth,
|
|
14607
|
-
borderColor: color(style.borderColor),
|
|
14608
|
-
x: length(style.x),
|
|
14609
|
-
y: length(style.y),
|
|
14610
|
-
minWidth: length(style.minWidth),
|
|
14611
|
-
maxWidth: length(style.maxWidth),
|
|
14612
|
-
minHeight: length(style.minHeight),
|
|
14613
|
-
maxHeight: length(style.maxHeight),
|
|
14614
|
-
zIndex: style.zIndex,
|
|
14615
|
-
overflowX: overflow(style.overflowX ?? style.overflow),
|
|
14616
|
-
overflowY: overflow(style.overflowY ?? style.overflow),
|
|
14617
|
-
gradient: gradient(style.gradient),
|
|
14618
|
-
boxShadow: shadow(style.boxShadow),
|
|
14619
|
-
textShadow: shadow(style.textShadow),
|
|
14620
|
-
tint: color(style.tint),
|
|
14621
|
-
saturation: style.saturation,
|
|
14622
|
-
brightness: style.brightness,
|
|
14623
|
-
contrast: style.contrast,
|
|
14624
|
-
blur: style.blur,
|
|
14625
|
-
italic: style.italic,
|
|
14626
|
-
weight: style.weight === void 0 ? void 0 : weights[style.weight],
|
|
14627
|
-
lineHeight: style.lineHeight,
|
|
14628
|
-
noWrap: style.noWrap,
|
|
14629
|
-
textOverflow: style.textOverflow === void 0 ? void 0 : textOverflows[style.textOverflow],
|
|
14630
|
-
decoration: style.decoration === void 0 ? void 0 : decorations[style.decoration],
|
|
14631
|
-
transform: transform(style),
|
|
14632
|
-
transition: transition(style.transition)
|
|
14633
|
-
};
|
|
14634
|
-
}
|
|
14635
|
-
function gradient(value) {
|
|
14636
|
-
if (!value) {
|
|
14637
|
-
return void 0;
|
|
14638
|
-
}
|
|
14639
|
-
const last = Math.max(1, value.colors.length - 1);
|
|
14640
|
-
return {
|
|
14641
|
-
shape: value.shape === void 0 ? void 0 : shapes[value.shape],
|
|
14642
|
-
stops: value.colors.map((each, index) => ({
|
|
14643
|
-
at: value.at?.[index] ?? index / last,
|
|
14644
|
-
color: color(each)
|
|
14645
|
-
}))
|
|
14646
|
-
};
|
|
14647
|
-
}
|
|
14648
|
-
function shadow(value) {
|
|
14649
|
-
if (!value) {
|
|
14650
|
-
return void 0;
|
|
14651
|
-
}
|
|
14652
|
-
return {
|
|
14653
|
-
x: value.x,
|
|
14654
|
-
y: value.y,
|
|
14655
|
-
blur: value.blur,
|
|
14656
|
-
spread: value.spread,
|
|
14657
|
-
color: color(value.color),
|
|
14658
|
-
inset: value.inset
|
|
14659
|
-
};
|
|
14660
|
-
}
|
|
14661
|
-
function transform(style) {
|
|
14662
|
-
const { translate, scale: scale2, rotate, origin } = style;
|
|
14663
|
-
if (!translate && scale2 === void 0 && rotate === void 0 && !origin) {
|
|
14664
|
-
return void 0;
|
|
14665
|
-
}
|
|
14666
|
-
const scales = typeof scale2 === "number" ? [scale2, scale2] : scale2;
|
|
14667
|
-
return {
|
|
14668
|
-
translateX: translate?.[0],
|
|
14669
|
-
translateY: translate?.[1],
|
|
14670
|
-
scaleX: scales?.[0],
|
|
14671
|
-
scaleY: scales?.[1],
|
|
14672
|
-
rotate,
|
|
14673
|
-
originX: origin?.[0],
|
|
14674
|
-
originY: origin?.[1]
|
|
14675
|
-
};
|
|
14676
|
-
}
|
|
14677
|
-
function transition(value) {
|
|
14678
|
-
if (value === void 0) {
|
|
14679
|
-
return void 0;
|
|
14680
|
-
}
|
|
14681
|
-
if (typeof value === "number") {
|
|
14682
|
-
return { seconds: value };
|
|
14683
|
-
}
|
|
14684
|
-
return {
|
|
14685
|
-
seconds: value.seconds,
|
|
14686
|
-
delay: value.delay,
|
|
14687
|
-
easing: value.easing === void 0 ? void 0 : easings[value.easing]
|
|
14688
|
-
};
|
|
14689
|
-
}
|
|
14690
|
-
function length(value) {
|
|
14691
|
-
if (value === void 0) {
|
|
14692
|
-
return void 0;
|
|
14693
|
-
}
|
|
14694
|
-
if (typeof value === "number") {
|
|
14695
|
-
return { value: { case: "pixels", value } };
|
|
14696
|
-
}
|
|
14697
|
-
if (value === "fit") {
|
|
14698
|
-
return { value: { case: "fitChildren", value: true } };
|
|
14699
|
-
}
|
|
14700
|
-
if (value === "fill") {
|
|
14701
|
-
return { value: { case: "fill", value: 1 } };
|
|
14702
|
-
}
|
|
14703
|
-
return { value: { case: "percent", value: Number.parseFloat(value) } };
|
|
14704
|
-
}
|
|
14705
|
-
function edges(value) {
|
|
14706
|
-
if (value === void 0) {
|
|
14707
|
-
return void 0;
|
|
14708
|
-
}
|
|
14709
|
-
if (typeof value === "number") {
|
|
14710
|
-
return { top: value, right: value, bottom: value, left: value };
|
|
14711
|
-
}
|
|
14712
|
-
if (value.length === 2) {
|
|
14713
|
-
return { top: value[0], right: value[1], bottom: value[0], left: value[1] };
|
|
14714
|
-
}
|
|
14715
|
-
return { top: value[0], right: value[1], bottom: value[2], left: value[3] };
|
|
14716
|
-
}
|
|
14717
|
-
function color(value) {
|
|
14718
|
-
const hex = value?.replace(/^#/, "");
|
|
14719
|
-
if (!hex || !/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) {
|
|
14720
|
-
return void 0;
|
|
14721
|
-
}
|
|
14722
|
-
return Number.parseInt(hex.length === 6 ? `${hex}ff` : hex, 16) >>> 0;
|
|
14723
|
-
}
|
|
14724
|
-
|
|
14725
|
-
// js/src/vector.ts
|
|
14726
|
-
var vector_exports = {};
|
|
14727
|
-
__export(vector_exports, {
|
|
14728
|
-
add: () => add,
|
|
14729
|
-
aimAt: () => aimAt,
|
|
14730
|
-
at: () => at,
|
|
14731
|
-
distance: () => distance,
|
|
14732
|
-
dot: () => dot,
|
|
14733
|
-
flatDistance: () => flatDistance,
|
|
14734
|
-
forward: () => forward,
|
|
14735
|
-
length: () => length2,
|
|
14736
|
-
lerp: () => lerp2,
|
|
14737
|
-
level: () => level,
|
|
14738
|
-
normalize: () => normalize,
|
|
14739
|
-
scale: () => scale,
|
|
14740
|
-
sub: () => sub,
|
|
14741
|
-
toward: () => toward,
|
|
14742
|
-
yawToward: () => yawToward
|
|
14743
|
-
});
|
|
14744
|
-
function at(x, y, z) {
|
|
14745
|
-
return { x, y, z };
|
|
14746
|
-
}
|
|
14747
|
-
function add(a, b) {
|
|
14748
|
-
return { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
|
|
14749
|
-
}
|
|
14750
|
-
function sub(a, b) {
|
|
14751
|
-
return { x: a.x - b.x, y: a.y - b.y, z: a.z - b.z };
|
|
14752
|
-
}
|
|
14753
|
-
function scale(a, s) {
|
|
14754
|
-
return { x: a.x * s, y: a.y * s, z: a.z * s };
|
|
14755
|
-
}
|
|
14756
|
-
function dot(a, b) {
|
|
14757
|
-
return a.x * b.x + a.y * b.y + a.z * b.z;
|
|
14758
|
-
}
|
|
14759
|
-
function length2(a) {
|
|
14760
|
-
return Math.hypot(a.x, a.y, a.z);
|
|
14761
|
-
}
|
|
14762
|
-
function normalize(a) {
|
|
14763
|
-
const size = length2(a);
|
|
14764
|
-
return size > 0 ? scale(a, 1 / size) : { x: 1, y: 0, z: 0 };
|
|
14765
|
-
}
|
|
14766
|
-
function lerp2(a, b, t) {
|
|
14767
|
-
return {
|
|
14768
|
-
x: a.x + (b.x - a.x) * t,
|
|
14769
|
-
y: a.y + (b.y - a.y) * t,
|
|
14770
|
-
z: a.z + (b.z - a.z) * t
|
|
14771
|
-
};
|
|
14772
|
-
}
|
|
14773
|
-
function distance(a, b) {
|
|
14774
|
-
return Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);
|
|
14775
|
-
}
|
|
14776
|
-
function flatDistance(a, b) {
|
|
14777
|
-
return Math.hypot(a.x - b.x, a.y - b.y);
|
|
14778
|
-
}
|
|
14779
|
-
function toward(from, to) {
|
|
14780
|
-
const span = distance(from, to);
|
|
14781
|
-
return span > 0 ? scale(sub(to, from), 1 / span) : { x: 0, y: 0, z: 0 };
|
|
14782
|
-
}
|
|
14783
|
-
function yawToward(from, to) {
|
|
14784
|
-
return Math.atan2(to.y - from.y, to.x - from.x) * 180 / Math.PI;
|
|
14785
|
-
}
|
|
14786
|
-
function level(yaw) {
|
|
14787
|
-
return { pitch: 0, yaw, roll: 0 };
|
|
14788
|
-
}
|
|
14789
|
-
function aimAt(from, to) {
|
|
14790
|
-
const across = flatDistance(from, to);
|
|
14791
|
-
return {
|
|
14792
|
-
pitch: -Math.atan2(to.z - from.z, across) * 180 / Math.PI,
|
|
14793
|
-
yaw: yawToward(from, to),
|
|
14794
|
-
roll: 0
|
|
14795
|
-
};
|
|
14796
|
-
}
|
|
14797
|
-
function forward(angles2) {
|
|
14798
|
-
const pitch = angles2.pitch * Math.PI / 180;
|
|
14799
|
-
const yaw = angles2.yaw * Math.PI / 180;
|
|
14800
|
-
return {
|
|
14801
|
-
x: Math.cos(pitch) * Math.cos(yaw),
|
|
14802
|
-
y: Math.cos(pitch) * Math.sin(yaw),
|
|
14803
|
-
z: -Math.sin(pitch)
|
|
14804
|
-
};
|
|
14805
|
-
}
|
|
14806
|
-
|
|
14807
|
-
// js/src/bits.ts
|
|
14808
|
-
var Buttons = {
|
|
14809
|
-
/** attack is the primary fire button. */
|
|
14810
|
-
attack: 1n,
|
|
14811
|
-
/**
|
|
14812
|
-
* jump is the jump key, Space by default (IN_MANTLE). Blocking it stops the
|
|
14813
|
-
* native jump and mantle; the jumping client still predicts the jump and is
|
|
14814
|
-
* corrected.
|
|
14815
|
-
*/
|
|
14816
|
-
jump: 1n << 48n,
|
|
14817
|
-
/** crouch is the crouch key, Ctrl by default. */
|
|
14818
|
-
crouch: 1n << 2n,
|
|
14819
|
-
/** dash is the dash key, Shift by default. */
|
|
14820
|
-
dash: 1n << 16n,
|
|
14821
|
-
/** use is the interact key. */
|
|
14822
|
-
use: 1n << 5n,
|
|
14823
|
-
/** altFire is the zoom and alternate fire button, right mouse by default. */
|
|
14824
|
-
altFire: 1n << 11n,
|
|
14825
|
-
/** reload is the reload key. */
|
|
14826
|
-
reload: 1n << 13n,
|
|
14827
|
-
/** melee is the light melee key, Q by default. */
|
|
14828
|
-
melee: 1n << 32n,
|
|
14829
|
-
/** ability1 to ability3 are the hero's first three ability keys. */
|
|
14830
|
-
ability1: 1n << 33n,
|
|
14831
|
-
ability2: 1n << 34n,
|
|
14832
|
-
ability3: 1n << 35n,
|
|
14833
|
-
/** ultimate is the hero's ultimate ability key, the fourth. */
|
|
14834
|
-
ultimate: 1n << 36n,
|
|
14835
|
-
/** parry is the melee parry button. */
|
|
14836
|
-
parry: 1n << 42n
|
|
14837
|
-
};
|
|
14838
|
-
var Layers = {
|
|
14839
|
-
/** solid is the world and solid objects. */
|
|
14840
|
-
solid: 1n << 0n,
|
|
14841
|
-
/** hitbox is the hit boxes of heroes and units. */
|
|
14842
|
-
hitbox: 1n << 1n,
|
|
14843
|
-
/** trigger is invisible volumes that react to touch. */
|
|
14844
|
-
trigger: 1n << 2n,
|
|
14845
|
-
/** playerClip is walls that only stop heroes. */
|
|
14846
|
-
playerClip: 1n << 4n,
|
|
14847
|
-
/** player is player-controlled heroes. */
|
|
14848
|
-
player: 1n << 18n,
|
|
14849
|
-
/** npc is units that are not players. */
|
|
14850
|
-
npc: 1n << 19n,
|
|
14851
|
-
/** staticLevel is the map's built geometry, foliage included. */
|
|
14852
|
-
staticLevel: 1n << 30n,
|
|
14853
|
-
/** hero, trooper and building are those units' bodies. */
|
|
14854
|
-
hero: 1n << 37n,
|
|
14855
|
-
trooper: 1n << 38n,
|
|
14856
|
-
building: 1n << 40n
|
|
14857
|
-
};
|
|
14858
|
-
|
|
14859
|
-
// js/src/curve.ts
|
|
14860
|
-
var curve_exports = {};
|
|
14861
|
-
__export(curve_exports, {
|
|
14862
|
-
chain: () => chain,
|
|
14863
|
-
durationOf: () => durationOf,
|
|
14864
|
-
ease: () => ease,
|
|
14865
|
-
hold: () => hold,
|
|
14866
|
-
keyframes: () => keyframes,
|
|
14867
|
-
line: () => line,
|
|
14868
|
-
orbit: () => orbit,
|
|
14869
|
-
pingPong: () => pingPong,
|
|
14870
|
-
repeat: () => repeat,
|
|
14871
|
-
reverse: () => reverse,
|
|
14872
|
-
shaped: () => shaped,
|
|
14873
|
-
through: () => through,
|
|
14874
|
-
valueAt: () => valueAt,
|
|
14875
|
-
wave: () => wave
|
|
14876
|
-
});
|
|
14877
|
-
var ease = {
|
|
14878
|
-
/** linear moves at an even pace. */
|
|
14879
|
-
linear: shaped((t) => t, {}),
|
|
14880
|
-
/** bias is the game's bias curve; see LerpShape. */
|
|
14881
|
-
bias: (b) => shaped((t) => bias(t, b), { bias: b }),
|
|
14882
|
-
/** gain is the game's gain curve; see LerpShape. */
|
|
14883
|
-
gain: (g) => shaped((t) => gain(t, g), { gain: g }),
|
|
14884
|
-
/** in starts slow and speeds up. */
|
|
14885
|
-
in: shaped((t) => t * t * t),
|
|
14886
|
-
/** out starts fast and slows to a stop. */
|
|
14887
|
-
out: shaped((t) => 1 - (1 - t) ** 3),
|
|
14888
|
-
/** inOut starts and ends slow. */
|
|
14889
|
-
inOut: shaped((t) => t < 0.5 ? 4 * t * t * t : 1 - (2 - 2 * t) ** 3 / 2),
|
|
14890
|
-
/** sine starts and ends slow, more gently than inOut. */
|
|
14891
|
-
sine: shaped((t) => (1 - Math.cos(Math.PI * t)) / 2),
|
|
14892
|
-
/** back passes its end a little and settles back onto it. */
|
|
14893
|
-
back: shaped((t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2),
|
|
14894
|
-
/** elastic overshoots its end and rings down onto it. */
|
|
14895
|
-
elastic: shaped(
|
|
14896
|
-
(t) => t <= 0 || t >= 1 ? t : 2 ** (-10 * t) * Math.sin((t * 10 - 0.75) * 2 * Math.PI / 3) + 1
|
|
14897
|
-
),
|
|
14898
|
-
/** bounce drops onto its end and bounces to rest. */
|
|
14899
|
-
bounce: shaped((t) => {
|
|
14900
|
-
const k = 7.5625;
|
|
14901
|
-
if (t < 1 / 2.75) return k * t * t;
|
|
14902
|
-
if (t < 2 / 2.75) return k * (t - 1.5 / 2.75) ** 2 + 0.75;
|
|
14903
|
-
if (t < 2.5 / 2.75) return k * (t - 2.25 / 2.75) ** 2 + 0.9375;
|
|
14904
|
-
return k * (t - 2.625 / 2.75) ** 2 + 0.984375;
|
|
14905
|
-
})
|
|
14906
|
-
};
|
|
14907
|
-
function shaped(at2, lerp3) {
|
|
14908
|
-
return { at: at2, lerp: lerp3 };
|
|
14909
|
-
}
|
|
14910
|
-
function line(from, to, duration, shape = ease.linear) {
|
|
14911
|
-
return [{ duration, lerp: shape.lerp, at: (u) => mix(from, to, shape.at(u)) }];
|
|
14912
|
-
}
|
|
14913
|
-
function hold(value, duration) {
|
|
14914
|
-
return [{ duration, lerp: {}, at: () => value }];
|
|
14915
|
-
}
|
|
14916
|
-
function keyframes(keys, options = {}) {
|
|
14917
|
-
const spans = [];
|
|
14918
|
-
const [first] = keys;
|
|
14919
|
-
if (first && first.at > 0) spans.push(...hold(first.value, first.at));
|
|
14920
|
-
keys.forEach((to, i) => {
|
|
14921
|
-
const from = keys[i - 1];
|
|
14922
|
-
if (!from || to.at <= from.at) return;
|
|
14923
|
-
const duration = to.at - from.at;
|
|
14924
|
-
const shape = to.ease ?? ease.linear;
|
|
14925
|
-
if (!options.smooth) {
|
|
14926
|
-
spans.push(...line(from.value, to.value, duration, shape));
|
|
14927
|
-
return;
|
|
14928
|
-
}
|
|
14929
|
-
const before = keys[i - 2]?.value ?? from.value;
|
|
14930
|
-
const after2 = keys[i + 1]?.value ?? to.value;
|
|
14931
|
-
spans.push({
|
|
14932
|
-
duration,
|
|
14933
|
-
at: (u) => spline(before, from.value, to.value, after2, shape.at(u))
|
|
14934
|
-
});
|
|
14935
|
-
});
|
|
14936
|
-
return spans;
|
|
14937
|
-
}
|
|
14938
|
-
function through(points, options) {
|
|
14939
|
-
let at2 = 0;
|
|
14940
|
-
let last = points[0];
|
|
14941
|
-
const keys = points.map((value) => {
|
|
14942
|
-
if (last !== void 0) at2 += distance2(last, value) / options.speed;
|
|
14943
|
-
last = value;
|
|
14944
|
-
return { at: at2, value, ease: options.ease };
|
|
14945
|
-
});
|
|
14946
|
-
return keyframes(keys, options);
|
|
14947
|
-
}
|
|
14948
|
-
function orbit(options) {
|
|
14949
|
-
const { center, radius, duration } = options;
|
|
14950
|
-
const turns = options.turns ?? 1;
|
|
14951
|
-
const start = (options.start ?? 0) * Math.PI / 180;
|
|
14952
|
-
const rise = options.rise ?? 0;
|
|
14953
|
-
const shape = options.ease ?? ease.linear;
|
|
14954
|
-
return [
|
|
14955
|
-
{
|
|
14956
|
-
duration,
|
|
14957
|
-
at: (u) => {
|
|
14958
|
-
const t = shape.at(u);
|
|
14959
|
-
const angle = start + t * turns * 2 * Math.PI;
|
|
14960
|
-
return {
|
|
14961
|
-
x: center.x + radius * Math.cos(angle),
|
|
14962
|
-
y: center.y + radius * Math.sin(angle),
|
|
14963
|
-
z: center.z + rise * t
|
|
14964
|
-
};
|
|
14965
|
-
}
|
|
14966
|
-
}
|
|
14967
|
-
];
|
|
14968
|
-
}
|
|
14969
|
-
function wave(options) {
|
|
14970
|
-
const { amplitude, frequency, duration, decay } = options;
|
|
14971
|
-
return [
|
|
14972
|
-
{
|
|
14973
|
-
duration,
|
|
14974
|
-
at: (u) => amplitude * (decay ? 1 - u : 1) * Math.sin(2 * Math.PI * frequency * duration * u)
|
|
14975
|
-
}
|
|
14976
|
-
];
|
|
14977
|
-
}
|
|
14978
|
-
function chain(...curves) {
|
|
14979
|
-
return curves.flat();
|
|
14980
|
-
}
|
|
14981
|
-
function reverse(curve) {
|
|
14982
|
-
return curve.map((span) => ({
|
|
14983
|
-
duration: span.duration,
|
|
14984
|
-
lerp: span.lerp?.bias === void 0 ? span.lerp : void 0,
|
|
14985
|
-
at: (u) => span.at(1 - u)
|
|
14986
|
-
})).reverse();
|
|
14987
|
-
}
|
|
14988
|
-
function repeat(curve, times) {
|
|
14989
|
-
return Array.from({ length: Math.max(0, times) }, () => curve).flat();
|
|
14990
|
-
}
|
|
14991
|
-
function pingPong(curve) {
|
|
14992
|
-
return chain(curve, reverse(curve));
|
|
14993
|
-
}
|
|
14994
|
-
function durationOf(curve) {
|
|
14995
|
-
return curve.reduce((sum, span) => sum + Math.max(0, span.duration), 0);
|
|
14996
|
-
}
|
|
14997
|
-
function valueAt(curve, seconds) {
|
|
14998
|
-
let left = seconds;
|
|
14999
|
-
for (const span of curve) {
|
|
15000
|
-
if (span.duration <= 0) continue;
|
|
15001
|
-
if (left <= span.duration) return span.at(Math.max(0, left) / span.duration);
|
|
15002
|
-
left -= span.duration;
|
|
15003
|
-
}
|
|
15004
|
-
return curve.at(-1)?.at(1);
|
|
15005
|
-
}
|
|
15006
|
-
function bias(t, b) {
|
|
15007
|
-
return t ** (Math.log(b) / Math.log(0.5));
|
|
15008
|
-
}
|
|
15009
|
-
function gain(t, g) {
|
|
15010
|
-
return t < 0.5 ? bias(2 * t, 1 - g) / 2 : 1 - bias(2 - 2 * t, 1 - g) / 2;
|
|
15011
|
-
}
|
|
15012
|
-
function mix(a, b, t) {
|
|
15013
|
-
if (typeof a === "number" && typeof b === "number") return a + (b - a) * t;
|
|
15014
|
-
const [p, q] = [vector2(a), vector2(b)];
|
|
15015
|
-
return {
|
|
15016
|
-
x: p.x + (q.x - p.x) * t,
|
|
15017
|
-
y: p.y + (q.y - p.y) * t,
|
|
15018
|
-
z: p.z + (q.z - p.z) * t
|
|
15019
|
-
};
|
|
15020
|
-
}
|
|
15021
|
-
function spline(p0, p1, p2, p3, t) {
|
|
15022
|
-
const f = (a2, b2, c2, d2) => 0.5 * (2 * b2 + (c2 - a2) * t + (2 * a2 - 5 * b2 + 4 * c2 - d2) * t * t + (3 * b2 - a2 - 3 * c2 + d2) * t * t * t);
|
|
15023
|
-
if (typeof p0 === "number" && typeof p1 === "number" && typeof p2 === "number" && typeof p3 === "number") {
|
|
15024
|
-
return f(p0, p1, p2, p3);
|
|
15025
|
-
}
|
|
15026
|
-
const [a, b, c, d] = [vector2(p0), vector2(p1), vector2(p2), vector2(p3)];
|
|
15027
|
-
return {
|
|
15028
|
-
x: f(a.x, b.x, c.x, d.x),
|
|
15029
|
-
y: f(a.y, b.y, c.y, d.y),
|
|
15030
|
-
z: f(a.z, b.z, c.z, d.z)
|
|
15031
|
-
};
|
|
15032
|
-
}
|
|
15033
|
-
function distance2(a, b) {
|
|
15034
|
-
if (typeof a === "number" && typeof b === "number") return Math.abs(b - a);
|
|
15035
|
-
const [p, q] = [vector2(a), vector2(b)];
|
|
15036
|
-
return Math.hypot(q.x - p.x, q.y - p.y, q.z - p.z);
|
|
15037
|
-
}
|
|
15038
|
-
function vector2(value) {
|
|
15039
|
-
return typeof value === "number" ? { x: value, y: 0, z: 0 } : value;
|
|
15040
|
-
}
|
|
15041
|
-
|
|
15042
|
-
// js/src/camera.ts
|
|
15043
|
-
function setOrbitCamera(player, enabled) {
|
|
15044
|
-
const pawn = player.pawn();
|
|
15045
|
-
if (!pawn?.entity) return false;
|
|
15046
|
-
const flag = writeField(
|
|
15047
|
-
pawn.entity,
|
|
15048
|
-
"CCitadelPlayerPawn",
|
|
15049
|
-
"m_bInHideoutZone",
|
|
15050
|
-
"bool",
|
|
15051
|
-
enabled
|
|
15052
|
-
);
|
|
15053
|
-
const zoom = holdModifierState(
|
|
15054
|
-
pawn.entity,
|
|
15055
|
-
"MODIFIER_STATE_HIDEOUT_ZONE",
|
|
15056
|
-
enabled
|
|
15057
|
-
);
|
|
15058
|
-
if (enabled) return flag && zoom;
|
|
15059
|
-
const orbit2 = fireInput(pawn.entity, "RemoveModifier", {
|
|
15060
|
-
text: "modifier_citadel_orbit_camera"
|
|
15061
|
-
});
|
|
15062
|
-
return flag && zoom && orbit2;
|
|
15063
|
-
}
|
|
15064
|
-
var moves = 0;
|
|
15065
|
-
function playCamera(player, options) {
|
|
15066
|
-
const tracks = [];
|
|
15067
|
-
for (const [param, curve] of Object.entries(options.tracks)) {
|
|
15068
|
-
if (curve) tracks.push({ param, curve });
|
|
15069
|
-
}
|
|
15070
|
-
return playTracks(player, options, tracks);
|
|
15071
|
-
}
|
|
15072
|
-
function playTracks(player, options, tracks) {
|
|
15073
|
-
const context = options.context ?? `modlock.camera.${++moves}`;
|
|
15074
|
-
const length3 = Math.max(0, ...tracks.map((track) => durationOf(track.curve)));
|
|
15075
|
-
const send2 = (delay) => tracks.every(
|
|
15076
|
-
({ param, curve }) => sendCurve(player, { ...options, context, param, delay }, curve)
|
|
15077
|
-
);
|
|
15078
|
-
let timer;
|
|
15079
|
-
const stop = () => {
|
|
15080
|
-
timer?.cancel();
|
|
15081
|
-
return player.clearCamera(context);
|
|
15082
|
-
};
|
|
15083
|
-
let sent = send2(options.delay);
|
|
15084
|
-
if (sent && options.loop && length3 > 0) {
|
|
15085
|
-
sent = send2(void 0);
|
|
15086
|
-
timer = every(length3, () => {
|
|
15087
|
-
if (!send2(void 0)) stop();
|
|
15088
|
-
});
|
|
15089
|
-
}
|
|
15090
|
-
if (!sent) {
|
|
15091
|
-
stop();
|
|
15092
|
-
return void 0;
|
|
15093
|
-
}
|
|
15094
|
-
return {
|
|
15095
|
-
context,
|
|
15096
|
-
duration: options.loop ? Infinity : (options.delay ?? 0) + length3,
|
|
15097
|
-
cancel: stop
|
|
15098
|
-
};
|
|
15099
|
-
}
|
|
15100
|
-
function cameraPulse(player, options) {
|
|
15101
|
-
const { param, by, ease: shape = ease.linear } = options;
|
|
15102
|
-
const rest = zero2(by);
|
|
15103
|
-
const curve = chain(
|
|
15104
|
-
line(rest, by, options.in, shape),
|
|
15105
|
-
hold(by, options.hold),
|
|
15106
|
-
reverse(line(rest, by, options.out, shape))
|
|
15107
|
-
);
|
|
15108
|
-
return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
|
|
15109
|
-
}
|
|
15110
|
-
function cameraShake(player, options) {
|
|
15111
|
-
const { amplitude, duration } = options;
|
|
15112
|
-
const curve = wave({
|
|
15113
|
-
amplitude,
|
|
15114
|
-
duration,
|
|
15115
|
-
frequency: options.frequency ?? 8,
|
|
15116
|
-
decay: true
|
|
15117
|
-
});
|
|
15118
|
-
const param = options.param ?? "horizontalOffset";
|
|
15119
|
-
return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
|
|
15120
|
-
}
|
|
15121
|
-
function sendCurve(player, options, curve) {
|
|
15122
|
-
const { context, param, relative, priority, target } = options;
|
|
15123
|
-
const rate = options.rate ?? 30;
|
|
15124
|
-
let delay = options.delay;
|
|
15125
|
-
const lerp3 = (start, end, duration, shape = {}) => {
|
|
15126
|
-
const sent = player.moveCamera({
|
|
15127
|
-
context,
|
|
15128
|
-
param,
|
|
15129
|
-
motion: { lerp: { start, end, duration, ...shape } },
|
|
15130
|
-
delay,
|
|
15131
|
-
relative,
|
|
15132
|
-
priority,
|
|
15133
|
-
target
|
|
15134
|
-
});
|
|
15135
|
-
delay = void 0;
|
|
15136
|
-
return sent;
|
|
15137
|
-
};
|
|
15138
|
-
return curve.every((span) => {
|
|
15139
|
-
if (span.duration <= 0) return true;
|
|
15140
|
-
if (span.lerp) {
|
|
15141
|
-
return lerp3(span.at(0), span.at(1), span.duration, span.lerp);
|
|
15142
|
-
}
|
|
15143
|
-
const steps = Math.max(1, Math.ceil(span.duration * rate));
|
|
15144
|
-
for (let i = 0; i < steps; i++) {
|
|
15145
|
-
const sent = lerp3(
|
|
15146
|
-
span.at(i / steps),
|
|
15147
|
-
span.at((i + 1) / steps),
|
|
15148
|
-
span.duration / steps
|
|
15149
|
-
);
|
|
15150
|
-
if (!sent) return false;
|
|
15151
|
-
}
|
|
15152
|
-
return true;
|
|
15153
|
-
});
|
|
15154
|
-
}
|
|
15155
|
-
function zero2(value) {
|
|
15156
|
-
return typeof value === "number" ? 0 : { x: 0, y: 0, z: 0 };
|
|
15157
|
-
}
|
|
15158
|
-
|
|
15159
|
-
// js/src/format.ts
|
|
15160
|
-
var format_exports = {};
|
|
15161
|
-
__export(format_exports, {
|
|
15162
|
-
clip: () => clip,
|
|
15163
|
-
clock: () => clock,
|
|
15164
|
-
count: () => count,
|
|
15165
|
-
grouped: () => grouped,
|
|
15166
|
-
ordinal: () => ordinal,
|
|
15167
|
-
percent: () => percent,
|
|
15168
|
-
stopwatch: () => stopwatch
|
|
15169
|
-
});
|
|
15170
|
-
function clock(seconds) {
|
|
15171
|
-
const whole = Math.max(0, Math.ceil(seconds));
|
|
15172
|
-
return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, "0")}`;
|
|
15173
|
-
}
|
|
15174
|
-
function stopwatch(seconds) {
|
|
15175
|
-
const hundredths = Math.max(0, Math.floor(seconds * 100));
|
|
15176
|
-
const minutes = Math.floor(hundredths / 6e3);
|
|
15177
|
-
const rest = hundredths % 6e3 / 100;
|
|
15178
|
-
return `${minutes}:${rest.toFixed(2).padStart(5, "0")}`;
|
|
15179
|
-
}
|
|
15180
|
-
function percent(part, whole) {
|
|
15181
|
-
if (!(whole > 0)) {
|
|
15182
|
-
return "-";
|
|
15183
|
-
}
|
|
15184
|
-
return `${Math.round(Math.max(0, Math.min(part / whole, 1)) * 100)}%`;
|
|
15185
|
-
}
|
|
15186
|
-
function grouped(value) {
|
|
15187
|
-
return String(Math.round(value)).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
15188
|
-
}
|
|
15189
|
-
function ordinal(place2) {
|
|
15190
|
-
const tens = place2 % 100;
|
|
15191
|
-
const suffix = tens >= 11 && tens <= 13 ? "th" : ["th", "st", "nd", "rd"][place2 % 10] ?? "th";
|
|
15192
|
-
return `${place2}${suffix}`;
|
|
15193
|
-
}
|
|
15194
|
-
function count(number, thing, plural = `${thing}s`) {
|
|
15195
|
-
return `${grouped(number)} ${number === 1 ? thing : plural}`;
|
|
15196
|
-
}
|
|
15197
|
-
function clip(text2, width) {
|
|
15198
|
-
if (text2.length <= width) return text2;
|
|
15199
|
-
const cut = text2.slice(0, width - 1);
|
|
15200
|
-
const space = cut.lastIndexOf(" ");
|
|
15201
|
-
return `${(space > 0 ? cut.slice(0, space) : cut).trimEnd()}\u2026`;
|
|
15202
|
-
}
|
|
15203
|
-
|
|
15204
14622
|
// js/src/heroes.ts
|
|
15205
14623
|
var heroes = [
|
|
15206
14624
|
{
|
|
@@ -15467,17 +14885,1229 @@ var heroes = [
|
|
|
15467
14885
|
title: "Yamato",
|
|
15468
14886
|
portrait: "file://{images}/heroes/yamato_sm.psd"
|
|
15469
14887
|
}
|
|
15470
|
-
];
|
|
15471
|
-
function findHero(typed) {
|
|
15472
|
-
return findTitled(heroes, typed);
|
|
14888
|
+
];
|
|
14889
|
+
function findHero(typed) {
|
|
14890
|
+
return findTitled(heroes, typed);
|
|
14891
|
+
}
|
|
14892
|
+
function findTitled(list, typed) {
|
|
14893
|
+
const key = typed.toLowerCase().replace(/[^a-z0-9_]/g, "");
|
|
14894
|
+
if (key === "") {
|
|
14895
|
+
return void 0;
|
|
14896
|
+
}
|
|
14897
|
+
const plain = (entry) => entry.title.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
14898
|
+
return list.find((entry) => entry.name === key || plain(entry) === key) ?? list.find((entry) => plain(entry).startsWith(key)) ?? list.find((entry) => plain(entry).includes(key));
|
|
14899
|
+
}
|
|
14900
|
+
|
|
14901
|
+
// js/src/ui.ts
|
|
14902
|
+
function jsx(type, props, key) {
|
|
14903
|
+
const named = key === void 0 ? void 0 : String(key);
|
|
14904
|
+
if (typeof type === "function") {
|
|
14905
|
+
return { type: fragment, props: { children: type(props) }, key: named };
|
|
14906
|
+
}
|
|
14907
|
+
return { type, props, key: named };
|
|
14908
|
+
}
|
|
14909
|
+
var fragment = "fragment";
|
|
14910
|
+
var jsxs = jsx;
|
|
14911
|
+
function Fragment(props) {
|
|
14912
|
+
return props.children;
|
|
14913
|
+
}
|
|
14914
|
+
function show(player, root) {
|
|
14915
|
+
views.set(player.slot, { ...view(player), root });
|
|
14916
|
+
return draw(player);
|
|
14917
|
+
}
|
|
14918
|
+
function hideHud(player, parts) {
|
|
14919
|
+
views.set(player.slot, { ...view(player), hud: parts });
|
|
14920
|
+
return draw(player);
|
|
14921
|
+
}
|
|
14922
|
+
function freeCursor(player, free) {
|
|
14923
|
+
const current = view(player);
|
|
14924
|
+
views.set(player.slot, {
|
|
14925
|
+
...current,
|
|
14926
|
+
cursor: free,
|
|
14927
|
+
asks: free ? current.asks + 1 : current.asks
|
|
14928
|
+
});
|
|
14929
|
+
return draw(player);
|
|
14930
|
+
}
|
|
14931
|
+
function abilityBarPresses(player, onPress) {
|
|
14932
|
+
views.set(player.slot, {
|
|
14933
|
+
...view(player),
|
|
14934
|
+
bar: onPress ? { handler: onPress } : void 0
|
|
14935
|
+
});
|
|
14936
|
+
return draw(player);
|
|
14937
|
+
}
|
|
14938
|
+
function abilityDisplay(viewer, rows = []) {
|
|
14939
|
+
views.set(viewer.slot, { ...view(viewer), display: rows.slice(0, 64) });
|
|
14940
|
+
return draw(viewer);
|
|
14941
|
+
}
|
|
14942
|
+
function displayRows(viewer, rows) {
|
|
14943
|
+
if (rows.length === 0) return [];
|
|
14944
|
+
const names = new Map(players().map((c) => [c.player.slot, c.name]));
|
|
14945
|
+
return rows.map((row2) => {
|
|
14946
|
+
const hero = row2.player.pawn()?.hero;
|
|
14947
|
+
return {
|
|
14948
|
+
player: row2.player.slot,
|
|
14949
|
+
// A Steam name is at most 32 characters, within the host's 128 bytes.
|
|
14950
|
+
name: (names.get(row2.player.slot) ?? "").slice(0, 32),
|
|
14951
|
+
hero: heroes.find((each) => each.id === hero)?.name ?? "",
|
|
14952
|
+
own: row2.player.slot === viewer.slot,
|
|
14953
|
+
abilities: row2.abilities.slice(0, 4).map((shown) => ({
|
|
14954
|
+
ability: shown?.name ? itemId(shown.name) : 0,
|
|
14955
|
+
image: shown?.image ?? "",
|
|
14956
|
+
upgrades: shown?.upgrades ?? 0
|
|
14957
|
+
}))
|
|
14958
|
+
};
|
|
14959
|
+
});
|
|
14960
|
+
}
|
|
14961
|
+
var abilityBarNode = /^ability:([0-3])$/;
|
|
14962
|
+
function cursorFree(player) {
|
|
14963
|
+
const pawn = player.pawn();
|
|
14964
|
+
if (pawn === void 0) return void 0;
|
|
14965
|
+
return readField(
|
|
14966
|
+
pawn.entity,
|
|
14967
|
+
"CCitadelPlayer_MovementServices",
|
|
14968
|
+
"m_bHasFreeCursor",
|
|
14969
|
+
"bool"
|
|
14970
|
+
);
|
|
14971
|
+
}
|
|
14972
|
+
function sheet(path) {
|
|
14973
|
+
if (!path.endsWith(".css") || !path.split("/").every((part) => sheetPart.test(part) && part !== "..")) {
|
|
14974
|
+
return false;
|
|
14975
|
+
}
|
|
14976
|
+
if (sheets.includes(path)) {
|
|
14977
|
+
return true;
|
|
14978
|
+
}
|
|
14979
|
+
sheets.push(path);
|
|
14980
|
+
for (const current of views.values()) {
|
|
14981
|
+
draw(current.player);
|
|
14982
|
+
}
|
|
14983
|
+
return true;
|
|
14984
|
+
}
|
|
14985
|
+
var sheetPart = /^[\w.-]+$/;
|
|
14986
|
+
var sheets = [];
|
|
14987
|
+
function route(player, name, value) {
|
|
14988
|
+
const routes = new Map(view(player).routes);
|
|
14989
|
+
const encoded = value === void 0 ? void 0 : JSON.stringify(value);
|
|
14990
|
+
if (!routeName.test(name) || value !== void 0 && encoded === void 0) {
|
|
14991
|
+
return false;
|
|
14992
|
+
}
|
|
14993
|
+
if (encoded === void 0) {
|
|
14994
|
+
routes.delete(name);
|
|
14995
|
+
} else {
|
|
14996
|
+
routes.set(name, encoded);
|
|
14997
|
+
}
|
|
14998
|
+
views.set(player.slot, { ...view(player), routes });
|
|
14999
|
+
return draw(player);
|
|
15000
|
+
}
|
|
15001
|
+
var routeName = /^[\w.-]+$/;
|
|
15002
|
+
function hide(player) {
|
|
15003
|
+
views.delete(player.slot);
|
|
15004
|
+
screens.delete(player.slot);
|
|
15005
|
+
return send(player.slot, { reset: true });
|
|
15006
|
+
}
|
|
15007
|
+
function toast(player, text2, seconds = 4) {
|
|
15008
|
+
const current = view(player);
|
|
15009
|
+
const notice = { id: nextNotice++, text: text2, until: now2 + seconds };
|
|
15010
|
+
views.set(player.slot, {
|
|
15011
|
+
...current,
|
|
15012
|
+
notices: [...current.notices, notice].slice(-maxNotices)
|
|
15013
|
+
});
|
|
15014
|
+
return draw(player);
|
|
15015
|
+
}
|
|
15016
|
+
function uiSound(player, sound, options = {}) {
|
|
15017
|
+
const current = view(player);
|
|
15018
|
+
const cue = { number: nextCue++, sound, seconds: options.seconds ?? 0 };
|
|
15019
|
+
views.set(player.slot, {
|
|
15020
|
+
...current,
|
|
15021
|
+
cues: [...current.cues, cue].slice(-maxCues)
|
|
15022
|
+
});
|
|
15023
|
+
return draw(player);
|
|
15024
|
+
}
|
|
15025
|
+
function press(player, node) {
|
|
15026
|
+
const bar = abilityBarNode.exec(node);
|
|
15027
|
+
if (bar) {
|
|
15028
|
+
views.get(player.slot)?.bar?.handler(player, Number(bar[1]));
|
|
15029
|
+
return;
|
|
15030
|
+
}
|
|
15031
|
+
const pressed = screens.get(player.slot)?.presses.get(node);
|
|
15032
|
+
if (pressed) {
|
|
15033
|
+
pressed.handler(player);
|
|
15034
|
+
}
|
|
15035
|
+
}
|
|
15036
|
+
function change(player, node, value) {
|
|
15037
|
+
if (typeof value === "object" && value !== null) {
|
|
15038
|
+
screens.get(player.slot)?.wheels.get(node)?.handler(player, value);
|
|
15039
|
+
return;
|
|
15040
|
+
}
|
|
15041
|
+
const changed = screens.get(player.slot)?.changes.get(node);
|
|
15042
|
+
if (changed) {
|
|
15043
|
+
changed.handler(player, value);
|
|
15044
|
+
}
|
|
15045
|
+
}
|
|
15046
|
+
function tick(seconds) {
|
|
15047
|
+
now2 = seconds;
|
|
15048
|
+
for (const current of views.values()) {
|
|
15049
|
+
if (current.notices.length === 0) {
|
|
15050
|
+
continue;
|
|
15051
|
+
}
|
|
15052
|
+
current.notices = current.notices.filter((notice) => notice.until > now2);
|
|
15053
|
+
draw(current.player);
|
|
15054
|
+
}
|
|
15055
|
+
}
|
|
15056
|
+
var views = /* @__PURE__ */ new Map();
|
|
15057
|
+
var now2 = 0;
|
|
15058
|
+
var nextNotice = 0;
|
|
15059
|
+
var nextCue = 1;
|
|
15060
|
+
var maxCues = 8;
|
|
15061
|
+
var maxNotices = 4;
|
|
15062
|
+
var noticeMotion = {
|
|
15063
|
+
enter: { opacity: 0, translate: [-16, 0] },
|
|
15064
|
+
exit: { opacity: 0 },
|
|
15065
|
+
transition: { seconds: 0.25, easing: "out" }
|
|
15066
|
+
};
|
|
15067
|
+
function view(player) {
|
|
15068
|
+
return views.get(player.slot) ?? {
|
|
15069
|
+
player,
|
|
15070
|
+
root: void 0,
|
|
15071
|
+
hud: [],
|
|
15072
|
+
cursor: false,
|
|
15073
|
+
asks: 0,
|
|
15074
|
+
routes: /* @__PURE__ */ new Map(),
|
|
15075
|
+
cues: [],
|
|
15076
|
+
bar: void 0,
|
|
15077
|
+
display: [],
|
|
15078
|
+
notices: []
|
|
15079
|
+
};
|
|
15080
|
+
}
|
|
15081
|
+
function draw(player) {
|
|
15082
|
+
const current = view(player);
|
|
15083
|
+
const root = [
|
|
15084
|
+
current.root,
|
|
15085
|
+
current.notices.length !== 0 && notices(current.notices)
|
|
15086
|
+
];
|
|
15087
|
+
const previous = screens.get(player.slot);
|
|
15088
|
+
const hud = current.hud.map((part) => hudParts[part]);
|
|
15089
|
+
const display = displayRows(player, current.display);
|
|
15090
|
+
const next = render(
|
|
15091
|
+
previous,
|
|
15092
|
+
root,
|
|
15093
|
+
hud,
|
|
15094
|
+
current.cursor,
|
|
15095
|
+
current.asks,
|
|
15096
|
+
current.routes,
|
|
15097
|
+
current.cues,
|
|
15098
|
+
current.bar !== void 0,
|
|
15099
|
+
display
|
|
15100
|
+
);
|
|
15101
|
+
const change2 = diff(previous, next);
|
|
15102
|
+
if (change2 && !send(player.slot, change2)) {
|
|
15103
|
+
const whole = render(
|
|
15104
|
+
void 0,
|
|
15105
|
+
root,
|
|
15106
|
+
hud,
|
|
15107
|
+
current.cursor,
|
|
15108
|
+
current.asks,
|
|
15109
|
+
current.routes,
|
|
15110
|
+
current.cues,
|
|
15111
|
+
current.bar !== void 0,
|
|
15112
|
+
display
|
|
15113
|
+
);
|
|
15114
|
+
if (!send(player.slot, diff(void 0, whole))) {
|
|
15115
|
+
screens.delete(player.slot);
|
|
15116
|
+
return false;
|
|
15117
|
+
}
|
|
15118
|
+
screens.set(player.slot, whole);
|
|
15119
|
+
return true;
|
|
15120
|
+
}
|
|
15121
|
+
screens.set(player.slot, next);
|
|
15122
|
+
return true;
|
|
15123
|
+
}
|
|
15124
|
+
function notices(stack) {
|
|
15125
|
+
const style = {
|
|
15126
|
+
width: "fit",
|
|
15127
|
+
height: "fit",
|
|
15128
|
+
flow: "down",
|
|
15129
|
+
horizontalAlign: "left",
|
|
15130
|
+
verticalAlign: "bottom",
|
|
15131
|
+
margin: [0, 0, 260, 24],
|
|
15132
|
+
transition: noticeMotion.transition
|
|
15133
|
+
};
|
|
15134
|
+
const labels = stack.map(
|
|
15135
|
+
(notice) => jsx(
|
|
15136
|
+
"label",
|
|
15137
|
+
{
|
|
15138
|
+
style: {
|
|
15139
|
+
horizontalAlign: "left",
|
|
15140
|
+
margin: [4, 0, 0, 0],
|
|
15141
|
+
padding: [5, 10],
|
|
15142
|
+
background: "#101418d8",
|
|
15143
|
+
color: "#f2f2f2",
|
|
15144
|
+
fontSize: 16,
|
|
15145
|
+
borderRadius: 4,
|
|
15146
|
+
transition: noticeMotion.transition
|
|
15147
|
+
},
|
|
15148
|
+
enter: noticeMotion.enter,
|
|
15149
|
+
exit: noticeMotion.exit,
|
|
15150
|
+
children: notice.text
|
|
15151
|
+
},
|
|
15152
|
+
notice.id
|
|
15153
|
+
)
|
|
15154
|
+
);
|
|
15155
|
+
return jsx("panel", { style, exit: noticeMotion.exit, children: labels });
|
|
15156
|
+
}
|
|
15157
|
+
var screens = /* @__PURE__ */ new Map();
|
|
15158
|
+
function render(previous, root, hud, cursor, asks, routes, cues, bar, display) {
|
|
15159
|
+
const layout = new Layout(previous);
|
|
15160
|
+
layout.add({
|
|
15161
|
+
id: "",
|
|
15162
|
+
kind: 0 /* PANEL */,
|
|
15163
|
+
children: place(layout, root, "/"),
|
|
15164
|
+
hideHud: [...hud],
|
|
15165
|
+
freeCursor: cursor,
|
|
15166
|
+
freeCursorAsks: asks,
|
|
15167
|
+
sheets: [...sheets],
|
|
15168
|
+
cues: [...cues],
|
|
15169
|
+
abilityBarPresses: bar,
|
|
15170
|
+
abilityDisplay: [...display]
|
|
15171
|
+
});
|
|
15172
|
+
for (const [name, data] of routes) {
|
|
15173
|
+
layout.add({ id: `route:${name}`, kind: 5 /* ROUTE */, route: name, data });
|
|
15174
|
+
}
|
|
15175
|
+
return layout.screen;
|
|
15176
|
+
}
|
|
15177
|
+
var Layout = class {
|
|
15178
|
+
screen;
|
|
15179
|
+
previous;
|
|
15180
|
+
/** The layout continues previous's id counter and keeps its ids. */
|
|
15181
|
+
constructor(previous) {
|
|
15182
|
+
this.previous = previous;
|
|
15183
|
+
this.screen = {
|
|
15184
|
+
nodes: /* @__PURE__ */ new Map(),
|
|
15185
|
+
ids: /* @__PURE__ */ new Map(),
|
|
15186
|
+
presses: /* @__PURE__ */ new Map(),
|
|
15187
|
+
changes: /* @__PURE__ */ new Map(),
|
|
15188
|
+
wheels: /* @__PURE__ */ new Map(),
|
|
15189
|
+
next: previous?.next ?? 0
|
|
15190
|
+
};
|
|
15191
|
+
}
|
|
15192
|
+
/** add records a node. */
|
|
15193
|
+
add(node) {
|
|
15194
|
+
const value = node.steamId === void 0 ? node : { ...node, steamId: String(node.steamId) };
|
|
15195
|
+
const encoded = JSON.stringify(value);
|
|
15196
|
+
this.screen.nodes.set(node.id, { node, encoded });
|
|
15197
|
+
}
|
|
15198
|
+
/** id returns the node id for the element at place. */
|
|
15199
|
+
id(place2) {
|
|
15200
|
+
let found = this.previous?.ids.get(place2);
|
|
15201
|
+
if (found === void 0) {
|
|
15202
|
+
found = (this.screen.next++).toString(36);
|
|
15203
|
+
}
|
|
15204
|
+
this.screen.ids.set(place2, found);
|
|
15205
|
+
return found;
|
|
15206
|
+
}
|
|
15207
|
+
};
|
|
15208
|
+
function place(layout, child, at3) {
|
|
15209
|
+
if (child === null || child === void 0 || typeof child === "boolean") {
|
|
15210
|
+
return [];
|
|
15211
|
+
}
|
|
15212
|
+
if (isList(child)) {
|
|
15213
|
+
return child.flatMap((item2, index) => {
|
|
15214
|
+
const key = isElement(item2) ? item2.key : void 0;
|
|
15215
|
+
return place(
|
|
15216
|
+
layout,
|
|
15217
|
+
item2,
|
|
15218
|
+
key === void 0 ? `${at3},${index}` : `${at3},=${key}`
|
|
15219
|
+
);
|
|
15220
|
+
});
|
|
15221
|
+
}
|
|
15222
|
+
if (!isElement(child)) {
|
|
15223
|
+
const node2 = {
|
|
15224
|
+
id: layout.id(at3),
|
|
15225
|
+
kind: 1 /* LABEL */,
|
|
15226
|
+
text: String(child)
|
|
15227
|
+
};
|
|
15228
|
+
layout.add(node2);
|
|
15229
|
+
return [node2.id];
|
|
15230
|
+
}
|
|
15231
|
+
if (child.type === fragment) {
|
|
15232
|
+
return place(layout, child.props.children, `${at3}>`);
|
|
15233
|
+
}
|
|
15234
|
+
const props = child.props;
|
|
15235
|
+
const node = {
|
|
15236
|
+
id: layout.id(at3),
|
|
15237
|
+
style: wireStyle(props.style),
|
|
15238
|
+
hover: wireStyle(props.hover),
|
|
15239
|
+
tooltip: props.tooltip,
|
|
15240
|
+
item: props.item ? itemId(props.item) : void 0,
|
|
15241
|
+
ability: props.ability?.name ? itemId(props.ability.name) : void 0,
|
|
15242
|
+
abilityPlayer: props.ability?.name ? props.ability.player.slot : void 0,
|
|
15243
|
+
hoverSound: props.hoverSound,
|
|
15244
|
+
enter: wireStyle(props.enter),
|
|
15245
|
+
exit: wireStyle(props.exit),
|
|
15246
|
+
cycle: cycle(props.cycle),
|
|
15247
|
+
classes: classes(props.class)
|
|
15248
|
+
};
|
|
15249
|
+
switch (child.type) {
|
|
15250
|
+
case "label":
|
|
15251
|
+
node.kind = 1 /* LABEL */;
|
|
15252
|
+
node.text = text(props.children);
|
|
15253
|
+
node.token = props.token;
|
|
15254
|
+
node.variables = variables(props.variables);
|
|
15255
|
+
break;
|
|
15256
|
+
case "avatar":
|
|
15257
|
+
node.kind = 8 /* AVATAR */;
|
|
15258
|
+
node.steamId = props.steamId;
|
|
15259
|
+
break;
|
|
15260
|
+
case "entry":
|
|
15261
|
+
case "slider":
|
|
15262
|
+
case "toggle":
|
|
15263
|
+
case "dropdown":
|
|
15264
|
+
input(layout, node, child.type, props);
|
|
15265
|
+
break;
|
|
15266
|
+
case "image":
|
|
15267
|
+
node.kind = 2 /* IMAGE */;
|
|
15268
|
+
node.image = props.src ?? "";
|
|
15269
|
+
node.scaling = scaling(props.scaling);
|
|
15270
|
+
break;
|
|
15271
|
+
case "hero":
|
|
15272
|
+
node.kind = 6 /* HERO_IMAGE */;
|
|
15273
|
+
node.hero = props.hero;
|
|
15274
|
+
node.heroLook = props.look === void 0 ? void 0 : looks[props.look];
|
|
15275
|
+
node.scaling = scaling(props.scaling);
|
|
15276
|
+
break;
|
|
15277
|
+
case "button":
|
|
15278
|
+
node.kind = 3 /* BUTTON */;
|
|
15279
|
+
node.sound = props.sound;
|
|
15280
|
+
node.disabled = props.disabled;
|
|
15281
|
+
if (props.onPress && !props.disabled) {
|
|
15282
|
+
layout.screen.presses.set(node.id, { handler: props.onPress });
|
|
15283
|
+
}
|
|
15284
|
+
node.children = place(layout, props.children, `${at3}/`);
|
|
15285
|
+
break;
|
|
15286
|
+
case "layout":
|
|
15287
|
+
node.kind = 4 /* LAYOUT */;
|
|
15288
|
+
node.layout = props.src ?? "";
|
|
15289
|
+
node.data = props.data === void 0 ? "" : JSON.stringify(props.data) ?? "";
|
|
15290
|
+
break;
|
|
15291
|
+
default:
|
|
15292
|
+
node.kind = 0 /* PANEL */;
|
|
15293
|
+
node.children = place(layout, props.children, `${at3}/`);
|
|
15294
|
+
}
|
|
15295
|
+
layout.add(node);
|
|
15296
|
+
return [node.id];
|
|
15297
|
+
}
|
|
15298
|
+
function classes(names) {
|
|
15299
|
+
const list = (names ?? "").split(" ").filter((name) => name !== "");
|
|
15300
|
+
return list.length === 0 ? void 0 : list;
|
|
15301
|
+
}
|
|
15302
|
+
function input(layout, node, kind, props) {
|
|
15303
|
+
node.kind = 7 /* INPUT */;
|
|
15304
|
+
node.disabled = props.disabled;
|
|
15305
|
+
if (props.onChange && !props.disabled) {
|
|
15306
|
+
layout.screen.changes.set(node.id, { handler: props.onChange });
|
|
15307
|
+
}
|
|
15308
|
+
switch (kind) {
|
|
15309
|
+
case "entry":
|
|
15310
|
+
node.input = {
|
|
15311
|
+
case: "textEntry",
|
|
15312
|
+
value: {
|
|
15313
|
+
text: String(props.value ?? ""),
|
|
15314
|
+
placeholder: props.placeholder,
|
|
15315
|
+
maxLength: props.maxLength
|
|
15316
|
+
}
|
|
15317
|
+
};
|
|
15318
|
+
break;
|
|
15319
|
+
case "slider":
|
|
15320
|
+
if (props.onWheel && !props.disabled) {
|
|
15321
|
+
layout.screen.wheels.set(node.id, { handler: props.onWheel });
|
|
15322
|
+
}
|
|
15323
|
+
node.input = {
|
|
15324
|
+
case: "slider",
|
|
15325
|
+
value: {
|
|
15326
|
+
value: Number(props.value ?? 0),
|
|
15327
|
+
min: props.min,
|
|
15328
|
+
max: props.max,
|
|
15329
|
+
step: props.step,
|
|
15330
|
+
wheel: !!props.onWheel && !props.disabled
|
|
15331
|
+
}
|
|
15332
|
+
};
|
|
15333
|
+
break;
|
|
15334
|
+
case "toggle":
|
|
15335
|
+
node.text = text(props.children);
|
|
15336
|
+
node.input = { case: "toggle", value: { on: props.on } };
|
|
15337
|
+
break;
|
|
15338
|
+
case "dropdown":
|
|
15339
|
+
node.input = {
|
|
15340
|
+
case: "dropdown",
|
|
15341
|
+
value: {
|
|
15342
|
+
options: [...props.options ?? []],
|
|
15343
|
+
selected: props.selected
|
|
15344
|
+
}
|
|
15345
|
+
};
|
|
15346
|
+
}
|
|
15347
|
+
}
|
|
15348
|
+
function variables(value) {
|
|
15349
|
+
if (!value) {
|
|
15350
|
+
return void 0;
|
|
15351
|
+
}
|
|
15352
|
+
const encoded = {};
|
|
15353
|
+
for (const [name, filled] of Object.entries(value)) {
|
|
15354
|
+
encoded[name] = String(filled);
|
|
15355
|
+
}
|
|
15356
|
+
return encoded;
|
|
15357
|
+
}
|
|
15358
|
+
function cycle(value) {
|
|
15359
|
+
if (!value) {
|
|
15360
|
+
return void 0;
|
|
15361
|
+
}
|
|
15362
|
+
return {
|
|
15363
|
+
style: wireStyle(value.style),
|
|
15364
|
+
seconds: value.seconds,
|
|
15365
|
+
count: value.count
|
|
15366
|
+
};
|
|
15367
|
+
}
|
|
15368
|
+
function diff(previous, next) {
|
|
15369
|
+
const set = [...next.nodes.values()].filter(
|
|
15370
|
+
({ node, encoded }) => previous?.nodes.get(node.id)?.encoded !== encoded
|
|
15371
|
+
).map(({ node }) => node);
|
|
15372
|
+
const removed = [...previous?.nodes.keys() ?? []].filter(
|
|
15373
|
+
(id) => !next.nodes.has(id)
|
|
15374
|
+
);
|
|
15375
|
+
if (previous && set.length === 0 && removed.length === 0) {
|
|
15376
|
+
return void 0;
|
|
15377
|
+
}
|
|
15378
|
+
return { reset: !previous, set, removed };
|
|
15379
|
+
}
|
|
15380
|
+
function send(slot, change2) {
|
|
15381
|
+
return call("Ui", UiRequest.toBinary({ player: slot, change: change2 })) !== void 0;
|
|
15382
|
+
}
|
|
15383
|
+
function isElement(child) {
|
|
15384
|
+
return typeof child === "object" && child !== null && !Array.isArray(child);
|
|
15385
|
+
}
|
|
15386
|
+
function isList(child) {
|
|
15387
|
+
return Array.isArray(child);
|
|
15388
|
+
}
|
|
15389
|
+
function text(children) {
|
|
15390
|
+
if (children === null || children === void 0 || typeof children === "boolean") {
|
|
15391
|
+
return "";
|
|
15392
|
+
}
|
|
15393
|
+
if (isList(children)) {
|
|
15394
|
+
return children.map(text).join("");
|
|
15395
|
+
}
|
|
15396
|
+
return isElement(children) ? "" : String(children);
|
|
15397
|
+
}
|
|
15398
|
+
var aligns = {
|
|
15399
|
+
left: 0 /* START */,
|
|
15400
|
+
top: 0 /* START */,
|
|
15401
|
+
center: 1 /* CENTER */,
|
|
15402
|
+
right: 2 /* END */,
|
|
15403
|
+
bottom: 2 /* END */
|
|
15404
|
+
};
|
|
15405
|
+
function align(value) {
|
|
15406
|
+
return value === void 0 ? void 0 : aligns[value];
|
|
15407
|
+
}
|
|
15408
|
+
var hudParts = {
|
|
15409
|
+
levelUp: 1 /* LEVEL_UP */,
|
|
15410
|
+
ownHealth: 2 /* OWN_HEALTH */,
|
|
15411
|
+
topBar: 3 /* TOP_BAR */,
|
|
15412
|
+
ammo: 4 /* AMMO */,
|
|
15413
|
+
souls: 5 /* SOULS */,
|
|
15414
|
+
minimap: 6 /* MINIMAP */,
|
|
15415
|
+
abilities: 7 /* ABILITIES */,
|
|
15416
|
+
status: 8 /* STATUS */,
|
|
15417
|
+
stats: 9 /* STATS */,
|
|
15418
|
+
heroPicker: 10 /* HERO_PICKER */,
|
|
15419
|
+
brokerCountdown: 11 /* BROKER_COUNTDOWN */,
|
|
15420
|
+
all: 12 /* ALL */
|
|
15421
|
+
};
|
|
15422
|
+
var faces = {
|
|
15423
|
+
body: 1 /* BODY */,
|
|
15424
|
+
block: 2 /* BLOCK */,
|
|
15425
|
+
serif: 3 /* SERIF */
|
|
15426
|
+
};
|
|
15427
|
+
var looks = {
|
|
15428
|
+
small: 0 /* SMALL */,
|
|
15429
|
+
card: 1 /* CARD */,
|
|
15430
|
+
icon: 2 /* ICON */,
|
|
15431
|
+
vertical: 3 /* VERTICAL */,
|
|
15432
|
+
topBar: 4 /* TOP_BAR */,
|
|
15433
|
+
minimap: 5 /* MINIMAP */
|
|
15434
|
+
};
|
|
15435
|
+
var scalings = {
|
|
15436
|
+
fit: 1 /* FIT */,
|
|
15437
|
+
cover: 2 /* COVER */,
|
|
15438
|
+
stretch: 3 /* STRETCH */,
|
|
15439
|
+
fitWidth: 4 /* FIT_WIDTH */,
|
|
15440
|
+
fitHeight: 5 /* FIT_HEIGHT */,
|
|
15441
|
+
none: 6 /* NONE */
|
|
15442
|
+
};
|
|
15443
|
+
function scaling(value) {
|
|
15444
|
+
return value === void 0 ? void 0 : scalings[value];
|
|
15445
|
+
}
|
|
15446
|
+
var flows = {
|
|
15447
|
+
down: 1 /* DOWN */,
|
|
15448
|
+
right: 2 /* RIGHT */,
|
|
15449
|
+
downWrap: 3 /* DOWN_WRAP */,
|
|
15450
|
+
rightWrap: 4 /* RIGHT_WRAP */
|
|
15451
|
+
};
|
|
15452
|
+
var overflows = {
|
|
15453
|
+
squish: 1 /* SQUISH */,
|
|
15454
|
+
clip: 2 /* CLIP */,
|
|
15455
|
+
scroll: 3 /* SCROLL */,
|
|
15456
|
+
show: 4 /* SHOW */
|
|
15457
|
+
};
|
|
15458
|
+
function overflow(value) {
|
|
15459
|
+
return value === void 0 ? void 0 : overflows[value];
|
|
15460
|
+
}
|
|
15461
|
+
var shapes = {
|
|
15462
|
+
down: 0 /* DOWN */,
|
|
15463
|
+
right: 1 /* RIGHT */,
|
|
15464
|
+
up: 2 /* UP */,
|
|
15465
|
+
left: 3 /* LEFT */,
|
|
15466
|
+
radial: 4 /* RADIAL */
|
|
15467
|
+
};
|
|
15468
|
+
var weights = {
|
|
15469
|
+
thin: 1 /* THIN */,
|
|
15470
|
+
light: 2 /* LIGHT */,
|
|
15471
|
+
normal: 3 /* NORMAL */,
|
|
15472
|
+
medium: 4 /* MEDIUM */,
|
|
15473
|
+
semiBold: 5 /* SEMI_BOLD */,
|
|
15474
|
+
bold: 6 /* BOLD */,
|
|
15475
|
+
black: 7 /* BLACK */
|
|
15476
|
+
};
|
|
15477
|
+
var textOverflows = {
|
|
15478
|
+
ellipsis: 1 /* ELLIPSIS */,
|
|
15479
|
+
shrink: 2 /* SHRINK */,
|
|
15480
|
+
clip: 3 /* CLIP */
|
|
15481
|
+
};
|
|
15482
|
+
var decorations = {
|
|
15483
|
+
underline: 1 /* UNDERLINE */,
|
|
15484
|
+
strike: 2 /* STRIKE */
|
|
15485
|
+
};
|
|
15486
|
+
var easings = {
|
|
15487
|
+
out: 0 /* EASE_OUT */,
|
|
15488
|
+
in: 1 /* EASE_IN */,
|
|
15489
|
+
inOut: 2 /* EASE_IN_OUT */,
|
|
15490
|
+
linear: 3 /* LINEAR */
|
|
15491
|
+
};
|
|
15492
|
+
function wireStyle(style) {
|
|
15493
|
+
if (!style) {
|
|
15494
|
+
return void 0;
|
|
15495
|
+
}
|
|
15496
|
+
return {
|
|
15497
|
+
width: length(style.width),
|
|
15498
|
+
height: length(style.height),
|
|
15499
|
+
flow: style.flow === void 0 ? void 0 : flows[style.flow],
|
|
15500
|
+
horizontalAlign: align(style.horizontalAlign),
|
|
15501
|
+
verticalAlign: align(style.verticalAlign),
|
|
15502
|
+
margin: edges(style.margin),
|
|
15503
|
+
padding: edges(style.padding),
|
|
15504
|
+
background: color(style.background),
|
|
15505
|
+
color: color(style.color),
|
|
15506
|
+
fontSize: style.fontSize,
|
|
15507
|
+
bold: style.bold,
|
|
15508
|
+
textAlign: align(style.textAlign),
|
|
15509
|
+
borderRadius: style.borderRadius,
|
|
15510
|
+
opacity: style.opacity,
|
|
15511
|
+
face: style.face === void 0 ? void 0 : faces[style.face],
|
|
15512
|
+
uppercase: style.uppercase,
|
|
15513
|
+
letterSpacing: style.letterSpacing,
|
|
15514
|
+
shadow: style.shadow,
|
|
15515
|
+
borderWidth: style.borderWidth,
|
|
15516
|
+
borderColor: color(style.borderColor),
|
|
15517
|
+
x: length(style.x),
|
|
15518
|
+
y: length(style.y),
|
|
15519
|
+
minWidth: length(style.minWidth),
|
|
15520
|
+
maxWidth: length(style.maxWidth),
|
|
15521
|
+
minHeight: length(style.minHeight),
|
|
15522
|
+
maxHeight: length(style.maxHeight),
|
|
15523
|
+
zIndex: style.zIndex,
|
|
15524
|
+
overflowX: overflow(style.overflowX ?? style.overflow),
|
|
15525
|
+
overflowY: overflow(style.overflowY ?? style.overflow),
|
|
15526
|
+
gradient: gradient(style.gradient),
|
|
15527
|
+
boxShadow: shadow(style.boxShadow),
|
|
15528
|
+
textShadow: shadow(style.textShadow),
|
|
15529
|
+
tint: color(style.tint),
|
|
15530
|
+
saturation: style.saturation,
|
|
15531
|
+
brightness: style.brightness,
|
|
15532
|
+
contrast: style.contrast,
|
|
15533
|
+
blur: style.blur,
|
|
15534
|
+
italic: style.italic,
|
|
15535
|
+
weight: style.weight === void 0 ? void 0 : weights[style.weight],
|
|
15536
|
+
lineHeight: style.lineHeight,
|
|
15537
|
+
noWrap: style.noWrap,
|
|
15538
|
+
textOverflow: style.textOverflow === void 0 ? void 0 : textOverflows[style.textOverflow],
|
|
15539
|
+
decoration: style.decoration === void 0 ? void 0 : decorations[style.decoration],
|
|
15540
|
+
transform: transform(style),
|
|
15541
|
+
transition: transition(style.transition)
|
|
15542
|
+
};
|
|
15543
|
+
}
|
|
15544
|
+
function gradient(value) {
|
|
15545
|
+
if (!value) {
|
|
15546
|
+
return void 0;
|
|
15547
|
+
}
|
|
15548
|
+
const last = Math.max(1, value.colors.length - 1);
|
|
15549
|
+
return {
|
|
15550
|
+
shape: value.shape === void 0 ? void 0 : shapes[value.shape],
|
|
15551
|
+
stops: value.colors.map((each, index) => ({
|
|
15552
|
+
at: value.at?.[index] ?? index / last,
|
|
15553
|
+
color: color(each)
|
|
15554
|
+
}))
|
|
15555
|
+
};
|
|
15556
|
+
}
|
|
15557
|
+
function shadow(value) {
|
|
15558
|
+
if (!value) {
|
|
15559
|
+
return void 0;
|
|
15560
|
+
}
|
|
15561
|
+
return {
|
|
15562
|
+
x: value.x,
|
|
15563
|
+
y: value.y,
|
|
15564
|
+
blur: value.blur,
|
|
15565
|
+
spread: value.spread,
|
|
15566
|
+
color: color(value.color),
|
|
15567
|
+
inset: value.inset
|
|
15568
|
+
};
|
|
15569
|
+
}
|
|
15570
|
+
function transform(style) {
|
|
15571
|
+
const { translate, scale: scale2, rotate, origin } = style;
|
|
15572
|
+
if (!translate && scale2 === void 0 && rotate === void 0 && !origin) {
|
|
15573
|
+
return void 0;
|
|
15574
|
+
}
|
|
15575
|
+
const scales = typeof scale2 === "number" ? [scale2, scale2] : scale2;
|
|
15576
|
+
return {
|
|
15577
|
+
translateX: translate?.[0],
|
|
15578
|
+
translateY: translate?.[1],
|
|
15579
|
+
scaleX: scales?.[0],
|
|
15580
|
+
scaleY: scales?.[1],
|
|
15581
|
+
rotate,
|
|
15582
|
+
originX: origin?.[0],
|
|
15583
|
+
originY: origin?.[1]
|
|
15584
|
+
};
|
|
15585
|
+
}
|
|
15586
|
+
function transition(value) {
|
|
15587
|
+
if (value === void 0) {
|
|
15588
|
+
return void 0;
|
|
15589
|
+
}
|
|
15590
|
+
if (typeof value === "number") {
|
|
15591
|
+
return { seconds: value };
|
|
15592
|
+
}
|
|
15593
|
+
return {
|
|
15594
|
+
seconds: value.seconds,
|
|
15595
|
+
delay: value.delay,
|
|
15596
|
+
easing: value.easing === void 0 ? void 0 : easings[value.easing]
|
|
15597
|
+
};
|
|
15598
|
+
}
|
|
15599
|
+
function length(value) {
|
|
15600
|
+
if (value === void 0) {
|
|
15601
|
+
return void 0;
|
|
15602
|
+
}
|
|
15603
|
+
if (typeof value === "number") {
|
|
15604
|
+
return { value: { case: "pixels", value } };
|
|
15605
|
+
}
|
|
15606
|
+
if (value === "fit") {
|
|
15607
|
+
return { value: { case: "fitChildren", value: true } };
|
|
15608
|
+
}
|
|
15609
|
+
if (value === "fill") {
|
|
15610
|
+
return { value: { case: "fill", value: 1 } };
|
|
15611
|
+
}
|
|
15612
|
+
return { value: { case: "percent", value: Number.parseFloat(value) } };
|
|
15613
|
+
}
|
|
15614
|
+
function edges(value) {
|
|
15615
|
+
if (value === void 0) {
|
|
15616
|
+
return void 0;
|
|
15617
|
+
}
|
|
15618
|
+
if (typeof value === "number") {
|
|
15619
|
+
return { top: value, right: value, bottom: value, left: value };
|
|
15620
|
+
}
|
|
15621
|
+
if (value.length === 2) {
|
|
15622
|
+
return { top: value[0], right: value[1], bottom: value[0], left: value[1] };
|
|
15623
|
+
}
|
|
15624
|
+
return { top: value[0], right: value[1], bottom: value[2], left: value[3] };
|
|
15625
|
+
}
|
|
15626
|
+
function color(value) {
|
|
15627
|
+
const hex = value?.replace(/^#/, "");
|
|
15628
|
+
if (!hex || !/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) {
|
|
15629
|
+
return void 0;
|
|
15630
|
+
}
|
|
15631
|
+
return Number.parseInt(hex.length === 6 ? `${hex}ff` : hex, 16) >>> 0;
|
|
15632
|
+
}
|
|
15633
|
+
|
|
15634
|
+
// js/src/vector.ts
|
|
15635
|
+
var vector_exports = {};
|
|
15636
|
+
__export(vector_exports, {
|
|
15637
|
+
add: () => add,
|
|
15638
|
+
aimAt: () => aimAt,
|
|
15639
|
+
at: () => at,
|
|
15640
|
+
distance: () => distance,
|
|
15641
|
+
dot: () => dot,
|
|
15642
|
+
flatDistance: () => flatDistance,
|
|
15643
|
+
forward: () => forward,
|
|
15644
|
+
length: () => length2,
|
|
15645
|
+
lerp: () => lerp2,
|
|
15646
|
+
level: () => level,
|
|
15647
|
+
normalize: () => normalize,
|
|
15648
|
+
scale: () => scale,
|
|
15649
|
+
sub: () => sub,
|
|
15650
|
+
toward: () => toward,
|
|
15651
|
+
yawToward: () => yawToward
|
|
15652
|
+
});
|
|
15653
|
+
function at(x, y, z) {
|
|
15654
|
+
return { x, y, z };
|
|
15655
|
+
}
|
|
15656
|
+
function add(a, b) {
|
|
15657
|
+
return { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
|
|
15658
|
+
}
|
|
15659
|
+
function sub(a, b) {
|
|
15660
|
+
return { x: a.x - b.x, y: a.y - b.y, z: a.z - b.z };
|
|
15661
|
+
}
|
|
15662
|
+
function scale(a, s) {
|
|
15663
|
+
return { x: a.x * s, y: a.y * s, z: a.z * s };
|
|
15664
|
+
}
|
|
15665
|
+
function dot(a, b) {
|
|
15666
|
+
return a.x * b.x + a.y * b.y + a.z * b.z;
|
|
15667
|
+
}
|
|
15668
|
+
function length2(a) {
|
|
15669
|
+
return Math.hypot(a.x, a.y, a.z);
|
|
15670
|
+
}
|
|
15671
|
+
function normalize(a) {
|
|
15672
|
+
const size = length2(a);
|
|
15673
|
+
return size > 0 ? scale(a, 1 / size) : { x: 1, y: 0, z: 0 };
|
|
15674
|
+
}
|
|
15675
|
+
function lerp2(a, b, t) {
|
|
15676
|
+
return {
|
|
15677
|
+
x: a.x + (b.x - a.x) * t,
|
|
15678
|
+
y: a.y + (b.y - a.y) * t,
|
|
15679
|
+
z: a.z + (b.z - a.z) * t
|
|
15680
|
+
};
|
|
15681
|
+
}
|
|
15682
|
+
function distance(a, b) {
|
|
15683
|
+
return Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);
|
|
15684
|
+
}
|
|
15685
|
+
function flatDistance(a, b) {
|
|
15686
|
+
return Math.hypot(a.x - b.x, a.y - b.y);
|
|
15687
|
+
}
|
|
15688
|
+
function toward(from, to) {
|
|
15689
|
+
const span = distance(from, to);
|
|
15690
|
+
return span > 0 ? scale(sub(to, from), 1 / span) : { x: 0, y: 0, z: 0 };
|
|
15691
|
+
}
|
|
15692
|
+
function yawToward(from, to) {
|
|
15693
|
+
return Math.atan2(to.y - from.y, to.x - from.x) * 180 / Math.PI;
|
|
15694
|
+
}
|
|
15695
|
+
function level(yaw) {
|
|
15696
|
+
return { pitch: 0, yaw, roll: 0 };
|
|
15697
|
+
}
|
|
15698
|
+
function aimAt(from, to) {
|
|
15699
|
+
const across = flatDistance(from, to);
|
|
15700
|
+
return {
|
|
15701
|
+
pitch: -Math.atan2(to.z - from.z, across) * 180 / Math.PI,
|
|
15702
|
+
yaw: yawToward(from, to),
|
|
15703
|
+
roll: 0
|
|
15704
|
+
};
|
|
15705
|
+
}
|
|
15706
|
+
function forward(angles2) {
|
|
15707
|
+
const pitch = angles2.pitch * Math.PI / 180;
|
|
15708
|
+
const yaw = angles2.yaw * Math.PI / 180;
|
|
15709
|
+
return {
|
|
15710
|
+
x: Math.cos(pitch) * Math.cos(yaw),
|
|
15711
|
+
y: Math.cos(pitch) * Math.sin(yaw),
|
|
15712
|
+
z: -Math.sin(pitch)
|
|
15713
|
+
};
|
|
15714
|
+
}
|
|
15715
|
+
|
|
15716
|
+
// js/src/bits.ts
|
|
15717
|
+
var Buttons = {
|
|
15718
|
+
/** attack is the primary fire button. */
|
|
15719
|
+
attack: 1n,
|
|
15720
|
+
/**
|
|
15721
|
+
* jump is the jump key, Space by default (IN_MANTLE). Blocking it stops the
|
|
15722
|
+
* native jump and mantle; the jumping client still predicts the jump and is
|
|
15723
|
+
* corrected.
|
|
15724
|
+
*/
|
|
15725
|
+
jump: 1n << 48n,
|
|
15726
|
+
/** crouch is the crouch key, Ctrl by default. */
|
|
15727
|
+
crouch: 1n << 2n,
|
|
15728
|
+
/** dash is the dash key, Shift by default. */
|
|
15729
|
+
dash: 1n << 16n,
|
|
15730
|
+
/** use is the interact key. */
|
|
15731
|
+
use: 1n << 5n,
|
|
15732
|
+
/** altFire is the zoom and alternate fire button, right mouse by default. */
|
|
15733
|
+
altFire: 1n << 11n,
|
|
15734
|
+
/** reload is the reload key. */
|
|
15735
|
+
reload: 1n << 13n,
|
|
15736
|
+
/** melee is the light melee key, Q by default. */
|
|
15737
|
+
melee: 1n << 32n,
|
|
15738
|
+
/** ability1 to ability3 are the hero's first three ability keys. */
|
|
15739
|
+
ability1: 1n << 33n,
|
|
15740
|
+
ability2: 1n << 34n,
|
|
15741
|
+
ability3: 1n << 35n,
|
|
15742
|
+
/** ultimate is the hero's ultimate ability key, the fourth. */
|
|
15743
|
+
ultimate: 1n << 36n,
|
|
15744
|
+
/** parry is the melee parry button. */
|
|
15745
|
+
parry: 1n << 42n
|
|
15746
|
+
};
|
|
15747
|
+
var Layers = {
|
|
15748
|
+
/** solid is the world and solid objects. */
|
|
15749
|
+
solid: 1n << 0n,
|
|
15750
|
+
/** hitbox is the hit boxes of heroes and units. */
|
|
15751
|
+
hitbox: 1n << 1n,
|
|
15752
|
+
/** trigger is invisible volumes that react to touch. */
|
|
15753
|
+
trigger: 1n << 2n,
|
|
15754
|
+
/** playerClip is walls that only stop heroes. */
|
|
15755
|
+
playerClip: 1n << 4n,
|
|
15756
|
+
/** player is player-controlled heroes. */
|
|
15757
|
+
player: 1n << 18n,
|
|
15758
|
+
/** npc is units that are not players. */
|
|
15759
|
+
npc: 1n << 19n,
|
|
15760
|
+
/** staticLevel is the map's built geometry, foliage included. */
|
|
15761
|
+
staticLevel: 1n << 30n,
|
|
15762
|
+
/** hero, trooper and building are those units' bodies. */
|
|
15763
|
+
hero: 1n << 37n,
|
|
15764
|
+
trooper: 1n << 38n,
|
|
15765
|
+
building: 1n << 40n
|
|
15766
|
+
};
|
|
15767
|
+
|
|
15768
|
+
// js/src/curve.ts
|
|
15769
|
+
var curve_exports = {};
|
|
15770
|
+
__export(curve_exports, {
|
|
15771
|
+
chain: () => chain,
|
|
15772
|
+
durationOf: () => durationOf,
|
|
15773
|
+
ease: () => ease,
|
|
15774
|
+
hold: () => hold,
|
|
15775
|
+
keyframes: () => keyframes,
|
|
15776
|
+
line: () => line,
|
|
15777
|
+
orbit: () => orbit,
|
|
15778
|
+
pingPong: () => pingPong,
|
|
15779
|
+
repeat: () => repeat,
|
|
15780
|
+
reverse: () => reverse,
|
|
15781
|
+
shaped: () => shaped,
|
|
15782
|
+
through: () => through,
|
|
15783
|
+
valueAt: () => valueAt,
|
|
15784
|
+
wave: () => wave
|
|
15785
|
+
});
|
|
15786
|
+
var ease = {
|
|
15787
|
+
/** linear moves at an even pace. */
|
|
15788
|
+
linear: shaped((t) => t, {}),
|
|
15789
|
+
/** bias is the game's bias curve; see LerpShape. */
|
|
15790
|
+
bias: (b) => shaped((t) => bias(t, b), { bias: b }),
|
|
15791
|
+
/** gain is the game's gain curve; see LerpShape. */
|
|
15792
|
+
gain: (g) => shaped((t) => gain(t, g), { gain: g }),
|
|
15793
|
+
/** in starts slow and speeds up. */
|
|
15794
|
+
in: shaped((t) => t * t * t),
|
|
15795
|
+
/** out starts fast and slows to a stop. */
|
|
15796
|
+
out: shaped((t) => 1 - (1 - t) ** 3),
|
|
15797
|
+
/** inOut starts and ends slow. */
|
|
15798
|
+
inOut: shaped((t) => t < 0.5 ? 4 * t * t * t : 1 - (2 - 2 * t) ** 3 / 2),
|
|
15799
|
+
/** sine starts and ends slow, more gently than inOut. */
|
|
15800
|
+
sine: shaped((t) => (1 - Math.cos(Math.PI * t)) / 2),
|
|
15801
|
+
/** back passes its end a little and settles back onto it. */
|
|
15802
|
+
back: shaped((t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2),
|
|
15803
|
+
/** elastic overshoots its end and rings down onto it. */
|
|
15804
|
+
elastic: shaped(
|
|
15805
|
+
(t) => t <= 0 || t >= 1 ? t : 2 ** (-10 * t) * Math.sin((t * 10 - 0.75) * 2 * Math.PI / 3) + 1
|
|
15806
|
+
),
|
|
15807
|
+
/** bounce drops onto its end and bounces to rest. */
|
|
15808
|
+
bounce: shaped((t) => {
|
|
15809
|
+
const k = 7.5625;
|
|
15810
|
+
if (t < 1 / 2.75) return k * t * t;
|
|
15811
|
+
if (t < 2 / 2.75) return k * (t - 1.5 / 2.75) ** 2 + 0.75;
|
|
15812
|
+
if (t < 2.5 / 2.75) return k * (t - 2.25 / 2.75) ** 2 + 0.9375;
|
|
15813
|
+
return k * (t - 2.625 / 2.75) ** 2 + 0.984375;
|
|
15814
|
+
})
|
|
15815
|
+
};
|
|
15816
|
+
function shaped(at3, lerp3) {
|
|
15817
|
+
return { at: at3, lerp: lerp3 };
|
|
15818
|
+
}
|
|
15819
|
+
function line(from, to, duration, shape = ease.linear) {
|
|
15820
|
+
return [{ duration, lerp: shape.lerp, at: (u) => mix(from, to, shape.at(u)) }];
|
|
15821
|
+
}
|
|
15822
|
+
function hold(value, duration) {
|
|
15823
|
+
return [{ duration, lerp: {}, at: () => value }];
|
|
15824
|
+
}
|
|
15825
|
+
function keyframes(keys, options = {}) {
|
|
15826
|
+
const spans = [];
|
|
15827
|
+
const [first] = keys;
|
|
15828
|
+
if (first && first.at > 0) spans.push(...hold(first.value, first.at));
|
|
15829
|
+
keys.forEach((to, i) => {
|
|
15830
|
+
const from = keys[i - 1];
|
|
15831
|
+
if (!from || to.at <= from.at) return;
|
|
15832
|
+
const duration = to.at - from.at;
|
|
15833
|
+
const shape = to.ease ?? ease.linear;
|
|
15834
|
+
if (!options.smooth) {
|
|
15835
|
+
spans.push(...line(from.value, to.value, duration, shape));
|
|
15836
|
+
return;
|
|
15837
|
+
}
|
|
15838
|
+
const before = keys[i - 2]?.value ?? from.value;
|
|
15839
|
+
const after2 = keys[i + 1]?.value ?? to.value;
|
|
15840
|
+
spans.push({
|
|
15841
|
+
duration,
|
|
15842
|
+
at: (u) => spline(before, from.value, to.value, after2, shape.at(u))
|
|
15843
|
+
});
|
|
15844
|
+
});
|
|
15845
|
+
return spans;
|
|
15846
|
+
}
|
|
15847
|
+
function through(points, options) {
|
|
15848
|
+
let at3 = 0;
|
|
15849
|
+
let last = points[0];
|
|
15850
|
+
const keys = points.map((value) => {
|
|
15851
|
+
if (last !== void 0) at3 += distance2(last, value) / options.speed;
|
|
15852
|
+
last = value;
|
|
15853
|
+
return { at: at3, value, ease: options.ease };
|
|
15854
|
+
});
|
|
15855
|
+
return keyframes(keys, options);
|
|
15856
|
+
}
|
|
15857
|
+
function orbit(options) {
|
|
15858
|
+
const { center, radius, duration } = options;
|
|
15859
|
+
const turns = options.turns ?? 1;
|
|
15860
|
+
const start = (options.start ?? 0) * Math.PI / 180;
|
|
15861
|
+
const rise = options.rise ?? 0;
|
|
15862
|
+
const shape = options.ease ?? ease.linear;
|
|
15863
|
+
return [
|
|
15864
|
+
{
|
|
15865
|
+
duration,
|
|
15866
|
+
at: (u) => {
|
|
15867
|
+
const t = shape.at(u);
|
|
15868
|
+
const angle = start + t * turns * 2 * Math.PI;
|
|
15869
|
+
return {
|
|
15870
|
+
x: center.x + radius * Math.cos(angle),
|
|
15871
|
+
y: center.y + radius * Math.sin(angle),
|
|
15872
|
+
z: center.z + rise * t
|
|
15873
|
+
};
|
|
15874
|
+
}
|
|
15875
|
+
}
|
|
15876
|
+
];
|
|
15877
|
+
}
|
|
15878
|
+
function wave(options) {
|
|
15879
|
+
const { amplitude, frequency, duration, decay } = options;
|
|
15880
|
+
return [
|
|
15881
|
+
{
|
|
15882
|
+
duration,
|
|
15883
|
+
at: (u) => amplitude * (decay ? 1 - u : 1) * Math.sin(2 * Math.PI * frequency * duration * u)
|
|
15884
|
+
}
|
|
15885
|
+
];
|
|
15886
|
+
}
|
|
15887
|
+
function chain(...curves) {
|
|
15888
|
+
return curves.flat();
|
|
15889
|
+
}
|
|
15890
|
+
function reverse(curve) {
|
|
15891
|
+
return curve.map((span) => ({
|
|
15892
|
+
duration: span.duration,
|
|
15893
|
+
lerp: span.lerp?.bias === void 0 ? span.lerp : void 0,
|
|
15894
|
+
at: (u) => span.at(1 - u)
|
|
15895
|
+
})).reverse();
|
|
15896
|
+
}
|
|
15897
|
+
function repeat(curve, times) {
|
|
15898
|
+
return Array.from({ length: Math.max(0, times) }, () => curve).flat();
|
|
15899
|
+
}
|
|
15900
|
+
function pingPong(curve) {
|
|
15901
|
+
return chain(curve, reverse(curve));
|
|
15902
|
+
}
|
|
15903
|
+
function durationOf(curve) {
|
|
15904
|
+
return curve.reduce((sum, span) => sum + Math.max(0, span.duration), 0);
|
|
15905
|
+
}
|
|
15906
|
+
function valueAt(curve, seconds) {
|
|
15907
|
+
let left = seconds;
|
|
15908
|
+
for (const span of curve) {
|
|
15909
|
+
if (span.duration <= 0) continue;
|
|
15910
|
+
if (left <= span.duration) return span.at(Math.max(0, left) / span.duration);
|
|
15911
|
+
left -= span.duration;
|
|
15912
|
+
}
|
|
15913
|
+
return curve.at(-1)?.at(1);
|
|
15473
15914
|
}
|
|
15474
|
-
function
|
|
15475
|
-
|
|
15476
|
-
|
|
15915
|
+
function bias(t, b) {
|
|
15916
|
+
return t ** (Math.log(b) / Math.log(0.5));
|
|
15917
|
+
}
|
|
15918
|
+
function gain(t, g) {
|
|
15919
|
+
return t < 0.5 ? bias(2 * t, 1 - g) / 2 : 1 - bias(2 - 2 * t, 1 - g) / 2;
|
|
15920
|
+
}
|
|
15921
|
+
function mix(a, b, t) {
|
|
15922
|
+
if (typeof a === "number" && typeof b === "number") return a + (b - a) * t;
|
|
15923
|
+
const [p, q] = [vector2(a), vector2(b)];
|
|
15924
|
+
return {
|
|
15925
|
+
x: p.x + (q.x - p.x) * t,
|
|
15926
|
+
y: p.y + (q.y - p.y) * t,
|
|
15927
|
+
z: p.z + (q.z - p.z) * t
|
|
15928
|
+
};
|
|
15929
|
+
}
|
|
15930
|
+
function spline(p0, p1, p2, p3, t) {
|
|
15931
|
+
const f = (a2, b2, c2, d2) => 0.5 * (2 * b2 + (c2 - a2) * t + (2 * a2 - 5 * b2 + 4 * c2 - d2) * t * t + (3 * b2 - a2 - 3 * c2 + d2) * t * t * t);
|
|
15932
|
+
if (typeof p0 === "number" && typeof p1 === "number" && typeof p2 === "number" && typeof p3 === "number") {
|
|
15933
|
+
return f(p0, p1, p2, p3);
|
|
15934
|
+
}
|
|
15935
|
+
const [a, b, c, d] = [vector2(p0), vector2(p1), vector2(p2), vector2(p3)];
|
|
15936
|
+
return {
|
|
15937
|
+
x: f(a.x, b.x, c.x, d.x),
|
|
15938
|
+
y: f(a.y, b.y, c.y, d.y),
|
|
15939
|
+
z: f(a.z, b.z, c.z, d.z)
|
|
15940
|
+
};
|
|
15941
|
+
}
|
|
15942
|
+
function distance2(a, b) {
|
|
15943
|
+
if (typeof a === "number" && typeof b === "number") return Math.abs(b - a);
|
|
15944
|
+
const [p, q] = [vector2(a), vector2(b)];
|
|
15945
|
+
return Math.hypot(q.x - p.x, q.y - p.y, q.z - p.z);
|
|
15946
|
+
}
|
|
15947
|
+
function vector2(value) {
|
|
15948
|
+
return typeof value === "number" ? { x: value, y: 0, z: 0 } : value;
|
|
15949
|
+
}
|
|
15950
|
+
|
|
15951
|
+
// js/src/camera.ts
|
|
15952
|
+
function setOrbitCamera(player, enabled) {
|
|
15953
|
+
const pawn = player.pawn();
|
|
15954
|
+
if (!pawn?.entity) return false;
|
|
15955
|
+
const flag = writeField(
|
|
15956
|
+
pawn.entity,
|
|
15957
|
+
"CCitadelPlayerPawn",
|
|
15958
|
+
"m_bInHideoutZone",
|
|
15959
|
+
"bool",
|
|
15960
|
+
enabled
|
|
15961
|
+
);
|
|
15962
|
+
const zoom = holdModifierState(
|
|
15963
|
+
pawn.entity,
|
|
15964
|
+
"MODIFIER_STATE_HIDEOUT_ZONE",
|
|
15965
|
+
enabled
|
|
15966
|
+
);
|
|
15967
|
+
if (enabled) return flag && zoom;
|
|
15968
|
+
const orbit2 = fireInput(pawn.entity, "RemoveModifier", {
|
|
15969
|
+
text: "modifier_citadel_orbit_camera"
|
|
15970
|
+
});
|
|
15971
|
+
return flag && zoom && orbit2;
|
|
15972
|
+
}
|
|
15973
|
+
var moves = 0;
|
|
15974
|
+
function playCamera(player, options) {
|
|
15975
|
+
const tracks = [];
|
|
15976
|
+
for (const [param, curve] of Object.entries(options.tracks)) {
|
|
15977
|
+
if (curve) tracks.push({ param, curve });
|
|
15978
|
+
}
|
|
15979
|
+
return playTracks(player, options, tracks);
|
|
15980
|
+
}
|
|
15981
|
+
function playTracks(player, options, tracks) {
|
|
15982
|
+
const context = options.context ?? `modlock.camera.${++moves}`;
|
|
15983
|
+
const length3 = Math.max(0, ...tracks.map((track) => durationOf(track.curve)));
|
|
15984
|
+
const send2 = (delay) => tracks.every(
|
|
15985
|
+
({ param, curve }) => sendCurve(player, { ...options, context, param, delay }, curve)
|
|
15986
|
+
);
|
|
15987
|
+
let timer;
|
|
15988
|
+
const stop = () => {
|
|
15989
|
+
timer?.cancel();
|
|
15990
|
+
return player.clearCamera(context);
|
|
15991
|
+
};
|
|
15992
|
+
let sent = send2(options.delay);
|
|
15993
|
+
if (sent && options.loop && length3 > 0) {
|
|
15994
|
+
sent = send2(void 0);
|
|
15995
|
+
timer = every(length3, () => {
|
|
15996
|
+
if (!send2(void 0)) stop();
|
|
15997
|
+
});
|
|
15998
|
+
}
|
|
15999
|
+
if (!sent) {
|
|
16000
|
+
stop();
|
|
15477
16001
|
return void 0;
|
|
15478
16002
|
}
|
|
15479
|
-
|
|
15480
|
-
|
|
16003
|
+
return {
|
|
16004
|
+
context,
|
|
16005
|
+
duration: options.loop ? Infinity : (options.delay ?? 0) + length3,
|
|
16006
|
+
cancel: stop
|
|
16007
|
+
};
|
|
16008
|
+
}
|
|
16009
|
+
function cameraPulse(player, options) {
|
|
16010
|
+
const { param, by, ease: shape = ease.linear } = options;
|
|
16011
|
+
const rest = zero2(by);
|
|
16012
|
+
const curve = chain(
|
|
16013
|
+
line(rest, by, options.in, shape),
|
|
16014
|
+
hold(by, options.hold),
|
|
16015
|
+
reverse(line(rest, by, options.out, shape))
|
|
16016
|
+
);
|
|
16017
|
+
return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
|
|
16018
|
+
}
|
|
16019
|
+
function cameraShake(player, options) {
|
|
16020
|
+
const { amplitude, duration } = options;
|
|
16021
|
+
const curve = wave({
|
|
16022
|
+
amplitude,
|
|
16023
|
+
duration,
|
|
16024
|
+
frequency: options.frequency ?? 8,
|
|
16025
|
+
decay: true
|
|
16026
|
+
});
|
|
16027
|
+
const param = options.param ?? "horizontalOffset";
|
|
16028
|
+
return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
|
|
16029
|
+
}
|
|
16030
|
+
function sendCurve(player, options, curve) {
|
|
16031
|
+
const { context, param, relative, priority, target } = options;
|
|
16032
|
+
const rate = options.rate ?? 30;
|
|
16033
|
+
let delay = options.delay;
|
|
16034
|
+
const lerp3 = (start, end, duration, shape = {}) => {
|
|
16035
|
+
const sent = player.moveCamera({
|
|
16036
|
+
context,
|
|
16037
|
+
param,
|
|
16038
|
+
motion: { lerp: { start, end, duration, ...shape } },
|
|
16039
|
+
delay,
|
|
16040
|
+
relative,
|
|
16041
|
+
priority,
|
|
16042
|
+
target
|
|
16043
|
+
});
|
|
16044
|
+
delay = void 0;
|
|
16045
|
+
return sent;
|
|
16046
|
+
};
|
|
16047
|
+
return curve.every((span) => {
|
|
16048
|
+
if (span.duration <= 0) return true;
|
|
16049
|
+
if (span.lerp) {
|
|
16050
|
+
return lerp3(span.at(0), span.at(1), span.duration, span.lerp);
|
|
16051
|
+
}
|
|
16052
|
+
const steps = Math.max(1, Math.ceil(span.duration * rate));
|
|
16053
|
+
for (let i = 0; i < steps; i++) {
|
|
16054
|
+
const sent = lerp3(
|
|
16055
|
+
span.at(i / steps),
|
|
16056
|
+
span.at((i + 1) / steps),
|
|
16057
|
+
span.duration / steps
|
|
16058
|
+
);
|
|
16059
|
+
if (!sent) return false;
|
|
16060
|
+
}
|
|
16061
|
+
return true;
|
|
16062
|
+
});
|
|
16063
|
+
}
|
|
16064
|
+
function zero2(value) {
|
|
16065
|
+
return typeof value === "number" ? 0 : { x: 0, y: 0, z: 0 };
|
|
16066
|
+
}
|
|
16067
|
+
|
|
16068
|
+
// js/src/format.ts
|
|
16069
|
+
var format_exports = {};
|
|
16070
|
+
__export(format_exports, {
|
|
16071
|
+
clip: () => clip,
|
|
16072
|
+
clock: () => clock,
|
|
16073
|
+
count: () => count,
|
|
16074
|
+
grouped: () => grouped,
|
|
16075
|
+
ordinal: () => ordinal,
|
|
16076
|
+
percent: () => percent,
|
|
16077
|
+
stopwatch: () => stopwatch
|
|
16078
|
+
});
|
|
16079
|
+
function clock(seconds) {
|
|
16080
|
+
const whole = Math.max(0, Math.ceil(seconds));
|
|
16081
|
+
return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, "0")}`;
|
|
16082
|
+
}
|
|
16083
|
+
function stopwatch(seconds) {
|
|
16084
|
+
const hundredths = Math.max(0, Math.floor(seconds * 100));
|
|
16085
|
+
const minutes = Math.floor(hundredths / 6e3);
|
|
16086
|
+
const rest = hundredths % 6e3 / 100;
|
|
16087
|
+
return `${minutes}:${rest.toFixed(2).padStart(5, "0")}`;
|
|
16088
|
+
}
|
|
16089
|
+
function percent(part, whole) {
|
|
16090
|
+
if (!(whole > 0)) {
|
|
16091
|
+
return "-";
|
|
16092
|
+
}
|
|
16093
|
+
return `${Math.round(Math.max(0, Math.min(part / whole, 1)) * 100)}%`;
|
|
16094
|
+
}
|
|
16095
|
+
function grouped(value) {
|
|
16096
|
+
return String(Math.round(value)).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
16097
|
+
}
|
|
16098
|
+
function ordinal(place2) {
|
|
16099
|
+
const tens = place2 % 100;
|
|
16100
|
+
const suffix = tens >= 11 && tens <= 13 ? "th" : ["th", "st", "nd", "rd"][place2 % 10] ?? "th";
|
|
16101
|
+
return `${place2}${suffix}`;
|
|
16102
|
+
}
|
|
16103
|
+
function count(number, thing, plural = `${thing}s`) {
|
|
16104
|
+
return `${grouped(number)} ${number === 1 ? thing : plural}`;
|
|
16105
|
+
}
|
|
16106
|
+
function clip(text2, width) {
|
|
16107
|
+
if (text2.length <= width) return text2;
|
|
16108
|
+
const cut = text2.slice(0, width - 1);
|
|
16109
|
+
const space = cut.lastIndexOf(" ");
|
|
16110
|
+
return `${(space > 0 ? cut.slice(0, space) : cut).trimEnd()}\u2026`;
|
|
15481
16111
|
}
|
|
15482
16112
|
|
|
15483
16113
|
// js/src/items.gen.ts
|
|
@@ -15954,7 +16584,7 @@ function Banner(props) {
|
|
|
15954
16584
|
return arriving(banner, { scale: 0.92 });
|
|
15955
16585
|
}
|
|
15956
16586
|
function TopStrip(props) {
|
|
15957
|
-
const
|
|
16587
|
+
const block2 = [
|
|
15958
16588
|
props.heading && Text({
|
|
15959
16589
|
role: "label",
|
|
15960
16590
|
style: { letterSpacing: 1 },
|
|
@@ -15973,9 +16603,9 @@ function TopStrip(props) {
|
|
|
15973
16603
|
{ flow: "down", horizontalAlign: "center", margin: [top, 0, 0, 0] },
|
|
15974
16604
|
children
|
|
15975
16605
|
);
|
|
15976
|
-
if (!props.keepTeamBar) return column(14, [...
|
|
16606
|
+
if (!props.keepTeamBar) return column(14, [...block2, line2]);
|
|
15977
16607
|
return element("panel", { width: "fill", height: "fill" }, [
|
|
15978
|
-
column(teamBarBottom,
|
|
16608
|
+
column(teamBarBottom, block2),
|
|
15979
16609
|
line2 && column(objectiveBarBottom, line2)
|
|
15980
16610
|
]);
|
|
15981
16611
|
}
|
|
@@ -16452,6 +17082,185 @@ function ground(point, {
|
|
|
16452
17082
|
return hit && !hit.startSolid ? hit.position : void 0;
|
|
16453
17083
|
}
|
|
16454
17084
|
|
|
17085
|
+
// js/src/racegate.ts
|
|
17086
|
+
var cell = 8;
|
|
17087
|
+
var margin = 3;
|
|
17088
|
+
var block = "\u25A0";
|
|
17089
|
+
var gap = "\u3000";
|
|
17090
|
+
var blockScale = 4.05;
|
|
17091
|
+
var inkSpread = 0.6;
|
|
17092
|
+
var inkDepth = 0.15;
|
|
17093
|
+
var columnRise = 1.75;
|
|
17094
|
+
var rowAcross = -1.2;
|
|
17095
|
+
var rowRise = 0.5;
|
|
17096
|
+
var frameWidth = 2;
|
|
17097
|
+
var railInset = 8;
|
|
17098
|
+
var railAlpha = 96;
|
|
17099
|
+
var tron = 1056243711;
|
|
17100
|
+
var tronFaded = 342915839;
|
|
17101
|
+
var anchorParticle = "particles/generic/null.vpcf";
|
|
17102
|
+
var beamMaterial = "materials/physics/wireframe_basic.vmat";
|
|
17103
|
+
var raceGateResources = [anchorParticle, beamMaterial];
|
|
17104
|
+
var nextPoint = 0;
|
|
17105
|
+
var RaceGate = class _RaceGate {
|
|
17106
|
+
constructor(objects, entities) {
|
|
17107
|
+
this.objects = objects;
|
|
17108
|
+
this.entities = entities;
|
|
17109
|
+
}
|
|
17110
|
+
objects;
|
|
17111
|
+
entities;
|
|
17112
|
+
/**
|
|
17113
|
+
* stand stands a gate across yaw at foot. A part the world refuses is left
|
|
17114
|
+
* out, so the gate stands whatever the world made.
|
|
17115
|
+
*/
|
|
17116
|
+
static stand(options) {
|
|
17117
|
+
const radians = options.yaw * Math.PI / 180;
|
|
17118
|
+
const halfWidth = Math.round((options.width ?? 112) / cell / 2) * cell;
|
|
17119
|
+
const height = Math.round((options.height ?? 144) / cell) * cell;
|
|
17120
|
+
const color2 = options.color ?? tron;
|
|
17121
|
+
const plane = {
|
|
17122
|
+
foot: options.foot,
|
|
17123
|
+
yaw: radians,
|
|
17124
|
+
across: { x: -Math.sin(radians), y: Math.cos(radians) }
|
|
17125
|
+
};
|
|
17126
|
+
const made = { objects: [], entities: [] };
|
|
17127
|
+
const rail = (color2 & ~255 | railAlpha) >>> 0;
|
|
17128
|
+
outline(plane, halfWidth, height, 0, color2, frameWidth, made);
|
|
17129
|
+
outline(plane, halfWidth, height, railInset, rail, frameWidth / 2, made);
|
|
17130
|
+
band(plane, halfWidth, height, color2, options.faded ?? tronFaded, made);
|
|
17131
|
+
if (options.viewer !== void 0) {
|
|
17132
|
+
const viewers = [options.viewer];
|
|
17133
|
+
made.objects.forEach((object) => object.showOnlyTo(viewers));
|
|
17134
|
+
made.entities.forEach((entity) => showEntityOnlyTo(entity, viewers));
|
|
17135
|
+
}
|
|
17136
|
+
return new _RaceGate(made.objects, made.entities);
|
|
17137
|
+
}
|
|
17138
|
+
/** remove takes every part of the gate out of the world. */
|
|
17139
|
+
remove() {
|
|
17140
|
+
this.entities.forEach((entity) => removeEntity(entity));
|
|
17141
|
+
this.objects.forEach((object) => object.remove());
|
|
17142
|
+
this.objects.length = 0;
|
|
17143
|
+
this.entities.length = 0;
|
|
17144
|
+
}
|
|
17145
|
+
};
|
|
17146
|
+
function at2(plane, side, up, deep = 0) {
|
|
17147
|
+
return {
|
|
17148
|
+
x: plane.foot.x + side * plane.across.x + Math.cos(plane.yaw) * deep,
|
|
17149
|
+
y: plane.foot.y + side * plane.across.y + Math.sin(plane.yaw) * deep,
|
|
17150
|
+
z: plane.foot.z + up
|
|
17151
|
+
};
|
|
17152
|
+
}
|
|
17153
|
+
function band(plane, halfWidth, height, lit, faded, made) {
|
|
17154
|
+
const width = halfWidth + margin * cell;
|
|
17155
|
+
const columns = width * 2 / cell;
|
|
17156
|
+
const openingRows = height / cell;
|
|
17157
|
+
const rows = openingRows + margin;
|
|
17158
|
+
for (let column = 0; column < columns; column++) {
|
|
17159
|
+
if (column >= margin && column < columns - margin) continue;
|
|
17160
|
+
const first = rows - 2 - (column + rows - 2) % 2;
|
|
17161
|
+
const count2 = Math.floor(first / 2) + 1;
|
|
17162
|
+
const outer = column === 0 || column === columns - 1;
|
|
17163
|
+
strip(plane, {
|
|
17164
|
+
text: Array(count2).fill(block).join(gap),
|
|
17165
|
+
side: -width + (column + 0.5) * cell,
|
|
17166
|
+
up: (first + 1) * cell + columnRise,
|
|
17167
|
+
pitch: 90,
|
|
17168
|
+
color: outer ? faded : lit,
|
|
17169
|
+
made
|
|
17170
|
+
});
|
|
17171
|
+
}
|
|
17172
|
+
for (let row2 = openingRows; row2 < rows; row2++) {
|
|
17173
|
+
const outer = row2 === rows - 1;
|
|
17174
|
+
const start = outer ? 0 : margin;
|
|
17175
|
+
const end = outer ? columns : columns - margin;
|
|
17176
|
+
const first = start + (start + row2) % 2;
|
|
17177
|
+
const count2 = Math.ceil((end - first) / 2);
|
|
17178
|
+
strip(plane, {
|
|
17179
|
+
text: Array(count2).fill(block).join(gap),
|
|
17180
|
+
side: -width + (first + count2 - 0.5) * cell + rowAcross,
|
|
17181
|
+
up: (row2 + 0.5) * cell + rowRise,
|
|
17182
|
+
pitch: 0,
|
|
17183
|
+
color: outer ? faded : lit,
|
|
17184
|
+
made
|
|
17185
|
+
});
|
|
17186
|
+
}
|
|
17187
|
+
}
|
|
17188
|
+
function strip(plane, { text: text2, side, up, pitch, color: color2, made }) {
|
|
17189
|
+
const yaw = plane.yaw * 180 / Math.PI - 90;
|
|
17190
|
+
for (const dx of [-1, 1]) {
|
|
17191
|
+
for (const dy of [-1, 1]) {
|
|
17192
|
+
const shown = createText({
|
|
17193
|
+
text: text2,
|
|
17194
|
+
position: at2(
|
|
17195
|
+
plane,
|
|
17196
|
+
side + dx * inkSpread,
|
|
17197
|
+
up + dy * inkSpread,
|
|
17198
|
+
inkDepth * (dx + 2 * dy + 3) / 2
|
|
17199
|
+
),
|
|
17200
|
+
facing: { pitch, yaw, roll: 90 },
|
|
17201
|
+
fontSize: 100,
|
|
17202
|
+
scale: blockScale,
|
|
17203
|
+
color: color2,
|
|
17204
|
+
align: pitch === 90 ? "left" : "center",
|
|
17205
|
+
verticalAlign: "center"
|
|
17206
|
+
});
|
|
17207
|
+
if (shown) made.objects.push(shown);
|
|
17208
|
+
}
|
|
17209
|
+
}
|
|
17210
|
+
}
|
|
17211
|
+
function outline(plane, halfWidth, height, inset, color2, width, made) {
|
|
17212
|
+
const corners = [
|
|
17213
|
+
at2(plane, -(halfWidth - inset), inset),
|
|
17214
|
+
at2(plane, halfWidth - inset, inset),
|
|
17215
|
+
at2(plane, halfWidth - inset, height - inset),
|
|
17216
|
+
at2(plane, -(halfWidth - inset), height - inset)
|
|
17217
|
+
];
|
|
17218
|
+
const names = corners.map((corner) => anchor(corner, made));
|
|
17219
|
+
if (names.some((name) => name === void 0)) return;
|
|
17220
|
+
corners.forEach((corner, index) => {
|
|
17221
|
+
const beam = createEntity({
|
|
17222
|
+
designerName: "env_beam",
|
|
17223
|
+
subclass: "",
|
|
17224
|
+
team: 0,
|
|
17225
|
+
position: corner,
|
|
17226
|
+
keyValues: [
|
|
17227
|
+
{ key: "LightningStart", value: { text: names[index] } },
|
|
17228
|
+
{ key: "LightningEnd", value: { text: names[(index + 1) % 4] } },
|
|
17229
|
+
{ key: "texture", value: { text: beamMaterial } },
|
|
17230
|
+
{ key: "BoltWidth", value: { number: width } },
|
|
17231
|
+
{ key: "NoiseAmplitude", value: { number: 0 } },
|
|
17232
|
+
{ key: "TextureScroll", value: { integer: 0 } },
|
|
17233
|
+
{ key: "life", value: { number: 0 } },
|
|
17234
|
+
{ key: "rendercolor", value: { color: color2 } },
|
|
17235
|
+
{ key: "renderamt", value: { integer: 255 } },
|
|
17236
|
+
{ key: "spawnflags", value: { integer: 1 } }
|
|
17237
|
+
]
|
|
17238
|
+
});
|
|
17239
|
+
if (beam) made.entities.push(beam);
|
|
17240
|
+
});
|
|
17241
|
+
}
|
|
17242
|
+
function anchor(position, made) {
|
|
17243
|
+
const carrier = createParticle({ resource: anchorParticle, position });
|
|
17244
|
+
const host2 = carrier?.entity();
|
|
17245
|
+
if (!carrier || !host2) {
|
|
17246
|
+
carrier?.remove();
|
|
17247
|
+
return void 0;
|
|
17248
|
+
}
|
|
17249
|
+
made.objects.push(carrier);
|
|
17250
|
+
const name = `racegate_${host2}_${nextPoint++}`;
|
|
17251
|
+
const point = createEntity({
|
|
17252
|
+
designerName: "info_particle_system",
|
|
17253
|
+
subclass: "",
|
|
17254
|
+
team: 0,
|
|
17255
|
+
position,
|
|
17256
|
+
keyValues: [{ key: "targetname", value: { text: name } }]
|
|
17257
|
+
});
|
|
17258
|
+
if (!point) return void 0;
|
|
17259
|
+
made.entities.push(point);
|
|
17260
|
+
fireInput(point, "SetParent", { text: "!activator" }, host2);
|
|
17261
|
+
return name;
|
|
17262
|
+
}
|
|
17263
|
+
|
|
16455
17264
|
// js/src/rotation.ts
|
|
16456
17265
|
var startingRating = 1e3;
|
|
16457
17266
|
var ratingStep = 32;
|
|
@@ -18158,6 +18967,7 @@ export {
|
|
|
18158
18967
|
Player,
|
|
18159
18968
|
ProbeRun,
|
|
18160
18969
|
Puppet,
|
|
18970
|
+
RaceGate,
|
|
18161
18971
|
Roster,
|
|
18162
18972
|
Score2 as Score,
|
|
18163
18973
|
Standings,
|
|
@@ -18166,7 +18976,10 @@ export {
|
|
|
18166
18976
|
Text,
|
|
18167
18977
|
TopStrip,
|
|
18168
18978
|
WorldObject,
|
|
18979
|
+
abilityBarPresses,
|
|
18980
|
+
abilityDisplay,
|
|
18169
18981
|
addBot,
|
|
18982
|
+
adjustSound,
|
|
18170
18983
|
after,
|
|
18171
18984
|
afterMatch,
|
|
18172
18985
|
blockInput,
|
|
@@ -18251,6 +19064,7 @@ export {
|
|
|
18251
19064
|
poseAt,
|
|
18252
19065
|
precache,
|
|
18253
19066
|
pushEntity,
|
|
19067
|
+
raceGateResources,
|
|
18254
19068
|
ratingChange,
|
|
18255
19069
|
ratingStep,
|
|
18256
19070
|
readBoard,
|
|
@@ -18284,9 +19098,11 @@ export {
|
|
|
18284
19098
|
show,
|
|
18285
19099
|
showEntityOnlyTo,
|
|
18286
19100
|
showEntityToAll,
|
|
19101
|
+
silenceVoice,
|
|
18287
19102
|
spawnNpc,
|
|
18288
19103
|
startRift,
|
|
18289
19104
|
startingRating,
|
|
19105
|
+
stopSound,
|
|
18290
19106
|
strayGraceSeconds,
|
|
18291
19107
|
theme_exports as theme,
|
|
18292
19108
|
ticksPerSecond,
|
|
@@ -18294,6 +19110,7 @@ export {
|
|
|
18294
19110
|
trace,
|
|
18295
19111
|
trackTicks,
|
|
18296
19112
|
triggers,
|
|
19113
|
+
uiSound,
|
|
18297
19114
|
vector_exports as vector,
|
|
18298
19115
|
watchInput,
|
|
18299
19116
|
watchProjectiles,
|