перенос файлов сервера из папки White в _White

This commit is contained in:
Remuchi
2024-01-28 18:18:54 +07:00
parent 21dbccfec9
commit 1e4ad59270
309 changed files with 450 additions and 437 deletions

View File

@@ -0,0 +1,57 @@
using Content.Server.GameTicking;
using Content.Shared.GameTicking;
using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Weapons.Ranged.Events;
using Content.Shared.White;
using Robust.Shared.Configuration;
namespace Content.Server._White.EndOfRoundStats.ShotsFired;
public sealed class ShotsFiredStatSystem : EntitySystem
{
[Dependency] private readonly IConfigurationManager _config = default!;
int shotsFired = 0;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<GunComponent, AmmoShotEvent>(OnShotFired);
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEnd);
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
}
private void OnShotFired(EntityUid _, GunComponent __, AmmoShotEvent args)
{
shotsFired++;
}
private void OnRoundEnd(RoundEndTextAppendEvent ev)
{
var line = string.Empty;
line += GenerateShotsFired(shotsFired);
if (line != string.Empty)
ev.AddLine("\n[color=cadetblue]" + line + "[/color]");
}
private string GenerateShotsFired(int shotsFired)
{
if (shotsFired == 0 && _config.GetCVar<bool>(WhiteCVars.ShotsFiredDisplayNone))
return Loc.GetString("eorstats-shotsfired-noshotsfired");
if (shotsFired == 0 || shotsFired < _config.GetCVar<int>(WhiteCVars.ShotsFiredThreshold))
return string.Empty;
return Loc.GetString("eorstats-shotsfired-amount", ("shotsFired", shotsFired));
}
private void OnRoundRestart(RoundRestartCleanupEvent ev)
{
shotsFired = 0;
}
}