Make phones functional (#12892)

This commit is contained in:
Chief-Engineer
2023-01-17 12:42:20 -06:00
committed by GitHub
parent 02c7ae727a
commit 6e8705b2eb
4 changed files with 59 additions and 14 deletions

View File

@@ -12,6 +12,34 @@
[DataField("bibleUserOnly")]
[ViewVariables(VVAccess.ReadWrite)]
public bool BibleUserOnly;
/// <summary>
/// Message given to user to notify them a message was sent
/// </summary>
[DataField("sentMessage")]
[ViewVariables(VVAccess.ReadWrite)]
public string SentMessage = "prayer-popup-notify-pray-sent";
/// <summary>
/// Prefix used in the notification to admins
/// </summary>
[DataField("notifiactionPrefix")]
[ViewVariables(VVAccess.ReadWrite)]
public string NotifiactionPrefix = "prayer-chat-notify-pray";
/// <summary>
/// Used in window title and context menu
/// </summary>
[DataField("verb")]
[ViewVariables(VVAccess.ReadOnly)]
public string Verb = "prayer-verbs-pray";
/// <summary>
/// Context menu image
/// </summary>
[DataField("verbImage")]
[ViewVariables(VVAccess.ReadOnly)]
public string VerbImage = "/Textures/Interface/pray.svg.png";
}
}

View File

@@ -1,4 +1,4 @@
using Content.Server.Administration;
using Content.Server.Administration;
using Content.Server.Administration.Logs;
using Content.Server.Bible.Components;
using Content.Server.Chat.Managers;
@@ -44,8 +44,8 @@ public sealed class PrayerSystem : EntitySystem
var prayerVerb = new ActivationVerb
{
Text = Loc.GetString("prayer-verbs-pray"),
IconTexture = "/Textures/Interface/pray.svg.png",
Text = Loc.GetString(comp.Verb),
IconTexture = comp.VerbImage == "" ? null : comp.VerbImage,
Act = () =>
{
if (comp.BibleUserOnly && !EntityManager.TryGetComponent<BibleUserComponent>(args.User, out var bibleUser))
@@ -54,9 +54,9 @@ public sealed class PrayerSystem : EntitySystem
return;
}
_quickDialog.OpenDialog(actor.PlayerSession, "Pray", "Message", (string message) =>
_quickDialog.OpenDialog(actor.PlayerSession, Loc.GetString(comp.Verb), "Message", (string message) =>
{
Pray(actor.PlayerSession, message);
Pray(actor.PlayerSession, comp, message);
});
},
Impact = LogImpact.Low,
@@ -78,7 +78,7 @@ public sealed class PrayerSystem : EntitySystem
if (target.AttachedEntity == null)
return;
var message = popupMessage == "" ? "" : popupMessage + $" \"{messageString}\"";
var message = popupMessage == "" ? "" : popupMessage + (messageString == "" ? "" : $" \"{messageString}\"");
_popupSystem.PopupEntity(popupMessage, target.AttachedEntity.Value, target, PopupType.Large);
_chatManager.ChatMessageToOne(ChatChannel.Local, messageString, message, EntityUid.Invalid, false, target.ConnectedClient);
@@ -89,20 +89,21 @@ public sealed class PrayerSystem : EntitySystem
/// Sends a message to the admin channel with a message and username
/// </summary>
/// <param name="sender">The IPlayerSession who sent the original message</param>
/// <param name="comp">Prayable component used to make the prayer</param>
/// <param name="message">Message to be sent to the admin chat</param>
/// <remarks>
/// You may be wondering, "Why the admin chat, specifically? Nobody even reads it!"
/// Exactly.
/// </remarks>
public void Pray(IPlayerSession sender, string message)
public void Pray(IPlayerSession sender, PrayableComponent comp, string message)
{
if (sender.AttachedEntity == null)
return;
_popupSystem.PopupEntity(Loc.GetString("prayer-popup-notify-sent"), sender.AttachedEntity.Value, sender, PopupType.Medium);
_popupSystem.PopupEntity(Loc.GetString(comp.SentMessage), sender.AttachedEntity.Value, sender, PopupType.Medium);
_chatManager.SendAdminAnnouncement(Loc.GetString("prayer-chat-notify", ("name", sender.Name), ("message", message)));
_adminLogger.Add(LogType.AdminMessage, LogImpact.Low, $"{ToPrettyString(sender.AttachedEntity.Value):player} sent prayer: {message}");
_chatManager.SendAdminAnnouncement($"{Loc.GetString(comp.NotifiactionPrefix)} <{sender.Name}>: {message}");
_adminLogger.Add(LogType.AdminMessage, LogImpact.Low, $"{ToPrettyString(sender.AttachedEntity.Value):player} sent prayer ({Loc.GetString(comp.NotifiactionPrefix)}): {message}");
}
}

View File

@@ -1,7 +1,13 @@
prayer-verbs-subtle-message = Subtle Message
prayer-verbs-pray = Pray
prayer-chat-notify = PRAYER: <{$name}>: {$message}
prayer-verbs-call = Call
prayer-chat-notify-pray = PRAYER
prayer-chat-notify-honkmother = HONKMOTHER
prayer-chat-notify-centcom = CENTCOM
prayer-popup-subtle-default = You hear a voice in your head...
prayer-popup-notify-sent = Your message has been sent to the gods...
prayer-popup-notify-locked = You don't feel worthy enough...
prayer-popup-notify-honkmother-sent = You left a voicemail message for the Honkmother...
prayer-popup-notify-centcom-sent = You left a voicemail message for Central Command...
prayer-popup-notify-pray-sent = Your message has been sent to the gods...
prayer-popup-notify-pray-locked = You don't feel worthy enough...

View File

@@ -56,6 +56,11 @@
program: 124
- type: Item
size: 10
- type: Prayable
sentMessage: prayer-popup-notify-centcom-sent
notifiactionPrefix: prayer-chat-notify-centcom
verb: prayer-verbs-call
verbImage: ""
- type: entity
parent: BaseHandheldInstrument
@@ -159,3 +164,8 @@
density: 5
mask:
- ItemMask
- type: Prayable
sentMessage: prayer-popup-notify-honkmother-sent
notifiactionPrefix: prayer-chat-notify-honkmother
verb: prayer-verbs-call
verbImage: ""