Inline UID
This commit is contained in:
@@ -35,9 +35,9 @@ namespace Content.Shared.Actions.Behaviors
|
||||
{
|
||||
Performer = performer;
|
||||
ActionType = actionType;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Performer.Uid, out PerformerActions))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Performer, out PerformerActions))
|
||||
{
|
||||
throw new InvalidOperationException($"performer {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(performer.Uid).EntityName} tried to perform action {actionType} " +
|
||||
throw new InvalidOperationException($"performer {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(performer).EntityName} tried to perform action {actionType} " +
|
||||
$" but the performer had no actions component," +
|
||||
" which should never occur");
|
||||
}
|
||||
|
||||
@@ -41,10 +41,10 @@ namespace Content.Shared.Actions.Behaviors.Item
|
||||
Performer = performer;
|
||||
ActionType = actionType;
|
||||
Item = item;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Item.Uid, out ItemActions))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Item, out ItemActions))
|
||||
{
|
||||
throw new InvalidOperationException($"performer {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(performer.Uid).EntityName} tried to perform item action {actionType} " +
|
||||
$" for item {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Item.Uid).EntityName} but the item had no ItemActionsComponent," +
|
||||
throw new InvalidOperationException($"performer {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(performer).EntityName} tried to perform item action {actionType} " +
|
||||
$" for item {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Item).EntityName} but the item had no ItemActionsComponent," +
|
||||
" which should never occur");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace Content.Shared.Actions.Components
|
||||
void IEquippedHand.EquippedHand(EquippedHandEventArgs eventArgs)
|
||||
{
|
||||
// this entity cannot be granted actions if no actions component
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedActionsComponent?>(eventArgs.User.Uid, out var actionsComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedActionsComponent?>(eventArgs.User, out var actionsComponent))
|
||||
return;
|
||||
Holder = eventArgs.User;
|
||||
_holderActionsComponent = actionsComponent;
|
||||
@@ -196,7 +196,7 @@ namespace Content.Shared.Actions.Components
|
||||
void IEquipped.Equipped(EquippedEventArgs eventArgs)
|
||||
{
|
||||
// this entity cannot be granted actions if no actions component
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedActionsComponent?>(eventArgs.User.Uid, out var actionsComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedActionsComponent?>(eventArgs.User, out var actionsComponent))
|
||||
return;
|
||||
Holder = eventArgs.User;
|
||||
_holderActionsComponent = actionsComponent;
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Content.Shared.Actions.Components
|
||||
public bool TryGetItemActionStates(IEntity item,
|
||||
[NotNullWhen((true))] out IReadOnlyDictionary<ItemActionType, ActionState>? itemActionStates)
|
||||
{
|
||||
return TryGetItemActionStates(item.Uid, out itemActionStates);
|
||||
return TryGetItemActionStates((EntityUid) item, out itemActionStates);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -173,7 +173,7 @@ namespace Content.Shared.Actions.Components
|
||||
/// <seealso cref="TryGetItemActionState(Content.Shared.Actions.ItemActionType,Robust.Shared.GameObjects.EntityUid,out Content.Shared.Actions.Components.ActionState)"/>
|
||||
public bool TryGetItemActionState(ItemActionType actionType, IEntity item, out ActionState actionState)
|
||||
{
|
||||
return TryGetItemActionState(actionType, item.Uid, out actionState);
|
||||
return TryGetItemActionState(actionType, (EntityUid) item, out actionState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace Content.Shared.Actions
|
||||
public ComponentMessage PerformInstantActionMessage()
|
||||
#pragma warning restore 618
|
||||
{
|
||||
return new PerformInstantItemActionMessage(_action.ActionType, _item.Uid);
|
||||
return new PerformInstantItemActionMessage(_action.ActionType, _item);
|
||||
}
|
||||
|
||||
#pragma warning disable 618
|
||||
@@ -199,23 +199,23 @@ namespace Content.Shared.Actions
|
||||
{
|
||||
if (toggleOn)
|
||||
{
|
||||
return new PerformToggleOnItemActionMessage(_action.ActionType, _item.Uid);
|
||||
return new PerformToggleOnItemActionMessage(_action.ActionType, _item);
|
||||
}
|
||||
return new PerformToggleOffItemActionMessage(_action.ActionType, _item.Uid);
|
||||
return new PerformToggleOffItemActionMessage(_action.ActionType, _item);
|
||||
}
|
||||
|
||||
#pragma warning disable 618
|
||||
public ComponentMessage PerformTargetPointActionMessage(PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||
#pragma warning restore 618
|
||||
{
|
||||
return new PerformTargetPointItemActionMessage(_action.ActionType, _item.Uid, args.Coordinates);
|
||||
return new PerformTargetPointItemActionMessage(_action.ActionType, _item, args.Coordinates);
|
||||
}
|
||||
|
||||
#pragma warning disable 618
|
||||
public ComponentMessage PerformTargetEntityActionMessage(PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||
#pragma warning restore 618
|
||||
{
|
||||
return new PerformTargetEntityItemActionMessage(_action.ActionType, _item.Uid, args.EntityUid);
|
||||
return new PerformTargetEntityItemActionMessage(_action.ActionType, _item, args.EntityUid);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
Reference in New Issue
Block a user