Prayer Fixes (#12752)
* fixe * no more ahelp spam * More fixes * i hate * typo fix Co-authored-by: Just-a-Unity-Dev <just-a-unity-dev@users.noreply.github.com>
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Prayer;
|
||||
|
||||
namespace Content.Client.Prayer;
|
||||
/// <summary>
|
||||
/// System to handle subtle messages and praying
|
||||
/// </summary>
|
||||
public sealed class PrayerSystem : SharedPrayerSystem
|
||||
{
|
||||
protected override void OnPrayerTextMessage(PrayerTextMessage message, EntitySessionEventArgs eventArgs)
|
||||
{
|
||||
var bwoinkMessage = new SharedBwoinkSystem.BwoinkTextMessage(eventArgs.SenderSession.UserId,
|
||||
eventArgs.SenderSession.UserId, message.Text);
|
||||
|
||||
RaiseNetworkEvent(bwoinkMessage);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ using Content.Shared.Popups;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Player;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.Prayer;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -15,7 +14,10 @@ namespace Content.Server.Prayer;
|
||||
/// <summary>
|
||||
/// System to handle subtle messages and praying
|
||||
/// </summary>
|
||||
public sealed class PrayerSystem : SharedPrayerSystem
|
||||
/// <remarks>
|
||||
/// Rain is a professional developer and this did not take 2 PRs to fix subtle messages
|
||||
/// </remarks>
|
||||
public sealed class PrayerSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly IChatManager _chatManager = default!;
|
||||
@@ -34,24 +36,29 @@ public sealed class PrayerSystem : SharedPrayerSystem
|
||||
if (!EntityManager.TryGetComponent<ActorComponent?>(args.User, out var actor))
|
||||
return;
|
||||
|
||||
// this is to prevent ghosts from using it
|
||||
if (!args.CanAccess)
|
||||
return;
|
||||
|
||||
ActivationVerb prayerVerb = new();
|
||||
prayerVerb.Text = Loc.GetString("prayer-verbs-pray");
|
||||
prayerVerb.IconTexture = "/Textures/Interface/pray.svg.png";
|
||||
prayerVerb.Act = () =>
|
||||
var prayerVerb = new ActivationVerb
|
||||
{
|
||||
if (comp.BibleUserOnly && !EntityManager.TryGetComponent<BibleUserComponent>(args.User, out var bibleUser))
|
||||
Text = Loc.GetString("prayer-verbs-pray"),
|
||||
IconTexture = "/Textures/Interface/pray.svg.png",
|
||||
Act = () =>
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("prayer-popup-notify-locked"), uid, Filter.Empty().AddPlayer(actor.PlayerSession), PopupType.Large);
|
||||
return;
|
||||
}
|
||||
if (comp.BibleUserOnly && !EntityManager.TryGetComponent<BibleUserComponent>(args.User, out var bibleUser))
|
||||
{
|
||||
_popupSystem.PopupEntity(Loc.GetString("prayer-popup-notify-locked"), uid, Filter.Empty().AddPlayer(actor.PlayerSession), PopupType.Large);
|
||||
return;
|
||||
}
|
||||
|
||||
_quickDialog.OpenDialog(actor.PlayerSession, "Pray", "Message", (string message) =>
|
||||
{
|
||||
Pray(actor.PlayerSession, message);
|
||||
});
|
||||
},
|
||||
Impact = LogImpact.Low,
|
||||
|
||||
_quickDialog.OpenDialog(actor.PlayerSession, "Pray", "Message", (string message) =>
|
||||
{
|
||||
Pray(actor.PlayerSession, message);
|
||||
});
|
||||
};
|
||||
prayerVerb.Impact = LogImpact.Low;
|
||||
args.Verbs.Add(prayerVerb);
|
||||
@@ -68,8 +75,10 @@ public sealed class PrayerSystem : SharedPrayerSystem
|
||||
if (target.AttachedEntity == null)
|
||||
return;
|
||||
|
||||
var message = popupMessage == "" ? "" : popupMessage + $" \"{messageString}\"";
|
||||
|
||||
_popupSystem.PopupEntity(popupMessage, target.AttachedEntity.Value, Filter.Empty().AddPlayer(target), PopupType.Large);
|
||||
_chatManager.ChatMessageToOne(ChatChannel.Local, messageString, popupMessage + " \"{message}\"", EntityUid.Invalid, false, target.ConnectedClient);
|
||||
_chatManager.ChatMessageToOne(ChatChannel.Local, messageString, message, EntityUid.Invalid, false, target.ConnectedClient);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -86,10 +95,9 @@ public sealed class PrayerSystem : SharedPrayerSystem
|
||||
if (sender.AttachedEntity == null)
|
||||
return;
|
||||
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("prayer-popup-notify-sent"), sender.AttachedEntity.Value, Filter.Empty().AddPlayer(sender), PopupType.Medium);
|
||||
|
||||
var networkMessage = new PrayerTextMessage(Loc.GetString("prayer-chat-notify", ("message", message)));
|
||||
|
||||
RaiseNetworkEvent(networkMessage, sender);
|
||||
_chatManager.SendAdminAnnouncement(Loc.GetString("prayer-chat-notify", ("name", sender.Name), ("message", message)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Prayer;
|
||||
|
||||
/// <summary>
|
||||
/// Shared system for handling Prayers
|
||||
/// </summary>
|
||||
public abstract class SharedPrayerSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeNetworkEvent<PrayerTextMessage>(OnPrayerTextMessage);
|
||||
}
|
||||
|
||||
protected virtual void OnPrayerTextMessage(PrayerTextMessage message, EntitySessionEventArgs eventArgs)
|
||||
{
|
||||
// Specific side code in target.
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class PrayerTextMessage : EntityEventArgs
|
||||
{
|
||||
public string Text { get; }
|
||||
|
||||
public PrayerTextMessage(string text)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
prayer-verbs-subtle-message = Subtle Message
|
||||
prayer-verbs-pray = Pray
|
||||
prayer-chat-notify = PRAYER: {$message}
|
||||
prayer-chat-notify = PRAYER: <{$name}>: {$message}
|
||||
|
||||
prayer-popup-subtle-default = You hear a voice in your head...
|
||||
prayer-popup-notify-sent = Your message has been sent to the gods...
|
||||
|
||||
Reference in New Issue
Block a user