Skip to content

Commit

Permalink
The mop stat now displays correctly (and is less dumb) (#217)
Browse files Browse the repository at this point in the history
# Changelog

<!-- You can add an author after the `:cl:` to change the name that
appears in the changelog, ex: `:cl: Death`, it will default to your
GitHub display name -->

:cl:
- fix: Fixed mopping end of round stat.
  • Loading branch information
Pspritechologist authored Oct 13, 2023
1 parent d9dbb60 commit f3f1a7a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Content.Server/Fluids/EntitySystems/AbsorbentSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Popups;
using Content.Server.SimpleStation14.EndOfRoundStats.MopUsed; // Parkstation-EndOfRoundStats
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
Expand Down Expand Up @@ -213,6 +214,8 @@ private bool TryPuddleInteract(EntityUid user, EntityUid used, EntityUid target,
puddleSolution.AddReagent(PuddleSystem.EvaporationReagent, split.Volume);
absorberSoln.AddSolution(split, _prototype);

RaiseLocalEvent(new MopUsedStatEvent(user, split.Volume)); // Parkstation-EndOfRoundStats

_solutionSystem.UpdateChemicals(used, absorberSoln);
_solutionSystem.UpdateChemicals(target, puddleSolution);
_audio.PlayPvs(absorber.PickupSound, target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ namespace Content.Server.SimpleStation14.EndOfRoundStats.MopUsed;

public sealed class MopUsedStatEvent : EntityEventArgs
{
public String Mopper;
public EntityUid Mopper;
public FixedPoint2 AmountMopped;
public String? Username;

public MopUsedStatEvent(String mopper, FixedPoint2 amountMopped, String? username)
public MopUsedStatEvent(EntityUid mopper, FixedPoint2 amountMopped)
{
Mopper = mopper;
AmountMopped = amountMopped;
Username = username;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq;
using Content.Server.GameTicking;
using Content.Server.Mind;
using Content.Shared.FixedPoint;
using Content.Shared.GameTicking;
using Content.Shared.SimpleStation14.CCVar;
Expand All @@ -10,6 +11,7 @@ namespace Content.Server.SimpleStation14.EndOfRoundStats.MopUsed;
public sealed class MopUsedStatSystem : EntitySystem
{
[Dependency] private readonly IConfigurationManager _config = default!;
[Dependency] private readonly MindSystem _mind = default!;


Dictionary<MopperData, FixedPoint2> userMopStats = new();
Expand Down Expand Up @@ -37,10 +39,13 @@ private void OnMopUsed(MopUsedStatEvent args)
{
timesMopped++;

var name = MetaData(args.Mopper).EntityName;
var username = _mind.TryGetMind(args.Mopper, out var mind) && mind.Session != null ? mind.Session.Name : null;

var mopperData = new MopperData
{
Name = args.Mopper,
Username = args.Username
Name = name,
Username = username
};

if (userMopStats.ContainsKey(mopperData))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ eorstats-mop-amountmopped = A total of [color={$impressColor}]{$amountMopped}[/c
eorstats-mop-topmopper-header = The top moppers were:
eorstats-mop-topmopper-hasusername = [color={$impressColor}]{$place}. {$name} with {$amountMopped} units mopped![/color]
eorstats-mop-topmopper-hasnousername = [color={$impressColor}]{$place}. {$username} as {$name} with {$amountMopped} units mopped![/color]
eorstats-mop-topmopper-hasusername = [color={$impressColor}]{$place}. {$username} as {$name} with {$amountMopped} units mopped![/color]
eorstats-mop-topmopper-hasnousername = [color={$impressColor}]{$place}. {$name} with {$amountMopped} units mopped![/color]
eorstats-mop-noamountmopped = Not one puddle was mopped this round!

0 comments on commit f3f1a7a

Please sign in to comment.