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:
keronshb
2022-11-20 01:49:37 -05:00
committed by GitHub
parent a5dff7eee7
commit 671324bef8
48 changed files with 1633 additions and 79 deletions

View File

@@ -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>

View File

@@ -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()