More error fixes.

This commit is contained in:
Vera Aguilera Puerto
2021-12-04 12:47:09 +01:00
parent 424c83e39c
commit 151778a1b9
30 changed files with 97 additions and 123 deletions

View File

@@ -21,7 +21,7 @@ namespace Content.Shared.Actions.Behaviors
/// <summary>
/// Entity performing the action.
/// </summary>
public readonly IEntity Performer;
public readonly EntityUid Performer;
/// <summary>
/// Action being performed
/// </summary>
@@ -31,7 +31,7 @@ namespace Content.Shared.Actions.Behaviors
/// </summary>
public readonly SharedActionsComponent? PerformerActions;
public ActionEventArgs(IEntity performer, ActionType actionType)
public ActionEventArgs(EntityUid performer, ActionType actionType)
{
Performer = performer;
ActionType = actionType;

View File

@@ -18,7 +18,7 @@ namespace Content.Shared.Actions.Behaviors
public class InstantActionEventArgs : ActionEventArgs
{
public InstantActionEventArgs(IEntity performer, ActionType actionType) : base(performer, actionType)
public InstantActionEventArgs(EntityUid performer, ActionType actionType) : base(performer, actionType)
{
}
}

View File

@@ -19,9 +19,9 @@ namespace Content.Shared.Actions.Behaviors
/// <summary>
/// Entity being targeted
/// </summary>
public readonly IEntity Target;
public readonly EntityUid Target;
public TargetEntityActionEventArgs(IEntity performer, ActionType actionType, IEntity target) :
public TargetEntityActionEventArgs(EntityUid performer, ActionType actionType, EntityUid target) :
base(performer, actionType)
{
Target = target;

View File

@@ -20,9 +20,9 @@ namespace Content.Shared.Actions.Behaviors
/// <summary>
/// Entity being targeted
/// </summary>
public readonly IEntity Target;
public readonly EntityUid Target;
public TargetEntityItemActionEventArgs(IEntity performer, IEntity target, IEntity item,
public TargetEntityItemActionEventArgs(EntityUid performer, EntityUid target, EntityUid item,
ItemActionType actionType) : base(performer, item, actionType)
{
Target = target;

View File

@@ -23,7 +23,7 @@ namespace Content.Shared.Actions.Behaviors
/// </summary>
public readonly EntityCoordinates Target;
public TargetPointActionEventArgs(IEntity performer, EntityCoordinates target, ActionType actionType)
public TargetPointActionEventArgs(EntityUid performer, EntityCoordinates target, ActionType actionType)
: base(performer, actionType)
{
Target = target;

View File

@@ -24,7 +24,7 @@ namespace Content.Shared.Actions.Behaviors
/// </summary>
public readonly EntityCoordinates Target;
public TargetPointItemActionEventArgs(IEntity performer, EntityCoordinates target, IEntity item,
public TargetPointItemActionEventArgs(EntityUid performer, EntityCoordinates target, EntityUid item,
ItemActionType actionType) : base(performer, item, actionType)
{
Target = target;

View File

@@ -33,7 +33,7 @@ namespace Content.Shared.Actions.Behaviors
/// </summary>
public bool ToggledOff => !ToggledOn;
public ToggleActionEventArgs(IEntity performer, ActionType actionType, bool toggledOn) : base(performer, actionType)
public ToggleActionEventArgs(EntityUid performer, ActionType actionType, bool toggledOn) : base(performer, actionType)
{
ToggledOn = toggledOn;
}

View File

@@ -18,7 +18,7 @@ namespace Content.Shared.Actions.Behaviors.Item
public class InstantItemActionEventArgs : ItemActionEventArgs
{
public InstantItemActionEventArgs(IEntity performer, IEntity item, ItemActionType actionType) :
public InstantItemActionEventArgs(EntityUid performer, EntityUid item, ItemActionType actionType) :
base(performer, item, actionType)
{
}

View File

@@ -22,11 +22,11 @@ namespace Content.Shared.Actions.Behaviors.Item
/// <summary>
/// Entity performing the action.
/// </summary>
public readonly IEntity Performer;
public readonly EntityUid Performer;
/// <summary>
/// Item being used to perform the action
/// </summary>
public readonly IEntity Item;
public readonly EntityUid Item;
/// <summary>
/// Action being performed
/// </summary>
@@ -36,7 +36,7 @@ namespace Content.Shared.Actions.Behaviors.Item
/// </summary>
public readonly ItemActionsComponent? ItemActions;
public ItemActionEventArgs(IEntity performer, IEntity item, ItemActionType actionType)
public ItemActionEventArgs(EntityUid performer, EntityUid item, ItemActionType actionType)
{
Performer = performer;
ActionType = actionType;

View File

@@ -33,7 +33,7 @@ namespace Content.Shared.Actions.Behaviors.Item
/// </summary>
public bool ToggledOff => !ToggledOn;
public ToggleItemActionEventArgs(IEntity performer, bool toggledOn, IEntity item,
public ToggleItemActionEventArgs(EntityUid performer, bool toggledOn, EntityUid item,
ItemActionType actionType) : base(performer, item, actionType)
{
ToggledOn = toggledOn;

View File

@@ -47,7 +47,7 @@ namespace Content.Shared.Actions.Components
/// <summary>
/// Entity currently holding this in hand or equip slot. Null if not held.
/// </summary>
public IEntity? Holder { get; private set; }
public EntityUid? Holder { get; private set; }
// cached actions component of the holder, since we'll need to access it frequently
private SharedActionsComponent? _holderActionsComponent;

View File

@@ -119,13 +119,6 @@ namespace Content.Shared.Actions.Components
return false;
}
/// <seealso cref="TryGetItemActionStates(Robust.Shared.GameObjects.EntityUid,out System.Collections.Generic.IReadOnlyDictionary{Content.Shared.Actions.ItemActionType,Content.Shared.Actions.Components.ActionState}?)"/>
public bool TryGetItemActionStates(IEntity item,
[NotNullWhen((true))] out IReadOnlyDictionary<ItemActionType, ActionState>? itemActionStates)
{
return TryGetItemActionStates((EntityUid) item, out itemActionStates);
}
/// <summary>
/// Gets the item action state associated with the specified item action type for the specified item, if it has any.
/// </summary>
@@ -170,12 +163,6 @@ namespace Content.Shared.Actions.Components
.Any(state => state.Key == actionType && state.Value.Enabled);
}
/// <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, (EntityUid) item, out actionState);
}
/// <summary>
/// Gets all action types that have non-initial state (granted, have a cooldown, or toggled on).
/// </summary>

View File

@@ -39,24 +39,24 @@ namespace Content.Shared.Actions
/// <summary>
/// Perform the server-side logic of the action
/// </summary>
void DoInstantAction(IEntity player);
void DoInstantAction(EntityUid player);
/// <summary>
/// Perform the server-side logic of the toggle action
/// </summary>
/// <returns>true if the attempt to toggle was successful, meaning the state should be toggled to the
/// indicated value</returns>
bool DoToggleAction(IEntity player, bool on);
bool DoToggleAction(EntityUid player, bool on);
/// <summary>
/// Perform the server-side logic of the target point action
/// </summary>
void DoTargetPointAction(IEntity player, EntityCoordinates target);
void DoTargetPointAction(EntityUid player, EntityCoordinates target);
/// <summary>
/// Perform the server-side logic of the target entity action
/// </summary>
void DoTargetEntityAction(IEntity player, IEntity target);
void DoTargetEntityAction(EntityUid player, EntityUid target);
}
public class ActionAttempt : IActionAttempt
@@ -80,22 +80,22 @@ namespace Content.Shared.Actions
actionsComponent.ToggleAction(_action.ActionType, toggleOn);
}
public void DoInstantAction(IEntity player)
public void DoInstantAction(EntityUid player)
{
_action.InstantAction.DoInstantAction(new InstantActionEventArgs(player, _action.ActionType));
}
public bool DoToggleAction(IEntity player, bool on)
public bool DoToggleAction(EntityUid player, bool on)
{
return _action.ToggleAction.DoToggleAction(new ToggleActionEventArgs(player, _action.ActionType, on));
}
public void DoTargetPointAction(IEntity player, EntityCoordinates target)
public void DoTargetPointAction(EntityUid player, EntityCoordinates target)
{
_action.TargetPointAction.DoTargetPointAction(new TargetPointActionEventArgs(player, target, _action.ActionType));
}
public void DoTargetEntityAction(IEntity player, IEntity target)
public void DoTargetEntityAction(EntityUid player, EntityUid target)
{
_action.TargetEntityAction.DoTargetEntityAction(new TargetEntityActionEventArgs(player, _action.ActionType,
target));
@@ -142,35 +142,35 @@ namespace Content.Shared.Actions
public class ItemActionAttempt : IActionAttempt
{
private readonly ItemActionPrototype _action;
private readonly IEntity _item;
private readonly EntityUid _item;
private readonly ItemActionsComponent _itemActions;
public BaseActionPrototype Action => _action;
public ItemActionAttempt(ItemActionPrototype action, IEntity item, ItemActionsComponent itemActions)
public ItemActionAttempt(ItemActionPrototype action, EntityUid item, ItemActionsComponent itemActions)
{
_action = action;
_item = item;
_itemActions = itemActions;
}
public void DoInstantAction(IEntity player)
public void DoInstantAction(EntityUid player)
{
_action.InstantAction.DoInstantAction(new InstantItemActionEventArgs(player, _item, _action.ActionType));
}
public bool DoToggleAction(IEntity player, bool on)
public bool DoToggleAction(EntityUid player, bool on)
{
return _action.ToggleAction.DoToggleAction(new ToggleItemActionEventArgs(player, on, _item, _action.ActionType));
}
public void DoTargetPointAction(IEntity player, EntityCoordinates target)
public void DoTargetPointAction(EntityUid player, EntityCoordinates target)
{
_action.TargetPointAction.DoTargetPointAction(new TargetPointItemActionEventArgs(player, target, _item,
_action.ActionType));
}
public void DoTargetEntityAction(IEntity player, IEntity target)
public void DoTargetEntityAction(EntityUid player, EntityUid target)
{
_action.TargetEntityAction.DoTargetEntityAction(new TargetEntityItemActionEventArgs(player, target,
_item, _action.ActionType));