Skip to content

Commit

Permalink
fix: success vs. failure logic
Browse files Browse the repository at this point in the history
  • Loading branch information
azaleacolburn committed Nov 17, 2024
1 parent d9869fd commit 08ef46e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/routes/scout/ActionInputs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@
actionState = `ScoreBalloon${where}`;
}
function complete(success: boolean) {
// Assume that the robot ejects even if they fail to score
if (actionState.includes('IntakeBalloon')) held_balloons++;
else if (actionState.includes('IntakeBunny')) held_bunnies++;
else if (actionState.includes('IntakeTote')) held_totes++;
else if (actionState.includes('ScoreBalloon')) held_balloons--;
// Assume that a failure means a note remains where it is
if (success) {
if (actionState.includes('IntakeBalloon')) held_balloons++;
else if (actionState.includes('IntakeBunny')) held_bunnies++;
else if (actionState.includes('IntakeTote')) held_totes++;
else if (actionState.includes('EjectBalloon')) held_balloons--;
else if (actionState.includes('EjectBunny')) held_bunnies--;
else if (actionState.includes('EjectTote')) held_totes--;
}
// Assume failed scoring is still ejecting
if (actionState.includes('ScoreBalloon')) held_balloons--;
else if (actionState.includes('ScoreBunny')) held_bunnies--;
else if (actionState.includes('EjectBalloon')) held_balloons--;
else if (actionState.includes('EjectBunny')) held_bunnies--;
else if (actionState.includes('EjectTote')) held_totes--;
const action: AutoActionData = {
action: actionState as AutoAction,
Expand All @@ -61,7 +64,7 @@
>Intake</button
>
{#if held_scorables > 0}
<button class="fond-bold text-md rounded bg-gunmetal p-2" onclick={score_piece}
<button class="text-md rounded bg-gunmetal p-2 font-bold" onclick={score_piece}
>Score</button
>
{/if}
Expand All @@ -72,7 +75,7 @@
{/if}
</div>
{:else if is_intake_state}
<div class="flex flex-col gap-4">
<div class="flex flex-grow flex-col gap-4">
<button class="rounded bg-gunmetal p-2" onclick={() => (actionState = 'IntakeBunny')}
>Intake Bunny</button
>
Expand Down

0 comments on commit 08ef46e

Please sign in to comment.