Это заняло больше времени, чем я думал (#782)
This commit is contained in:
@@ -44,6 +44,18 @@ public sealed class SubdermalImplantRemoved(EntityUid user, EntityUid target, Su
|
||||
public SubdermalImplantComponent Component = component;
|
||||
}
|
||||
|
||||
public sealed class ImplanterUsed(EntityUid implant, EntityUid implanter) : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Implant which was used
|
||||
/// </summary>
|
||||
public EntityUid Implant = implant;
|
||||
/// <summary>
|
||||
/// Implanter which was used
|
||||
/// </summary>
|
||||
public EntityUid Implanter = implanter;
|
||||
}
|
||||
|
||||
//WD EDIT END
|
||||
|
||||
public abstract class SharedImplanterSystem : EntitySystem
|
||||
@@ -113,6 +125,7 @@ public abstract class SharedImplanterSystem : EntitySystem
|
||||
|
||||
var ev = new TransferDnaEvent { Donor = target, Recipient = implanter };
|
||||
RaiseLocalEvent(target, ref ev);
|
||||
RaiseLocalEvent(implant.Value, new ImplanterUsed(implant.Value, implanter)); // WD
|
||||
|
||||
Dirty(implanter, component);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Implants;
|
||||
using Content.Shared.Tag;
|
||||
|
||||
namespace Content.Shared._White.Implants.VoiceActivatedBomb;
|
||||
|
||||
public abstract class SharedVoiceActivatedBombSystem : EntitySystem
|
||||
{
|
||||
[Dependency] protected readonly TagSystem Tag = default!;
|
||||
protected const string VoiceActivatedBombTag = "VoiceActivatedBombImplant";
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<BodyComponent, AddImplantAttemptEvent>(OnTryInsertVoiceActivatedBomb);
|
||||
}
|
||||
|
||||
private void OnTryInsertVoiceActivatedBomb(Entity<BodyComponent> ent, ref AddImplantAttemptEvent args)
|
||||
{
|
||||
if (!Tag.HasTag(args.Implant, VoiceActivatedBombTag))
|
||||
return;
|
||||
|
||||
var ev = new InsertVoiceActivatedBombEvent(args.User, args.Implant, args.Implanter);
|
||||
RaiseLocalEvent(args.Implant, ev);
|
||||
if (ev.Cancelled)
|
||||
args.Cancel();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
public sealed class InsertVoiceActivatedBombEvent(EntityUid user, EntityUid implant, EntityUid implanter)
|
||||
: CancellableEntityEventArgs
|
||||
{
|
||||
public readonly EntityUid User = user;
|
||||
public readonly EntityUid Implant = implant;
|
||||
public readonly EntityUid Implanter = implanter;
|
||||
}
|
||||
Reference in New Issue
Block a user