Inline TryGetComponent completely, for real

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 14:17:01 +01:00
parent 2ff4ec65d5
commit 69b270017b
425 changed files with 1143 additions and 995 deletions

View File

@@ -67,7 +67,7 @@ namespace Content.Server.Kitchen.Components
private void UpdateAppearance()
{
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance))
{
appearance.SetData(KitchenSpikeVisuals.Status, (_meatParts > 0) ? KitchenSpikeStatus.Bloody : KitchenSpikeStatus.Empty);
}
@@ -83,7 +83,7 @@ namespace Content.Server.Kitchen.Components
return false;
}
if (!victim.TryGetComponent(out butcherable))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(victim.Uid, out butcherable))
{
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-butcher", ("victim", victim), ("this", Owner)));
return false;
@@ -106,7 +106,7 @@ namespace Content.Server.Kitchen.Components
return;
// Prevent dead from being spiked TODO: Maybe remove when rounds can be played and DOT is implemented
if (victim.TryGetComponent<MobStateComponent>(out var state) &&
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<MobStateComponent?>(victim.Uid, out var state) &&
!state.IsDead())
{
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", victim)));