Inline TryGetComponent completely, for real
This commit is contained in:
@@ -4,6 +4,7 @@ using Content.Server.Storage.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.AI.Operators.Inventory
|
||||
{
|
||||
@@ -58,7 +59,7 @@ namespace Content.Server.AI.Operators.Inventory
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
if (!_target.TryGetComponent(out EntityStorageComponent? storageComponent) ||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(_target.Uid, out EntityStorageComponent? storageComponent) ||
|
||||
storageComponent.IsWeldedShut)
|
||||
{
|
||||
return Outcome.Failed;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Hands.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.AI.Operators.Inventory
|
||||
{
|
||||
@@ -20,7 +21,7 @@ namespace Content.Server.AI.Operators.Inventory
|
||||
/// <returns></returns>
|
||||
public override Outcome Execute(float frameTime)
|
||||
{
|
||||
if (!_owner.TryGetComponent(out HandsComponent? handsComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(_owner.Uid, out HandsComponent? handsComponent))
|
||||
{
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Hands.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.AI.Operators.Inventory
|
||||
{
|
||||
@@ -14,7 +15,7 @@ namespace Content.Server.AI.Operators.Inventory
|
||||
|
||||
public override Outcome Execute(float frameTime)
|
||||
{
|
||||
if (!_owner.TryGetComponent(out HandsComponent? handsComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(_owner.Uid, out HandsComponent? handsComponent))
|
||||
{
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Hands.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.AI.Operators.Inventory
|
||||
{
|
||||
@@ -15,7 +16,7 @@ namespace Content.Server.AI.Operators.Inventory
|
||||
|
||||
public override Outcome Execute(float frameTime)
|
||||
{
|
||||
if (!_owner.TryGetComponent(out HandsComponent? handsComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(_owner.Uid, out HandsComponent? handsComponent))
|
||||
{
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Content.Server.AI.Operators.Inventory
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
if (_owner.TryGetComponent(out CombatModeComponent? combatModeComponent))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(_owner.Uid, out CombatModeComponent? combatModeComponent))
|
||||
{
|
||||
combatModeComponent.IsInCombatMode = false;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.AI.Operators.Inventory
|
||||
{
|
||||
@@ -34,7 +35,7 @@ namespace Content.Server.AI.Operators.Inventory
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
if (!container.Owner.TryGetComponent(out EntityStorageComponent? storageComponent) ||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(container.Owner.Uid, out EntityStorageComponent? storageComponent) ||
|
||||
storageComponent.IsWeldedShut)
|
||||
{
|
||||
return Outcome.Failed;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Content.Server.AI.Operators.Inventory
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
if (!_owner.TryGetComponent(out HandsComponent? handsComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(_owner.Uid, out HandsComponent? handsComponent))
|
||||
{
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Server.Items;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.AI.Operators.Inventory
|
||||
{
|
||||
@@ -21,12 +22,12 @@ namespace Content.Server.AI.Operators.Inventory
|
||||
public override Outcome Execute(float frameTime)
|
||||
{
|
||||
// TODO: Also have this check storage a la backpack etc.
|
||||
if (!_owner.TryGetComponent(out HandsComponent? handsComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(_owner.Uid, out HandsComponent? handsComponent))
|
||||
{
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
if (!_target.TryGetComponent(out ItemComponent? itemComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(_target.Uid, out ItemComponent? itemComponent))
|
||||
{
|
||||
return Outcome.Failed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user