Revert "Actions Rework" (#6888)

This commit is contained in:
Leon Friedrich
2022-02-25 18:55:18 +13:00
committed by GitHub
parent 5ac5dd6a64
commit 49ae383f06
135 changed files with 5165 additions and 3119 deletions

View File

@@ -1,4 +1,6 @@
using Content.Shared.Actions;
using Content.Shared.Actions.Behaviors.Item;
using Content.Shared.Actions.Components;
using Content.Shared.Clothing;
using Content.Shared.Interaction;
using Content.Shared.Inventory;
@@ -36,6 +38,8 @@ namespace Content.Server.Clothing.Components
EntitySystem.Get<MagbootsSystem>().UpdateMagbootEffects(container.Owner, Owner, true, this);
}
if(_entMan.TryGetComponent<ItemActionsComponent>(Owner, out var itemActions))
itemActions.Toggle(ItemActionType.ToggleMagboots, On);
if (_entMan.TryGetComponent<SharedItemComponent>(Owner, out var item))
item.EquippedPrefix = On ? "on" : null;
if(_entMan.TryGetComponent<SpriteComponent>(Owner, out var sprite))
@@ -45,14 +49,33 @@ namespace Content.Server.Clothing.Components
}
}
void IActivate.Activate(ActivateEventArgs eventArgs)
public void Toggle(EntityUid user)
{
On = !On;
}
void IActivate.Activate(ActivateEventArgs eventArgs)
{
Toggle(eventArgs.User);
}
public override ComponentState GetComponentState()
{
return new MagbootsComponentState(On);
}
}
[UsedImplicitly]
[DataDefinition]
public sealed class ToggleMagbootsAction : IToggleItemAction
{
public bool DoToggleAction(ToggleItemActionEventArgs args)
{
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<MagbootsComponent?>(args.Item, out var magboots))
return false;
magboots.Toggle(args.Performer);
return true;
}
}
}