Skip to content

Commit

Permalink
[Repo] Corvax (#20)
Browse files Browse the repository at this point in the history
# Changelog

:cl: DEATHB4DEFEAT, courtesy of Corvax
- tweak: Typing indicators are more reactive, with a new state for
idling in the chat bar
- tweak: Resprite typing indicators
- add: Slimepeople, Moths, Aliens, and Robots now have unique typing
indicators
- add: Added a queue system, if the server is full, players will be put
in a queue instead of being kicked
- add: Added random station goals, sent to the command fax machine at
the start of the shift
- add: Added some new lobby art
- add: Added more Captain clothing
- add: Added a HoP coat
- add: Added 9 potted plant variations
- tweak: Different shotguns have different sounds
- tweak: Resprite ERT jumpsuits and helmets
- tweak: Resprite Syndicate EVA suit
- tweak: Resprite Singularity and related equipment
- tweak: Resprite intercom
- tweak: Resprite lamps
- tweak: Resprite reagent tanks
- fix: Resprite uranium windows
- tweak: Resprite chairs
- tweak: Resprite mailing units
- tweak: Resprite diagonal solid walls
- tweak: Resprite Atmospheric Technician backpacks
- tweak: Resprite cans
- tweak: Resprite gas canisters
- tweak: Resprite fax machines
- tweak: Resprite some melee weapons

---------

Co-authored-by: Morb <[email protected]>
Co-authored-by: no_mad <[email protected]>
Co-authored-by: fedKotikeD <[email protected]>
Co-authored-by: lzk228 <[email protected]>
Co-authored-by: JerryTheMouse <[email protected]>
Co-authored-by: SonicHDC <[email protected]>
Co-authored-by: faint <[email protected]>
Co-authored-by: mhamster <[email protected]>
Co-authored-by: RomanMinaev <[email protected]>
  • Loading branch information
10 people committed Aug 29, 2023
1 parent 0a93bb0 commit 27fe3ea
Show file tree
Hide file tree
Showing 701 changed files with 3,505 additions and 706 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Administration/UI/AdminMenuWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public sealed partial class AdminMenuWindow : DefaultWindow

public AdminMenuWindow()
{
MinSize = new Vector2(500, 250);
MinSize = new Vector2(600, 250); // Corvax-Resize
Title = Loc.GetString("admin-menu-title");
RobustXamlLoader.Load(this);
MasterTabContainer.SetTabTitle(0, Loc.GetString("admin-menu-admin-tab"));
Expand Down
53 changes: 44 additions & 9 deletions Content.Client/Chat/TypingIndicator/TypingIndicatorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public sealed class TypingIndicatorSystem : SharedTypingIndicatorSystem
private readonly TimeSpan _typingTimeout = TimeSpan.FromSeconds(2);
private TimeSpan _lastTextChange;
private bool _isClientTyping;
private bool _isClientChatFocused; // Corvax-TypingIndicator

public override void Initialize()
{
Expand All @@ -30,7 +31,10 @@ public void ClientChangedChatText()
return;

// client typed something - show typing indicator
ClientUpdateTyping(true);
// Corvax-TypingIndicator-Start
_isClientTyping = true;
ClientUpdateTyping();
// Corvax-TypingIndicator-End
_lastTextChange = _time.CurTime;
}

Expand All @@ -41,9 +45,26 @@ public void ClientSubmittedChatText()
return;

// client submitted text - hide typing indicator
ClientUpdateTyping(false);
// Corvax-TypingIndicator-Start
_isClientTyping = false;
_isClientChatFocused = false;
ClientUpdateTyping();
// Corvax-TypingIndicator-End
}

// Corvax-TypingIndicator-Start
public void ClientChangedChatFocus(bool isFocused)
{
// don't update it if player don't want to show typing
if (!_cfg.GetCVar(CCVars.ChatShowTypingIndicator))
return;

// client submitted text - hide typing indicator
_isClientChatFocused = isFocused;
ClientUpdateTyping();
}
// Corvax-TypingIndicator-End

public override void Update(float frameTime)
{
base.Update(frameTime);
Expand All @@ -55,31 +76,45 @@ public override void Update(float frameTime)
if (dif > _typingTimeout)
{
// client didn't typed anything for a long time - hide indicator
ClientUpdateTyping(false);
// Corvax-TypingIndicator-Start
_isClientTyping = false;
ClientUpdateTyping();
// Corvax-TypingIndicator-End
}
}
}

private void ClientUpdateTyping(bool isClientTyping)
private void ClientUpdateTyping() // Corvax-TypingIndicator
{
if (_isClientTyping == isClientTyping)
return;
_isClientTyping = isClientTyping;
// Corvax-TypingIndicator-Start
// if (_isClientTyping == isClientTyping)
// return;
// _isClientTyping = isClientTyping;
// Corvax-TypingIndicator-End

// check if player controls any pawn
if (_playerManager.LocalPlayer?.ControlledEntity == null)
return;

// Corvax-TypingIndicator-Start
var state = TypingIndicatorState.None;
if (_isClientChatFocused)
state = _isClientTyping ? TypingIndicatorState.Typing : TypingIndicatorState.Idle;
// Corvax-TypingIndicator-End

// send a networked event to server
RaiseNetworkEvent(new TypingChangedEvent(isClientTyping));
RaiseNetworkEvent(new TypingChangedEvent(state)); // Corvax-TypingIndicator
}

private void OnShowTypingChanged(bool showTyping)
{
// hide typing indicator immediately if player don't want to show it anymore
if (!showTyping)
{
ClientUpdateTyping(false);
// Corvax-TypingIndicator-Start
_isClientTyping = false;
ClientUpdateTyping();
// Corvax-TypingIndicator-End
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected override void OnAppearanceChange(EntityUid uid, TypingIndicatorCompone
return;
}

AppearanceSystem.TryGetData<bool>(uid, TypingIndicatorVisuals.IsTyping, out var isTyping, args.Component);
// args.Component.TryGetData(TypingIndicatorVisuals.IsTyping, out bool isTyping); // Corvax-TypingIndicator
var layerExists = args.Sprite.LayerMapTryGet(TypingIndicatorLayers.Base, out var layer);
if (!layerExists)
layer = args.Sprite.LayerMapReserveBlank(TypingIndicatorLayers.Base);
Expand All @@ -29,6 +29,19 @@ protected override void OnAppearanceChange(EntityUid uid, TypingIndicatorCompone
args.Sprite.LayerSetState(layer, proto.TypingState);
args.Sprite.LayerSetShader(layer, proto.Shader);
args.Sprite.LayerSetOffset(layer, proto.Offset);
args.Sprite.LayerSetVisible(layer, isTyping);
// args.Sprite.LayerSetVisible(layer, isTyping); // Corvax-TypingIndicator
// Corvax-TypingIndicator-Start
args.Component.TryGetData(TypingIndicatorVisuals.State, out TypingIndicatorState state);
args.Sprite.LayerSetVisible(layer, state != TypingIndicatorState.None);
switch (state)
{
case TypingIndicatorState.Idle:
args.Sprite.LayerSetState(layer, proto.IdleState);
break;
case TypingIndicatorState.Typing:
args.Sprite.LayerSetState(layer, proto.TypingState);
break;
}
// Corvax-TypingIndicator-End
}
}
28 changes: 28 additions & 0 deletions Content.Client/Corvax/DiscordAuth/DiscordAuthGui.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Control xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:parallax="clr-namespace:Content.Client.Parallax"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls">
<parallax:ParallaxControl />
<Control HorizontalAlignment="Center" VerticalAlignment="Center">
<PanelContainer StyleClasses="AngleRect" />
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Horizontal">
<Label Margin="8 0 0 0" Text="{Loc 'discord-auth-title'}"
StyleClasses="LabelHeading" VAlign="Center" />
<Button Name="QuitButton" Text="{Loc 'discord-auth-quit-btn'}"
HorizontalAlignment="Right" HorizontalExpand="True" />
</BoxContainer>
<controls:HighDivider />
<BoxContainer Orientation="Vertical" Margin="50 20 50 20">
<Label Text="{Loc 'discord-auth-info'}" Align="Center" />
<Label Text="{Loc 'discord-auth-warn'}" Margin="0 5 0 0" Align="Center" StyleClasses="LabelSubText" />
</BoxContainer>
<BoxContainer Orientation="Horizontal" VerticalAlignment="Bottom" Margin="10 0 0 0">
<Label Text="{Loc 'discord-auth-link'}" Align="Center" />
<Label Text=" " />
<LineEdit Name="UrlEdit" HorizontalExpand="True" Editable="False"></LineEdit>
</BoxContainer>
<Button Name="OpenUrlButton" Text="{Loc 'discord-auth-browser-btn'}" HorizontalExpand="True" StyleClasses="OpenRight" />
</BoxContainer>
</Control>
</Control>
35 changes: 35 additions & 0 deletions Content.Client/Corvax/DiscordAuth/DiscordAuthGui.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.Corvax.DiscordAuth;

[GenerateTypedNameReferences]
public sealed partial class DiscordAuthGui : Control
{
[Dependency] private readonly DiscordAuthManager _discordAuthManager = default!;
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;

public DiscordAuthGui()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide);

QuitButton.OnPressed += (_) =>
{
_consoleHost.ExecuteCommand("quit");
};

UrlEdit.Text = _discordAuthManager.AuthUrl;
OpenUrlButton.OnPressed += (_) =>
{
if (_discordAuthManager.AuthUrl != string.Empty)
{
IoCManager.Resolve<IUriOpener>().OpenUri(_discordAuthManager.AuthUrl);
}
};
}
}
30 changes: 30 additions & 0 deletions Content.Client/Corvax/DiscordAuth/DiscordAuthManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Threading;
using Content.Shared.Corvax.DiscordAuth;
using Robust.Client.State;
using Robust.Shared.Network;
using Timer = Robust.Shared.Timing.Timer;

namespace Content.Client.Corvax.DiscordAuth;

public sealed class DiscordAuthManager
{
[Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private readonly IStateManager _stateManager = default!;

public string AuthUrl { get; private set; } = string.Empty;

public void Initialize()
{
_netManager.RegisterNetMessage<MsgDiscordAuthCheck>();
_netManager.RegisterNetMessage<MsgDiscordAuthRequired>(OnDiscordAuthRequired);
}

private void OnDiscordAuthRequired(MsgDiscordAuthRequired message)
{
if (_stateManager.CurrentState is not DiscordAuthState)
{
AuthUrl = message.AuthUrl;
_stateManager.RequestStateChange<DiscordAuthState>();
}
}
}
34 changes: 34 additions & 0 deletions Content.Client/Corvax/DiscordAuth/DiscordAuthState.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.Threading;
using Content.Shared.Corvax.DiscordAuth;
using Robust.Client.State;
using Robust.Client.UserInterface;
using Robust.Shared.Network;
using Timer = Robust.Shared.Timing.Timer;

namespace Content.Client.Corvax.DiscordAuth;

public sealed class DiscordAuthState : State
{
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IClientNetManager _netManager = default!;

private DiscordAuthGui? _gui;
private readonly CancellationTokenSource _checkTimerCancel = new();

protected override void Startup()
{
_gui = new DiscordAuthGui();
_userInterfaceManager.StateRoot.AddChild(_gui);

Timer.SpawnRepeating(TimeSpan.FromSeconds(5), () =>
{
_netManager.ClientSendMessage(new MsgDiscordAuthCheck());
}, _checkTimerCancel.Token);
}

protected override void Shutdown()
{
_checkTimerCancel.Cancel();
_gui!.Dispose();
}
}
26 changes: 26 additions & 0 deletions Content.Client/Corvax/JoinQueue/JoinQueueManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Content.Shared.Corvax.JoinQueue;
using Robust.Client.State;
using Robust.Shared.Network;

namespace Content.Client.Corvax.JoinQueue;

public sealed class JoinQueueManager
{
[Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private readonly IStateManager _stateManager = default!;

public void Initialize()
{
_netManager.RegisterNetMessage<MsgQueueUpdate>(OnQueueUpdate);
}

private void OnQueueUpdate(MsgQueueUpdate msg)
{
if (_stateManager.CurrentState is not QueueState)
{
_stateManager.RequestStateChange<QueueState>();
}

((QueueState) _stateManager.CurrentState).OnQueueUpdate(msg);
}
}
31 changes: 31 additions & 0 deletions Content.Client/Corvax/JoinQueue/QueueGui.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Control xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:parallax="clr-namespace:Content.Client.Parallax"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls">
<parallax:ParallaxControl />
<Control HorizontalAlignment="Center" VerticalAlignment="Center">
<PanelContainer StyleClasses="AngleRect" />
<BoxContainer Orientation="Vertical" MinSize="200 200">
<BoxContainer Orientation="Horizontal">
<Label Margin="8 0 0 0" Text="{Loc 'queue-title'}"
StyleClasses="LabelHeading" VAlign="Center" />
<Button Name="QuitButton" Text="{Loc 'queue-quit'}"
HorizontalAlignment="Right" HorizontalExpand="True" />
</BoxContainer>
<controls:HighDivider />
<BoxContainer Orientation="Vertical" VerticalExpand="True" Margin="0 20 0 0">
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Vertical" VerticalExpand="True">
<Label Text="{Loc 'queue-position'}" Align="Center" />
<Label Name="QueuePosition" StyleClasses="LabelHeading" Align="Center" />
</BoxContainer>
<BoxContainer Orientation="Vertical" VerticalExpand="True" Margin="0 10 0 0">
<Label Text="{Loc 'queue-total'}" Align="Center" />
<Label Name="QueueTotal" StyleClasses="LabelHeading" Align="Center" />
</BoxContainer>
</BoxContainer>
</BoxContainer>
</BoxContainer>
</Control>
</Control>
31 changes: 31 additions & 0 deletions Content.Client/Corvax/JoinQueue/QueueGui.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Content.Shared.CCVar;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration;

namespace Content.Client.Corvax.JoinQueue;

[GenerateTypedNameReferences]
public sealed partial class QueueGui : Control
{
[Dependency] private readonly IConfigurationManager _cfg = default!;

public event Action? QuitPressed;

public QueueGui()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide);

QuitButton.OnPressed += (_) => QuitPressed?.Invoke();
}

public void UpdateInfo(int total, int position)
{
QueueTotal.Text = total.ToString();
QueuePosition.Text = position.ToString();
}
}
Loading

0 comments on commit 27fe3ea

Please sign in to comment.