Remove redundant IComponent casts

This commit is contained in:
metalgearsloth
2021-12-07 21:54:00 +11:00
parent 8d4799e611
commit 373b5988d7
29 changed files with 53 additions and 53 deletions

View File

@@ -108,9 +108,9 @@ namespace Content.Server.Access.Components
private void HandleIdButton(EntityUid user, ItemSlot slot)
{
if (slot.HasItem)
EntitySystem.Get<ItemSlotsSystem>().TryEjectToHands(((IComponent) this).Owner, slot, user);
EntitySystem.Get<ItemSlotsSystem>().TryEjectToHands(Owner, slot, user);
else
EntitySystem.Get<ItemSlotsSystem>().TryInsertFromHand(((IComponent) this).Owner, slot, user);
EntitySystem.Get<ItemSlotsSystem>().TryInsertFromHand(Owner, slot, user);
}
public void UpdateUserInterface()

View File

@@ -131,7 +131,7 @@ namespace Content.Server.Arcade.Components
if (obj.Session != _player) break;
// TODO: Should this check if the Owner can interact...?
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(((IComponent) this).Owner))
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(Owner))
{
DeactivePlayer(obj.Session);
break;

View File

@@ -269,7 +269,7 @@ namespace Content.Server.Atmos.Components
range = MaxExplosionRange;
}
EntitySystem.Get<ExplosionSystem>().SpawnExplosion(((IComponent) this).Owner, (int) (range * 0.25f), (int) (range * 0.5f), (int) (range * 1.5f), 1);
EntitySystem.Get<ExplosionSystem>().SpawnExplosion(Owner, (int) (range * 0.25f), (int) (range * 0.5f), (int) (range * 1.5f), 1);
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(Owner);
return;

View File

@@ -562,10 +562,10 @@ namespace Content.Server.Botany.Components
else
{
var amt = FixedPoint2.New(1);
foreach (var reagent in solutionSystem.RemoveEachReagent(((IComponent) this).Owner, solution, amt))
foreach (var reagent in solutionSystem.RemoveEachReagent(Owner, solution, amt))
{
var reagentProto = _prototypeManager.Index<ReagentPrototype>(reagent);
reagentProto.ReactionPlant(((IComponent) this).Owner, new Solution.ReagentQuantity(reagent, amt), solution);
reagentProto.ReactionPlant(Owner, new Solution.ReagentQuantity(reagent, amt), solution);
}
}

View File

@@ -141,7 +141,7 @@ namespace Content.Server.Cargo.Components
// attempt to attach the label
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(product, out PaperLabelComponent label))
{
EntitySystem.Get<ItemSlotsSystem>().TryInsert(((IComponent) this).Owner, label.LabelSlot, printed);
EntitySystem.Get<ItemSlotsSystem>().TryInsert(Owner, label.LabelSlot, printed);
}
}

View File

@@ -121,7 +121,7 @@ namespace Content.Server.Chemistry.Components
switch (msg.Action)
{
case UiAction.Eject:
EntitySystem.Get<ItemSlotsSystem>().TryEjectToHands(((IComponent) this).Owner, BeakerSlot, player);
EntitySystem.Get<ItemSlotsSystem>().TryEjectToHands(Owner, BeakerSlot, player);
break;
case UiAction.ChemButton:
TransferReagent(msg.Id, msg.Amount, msg.IsBuffer);

View File

@@ -149,7 +149,7 @@ namespace Content.Server.Chemistry.Components
switch (msg.Button)
{
case UiButton.Eject:
EntitySystem.Get<ItemSlotsSystem>().TryEjectToHands(((IComponent) this).Owner, BeakerSlot, obj.Session.AttachedEntity);
EntitySystem.Get<ItemSlotsSystem>().TryEjectToHands(Owner, BeakerSlot, obj.Session.AttachedEntity);
break;
case UiButton.Clear:
TryClear();

View File

@@ -85,7 +85,7 @@ namespace Content.Server.Climbing.Components
Body.ApplyLinearImpulse((to - from).Normalized * velocity * Body.Mass * 5);
OwnerIsTransitioning = true;
EntitySystem.Get<ClimbSystem>().UnsetTransitionBoolAfterBufferTime(((IComponent) this).Owner, this);
EntitySystem.Get<ClimbSystem>().UnsetTransitionBoolAfterBufferTime(Owner, this);
}
public void Update()

View File

@@ -124,7 +124,7 @@ namespace Content.Server.Construction.Components
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<ConstructionComponent?>(Owner, out var construction))
{
// Attempt to set pathfinding to the machine node...
EntitySystem.Get<ConstructionSystem>().SetPathfindingTarget(((IComponent) this).Owner, "machine", construction);
EntitySystem.Get<ConstructionSystem>().SetPathfindingTarget(Owner, "machine", construction);
}
}
@@ -271,7 +271,7 @@ namespace Content.Server.Construction.Components
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ConstructionComponent? construction))
{
// So prying the components off works correctly.
EntitySystem.Get<ConstructionSystem>().ResetEdge(((IComponent) this).Owner, construction);
EntitySystem.Get<ConstructionSystem>().ResetEdge(Owner, construction);
}
return true;

View File

@@ -32,7 +32,7 @@ namespace Content.Server.Disposal.Tube.Components
EntitySystem.Get<AtmosphereSystem>().Merge(holderComponent.Air, from.Air);
from.Air.Clear();
return EntitySystem.Get<DisposableSystem>().EnterTube(((IComponent) holderComponent).Owner, ((IComponent) this).Owner, holderComponent, null, this);
return EntitySystem.Get<DisposableSystem>().EnterTube(((IComponent) holderComponent).Owner, Owner, holderComponent, null, this);
}
protected override Direction[] ConnectableDirections()

View File

@@ -48,7 +48,7 @@ namespace Content.Server.Ghost.Roles.Components
mob.EnsureComponent<MindComponent>();
var ghostRoleSystem = EntitySystem.Get<GhostRoleSystem>();
ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, ((IComponent) this).Owner, mob, this);
ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, Owner, mob, this);
if (++_currentTakeovers < _availableTakeovers)
return true;

View File

@@ -30,10 +30,10 @@ namespace Content.Server.Ghost.Roles.Components
return false;
if (MakeSentient)
MakeSentientCommand.MakeSentient(((IComponent) this).Owner, IoCManager.Resolve<IEntityManager>());
MakeSentientCommand.MakeSentient(Owner, IoCManager.Resolve<IEntityManager>());
var ghostRoleSystem = EntitySystem.Get<GhostRoleSystem>();
ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, ((IComponent) this).Owner, ((IComponent) this).Owner, this);
ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, Owner, Owner, this);
ghostRoleSystem.UnregisterGhostRole(this);

View File

@@ -201,7 +201,7 @@ namespace Content.Server.Inventory.Components
var pass = false;
reason = null;
if (mobCheck && !EntitySystem.Get<ActionBlockerSystem>().CanEquip(((IComponent) this).Owner))
if (mobCheck && !EntitySystem.Get<ActionBlockerSystem>().CanEquip(Owner))
{
reason = Loc.GetString("inventory-component-can-equip-cannot");
return false;
@@ -288,7 +288,7 @@ namespace Content.Server.Inventory.Components
private void UpdateMovementSpeed()
{
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(((IComponent) this).Owner);
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(Owner);
}
public void ForceUnequip(Slots slot)
@@ -323,7 +323,7 @@ namespace Content.Server.Inventory.Components
/// </returns>
public bool CanUnequip(Slots slot, bool mobCheck = true)
{
if (mobCheck && !EntitySystem.Get<ActionBlockerSystem>().CanUnequip(((IComponent) this).Owner))
if (mobCheck && !EntitySystem.Get<ActionBlockerSystem>().CanUnequip(Owner))
return false;
var inventorySlot = _slotContainers[slot];

View File

@@ -90,7 +90,7 @@ namespace Content.Server.Nutrition.Components
if (_lastHungerThreshold == HungerThreshold.Starving && _currentHungerThreshold != HungerThreshold.Dead &&
IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out MovementSpeedModifierComponent? movementSlowdownComponent))
{
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(((IComponent) this).Owner);
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(Owner);
}
// Update UI
@@ -126,7 +126,7 @@ namespace Content.Server.Nutrition.Components
case HungerThreshold.Starving:
// TODO: If something else bumps this could cause mega-speed.
// If some form of speed update system if multiple things are touching it use that.
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(((IComponent) this).Owner);
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(Owner);
_lastHungerThreshold = _currentHungerThreshold;
_actualDecayRate = _baseDecayRate * 0.6f;
return;

View File

@@ -89,7 +89,7 @@ namespace Content.Server.Nutrition.Components
if (_lastThirstThreshold == ThirstThreshold.Parched && _currentThirstThreshold != ThirstThreshold.Dead &&
IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out MovementSpeedModifierComponent? movementSlowdownComponent))
{
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(((IComponent) this).Owner);
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(Owner);
}
// Update UI
@@ -123,7 +123,7 @@ namespace Content.Server.Nutrition.Components
return;
case ThirstThreshold.Parched:
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(((IComponent) this).Owner);
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(Owner);
_lastThirstThreshold = _currentThirstThreshold;
_actualDecayRate = _baseDecayRate * 0.6f;
return;

View File

@@ -73,7 +73,7 @@ namespace Content.Server.PowerCell.Components
var light = (int) Math.Ceiling(Math.Sqrt(CurrentCharge) / 30);
CurrentCharge = 0;
EntitySystem.Get<ExplosionSystem>().SpawnExplosion(((IComponent) this).Owner, 0, heavy, light, light*2);
EntitySystem.Get<ExplosionSystem>().SpawnExplosion(Owner, 0, heavy, light, light*2);
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner);
}

View File

@@ -33,11 +33,11 @@ namespace Content.Server.Shuttles.Components
if (!_enabled)
{
system.DisableThruster(((IComponent) this).Owner, this);
system.DisableThruster(Owner, this);
}
else if (system.CanEnable(((IComponent) this).Owner, this))
else if (system.CanEnable(Owner, this))
{
system.EnableThruster(((IComponent) this).Owner, this);
system.EnableThruster(Owner, this);
}
}
}

View File

@@ -221,7 +221,7 @@ namespace Content.Server.Storage.Components
var targetIsItem = IoCManager.Resolve<IEntityManager>().HasComponent<SharedItemComponent>(entity);
var targetIsMob = IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity);
var storageIsItem = IoCManager.Resolve<IEntityManager>().HasComponent<SharedItemComponent>(((IComponent) this).Owner);
var storageIsItem = IoCManager.Resolve<IEntityManager>().HasComponent<SharedItemComponent>(Owner);
var allowedToEat = false;

View File

@@ -94,7 +94,7 @@ namespace Content.Server.Storage.Components
private void UpdateStorageVisualization()
{
if (!_entityManager.TryGetComponent(((IComponent) this).Owner, out AppearanceComponent appearance))
if (!_entityManager.TryGetComponent(Owner, out AppearanceComponent appearance))
return;
bool open = SubscribedSessions.Count != 0;
@@ -102,7 +102,7 @@ namespace Content.Server.Storage.Components
appearance.SetData(StorageVisuals.Open, open);
appearance.SetData(SharedBagOpenVisuals.BagState, open ? SharedBagState.Open : SharedBagState.Closed);
if (_entityManager.HasComponent<ItemCounterComponent>(((IComponent) this).Owner))
if (_entityManager.HasComponent<ItemCounterComponent>(Owner))
appearance.SetData(StackVisuals.Hide, !open);
}
@@ -402,7 +402,7 @@ namespace Content.Server.Storage.Components
{
if (_entityManager.TryGetComponent(entity, out ServerStorageComponent storageComponent))
{
DebugTools.Assert(storageComponent != this, $"Storage component contains itself!? Entity: {((IComponent) this).Owner}");
DebugTools.Assert(storageComponent != this, $"Storage component contains itself!? Entity: {Owner}");
storageComponent.UnsubscribeSession(session);
}

View File

@@ -365,7 +365,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
_entities.GetComponent<TransformComponent>(projectile).WorldRotation = projectileAngle + MathHelper.PiOver2;
}
_entities.EventBus.RaiseLocalEvent(((IComponent) this).Owner, new GunShotEvent(firedProjectiles));
_entities.EventBus.RaiseLocalEvent(Owner, new GunShotEvent(firedProjectiles));
_entities.EventBus.RaiseLocalEvent(ammo, new AmmoShotEvent(firedProjectiles));
}