Replace IClickAlert with events (#30728)
* Replace IAlertClick with events * whoop * eek!
This commit is contained in:
@@ -58,6 +58,7 @@ public sealed class PullingSystem : EntitySystem
|
||||
SubscribeLocalEvent<PullableComponent, GetVerbsEvent<Verb>>(AddPullVerbs);
|
||||
SubscribeLocalEvent<PullableComponent, EntGotInsertedIntoContainerMessage>(OnPullableContainerInsert);
|
||||
SubscribeLocalEvent<PullableComponent, ModifyUncuffDurationEvent>(OnModifyUncuffDuration);
|
||||
SubscribeLocalEvent<PullableComponent, StopBeingPulledAlertEvent>(OnStopBeingPulledAlert);
|
||||
|
||||
SubscribeLocalEvent<PullerComponent, AfterAutoHandleStateEvent>(OnAfterState);
|
||||
SubscribeLocalEvent<PullerComponent, EntGotInsertedIntoContainerMessage>(OnPullerContainerInsert);
|
||||
@@ -65,6 +66,7 @@ public sealed class PullingSystem : EntitySystem
|
||||
SubscribeLocalEvent<PullerComponent, VirtualItemDeletedEvent>(OnVirtualItemDeleted);
|
||||
SubscribeLocalEvent<PullerComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
|
||||
SubscribeLocalEvent<PullerComponent, DropHandItemsEvent>(OnDropHandItems);
|
||||
SubscribeLocalEvent<PullerComponent, StopPullingAlertEvent>(OnStopPullingAlert);
|
||||
|
||||
SubscribeLocalEvent<PullableComponent, StrappedEvent>(OnBuckled);
|
||||
SubscribeLocalEvent<PullableComponent, BuckledEvent>(OnGotBuckled);
|
||||
@@ -105,6 +107,15 @@ public sealed class PullingSystem : EntitySystem
|
||||
TryStopPull(pullerComp.Pulling.Value, pullableComp, uid);
|
||||
}
|
||||
|
||||
private void OnStopPullingAlert(Entity<PullerComponent> ent, ref StopPullingAlertEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
if (!TryComp<PullableComponent>(ent.Comp.Pulling, out var pullable))
|
||||
return;
|
||||
args.Handled = TryStopPull(ent.Comp.Pulling.Value, pullable, ent);
|
||||
}
|
||||
|
||||
private void OnPullerContainerInsert(Entity<PullerComponent> ent, ref EntGotInsertedIntoContainerMessage args)
|
||||
{
|
||||
if (ent.Comp.Pulling == null)
|
||||
@@ -133,6 +144,14 @@ public sealed class PullingSystem : EntitySystem
|
||||
args.Duration *= 2;
|
||||
}
|
||||
|
||||
private void OnStopBeingPulledAlert(Entity<PullableComponent> ent, ref StopBeingPulledAlertEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
args.Handled = TryStopPull(ent, ent, ent);
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
@@ -491,6 +510,9 @@ public sealed class PullingSystem : EntitySystem
|
||||
if (pullerUidNull == null)
|
||||
return true;
|
||||
|
||||
if (user != null && !_blocker.CanInteract(user.Value, pullableUid))
|
||||
return false;
|
||||
|
||||
var msg = new AttemptStopPullingEvent(user);
|
||||
RaiseLocalEvent(pullableUid, msg, true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user