mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-07 23:07:26 +00:00
* Add set pose (#4682) Co-authored-by: Whisper <121047731+QuietlyWhisper@users.noreply.github.com> # Conflicts: # Resources/Prototypes/_RMC14/Entities/Mobs/Species/base.yml * hi * comment * uncommenting Co-authored-by: DisposableCrewmember42 <disposablecrewmember42@proton.me> Signed-off-by: keekee38 <iamabanana372456@gmail.com> * ok so riders still insistent about the adminlog thingy being weird but did it i think? i may be stupid * ty kotob <3 Co-authored-by: KOTOB <59124164+kotobdev@users.noreply.github.com> Signed-off-by: keekee38 <iamabanana372456@gmail.com> * ok ipcs should be able to now! --------- Signed-off-by: keekee38 <iamabanana372456@gmail.com> Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com> Co-authored-by: Whisper <121047731+QuietlyWhisper@users.noreply.github.com> Co-authored-by: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Co-authored-by: DisposableCrewmember42 <disposablecrewmember42@proton.me> Co-authored-by: KOTOB <59124164+kotobdev@users.noreply.github.com>
65 lines
1.8 KiB
C#
65 lines
1.8 KiB
C#
using Content.Shared.Examine;
|
|
using Content.Shared.Mobs;
|
|
using Content.Shared.Verbs;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Shared._RMC14.Examine.Pose;
|
|
|
|
public abstract class SharedRMCSetPoseSystem : EntitySystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<RMCSetPoseComponent, GetVerbsEvent<Verb>>(OnSetPoseGetVerbs);
|
|
SubscribeLocalEvent<RMCSetPoseComponent, ExaminedEvent>(OnExamine);
|
|
SubscribeLocalEvent<RMCSetPoseComponent, MobStateChangedEvent>(OnMobStateChanged);
|
|
}
|
|
|
|
private void OnSetPoseGetVerbs(Entity<RMCSetPoseComponent> ent, ref GetVerbsEvent<Verb> args)
|
|
{
|
|
if (!args.CanInteract)
|
|
return;
|
|
|
|
if (args.User != args.Target)
|
|
return;
|
|
|
|
Verb verb = new()
|
|
{
|
|
Text = Loc.GetString("rmc-set-pose-title"),
|
|
Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/character.svg.192dpi.png")),
|
|
Priority = -5,
|
|
Act = () => SetPose(ent),
|
|
};
|
|
|
|
args.Verbs.Add(verb);
|
|
}
|
|
|
|
private void OnExamine(Entity<RMCSetPoseComponent> ent, ref ExaminedEvent args)
|
|
{
|
|
var comp = ent.Comp;
|
|
|
|
if (comp.Pose.Trim() == string.Empty)
|
|
return;
|
|
|
|
using (args.PushGroup(nameof(RMCSetPoseComponent)))
|
|
{
|
|
var pose = Loc.GetString("rmc-set-pose-examined", ("ent", ent), ("pose", comp.Pose));
|
|
args.PushMarkup(pose, -5);
|
|
}
|
|
}
|
|
|
|
private void OnMobStateChanged(Entity<RMCSetPoseComponent> ent, ref MobStateChangedEvent args)
|
|
{
|
|
if (args.NewMobState == MobState.Alive)
|
|
return;
|
|
|
|
ent.Comp.Pose = string.Empty; // reset the pose on death/crit
|
|
Dirty(ent);
|
|
}
|
|
|
|
protected virtual void SetPose(Entity<RMCSetPoseComponent> ent)
|
|
{
|
|
}
|
|
}
|