Skip to content

Commit f0868db

Browse files
committed
add raw cheese counter
1 parent cad16a2 commit f0868db

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

client/src/components/sidebar/game/team-table.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
6565
let ratKingCount = 0
6666
let ratKingPercent = 0
6767
let globalCheese = 0
68+
let rawCheese = 0
6869

6970
if (map && teamStat) {
7071
cheeseAmount = teamStat.cheeseAmount
@@ -74,6 +75,7 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
7475
ratKingCount = teamStat.ratKingCount
7576
ratKingPercent = teamStat.ratKingPercent
7677
globalCheese = teamStat.globalCheeseAmount
78+
rawCheese = teamStat.globalRawCheeseAmount
7779
}
7880

7981
const formatPercent = (val: number) => (val * 100).toFixed(1).toString() + '%'
@@ -135,7 +137,11 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
135137
</div>
136138
</div>
137139
</div>
138-
<div className="flex items-center w-full mt-2 mb-1 text-xs font-bold justify-around">Global Cheese Amount: {globalCheese}</div>
140+
<div className="flex items-center w-full mt-2 mb-1 text-xs font-bold justify-around">
141+
<div>Global Cheese: {globalCheese}</div>
142+
<div>Raw Cheese: {rawCheese}</div>
143+
</div>
144+
139145
</div>
140146
)
141147
}

client/src/playback/RoundStat.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class TeamRoundStat {
2020
ratKingPercent: number = 0
2121
dirtAmount: number = 0
2222
globalCheeseAmount: number = 0
23+
globalRawCheeseAmount: number = 0
2324
babyRatCount: number = 0
2425
ratTrapAmount: number = 0
2526
catTrapAmount: number = 0
@@ -132,7 +133,10 @@ export default class RoundStat {
132133
// Count number of alive robots
133134
if (body.dead) continue
134135

135-
if (body.robotType == schema.RobotType.RAT) teamStat.babyRatCount++
136+
if (body.robotType == schema.RobotType.RAT) {
137+
teamStat.babyRatCount++
138+
teamStat.globalRawCheeseAmount += body.cheese
139+
}
136140
}
137141

138142
const timems = Date.now() - time

0 commit comments

Comments
 (0)