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

@@ -86,7 +86,7 @@ namespace Content.Shared.Actions.Components
if (_holderActionsComponent == null) return;
foreach (var (actionType, state) in _actions)
{
_holderActionsComponent.GrantOrUpdateItemAction(actionType, ((IComponent) this).Owner, state);
_holderActionsComponent.GrantOrUpdateItemAction(actionType, Owner, state);
}
}
@@ -95,7 +95,7 @@ namespace Content.Shared.Actions.Components
if (_holderActionsComponent == null) return;
foreach (var (actionType, state) in _actions)
{
_holderActionsComponent.RevokeItemAction(actionType, ((IComponent) this).Owner);
_holderActionsComponent.RevokeItemAction(actionType, Owner);
}
}
@@ -152,7 +152,7 @@ namespace Content.Shared.Actions.Components
if (!dirty) return;
_actions[actionType] = actionState;
_holderActionsComponent?.GrantOrUpdateItemAction(actionType, ((IComponent) this).Owner, actionState);
_holderActionsComponent?.GrantOrUpdateItemAction(actionType, Owner, actionState);
}
/// <summary>

View File

@@ -146,7 +146,7 @@ namespace Content.Shared.Body.Components
var argsAdded = new BodyPartAddedEventArgs(slot.Id, part);
EntitySystem.Get<SharedHumanoidAppearanceSystem>().BodyPartAdded(((IComponent) this).Owner, argsAdded);
EntitySystem.Get<SharedHumanoidAppearanceSystem>().BodyPartAdded(Owner, argsAdded);
foreach (var component in IoCManager.Resolve<IEntityManager>().GetComponents<IBodyPartAdded>(Owner).ToArray())
{
component.BodyPartAdded(argsAdded);
@@ -174,7 +174,7 @@ namespace Content.Shared.Body.Components
var args = new BodyPartRemovedEventArgs(slot.Id, part);
EntitySystem.Get<SharedHumanoidAppearanceSystem>().BodyPartRemoved(((IComponent) this).Owner, args);
EntitySystem.Get<SharedHumanoidAppearanceSystem>().BodyPartRemoved(Owner, args);
foreach (var component in IoCManager.Resolve<IEntityManager>().GetComponents<IBodyPartRemoved>(Owner))
{
component.BodyPartRemoved(args);
@@ -184,7 +184,7 @@ namespace Content.Shared.Body.Components
if (part.PartType == BodyPartType.Leg &&
GetPartsOfType(BodyPartType.Leg).ToArray().Length == 0)
{
EntitySystem.Get<StandingStateSystem>().Down(((IComponent) this).Owner);
EntitySystem.Get<StandingStateSystem>().Down(Owner);
}
if (part.IsVital && SlotParts.Count(x => x.Value.PartType == part.PartType) == 0)

View File

@@ -37,11 +37,11 @@ namespace Content.Shared.Body.Components
{
if (old.Body == null)
{
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(((IComponent) this).Owner, new RemovedFromPartEvent(old));
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new RemovedFromPartEvent(old));
}
else
{
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(((IComponent) this).Owner, new RemovedFromPartInBodyEvent(old.Body, old));
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new RemovedFromPartInBodyEvent(old.Body, old));
}
}
@@ -49,11 +49,11 @@ namespace Content.Shared.Body.Components
{
if (value.Body == null)
{
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(((IComponent) this).Owner, new AddedToPartEvent(value));
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new AddedToPartEvent(value));
}
else
{
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(((IComponent) this).Owner, new AddedToPartInBodyEvent(value.Body, value));
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new AddedToPartInBodyEvent(value.Body, value));
}
}
}

View File

@@ -95,7 +95,7 @@ namespace Content.Shared.Damage
damage.DamageDict.Add(typeID, damageValue);
}
var actual = EntitySystem.Get<DamageableSystem>().TryChangeDamage(((IComponent) this).Owner, damage);
var actual = EntitySystem.Get<DamageableSystem>().TryChangeDamage(Owner, damage);
// should logging be disabled during rad storms? a lot of entities are going to be damaged.
if (actual != null && !actual.Empty)
@@ -120,7 +120,7 @@ namespace Content.Shared.Damage
damage.DamageDict.Add(typeID, damageValue);
}
var actual = EntitySystem.Get<DamageableSystem>().TryChangeDamage(((IComponent) this).Owner, damage);
var actual = EntitySystem.Get<DamageableSystem>().TryChangeDamage(Owner, damage);
// will logging handle nukes?
if (actual != null && !actual.Empty)

View File

@@ -433,7 +433,7 @@ namespace Content.Shared.Hands.Components
/// </summary>
private bool PlayerCanDrop()
{
if (!IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ActionBlockerSystem>().CanDrop(((IComponent) this).Owner))
if (!IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ActionBlockerSystem>().CanDrop(Owner))
return false;
return true;

View File

@@ -291,7 +291,7 @@ namespace Content.Shared.MobState.Components
{
if (!current.HasValue)
{
old?.ExitState(((IComponent) this).Owner, IoCManager.Resolve<IEntityManager>());
old?.ExitState(Owner, IoCManager.Resolve<IEntityManager>());
return;
}
@@ -301,16 +301,16 @@ namespace Content.Shared.MobState.Components
if (state == old)
{
state.UpdateState(((IComponent) this).Owner, threshold, IoCManager.Resolve<IEntityManager>());
state.UpdateState(Owner, threshold, IoCManager.Resolve<IEntityManager>());
return;
}
old?.ExitState(((IComponent) this).Owner, IoCManager.Resolve<IEntityManager>());
old?.ExitState(Owner, IoCManager.Resolve<IEntityManager>());
CurrentState = state;
state.EnterState(((IComponent) this).Owner, IoCManager.Resolve<IEntityManager>());
state.UpdateState(((IComponent) this).Owner, threshold, IoCManager.Resolve<IEntityManager>());
state.EnterState(Owner, IoCManager.Resolve<IEntityManager>());
state.UpdateState(Owner, threshold, IoCManager.Resolve<IEntityManager>());
var message = new MobStateChangedMessage(this, old, state);
#pragma warning disable 618