More DoAfter Changes (#14609)
* DoAfters * Compact Clone() * Fix mice and cuffables * Try generalize attempt events * moves climbabledoafter event to shared, fixes issue with climbable target * Fix merge (cuffing) * Make all events netserializable * handful of doafter events moved * moves the rest of the events to their respective shared folders * Changes all mentions of server doafter to shared * stop stripping cancellation * fix merge errors * draw paused doafters * handle unpausing * missing netserializable ref * removes break on stun reference * removes cuffing state reference * Fix tools * Fix door prying. * Fix construction * Fix dumping * Fix wielding assert * fix rev * Fix test * more test fixes --------- Co-authored-by: keronshb <keronshb@live.com>
This commit is contained in:
@@ -6,6 +6,7 @@ using Content.Server.Storage.EntitySystems;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Body.Part;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction;
|
||||
@@ -39,8 +40,7 @@ namespace Content.Server.Toilet
|
||||
SubscribeLocalEvent<ToiletComponent, InteractHandEvent>(OnInteractHand, new []{typeof(BuckleSystem)});
|
||||
SubscribeLocalEvent<ToiletComponent, ExaminedEvent>(OnExamine);
|
||||
SubscribeLocalEvent<ToiletComponent, SuicideEvent>(OnSuicide);
|
||||
SubscribeLocalEvent<ToiletPryFinished>(OnToiletPried);
|
||||
SubscribeLocalEvent<ToiletPryInterrupted>(OnToiletInterrupt);
|
||||
SubscribeLocalEvent<ToiletComponent, ToiletPryDoAfterEvent>(OnToiletPried);
|
||||
}
|
||||
|
||||
private void OnSuicide(EntityUid uid, ToiletComponent component, SuicideEvent args)
|
||||
@@ -94,29 +94,15 @@ namespace Content.Server.Toilet
|
||||
return;
|
||||
|
||||
// are player trying place or lift of cistern lid?
|
||||
if (EntityManager.TryGetComponent(args.Used, out ToolComponent? tool)
|
||||
&& tool.Qualities.Contains(component.PryingQuality))
|
||||
if (_toolSystem.UseTool(args.Used, args.User, uid, component.PryLidTime, component.PryingQuality, new ToiletPryDoAfterEvent()))
|
||||
{
|
||||
// check if someone is already prying this toilet
|
||||
if (component.IsPrying)
|
||||
return;
|
||||
component.IsPrying = true;
|
||||
|
||||
var toolEvData = new ToolEventData(new ToiletPryFinished(uid));
|
||||
|
||||
// try to pry toilet cistern
|
||||
if (!_toolSystem.UseTool(args.Used, args.User, uid, component.PryLidTime, new [] {component.PryingQuality}, toolEvData))
|
||||
{
|
||||
component.IsPrying = false;
|
||||
return;
|
||||
}
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
// maybe player trying to hide something inside cistern?
|
||||
else if (component.LidOpen)
|
||||
{
|
||||
args.Handled = _secretStash.TryHideItem(uid, args.User, args.Used);
|
||||
args.Handled = true;
|
||||
_secretStash.TryHideItem(uid, args.User, args.Used);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,22 +146,13 @@ namespace Content.Server.Toilet
|
||||
}
|
||||
}
|
||||
|
||||
private void OnToiletInterrupt(ToiletPryInterrupted ev)
|
||||
private void OnToiletPried(EntityUid uid, ToiletComponent toilet, ToiletPryDoAfterEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(ev.Uid, out ToiletComponent? toilet))
|
||||
if (args.Cancelled)
|
||||
return;
|
||||
|
||||
toilet.IsPrying = false;
|
||||
}
|
||||
|
||||
private void OnToiletPried(ToiletPryFinished ev)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(ev.Uid, out ToiletComponent? toilet))
|
||||
return;
|
||||
|
||||
toilet.IsPrying = false;
|
||||
toilet.LidOpen = !toilet.LidOpen;
|
||||
UpdateSprite(ev.Uid, toilet);
|
||||
UpdateSprite(uid, toilet);
|
||||
}
|
||||
|
||||
public void ToggleToiletSeat(EntityUid uid, ToiletComponent? component = null)
|
||||
@@ -197,24 +174,4 @@ namespace Content.Server.Toilet
|
||||
_appearance.SetData(uid, ToiletVisuals.SeatUp, component.IsSeatUp, appearance);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ToiletPryFinished : EntityEventArgs
|
||||
{
|
||||
public EntityUid Uid;
|
||||
|
||||
public ToiletPryFinished(EntityUid uid)
|
||||
{
|
||||
Uid = uid;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ToiletPryInterrupted : EntityEventArgs
|
||||
{
|
||||
public EntityUid Uid;
|
||||
|
||||
public ToiletPryInterrupted(EntityUid uid)
|
||||
{
|
||||
Uid = uid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user