Skip to content

Commit

Permalink
feat: shame cheaters
Browse files Browse the repository at this point in the history
  • Loading branch information
roydejong committed Jan 12, 2024
1 parent fbdc45e commit acf490e
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/Models/Player.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Player extends Model
public bool $showSteam = true;
public bool $showScoreSaber = true;
public bool $showHistory = true;
public bool $isCheater = false;

// -----------------------------------------------------------------------------------------------------------------
// Create/update
Expand Down Expand Up @@ -259,6 +260,7 @@ public function renderFaceHtml(string $size = 'sm'): string
$view->set('skinColorId', $skinColorId);
$view->set('eyesId', $eyesId);
$view->set('isDedicatedServer', $this->getIsDedicatedServer());
$view->set('isCheater', $this->isCheater);
return $view->render();
}

Expand Down
14 changes: 14 additions & 0 deletions migrations/20240112160332_add_cheater_flag.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddCheaterFlag extends AbstractMigration
{
public function change(): void
{
$this->table('players')
->addColumn('is_cheater', 'boolean', ['default' => false])
->update();
}
}
11 changes: 11 additions & 0 deletions public/static/scss/components/face.scss
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,15 @@
> .face {
margin: 0 1rem;
}
}

.face.-cheater {
background-color: transparent !important;
background-image: url('/static/stuff/dunce.png') !important;
background-size: contain !important;
box-shadow: none !important;

.eyes {
display: none !important;
}
}
Binary file added public/static/stuff/cap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/static/stuff/dunce.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion views/bits/face.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% endif %}

{% if not isDedicatedServer %}
<div class="face -size-{{ size }} -skin-{{ skinColorId }}">
<div class="face -size-{{ size }} -skin-{{ skinColorId }} {% if isCheater %}-cheater{% endif %}">
<div class="eyes -{{ eyesId }}"></div>
</div>
{% else %}
Expand Down
6 changes: 6 additions & 0 deletions views/pages/player-profile.base.twig
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
</div>
{% endif %}

{% if player.isCheater %}
<div class="alert">
💩 This player has been seen cheating in multiplayer games. For shame!
</div>
{% endif %}

<div class="page-tabs">
<a href="{{ profileBaseUrl }}" class="{% if profileTab == "info" %}-active{% endif %}">
<i class="mdi mdi-account"></i>
Expand Down

0 comments on commit acf490e

Please sign in to comment.