Skip to content

Commit

Permalink
Clear match kills
Browse files Browse the repository at this point in the history
  • Loading branch information
EwanLyon committed Feb 11, 2021
1 parent 3e52673 commit 72ced7d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/dashboard/setup/server/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { ThemeProvider } from '@material-ui/styles';
// Interfaces
import { bundleStatus as ExampleBundle } from '../../../extension/example-data';
import { BundleStatus } from '../../../types/bundle-status';
import { Button } from '@material-ui/core';

const HlaeActive = styled.div`
width: 100%;
Expand Down Expand Up @@ -55,14 +54,6 @@ export const Server: React.FunctionComponent = () => {
}
}, [bundleStatus]);

/*
This button should only be used for dev
Match kills should be cleared at the end of a match or when a new one is started
*/
function resetMatchKills() {
nodecg.sendMessage('resetMatchKills');
}

return (
<ThemeProvider theme={theme}>
<StyledToggleButton
Expand Down Expand Up @@ -91,9 +82,6 @@ export const Server: React.FunctionComponent = () => {
<HlaeActive active={hlaeActiveRep}>
HLAE is currently {hlaeActiveRep ? 'active' : 'inactive'}
</HlaeActive>
<Button onClick={resetMatchKills} variant="contained">
Reset Match Kills (Dev)
</Button>
</ThemeProvider>
);
};
Expand Down
3 changes: 3 additions & 0 deletions src/extension/matches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import _ from 'lodash';
import { MapInfo, Match, Matches, NewMatch } from '../types/matches';
import { TeamsPreset } from '../types/team-preset';
import { CSGO } from '../types/csgo-gsi';
import { PlayerDeath } from '../types/hlae';

const nodecg = nodecgApiContext.get();
const currentMatchRep = nodecg.Replicant<Match | undefined>('currentMatch');
const matchesRep = nodecg.Replicant<Matches>('matches');
const teamsRep = nodecg.Replicant<TeamsPreset>('teamPlayerPreset');
const round30Winner = nodecg.Replicant<string>('round30Winner');
const matchKills = nodecg.Replicant<PlayerDeath[]>('matchKills');

// If no current match set then start at the very beginning, a very good place to start
if (!currentMatchRep.value) {
Expand All @@ -36,6 +38,7 @@ nodecg.listenFor('nextMatch', () => {
}

currentMatchRep.value = _.cloneDeep(matchesRep.value[currentMatchIndex + 1]);
matchKills.value = []; // Clear match kills since we are on a new one now
});

nodecg.listenFor('prevMatch', () => {
Expand Down

0 comments on commit 72ced7d

Please sign in to comment.