Remove warnings in Content.Server for _DV content (#5114)

* Cleanup datafields with matching autogenerated tag [RA0027]

* Remove unused dependencies [CS0414]

* Swap to AddMarkupOrThrow over PushMarkup [CS0618]

* Fix namespacing [CA1050]

* Prefer the generic overload [CA2263]

* Fix exception throwing [CA2208]

* Mark RoundStartCaptain as static [CA1822]

* Don't use string literal [RA0033]

* Remove un-needed null check [CS8073]

* Explicitly set webhookData to null [CS0649]

* Use protoId over bare string

* Prefer HasComp over TryComp with no usage of the actual comp
This commit is contained in:
BarryNorfolk 2026-01-06 17:31:51 +01:00 committed by GitHub
parent f7dbafc607
commit bf8cce52a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 51 additions and 68 deletions

View File

@ -11,7 +11,6 @@ namespace Content.Server._DV.Abilities.Chitinid;
public sealed partial class ChitinidSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly ItemCougherSystem _cougher = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;

View File

@ -9,7 +9,6 @@ namespace Content.Server._DV.Abilities.Kitsune;
public sealed class KitsuneFoxSystem : EntitySystem
{
[Dependency] private readonly PolymorphSystem _polymorph = default!;
[Dependency] private readonly SharedStaminaSystem _stamina = default!;
public override void Initialize()
{
@ -20,7 +19,7 @@ public sealed class KitsuneFoxSystem : EntitySystem
private void OnStunned(Entity<KitsuneFoxComponent> ent, ref StunnedEvent args)
{
if (!TryComp<PolymorphedEntityComponent>(ent, out var polymorph))
if (!HasComp<PolymorphedEntityComponent>(ent))
return;
_polymorph.Revert(ent.Owner);

View File

@ -27,7 +27,6 @@ public sealed class PrecognitionPowerSystem : EntitySystem
{
[Dependency] private readonly DoAfterSystem _doAfter = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly MindSystem _mind = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
@ -35,7 +34,6 @@ public sealed class PrecognitionPowerSystem : EntitySystem
[Dependency] private readonly StatusEffectsSystem _statusEffects = default!;
[Dependency] private readonly IChatManager _chat = default!;
[Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly MovementModStatusSystem _movementMod = default!;

View File

@ -25,6 +25,7 @@ public sealed class AddictionSystem : SharedAddictionSystem
private const int SuppressionDuration = 10;
private EntityQuery<AddictedComponent> _addicted;
private readonly ProtoId<LocalizedDatasetPrototype> _datasetId = "AddictionEffects";
public override void Initialize()
{
@ -86,7 +87,7 @@ public sealed class AddictionSystem : SharedAddictionSystem
private string GetRandomPopup()
{
return Loc.GetString(_random.Pick(_prototypeManager.Index<LocalizedDatasetPrototype>("AddictionEffects").Values));
return Loc.GetString(_random.Pick(_prototypeManager.Index<LocalizedDatasetPrototype>(_datasetId).Values));
}
private void DoAddictionEffect(EntityUid uid)

View File

@ -24,8 +24,6 @@ public sealed class SpawnPlayer : LocalizedEntityCommands
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IServerPreferencesManager _prefs = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly TraitSystem _trait = default!;
[Dependency] private readonly PlayTimeTrackingManager _playTimeTracking = default!;
public override string Command => "spawnplayer";

View File

@ -89,7 +89,7 @@ public sealed partial class CargoSystem
{
Components =
[
Factory.GetComponentName(typeof(CargoShuttleComponent))
Factory.GetComponentName<CargoShuttleComponent>()
]
};

View File

@ -13,7 +13,7 @@ public sealed partial class PricingSystem
/// <returns>The modified price.</returns>
private double ApplyPrototypePriceModifier(EntityPrototype prototype, double basePrice)
{
if (prototype.Components.TryGetValue(Factory.GetComponentName(typeof(PriceModifierComponent)),
if (prototype.Components.TryGetValue(Factory.GetComponentName<PriceModifierComponent>(),
out var modProto))
{
var priceModifier = (PriceModifierComponent)modProto.Component;

View File

@ -109,7 +109,7 @@ public sealed class StockMarketSystem : EntitySystem
break;
default:
throw new ArgumentOutOfRangeException();
throw new InvalidOperationException($"Unknown UiAction type [{message.Action}]");
}
// Play confirmation sound if the transaction was successful

View File

@ -18,7 +18,6 @@ public sealed class CosmicConversionSystem : EntitySystem
[Dependency] private readonly CosmicCultRuleSystem _cultRule = default!;
[Dependency] private readonly CosmicGlyphSystem _cosmicGlyph = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly SharedCosmicCultSystem _cosmicCult = default!;

View File

@ -74,7 +74,6 @@ public sealed class CosmicCultRuleSystem : GameRuleSystem<CosmicCultRuleComponen
[Dependency] private readonly AntagSelectionSystem _antag = default!;
[Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly ChatSystem _chatSystem = default!;
[Dependency] private readonly DamageableSystem _damage = default!;
[Dependency] private readonly EmergencyShuttleSystem _emergency = default!;
[Dependency] private readonly EuiManager _euiMan = default!;
[Dependency] private readonly GhostSystem _ghost = default!;

View File

@ -27,15 +27,12 @@ namespace Content.Server._DV.CosmicCult;
public sealed class DeconversionSystem : EntitySystem
{
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly SharedJitteringSystem _jittering = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedToolSystem _tools = default!;
[Dependency] private readonly UseDelaySystem _delay = default!;
[Dependency] private readonly SharedStunSystem _stun = default!;
[Dependency] private readonly SharedMindSystem _mind = default!;
[Dependency] private readonly IPlayerManager _playerMan = default!;

View File

@ -12,7 +12,6 @@ namespace Content.Server._DV.CosmicCult.EntitySystems;
public sealed partial class CosmicEntropyDegenSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
public override void Initialize()

View File

@ -54,7 +54,7 @@ public sealed partial class CwoinkSystem : SharedCwoinkSystem
private static partial Regex DiscordRegex();
private string _webhookUrl = string.Empty;
private WebhookData? _webhookData;
private WebhookData? _webhookData = null;
private readonly HttpClient _httpClient = new();
@ -523,8 +523,7 @@ public sealed partial class CwoinkSystem : SharedCwoinkSystem
GameRunLevel.PreRoundLobby => "\n\n:arrow_forward: _**Pre-round lobby started**_\n",
GameRunLevel.InRound => "\n\n:arrow_forward: _**Round started**_\n",
GameRunLevel.PostRound => "\n\n:stop_button: _**Post-round started**_\n",
_ => throw new ArgumentOutOfRangeException(nameof(_gameTicker.RunLevel),
$"{_gameTicker.RunLevel} was not matched."),
_ => throw new InvalidOperationException( $"{_gameTicker.RunLevel} was not matched."),
};
existingEmbed.LastRunLevel = _gameTicker.RunLevel;
@ -615,8 +614,7 @@ public sealed partial class CwoinkSystem : SharedCwoinkSystem
: $"pre-round lobby for round {_gameTicker.RoundId + 1}",
GameRunLevel.InRound => $"round {_gameTicker.RoundId}",
GameRunLevel.PostRound => $"post-round {_gameTicker.RoundId}",
_ => throw new ArgumentOutOfRangeException(nameof(_gameTicker.RunLevel),
$"{_gameTicker.RunLevel} was not matched."),
_ => throw new InvalidOperationException( $"{_gameTicker.RunLevel} was not matched."),
};
return new WebhookPayload

View File

@ -40,7 +40,6 @@ public sealed class ExecutionSystem : EntitySystem
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
[Dependency] private readonly InteractionSystem _interactionSystem = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
@ -262,7 +261,7 @@ public sealed class ExecutionSystem : EntitySystem
break;
default:
throw new ArgumentOutOfRangeException();
throw new InvalidOperationException($"Unknown shootable type [{ev.Ammo[0].Shootable}]");
}
// Clumsy people have a chance to shoot themselves (not in the head)

View File

@ -44,7 +44,6 @@ public sealed partial class GrapplingSystem : SharedGrapplingSystem
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly StandingStateSystem _standingState = default!;
[Dependency] private readonly TagSystem _tag = default!;
[Dependency] private readonly SharedVirtualItemSystem _virtual = default!;
private ProtoId<TagPrototype> _grappleTargetId = "GrappleTarget";

View File

@ -6,21 +6,21 @@ namespace Content.Server.Roboisseur.Roboisseur
public sealed partial class RoboisseurComponent : Component
{
[ViewVariables]
[DataField("accumulator")]
[DataField]
public float Accumulator = 0f;
[ViewVariables(VVAccess.ReadOnly)]
[DataField("impatient")]
[DataField]
public Boolean Impatient { get; set; } = false;
[ViewVariables]
[DataField("resetTime")]
[DataField]
public TimeSpan ResetTime = TimeSpan.FromMinutes(10);
[DataField("barkAccumulator")]
[DataField]
public float BarkAccumulator = 0f;
[DataField("barkTime")]
[DataField]
public TimeSpan BarkTime = TimeSpan.FromMinutes(1);
/// <summary>
@ -28,7 +28,7 @@ namespace Content.Server.Roboisseur.Roboisseur
/// </summary>
public TimeSpan StateTime = default!;
[DataField("stateCD")]
[DataField]
public TimeSpan StateCD = TimeSpan.FromSeconds(5);
[ViewVariables(VVAccess.ReadWrite)]

View File

@ -21,7 +21,6 @@ namespace Content.Server.Roboisseur.Roboisseur
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly MaterialStorageSystem _material = default!;
[Dependency] private readonly AppearanceSystem _appearance = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IAdminLogManager _adminLog = default!;

View File

@ -1,7 +1,9 @@
using Content.Server.Objectives.Systems;
using Content.Server._DV.Objectives.Systems;
using Content.Shared.Roles;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Server._DV.Objectives.Components;
/// <summary>
/// Requires that the player not have a certain job to have this objective.
/// </summary>

View File

@ -1,8 +1,8 @@
using Content.Server.Objectives.Components;
using Content.Server._DV.Objectives.Components;
using Content.Shared.Objectives.Components;
using Content.Shared.Roles.Components;
namespace Content.Server.Objectives.Systems;
namespace Content.Server._DV.Objectives.Systems;
/// <summary>
/// Handles checking the job blacklist for this objective.

View File

@ -77,7 +77,7 @@ public sealed class AutomaticSpareIdSystem : EntitySystem
MoveToAlerted(ent);
}
private void RoundStartCaptain(Entity<AutomaticSpareIdComponent> ent)
private static void RoundStartCaptain(Entity<AutomaticSpareIdComponent> ent)
{
ent.Comp.State = AutomaticSpareIdState.CaptainPresent;
ent.Comp.Timeout = null;

View File

@ -16,46 +16,46 @@ public sealed partial class MeteorSwarmRuleComponent : Component
[DataField("waves")]
public int? WaveCounter = null;
[DataField("minimumWaves")]
[DataField]
public int MinimumWaves = 3;
[DataField("maximumWaves")]
[DataField]
public int MaximumWaves = 8;
[DataField("minimumCooldown")]
[DataField]
public float MinimumCooldown = 10f;
[DataField("maximumCooldown")]
[DataField]
public float MaximumCooldown = 60f;
[DataField("meteorsPerWave")]
[DataField]
public int MeteorsPerWave = 5;
[DataField("meteorVelocity")]
[DataField]
public float MeteorVelocity = 10f;
[DataField("maxAngularVelocity")]
[DataField]
public float MaxAngularVelocity = 2f;
[DataField("minAngularVelocity")]
[DataField]
public float MinAngularVelocity = -2f;
/// <summary>
/// Stagger the spawns a bit, but not too much so they still come in waves
/// </summary>
[DataField("spawnDistanceVariation")]
[DataField]
public float SpawnDistanceVariation = 50f;
/// <summary>
/// Percentage of the station area to target. Allow for some near-miss fly-by meteors to jump-scare crew on EVAs.
/// Stations aren't perfect rectangles like the targeting area, so even 1.0 will still have some near-misses.
/// </summary>
[DataField("targetingSpread")]
[DataField]
public float TargetingSpread = 1.05f;
/// <summary>
/// How long before a meteor despawns (in case it missed everything).
/// </summary>
[DataField("meteorLifetime")]
[DataField]
public float MeteorLifetime = 300f;
}

View File

@ -10,7 +10,7 @@ public sealed partial class MinorMassMindSwapRuleComponent : Component
/// <summary>
/// The mind swap is only temporary if true.
/// </summary>
[DataField("isTemporary")]
[DataField]
public bool IsTemporary = false;
[DataField]

View File

@ -108,35 +108,35 @@ public sealed class FugitiveRule : StationEventSystem<FugitiveRuleComponent>
private FormattedMessage GenerateReport(EntityUid uid, FugitiveRuleComponent rule)
{
var report = new FormattedMessage();
report.PushMarkup(Loc.GetString("fugitive-report-title"));
report.AddMarkupOrThrow(Loc.GetString("fugitive-report-title"));
report.PushNewline();
report.PushMarkup(Loc.GetString("fugitive-report-first-line"));
report.AddMarkupOrThrow(Loc.GetString("fugitive-report-first-line"));
report.PushNewline();
if (!TryComp<HumanoidAppearanceComponent>(uid, out var humanoid))
{
report.AddMarkup(Loc.GetString("fugitive-report-inhuman", ("name", uid)));
report.AddMarkupOrThrow(Loc.GetString("fugitive-report-inhuman", ("name", uid)));
return report;
}
var species = PrototypeManager.Index(humanoid.Species);
report.PushMarkup(Loc.GetString("fugitive-report-morphotype", ("species", Loc.GetString(species.Name))));
report.PushMarkup(Loc.GetString("fugitive-report-age", ("age", humanoid.Age)));
report.PushMarkup(Loc.GetString("fugitive-report-sex", ("sex", humanoid.Sex.ToString())));
report.AddMarkupOrThrow(Loc.GetString("fugitive-report-morphotype", ("species", Loc.GetString(species.Name))));
report.AddMarkupOrThrow(Loc.GetString("fugitive-report-age", ("age", humanoid.Age)));
report.AddMarkupOrThrow(Loc.GetString("fugitive-report-sex", ("sex", humanoid.Sex.ToString())));
if (TryComp<PhysicsComponent>(uid, out var physics))
report.PushMarkup(Loc.GetString("fugitive-report-weight", ("weight", Math.Round(physics.FixturesMass))));
report.AddMarkupOrThrow(Loc.GetString("fugitive-report-weight", ("weight", Math.Round(physics.FixturesMass))));
// add a random identifying quality that officers can use to track them down
report.PushMarkup(RobustRandom.Next(0, 2) switch
report.AddMarkupOrThrow(RobustRandom.Next(0, 2) switch
{
0 => Loc.GetString("fugitive-report-detail-dna", ("dna", GetDNA(uid))),
_ => Loc.GetString("fugitive-report-detail-prints", ("prints", GetPrints(uid)))
});
report.PushNewline();
report.PushMarkup(Loc.GetString("fugitive-report-crimes-header"));
report.AddMarkupOrThrow(Loc.GetString("fugitive-report-crimes-header"));
// generate some random crimes to avoid this situation
// "officer what are my charges?"
@ -144,7 +144,7 @@ public sealed class FugitiveRule : StationEventSystem<FugitiveRuleComponent>
AddCharges(report, rule);
report.PushNewline();
report.AddMarkup(Loc.GetString("fugitive-report-last-line"));
report.AddMarkupOrThrow(Loc.GetString("fugitive-report-last-line"));
return report;
}
@ -172,7 +172,7 @@ public sealed class FugitiveRule : StationEventSystem<FugitiveRuleComponent>
foreach (var crime in crimes)
{
var count = RobustRandom.Next(rule.MinCounts, rule.MaxCounts + 1);
report.PushMarkup(Loc.GetString("fugitive-report-crime", ("crime", Loc.GetString(crime)), ("count", count)));
report.AddMarkupOrThrow(Loc.GetString("fugitive-report-crime", ("crime", Loc.GetString(crime)), ("count", count)));
}
}
}

View File

@ -16,14 +16,14 @@ public sealed partial class EnergyGunComponent : Component
/// <summary>
/// A list of the different firing modes the energy gun can switch between
/// </summary>
[DataField("fireModes", required: true)]
[DataField(required: true)]
[AutoNetworkedField]
public List<EnergyWeaponFireMode> FireModes = new();
/// <summary>
/// The currently selected firing mode
/// </summary>
[DataField("currentFireMode")]
[DataField]
[AutoNetworkedField]
public EnergyWeaponFireMode? CurrentFireMode = default!;
}
@ -40,18 +40,18 @@ public sealed partial class EnergyWeaponFireMode
/// <summary>
/// The battery cost to fire the projectile associated with this firing mode
/// </summary>
[DataField("fireCost")]
[DataField]
public float FireCost = 100;
/// <summary>
/// The name of the selected firemode
/// </summary>
[DataField("name")]
[DataField]
public string Name = string.Empty;
/// <summary>
/// What RsiState we use for that firemode if it needs to change.
/// </summary>
[DataField("state")]
[DataField]
public string State = string.Empty;
}

View File

@ -4,6 +4,7 @@ using Content.Server.Psionics;
using Content.Shared.Xenoarchaeology.Artifact;
using Content.Shared.Xenoarchaeology.Artifact.Components;
namespace Content.Server._DV.Xenoarchaeology.XenoArtifacts.Effects.Systems;
public sealed class PsionicProducingArtifactSystem : EntitySystem
{
[Dependency] private readonly SharedXenoArtifactSystem _artifact = default!;
@ -31,8 +32,6 @@ public sealed class PsionicProducingArtifactSystem : EntitySystem
// Pick first active node
var node = _artifact.GetActiveNodes(artifactEntity).FirstOrDefault();
if (node == null)
return;
// Track psionic usage using ConsumedResearchValue
var currentAmount = _artifact.GetResearchValue(node);

View File

@ -9,8 +9,6 @@ namespace Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Systems;
public sealed class ArtifactMetapsionicTriggerSystem : BaseXATSystem<ArtifactMetapsionicTriggerComponent>
{
[Dependency] private readonly XenoArtifactSystem _artifact = default!;
private EntityQuery<XenoArtifactComponent> _xenoArtifactQuery;
public override void Initialize()