porting RMC pose stuff (#5558)
* 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>
This commit is contained in:
parent
4c8b78221a
commit
88310fef8d
|
|
@ -0,0 +1,5 @@
|
|||
using Content.Shared._RMC14.Examine.Pose;
|
||||
|
||||
namespace Content.Client._RMC14.Examine;
|
||||
|
||||
public sealed class RMCSetPoseSystem : SharedRMCSetPoseSystem;
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
using Content.Server.Administration;
|
||||
using Content.Shared._RMC14.Examine.Pose;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Database;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server._RMC14.Examine;
|
||||
|
||||
public sealed class RMCSetPoseSystem : SharedRMCSetPoseSystem
|
||||
{
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLog = default!;
|
||||
[Dependency] private readonly QuickDialogSystem _quickDialog = default!;
|
||||
|
||||
protected override void SetPose(Entity<RMCSetPoseComponent> ent)
|
||||
{
|
||||
base.SetPose(ent);
|
||||
|
||||
if (!TryComp<ActorComponent>(ent, out var actor))
|
||||
return;
|
||||
|
||||
var setPosePrompt = Loc.GetString("rmc-set-pose-dialog", ("ent", ent));
|
||||
_quickDialog.OpenDialog(actor.PlayerSession,
|
||||
Loc.GetString("rmc-set-pose-title"),
|
||||
setPosePrompt,
|
||||
(string pose) =>
|
||||
{
|
||||
if (pose.Length > 1000)
|
||||
pose = pose[..999];
|
||||
_adminLog.Add(LogType.RMCSetPose, $"{ToPrettyString(ent)} set their pose to {pose}");
|
||||
ent.Comp.Pose = pose;
|
||||
Dirty(ent);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -481,4 +481,9 @@ public enum LogType
|
|||
/// Events relating to midi playback.
|
||||
/// </summary>
|
||||
Instrument = 103,
|
||||
|
||||
/// <summary>
|
||||
/// Delta V - RMC Pose port
|
||||
/// </summary>
|
||||
RMCSetPose= 10000,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared._RMC14.Examine.Pose;
|
||||
|
||||
/// <summary>
|
||||
/// Flavour text when this entity is examined. Can be set with an action.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
[Access(typeof(SharedRMCSetPoseSystem))]
|
||||
public sealed partial class RMCSetPoseComponent : Component
|
||||
{
|
||||
[DataField, AutoNetworkedField]
|
||||
public string Pose = string.Empty;
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
rmc-set-pose-examined = [color=lightblue][bold]{ CAPITALIZE(SUBJECT($ent)) } {$pose}[/bold][/color]
|
||||
rmc-set-pose-dialog = This is {$ent}. { CAPITALIZE(SUBJECT($ent)) }...
|
||||
# Delta V - removed conjugation
|
||||
rmc-set-pose-title = Set Pose
|
||||
|
|
@ -231,6 +231,7 @@
|
|||
- type: CosmicCenserTarget # DeltaV - Cosmic Cult
|
||||
- type: Carriable # DeltaV
|
||||
- type: GrappleTarget # DeltaV - Allow targets to be grappled
|
||||
- type: RMCSetPose # DeltaV - RMC pose port
|
||||
|
||||
- type: entity
|
||||
save: false
|
||||
|
|
|
|||
|
|
@ -338,3 +338,4 @@
|
|||
- type: CosmicCenserTarget # DeltaV - Cosmic Cult
|
||||
- type: GrappleTarget # DeltaV - Allow targets to be grappled
|
||||
- type: CanDoCPR # DeltaV - Addition of CPR
|
||||
- type: RMCSetPose # DeltaV - RMC pose port
|
||||
|
|
|
|||
Loading…
Reference in New Issue