Skip to content

Commit

Permalink
Some tweaks for relays
Browse files Browse the repository at this point in the history
  • Loading branch information
zoton2 committed Feb 24, 2024
1 parent b65ab1a commit 423b0b7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
14 changes: 10 additions & 4 deletions src/extension/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,16 @@ async function changeTwitchMetadata(title?: string, gameId?: string): Promise<vo
// TODO: Expose a helper in that bundle to do this stuff instead.
const runData = sc.getCurrentRun();
const mentionChannels = true;
const players = runData?.teams.map((team) => (
team.players.map((player) => (mentionChannels && player.social.twitch
? `@${player.social.twitch}` : player.name)).join(', ')
)).join(' vs. ') || 'Runs coming up!'; // "Fake" string to show when no runners active
let players = 'Runs coming up!'; // "Fake" string to show when no runners active
// OVERRIDE FOR RELAYS BECAUSE LOTS OF PEOPLE! ESAW24
if (runData?.relay && runData.teams[0].name) {
players = runData.teams[0].name;
} else {
players = runData?.teams.map((team) => (
team.players.map((player) => (mentionChannels && player.social.twitch
? `@${player.social.twitch}` : player.name)).join(', ')
)).join(' vs. ') || 'Runs coming up!'; // "Fake" string to show when no runners active
}
const additionalDonationsMapped = nodecg().bundleConfig.additionalDonations.map((d) => ({
key: d.key,
description: d.description,
Expand Down
9 changes: 7 additions & 2 deletions src/graphics/game-layout/esaw24-base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
<script lang="ts">
import { CommentatorsNew, DonationReaderNew } from '@esa-layouts/types/schemas';
import MediaBox from '@shared/graphics/mediabox';
import { RunDataActiveRun } from 'speedcontrol-util/types';
import { RunDataActiveRun, RunDataPlayer } from 'speedcontrol-util/types';
import { Component, Prop, Vue } from 'vue-property-decorator';
import { State } from 'vuex-class';
import ParticipantInfo from '../_misc/components/ParticipantInfo.vue';
Expand Down Expand Up @@ -182,8 +182,13 @@ export default class extends Vue {
@State readonly commentatorsNew!: CommentatorsNew;
@State readonly donationReaderNew!: DonationReaderNew;
get players() {
get players(): RunDataPlayer[] {
if (!this.runData) return [];
if (this.runData.relay) {
const team = this.runData?.teams[0];
const player = team?.players.find((p) => p.id === team.relayPlayerID);
return player ? [player] : [];
}
return this.runData.teams.map((t) => t.players).flat(1);
}
}
Expand Down

0 comments on commit 423b0b7

Please sign in to comment.