Skip to content

Commit

Permalink
Also check total selections
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus committed Dec 19, 2024
1 parent 09741da commit 92a1c73
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Content.Server/Traits/TraitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public override void Initialize()
private void OnPlayerSpawnComplete(PlayerSpawnCompleteEvent args)
{
var pointsTotal = _configuration.GetCVar(CCVars.GameTraitsDefaultPoints);
var traitSelections = _configuration.GetCVar(CCVars.GameTraitsMax);

foreach (var traitId in args.Profile.TraitPreferences)
{
Expand All @@ -65,11 +66,12 @@ private void OnPlayerSpawnComplete(PlayerSpawnCompleteEvent args)

// To check for cheaters. :FaridaBirb.png:
pointsTotal += traitPrototype.Points;
--traitSelections;

AddTrait(args.Mob, traitPrototype);
}

if (pointsTotal < 0)
if (pointsTotal < 0 || traitSelections < 0)
PunishCheater(args.Mob);
}

Expand Down

0 comments on commit 92a1c73

Please sign in to comment.