Skip to content

feat: implement cannot_restart turn reset lockout system - #380

Open
chriscalip wants to merge 1 commit into
AsyncEclipse:mainfrom
chriscalip:cannot-restart
Open

feat: implement cannot_restart turn reset lockout system#380
chriscalip wants to merge 1 commit into
AsyncEclipse:mainfrom
chriscalip:cannot-restart

Conversation

@chriscalip

@chriscalip chriscalip commented Jun 17, 2026

Copy link
Copy Markdown

Title

feat: Migrate turn reset lockout system to PlayerHelper methods

Description

A new property cannot_restart is added to the player's data model. Whenever an action is taken that reveals hidden or confidential gamestate information—such as making explicit exploration choices or pulling discovery tiles via research milestones—the turn is permanently locked for that round to preserve integrity and prevent unfair rollbacks.


Key Changes

🛠️ Core Player Model & Helpers

  • helpers/PlayerHelper.py
    • Added cannotRestart() getter to safely verify if a player is restricted from resetting.
    • Added setCannotRestart(bool) setter to manipulate the underlying cannot_restart state uniformly without exposing string keys across files.

🎮 Turn Lifecycle & Buttons

  • Buttons/Turn.py

    • Updated restartTurn to call player_helper.cannotRestart(), throwing a clear, ephemeral layout failure block if triggered.
    • Updated endTurn to automatically clear the lockout state via player_helper.setCannotRestart(False) when the player finishes their round.
  • Buttons/Explore.py

    • Injected player_helper.setCannotRestart(True) right at the start of resolution hooks to lock turn modification upon discovering sector layout data.
  • Buttons/Research.py

    • Restricts turn restarts by invoking player_helper.setCannotRestart(True) whenever a standard tech discovery tile is drawn or when Magellan triggers their 4th tech track milestone discovery tile.

👑 Admin & Override Commands

  • commands/player_commands.py
    • Exposed an optional admin slash command /player set_cannot_restart [cannot_restart: bool] [player: Member] to ease in-game tracking, edge case troubleshooting, or manual operator overrides.

Notes

** This does not interfere or break with feature "Undo Last Turn"


Introduces a centralized `cannot_restart` flag managed via `PlayerHelper` to replace the deprecated `has_explored` attribute. This establishes structural groundwork to prevent turn rollbacks whenever a player exposes hidden gamestate information.

Changes include:
- `helpers/PlayerHelper.py`: Added `cannotRestart()` getter and `setCannotRestart()` setter methods to safely handle the new state attribute.
- `Buttons/Turn.py`: Integrated `cannotRestart()` check into `restartTurn` to block resets, and ensured the flag resets to `False` inside `endTurn` when the player completes their turn.
- `Buttons/Explore.py`: Set the `cannot_restart` flag to `True` upon resolving an explicit exploration choice.
- `Buttons/Research.py`: Restricted turn restarts when a player draws discovery tiles via standard research items or triggers the Magellan 4th technology milestone.
- `commands/player_commands.py`: Added a `/player set_cannot_restart` admin Discord command for manual troubleshooting/overrides.
@chriscalip

Copy link
Copy Markdown
Author

Example shows cannot-restart after explore, this happens to planta players.
cannot-restart-explore-for-github

Example shows cannot-restart after magellan gets discovery tile on 4th tech track.
cannot-restart-magellan-for-github

@TaylorBoyd

Copy link
Copy Markdown
Contributor

Allowing restarts should be the default option. If the table decides they want to play extra strict then they can run a command to turn this feature on.

Though all of it seems somewhat moot considering you can still just undo your turn. If the goal is to prevent cheating, undo is still available and there are many ways to cheat. If we're not worried about cheaters with this feature then we are just punishing misclicks/mistakes/new players by forbidding restarts

@chriscalip

chriscalip commented Jun 18, 2026

Copy link
Copy Markdown
Author

@TaylorBoyd The idea is make it easy for a group of players have rule guard rails.
Prevent restart after a player saw hidden information already, a point of no return.

This feature puts guard rails on the following conditions:

  1. During a planta players explore action (2 explore tokens), the planta player already revealed a sector tile.
  2. When a magellan player reveals a discovery tile on research action (4th tech on track).
  3. When any player during a research action reveals a discovery tile.

Additionally, this feature lets a group or a player recover from a mistake; if they truly want to restart just use command /player set_cannot_restart False

@chriscalip

Copy link
Copy Markdown
Author

Allowing restarts should be the default option. If the table decides they want to play extra strict then they can run a command to turn this feature on.

Though all of it seems somewhat moot considering you can still just undo your turn. If the goal is to prevent cheating, undo is still available and there are many ways to cheat. If we're not worried about cheaters with this feature then we are just punishing misclicks/mistakes/new players by forbidding restarts

🟢 The Pros
Prioritizes a Better User Experience (UX): Playing tabletop games via a text-based Discord interface is naturally prone to typos, misclicks, and UI fat-fingering. Making "allow restarts" the default safeguards casual games, mistakes by new players, or fat-finger errors from instantly ruining a multi-hour session.

Exposes the "Security Theater" (The Undo Loophole): The commenter points out a major logical flaw: if players can still just use a manual undo command to bypass the lockout, this new feature doesn't actually stop a committed cheater. It creates a false sense of security while only adding friction for honest players.

Promotes Table Autonomy (Opt-in Strictness): By suggesting this be an opt-in toggle rather than a forced, global restriction, it allows casual groups to stay relaxed while letting highly competitive groups turn on "tournament mode" via a configuration command if they choose.

🔴 The Cons
Normalizes "Save Scumming" of Hidden Information: In a strategy game, information is a resource. If restarting after an exploration is allowed by default, players can "peek" at a hidden tile or tech draw, decide they don't like it, and restart their turn to try a completely different strategy. This fundamentally breaks game balance.

Puts the Enforcement Burden on the Host: If the strict anti-cheat feature is turned off by default, the game host or server administrator has to remember to run a manual configuration command before every single match. Important rules are usually safer when they are "secure by default."

The "Perfect Solution" Fallacy: Just because an undo command exists doesn't mean the developers shouldn't try to lock down smaller, accidental exploits. Preventing an easy turn-restart exploit inside the active UI buttons is still a valuable, incremental step toward game state integrity, even if a broader undo override command still exists in the background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants