Thieves can innately pickpocket - thieving gloves rework (#38123)
* Thieves can innately pickpocket (#107) Pickpocketing a skyrim guard's armor off (cherry picked from commit 21b9f1ddb251ea3c7c6803e78871abefcaecbfb4) * this isnt moff * Make predicted, cleanup * !skating-basketball * orks are NOT the best trollface * Implement much more sensible component replication prevention --------- Co-authored-by: DuckManZach <144298822+duckmanzach@users.noreply.github.com>
This commit is contained in:
@@ -1,23 +1,54 @@
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Strip;
|
||||
using Content.Shared.Strip.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Strip;
|
||||
|
||||
public sealed class ThievingSystem : EntitySystem
|
||||
public sealed partial class ThievingSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ThievingComponent, BeforeStripEvent>(OnBeforeStrip);
|
||||
SubscribeLocalEvent<ThievingComponent, InventoryRelayedEvent<BeforeStripEvent>>((e, c, ev) => OnBeforeStrip(e, c, ev.Args));
|
||||
SubscribeLocalEvent<ThievingComponent, InventoryRelayedEvent<BeforeStripEvent>>((e, c, ev) =>
|
||||
OnBeforeStrip(e, c, ev.Args));
|
||||
SubscribeLocalEvent<ThievingComponent, ToggleThievingEvent>(OnToggleStealthy);
|
||||
SubscribeLocalEvent<ThievingComponent, ComponentInit>(OnCompInit);
|
||||
SubscribeLocalEvent<ThievingComponent, ComponentRemove>(OnCompRemoved);
|
||||
}
|
||||
|
||||
private void OnBeforeStrip(EntityUid uid, ThievingComponent component, BeforeStripEvent args)
|
||||
{
|
||||
args.Stealth |= component.Stealthy;
|
||||
args.Additive -= component.StripTimeReduction;
|
||||
if (args.Stealth)
|
||||
{
|
||||
args.Additive -= component.StripTimeReduction;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCompInit(Entity<ThievingComponent> entity, ref ComponentInit args)
|
||||
{
|
||||
_alertsSystem.ShowAlert(entity, entity.Comp.StealthyAlertProtoId, 1);
|
||||
}
|
||||
|
||||
private void OnCompRemoved(Entity<ThievingComponent> entity, ref ComponentRemove args)
|
||||
{
|
||||
_alertsSystem.ClearAlert(entity, entity.Comp.StealthyAlertProtoId);
|
||||
}
|
||||
|
||||
private void OnToggleStealthy(Entity<ThievingComponent> ent, ref ToggleThievingEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
ent.Comp.Stealthy = !ent.Comp.Stealthy;
|
||||
_alertsSystem.ShowAlert(ent.Owner, ent.Comp.StealthyAlertProtoId, (short)(ent.Comp.Stealthy ? 1 : 0));
|
||||
DirtyField(ent.AsNullable(), nameof(ent.Comp.Stealthy), null);
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user