Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepyyapril committed Jan 18, 2025
2 parents 8526ddb + ec7a862 commit 3629f59
Show file tree
Hide file tree
Showing 166 changed files with 1,459 additions and 212 deletions.
4 changes: 4 additions & 0 deletions Content.Client/Chat/Managers/ChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public void SendMessage(string text, ChatSelectChannel channel)
_consoleHost.ExecuteCommand($"subtle \"{CommandParsing.Escape(str)}\"");
break;

case ChatSelectChannel.SubtleOOC: // Den
_consoleHost.ExecuteCommand($"subtleooc \"{CommandParsing.Escape(str)}\"");
break;

case ChatSelectChannel.Dead:
if (_systems.GetEntitySystemOrNull<GhostSystem>() is {IsGhost: true})
goto case ChatSelectChannel.Local;
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Chemistry/UI/ChemMasterWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
MinSize="620 770"
MinSize="770 770"
Title="{Loc 'chem-master-bound-user-interface-title'}">
<TabContainer Name="Tabs" Margin="5 5 7 5">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" Margin="5" SeparationOverride="10">
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/GameTicking/Managers/ClientGameTicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Client.Lobby;
using Content.Client.RoundEnd;
using Content.Shared.GameTicking;
using Content.Shared.GameTicking.Prototypes;
using Content.Shared.GameWindow;
using JetBrains.Annotations;
using Robust.Client.Graphics;
Expand All @@ -29,7 +30,7 @@ public sealed class ClientGameTicker : SharedGameTicker
[ViewVariables] public bool AreWeReady { get; private set; }
[ViewVariables] public bool IsGameStarted { get; private set; }
[ViewVariables] public string? RestartSound { get; private set; }
[ViewVariables] public string? LobbyBackground { get; private set; }
[ViewVariables] public LobbyBackgroundPrototype? LobbyBackground { get; private set; }
[ViewVariables] public bool DisallowedLateJoin { get; private set; }
[ViewVariables] public string? ServerInfoBlob { get; private set; }
[ViewVariables] public TimeSpan StartTime { get; private set; }
Expand Down
34 changes: 28 additions & 6 deletions Content.Client/Lobby/LobbyState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;


namespace Content.Client.Lobby
{
public sealed class LobbyState : Robust.Client.State.State
Expand All @@ -25,6 +24,7 @@ public sealed class LobbyState : Robust.Client.State.State
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IVoteManager _voteManager = default!;

private ISawmill _sawmill = default!;
private ClientGameTicker _gameTicker = default!;
private ContentAudioSystem _contentAudioSystem = default!;

Expand All @@ -42,6 +42,7 @@ protected override void Startup()
_gameTicker = _entityManager.System<ClientGameTicker>();
_contentAudioSystem = _entityManager.System<ContentAudioSystem>();
_contentAudioSystem.LobbySoundtrackChanged += UpdateLobbySoundtrackInfo;
_sawmill = Logger.GetSawmill("lobby");

chatController.SetMainChat(true);

Expand Down Expand Up @@ -113,7 +114,7 @@ public override void FrameUpdate(FrameEventArgs e)
return;
}

Lobby!.StationTime.Text = Loc.GetString("lobby-state-player-status-round-not-started");
Lobby!.StationTime.Text = Loc.GetString("lobby-state-player-status-round-not-started");
string text;

if (_gameTicker.Paused)
Expand Down Expand Up @@ -161,7 +162,7 @@ private void UpdateLobbyUi()
else
{
Lobby!.StartTime.Text = string.Empty;
Lobby!.ReadyButton.Text = Loc.GetString(Lobby!.ReadyButton.Pressed ? "lobby-state-player-status-ready": "lobby-state-player-status-not-ready");
Lobby!.ReadyButton.Text = Loc.GetString(Lobby!.ReadyButton.Pressed ? "lobby-state-player-status-ready" : "lobby-state-player-status-not-ready");
Lobby!.ReadyButton.ToggleMode = true;
Lobby!.ReadyButton.Disabled = false;
Lobby!.ReadyButton.Pressed = _gameTicker.AreWeReady;
Expand Down Expand Up @@ -200,10 +201,31 @@ private void UpdateLobbySoundtrackInfo(LobbySoundtrackChangedEvent ev)
private void UpdateLobbyBackground()
{
if (_gameTicker.LobbyBackground != null)
Lobby!.Background.Texture = _resourceCache.GetResource<TextureResource>(_gameTicker.LobbyBackground);
else
Lobby!.Background.Texture = null;
{
Lobby!.Background.Texture = _resourceCache.GetResource<TextureResource>(_gameTicker.LobbyBackground.Background);

var lobbyBackground = _gameTicker.LobbyBackground;

var name = string.IsNullOrEmpty(lobbyBackground.Name)
? Loc.GetString("lobby-state-background-unknown-title")
: lobbyBackground.Name;

var artist = string.IsNullOrEmpty(lobbyBackground.Artist)
? Loc.GetString("lobby-state-background-unknown-artist")
: lobbyBackground.Artist;

var markup = Loc.GetString("lobby-state-background-text",
("backgroundName", name),
("backgroundArtist", artist));

Lobby!.LobbyBackground.SetMarkup(markup);

return;
}

_sawmill.Warning("_gameTicker.LobbyBackground was null! No lobby background selected.");
Lobby!.Background.Texture = null;
Lobby!.LobbyBackground.SetMarkup(Loc.GetString("lobby-state-background-no-background-text"));
}

private void SetReady(bool newReady)
Expand Down
5 changes: 4 additions & 1 deletion Content.Client/Lobby/UI/LobbyGui.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@
<!-- Vertical Padding-->
<Control VerticalExpand="True" />
<!-- Left Bot Panel -->
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Bottom">
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Bottom" SeparationOverride="4">
<info:DevInfoBanner Name="DevInfoBanner" VerticalExpand="false" Margin="3 3 3 3" />
<PanelContainer StyleClasses="AngleRect">
<RichTextLabel Name="LobbySong" Access="Public" HorizontalAlignment="Center" />
</PanelContainer>
<PanelContainer StyleClasses="AngleRect">
<RichTextLabel Name="LobbyBackground" Access="Public" HorizontalAlignment="Center" />
</PanelContainer>
</BoxContainer>
</Control>
<!-- Character setup state -->
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Lobby/UI/LobbyGui.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public LobbyGui()
SetAnchorPreset(Background, LayoutPreset.Wide);

LobbySong.SetMarkup(Loc.GetString("lobby-state-song-no-song-text"));
LobbyBackground.SetMarkup(Loc.GetString("lobby-state-background-no-background-text"));

LeaveButton.OnPressed += _ => _consoleHost.ExecuteCommand("disconnect");
OptionsButton.OnPressed += _ => UserInterfaceManager.GetUIController<OptionsUIController>().ToggleWindow();
Expand Down
5 changes: 5 additions & 0 deletions Content.Client/UserInterface/Systems/Chat/ChatUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public sealed class ChatUIController : UIController
{SharedChatSystem.EmotesPrefix, ChatSelectChannel.Emotes},
{SharedChatSystem.EmotesAltPrefix, ChatSelectChannel.Emotes},
{SharedChatSystem.SubtlePrefix, ChatSelectChannel.Subtle}, // Floofstation
{SharedChatSystem.SubtleOOCPrefix, ChatSelectChannel.SubtleOOC}, // Den
{SharedChatSystem.AdminPrefix, ChatSelectChannel.Admin},
{SharedChatSystem.RadioCommonPrefix, ChatSelectChannel.Radio},
{SharedChatSystem.DeadPrefix, ChatSelectChannel.Dead},
Expand All @@ -100,6 +101,7 @@ public sealed class ChatUIController : UIController
{ChatSelectChannel.OOC, SharedChatSystem.OOCPrefix},
{ChatSelectChannel.Emotes, SharedChatSystem.EmotesPrefix},
{ChatSelectChannel.Subtle, SharedChatSystem.SubtlePrefix}, // Floofstation
{ChatSelectChannel.SubtleOOC, SharedChatSystem.SubtleOOCPrefix}, // Den
{ChatSelectChannel.Admin, SharedChatSystem.AdminPrefix},
{ChatSelectChannel.Radio, SharedChatSystem.RadioCommonPrefix},
{ChatSelectChannel.Dead, SharedChatSystem.DeadPrefix},
Expand Down Expand Up @@ -544,12 +546,14 @@ private void UpdateChannelPermissions()
if (_ghost is not {IsGhost: true})
{
FilterableChannels |= ChatChannel.Subtle;
FilterableChannels |= ChatChannel.SubtleOOC;

CanSendChannels |= ChatSelectChannel.Local;
CanSendChannels |= ChatSelectChannel.Whisper;
CanSendChannels |= ChatSelectChannel.Radio;
CanSendChannels |= ChatSelectChannel.Emotes;
CanSendChannels |= ChatSelectChannel.Subtle; // Floofstation
CanSendChannels |= ChatSelectChannel.SubtleOOC;
}
}

Expand All @@ -563,6 +567,7 @@ private void UpdateChannelPermissions()
if (_admin.HasFlag(AdminFlags.Pii) && _ghost is { IsGhost: true })
{
FilterableChannels |= ChatChannel.Subtle;
FilterableChannels |= ChatChannel.SubtleOOC;
}

// only admins can see / filter asay
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public sealed partial class ChannelFilterPopup : Popup
ChatChannel.Local,
ChatChannel.Whisper,
ChatChannel.Subtle,
ChatChannel.SubtleOOC,
ChatChannel.Emotes,
ChatChannel.Radio,
ChatChannel.Telepathic, //Nyano - Summary: adds telepathic chat to where it belongs in order in the chat.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public sealed class ChannelSelectorPopup : Popup
ChatSelectChannel.Whisper,
ChatSelectChannel.Emotes,
ChatSelectChannel.Subtle, // Floofstation
ChatSelectChannel.SubtleOOC,
ChatSelectChannel.Radio,
ChatSelectChannel.Telepathic, //Nyano - Summary: determines the order in which telepathic shows.
ChatSelectChannel.LOOC,
Expand Down
4 changes: 3 additions & 1 deletion Content.Server/Chat/Commands/SubtleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ internal sealed class SubtleCommand : IConsoleCommand
public string Description => "Perform an subtle action.";
public string Help => "subtle <text>";

private const string SubtleColor = "#d3d3ff";

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
Expand All @@ -38,7 +40,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
return;

IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>()
.TrySendInGameICMessage(playerEntity, message, InGameICChatType.Subtle, ChatTransmitRange.NoGhosts, false, shell, player);
.TrySendInGameICMessage(playerEntity, message, InGameICChatType.Subtle, ChatTransmitRange.NoGhosts, false, shell, player, color: SubtleColor);
}
}
}
46 changes: 46 additions & 0 deletions Content.Server/Chat/Commands/SubtleOOCCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Content.Server.Chat.Systems;
using Content.Shared.Administration;
using Content.Shared.Chat;
using Robust.Shared.Console;
using Robust.Shared.Enums;

namespace Content.Server.Chat.Commands
{
[AnyCommand]
internal sealed class SubtleOOCCommand : IConsoleCommand
{
public string Command => "subtleooc";
public string Description => "Perform an subtle action.";
public string Help => "subtleooc <text>";

private const string SubtleOOCColor = "#ff7782";

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
{
shell.WriteError("This command cannot be run from the server.");
return;
}

if (player.Status != SessionStatus.InGame)
return;

if (player.AttachedEntity is not {} playerEntity)
{
shell.WriteError("You don't have an entity!");
return;
}

if (args.Length < 1)
return;

var message = string.Join(" ", args).Trim();
if (string.IsNullOrEmpty(message))
return;

IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>()
.TrySendInGameICMessage(playerEntity, message, InGameICChatType.SubtleOOC, ChatTransmitRange.NoGhosts, false, shell, player, color: SubtleOOCColor);
}
}
}
16 changes: 11 additions & 5 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ public void TrySendInGameICMessage(
string? nameOverride = null,
bool checkRadioPrefix = true,
bool ignoreActionBlocker = false,
LanguagePrototype? languageOverride = null
LanguagePrototype? languageOverride = null,
string? color = null
)
{
if (HasComp<GhostComponent>(source))
Expand Down Expand Up @@ -231,7 +232,7 @@ public void TrySendInGameICMessage(

var language = languageOverride ?? _language.GetLanguage(source);

bool shouldCapitalize = (desiredType != InGameICChatType.Emote && desiredType != InGameICChatType.Subtle);
bool shouldCapitalize = (desiredType != InGameICChatType.Emote && desiredType != InGameICChatType.Subtle && desiredType != InGameICChatType.SubtleOOC);
bool shouldPunctuate = _configurationManager.GetCVar(CCVars.ChatPunctuation);
// Capitalizing the word I only happens in English, so we check language here
bool shouldCapitalizeTheWordI = (!CultureInfo.CurrentCulture.IsNeutralCulture && CultureInfo.CurrentCulture.Parent.Name == "en")
Expand Down Expand Up @@ -276,7 +277,10 @@ public void TrySendInGameICMessage(
SendEntityEmote(source, message, range, nameOverride, language, hideLog: hideLog, ignoreActionBlocker: ignoreActionBlocker);
break;
case InGameICChatType.Subtle:
SendEntitySubtle(source, message, range, nameOverride, hideLog: hideLog, ignoreActionBlocker: ignoreActionBlocker);
SendEntitySubtle(source, message, range, nameOverride, hideLog: hideLog, ignoreActionBlocker: ignoreActionBlocker, color: color);
break;
case InGameICChatType.SubtleOOC:
SendEntitySubtle(source, $"ooc: {message}", range, nameOverride, hideLog: hideLog, ignoreActionBlocker: ignoreActionBlocker, color: color);
break;
//Nyano - Summary: case adds the telepathic chat sending ability.
case InGameICChatType.Telepathic:
Expand Down Expand Up @@ -613,7 +617,8 @@ private void SendEntitySubtle(
string? nameOverride,
bool hideLog = false,
bool ignoreActionBlocker = false,
NetUserId? author = null
NetUserId? author = null,
string? color = null
)
{
if (!_actionBlocker.CanEmote(source) && !ignoreActionBlocker)
Expand All @@ -627,7 +632,8 @@ private void SendEntitySubtle(
var wrappedMessage = Loc.GetString("chat-manager-entity-subtle-wrap-message",
("entityName", name),
("entity", ent),
("message", FormattedMessage.RemoveMarkup(action)));
("color", color ?? DefaultSpeakColor.ToHex()),
("message", FormattedMessage.RemoveMarkupPermissive(action)));

foreach (var (session, data) in GetRecipients(source, WhisperClearRange))
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private void OnDamageExamine(EntityUid uid, DamageOtherOnHitComponent component,

var staminaCostMarkup = FormattedMessage.FromMarkupOrThrow(
Loc.GetString("damage-stamina-cost",
("type", Loc.GetString("damage-throw")), ("cost", component.StaminaCost)));
("type", Loc.GetString("damage-throw")), ("cost", Math.Round(component.StaminaCost, 2).ToString("0.##"))));
args.Message.PushNewline();
args.Message.AddMessage(staminaCostMarkup);
}
Expand Down
22 changes: 14 additions & 8 deletions Content.Server/GameTicking/GameTicker.LobbyBackground.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Server.GameTicking.Prototypes;
using Content.Shared.GameTicking.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using System.Linq;
Expand All @@ -8,24 +8,30 @@ namespace Content.Server.GameTicking;
public sealed partial class GameTicker
{
[ViewVariables]
public string? LobbyBackground { get; private set; }
public LobbyBackgroundPrototype? LobbyBackground { get; private set; }

[ViewVariables]
private List<ResPath>? _lobbyBackgrounds;
private List<LobbyBackgroundPrototype> _lobbyBackgrounds = [];

private static readonly string[] WhitelistedBackgroundExtensions = new string[] {"png", "jpg", "jpeg", "webp"};

private void InitializeLobbyBackground()
{
_lobbyBackgrounds = _prototypeManager.EnumeratePrototypes<LobbyBackgroundPrototype>()
.Select(x => x.Background)
.Where(x => WhitelistedBackgroundExtensions.Contains(x.Extension))
.ToList();
foreach (var prototype in _prototypeManager.EnumeratePrototypes<LobbyBackgroundPrototype>())
{
if (!WhitelistedBackgroundExtensions.Contains(prototype.Background.Extension))
{
_sawmill.Warning($"Lobby background '{prototype.ID}' has an invalid extension '{prototype.Background.Extension}' and will be ignored.");
continue;
}

_lobbyBackgrounds.Add(prototype);
}

RandomizeLobbyBackground();
}

private void RandomizeLobbyBackground() {
LobbyBackground = _lobbyBackgrounds!.Any() ? _robustRandom.Pick(_lobbyBackgrounds!).ToString() : null;
LobbyBackground = _lobbyBackgrounds!.Any() ? _robustRandom.Pick(_lobbyBackgrounds!) : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public override void Update(float frameTime)
if (!TryComp<IntrinsicRadioTransmitterComponent>(scribe, out var radio))
continue;

var message = Loc.GetString("glimmer-report", ("level", _glimmerSystem.GlimmerOutput));
var message = Loc.GetString("glimmer-report", ("level", _glimmerSystem.GlimmerOutputString));
var channel = _prototypeManager.Index<RadioChannelPrototype>("Science");
_radioSystem.SendRadioMessage(scribe, message, channel, scribe);

Expand All @@ -62,7 +62,7 @@ private void OnInteractHand(EntityUid uid, SophicScribeComponent component, Inte

component.StateTime = _timing.CurTime + component.StateCD;

_chat.TrySendInGameICMessage(uid, Loc.GetString("glimmer-report", ("level", _glimmerSystem.GlimmerOutput)), InGameICChatType.Speak, true);
_chat.TrySendInGameICMessage(uid, Loc.GetString("glimmer-report", ("level", _glimmerSystem.GlimmerOutputString)), InGameICChatType.Speak, true);
}

private void OnGlimmerEventEnded(GlimmerEventEndedEvent args)
Expand All @@ -79,7 +79,7 @@ private void OnGlimmerEventEnded(GlimmerEventEndedEvent args)
speaker = swapped.OriginalEntity;
}

var message = Loc.GetString(args.Message, ("decrease", args.GlimmerBurned), ("level", _glimmerSystem.GlimmerOutput));
var message = Loc.GetString(args.Message, ("decrease", args.GlimmerBurned), ("level", _glimmerSystem.GlimmerOutputString));
var channel = _prototypeManager.Index<RadioChannelPrototype>("Common");
_radioSystem.SendRadioMessage(speaker, message, channel, speaker);
}
Expand Down
Loading

0 comments on commit 3629f59

Please sign in to comment.