Fixing some warnings (#6250)

Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com>
This commit is contained in:
wrexbe
2022-01-21 01:38:35 -08:00
committed by GitHub
parent 29b22e2871
commit cea1b21832
191 changed files with 341 additions and 340 deletions

View File

@@ -66,12 +66,12 @@ namespace Content.Server.AI.Operators.Combat.Melee
return Outcome.Success;
}
if (!_entMan.TryGetComponent(_owner, out HandsComponent? hands) || hands.GetActiveHand == null)
if (!_entMan.TryGetComponent(_owner, out HandsComponent? hands) || hands.GetActiveHandItem == null)
{
return Outcome.Failed;
}
var meleeWeapon = hands.GetActiveHand.Owner;
var meleeWeapon = hands.GetActiveHandItem.Owner;
_entMan.TryGetComponent(meleeWeapon, out MeleeWeaponComponent? meleeWeaponComponent);
if ((_entMan.GetComponent<TransformComponent>(_target).Coordinates.Position - _entMan.GetComponent<TransformComponent>(_owner).Coordinates.Position).Length >

View File

@@ -146,19 +146,19 @@ namespace Content.Server.AI.Pathfinding
{
var chunkX = (int) (Math.Floor((float) tile.X / PathfindingChunk.ChunkSize) * PathfindingChunk.ChunkSize);
var chunkY = (int) (Math.Floor((float) tile.Y / PathfindingChunk.ChunkSize) * PathfindingChunk.ChunkSize);
var Vector2i = new Vector2i(chunkX, chunkY);
var vector2i = new Vector2i(chunkX, chunkY);
if (_graph.TryGetValue(tile.GridIndex, out var chunks))
{
if (!chunks.ContainsKey(Vector2i))
if (!chunks.ContainsKey(vector2i))
{
CreateChunk(tile.GridIndex, Vector2i);
CreateChunk(tile.GridIndex, vector2i);
}
return chunks[Vector2i];
return chunks[vector2i];
}
var newChunk = CreateChunk(tile.GridIndex, Vector2i);
var newChunk = CreateChunk(tile.GridIndex, vector2i);
return newChunk;
}

View File

@@ -28,7 +28,6 @@ namespace Content.Server.AI.Utility
internal sealed class NpcBehaviorManager : INpcBehaviorManager
{
[Dependency] private readonly IDynamicTypeFactory _typeFactory = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
private readonly NpcActionComparer _comparer = new();

View File

@@ -15,7 +15,7 @@ namespace Content.Server.AI.WorldState.States.Inventory
public override EntityUid? GetValue()
{
return IoCManager.Resolve<IEntityManager>().GetComponentOrNull<HandsComponent>(Owner)?.GetActiveHand?.Owner;
return IoCManager.Resolve<IEntityManager>().GetComponentOrNull<HandsComponent>(Owner)?.GetActiveHandItem?.Owner;
}
}
}

View File

@@ -132,7 +132,7 @@ namespace Content.Server.AME.Components
return;
}
var activeHandEntity = hands.GetActiveHand?.Owner;
var activeHandEntity = hands.GetActiveHandItem?.Owner;
if (activeHandEntity == null)
{
UserInterface?.Open(actor.PlayerSession);
@@ -341,13 +341,13 @@ namespace Content.Server.AME.Components
return true;
}
if (hands.GetActiveHand == null)
if (hands.GetActiveHandItem == null)
{
Owner.PopupMessage(args.User, Loc.GetString("ame-controller-component-interact-using-nothing-in-hands-text"));
return false;
}
var activeHandEntity = hands.GetActiveHand.Owner;
var activeHandEntity = hands.GetActiveHandItem.Owner;
if (_entities.HasComponent<AMEFuelContainerComponent?>(activeHandEntity))
{
if (HasJar)

View File

@@ -167,7 +167,7 @@ namespace Content.Server.Atmos.Components
if (!_entities.TryGetComponent(playerEntity, out HandsComponent? handsComponent))
return;
if (handsComponent?.GetActiveHand?.Owner is not {Valid: true} activeHandEntity ||
if (handsComponent?.GetActiveHandItem?.Owner is not {Valid: true} activeHandEntity ||
!_entities.TryGetComponent(activeHandEntity, out GasAnalyzerComponent? gasAnalyzer))
{
return;
@@ -234,7 +234,7 @@ namespace Content.Server.Atmos.Components
return;
}
if (handsComponent.GetActiveHand?.Owner is not {Valid: true} activeHandEntity ||
if (handsComponent.GetActiveHandItem?.Owner is not {Valid: true} activeHandEntity ||
!_entities.TryGetComponent(activeHandEntity, out GasAnalyzerComponent? gasAnalyzer))
{
serverMsg.Session.AttachedEntity.Value.PopupMessage(Loc.GetString("gas-analyzer-component-need-gas-analyzer-in-hand-message"));

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Diagnostics.CodeAnalysis;
using Content.Shared.Atmos;
using Content.Shared.MobState.Components;
@@ -45,6 +45,8 @@ namespace Content.Server.Atmos.Components
{
if (!_entMan.TryGetComponent(Owner, out PhysicsComponent? physics))
return;
if (!_entMan.TryGetComponent(Owner, out FixturesComponent? fixtureComponent))
return;
// TODO ATMOS stuns?
@@ -65,8 +67,7 @@ namespace Content.Server.Atmos.Components
if (_entMan.HasComponent<MobStateComponent>(physics.Owner))
{
physics.BodyStatus = BodyStatus.InAir;
foreach (var fixture in physics.Fixtures)
foreach (var fixture in fixtureComponent.Fixtures.Values)
{
fixture.CollisionMask &= ~(int) CollisionGroup.VaultImpassable;
}

View File

@@ -14,7 +14,6 @@ namespace Content.Server.Atmos.EntitySystems
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SpreaderSystem _spreaderSystem = default!;
public override void Initialize()
{

View File

@@ -428,7 +428,7 @@ namespace Content.Server.Botany.Components
{
if (_entMan.TryGetComponent(user, out HandsComponent? hands))
{
if (!Seed.CheckHarvest(user, hands.GetActiveHand?.Owner))
if (!Seed.CheckHarvest(user, hands.GetActiveHandItem?.Owner))
return false;
}
else if (!Seed.CheckHarvest(user))

View File

@@ -89,7 +89,7 @@ namespace Content.Server.Chat.Commands
// Held item suicide
var handsComponent = _entities.GetComponent<HandsComponent>(owner);
var itemComponent = handsComponent.GetActiveHand;
var itemComponent = handsComponent.GetActiveHandItem;
if (itemComponent != null)
{
var suicide = _entities.GetComponents<ISuicideAct>(itemComponent.Owner).FirstOrDefault();

View File

@@ -407,7 +407,7 @@ namespace Content.Server.Chemistry.Components
return;
}
var activeHandEntity = hands.GetActiveHand?.Owner;
var activeHandEntity = hands.GetActiveHandItem?.Owner;
if (activeHandEntity == null)
{
UserInterface?.Open(actor.PlayerSession);

View File

@@ -295,7 +295,7 @@ namespace Content.Server.Chemistry.Components
return;
}
var activeHandEntity = hands.GetActiveHand?.Owner;
var activeHandEntity = hands.GetActiveHandItem?.Owner;
if (activeHandEntity == null)
{
UserInterface?.Open(actor.PlayerSession);

View File

@@ -1,4 +1,4 @@
using System;
using System;
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Coordinates.Helpers;
@@ -44,13 +44,6 @@ namespace Content.Server.Chemistry.ReactionEffects
/// </summary>
[DataField("reagentDilutionFactor")] private float _reagentDilutionFactor = 1f;
/// <summary>
/// Used to calculate concentration. Reagents get linearly more concentrated as the range goes from
/// _reagentDilutionStart to zero. When the range is zero the reagents volume gets multiplied by this.
/// </summary>
[DataField("reagentMaxConcentrationFactor")]
private float _reagentMaxConcentrationFactor = 2;
/// <summary>
/// How many seconds will the effect stay, counting after fully spreading.
/// </summary>

View File

@@ -208,7 +208,7 @@ namespace Content.Server.Climbing.Components
var result = await EntitySystem.Get<DoAfterSystem>().WaitDoAfter(doAfterEventArgs);
if (result != DoAfterStatus.Cancelled && _entities.TryGetComponent(user, out PhysicsComponent? body) && body.Fixtures.Count >= 1)
if (result != DoAfterStatus.Cancelled && _entities.TryGetComponent(user, out FixturesComponent? fixtureComp) && fixtureComp.Fixtures.Count >= 1)
{
// TODO: Remove the copy-paste code
var userPos = _entities.GetComponent<TransformComponent>(user).WorldPosition;

View File

@@ -21,7 +21,7 @@ namespace Content.Server.Climbing.Components
get => base.IsClimbing;
set
{
if (_isClimbing == value)
if (base.IsClimbing == value)
return;
base.IsClimbing = value;
@@ -102,7 +102,7 @@ namespace Content.Server.Climbing.Components
public override ComponentState GetComponentState()
{
return new ClimbModeComponentState(_isClimbing, OwnerIsTransitioning);
return new ClimbModeComponentState(base.IsClimbing, OwnerIsTransitioning);
}
}
}

View File

@@ -400,7 +400,7 @@ namespace Content.Server.Construction
}
if (!Get<ActionBlockerSystem>().CanInteract(user)
|| !EntityManager.TryGetComponent(user, out HandsComponent? hands) || hands.GetActiveHand == null
|| !EntityManager.TryGetComponent(user, out HandsComponent? hands) || hands.GetActiveHandItem == null
|| !user.InRangeUnobstructed(ev.Location, ignoreInsideBlocker:constructionPrototype.CanBuildInImpassable))
{
Cleanup();
@@ -417,7 +417,7 @@ namespace Content.Server.Construction
var valid = false;
if (hands.GetActiveHand?.Owner is not {Valid: true} holding)
if (hands.GetActiveHandItem?.Owner is not {Valid: true} holding)
{
Cleanup();
return;

View File

@@ -173,7 +173,7 @@ namespace Content.Server.Disposal.Tube.Components
return;
}
var activeHandEntity = hands.GetActiveHand?.Owner;
var activeHandEntity = hands.GetActiveHandItem?.Owner;
if (activeHandEntity == null)
{
OpenUserInterface(actor);

View File

@@ -139,7 +139,7 @@ namespace Content.Server.Disposal.Tube.Components
return;
}
var activeHandEntity = hands.GetActiveHand?.Owner;
var activeHandEntity = hands.GetActiveHandItem?.Owner;
if (activeHandEntity == null)
{
OpenUserInterface(actor);

View File

@@ -53,7 +53,7 @@ namespace Content.Server.DoAfter
if (eventArgs.NeedHand && entityManager.TryGetComponent(eventArgs.User, out HandsComponent? handsComponent))
{
_activeHand = handsComponent.ActiveHand;
_activeItem = handsComponent.GetActiveHand;
_activeItem = handsComponent.GetActiveHandItem;
}
Tcs = new TaskCompletionSource<DoAfterStatus>();
@@ -157,7 +157,7 @@ namespace Content.Server.DoAfter
return true;
}
var currentItem = handsComponent.GetActiveHand;
var currentItem = handsComponent.GetActiveHandItem;
if (_activeItem != currentItem)
{
return true;

View File

@@ -18,6 +18,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Timing;
@@ -142,7 +143,12 @@ namespace Content.Server.Explosion.EntitySystems
continue;
}
if (!EntityManager.TryGetComponent(entity, out PhysicsComponent? body) || body.Fixtures.Count < 1)
if (!EntityManager.TryGetComponent(entity, out FixturesComponent? fixturesComp) || fixturesComp.Fixtures.Count < 1)
{
continue;
}
if (!EntityManager.TryGetComponent(entity, out PhysicsComponent? body))
{
continue;
}

View File

@@ -39,7 +39,6 @@ namespace Content.Server.Explosion.EntitySystems
{
[Dependency] private readonly ExplosionSystem _explosions = default!;
[Dependency] private readonly FlashSystem _flashSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!;
public override void Initialize()
{

View File

@@ -25,7 +25,7 @@ namespace Content.Server.GameTicking
private TimeSpan _pauseTime;
[ViewVariables]
public bool Paused { get; set; }
public new bool Paused { get; set; }
[ViewVariables]
private bool _roundStartCountdownHasNotStartedYetDueToNoPlayers;

View File

@@ -20,7 +20,7 @@ public abstract class GameRuleSystem : EntitySystem
/// When the GameRule prototype with this ID is added, this system will be enabled.
/// When it gets removed, this system will be disabled.
/// </summary>
public abstract string Prototype { get; }
public new abstract string Prototype { get; }
public override void Initialize()
{

View File

@@ -149,7 +149,7 @@ namespace Content.Server.Hands.Components
/// <summary>
/// Tries to get the ItemComponent off the entity in the active hand.
/// </summary>
public SharedItemComponent? GetActiveHand
public SharedItemComponent? GetActiveHandItem
{
get
{

View File

@@ -320,7 +320,7 @@ namespace Content.Server.Interaction
// Verify user has a hand, and find what object they are currently holding in their active hand
if (TryComp(user, out HandsComponent? hands))
{
var item = hands.GetActiveHand?.Owner;
var item = hands.GetActiveHandItem?.Owner;
if (item != null && !Deleted(item.Value))
{

View File

@@ -36,7 +36,7 @@ namespace Content.Server.Inventory
if (!TryComp<HandsComponent>(ev.Uid, out var hands) || !TryGetSlotEntity(ev.Uid, ev.Slot, out var itemUid))
return;
var activeHand = hands.GetActiveHand;
var activeHand = hands.GetActiveHandItem;
if (activeHand != null)
{
_interactionSystem.InteractUsing(ev.Uid, activeHand.Owner, itemUid.Value,

View File

@@ -243,7 +243,7 @@ namespace Content.Server.Kitchen.Components
return false;
}
if (_entities.GetComponent<HandsComponent>(eventArgs.User).GetActiveHand?.Owner is not {Valid: true} itemEntity)
if (_entities.GetComponent<HandsComponent>(eventArgs.User).GetActiveHandItem?.Owner is not {Valid: true} itemEntity)
{
eventArgs.User.PopupMessage(Loc.GetString("microwave-component-interact-using-no-active-hand"));
return false;

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Content.Shared.Lathe;
using Robust.Shared.GameObjects;
using Robust.Shared.Players;
@@ -40,28 +40,28 @@ namespace Content.Server.Lathe.Components
/// <summary>
/// Checks if it can insert a material.
/// </summary>
/// <param name="ID">Material ID</param>
/// <param name="id">Material ID</param>
/// <param name="amount">How much to insert</param>
/// <returns>Whether it can insert the material or not.</returns>
public bool CanInsertMaterial(string ID, int amount)
public bool CanInsertMaterial(string id, int amount)
{
return (CanTakeAmount(amount) || StorageLimit < 0) && (!Storage.ContainsKey(ID) || Storage[ID] + amount >= 0);
return (CanTakeAmount(amount) || StorageLimit < 0) && (!Storage.ContainsKey(id) || Storage[id] + amount >= 0);
}
/// <summary>
/// Inserts material into the storage.
/// </summary>
/// <param name="ID">Material ID</param>
/// <param name="id">Material ID</param>
/// <param name="amount">How much to insert</param>
/// <returns>Whether it inserted it or not.</returns>
public bool InsertMaterial(string ID, int amount)
public bool InsertMaterial(string id, int amount)
{
if (!CanInsertMaterial(ID, amount)) return false;
if (!CanInsertMaterial(id, amount)) return false;
if (!Storage.ContainsKey(ID))
Storage.Add(ID, 0);
if (!Storage.ContainsKey(id))
Storage.Add(id, 0);
Storage[ID] += amount;
Storage[id] += amount;
Dirty();
@@ -71,12 +71,12 @@ namespace Content.Server.Lathe.Components
/// <summary>
/// Removes material from the storage.
/// </summary>
/// <param name="ID">Material ID</param>
/// <param name="id">Material ID</param>
/// <param name="amount">How much to remove</param>
/// <returns>Whether it removed it or not.</returns>
public bool RemoveMaterial(string ID, int amount)
public bool RemoveMaterial(string id, int amount)
{
return InsertMaterial(ID, -amount);
return InsertMaterial(id, -amount);
}
}
}

View File

@@ -26,7 +26,7 @@ namespace Content.Server.MoMMI
void IPostInjectInit.PostInject()
{
_statusHost.AddHandler(_handleChatPost);
_statusHost.AddHandler(HandleChatPost);
}
public async void SendOOCMessage(string sender, string message)
@@ -37,10 +37,10 @@ namespace Content.Server.MoMMI
Contents = message
};
await _sendMessageInternal("ooc", sentMessage);
await SendMessageInternal("ooc", sentMessage);
}
private async Task _sendMessageInternal(string type, object messageObject)
private async Task SendMessageInternal(string type, object messageObject)
{
var url = _configurationManager.GetCVar(CCVars.StatusMoMMIUrl);
var password = _configurationManager.GetCVar(CCVars.StatusMoMMIPassword);
@@ -70,7 +70,7 @@ namespace Content.Server.MoMMI
}
}
private bool _handleChatPost(IStatusHandlerContext context)
private bool HandleChatPost(IStatusHandlerContext context)
{
if (context.RequestMethod != HttpMethod.Post || context.Url!.AbsolutePath != "/ooc")
{

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Content.Server.Power.Components;
@@ -11,7 +11,6 @@ namespace Content.Server.Power.EntitySystems
{
public sealed class ExtensionCableSystem : EntitySystem
{
[Dependency] private readonly IEntityLookup _lookup = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
public override void Initialize()

View File

@@ -118,7 +118,12 @@ namespace Content.Server.Shuttles.EntitySystems
Disable(physicsComponent);
foreach (var fixture in physicsComponent.Fixtures)
if (!EntityManager.TryGetComponent(component.Owner, out FixturesComponent? fixturesComponent))
{
return;
}
foreach (var fixture in fixturesComponent.Fixtures.Values)
{
fixture.Mass = 0f;
}

View File

@@ -240,12 +240,12 @@ namespace Content.Server.Storage.Components
EnsureInitialCalculated();
if (!_entityManager.TryGetComponent(player, out HandsComponent? hands) ||
hands.GetActiveHand == null)
hands.GetActiveHandItem == null)
{
return false;
}
var toInsert = hands.GetActiveHand;
var toInsert = hands.GetActiveHandItem;
if (!hands.Drop(toInsert.Owner))
{

View File

@@ -83,7 +83,7 @@ namespace Content.Server.Strip
private async void PlaceActiveHandItemInInventory(EntityUid user, string slot)
{
var userHands = _entities.GetComponent<HandsComponent>(user);
var item = userHands.GetActiveHand;
var item = userHands.GetActiveHandItem;
var invSystem = EntitySystem.Get<InventorySystem>();
bool Check()
@@ -149,7 +149,7 @@ namespace Content.Server.Strip
{
var hands = _entities.GetComponent<HandsComponent>(Owner);
var userHands = _entities.GetComponent<HandsComponent>(user);
var item = userHands.GetActiveHand;
var item = userHands.GetActiveHandItem;
bool Check()
{
@@ -324,7 +324,7 @@ namespace Content.Server.Strip
!_entities.TryGetComponent(user, out HandsComponent? userHands))
return;
var placingItem = userHands.GetActiveHand != null;
var placingItem = userHands.GetActiveHandItem != null;
switch (obj.Message)
{

View File

@@ -144,7 +144,7 @@ namespace Content.Server.Weapon.Ranged
/// <param name="targetPos">Target position on the map to shoot at.</param>
private void TryFire(EntityUid user, Vector2 targetPos)
{
if (!_entMan.TryGetComponent(user, out HandsComponent? hands) || hands.GetActiveHand?.Owner != Owner)
if (!_entMan.TryGetComponent(user, out HandsComponent? hands) || hands.GetActiveHandItem?.Owner != Owner)
{
return;
}

View File

@@ -425,7 +425,7 @@ namespace Content.Server.WireHacking
}
ToolComponent? tool = null;
if (handsComponent.GetActiveHand?.Owner is EntityUid activeHandEntity)
if (handsComponent.GetActiveHandItem?.Owner is EntityUid activeHandEntity)
_entities.TryGetComponent(activeHandEntity, out tool);
var toolSystem = EntitySystem.Get<ToolSystem>();