Skip to content

Commit

Permalink
Merge branch 'master' into eddie-old-pulls
Browse files Browse the repository at this point in the history
  • Loading branch information
Inconnu1337 authored Oct 25, 2024
2 parents ac4c6d7 + 98c7828 commit 683b839
Show file tree
Hide file tree
Showing 873 changed files with 30,680 additions and 290 deletions.
31 changes: 31 additions & 0 deletions Content.Client/ADT/CollectiveMind/Systems/CollectiveMindSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Content.Client.Chat.Managers;
using Content.Shared.Sirena.CollectiveMind;
using Robust.Client.Player;

namespace Content.Client.Sirena.CollectiveMind;

public sealed class CollectiveMindSystem : EntitySystem
{
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CollectiveMindComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<CollectiveMindComponent, ComponentRemove>(OnRemove);
}

public CollectiveMindComponent? Player => CompOrNull<CollectiveMindComponent>(_playerManager.LocalPlayer?.ControlledEntity);
public bool IsCollectiveMind => Player != null;

private void OnInit(EntityUid uid, CollectiveMindComponent component, ComponentInit args)
{
_chatManager.UpdatePermissions();
}

private void OnRemove(EntityUid uid, CollectiveMindComponent component, ComponentRemove args)
{
_chatManager.UpdatePermissions();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<DefaultWindow xmlns="https://spacestation14.io"
Title="{Loc 'ghost-target-window-ghostbar'}"
MinSize="550 400"
SetSize="550 400">
<BoxContainer Orientation="Vertical"
HorizontalExpand="True">
<RichTextLabel Name="TopBanner" VerticalExpand="True"/>
<Button Name="SpawnButton"
Text="{Loc 'ghost-window-spawn-ghostbar-button'}"
Disabled="True"
TextAlign="Center"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</BoxContainer>
</DefaultWindow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Content.Shared.CCVar;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration;
using Robust.Shared.Timing;
using Robust.Shared.Utility;

namespace Content.Client.ADT.UserInterface.Systems.Ghost.Controls
{
[GenerateTypedNameReferences]
public sealed partial class GhostBarRulesWindow : DefaultWindow
{
[Dependency] private readonly IConfigurationManager _cfg = IoCManager.Resolve<IConfigurationManager>();
private float _timer;

public event Action? SpawnButtonPressed;
public GhostBarRulesWindow()
{
RobustXamlLoader.Load(this);
var ghostBarTime = _cfg.GetCVar(CCVars.GhostRoleTime);
_timer = ghostBarTime;

if (ghostBarTime > 0f)
{
SpawnButton.Text = Loc.GetString("ghost-window-spawn-ghostbar-button-timer", ("time", $"{_timer:0.0}"));
TopBanner.SetMessage(FormattedMessage.FromMarkupPermissive(Loc.GetString("ghost-bar-rules") + "\n" + Loc.GetString("ghost-roles-window-rules-footer", ("time", ghostBarTime))));
SpawnButton.Disabled = true;
}

SpawnButton.OnPressed += _ => SpawnButtonPressed?.Invoke();
}


protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
if (!SpawnButton.Disabled) return;
if (_timer > 0.0)
{
_timer -= args.DeltaSeconds;
SpawnButton.Text = Loc.GetString("ghost-window-spawn-ghostbar-button-timer", ("time", $"{_timer:0.0}"));
}
else
{
SpawnButton.Disabled = false;
SpawnButton.Text = Loc.GetString("ghost-window-spawn-ghostbar-button");
}
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Content.Client.Gameplay;
using Content.Client.Ghost;
using Content.Client.UserInterface.Systems.Gameplay;
using Content.Client.UserInterface.Systems.Ghost.Widgets;
using Content.Shared.Ghost;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers;
using Content.Client.UserInterface.Systems.Ghost;

namespace Content.Client.UserInterface.Systems.Ghost;

// TODO hud refactor BEFORE MERGE fix ghost gui being too far up
public sealed partial class GhostUIController
{
private void GhostBarPressed()
{
Gui?.GhostBarWindow.OpenCentered();
}

private void GhostBarSpawnPressed()
{
_system?.GhostBarSpawn();
}

public void LoadGhostbarGui()
{
if (Gui == null)
return;

Gui.GhostBarPressed += GhostBarPressed;
Gui.GhostBarWindow.SpawnButtonPressed += GhostBarSpawnPressed;
}

public void UnloadGhostbarGui()
{
if (Gui == null)
return;

Gui.GhostBarPressed -= GhostBarPressed;
Gui.GhostBarWindow.SpawnButtonPressed -= GhostBarSpawnPressed;
}
}
12 changes: 12 additions & 0 deletions Content.Client/Chat/Managers/ChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ internal sealed class ChatManager : IChatManager
[Dependency] private readonly IEntitySystemManager _systems = default!;

private ISawmill _sawmill = default!;
public event Action? PermissionsUpdated; // ADT-CollectiveMind-Tweak

public void Initialize()
{
Expand Down Expand Up @@ -67,8 +68,19 @@ public void SendMessage(string text, ChatSelectChannel channel)
_consoleHost.ExecuteCommand($"whisper \"{CommandParsing.Escape(str)}\"");
break;

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

default:
throw new ArgumentOutOfRangeException(nameof(channel), channel, null);
}
}

// ADT-CollectiveMind-Tweak-Start
public void UpdatePermissions()
{
PermissionsUpdated?.Invoke();
}
// ADT-CollectiveMind-Tweak-End
}
8 changes: 7 additions & 1 deletion Content.Client/Chat/Managers/IChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ namespace Content.Client.Chat.Managers
{
public interface IChatManager
{
void Initialize();
void Initialize(); // ADT-CollectiveMind-Tweak

/// <summary>
/// Will refresh perms.
/// </summary>
event Action PermissionsUpdated; // ADT-CollectiveMind-Tweak

public void SendMessage(string text, ChatSelectChannel channel);
public void UpdatePermissions(); // ADT-CollectiveMind-Tweak
}
}
1 change: 1 addition & 0 deletions Content.Client/Entry/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public override void Init()
_prototypeManager.RegisterIgnore("nukeopsRole");
_prototypeManager.RegisterIgnore("stationGoal"); // Corvax-StationGoal
_prototypeManager.RegisterIgnore("ghostRoleRaffleDecider");
_prototypeManager.RegisterIgnore("ghostbarMap"); ///ADT-ghostber

_componentFactory.GenerateNetIds();
_adminManager.Initialize();
Expand Down
5 changes: 5 additions & 0 deletions Content.Client/Ghost/GhostSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ public void OpenGhostRoles()
_console.RemoteExecuteCommand(null, "ghostroles");
}

public void GhostBarSpawn() // Goobstation - Ghost Bar
{
RaiseNetworkEvent(new GhostBarSpawnEvent());
}

public void ToggleGhostVisibility(bool? visibility = null)
{
GhostVisibility = visibility ?? !GhostVisibility;
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.FocusCollectiveMind); // ADT-CollectiveMind-Tweak
common.AddFunction(ContentKeyFunctions.FocusWhisperChat);
common.AddFunction(ContentKeyFunctions.FocusRadio);
common.AddFunction(ContentKeyFunctions.FocusLOOC);
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 @@ -205,6 +205,7 @@ void AddCheckBox(string checkBoxName, bool currentState, Action<BaseButton.Butto
AddButton(ContentKeyFunctions.FocusLocalChat);
AddButton(ContentKeyFunctions.FocusEmote);
AddButton(ContentKeyFunctions.FocusWhisperChat);
AddButton(ContentKeyFunctions.FocusCollectiveMind); // ADT-CollectiveMind-Tweak
AddButton(ContentKeyFunctions.FocusRadio);
AddButton(ContentKeyFunctions.FocusLOOC);
AddButton(ContentKeyFunctions.FocusOOC);
Expand Down
18 changes: 18 additions & 0 deletions Content.Client/UserInterface/Systems/Chat/ChatUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
using Robust.Shared.Replays;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Content.Client.Sirena.CollectiveMind; // ADT-CollectiveMind-Tweak
using System.Globalization;
using System.Linq;
using System.Numerics;

namespace Content.Client.UserInterface.Systems.Chat;

Expand All @@ -66,6 +70,7 @@ public sealed class ChatUIController : UIController
[UISystemDependency] private readonly TransformSystem? _transform = default;
[UISystemDependency] private readonly MindSystem? _mindSystem = default!;
[UISystemDependency] private readonly RoleCodewordSystem? _roleCodewordSystem = default!;
[UISystemDependency] private readonly CollectiveMindSystem? _collectiveMind = default!; // ADT-CollectiveMind-Tweak

[ValidatePrototypeId<ColorPalettePrototype>]
private const string ChatNamePalette = "ChatNames";
Expand All @@ -78,6 +83,7 @@ public sealed class ChatUIController : UIController
{
{SharedChatSystem.LocalPrefix, ChatSelectChannel.Local},
{SharedChatSystem.WhisperPrefix, ChatSelectChannel.Whisper},
{SharedChatSystem.CollectiveMindPrefix, ChatSelectChannel.CollectiveMind}, // ADT-CollectiveMind-Tweak
{SharedChatSystem.ConsolePrefix, ChatSelectChannel.Console},
{SharedChatSystem.LOOCPrefix, ChatSelectChannel.LOOC},
{SharedChatSystem.OOCPrefix, ChatSelectChannel.OOC},
Expand All @@ -92,6 +98,7 @@ public sealed class ChatUIController : UIController
{
{ChatSelectChannel.Local, SharedChatSystem.LocalPrefix},
{ChatSelectChannel.Whisper, SharedChatSystem.WhisperPrefix},
{ChatSelectChannel.CollectiveMind, SharedChatSystem.CollectiveMindPrefix}, // ADT-CollectiveMind-Tweak
{ChatSelectChannel.Console, SharedChatSystem.ConsolePrefix},
{ChatSelectChannel.LOOC, SharedChatSystem.LOOCPrefix},
{ChatSelectChannel.OOC, SharedChatSystem.OOCPrefix},
Expand Down Expand Up @@ -204,6 +211,9 @@ public override void Initialize()
_input.SetInputCommand(ContentKeyFunctions.FocusWhisperChat,
InputCmdHandler.FromDelegate(_ => FocusChannel(ChatSelectChannel.Whisper)));

_input.SetInputCommand(ContentKeyFunctions.FocusCollectiveMind, // ADT-CollectiveMind-Tweak
InputCmdHandler.FromDelegate(_ => FocusChannel(ChatSelectChannel.CollectiveMind))); // ADT-CollectiveMind-Tweak

_input.SetInputCommand(ContentKeyFunctions.FocusLOOC,
InputCmdHandler.FromDelegate(_ => FocusChannel(ChatSelectChannel.LOOC)));

Expand Down Expand Up @@ -558,7 +568,15 @@ private void UpdateChannelPermissions()
FilterableChannels |= ChatChannel.AdminAlert;
FilterableChannels |= ChatChannel.AdminChat;
CanSendChannels |= ChatSelectChannel.Admin;
FilterableChannels |= ChatChannel.CollectiveMind; // ADT-CollectiveMind-Tweak
}
// ADT-CollectiveMind-Tweak-Start
if (_collectiveMind != null)
{
CanSendChannels |= ChatSelectChannel.CollectiveMind;
FilterableChannels |= ChatChannel.CollectiveMind;
}
// ADT-CollectiveMind-Tweak-End

SelectableChannels = CanSendChannels;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public sealed partial class ChannelFilterPopup : Popup
ChatChannel.Whisper,
ChatChannel.Emotes,
ChatChannel.Radio,
ChatChannel.CollectiveMind, // ADT-CollectiveMind-Tweak
ChatChannel.Notifications,
ChatChannel.LOOC,
ChatChannel.OOC,
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.Radio,
ChatSelectChannel.CollectiveMind, // ADT-CollectiveMind-Tweak
ChatSelectChannel.LOOC,
ChatSelectChannel.OOC,
ChatSelectChannel.Dead,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
namespace Content.Client.UserInterface.Systems.Ghost;

// TODO hud refactor BEFORE MERGE fix ghost gui being too far up
public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSystem>
public sealed partial class GhostUIController : UIController, IOnSystemChanged<GhostSystem> // ADT - now this class is partial
{
[Dependency] private readonly IEntityNetworkManager _net = default!;

[UISystemDependency] private readonly GhostSystem? _system = default;

private GhostGui? Gui => UIManager.GetActiveUIWidgetOrNull<GhostGui>();


public override void Initialize()
{
base.Initialize();
Expand All @@ -29,11 +29,13 @@ public override void Initialize()
private void OnScreenLoad()
{
LoadGui();
LoadGhostbarGui(); // ADT ghostbar
}

private void OnScreenUnload()
{
UnloadGui();
UnloadGhostbarGui(); // ADT ghostbar
}

public void OnSystemLoaded(GhostSystem system)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<Button Name="ReturnToBodyButton" Text="{Loc ghost-gui-return-to-body-button}" />
<Button Name="GhostWarpButton" Text="{Loc ghost-gui-ghost-warp-button}" />
<Button Name="GhostRolesButton" />
<Button Name="GhostBarButton" Text="{Loc 'ghost-target-window-ghostbar'}" /> <!-- Goobstation - Ghost Bar -->
</BoxContainer>
</widgets:GhostGui>
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,41 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Content.Client.ADT.UserInterface.Systems.Ghost.Controls;

namespace Content.Client.UserInterface.Systems.Ghost.Widgets;

[GenerateTypedNameReferences]
public sealed partial class GhostGui : UIWidget
{
public GhostTargetWindow TargetWindow { get; }
public GhostBarRulesWindow GhostBarWindow { get; }

public event Action? RequestWarpsPressed;
public event Action? ReturnToBodyPressed;
public event Action? GhostRolesPressed;
public event Action? GhostBarPressed; // Goobstation - Ghost Bar

public GhostGui()
{
RobustXamlLoader.Load(this);

TargetWindow = new GhostTargetWindow();

GhostBarWindow = new GhostBarRulesWindow();

MouseFilter = MouseFilterMode.Ignore;

GhostWarpButton.OnPressed += _ => RequestWarpsPressed?.Invoke();
ReturnToBodyButton.OnPressed += _ => ReturnToBodyPressed?.Invoke();
GhostRolesButton.OnPressed += _ => GhostRolesPressed?.Invoke();
GhostBarButton.OnPressed += _ => GhostBarPressed?.Invoke(); // Goobstation - Ghost Bar
}

public void Hide()
{
TargetWindow.Close();
GhostBarWindow.Close(); // Goobstation - Ghost Bar
Visible = false;
}

Expand Down Expand Up @@ -61,6 +68,7 @@ protected override void Dispose(bool disposing)
if (disposing)
{
TargetWindow.Dispose();
GhostBarWindow.Dispose(); // Goobstation - Ghost Bar
}
}
}
2 changes: 1 addition & 1 deletion Content.Server/ADT/Clothing/MadnessMaskSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Content.Shared.Stunnable;
using Robust.Shared.Random;

namespace Content.Server.Goobstation.Clothing;
namespace Content.Server.ADT.Clothing;

public sealed partial class MadnessMaskSystem : EntitySystem
{
Expand Down
Loading

0 comments on commit 683b839

Please sign in to comment.