@modlock/modlock 0.1.94 → 0.1.95
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/chat.d.ts +29 -6
- package/hud.d.ts +62 -14
- package/index.d.ts +2 -2
- package/index.js +931 -645
- package/package.json +6 -6
- package/theme.d.ts +5 -0
package/index.js
CHANGED
|
@@ -16609,56 +16609,12 @@ function endServiceCall(event) {
|
|
|
16609
16609
|
done(event.payload);
|
|
16610
16610
|
}
|
|
16611
16611
|
|
|
16612
|
-
// js/src/format.ts
|
|
16613
|
-
var format_exports = {};
|
|
16614
|
-
__export(format_exports, {
|
|
16615
|
-
clip: () => clip,
|
|
16616
|
-
clock: () => clock,
|
|
16617
|
-
count: () => count,
|
|
16618
|
-
grouped: () => grouped,
|
|
16619
|
-
ordinal: () => ordinal,
|
|
16620
|
-
percent: () => percent,
|
|
16621
|
-
stopwatch: () => stopwatch
|
|
16622
|
-
});
|
|
16623
|
-
function clock(seconds) {
|
|
16624
|
-
const whole = Math.max(0, Math.ceil(seconds));
|
|
16625
|
-
return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, "0")}`;
|
|
16626
|
-
}
|
|
16627
|
-
function stopwatch(seconds) {
|
|
16628
|
-
const hundredths = Math.max(0, Math.floor(seconds * 100));
|
|
16629
|
-
const minutes = Math.floor(hundredths / 6e3);
|
|
16630
|
-
const rest = hundredths % 6e3 / 100;
|
|
16631
|
-
return `${minutes}:${rest.toFixed(2).padStart(5, "0")}`;
|
|
16632
|
-
}
|
|
16633
|
-
function percent(part, whole) {
|
|
16634
|
-
if (!(whole > 0)) {
|
|
16635
|
-
return "-";
|
|
16636
|
-
}
|
|
16637
|
-
return `${Math.round(Math.max(0, Math.min(part / whole, 1)) * 100)}%`;
|
|
16638
|
-
}
|
|
16639
|
-
function grouped(value) {
|
|
16640
|
-
return String(Math.round(value)).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
16641
|
-
}
|
|
16642
|
-
function ordinal(place2) {
|
|
16643
|
-
const tens = place2 % 100;
|
|
16644
|
-
const suffix = tens >= 11 && tens <= 13 ? "th" : ["th", "st", "nd", "rd"][place2 % 10] ?? "th";
|
|
16645
|
-
return `${place2}${suffix}`;
|
|
16646
|
-
}
|
|
16647
|
-
function count(number, thing, plural = `${thing}s`) {
|
|
16648
|
-
return `${grouped(number)} ${number === 1 ? thing : plural}`;
|
|
16649
|
-
}
|
|
16650
|
-
function clip(text2, width) {
|
|
16651
|
-
if (text2.length <= width) return text2;
|
|
16652
|
-
const cut = text2.slice(0, width - 1);
|
|
16653
|
-
const space = cut.lastIndexOf(" ");
|
|
16654
|
-
return `${(space > 0 ? cut.slice(0, space) : cut).trimEnd()}\u2026`;
|
|
16655
|
-
}
|
|
16656
|
-
|
|
16657
16612
|
// js/src/theme.ts
|
|
16658
16613
|
var theme_exports = {};
|
|
16659
16614
|
__export(theme_exports, {
|
|
16660
16615
|
emptyPip: () => emptyPip,
|
|
16661
16616
|
fpsReadoutBottom: () => fpsReadoutBottom,
|
|
16617
|
+
minimapTop: () => minimapTop,
|
|
16662
16618
|
motion: () => motion,
|
|
16663
16619
|
objectiveBarBottom: () => objectiveBarBottom,
|
|
16664
16620
|
pillEdge: () => pillEdge,
|
|
@@ -16755,488 +16711,213 @@ var emptyPip = "#00000000";
|
|
|
16755
16711
|
var teamBarBottom = 84;
|
|
16756
16712
|
var objectiveBarBottom = 220;
|
|
16757
16713
|
var fpsReadoutBottom = 68;
|
|
16714
|
+
var minimapTop = 625;
|
|
16758
16715
|
var sounds = {
|
|
16759
16716
|
hover: "UI.MainMenu.Hover",
|
|
16760
16717
|
press: "UI.MainMenu.Activate"
|
|
16761
16718
|
};
|
|
16762
16719
|
var motion = { hover: 0.15, meter: 0.25 };
|
|
16763
16720
|
|
|
16764
|
-
// js/src/
|
|
16765
|
-
|
|
16766
|
-
|
|
16721
|
+
// js/src/chat.ts
|
|
16722
|
+
var lines = /* @__PURE__ */ new Map();
|
|
16723
|
+
var shown;
|
|
16724
|
+
function showChatLines(options = {}) {
|
|
16725
|
+
shown = options;
|
|
16767
16726
|
}
|
|
16768
|
-
function
|
|
16727
|
+
function chatShown() {
|
|
16728
|
+
return shown !== void 0;
|
|
16729
|
+
}
|
|
16730
|
+
function hearChat(line2, now4) {
|
|
16731
|
+
if (!shown) return false;
|
|
16732
|
+
const text2 = line2.text.trim();
|
|
16733
|
+
if (text2 === "" || text2.startsWith("/")) return false;
|
|
16734
|
+
const team = line2.all ? 0 : line2.player.pawn()?.team ?? 0;
|
|
16735
|
+
lines.delete(line2.player.slot);
|
|
16736
|
+
lines.set(line2.player.slot, {
|
|
16737
|
+
speaker: line2.player,
|
|
16738
|
+
text: text2,
|
|
16739
|
+
team,
|
|
16740
|
+
until: now4 + (shown.seconds ?? 6)
|
|
16741
|
+
});
|
|
16742
|
+
return true;
|
|
16743
|
+
}
|
|
16744
|
+
function expireChat(now4) {
|
|
16745
|
+
let expired = false;
|
|
16746
|
+
for (const [slot, line2] of lines) {
|
|
16747
|
+
if (now4 >= line2.until) {
|
|
16748
|
+
lines.delete(slot);
|
|
16749
|
+
expired = true;
|
|
16750
|
+
}
|
|
16751
|
+
}
|
|
16752
|
+
return expired;
|
|
16753
|
+
}
|
|
16754
|
+
function forgetChat(slot) {
|
|
16755
|
+
return lines.delete(slot);
|
|
16756
|
+
}
|
|
16757
|
+
function chatLines(viewer) {
|
|
16758
|
+
if (lines.size === 0 || !shown) return void 0;
|
|
16759
|
+
const team = viewer.pawn()?.team ?? 0;
|
|
16760
|
+
const readable = [];
|
|
16761
|
+
for (const line2 of lines.values()) {
|
|
16762
|
+
if (line2.team === 0 || line2.team === team) readable.push(line2);
|
|
16763
|
+
}
|
|
16764
|
+
if (readable.length === 0) return void 0;
|
|
16765
|
+
const kept = readable.slice(-(shown.lines ?? 4));
|
|
16769
16766
|
return {
|
|
16770
|
-
|
|
16767
|
+
type: "panel",
|
|
16771
16768
|
props: {
|
|
16772
|
-
...component.props,
|
|
16773
16769
|
style: {
|
|
16774
|
-
|
|
16775
|
-
|
|
16770
|
+
flow: "down",
|
|
16771
|
+
horizontalAlign: "center",
|
|
16772
|
+
verticalAlign: "bottom",
|
|
16773
|
+
margin: [0, 0, shown.bottom ?? abilityBarTop, 0]
|
|
16776
16774
|
},
|
|
16777
|
-
|
|
16778
|
-
|
|
16775
|
+
children: kept.map(
|
|
16776
|
+
(line2, at3) => subtitle(line2, viewer, kept.length - 1 - at3)
|
|
16777
|
+
)
|
|
16779
16778
|
}
|
|
16780
16779
|
};
|
|
16781
16780
|
}
|
|
16782
|
-
|
|
16783
|
-
|
|
16784
|
-
|
|
16785
|
-
|
|
16786
|
-
|
|
16787
|
-
|
|
16788
|
-
|
|
16789
|
-
|
|
16790
|
-
|
|
16791
|
-
|
|
16792
|
-
|
|
16793
|
-
|
|
16794
|
-
|
|
16795
|
-
|
|
16796
|
-
|
|
16797
|
-
|
|
16798
|
-
|
|
16781
|
+
var abilityBarTop = 190;
|
|
16782
|
+
var bandWidth = 640;
|
|
16783
|
+
var nameWidth = 180;
|
|
16784
|
+
var lineWidth = bandWidth - (4 + 10) - 24 - 7 - nameWidth - 9;
|
|
16785
|
+
var fades = [1, 0.85, 0.7];
|
|
16786
|
+
var lifted = {
|
|
16787
|
+
amber: "#f0a73a",
|
|
16788
|
+
sapphire: "#8fb1f0"
|
|
16789
|
+
};
|
|
16790
|
+
var words = {
|
|
16791
|
+
face: "body",
|
|
16792
|
+
weight: "bold",
|
|
16793
|
+
verticalAlign: "top",
|
|
16794
|
+
lineHeight: 23,
|
|
16795
|
+
textAlign: "left"
|
|
16796
|
+
};
|
|
16797
|
+
var portraits = new Map(heroes.map((hero) => [hero.id, hero.portrait]));
|
|
16798
|
+
function subtitle(line2, viewer, age) {
|
|
16799
|
+
const pawn = line2.speaker.pawn();
|
|
16800
|
+
const seen = shown?.speaker?.(line2.speaker, viewer) ?? {};
|
|
16801
|
+
const tone = teamTones[pawn?.team ?? 0];
|
|
16802
|
+
const color2 = seen.out ? shades.quiet : seen.color ?? (tone ? lifted[tone] : void 0) ?? tones.text;
|
|
16803
|
+
const notes = [line2.team !== 0 ? "team" : "", seen.note ?? ""].filter((note) => note !== "").map((note) => ` (${note})`).join("");
|
|
16804
|
+
const name = `${connection(line2.speaker)?.name ?? ""}${notes}`;
|
|
16805
|
+
const src = portraits.get(seen.hero ?? pawn?.hero ?? 0);
|
|
16806
|
+
const portrait = {
|
|
16807
|
+
type: "panel",
|
|
16808
|
+
props: {
|
|
16809
|
+
style: {
|
|
16810
|
+
width: 24,
|
|
16811
|
+
height: 24,
|
|
16812
|
+
verticalAlign: "top",
|
|
16813
|
+
borderRadius: 2,
|
|
16814
|
+
background: shades.raised,
|
|
16815
|
+
saturation: seen.out ? 0 : 1
|
|
16816
|
+
},
|
|
16817
|
+
children: src !== void 0 && {
|
|
16818
|
+
type: "image",
|
|
16819
|
+
props: { src, style: { width: "100%", height: "100%" } }
|
|
16820
|
+
}
|
|
16821
|
+
}
|
|
16822
|
+
};
|
|
16823
|
+
const speaker = {
|
|
16824
|
+
type: "label",
|
|
16825
|
+
props: {
|
|
16826
|
+
style: {
|
|
16827
|
+
...words,
|
|
16828
|
+
fontSize: 16,
|
|
16829
|
+
color: color2,
|
|
16830
|
+
margin: [1, 0, 0, 7],
|
|
16831
|
+
maxWidth: nameWidth
|
|
16832
|
+
},
|
|
16833
|
+
children: name
|
|
16834
|
+
}
|
|
16835
|
+
};
|
|
16836
|
+
const said = {
|
|
16837
|
+
type: "label",
|
|
16838
|
+
props: {
|
|
16839
|
+
style: {
|
|
16840
|
+
...words,
|
|
16841
|
+
fontSize: 18,
|
|
16842
|
+
color: tones.text,
|
|
16843
|
+
margin: [0, 0, 0, 9],
|
|
16844
|
+
maxWidth: lineWidth
|
|
16845
|
+
},
|
|
16846
|
+
children: line2.text
|
|
16847
|
+
}
|
|
16848
|
+
};
|
|
16849
|
+
return {
|
|
16850
|
+
type: "panel",
|
|
16851
|
+
key: `line-${line2.speaker.slot}`,
|
|
16852
|
+
props: {
|
|
16853
|
+
style: {
|
|
16854
|
+
flow: "right",
|
|
16855
|
+
horizontalAlign: "center",
|
|
16856
|
+
background: "#10130d9e",
|
|
16857
|
+
borderRadius: 3,
|
|
16858
|
+
padding: [3, 10, 4, 4],
|
|
16859
|
+
margin: [0, 0, 4, 0],
|
|
16860
|
+
opacity: fades[age] ?? fades[fades.length - 1],
|
|
16861
|
+
transition: { seconds: 0.25, easing: "out" }
|
|
16862
|
+
},
|
|
16863
|
+
enter: { opacity: 0, translate: [0, 8] },
|
|
16864
|
+
exit: { opacity: 0 },
|
|
16865
|
+
children: [portrait, speaker, said]
|
|
16866
|
+
}
|
|
16867
|
+
};
|
|
16799
16868
|
}
|
|
16800
|
-
|
|
16801
|
-
|
|
16802
|
-
|
|
16803
|
-
|
|
16804
|
-
|
|
16805
|
-
|
|
16806
|
-
|
|
16807
|
-
|
|
16808
|
-
|
|
16809
|
-
|
|
16810
|
-
|
|
16811
|
-
|
|
16812
|
-
|
|
16869
|
+
|
|
16870
|
+
// js/src/bystander.ts
|
|
16871
|
+
var bystanderStates = [
|
|
16872
|
+
"MODIFIER_STATE_IMMOBILIZED",
|
|
16873
|
+
"MODIFIER_STATE_DISARMED",
|
|
16874
|
+
"MODIFIER_STATE_MELEE_DISABLED",
|
|
16875
|
+
"MODIFIER_STATE_SILENCED",
|
|
16876
|
+
"MODIFIER_STATE_INVULNERABLE",
|
|
16877
|
+
"MODIFIER_STATE_TECH_UNTARGETABLE_BY_ENEMIES",
|
|
16878
|
+
"MODIFIER_STATE_TECH_UNTARGETABLE_BY_TEAMMATES",
|
|
16879
|
+
"MODIFIER_STATE_DISPLACEMENT_IMMUNE",
|
|
16880
|
+
"MODIFIER_STATE_IGNORE_BULLETS",
|
|
16881
|
+
"MODIFIER_STATE_IGNORE_MELEE",
|
|
16882
|
+
"MODIFIER_STATE_IN_ABILITY_DISABLE_ZOOM"
|
|
16883
|
+
];
|
|
16884
|
+
function holdBystander(entity, active = true) {
|
|
16885
|
+
let held = true;
|
|
16886
|
+
for (const state of bystanderStates) {
|
|
16887
|
+
held = holdModifierState(entity, state, active) && held;
|
|
16888
|
+
}
|
|
16889
|
+
return held;
|
|
16813
16890
|
}
|
|
16814
|
-
|
|
16815
|
-
|
|
16816
|
-
|
|
16817
|
-
|
|
16818
|
-
|
|
16819
|
-
|
|
16820
|
-
|
|
16821
|
-
|
|
16822
|
-
|
|
16823
|
-
|
|
16824
|
-
|
|
16825
|
-
|
|
16826
|
-
|
|
16827
|
-
|
|
16828
|
-
|
|
16891
|
+
var parkedStates = [
|
|
16892
|
+
"MODIFIER_STATE_DO_NOT_DRAW_MODEL",
|
|
16893
|
+
"MODIFIER_STATE_UNIT_STATUS_HIDDEN",
|
|
16894
|
+
"MODIFIER_STATE_INVISIBLE_ON_MINIMAP",
|
|
16895
|
+
"MODIFIER_STATE_IGNORE_OUT_OF_PLAY_AREA_CHECK"
|
|
16896
|
+
];
|
|
16897
|
+
var parkHeight = 4e3;
|
|
16898
|
+
function spectateFrom(player, position, facing, park) {
|
|
16899
|
+
const pawn = player.pawn();
|
|
16900
|
+
if (pawn === void 0 || pawn.hero === 0) return void 0;
|
|
16901
|
+
const stood = pawn.position;
|
|
16902
|
+
const faced = pawn.eyeAngles;
|
|
16903
|
+
hideParked(pawn.entity, true);
|
|
16904
|
+
player.teleport(park ?? { ...stood, z: stood.z + parkHeight }, faced, {
|
|
16905
|
+
x: 0,
|
|
16906
|
+
y: 0,
|
|
16907
|
+
z: 0
|
|
16908
|
+
});
|
|
16909
|
+
player.freeze(true);
|
|
16910
|
+
player.freeCamera(position, facing);
|
|
16911
|
+
return (restore = true) => {
|
|
16912
|
+
player.unwatch();
|
|
16913
|
+
player.freeze(false);
|
|
16914
|
+
if (restore) player.teleport(stood, faced, { x: 0, y: 0, z: 0 });
|
|
16915
|
+
hideParked(pawn.entity, false);
|
|
16916
|
+
};
|
|
16829
16917
|
}
|
|
16830
|
-
function
|
|
16831
|
-
|
|
16832
|
-
const
|
|
16833
|
-
return element(
|
|
16834
|
-
"panel",
|
|
16835
|
-
{ flow: "right", verticalAlign: "center", ...props.style },
|
|
16836
|
-
Array.from(
|
|
16837
|
-
{ length: props.total },
|
|
16838
|
-
(_, index) => element(
|
|
16839
|
-
"panel",
|
|
16840
|
-
{
|
|
16841
|
-
width: shape.width,
|
|
16842
|
-
height: shape.height,
|
|
16843
|
-
borderRadius: shape.radius,
|
|
16844
|
-
margin: [0, 2],
|
|
16845
|
-
background: lit(index) ? tones[props.tone] : emptyPip,
|
|
16846
|
-
borderWidth: 2,
|
|
16847
|
-
borderColor: lit(index) ? pipRings.filled : pipRings.empty
|
|
16848
|
-
},
|
|
16849
|
-
void 0,
|
|
16850
|
-
`pip-${index}`
|
|
16851
|
-
)
|
|
16852
|
-
)
|
|
16853
|
-
);
|
|
16854
|
-
}
|
|
16855
|
-
function Tag(props) {
|
|
16856
|
-
const filled = props.fill === "filled";
|
|
16857
|
-
return element(
|
|
16858
|
-
"label",
|
|
16859
|
-
{
|
|
16860
|
-
face: "block",
|
|
16861
|
-
fontSize: 12,
|
|
16862
|
-
letterSpacing: 1,
|
|
16863
|
-
uppercase: true,
|
|
16864
|
-
color: filled ? tones.onAccent : tones[props.tone],
|
|
16865
|
-
background: filled ? tones[props.tone] : void 0,
|
|
16866
|
-
borderWidth: 1,
|
|
16867
|
-
borderColor: tones[props.tone],
|
|
16868
|
-
borderRadius: sizes.radius,
|
|
16869
|
-
padding: [4, 8],
|
|
16870
|
-
verticalAlign: "center",
|
|
16871
|
-
...props.style
|
|
16872
|
-
},
|
|
16873
|
-
props.children
|
|
16874
|
-
);
|
|
16875
|
-
}
|
|
16876
|
-
function Banner(props) {
|
|
16877
|
-
const banner = element(
|
|
16878
|
-
"panel",
|
|
16879
|
-
{
|
|
16880
|
-
flow: "down",
|
|
16881
|
-
horizontalAlign: "center",
|
|
16882
|
-
margin: [20, 0, 0, 0],
|
|
16883
|
-
...props.style
|
|
16884
|
-
},
|
|
16885
|
-
[
|
|
16886
|
-
Text({ role: "title", tone: props.tone, children: props.title }),
|
|
16887
|
-
props.detail && Text({ role: "caption", tone: "muted", children: props.detail })
|
|
16888
|
-
]
|
|
16889
|
-
);
|
|
16890
|
-
return arriving(banner, { scale: 0.92 });
|
|
16891
|
-
}
|
|
16892
|
-
function TopStrip(props) {
|
|
16893
|
-
const block2 = [
|
|
16894
|
-
props.heading && Text({
|
|
16895
|
-
role: "label",
|
|
16896
|
-
style: { letterSpacing: 1 },
|
|
16897
|
-
children: props.heading
|
|
16898
|
-
}),
|
|
16899
|
-
Pill({ style: { margin: [4, 0, 0, 0] }, children: props.children })
|
|
16900
|
-
];
|
|
16901
|
-
const line2 = props.line && Text({
|
|
16902
|
-
role: "label",
|
|
16903
|
-
tone: props.lineTone ?? "text",
|
|
16904
|
-
style: { margin: [4, 0, 0, 0], fontSize: 18, letterSpacing: 1 },
|
|
16905
|
-
children: props.line
|
|
16906
|
-
});
|
|
16907
|
-
const column = (top, children) => element(
|
|
16908
|
-
"panel",
|
|
16909
|
-
{ flow: "down", horizontalAlign: "center", margin: [top, 0, 0, 0] },
|
|
16910
|
-
children
|
|
16911
|
-
);
|
|
16912
|
-
if (!props.keepTeamBar) return column(14, [...block2, line2]);
|
|
16913
|
-
return element("panel", { width: "fill", height: "fill" }, [
|
|
16914
|
-
column(teamBarBottom, block2),
|
|
16915
|
-
line2 && column(objectiveBarBottom, line2)
|
|
16916
|
-
]);
|
|
16917
|
-
}
|
|
16918
|
-
function Score2(props) {
|
|
16919
|
-
const [near, far] = props.tones ?? ["accent", "text"];
|
|
16920
|
-
const side = (points, tone) => Text({
|
|
16921
|
-
role: "title",
|
|
16922
|
-
tone,
|
|
16923
|
-
plated: true,
|
|
16924
|
-
style: { margin: [0, 10], horizontalAlign: void 0 },
|
|
16925
|
-
children: `${points}`
|
|
16926
|
-
});
|
|
16927
|
-
return element("panel", { flow: "right", verticalAlign: "center" }, [
|
|
16928
|
-
side(props.points[0], near),
|
|
16929
|
-
Text({
|
|
16930
|
-
role: "title",
|
|
16931
|
-
tone: "muted",
|
|
16932
|
-
plated: true,
|
|
16933
|
-
style: { horizontalAlign: void 0 },
|
|
16934
|
-
children: ":"
|
|
16935
|
-
}),
|
|
16936
|
-
side(props.points[1], far)
|
|
16937
|
-
]);
|
|
16938
|
-
}
|
|
16939
|
-
var rosterRows = 6;
|
|
16940
|
-
var rosterName = 24;
|
|
16941
|
-
var portraitSize = 44;
|
|
16942
|
-
var badgeSize = 18;
|
|
16943
|
-
var portraits = new Map(heroes.map((hero) => [hero.id, hero.portrait]));
|
|
16944
|
-
function rosterKey(rows) {
|
|
16945
|
-
return rows.slice(0, rosterRows).map(
|
|
16946
|
-
(row2) => `${row2.self ? "*" : ""}${row2.selected ? "+" : ""}${row2.onPress ? ">" : ""}${row2.name} ${row2.hero} ${row2.activity} ${row2.steamId ?? ""}`
|
|
16947
|
-
).join("\n");
|
|
16948
|
-
}
|
|
16949
|
-
function Roster(props) {
|
|
16950
|
-
if (props.rows.length === 0) return null;
|
|
16951
|
-
return element(
|
|
16952
|
-
"panel",
|
|
16953
|
-
{
|
|
16954
|
-
width: "fit",
|
|
16955
|
-
height: "fit",
|
|
16956
|
-
flow: "down",
|
|
16957
|
-
horizontalAlign: "right",
|
|
16958
|
-
verticalAlign: "top",
|
|
16959
|
-
margin: [props.top ?? fpsReadoutBottom, 24, 0, 0]
|
|
16960
|
-
},
|
|
16961
|
-
props.rows.slice(0, rosterRows).map(rosterRow)
|
|
16962
|
-
);
|
|
16963
|
-
}
|
|
16964
|
-
function rosterRow(row2, index) {
|
|
16965
|
-
const right = { horizontalAlign: "right", textAlign: "right" };
|
|
16966
|
-
const text2 = element(
|
|
16967
|
-
"panel",
|
|
16968
|
-
{ flow: "down", verticalAlign: "center", margin: [0, 12, 0, 0] },
|
|
16969
|
-
[
|
|
16970
|
-
Text({
|
|
16971
|
-
role: "label",
|
|
16972
|
-
tone: "text",
|
|
16973
|
-
style: right,
|
|
16974
|
-
children: clip(row2.name.toUpperCase(), rosterName)
|
|
16975
|
-
}),
|
|
16976
|
-
Text({
|
|
16977
|
-
role: "caption",
|
|
16978
|
-
tone: "muted",
|
|
16979
|
-
style: { ...right, margin: [1, 0, 0, 0] },
|
|
16980
|
-
children: row2.activity
|
|
16981
|
-
})
|
|
16982
|
-
]
|
|
16983
|
-
);
|
|
16984
|
-
const src = portraits.get(row2.hero);
|
|
16985
|
-
const badge = row2.steamId === void 0 ? false : avatarBadge(row2.steamId);
|
|
16986
|
-
const image = src === void 0 ? false : portraitImage(src);
|
|
16987
|
-
const portrait = element(
|
|
16988
|
-
"panel",
|
|
16989
|
-
{
|
|
16990
|
-
width: portraitSize,
|
|
16991
|
-
height: portraitSize,
|
|
16992
|
-
padding: 1,
|
|
16993
|
-
verticalAlign: "center",
|
|
16994
|
-
background: row2.self || row2.selected ? tones.accent : shades.dim
|
|
16995
|
-
},
|
|
16996
|
-
element(
|
|
16997
|
-
"panel",
|
|
16998
|
-
{ width: "100%", height: "100%", background: shades.raised },
|
|
16999
|
-
[image, badge]
|
|
17000
|
-
)
|
|
17001
|
-
);
|
|
17002
|
-
const style = {
|
|
17003
|
-
flow: "right",
|
|
17004
|
-
horizontalAlign: "right",
|
|
17005
|
-
margin: [0, 0, 8, 0]
|
|
17006
|
-
};
|
|
17007
|
-
const line2 = row2.onPress ? {
|
|
17008
|
-
type: "button",
|
|
17009
|
-
props: {
|
|
17010
|
-
style: {
|
|
17011
|
-
...style,
|
|
17012
|
-
borderRadius: sizes.radius,
|
|
17013
|
-
transition: motion.hover
|
|
17014
|
-
},
|
|
17015
|
-
hover: { background: shades.raised },
|
|
17016
|
-
hoverSound: sounds.hover,
|
|
17017
|
-
sound: sounds.press,
|
|
17018
|
-
onPress: row2.onPress,
|
|
17019
|
-
children: [text2, portrait]
|
|
17020
|
-
},
|
|
17021
|
-
key: `row-${index}`
|
|
17022
|
-
} : element("panel", style, [text2, portrait], `row-${index}`);
|
|
17023
|
-
return arriving(line2, { translate: [16, 0] });
|
|
17024
|
-
}
|
|
17025
|
-
function portraitImage(src) {
|
|
17026
|
-
return {
|
|
17027
|
-
type: "image",
|
|
17028
|
-
props: { src, style: { width: "100%", height: "100%" } }
|
|
17029
|
-
};
|
|
17030
|
-
}
|
|
17031
|
-
function avatarBadge(steamId) {
|
|
17032
|
-
return {
|
|
17033
|
-
type: "avatar",
|
|
17034
|
-
props: {
|
|
17035
|
-
steamId,
|
|
17036
|
-
style: {
|
|
17037
|
-
width: badgeSize,
|
|
17038
|
-
height: badgeSize,
|
|
17039
|
-
horizontalAlign: "left",
|
|
17040
|
-
verticalAlign: "bottom",
|
|
17041
|
-
borderRadius: badgeSize / 2,
|
|
17042
|
-
borderWidth: 1,
|
|
17043
|
-
borderColor: shades.dim
|
|
17044
|
-
}
|
|
17045
|
-
}
|
|
17046
|
-
};
|
|
17047
|
-
}
|
|
17048
|
-
var actionLooks = {
|
|
17049
|
-
primary: {
|
|
17050
|
-
idle: { background: tones.text },
|
|
17051
|
-
hover: { background: shades.white },
|
|
17052
|
-
text: shades.ink
|
|
17053
|
-
},
|
|
17054
|
-
secondary: {
|
|
17055
|
-
idle: {
|
|
17056
|
-
background: shades.raised,
|
|
17057
|
-
borderWidth: 1,
|
|
17058
|
-
borderColor: shades.faint
|
|
17059
|
-
},
|
|
17060
|
-
hover: { background: shades.lit, borderColor: tones.text },
|
|
17061
|
-
text: tones.text
|
|
17062
|
-
},
|
|
17063
|
-
quiet: {
|
|
17064
|
-
idle: { background: shades.clear },
|
|
17065
|
-
hover: { background: shades.raised },
|
|
17066
|
-
text: shades.quiet
|
|
17067
|
-
}
|
|
17068
|
-
};
|
|
17069
|
-
function Action(props) {
|
|
17070
|
-
const look = actionLooks[props.kind ?? "secondary"];
|
|
17071
|
-
const label = element(
|
|
17072
|
-
"label",
|
|
17073
|
-
{
|
|
17074
|
-
face: "block",
|
|
17075
|
-
fontSize: 16,
|
|
17076
|
-
uppercase: true,
|
|
17077
|
-
letterSpacing: 1,
|
|
17078
|
-
color: look.text,
|
|
17079
|
-
horizontalAlign: "center",
|
|
17080
|
-
verticalAlign: "center",
|
|
17081
|
-
noWrap: true
|
|
17082
|
-
},
|
|
17083
|
-
props.children
|
|
17084
|
-
);
|
|
17085
|
-
return {
|
|
17086
|
-
type: "button",
|
|
17087
|
-
props: {
|
|
17088
|
-
style: {
|
|
17089
|
-
height: sizes.control,
|
|
17090
|
-
padding: [0, 14],
|
|
17091
|
-
borderRadius: sizes.radius,
|
|
17092
|
-
transition: motion.hover,
|
|
17093
|
-
...look.idle,
|
|
17094
|
-
...props.disabled ? { opacity: 0.4 } : {},
|
|
17095
|
-
...props.style
|
|
17096
|
-
},
|
|
17097
|
-
hover: props.disabled ? void 0 : look.hover,
|
|
17098
|
-
hoverSound: props.disabled ? void 0 : sounds.hover,
|
|
17099
|
-
sound: sounds.press,
|
|
17100
|
-
disabled: props.disabled,
|
|
17101
|
-
onPress: props.onPress,
|
|
17102
|
-
children: label
|
|
17103
|
-
}
|
|
17104
|
-
};
|
|
17105
|
-
}
|
|
17106
|
-
function Meter(props) {
|
|
17107
|
-
const height = props.height ?? 8;
|
|
17108
|
-
const value = Math.min(1, Math.max(0, props.value));
|
|
17109
|
-
return element(
|
|
17110
|
-
"panel",
|
|
17111
|
-
{
|
|
17112
|
-
width: props.width ?? 160,
|
|
17113
|
-
height,
|
|
17114
|
-
background: shades.raised,
|
|
17115
|
-
borderRadius: height / 2,
|
|
17116
|
-
overflow: "clip",
|
|
17117
|
-
...props.style
|
|
17118
|
-
},
|
|
17119
|
-
// The fill scales rather than resizes, so it eases without layout work.
|
|
17120
|
-
element("panel", {
|
|
17121
|
-
width: "100%",
|
|
17122
|
-
height: "100%",
|
|
17123
|
-
background: tones[props.tone ?? "accent"],
|
|
17124
|
-
scale: [value, 1],
|
|
17125
|
-
origin: [0, 50],
|
|
17126
|
-
transition: motion.meter
|
|
17127
|
-
})
|
|
17128
|
-
);
|
|
17129
|
-
}
|
|
17130
|
-
|
|
17131
|
-
// js/src/chat.ts
|
|
17132
|
-
var lineWidth = 40;
|
|
17133
|
-
var lines = /* @__PURE__ */ new Map();
|
|
17134
|
-
var shown;
|
|
17135
|
-
function showChatLines(options = {}) {
|
|
17136
|
-
shown = options;
|
|
17137
|
-
}
|
|
17138
|
-
function chatShown() {
|
|
17139
|
-
return shown !== void 0;
|
|
17140
|
-
}
|
|
17141
|
-
function hearChat(line2, now4) {
|
|
17142
|
-
if (!shown) return false;
|
|
17143
|
-
const text2 = line2.text.trim();
|
|
17144
|
-
if (text2 === "" || text2.startsWith("/")) return false;
|
|
17145
|
-
const team = line2.all ? 0 : line2.player.pawn()?.team ?? 0;
|
|
17146
|
-
lines.set(line2.player.slot, {
|
|
17147
|
-
speaker: line2.player,
|
|
17148
|
-
text: `\u201C${clip(text2, lineWidth)}\u201D`,
|
|
17149
|
-
team,
|
|
17150
|
-
until: now4 + (shown.seconds ?? 6)
|
|
17151
|
-
});
|
|
17152
|
-
return true;
|
|
17153
|
-
}
|
|
17154
|
-
function expireChat(now4) {
|
|
17155
|
-
let expired = false;
|
|
17156
|
-
for (const [slot, line2] of lines) {
|
|
17157
|
-
if (now4 >= line2.until) {
|
|
17158
|
-
lines.delete(slot);
|
|
17159
|
-
expired = true;
|
|
17160
|
-
}
|
|
17161
|
-
}
|
|
17162
|
-
return expired;
|
|
17163
|
-
}
|
|
17164
|
-
function forgetChat(slot) {
|
|
17165
|
-
return lines.delete(slot);
|
|
17166
|
-
}
|
|
17167
|
-
function chatLines(viewer) {
|
|
17168
|
-
if (lines.size === 0) return void 0;
|
|
17169
|
-
const team = viewer.pawn()?.team ?? 0;
|
|
17170
|
-
const readable = [];
|
|
17171
|
-
for (const line2 of lines.values()) {
|
|
17172
|
-
if (line2.team === 0 || line2.team === team) readable.push(line2);
|
|
17173
|
-
}
|
|
17174
|
-
readable.sort((a, b) => b.until - a.until);
|
|
17175
|
-
return Roster({
|
|
17176
|
-
top: shown?.top,
|
|
17177
|
-
rows: readable.map((line2) => {
|
|
17178
|
-
const speaker = connection(line2.speaker);
|
|
17179
|
-
return {
|
|
17180
|
-
name: speaker?.name ?? "",
|
|
17181
|
-
hero: line2.speaker.pawn()?.hero ?? 0,
|
|
17182
|
-
activity: line2.text,
|
|
17183
|
-
steamId: speaker && !speaker.bot ? speaker.steamId : void 0
|
|
17184
|
-
};
|
|
17185
|
-
})
|
|
17186
|
-
});
|
|
17187
|
-
}
|
|
17188
|
-
|
|
17189
|
-
// js/src/bystander.ts
|
|
17190
|
-
var bystanderStates = [
|
|
17191
|
-
"MODIFIER_STATE_IMMOBILIZED",
|
|
17192
|
-
"MODIFIER_STATE_DISARMED",
|
|
17193
|
-
"MODIFIER_STATE_MELEE_DISABLED",
|
|
17194
|
-
"MODIFIER_STATE_SILENCED",
|
|
17195
|
-
"MODIFIER_STATE_INVULNERABLE",
|
|
17196
|
-
"MODIFIER_STATE_TECH_UNTARGETABLE_BY_ENEMIES",
|
|
17197
|
-
"MODIFIER_STATE_TECH_UNTARGETABLE_BY_TEAMMATES",
|
|
17198
|
-
"MODIFIER_STATE_DISPLACEMENT_IMMUNE",
|
|
17199
|
-
"MODIFIER_STATE_IGNORE_BULLETS",
|
|
17200
|
-
"MODIFIER_STATE_IGNORE_MELEE",
|
|
17201
|
-
"MODIFIER_STATE_IN_ABILITY_DISABLE_ZOOM"
|
|
17202
|
-
];
|
|
17203
|
-
function holdBystander(entity, active = true) {
|
|
17204
|
-
let held = true;
|
|
17205
|
-
for (const state of bystanderStates) {
|
|
17206
|
-
held = holdModifierState(entity, state, active) && held;
|
|
17207
|
-
}
|
|
17208
|
-
return held;
|
|
17209
|
-
}
|
|
17210
|
-
var parkedStates = [
|
|
17211
|
-
"MODIFIER_STATE_DO_NOT_DRAW_MODEL",
|
|
17212
|
-
"MODIFIER_STATE_UNIT_STATUS_HIDDEN",
|
|
17213
|
-
"MODIFIER_STATE_INVISIBLE_ON_MINIMAP",
|
|
17214
|
-
"MODIFIER_STATE_IGNORE_OUT_OF_PLAY_AREA_CHECK"
|
|
17215
|
-
];
|
|
17216
|
-
var parkHeight = 4e3;
|
|
17217
|
-
function spectateFrom(player, position, facing, park) {
|
|
17218
|
-
const pawn = player.pawn();
|
|
17219
|
-
if (pawn === void 0 || pawn.hero === 0) return void 0;
|
|
17220
|
-
const stood = pawn.position;
|
|
17221
|
-
const faced = pawn.eyeAngles;
|
|
17222
|
-
hideParked(pawn.entity, true);
|
|
17223
|
-
player.teleport(park ?? { ...stood, z: stood.z + parkHeight }, faced, {
|
|
17224
|
-
x: 0,
|
|
17225
|
-
y: 0,
|
|
17226
|
-
z: 0
|
|
17227
|
-
});
|
|
17228
|
-
player.freeze(true);
|
|
17229
|
-
player.freeCamera(position, facing);
|
|
17230
|
-
return (restore = true) => {
|
|
17231
|
-
player.unwatch();
|
|
17232
|
-
player.freeze(false);
|
|
17233
|
-
if (restore) player.teleport(stood, faced, { x: 0, y: 0, z: 0 });
|
|
17234
|
-
hideParked(pawn.entity, false);
|
|
17235
|
-
};
|
|
17236
|
-
}
|
|
17237
|
-
function hideParked(entity, active) {
|
|
17238
|
-
holdBystander(entity, active);
|
|
17239
|
-
for (const state of parkedStates) holdModifierState(entity, state, active);
|
|
16918
|
+
function hideParked(entity, active) {
|
|
16919
|
+
holdBystander(entity, active);
|
|
16920
|
+
for (const state of parkedStates) holdModifierState(entity, state, active);
|
|
17240
16921
|
}
|
|
17241
16922
|
|
|
17242
16923
|
// js/src/strays.ts
|
|
@@ -17434,15 +17115,15 @@ function Fragment(props) {
|
|
|
17434
17115
|
}
|
|
17435
17116
|
function show(player, root) {
|
|
17436
17117
|
views.set(player.slot, { ...view(player), root });
|
|
17437
|
-
return draw(player);
|
|
17118
|
+
return draw(player, ["view"]);
|
|
17438
17119
|
}
|
|
17439
17120
|
function hideHud(player, parts) {
|
|
17440
17121
|
views.set(player.slot, { ...view(player), hud: parts });
|
|
17441
|
-
return draw(player);
|
|
17122
|
+
return draw(player, []);
|
|
17442
17123
|
}
|
|
17443
17124
|
function hideHudForAll(parts) {
|
|
17444
17125
|
everyoneHud = parts;
|
|
17445
|
-
drawAll();
|
|
17126
|
+
drawAll([]);
|
|
17446
17127
|
}
|
|
17447
17128
|
function freeCursor(player, free) {
|
|
17448
17129
|
const current = view(player);
|
|
@@ -17451,18 +17132,18 @@ function freeCursor(player, free) {
|
|
|
17451
17132
|
cursor: free,
|
|
17452
17133
|
asks: free ? current.asks + 1 : current.asks
|
|
17453
17134
|
});
|
|
17454
|
-
return draw(player);
|
|
17135
|
+
return draw(player, []);
|
|
17455
17136
|
}
|
|
17456
17137
|
function abilityBarPresses(player, onPress) {
|
|
17457
17138
|
views.set(player.slot, {
|
|
17458
17139
|
...view(player),
|
|
17459
17140
|
bar: onPress ? { handler: onPress } : void 0
|
|
17460
17141
|
});
|
|
17461
|
-
return draw(player);
|
|
17142
|
+
return draw(player, []);
|
|
17462
17143
|
}
|
|
17463
17144
|
function abilityDisplay(viewer, rows = []) {
|
|
17464
17145
|
views.set(viewer.slot, { ...view(viewer), display: rows.slice(0, 64) });
|
|
17465
|
-
return draw(viewer);
|
|
17146
|
+
return draw(viewer, []);
|
|
17466
17147
|
}
|
|
17467
17148
|
function displayRows(viewer, rows) {
|
|
17468
17149
|
if (rows.length === 0) return [];
|
|
@@ -17503,7 +17184,7 @@ function sheet(path) {
|
|
|
17503
17184
|
}
|
|
17504
17185
|
sheets.push(path);
|
|
17505
17186
|
for (const current of views.values()) {
|
|
17506
|
-
draw(current.player);
|
|
17187
|
+
draw(current.player, []);
|
|
17507
17188
|
}
|
|
17508
17189
|
return true;
|
|
17509
17190
|
}
|
|
@@ -17521,7 +17202,7 @@ function route(player, name, value) {
|
|
|
17521
17202
|
routes.set(name, encoded);
|
|
17522
17203
|
}
|
|
17523
17204
|
views.set(player.slot, { ...view(player), routes });
|
|
17524
|
-
return draw(player);
|
|
17205
|
+
return draw(player, ["routes"]);
|
|
17525
17206
|
}
|
|
17526
17207
|
var routeName = /^[\w.-]+$/;
|
|
17527
17208
|
function hide(player) {
|
|
@@ -17536,10 +17217,10 @@ function joined(player) {
|
|
|
17536
17217
|
function left(player) {
|
|
17537
17218
|
views.delete(player.slot);
|
|
17538
17219
|
screens.delete(player.slot);
|
|
17539
|
-
if (forgetChat(player.slot)) drawAll();
|
|
17220
|
+
if (forgetChat(player.slot)) drawAll(["chat"]);
|
|
17540
17221
|
}
|
|
17541
17222
|
function heard(line2) {
|
|
17542
|
-
if (hearChat(line2, now2)) drawAll();
|
|
17223
|
+
if (hearChat(line2, now2)) drawAll(["chat"]);
|
|
17543
17224
|
}
|
|
17544
17225
|
function toast(player, text2, seconds = 4) {
|
|
17545
17226
|
const current = view(player);
|
|
@@ -17548,7 +17229,7 @@ function toast(player, text2, seconds = 4) {
|
|
|
17548
17229
|
...current,
|
|
17549
17230
|
notices: [...current.notices, notice].slice(-maxNotices)
|
|
17550
17231
|
});
|
|
17551
|
-
return draw(player);
|
|
17232
|
+
return draw(player, ["notices"]);
|
|
17552
17233
|
}
|
|
17553
17234
|
function uiSound(player, sound, options = {}) {
|
|
17554
17235
|
const current = view(player);
|
|
@@ -17562,11 +17243,11 @@ function uiSound(player, sound, options = {}) {
|
|
|
17562
17243
|
...current,
|
|
17563
17244
|
cues: [...current.cues, cue].slice(-maxCues)
|
|
17564
17245
|
});
|
|
17565
|
-
return draw(player);
|
|
17246
|
+
return draw(player, []);
|
|
17566
17247
|
}
|
|
17567
17248
|
function press(player, node, action = "", payload = "") {
|
|
17568
17249
|
if (action !== "") {
|
|
17569
|
-
const pressed2 =
|
|
17250
|
+
const pressed2 = partOf(player.slot, node)?.actions.get(node);
|
|
17570
17251
|
if (pressed2) {
|
|
17571
17252
|
let value = void 0;
|
|
17572
17253
|
try {
|
|
@@ -17583,30 +17264,30 @@ function press(player, node, action = "", payload = "") {
|
|
|
17583
17264
|
views.get(player.slot)?.bar?.handler(player, Number(bar[1]));
|
|
17584
17265
|
return;
|
|
17585
17266
|
}
|
|
17586
|
-
const pressed =
|
|
17267
|
+
const pressed = partOf(player.slot, node)?.presses.get(node);
|
|
17587
17268
|
if (pressed) {
|
|
17588
17269
|
pressed.handler(player);
|
|
17589
17270
|
}
|
|
17590
17271
|
}
|
|
17591
17272
|
function change(player, node, value) {
|
|
17592
17273
|
if (typeof value === "object" && value !== null) {
|
|
17593
|
-
|
|
17274
|
+
partOf(player.slot, node)?.wheels.get(node)?.handler(player, value);
|
|
17594
17275
|
return;
|
|
17595
17276
|
}
|
|
17596
|
-
const changed =
|
|
17277
|
+
const changed = partOf(player.slot, node)?.changes.get(node);
|
|
17597
17278
|
if (changed) {
|
|
17598
17279
|
changed.handler(player, value);
|
|
17599
17280
|
}
|
|
17600
17281
|
}
|
|
17601
17282
|
function tick(seconds) {
|
|
17602
17283
|
now2 = seconds;
|
|
17603
|
-
if (expireChat(now2)) drawAll();
|
|
17284
|
+
if (expireChat(now2)) drawAll(["chat"]);
|
|
17604
17285
|
for (const current of views.values()) {
|
|
17605
17286
|
if (!current.notices.some((notice) => notice.until <= now2)) {
|
|
17606
17287
|
continue;
|
|
17607
17288
|
}
|
|
17608
17289
|
current.notices = current.notices.filter((notice) => notice.until > now2);
|
|
17609
|
-
draw(current.player);
|
|
17290
|
+
draw(current.player, ["notices"]);
|
|
17610
17291
|
}
|
|
17611
17292
|
}
|
|
17612
17293
|
var views = /* @__PURE__ */ new Map();
|
|
@@ -17635,40 +17316,13 @@ function view(player) {
|
|
|
17635
17316
|
notices: []
|
|
17636
17317
|
};
|
|
17637
17318
|
}
|
|
17638
|
-
|
|
17639
|
-
|
|
17640
|
-
const root = [
|
|
17641
|
-
current.root,
|
|
17642
|
-
chatLines(player),
|
|
17643
|
-
current.notices.length !== 0 && notices(current.notices)
|
|
17644
|
-
];
|
|
17319
|
+
var layers = ["view", "chat", "notices", "routes"];
|
|
17320
|
+
function draw(player, changed = layers) {
|
|
17645
17321
|
const previous = screens.get(player.slot);
|
|
17646
|
-
const
|
|
17647
|
-
const display = displayRows(player, current.display);
|
|
17648
|
-
const next = render(
|
|
17649
|
-
previous,
|
|
17650
|
-
root,
|
|
17651
|
-
hud,
|
|
17652
|
-
current.cursor,
|
|
17653
|
-
current.asks,
|
|
17654
|
-
current.routes,
|
|
17655
|
-
current.cues,
|
|
17656
|
-
current.bar !== void 0,
|
|
17657
|
-
display
|
|
17658
|
-
);
|
|
17322
|
+
const next = compose(player, previous, previous ? changed : layers);
|
|
17659
17323
|
const change2 = diff(previous, next);
|
|
17660
17324
|
if (change2 && !send(player.slot, change2)) {
|
|
17661
|
-
const whole =
|
|
17662
|
-
void 0,
|
|
17663
|
-
root,
|
|
17664
|
-
hud,
|
|
17665
|
-
current.cursor,
|
|
17666
|
-
current.asks,
|
|
17667
|
-
current.routes,
|
|
17668
|
-
current.cues,
|
|
17669
|
-
current.bar !== void 0,
|
|
17670
|
-
display
|
|
17671
|
-
);
|
|
17325
|
+
const whole = compose(player, void 0, layers);
|
|
17672
17326
|
if (!send(player.slot, diff(void 0, whole))) {
|
|
17673
17327
|
screens.delete(player.slot);
|
|
17674
17328
|
return false;
|
|
@@ -17679,9 +17333,58 @@ function draw(player) {
|
|
|
17679
17333
|
screens.set(player.slot, next);
|
|
17680
17334
|
return true;
|
|
17681
17335
|
}
|
|
17682
|
-
function drawAll() {
|
|
17336
|
+
function drawAll(changed = layers) {
|
|
17683
17337
|
for (const { player } of players()) {
|
|
17684
|
-
draw(player);
|
|
17338
|
+
draw(player, changed);
|
|
17339
|
+
}
|
|
17340
|
+
}
|
|
17341
|
+
function compose(player, previous, changed) {
|
|
17342
|
+
const current = view(player);
|
|
17343
|
+
const screen = {
|
|
17344
|
+
parts: new Map(previous?.parts),
|
|
17345
|
+
root: { node: {}, encoded: "" },
|
|
17346
|
+
next: previous?.next ?? 0
|
|
17347
|
+
};
|
|
17348
|
+
for (const layer of changed) {
|
|
17349
|
+
const layout = new Layout(previous?.parts.get(layer), screen);
|
|
17350
|
+
if (layer === "routes") {
|
|
17351
|
+
for (const [name, data] of current.routes) {
|
|
17352
|
+
layout.add({ id: `route:${name}`, kind: 5 /* ROUTE */, route: name, data });
|
|
17353
|
+
}
|
|
17354
|
+
} else {
|
|
17355
|
+
layout.part.top = place(layout, content(layer, current), "/");
|
|
17356
|
+
}
|
|
17357
|
+
screen.parts.set(layer, layout.part);
|
|
17358
|
+
}
|
|
17359
|
+
const children = [];
|
|
17360
|
+
for (const layer of layers) {
|
|
17361
|
+
children.push(...screen.parts.get(layer)?.top ?? []);
|
|
17362
|
+
}
|
|
17363
|
+
const root = {
|
|
17364
|
+
id: "",
|
|
17365
|
+
kind: 0 /* PANEL */,
|
|
17366
|
+
children,
|
|
17367
|
+
hideHud: hiddenParts(current.hud),
|
|
17368
|
+
freeCursor: current.cursor,
|
|
17369
|
+
freeCursorAsks: current.asks,
|
|
17370
|
+
sheets: [...sheets],
|
|
17371
|
+
cues: [...current.cues],
|
|
17372
|
+
abilityBarPresses: current.bar !== void 0,
|
|
17373
|
+
abilityDisplay: displayRows(player, current.display)
|
|
17374
|
+
};
|
|
17375
|
+
screen.root = { node: root, encoded: JSON.stringify(root) };
|
|
17376
|
+
return screen;
|
|
17377
|
+
}
|
|
17378
|
+
function content(layer, current) {
|
|
17379
|
+
switch (layer) {
|
|
17380
|
+
case "view":
|
|
17381
|
+
return current.root;
|
|
17382
|
+
case "chat":
|
|
17383
|
+
return chatLines(current.player);
|
|
17384
|
+
case "notices":
|
|
17385
|
+
return current.notices.length !== 0 && notices(current.notices);
|
|
17386
|
+
default:
|
|
17387
|
+
return void 0;
|
|
17685
17388
|
}
|
|
17686
17389
|
}
|
|
17687
17390
|
function hiddenParts(own) {
|
|
@@ -17727,46 +17430,35 @@ function notices(stack) {
|
|
|
17727
17430
|
return jsx("panel", { style, exit: noticeMotion.exit, children: labels });
|
|
17728
17431
|
}
|
|
17729
17432
|
var screens = /* @__PURE__ */ new Map();
|
|
17730
|
-
function
|
|
17731
|
-
const
|
|
17732
|
-
|
|
17733
|
-
id: "",
|
|
17734
|
-
kind: 0 /* PANEL */,
|
|
17735
|
-
children: place(layout, root, "/"),
|
|
17736
|
-
hideHud: [...hud],
|
|
17737
|
-
freeCursor: cursor,
|
|
17738
|
-
freeCursorAsks: asks,
|
|
17739
|
-
sheets: [...sheets],
|
|
17740
|
-
cues: [...cues],
|
|
17741
|
-
abilityBarPresses: bar,
|
|
17742
|
-
abilityDisplay: [...display]
|
|
17743
|
-
});
|
|
17744
|
-
for (const [name, data] of routes) {
|
|
17745
|
-
layout.add({ id: `route:${name}`, kind: 5 /* ROUTE */, route: name, data });
|
|
17433
|
+
function partOf(slot, id) {
|
|
17434
|
+
for (const part of screens.get(slot)?.parts.values() ?? []) {
|
|
17435
|
+
if (part.nodes.has(id)) return part;
|
|
17746
17436
|
}
|
|
17747
|
-
return
|
|
17437
|
+
return void 0;
|
|
17748
17438
|
}
|
|
17749
17439
|
var Layout = class {
|
|
17750
|
-
|
|
17440
|
+
part;
|
|
17751
17441
|
previous;
|
|
17752
|
-
|
|
17753
|
-
|
|
17442
|
+
screen;
|
|
17443
|
+
/** The layout keeps previous's ids and numbers new nodes from screen's counter. */
|
|
17444
|
+
constructor(previous, screen) {
|
|
17754
17445
|
this.previous = previous;
|
|
17755
|
-
this.screen =
|
|
17446
|
+
this.screen = screen;
|
|
17447
|
+
this.part = {
|
|
17756
17448
|
nodes: /* @__PURE__ */ new Map(),
|
|
17757
17449
|
ids: /* @__PURE__ */ new Map(),
|
|
17758
17450
|
presses: /* @__PURE__ */ new Map(),
|
|
17759
17451
|
changes: /* @__PURE__ */ new Map(),
|
|
17760
17452
|
actions: /* @__PURE__ */ new Map(),
|
|
17761
17453
|
wheels: /* @__PURE__ */ new Map(),
|
|
17762
|
-
|
|
17454
|
+
top: []
|
|
17763
17455
|
};
|
|
17764
17456
|
}
|
|
17765
17457
|
/** add records a node. */
|
|
17766
17458
|
add(node) {
|
|
17767
17459
|
const value = node.steamId === void 0 ? node : { ...node, steamId: String(node.steamId) };
|
|
17768
17460
|
const encoded = JSON.stringify(value);
|
|
17769
|
-
this.
|
|
17461
|
+
this.part.nodes.set(node.id, { node, encoded });
|
|
17770
17462
|
}
|
|
17771
17463
|
/** id returns the node id for the element at place. */
|
|
17772
17464
|
id(place2) {
|
|
@@ -17774,7 +17466,7 @@ var Layout = class {
|
|
|
17774
17466
|
if (found === void 0) {
|
|
17775
17467
|
found = (this.screen.next++).toString(36);
|
|
17776
17468
|
}
|
|
17777
|
-
this.
|
|
17469
|
+
this.part.ids.set(place2, found);
|
|
17778
17470
|
return found;
|
|
17779
17471
|
}
|
|
17780
17472
|
};
|
|
@@ -17825,7 +17517,7 @@ function place(layout, child, at3) {
|
|
|
17825
17517
|
node.text = text(props.children);
|
|
17826
17518
|
node.token = props.token;
|
|
17827
17519
|
node.variables = variables(props.variables);
|
|
17828
|
-
node.clock =
|
|
17520
|
+
node.clock = clock(props.clock);
|
|
17829
17521
|
break;
|
|
17830
17522
|
case "avatar":
|
|
17831
17523
|
node.kind = 8 /* AVATAR */;
|
|
@@ -17853,7 +17545,7 @@ function place(layout, child, at3) {
|
|
|
17853
17545
|
node.sound = props.sound;
|
|
17854
17546
|
node.disabled = props.disabled;
|
|
17855
17547
|
if (props.onPress && !props.disabled) {
|
|
17856
|
-
layout.
|
|
17548
|
+
layout.part.presses.set(node.id, { handler: props.onPress });
|
|
17857
17549
|
}
|
|
17858
17550
|
node.children = place(layout, props.children, `${at3}/`);
|
|
17859
17551
|
break;
|
|
@@ -17862,7 +17554,7 @@ function place(layout, child, at3) {
|
|
|
17862
17554
|
node.layout = props.src ?? "";
|
|
17863
17555
|
node.data = props.data === void 0 ? "" : JSON.stringify(props.data) ?? "";
|
|
17864
17556
|
if (props.onAction) {
|
|
17865
|
-
layout.
|
|
17557
|
+
layout.part.actions.set(node.id, { handler: props.onAction });
|
|
17866
17558
|
}
|
|
17867
17559
|
break;
|
|
17868
17560
|
default:
|
|
@@ -17880,7 +17572,7 @@ function input(layout, node, kind, props) {
|
|
|
17880
17572
|
node.kind = 7 /* INPUT */;
|
|
17881
17573
|
node.disabled = props.disabled;
|
|
17882
17574
|
if (props.onChange && !props.disabled) {
|
|
17883
|
-
layout.
|
|
17575
|
+
layout.part.changes.set(node.id, { handler: props.onChange });
|
|
17884
17576
|
}
|
|
17885
17577
|
switch (kind) {
|
|
17886
17578
|
case "entry":
|
|
@@ -17895,7 +17587,7 @@ function input(layout, node, kind, props) {
|
|
|
17895
17587
|
break;
|
|
17896
17588
|
case "slider":
|
|
17897
17589
|
if (props.onWheel && !props.disabled) {
|
|
17898
|
-
layout.
|
|
17590
|
+
layout.part.wheels.set(node.id, { handler: props.onWheel });
|
|
17899
17591
|
}
|
|
17900
17592
|
node.input = {
|
|
17901
17593
|
case: "slider",
|
|
@@ -17922,7 +17614,7 @@ function input(layout, node, kind, props) {
|
|
|
17922
17614
|
};
|
|
17923
17615
|
}
|
|
17924
17616
|
}
|
|
17925
|
-
function
|
|
17617
|
+
function clock(value) {
|
|
17926
17618
|
if (!value) {
|
|
17927
17619
|
return void 0;
|
|
17928
17620
|
}
|
|
@@ -17939,7 +17631,7 @@ var clockFormats = {
|
|
|
17939
17631
|
seconds: 1 /* SECONDS */,
|
|
17940
17632
|
tenths: 2 /* TENTHS */
|
|
17941
17633
|
};
|
|
17942
|
-
function
|
|
17634
|
+
function clip(value) {
|
|
17943
17635
|
if (!value) {
|
|
17944
17636
|
return void 0;
|
|
17945
17637
|
}
|
|
@@ -17980,12 +17672,20 @@ function cycle(value) {
|
|
|
17980
17672
|
};
|
|
17981
17673
|
}
|
|
17982
17674
|
function diff(previous, next) {
|
|
17983
|
-
const set = [
|
|
17984
|
-
|
|
17985
|
-
|
|
17986
|
-
const
|
|
17987
|
-
|
|
17988
|
-
|
|
17675
|
+
const set = [];
|
|
17676
|
+
const removed = [];
|
|
17677
|
+
if (previous?.root.encoded !== next.root.encoded) set.push(next.root.node);
|
|
17678
|
+
for (const layer of layers) {
|
|
17679
|
+
const before2 = previous?.parts.get(layer);
|
|
17680
|
+
const after2 = next.parts.get(layer);
|
|
17681
|
+
if (before2 === after2) continue;
|
|
17682
|
+
for (const { node, encoded } of after2?.nodes.values() ?? []) {
|
|
17683
|
+
if (before2?.nodes.get(node.id)?.encoded !== encoded) set.push(node);
|
|
17684
|
+
}
|
|
17685
|
+
for (const id of before2?.nodes.keys() ?? []) {
|
|
17686
|
+
if (!after2?.nodes.has(id)) removed.push(id);
|
|
17687
|
+
}
|
|
17688
|
+
}
|
|
17989
17689
|
if (previous && set.length === 0 && removed.length === 0) {
|
|
17990
17690
|
return void 0;
|
|
17991
17691
|
}
|
|
@@ -18156,7 +17856,7 @@ function wireStyle(style) {
|
|
|
18156
17856
|
decoration: style.decoration === void 0 ? void 0 : decorations[style.decoration],
|
|
18157
17857
|
transform: transform(style),
|
|
18158
17858
|
turn: style.turn,
|
|
18159
|
-
clip:
|
|
17859
|
+
clip: clip(style.clip),
|
|
18160
17860
|
transition: transition(style.transition)
|
|
18161
17861
|
};
|
|
18162
17862
|
}
|
|
@@ -18686,8 +18386,53 @@ function sendCurve(player, options, curve) {
|
|
|
18686
18386
|
return true;
|
|
18687
18387
|
});
|
|
18688
18388
|
}
|
|
18689
|
-
function zero2(value) {
|
|
18690
|
-
return typeof value === "number" ? 0 : { x: 0, y: 0, z: 0 };
|
|
18389
|
+
function zero2(value) {
|
|
18390
|
+
return typeof value === "number" ? 0 : { x: 0, y: 0, z: 0 };
|
|
18391
|
+
}
|
|
18392
|
+
|
|
18393
|
+
// js/src/format.ts
|
|
18394
|
+
var format_exports = {};
|
|
18395
|
+
__export(format_exports, {
|
|
18396
|
+
clip: () => clip2,
|
|
18397
|
+
clock: () => clock2,
|
|
18398
|
+
count: () => count,
|
|
18399
|
+
grouped: () => grouped,
|
|
18400
|
+
ordinal: () => ordinal,
|
|
18401
|
+
percent: () => percent,
|
|
18402
|
+
stopwatch: () => stopwatch
|
|
18403
|
+
});
|
|
18404
|
+
function clock2(seconds) {
|
|
18405
|
+
const whole = Math.max(0, Math.ceil(seconds));
|
|
18406
|
+
return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, "0")}`;
|
|
18407
|
+
}
|
|
18408
|
+
function stopwatch(seconds) {
|
|
18409
|
+
const hundredths = Math.max(0, Math.floor(seconds * 100));
|
|
18410
|
+
const minutes = Math.floor(hundredths / 6e3);
|
|
18411
|
+
const rest = hundredths % 6e3 / 100;
|
|
18412
|
+
return `${minutes}:${rest.toFixed(2).padStart(5, "0")}`;
|
|
18413
|
+
}
|
|
18414
|
+
function percent(part, whole) {
|
|
18415
|
+
if (!(whole > 0)) {
|
|
18416
|
+
return "-";
|
|
18417
|
+
}
|
|
18418
|
+
return `${Math.round(Math.max(0, Math.min(part / whole, 1)) * 100)}%`;
|
|
18419
|
+
}
|
|
18420
|
+
function grouped(value) {
|
|
18421
|
+
return String(Math.round(value)).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
18422
|
+
}
|
|
18423
|
+
function ordinal(place2) {
|
|
18424
|
+
const tens = place2 % 100;
|
|
18425
|
+
const suffix = tens >= 11 && tens <= 13 ? "th" : ["th", "st", "nd", "rd"][place2 % 10] ?? "th";
|
|
18426
|
+
return `${place2}${suffix}`;
|
|
18427
|
+
}
|
|
18428
|
+
function count(number, thing, plural = `${thing}s`) {
|
|
18429
|
+
return `${grouped(number)} ${number === 1 ? thing : plural}`;
|
|
18430
|
+
}
|
|
18431
|
+
function clip2(text2, width) {
|
|
18432
|
+
if (text2.length <= width) return text2;
|
|
18433
|
+
const cut = text2.slice(0, width - 1);
|
|
18434
|
+
const space = cut.lastIndexOf(" ");
|
|
18435
|
+
return `${(space > 0 ? cut.slice(0, space) : cut).trimEnd()}\u2026`;
|
|
18691
18436
|
}
|
|
18692
18437
|
|
|
18693
18438
|
// js/src/items.gen.ts
|
|
@@ -18881,53 +18626,594 @@ var Hook = class {
|
|
|
18881
18626
|
reset() {
|
|
18882
18627
|
this.thrownAt = 0;
|
|
18883
18628
|
}
|
|
18884
|
-
/**
|
|
18885
|
-
* update reads the thrower's hook at game time now, keeps it fully upgraded
|
|
18886
|
-
* and sets the length of any cooldown a throw started. It reports nothing
|
|
18887
|
-
* for a hero without the hook. A caller that already read this frame's
|
|
18888
|
-
* abilities passes them to avoid another read.
|
|
18889
|
-
*/
|
|
18890
|
-
update(player, now4, abilities = player.abilities()) {
|
|
18891
|
-
const ability = abilities.find((a) => a.name === hookAbility);
|
|
18892
|
-
if (!ability) {
|
|
18893
|
-
return void 0;
|
|
18894
|
-
}
|
|
18895
|
-
const victim = this.victim(ability.entity);
|
|
18896
|
-
if ((ability.upgrades & hookUpgrades) !== hookUpgrades) {
|
|
18897
|
-
player.setAbility({ ability: hookAbility, upgrades: hookUpgrades });
|
|
18898
|
-
}
|
|
18899
|
-
if (ability.cooldownEnd <= now4) {
|
|
18900
|
-
return { victim, thrown: false };
|
|
18901
|
-
}
|
|
18902
|
-
const thrown = ability.cooldownStart > this.thrownAt;
|
|
18903
|
-
if (thrown) {
|
|
18904
|
-
this.thrownAt = ability.cooldownStart;
|
|
18629
|
+
/**
|
|
18630
|
+
* update reads the thrower's hook at game time now, keeps it fully upgraded
|
|
18631
|
+
* and sets the length of any cooldown a throw started. It reports nothing
|
|
18632
|
+
* for a hero without the hook. A caller that already read this frame's
|
|
18633
|
+
* abilities passes them to avoid another read.
|
|
18634
|
+
*/
|
|
18635
|
+
update(player, now4, abilities = player.abilities()) {
|
|
18636
|
+
const ability = abilities.find((a) => a.name === hookAbility);
|
|
18637
|
+
if (!ability) {
|
|
18638
|
+
return void 0;
|
|
18639
|
+
}
|
|
18640
|
+
const victim = this.victim(ability.entity);
|
|
18641
|
+
if ((ability.upgrades & hookUpgrades) !== hookUpgrades) {
|
|
18642
|
+
player.setAbility({ ability: hookAbility, upgrades: hookUpgrades });
|
|
18643
|
+
}
|
|
18644
|
+
if (ability.cooldownEnd <= now4) {
|
|
18645
|
+
return { victim, thrown: false };
|
|
18646
|
+
}
|
|
18647
|
+
const thrown = ability.cooldownStart > this.thrownAt;
|
|
18648
|
+
if (thrown) {
|
|
18649
|
+
this.thrownAt = ability.cooldownStart;
|
|
18650
|
+
}
|
|
18651
|
+
this.setCooldown(player, ability);
|
|
18652
|
+
return { victim, thrown };
|
|
18653
|
+
}
|
|
18654
|
+
/** victim is the hero the hook entity holds, or undefined while it holds none. */
|
|
18655
|
+
victim(hookEntity) {
|
|
18656
|
+
const victim = this.read(
|
|
18657
|
+
hookEntity,
|
|
18658
|
+
"CCitadel_Ability_Hook",
|
|
18659
|
+
"m_hHookVictim",
|
|
18660
|
+
"handle"
|
|
18661
|
+
);
|
|
18662
|
+
return typeof victim === "number" ? victim : void 0;
|
|
18663
|
+
}
|
|
18664
|
+
/** setCooldown ends the cooldown cooldownSeconds after the hook's throw. */
|
|
18665
|
+
setCooldown(player, ability) {
|
|
18666
|
+
if (this.cooldownSeconds <= 0) {
|
|
18667
|
+
player.refreshAbility(hookAbility);
|
|
18668
|
+
return;
|
|
18669
|
+
}
|
|
18670
|
+
const cooldownEnd = ability.cooldownStart + this.cooldownSeconds;
|
|
18671
|
+
if (cooldownEnd !== ability.cooldownEnd) {
|
|
18672
|
+
player.setAbility({ ability: hookAbility, cooldownEnd });
|
|
18673
|
+
}
|
|
18674
|
+
}
|
|
18675
|
+
};
|
|
18676
|
+
|
|
18677
|
+
// js/src/hud.ts
|
|
18678
|
+
function element(type, style, children, key) {
|
|
18679
|
+
return { type, props: { style, children }, key };
|
|
18680
|
+
}
|
|
18681
|
+
function arriving(component, from) {
|
|
18682
|
+
return {
|
|
18683
|
+
...component,
|
|
18684
|
+
props: {
|
|
18685
|
+
...component.props,
|
|
18686
|
+
style: {
|
|
18687
|
+
transition: { seconds: 0.25, easing: "out" },
|
|
18688
|
+
...component.props.style
|
|
18689
|
+
},
|
|
18690
|
+
enter: { opacity: 0, ...from },
|
|
18691
|
+
exit: { opacity: 0 }
|
|
18692
|
+
}
|
|
18693
|
+
};
|
|
18694
|
+
}
|
|
18695
|
+
function Text(props) {
|
|
18696
|
+
const type = types[props.role];
|
|
18697
|
+
const text2 = element(
|
|
18698
|
+
"label",
|
|
18699
|
+
{
|
|
18700
|
+
face: type.face,
|
|
18701
|
+
fontSize: type.size,
|
|
18702
|
+
uppercase: type.uppercase,
|
|
18703
|
+
shadow: !props.plated,
|
|
18704
|
+
color: tones[props.tone ?? (props.role === "label" ? "muted" : "text")],
|
|
18705
|
+
horizontalAlign: "center",
|
|
18706
|
+
textAlign: "center",
|
|
18707
|
+
...props.style
|
|
18708
|
+
},
|
|
18709
|
+
props.children
|
|
18710
|
+
);
|
|
18711
|
+
return props.clock ? { ...text2, props: { ...text2.props, clock: props.clock } } : text2;
|
|
18712
|
+
}
|
|
18713
|
+
function Plate(props) {
|
|
18714
|
+
return element(
|
|
18715
|
+
"panel",
|
|
18716
|
+
{
|
|
18717
|
+
flow: props.flow ?? "down",
|
|
18718
|
+
horizontalAlign: "center",
|
|
18719
|
+
background: plate.color,
|
|
18720
|
+
borderRadius: plate.radius,
|
|
18721
|
+
padding: plate.padding,
|
|
18722
|
+
...props.style
|
|
18723
|
+
},
|
|
18724
|
+
props.children
|
|
18725
|
+
);
|
|
18726
|
+
}
|
|
18727
|
+
function Pill(props) {
|
|
18728
|
+
return element(
|
|
18729
|
+
"panel",
|
|
18730
|
+
{
|
|
18731
|
+
flow: props.flow ?? "right",
|
|
18732
|
+
horizontalAlign: "center",
|
|
18733
|
+
background: plate.color,
|
|
18734
|
+
borderRadius: 50,
|
|
18735
|
+
borderWidth: 2,
|
|
18736
|
+
borderColor: pillEdge,
|
|
18737
|
+
padding: [3, 6],
|
|
18738
|
+
...props.style
|
|
18739
|
+
},
|
|
18740
|
+
props.children
|
|
18741
|
+
);
|
|
18742
|
+
}
|
|
18743
|
+
function Pips(props) {
|
|
18744
|
+
const shape = pipShapes[props.shape ?? "round"];
|
|
18745
|
+
const lit = (index) => props.mirror ? index >= props.total - props.filled : index < props.filled;
|
|
18746
|
+
return element(
|
|
18747
|
+
"panel",
|
|
18748
|
+
{ flow: "right", verticalAlign: "center", ...props.style },
|
|
18749
|
+
Array.from(
|
|
18750
|
+
{ length: props.total },
|
|
18751
|
+
(_, index) => element(
|
|
18752
|
+
"panel",
|
|
18753
|
+
{
|
|
18754
|
+
width: shape.width,
|
|
18755
|
+
height: shape.height,
|
|
18756
|
+
borderRadius: shape.radius,
|
|
18757
|
+
margin: [0, 2],
|
|
18758
|
+
background: lit(index) ? tones[props.tone] : emptyPip,
|
|
18759
|
+
borderWidth: 2,
|
|
18760
|
+
borderColor: lit(index) ? pipRings.filled : pipRings.empty
|
|
18761
|
+
},
|
|
18762
|
+
void 0,
|
|
18763
|
+
`pip-${index}`
|
|
18764
|
+
)
|
|
18765
|
+
)
|
|
18766
|
+
);
|
|
18767
|
+
}
|
|
18768
|
+
function Tag(props) {
|
|
18769
|
+
const filled = props.fill === "filled";
|
|
18770
|
+
return element(
|
|
18771
|
+
"label",
|
|
18772
|
+
{
|
|
18773
|
+
face: "block",
|
|
18774
|
+
fontSize: 12,
|
|
18775
|
+
letterSpacing: 1,
|
|
18776
|
+
uppercase: true,
|
|
18777
|
+
color: filled ? tones.onAccent : tones[props.tone],
|
|
18778
|
+
background: filled ? tones[props.tone] : void 0,
|
|
18779
|
+
borderWidth: 1,
|
|
18780
|
+
borderColor: tones[props.tone],
|
|
18781
|
+
borderRadius: sizes.radius,
|
|
18782
|
+
padding: [4, 8],
|
|
18783
|
+
verticalAlign: "center",
|
|
18784
|
+
...props.style
|
|
18785
|
+
},
|
|
18786
|
+
props.children
|
|
18787
|
+
);
|
|
18788
|
+
}
|
|
18789
|
+
function Banner(props) {
|
|
18790
|
+
const banner = element(
|
|
18791
|
+
"panel",
|
|
18792
|
+
{
|
|
18793
|
+
flow: "down",
|
|
18794
|
+
horizontalAlign: "center",
|
|
18795
|
+
margin: [20, 0, 0, 0],
|
|
18796
|
+
...props.style
|
|
18797
|
+
},
|
|
18798
|
+
[
|
|
18799
|
+
Text({ role: "title", tone: props.tone, children: props.title }),
|
|
18800
|
+
props.detail && Text({ role: "caption", tone: "muted", children: props.detail })
|
|
18801
|
+
]
|
|
18802
|
+
);
|
|
18803
|
+
return arriving(banner, { scale: 0.92 });
|
|
18804
|
+
}
|
|
18805
|
+
function TopStrip(props) {
|
|
18806
|
+
const block2 = [
|
|
18807
|
+
props.heading && Text({
|
|
18808
|
+
role: "label",
|
|
18809
|
+
style: { letterSpacing: 1 },
|
|
18810
|
+
children: props.heading
|
|
18811
|
+
}),
|
|
18812
|
+
Pill({ style: { margin: [4, 0, 0, 0] }, children: props.children })
|
|
18813
|
+
];
|
|
18814
|
+
const line2 = props.line && Text({
|
|
18815
|
+
role: "label",
|
|
18816
|
+
tone: props.lineTone ?? "text",
|
|
18817
|
+
style: { margin: [4, 0, 0, 0], fontSize: 18, letterSpacing: 1 },
|
|
18818
|
+
children: props.line
|
|
18819
|
+
});
|
|
18820
|
+
const column = (top, children) => element(
|
|
18821
|
+
"panel",
|
|
18822
|
+
{ flow: "down", horizontalAlign: "center", margin: [top, 0, 0, 0] },
|
|
18823
|
+
children
|
|
18824
|
+
);
|
|
18825
|
+
if (!props.keepTeamBar) return column(14, [...block2, line2]);
|
|
18826
|
+
return element("panel", { width: "fill", height: "fill" }, [
|
|
18827
|
+
column(teamBarBottom, block2),
|
|
18828
|
+
line2 && column(objectiveBarBottom, line2)
|
|
18829
|
+
]);
|
|
18830
|
+
}
|
|
18831
|
+
function Score2(props) {
|
|
18832
|
+
const [near, far] = props.tones ?? ["accent", "text"];
|
|
18833
|
+
const side = (points, tone) => Text({
|
|
18834
|
+
role: "title",
|
|
18835
|
+
tone,
|
|
18836
|
+
plated: true,
|
|
18837
|
+
style: { margin: [0, 10], horizontalAlign: void 0 },
|
|
18838
|
+
children: `${points}`
|
|
18839
|
+
});
|
|
18840
|
+
return element("panel", { flow: "right", verticalAlign: "center" }, [
|
|
18841
|
+
side(props.points[0], near),
|
|
18842
|
+
Text({
|
|
18843
|
+
role: "title",
|
|
18844
|
+
tone: "muted",
|
|
18845
|
+
plated: true,
|
|
18846
|
+
style: { horizontalAlign: void 0 },
|
|
18847
|
+
children: ":"
|
|
18848
|
+
}),
|
|
18849
|
+
side(props.points[1], far)
|
|
18850
|
+
]);
|
|
18851
|
+
}
|
|
18852
|
+
var rosterDensities = [
|
|
18853
|
+
{
|
|
18854
|
+
portrait: 44,
|
|
18855
|
+
pitch: 52,
|
|
18856
|
+
nameSize: 15,
|
|
18857
|
+
activity: true,
|
|
18858
|
+
badge: 18,
|
|
18859
|
+
columns: 1
|
|
18860
|
+
},
|
|
18861
|
+
{
|
|
18862
|
+
portrait: 32,
|
|
18863
|
+
pitch: 38,
|
|
18864
|
+
nameSize: 15,
|
|
18865
|
+
activity: false,
|
|
18866
|
+
badge: 14,
|
|
18867
|
+
columns: 1
|
|
18868
|
+
},
|
|
18869
|
+
{
|
|
18870
|
+
portrait: 24,
|
|
18871
|
+
pitch: 27,
|
|
18872
|
+
nameSize: 13,
|
|
18873
|
+
activity: false,
|
|
18874
|
+
badge: 0,
|
|
18875
|
+
columns: 3
|
|
18876
|
+
}
|
|
18877
|
+
];
|
|
18878
|
+
var rosterName = 24;
|
|
18879
|
+
var rosterCell = 150;
|
|
18880
|
+
var rosterColumnGap = 12;
|
|
18881
|
+
var rosterHeading = 24;
|
|
18882
|
+
var rosterGroupGap = 10;
|
|
18883
|
+
var rosterGap = 12;
|
|
18884
|
+
var portraits2 = new Map(heroes.map((hero) => [hero.id, hero.portrait]));
|
|
18885
|
+
function rosterKey(groups) {
|
|
18886
|
+
return groups.map(
|
|
18887
|
+
(group) => `${group.key} ${group.title ?? ""} ${group.tone ?? ""} ${group.note ?? ""}
|
|
18888
|
+
${group.rows.map(
|
|
18889
|
+
(row2) => `${row2.key ?? ""} ${row2.self ? "*" : ""}${row2.selected ? "+" : ""}${row2.out ? "-" : ""}${row2.onPress ? ">" : ""}${row2.name} ${row2.hero} ${row2.activity ?? ""} ${row2.steamId ?? ""}`
|
|
18890
|
+
).join("\n")}`
|
|
18891
|
+
).join("\n\n");
|
|
18892
|
+
}
|
|
18893
|
+
function linesOf(rows, columns) {
|
|
18894
|
+
return Math.ceil(rows / columns);
|
|
18895
|
+
}
|
|
18896
|
+
function rosterLayout(groups, height) {
|
|
18897
|
+
const chrome = groups.reduce(
|
|
18898
|
+
(sum, group, index) => sum + (group.title === void 0 ? 0 : rosterHeading) + (index > 0 ? rosterGroupGap : 0),
|
|
18899
|
+
0
|
|
18900
|
+
);
|
|
18901
|
+
for (const density2 of rosterDensities) {
|
|
18902
|
+
for (let columns2 = 1; columns2 <= density2.columns; columns2++) {
|
|
18903
|
+
const lines3 = groups.map((group) => linesOf(group.rows.length, columns2));
|
|
18904
|
+
const total2 = lines3.reduce((sum, count2) => sum + count2, 0);
|
|
18905
|
+
if (chrome + total2 * density2.pitch <= height) {
|
|
18906
|
+
return {
|
|
18907
|
+
density: density2,
|
|
18908
|
+
columns: columns2,
|
|
18909
|
+
lines: lines3,
|
|
18910
|
+
height: chrome + total2 * density2.pitch
|
|
18911
|
+
};
|
|
18912
|
+
}
|
|
18905
18913
|
}
|
|
18906
|
-
this.setCooldown(player, ability);
|
|
18907
|
-
return { victim, thrown };
|
|
18908
|
-
}
|
|
18909
|
-
/** victim is the hero the hook entity holds, or undefined while it holds none. */
|
|
18910
|
-
victim(hookEntity) {
|
|
18911
|
-
const victim = this.read(
|
|
18912
|
-
hookEntity,
|
|
18913
|
-
"CCitadel_Ability_Hook",
|
|
18914
|
-
"m_hHookVictim",
|
|
18915
|
-
"handle"
|
|
18916
|
-
);
|
|
18917
|
-
return typeof victim === "number" ? victim : void 0;
|
|
18918
18914
|
}
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18915
|
+
const density = rosterDensities[rosterDensities.length - 1];
|
|
18916
|
+
const columns = density.columns;
|
|
18917
|
+
const wanted = groups.map((group) => linesOf(group.rows.length, columns));
|
|
18918
|
+
const lines2 = groups.map(() => 1);
|
|
18919
|
+
let spare = Math.max(groups.length, Math.floor((height - chrome) / density.pitch)) - groups.length;
|
|
18920
|
+
while (spare > 0 && lines2.some((count2, at3) => count2 < wanted[at3])) {
|
|
18921
|
+
for (let at3 = 0; at3 < lines2.length && spare > 0; at3++) {
|
|
18922
|
+
if (lines2[at3] < wanted[at3]) {
|
|
18923
|
+
lines2[at3] = lines2[at3] + 1;
|
|
18924
|
+
spare -= 1;
|
|
18925
|
+
}
|
|
18924
18926
|
}
|
|
18925
|
-
|
|
18926
|
-
|
|
18927
|
-
|
|
18927
|
+
}
|
|
18928
|
+
const total = lines2.reduce((sum, count2) => sum + count2, 0);
|
|
18929
|
+
return { density, columns, lines: lines2, height: chrome + total * density.pitch };
|
|
18930
|
+
}
|
|
18931
|
+
function rosterPlan(props) {
|
|
18932
|
+
const groups = (props.groups ?? [{ key: "players", rows: props.rows ?? [] }]).filter((group) => group.rows.length > 0);
|
|
18933
|
+
if (groups.length === 0) return null;
|
|
18934
|
+
const top = props.top ?? fpsReadoutBottom;
|
|
18935
|
+
const bottom = (props.bottom ?? minimapTop) - rosterGap;
|
|
18936
|
+
return { groups, top, layout: rosterLayout(groups, bottom - top) };
|
|
18937
|
+
}
|
|
18938
|
+
function rosterBottom(props) {
|
|
18939
|
+
const plan = rosterPlan(props);
|
|
18940
|
+
return plan ? plan.top + plan.layout.height : props.top ?? fpsReadoutBottom;
|
|
18941
|
+
}
|
|
18942
|
+
function Roster(props) {
|
|
18943
|
+
const plan = rosterPlan(props);
|
|
18944
|
+
if (!plan) return null;
|
|
18945
|
+
const { groups, top, layout } = plan;
|
|
18946
|
+
return element(
|
|
18947
|
+
"panel",
|
|
18948
|
+
{
|
|
18949
|
+
width: "fit",
|
|
18950
|
+
height: "fit",
|
|
18951
|
+
flow: "down",
|
|
18952
|
+
horizontalAlign: "right",
|
|
18953
|
+
verticalAlign: "top",
|
|
18954
|
+
margin: [top, 24, 0, 0]
|
|
18955
|
+
},
|
|
18956
|
+
groups.map(
|
|
18957
|
+
(group, index) => rosterGroup(group, index, layout, layout.lines[index])
|
|
18958
|
+
)
|
|
18959
|
+
);
|
|
18960
|
+
}
|
|
18961
|
+
function rosterGroup(group, index, layout, lines2) {
|
|
18962
|
+
const { density, columns } = layout;
|
|
18963
|
+
const room = lines2 * columns;
|
|
18964
|
+
const cut = group.rows.length > room;
|
|
18965
|
+
const shown2 = cut ? group.rows.slice(0, room - 1) : group.rows;
|
|
18966
|
+
const cells = shown2.map(
|
|
18967
|
+
(row2, at3) => rosterRow(row2, at3, density, columns > 1)
|
|
18968
|
+
);
|
|
18969
|
+
if (cut) cells.push(rosterRest(group.rows.length - shown2.length, density));
|
|
18970
|
+
const body = columns === 1 ? cells : Array.from(
|
|
18971
|
+
{ length: lines2 },
|
|
18972
|
+
(_, line2) => element(
|
|
18973
|
+
"panel",
|
|
18974
|
+
{ flow: "right", horizontalAlign: "right" },
|
|
18975
|
+
cells.slice(line2 * columns, (line2 + 1) * columns),
|
|
18976
|
+
`line-${line2}`
|
|
18977
|
+
)
|
|
18978
|
+
);
|
|
18979
|
+
const heading = group.title === void 0 ? false : element(
|
|
18980
|
+
"panel",
|
|
18981
|
+
{
|
|
18982
|
+
flow: "right",
|
|
18983
|
+
horizontalAlign: "right",
|
|
18984
|
+
height: rosterHeading
|
|
18985
|
+
},
|
|
18986
|
+
[
|
|
18987
|
+
Text({
|
|
18988
|
+
role: "label",
|
|
18989
|
+
tone: group.tone ?? "muted",
|
|
18990
|
+
style: { letterSpacing: 1, horizontalAlign: void 0 },
|
|
18991
|
+
children: group.title
|
|
18992
|
+
}),
|
|
18993
|
+
group.note !== void 0 && Text({
|
|
18994
|
+
role: "label",
|
|
18995
|
+
tone: "muted",
|
|
18996
|
+
style: { margin: [0, 0, 0, 8], horizontalAlign: void 0 },
|
|
18997
|
+
children: group.note
|
|
18998
|
+
})
|
|
18999
|
+
]
|
|
19000
|
+
);
|
|
19001
|
+
return element(
|
|
19002
|
+
"panel",
|
|
19003
|
+
{
|
|
19004
|
+
flow: "down",
|
|
19005
|
+
horizontalAlign: "right",
|
|
19006
|
+
margin: [index > 0 ? rosterGroupGap : 0, 0, 0, 0]
|
|
19007
|
+
},
|
|
19008
|
+
[heading, ...body],
|
|
19009
|
+
`group-${group.key}`
|
|
19010
|
+
);
|
|
19011
|
+
}
|
|
19012
|
+
function rosterRow(row2, index, density, cell2) {
|
|
19013
|
+
const right = { horizontalAlign: "right", textAlign: "right" };
|
|
19014
|
+
const nameWidth2 = cell2 ? rosterCell - density.portrait - 8 - rosterColumnGap : void 0;
|
|
19015
|
+
const text2 = element(
|
|
19016
|
+
"panel",
|
|
19017
|
+
{ flow: "down", verticalAlign: "center", margin: [0, 8, 0, 0] },
|
|
19018
|
+
[
|
|
19019
|
+
Text({
|
|
19020
|
+
role: "label",
|
|
19021
|
+
tone: row2.out ? "muted" : "text",
|
|
19022
|
+
style: {
|
|
19023
|
+
...right,
|
|
19024
|
+
fontSize: density.nameSize,
|
|
19025
|
+
...nameWidth2 === void 0 ? {} : { width: nameWidth2, noWrap: true, textOverflow: "ellipsis" }
|
|
19026
|
+
},
|
|
19027
|
+
children: clip2(row2.name.toUpperCase(), rosterName)
|
|
19028
|
+
}),
|
|
19029
|
+
density.activity && row2.activity !== void 0 && row2.activity !== "" && Text({
|
|
19030
|
+
role: "caption",
|
|
19031
|
+
tone: "muted",
|
|
19032
|
+
style: { ...right, margin: [1, 0, 0, 0] },
|
|
19033
|
+
children: row2.activity
|
|
19034
|
+
})
|
|
19035
|
+
]
|
|
19036
|
+
);
|
|
19037
|
+
const src = portraits2.get(row2.hero);
|
|
19038
|
+
const picture = src !== void 0 ? [
|
|
19039
|
+
portraitImage(src),
|
|
19040
|
+
density.badge > 0 && row2.steamId !== void 0 && avatarBadge(row2.steamId, density.badge)
|
|
19041
|
+
] : row2.steamId !== void 0 ? [avatarFill(row2.steamId)] : [];
|
|
19042
|
+
const portrait = element(
|
|
19043
|
+
"panel",
|
|
19044
|
+
{
|
|
19045
|
+
width: density.portrait,
|
|
19046
|
+
height: density.portrait,
|
|
19047
|
+
padding: 1,
|
|
19048
|
+
verticalAlign: "center",
|
|
19049
|
+
background: row2.self || row2.selected ? tones.accent : shades.dim
|
|
19050
|
+
},
|
|
19051
|
+
element(
|
|
19052
|
+
"panel",
|
|
19053
|
+
{
|
|
19054
|
+
width: "100%",
|
|
19055
|
+
height: "100%",
|
|
19056
|
+
background: shades.raised,
|
|
19057
|
+
saturation: row2.out ? 0 : 1
|
|
19058
|
+
},
|
|
19059
|
+
picture
|
|
19060
|
+
)
|
|
19061
|
+
);
|
|
19062
|
+
const style = {
|
|
19063
|
+
flow: "right",
|
|
19064
|
+
horizontalAlign: "right",
|
|
19065
|
+
height: density.pitch,
|
|
19066
|
+
opacity: row2.out ? 0.55 : 1,
|
|
19067
|
+
...cell2 ? { width: rosterCell } : {}
|
|
19068
|
+
};
|
|
19069
|
+
const key = `row-${row2.key ?? index}`;
|
|
19070
|
+
const line2 = row2.onPress ? {
|
|
19071
|
+
type: "button",
|
|
19072
|
+
props: {
|
|
19073
|
+
style: {
|
|
19074
|
+
...style,
|
|
19075
|
+
borderRadius: sizes.radius,
|
|
19076
|
+
transition: motion.hover
|
|
19077
|
+
},
|
|
19078
|
+
hover: { background: shades.raised },
|
|
19079
|
+
hoverSound: sounds.hover,
|
|
19080
|
+
sound: sounds.press,
|
|
19081
|
+
onPress: row2.onPress,
|
|
19082
|
+
children: [text2, portrait]
|
|
19083
|
+
},
|
|
19084
|
+
key
|
|
19085
|
+
} : element("panel", style, [text2, portrait], key);
|
|
19086
|
+
return arriving(line2, { translate: [16, 0] });
|
|
19087
|
+
}
|
|
19088
|
+
function rosterRest(count2, density) {
|
|
19089
|
+
return element(
|
|
19090
|
+
"panel",
|
|
19091
|
+
{ height: density.pitch, width: rosterCell, horizontalAlign: "right" },
|
|
19092
|
+
Text({
|
|
19093
|
+
role: "label",
|
|
19094
|
+
tone: "muted",
|
|
19095
|
+
style: {
|
|
19096
|
+
fontSize: density.nameSize,
|
|
19097
|
+
horizontalAlign: "right",
|
|
19098
|
+
verticalAlign: "center",
|
|
19099
|
+
textAlign: "right"
|
|
19100
|
+
},
|
|
19101
|
+
children: `+${count2} more`
|
|
19102
|
+
}),
|
|
19103
|
+
"rest"
|
|
19104
|
+
);
|
|
19105
|
+
}
|
|
19106
|
+
function portraitImage(src) {
|
|
19107
|
+
return {
|
|
19108
|
+
type: "image",
|
|
19109
|
+
props: { src, style: { width: "100%", height: "100%" } }
|
|
19110
|
+
};
|
|
19111
|
+
}
|
|
19112
|
+
function avatarFill(steamId) {
|
|
19113
|
+
return {
|
|
19114
|
+
type: "avatar",
|
|
19115
|
+
props: { steamId, style: { width: "100%", height: "100%" } }
|
|
19116
|
+
};
|
|
19117
|
+
}
|
|
19118
|
+
function avatarBadge(steamId, side) {
|
|
19119
|
+
return {
|
|
19120
|
+
type: "avatar",
|
|
19121
|
+
props: {
|
|
19122
|
+
steamId,
|
|
19123
|
+
style: {
|
|
19124
|
+
width: side,
|
|
19125
|
+
height: side,
|
|
19126
|
+
horizontalAlign: "left",
|
|
19127
|
+
verticalAlign: "bottom",
|
|
19128
|
+
borderRadius: side / 2,
|
|
19129
|
+
borderWidth: 1,
|
|
19130
|
+
borderColor: shades.dim
|
|
19131
|
+
}
|
|
18928
19132
|
}
|
|
19133
|
+
};
|
|
19134
|
+
}
|
|
19135
|
+
var actionLooks = {
|
|
19136
|
+
primary: {
|
|
19137
|
+
idle: { background: tones.text },
|
|
19138
|
+
hover: { background: shades.white },
|
|
19139
|
+
text: shades.ink
|
|
19140
|
+
},
|
|
19141
|
+
secondary: {
|
|
19142
|
+
idle: {
|
|
19143
|
+
background: shades.raised,
|
|
19144
|
+
borderWidth: 1,
|
|
19145
|
+
borderColor: shades.faint
|
|
19146
|
+
},
|
|
19147
|
+
hover: { background: shades.lit, borderColor: tones.text },
|
|
19148
|
+
text: tones.text
|
|
19149
|
+
},
|
|
19150
|
+
quiet: {
|
|
19151
|
+
idle: { background: shades.clear },
|
|
19152
|
+
hover: { background: shades.raised },
|
|
19153
|
+
text: shades.quiet
|
|
18929
19154
|
}
|
|
18930
19155
|
};
|
|
19156
|
+
function Action(props) {
|
|
19157
|
+
const look = actionLooks[props.kind ?? "secondary"];
|
|
19158
|
+
const label = element(
|
|
19159
|
+
"label",
|
|
19160
|
+
{
|
|
19161
|
+
face: "block",
|
|
19162
|
+
fontSize: 16,
|
|
19163
|
+
uppercase: true,
|
|
19164
|
+
letterSpacing: 1,
|
|
19165
|
+
color: look.text,
|
|
19166
|
+
horizontalAlign: "center",
|
|
19167
|
+
verticalAlign: "center",
|
|
19168
|
+
noWrap: true
|
|
19169
|
+
},
|
|
19170
|
+
props.children
|
|
19171
|
+
);
|
|
19172
|
+
return {
|
|
19173
|
+
type: "button",
|
|
19174
|
+
props: {
|
|
19175
|
+
style: {
|
|
19176
|
+
height: sizes.control,
|
|
19177
|
+
padding: [0, 14],
|
|
19178
|
+
borderRadius: sizes.radius,
|
|
19179
|
+
transition: motion.hover,
|
|
19180
|
+
...look.idle,
|
|
19181
|
+
...props.disabled ? { opacity: 0.4 } : {},
|
|
19182
|
+
...props.style
|
|
19183
|
+
},
|
|
19184
|
+
hover: props.disabled ? void 0 : look.hover,
|
|
19185
|
+
hoverSound: props.disabled ? void 0 : sounds.hover,
|
|
19186
|
+
sound: sounds.press,
|
|
19187
|
+
disabled: props.disabled,
|
|
19188
|
+
onPress: props.onPress,
|
|
19189
|
+
children: label
|
|
19190
|
+
}
|
|
19191
|
+
};
|
|
19192
|
+
}
|
|
19193
|
+
function Meter(props) {
|
|
19194
|
+
const height = props.height ?? 8;
|
|
19195
|
+
const value = Math.min(1, Math.max(0, props.value));
|
|
19196
|
+
return element(
|
|
19197
|
+
"panel",
|
|
19198
|
+
{
|
|
19199
|
+
width: props.width ?? 160,
|
|
19200
|
+
height,
|
|
19201
|
+
background: shades.raised,
|
|
19202
|
+
borderRadius: height / 2,
|
|
19203
|
+
overflow: "clip",
|
|
19204
|
+
...props.style
|
|
19205
|
+
},
|
|
19206
|
+
// The fill scales rather than resizes, so it eases without layout work.
|
|
19207
|
+
element("panel", {
|
|
19208
|
+
width: "100%",
|
|
19209
|
+
height: "100%",
|
|
19210
|
+
background: tones[props.tone ?? "accent"],
|
|
19211
|
+
scale: [value, 1],
|
|
19212
|
+
origin: [0, 50],
|
|
19213
|
+
transition: motion.meter
|
|
19214
|
+
})
|
|
19215
|
+
);
|
|
19216
|
+
}
|
|
18931
19217
|
|
|
18932
19218
|
// js/src/frameclock.ts
|
|
18933
19219
|
var now3 = () => performance.now();
|
|
@@ -19014,12 +19300,12 @@ var frameClock = new FrameClock();
|
|
|
19014
19300
|
function ground(point, {
|
|
19015
19301
|
above = 64,
|
|
19016
19302
|
below = 1024,
|
|
19017
|
-
layers = Layers.solid | Layers.playerClip
|
|
19303
|
+
layers: layers2 = Layers.solid | Layers.playerClip
|
|
19018
19304
|
} = {}) {
|
|
19019
19305
|
const hit = trace({
|
|
19020
19306
|
start: { ...point, z: point.z + above },
|
|
19021
19307
|
end: { ...point, z: point.z - below },
|
|
19022
|
-
layers
|
|
19308
|
+
layers: layers2
|
|
19023
19309
|
});
|
|
19024
19310
|
return hit && !hit.startSolid ? hit.position : void 0;
|
|
19025
19311
|
}
|
|
@@ -21972,8 +22258,8 @@ export {
|
|
|
21972
22258
|
restoreHero,
|
|
21973
22259
|
restoreNpcs,
|
|
21974
22260
|
rift,
|
|
22261
|
+
rosterBottom,
|
|
21975
22262
|
rosterKey,
|
|
21976
|
-
rosterRows,
|
|
21977
22263
|
route,
|
|
21978
22264
|
sequence,
|
|
21979
22265
|
serve,
|