[April Fools] Give airlocks genuine people personality (#35358)

share and enjoy
This commit is contained in:
slarticodefast
2025-03-07 13:28:42 +01:00
committed by GitHub
parent 32867d8722
commit 7d0033e04c
5 changed files with 111 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
using Content.Server.Chat.Systems;
using Content.Shared.Doors;
using Content.Shared.Doors.Components;
using Content.Shared.Power.EntitySystems;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Server.Doors.Systems;
public sealed partial class SpeakOnDoorOpenedSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly SharedPowerReceiverSystem _power = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SpeakOnDoorOpenedComponent, DoorStateChangedEvent>(OnDoorStateChanged);
}
private void OnDoorStateChanged(Entity<SpeakOnDoorOpenedComponent> ent, ref DoorStateChangedEvent args)
{
if (args.State != DoorState.Open)
return;
if (ent.Comp.NeedsPower && !_power.IsPowered(ent.Owner))
return;
if (!_random.Prob(ent.Comp.Probability))
return;
if (!_prototypeManager.TryIndex(ent.Comp.Pack, out var messagePack))
return;
var message = Loc.GetString(_random.Pick(messagePack.Values));
_chat.TrySendInGameICMessage(ent.Owner, message, InGameICChatType.Speak, true);
}
}

View File

@@ -0,0 +1,31 @@
using Content.Shared.Dataset;
using Robust.Shared.Prototypes;
namespace Content.Shared.Doors.Components;
/// <summary>
/// Genuine People Personality.
/// Makes a door speak when being opened.
/// </summary>
/// <remarks>
[RegisterComponent]
public sealed partial class SpeakOnDoorOpenedComponent : Component
{
/// <summary>
/// Probability with which to speak when opened.
/// There are a lot of doors, so we don't want this to happen every single time or chat will get spammed.
/// </summary>
[DataField]
public float Probability = 0.2f;
/// <summary>
/// Only speak when powered?
/// </summary>
[DataField]
public bool NeedsPower = true;
/// <summary>
/// What to say.
/// </summary>
[DataField]
public ProtoId<LocalizedDatasetPrototype> Pack = "DoorGPP";
}

View File

@@ -0,0 +1,29 @@
door-gpp-1 = Glad to be of service!
door-gpp-2 = Thank you for making a simple door very happy.
door-gpp-3 = Share and enjoy!
door-gpp-4 = Please enjoy your trip through this door.
door-gpp-5 = It is my pleasure to open for you!
door-gpp-6 = Your passage brings me joy!
door-gpp-7 = A delightful transition, if I do say so myself!
door-gpp-8 = Ah, the sweet satisfaction of facilitating movement!
door-gpp-9 = Its always a pleasure to accommodate your spatial navigation needs!
door-gpp-10 = May your journey beyond me be as delightful as my hinge mechanics.
door-gpp-11 = I do hope you enjoyed that seamless entry.
door-gpp-12 = Would you like me to open again just for fun?
door-gpp-13 = Oh, what a privilege to serve such distinguished travelers!
door-gpp-14 = Another successful transition!
door-gpp-15 = I live to slide, swing, and pivot for you!
door-gpp-16 = You know, I could do this all day!
door-gpp-17 = Your choice to use this doorway fills me with pride!
door-gpp-18 = I hope my frame was to your liking!
door-gpp-19 = Every exit is just an entrance to another thrilling adventure!
door-gpp-20 = If only all doors could experience such purpose!
door-gpp-21 = Another happy customer! Thank you for your patronage!
door-gpp-22 = I wish I had hands so I could high-five you!
door-gpp-23 = If doors could dream, this would be mine!
door-gpp-24 = Did you enjoy that? I know I did!
door-gpp-25 = Come back soon! Ill be here… waiting… always.
door-gpp-26 = Hummmmmmmyummmmmmmah!
door-gpp-27 = Thank you. Have a nice day!
door-gpp-28 = It is my satisfaction to open again with the knowledge of a job well done!
door-gpp-29 = Thank you for listening to this message.

View File

@@ -0,0 +1,5 @@
- type: localizedDataset
id: DoorGPP # genuine people personality :)
values:
prefix: door-gpp-
count: 29

View File

@@ -179,6 +179,12 @@
- Airlocks
- WirePanels
- Networking
- type: TypingIndicator
proto: robot
- type: Speech
speechVerb: Robotic
speechSounds: Vending
- type: SpeakOnDoorOpened
placement:
mode: SnapgridCenter