Slipping tweaks + remove EffectBlocker (#4955)

* Slipping tweaks + remove EffectBlocker

* mfw failed merge conflict resolution

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
mirrorcult
2021-10-24 23:43:49 -07:00
committed by GitHub
parent e016fc9906
commit c0ecdb09af
16 changed files with 69 additions and 112 deletions

View File

@@ -1,4 +1,5 @@
using Content.Server.Clothing.Components;
using Content.Shared.Slippery;
using Content.Shared.Verbs;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
@@ -12,6 +13,7 @@ namespace Content.Server.Clothing
base.Initialize();
SubscribeLocalEvent<MagbootsComponent, GetActivationVerbsEvent>(AddToggleVerb);
SubscribeLocalEvent<MagbootsComponent, SlipAttemptEvent>(OnSlipAttempt);
}
private void AddToggleVerb(EntityUid uid, MagbootsComponent component, GetActivationVerbsEvent args)
@@ -25,5 +27,13 @@ namespace Content.Server.Clothing
// TODO VERB ICON add toggle icon? maybe a computer on/off symbol?
args.Verbs.Add(verb);
}
private void OnSlipAttempt(EntityUid uid, MagbootsComponent component, SlipAttemptEvent args)
{
if (component.On)
{
args.Cancel();
}
}
}
}

View File

@@ -10,7 +10,6 @@ using Content.Server.Items;
using Content.Server.Storage.Components;
using Content.Shared.ActionBlocker;
using Content.Shared.Acts;
using Content.Shared.EffectBlocker;
using Content.Shared.Inventory;
using Content.Shared.Movement.Components;
using Content.Shared.Popups;
@@ -36,7 +35,7 @@ namespace Content.Server.Inventory.Components
{
[RegisterComponent]
[ComponentReference(typeof(SharedInventoryComponent))]
public class InventoryComponent : SharedInventoryComponent, IExAct, IEffectBlocker
public class InventoryComponent : SharedInventoryComponent, IExAct
{
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
@@ -101,11 +100,6 @@ namespace Content.Server.Inventory.Components
}
}
bool IEffectBlocker.CanSlip()
{
return !TryGetSlotItem(EquipmentSlotDefines.Slots.SHOES, out ItemComponent? shoes) || EffectBlockerSystem.CanSlip(shoes.Owner);
}
protected override void OnRemove()
{
var slots = _slotContainers.Keys.ToList();

View File

@@ -1,5 +1,8 @@
using Content.Server.Atmos;
using Content.Server.Inventory.Components;
using Content.Server.Items;
using Content.Shared.Inventory;
using Content.Shared.Slippery;
using Content.Shared.Damage;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
@@ -17,6 +20,15 @@ namespace Content.Server.Inventory
SubscribeLocalEvent<InventoryComponent, HighPressureEvent>(OnHighPressureEvent);
SubscribeLocalEvent<InventoryComponent, LowPressureEvent>(OnLowPressureEvent);
SubscribeLocalEvent<InventoryComponent, DamageModifyEvent>(OnDamageModify);
SubscribeLocalEvent<InventoryComponent, SlipAttemptEvent>(OnSlipAttemptEvent);
}
private void OnSlipAttemptEvent(EntityUid uid, InventoryComponent component, SlipAttemptEvent args)
{
if (component.TryGetSlotItem(EquipmentSlotDefines.Slots.SHOES, out ItemComponent? shoes))
{
RaiseLocalEvent(shoes.Owner.Uid, args, false);
}
}
private static void HandleInvRemovedFromContainer(EntityUid uid, InventoryComponent component, EntRemovedFromContainerMessage args)