Skip to content

Fix ClassDAreTeammates config being ignored for Class-D friendly fire - #12

Open
dualfroz wants to merge 1 commit into
Vretu-Dev:mainfrom
dualfroz:fix/classd-teammates-friendly-fire
Open

Fix ClassDAreTeammates config being ignored for Class-D friendly fire#12
dualfroz wants to merge 1 commit into
Vretu-Dev:mainfrom
dualfroz:fix/classd-teammates-friendly-fire

Conversation

@dualfroz

@dualfroz dualfroz commented Sep 5, 2026

Copy link
Copy Markdown

Problem

Repo: Vretu-Dev/UsefulHints
Base: main
Head: dualfroz:fix/classd-teammates-friendly-fire
No tracking issue (behaviour bug found while reading the source; nothing to Closes).


The ClassDAreTeammates option currently has no effect. In FFWarning.OnHurting
the if branch that gated the warning on Config.ClassDAreTeammates and its else
branch were identical:

if (ev.Attacker.Role.Team == Team.ClassD && ev.Player.Role.Team == Team.ClassD && Config.ClassDAreTeammates)
{
    ev.Attacker.ShowHint(string.Format(Config.FriendlyFireWarning), 1);
    ev.Player.ShowHint(string.Format(Config.DamageTakenWarning, ev.Attacker.Nickname), 2);
}
else
{
    ev.Attacker.ShowHint(string.Format(Config.FriendlyFireWarning), 1);
    ev.Player.ShowHint(string.Format(Config.DamageTakenWarning, ev.Attacker.Nickname), 2);
}

Both paths showed the warning, so setting ClassDAreTeammates: false still fired the
friendly-fire warning when one Class-D hurt another.

This collapses the duplicated branches into a single guarded block, so the warning is
skipped only for the intended case: two Class-D players hurting each other while
ClassDAreTeammates is false. Every other same-side pairing (MTF, Chaos, etc.) is
unchanged.

Root cause: UsefulHints/EventHandlers/Modules/FFWarning.cs, lines 28-38 (parent
commit 3c4e6b0), inside FFWarning.OnHurting.

Flags

SECURITY.md found in this repository; README.md has no AI-disclosure or
CLA/DCO language either. No policy gate applies.

  • No open upstream PR or issue covers this bug (checked
    pulls?state=open&per_page=100 and all issues, all-time, on
    Vretu-Dev/UsefulHints).

Limitations

  • Full project build not verified in this environment (see Verification above);
    only the isolated boolean-logic extraction was run.
  • No automated test suite exists in the repository to regression-guard this fix.

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.

1 participant