Implanters and Subdermal Implants (#11840)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -34,6 +34,12 @@ namespace Content.Server.Medical.SuitSensors
|
||||
[DataField("activationSlot")]
|
||||
public string ActivationSlot = "jumpsuit";
|
||||
|
||||
/// <summary>
|
||||
/// Activate sensor if user has this in a sensor-compatible container.
|
||||
/// </summary>
|
||||
[DataField("activationContainer")]
|
||||
public string? ActivationContainer;
|
||||
|
||||
/// <summary>
|
||||
/// How often does sensor update its owners status (in seconds). Limited by the system update rate.
|
||||
/// </summary>
|
||||
@@ -43,6 +49,7 @@ namespace Content.Server.Medical.SuitSensors
|
||||
/// <summary>
|
||||
/// Current user that wears suit sensor. Null if nobody wearing it.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public EntityUid? User = null;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -9,6 +9,7 @@ using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Medical.SuitSensor;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
@@ -35,6 +36,8 @@ namespace Content.Server.Medical.SuitSensors
|
||||
SubscribeLocalEvent<SuitSensorComponent, GotUnequippedEvent>(OnUnequipped);
|
||||
SubscribeLocalEvent<SuitSensorComponent, ExaminedEvent>(OnExamine);
|
||||
SubscribeLocalEvent<SuitSensorComponent, GetVerbsEvent<Verb>>(OnVerb);
|
||||
SubscribeLocalEvent<SuitSensorComponent, EntGotInsertedIntoContainerMessage>(OnInsert);
|
||||
SubscribeLocalEvent<SuitSensorComponent, EntGotRemovedFromContainerMessage>(OnRemove);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
@@ -150,6 +153,22 @@ namespace Content.Server.Medical.SuitSensors
|
||||
});
|
||||
}
|
||||
|
||||
private void OnInsert(EntityUid uid, SuitSensorComponent component, EntGotInsertedIntoContainerMessage args)
|
||||
{
|
||||
if (args.Container.ID != component.ActivationContainer)
|
||||
return;
|
||||
|
||||
component.User = args.Container.Owner;
|
||||
}
|
||||
|
||||
private void OnRemove(EntityUid uid, SuitSensorComponent component, EntGotRemovedFromContainerMessage args)
|
||||
{
|
||||
if (args.Container.ID != component.ActivationContainer)
|
||||
return;
|
||||
|
||||
component.User = null;
|
||||
}
|
||||
|
||||
private Verb CreateVerb(EntityUid uid, SuitSensorComponent component, EntityUid userUid, SuitSensorMode mode)
|
||||
{
|
||||
return new Verb()
|
||||
|
||||
Reference in New Issue
Block a user