mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-19 06:28:40 +03:00
Lots of stuff. Also moved everything I could to the _Shitmed namespace
as I do in Goob. Will make future ports way faster
# Changelog
🆑 Mocho
- add: Added some fun organs and other thingies, check out the Goob PRs
if you want more details.
- fix: Fixed tons of issues with shitmed. Too many for the changelog in
fact.
(cherry picked from commit 3c9db94102cb25b28a83d51ac8d659fa31fe7d12)
66 lines
2.8 KiB
C#
66 lines
2.8 KiB
C#
using Content.Shared.Body.Organ;
|
|
using Content.Shared.Body.Part;
|
|
using Content.Shared.Examine;
|
|
using Content.Shared.Verbs;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Shared._Shitmed.Medical.Surgery.Tools;
|
|
|
|
/// <summary>
|
|
/// Examining a surgical or ghetto tool shows everything it can be used for.
|
|
/// </summary>
|
|
public sealed class SurgeryToolExamineSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly ExamineSystemShared _examine = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<SurgeryToolComponent, GetVerbsEvent<ExamineVerb>>(OnGetVerbs);
|
|
|
|
SubscribeLocalEvent<BoneGelComponent, SurgeryToolExaminedEvent>(OnExamined);
|
|
SubscribeLocalEvent<BoneSawComponent, SurgeryToolExaminedEvent>(OnExamined);
|
|
SubscribeLocalEvent<CauteryComponent, SurgeryToolExaminedEvent>(OnExamined);
|
|
SubscribeLocalEvent<HemostatComponent, SurgeryToolExaminedEvent>(OnExamined);
|
|
SubscribeLocalEvent<RetractorComponent, SurgeryToolExaminedEvent>(OnExamined);
|
|
SubscribeLocalEvent<ScalpelComponent, SurgeryToolExaminedEvent>(OnExamined);
|
|
SubscribeLocalEvent<DrillComponent, SurgeryToolExaminedEvent>(OnExamined);
|
|
SubscribeLocalEvent<TendingComponent, SurgeryToolExaminedEvent>(OnExamined);
|
|
SubscribeLocalEvent<TweezersComponent, SurgeryToolExaminedEvent>(OnExamined);
|
|
|
|
SubscribeLocalEvent<BodyPartComponent, SurgeryToolExaminedEvent>(OnExamined);
|
|
SubscribeLocalEvent<OrganComponent, SurgeryToolExaminedEvent>(OnExamined);
|
|
}
|
|
|
|
private void OnGetVerbs(Entity<SurgeryToolComponent> ent, ref GetVerbsEvent<ExamineVerb> args)
|
|
{
|
|
if (!args.CanInteract || !args.CanAccess)
|
|
return;
|
|
|
|
var msg = FormattedMessage.FromMarkupOrThrow(Loc.GetString("surgery-tool-header"));
|
|
msg.PushNewline();
|
|
var ev = new SurgeryToolExaminedEvent(msg);
|
|
RaiseLocalEvent(ent, ref ev);
|
|
|
|
_examine.AddDetailedExamineVerb(args, ent.Comp, ev.Message,
|
|
Loc.GetString("surgery-tool-examinable-verb-text"), "/Textures/Objects/Specific/Medical/Surgery/scalpel.rsi/scalpel.png",
|
|
Loc.GetString("surgery-tool-examinable-verb-message"));
|
|
}
|
|
|
|
private void OnExamined(EntityUid uid, ISurgeryToolComponent comp, ref SurgeryToolExaminedEvent args)
|
|
{
|
|
var msg = args.Message;
|
|
var color = comp.Speed switch
|
|
{
|
|
< 1f => "red",
|
|
> 1f => "green",
|
|
_ => "white"
|
|
};
|
|
var key = "surgery-tool-" + (comp.Used == true ? "used" : "unlimited");
|
|
var speed = comp.Speed.ToString("N2"); // 2 decimal places to not get trolled by float
|
|
msg.PushMarkup(Loc.GetString(key, ("tool", comp.ToolName), ("speed", speed), ("color", color)));
|
|
}
|
|
}
|
|
|
|
[ByRefEvent]
|
|
public record struct SurgeryToolExaminedEvent(FormattedMessage Message);
|