Skip to content

Commit

Permalink
Merge branch 'things' of https://github.com/Hqlle/Lost-Paradise into …
Browse files Browse the repository at this point in the history
…things
  • Loading branch information
Hqlle committed Nov 7, 2024
2 parents 1e48278 + 3248709 commit e45d669
Show file tree
Hide file tree
Showing 193 changed files with 1,979 additions and 245 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 @@ -47,6 +47,10 @@ public void SendMessage(string text, ChatSelectChannel channel)
_consoleHost.ExecuteCommand($"me \"{CommandParsing.Escape(str)}\"");
break;

case ChatSelectChannel.HiddenEmotes:
_consoleHost.ExecuteCommand($"hme \"{CommandParsing.Escape(str)}\"");
break;

case ChatSelectChannel.Dead:
if (_systems.GetEntitySystemOrNull<GhostSystem>() is {IsGhost: true})
goto case ChatSelectChannel.Local;
Expand Down
4 changes: 4 additions & 0 deletions Content.Client/Chat/UI/SpeechBubble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public abstract class SpeechBubble : Control
public enum SpeechType : byte
{
Emote,
HiddenEmote,
Say,
Whisper,
Looc
Expand Down Expand Up @@ -65,6 +66,9 @@ public static SpeechBubble CreateSpeechBubble(SpeechType type, ChatMessage messa
case SpeechType.Emote:
return new TextSpeechBubble(message, senderEntity, "emoteBox");

case SpeechType.HiddenEmote:
return new TextSpeechBubble(message, senderEntity, "emoteBox", Color.FromHex("#ffd29e"));

case SpeechType.Say:
return new FancyTextSpeechBubble(message, senderEntity, "sayBox");

Expand Down
12 changes: 11 additions & 1 deletion Content.Client/Info/LinkBanner.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Content.Client.Changelog;
using Content.Client._LostParadise.Roadmap;
using Content.Client.Changelog;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Systems.EscapeMenu;
using Content.Client.UserInterface.Systems.Guidebook;
using Content.Shared.CCVar;
Expand Down Expand Up @@ -47,6 +49,14 @@ public LinkBanner()
changelogButton.OnPressed += args => UserInterfaceManager.GetUIController<ChangelogUIController>().ToggleWindow();
buttons.AddChild(changelogButton);

var roadmapButton = new Button
{
Text = Loc.GetString("server-info-roadmap-button"),
StyleClasses = { StyleBase.ButtonCaution },
};
roadmapButton.OnPressed += _ => UserInterfaceManager.GetUIController<RoadmapUI>().ToggleRoadmap();
buttons.AddChild(roadmapButton);

void AddInfoButton(string loc, CVarDef<string> cVar)
{
var button = new Button { Text = Loc.GetString(loc) };
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public static void SetupContexts(IInputContextContainer contexts)
common.AddFunction(ContentKeyFunctions.FocusChat);
common.AddFunction(ContentKeyFunctions.FocusLocalChat);
common.AddFunction(ContentKeyFunctions.FocusEmote);
common.AddFunction(ContentKeyFunctions.FocusHiddenEmote);
common.AddFunction(ContentKeyFunctions.FocusWhisperChat);
common.AddFunction(ContentKeyFunctions.FocusRadio);
common.AddFunction(ContentKeyFunctions.FocusLOOC);
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/EscapeMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Resizable="False">

<BoxContainer Orientation="Vertical" SeparationOverride="4" MinWidth="150">
<Button Access="Public" Name="RoadmapButton" Text="{Loc 'ui-roadmap'}" StyleClasses="Caution" />
<changelog:ChangelogButton Access="Public" Name="ChangelogButton"/>
<ui:VoteCallMenuButton />
<Button Access="Public" Name="OptionsButton" Text="{Loc 'ui-escape-options'}" />
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ void AddCheckBox(string checkBoxName, bool currentState, Action<BaseButton.Butto
AddButton(ContentKeyFunctions.FocusChat);
AddButton(ContentKeyFunctions.FocusLocalChat);
AddButton(ContentKeyFunctions.FocusEmote);
AddButton(ContentKeyFunctions.FocusHiddenEmote);
AddButton(ContentKeyFunctions.FocusWhisperChat);
AddButton(ContentKeyFunctions.FocusRadio);
AddButton(ContentKeyFunctions.FocusLOOC);
Expand Down
11 changes: 11 additions & 0 deletions Content.Client/UserInterface/Systems/Chat/ChatUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public sealed class ChatUIController : UIController
{SharedChatSystem.OOCPrefix, ChatSelectChannel.OOC},
{SharedChatSystem.EmotesPrefix, ChatSelectChannel.Emotes},
{SharedChatSystem.EmotesAltPrefix, ChatSelectChannel.Emotes},
{SharedChatSystem.HiddenEmotesPrefix, ChatSelectChannel.HiddenEmotes},
{SharedChatSystem.AdminPrefix, ChatSelectChannel.Admin},
{SharedChatSystem.RadioCommonPrefix, ChatSelectChannel.Radio},
{SharedChatSystem.DeadPrefix, ChatSelectChannel.Dead},
Expand All @@ -92,6 +93,7 @@ public sealed class ChatUIController : UIController
{ChatSelectChannel.LOOC, SharedChatSystem.LOOCPrefix},
{ChatSelectChannel.OOC, SharedChatSystem.OOCPrefix},
{ChatSelectChannel.Emotes, SharedChatSystem.EmotesPrefix},
{ChatSelectChannel.HiddenEmotes, SharedChatSystem.HiddenEmotesPrefix},
{ChatSelectChannel.Admin, SharedChatSystem.AdminPrefix},
{ChatSelectChannel.Radio, SharedChatSystem.RadioCommonPrefix},
{ChatSelectChannel.Dead, SharedChatSystem.DeadPrefix},
Expand Down Expand Up @@ -199,6 +201,9 @@ public override void Initialize()
_input.SetInputCommand(ContentKeyFunctions.FocusEmote,
InputCmdHandler.FromDelegate(_ => FocusChannel(ChatSelectChannel.Emotes)));

_input.SetInputCommand(ContentKeyFunctions.FocusHiddenEmote,
InputCmdHandler.FromDelegate(_ => FocusChannel(ChatSelectChannel.HiddenEmotes)));

_input.SetInputCommand(ContentKeyFunctions.FocusWhisperChat,
InputCmdHandler.FromDelegate(_ => FocusChannel(ChatSelectChannel.Whisper)));

Expand Down Expand Up @@ -529,6 +534,7 @@ private void UpdateChannelPermissions()
FilterableChannels |= ChatChannel.Whisper;
FilterableChannels |= ChatChannel.Radio;
FilterableChannels |= ChatChannel.Emotes;
FilterableChannels |= ChatChannel.HiddenEmotes;
FilterableChannels |= ChatChannel.Notifications;

// Can only send local / radio / emote when attached to a non-ghost entity.
Expand All @@ -539,6 +545,7 @@ private void UpdateChannelPermissions()
CanSendChannels |= ChatSelectChannel.Whisper;
CanSendChannels |= ChatSelectChannel.Radio;
CanSendChannels |= ChatSelectChannel.Emotes;
CanSendChannels |= ChatSelectChannel.HiddenEmotes;
}
}

Expand Down Expand Up @@ -875,6 +882,10 @@ public void ProcessChatMessage(ChatMessage msg, bool speechBubble = true)
AddSpeechBubble(msg, SpeechBubble.SpeechType.Emote);
break;

case ChatChannel.HiddenEmotes:
AddSpeechBubble(msg, SpeechBubble.SpeechType.HiddenEmote);
break;

case ChatChannel.LOOC:
if (_config.GetCVar(CCVars.LoocAboveHeadShow))
AddSpeechBubble(msg, SpeechBubble.SpeechType.Looc);
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.Emotes,
ChatChannel.HiddenEmotes,
ChatChannel.Radio,
ChatChannel.Telepathic, //Nyano - Summary: adds telepathic chat to where it belongs in order in the chat.
ChatChannel.Notifications,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public sealed class ChannelSelectorPopup : Popup
ChatSelectChannel.Local,
ChatSelectChannel.Whisper,
ChatSelectChannel.Emotes,
ChatSelectChannel.HiddenEmotes,
ChatSelectChannel.Radio,
ChatSelectChannel.Telepathic, //Nyano - Summary: determines the order in which telepathic shows.
ChatSelectChannel.LOOC,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Client.Gameplay;
using Content.Client._LostParadise.Roadmap;
using Content.Client.Gameplay;
using Content.Client.UserInterface.Controls;
using Content.Client.UserInterface.Systems.Guidebook;
using Content.Client.UserInterface.Systems.Info;
Expand Down Expand Up @@ -63,6 +64,12 @@ public void OnStateEntered(GameplayState state)
_escapeWindow.OnClose += DeactivateButton;
_escapeWindow.OnOpen += ActivateButton;

_escapeWindow.RoadmapButton.OnPressed += _ =>
{
CloseEscapeWindow();
UIManager.GetUIController<RoadmapUI>().ToggleRoadmap();
};

_escapeWindow.ChangelogButton.OnPressed += _ =>
{
CloseEscapeWindow();
Expand Down
96 changes: 96 additions & 0 deletions Content.Client/_LostParadise/Roadmap/RoadmapControl.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
using Content.Shared._LostParadise.Roadmap;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface;
using System.Numerics;

namespace Content.Client._LostParadise.Roadmap
{
public class RoadmapControl : Control
{
private readonly RoadmapPrototype _prototype;
private readonly ProgressBar _progressBar;

public RoadmapControl(RoadmapPrototype prototype)
{
_prototype = prototype;
_progressBar = new ProgressBar
{
MinValue = 0,
MaxValue = 100,
Value = _prototype.Progress,
HorizontalExpand = true
};

SetupUI();
}

private void SetupUI()
{
Margin = new Thickness(0, 20, 0, 0);

var vBox = new BoxContainer
{
Orientation = BoxContainer.LayoutOrientation.Vertical
};

var nameButton = new Button
{
Text = _prototype.Name,
StyleClasses = { "Caution" },
HorizontalExpand = true
};

vBox.AddChild(nameButton);

var descriptionLabel = new Label { Text = _prototype.Description, FontColorOverride = Color.LightGray };
var progressLabel = new Label
{
Text = Loc.GetString("roadmap-progress") + $": {_prototype.Progress}%",
FontColorOverride = Color.White
};

var statusBox = new BoxContainer
{
Orientation = BoxContainer.LayoutOrientation.Horizontal,
HorizontalExpand = true,
SeparationOverride = 5
};

var statusLabel = new Label
{
Text = Loc.GetString("roadmap-status") + $": {Loc.GetString(_prototype.Status)}",
FontColorOverride = GetStatusColor(),
};

statusBox.AddChild(statusLabel);
statusBox.AddChild(new Control { HorizontalExpand = true });

vBox.AddChild(descriptionLabel);
vBox.AddChild(progressLabel);
vBox.AddChild(_progressBar);
vBox.AddChild(statusBox);

var separator = new PanelContainer
{
Modulate = new Color(0.5f, 0.5f, 0.5f, 1f),
MinSize = new Vector2(0, 2),
HorizontalExpand = true
};
vBox.AddChild(separator);

AddChild(vBox);
}

private Color GetStatusColor()
{
string status = _prototype.Status;
return status switch
{
"roadmap-goal-completed" => new Color(0.0f, 1.0f, 0.0f),
"roadmap-goal-progress" => new Color(1.0f, 1.0f, 0.0f),
"roadmap-goal-waiting" => new Color(1.0f, 0.5f, 0.0f),
_ => Color.White
};
}
}
}
81 changes: 81 additions & 0 deletions Content.Client/_LostParadise/Roadmap/RoadmapUI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using Content.Shared._LostParadise.Roadmap;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using System.Numerics;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.Controllers;
using System.Linq;

namespace Content.Client._LostParadise.Roadmap
{
public sealed class RoadmapUI : UIController
{
private DefaultWindow _roadmapWindow;

public RoadmapUI()
{
_roadmapWindow = new DefaultWindow
{
Title = Loc.GetString("roadmap-plan-LLP"),
SetSize = new Vector2(600, 600),
Resizable = false
};

var panelContainer = new PanelContainer
{
MinSize = new Vector2(580, 580),
ModulateSelfOverride = Color.Transparent,
Margin = new Thickness(10)
};

var scrollContainer = new ScrollContainer
{
HorizontalExpand = true,
VerticalExpand = true,
Margin = new Thickness(0, 20, 0, 0)
};

var phaseList = new BoxContainer
{
Orientation = BoxContainer.LayoutOrientation.Vertical,
SeparationOverride = 10
};

scrollContainer.AddChild(phaseList);
panelContainer.AddChild(scrollContainer);
_roadmapWindow.AddChild(panelContainer);

RefreshUI(phaseList);
}

private void RefreshUI(BoxContainer phaseList)
{
phaseList.RemoveAllChildren();

var roadmapSystem = IoCManager.Resolve<IPrototypeManager>();

var roadmapPhases = roadmapSystem.EnumeratePrototypes<RoadmapPrototype>()
.OrderBy<RoadmapPrototype, int>(phase => phase.Order);

foreach (var phase in roadmapPhases)
{
var phaseControl = new RoadmapControl(phase);
phaseList.AddChild(phaseControl);
}
}

public void ToggleRoadmap()
{
if (_roadmapWindow.IsOpen)
{
_roadmapWindow.Close();
}
else
{
_roadmapWindow.OpenCentered();
}
}
}
}
44 changes: 44 additions & 0 deletions Content.Server/Chat/Commands/HiddenMeCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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 HiddenMeCommand : IConsoleCommand
{
public string Command => "hme";
public string Description => "Perform an action.";
public string Help => "hme <text>";

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.HiddenEmote, ChatTransmitRange.GhostRangeLimit, false, shell, player);
}
}
}
Loading

0 comments on commit e45d669

Please sign in to comment.