Skip to content

Commit

Permalink
Merge branch 'master' of github.com:/pxc1984/space-sunrise into vox-n…
Browse files Browse the repository at this point in the history
…o-roles-restriction
  • Loading branch information
pxc1984 committed Nov 27, 2024
2 parents b700eb3 + 8086258 commit 3cd8d53
Show file tree
Hide file tree
Showing 302 changed files with 88,257 additions and 16,207 deletions.
11 changes: 5 additions & 6 deletions Content.Client/Administration/UI/BanPanel/BanPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ namespace Content.Client.Administration.UI.BanPanel;
[GenerateTypedNameReferences]
public sealed partial class BanPanel : DefaultWindow
{
public event Action<string?, (IPAddress, int)?, bool, byte[]?, bool, uint, string, NoteSeverity, string[]?, bool>? BanSubmitted;
public event Action<string?, (IPAddress, int)?, bool, ImmutableTypedHwid?, bool, uint, string, NoteSeverity, string[]?, bool>? BanSubmitted;
public event Action<string>? PlayerChanged;
private string? PlayerUsername { get; set; }
private (IPAddress, int)? IpAddress { get; set; }
private byte[]? Hwid { get; set; }
private ImmutableTypedHwid? Hwid { get; set; }
private double TimeEntered { get; set; }
private uint Multiplier { get; set; }
private bool HasBanFlag { get; set; }
Expand Down Expand Up @@ -371,9 +371,8 @@ private void OnIpChanged()
private void OnHwidChanged()
{
var hwidString = HwidLine.Text;
var length = 3 * (hwidString.Length / 4) - hwidString.TakeLast(2).Count(c => c == '=');
Hwid = new byte[length];
if (HwidCheckbox.Pressed && !(string.IsNullOrEmpty(hwidString) && LastConnCheckbox.Pressed) && !Convert.TryFromBase64String(hwidString, Hwid, out _))
ImmutableTypedHwid? hwid = null;
if (HwidCheckbox.Pressed && !(string.IsNullOrEmpty(hwidString) && LastConnCheckbox.Pressed) && !ImmutableTypedHwid.TryParse(hwidString, out hwid))
{
ErrorLevel |= ErrorLevelEnum.Hwid;
HwidLine.ModulateSelfOverride = Color.Red;
Expand All @@ -390,7 +389,7 @@ private void OnHwidChanged()
Hwid = null;
return;
}
Hwid = Convert.FromHexString(hwidString);
Hwid = hwid;
}

private void OnTypeChanged()
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ private void OnTypeChanged(OptionButton.ItemSelectedEventArgs args)
SecretCheckBox.Pressed = false;
SeverityOption.Disabled = false;
PermanentCheckBox.Pressed = true;
SubmitButton.Disabled = true;
UpdatePermanentCheckboxFields();
break;
case (int) NoteType.Message: // Message: these are shown to the player when they log on
Expand Down
95 changes: 95 additions & 0 deletions Content.Client/Electrocution/ElectrocutionHUDVisualizerSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
using Content.Shared.Electrocution;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.Player;

namespace Content.Client.Electrocution;

/// <summary>
/// Shows the Electrocution HUD to entities with the ShowElectrocutionHUDComponent.
/// </summary>
public sealed class ElectrocutionHUDVisualizerSystem : VisualizerSystem<ElectrocutionHUDVisualsComponent>
{
[Dependency] private readonly IPlayerManager _playerMan = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ShowElectrocutionHUDComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<ShowElectrocutionHUDComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<ShowElectrocutionHUDComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<ShowElectrocutionHUDComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
}

private void OnPlayerAttached(Entity<ShowElectrocutionHUDComponent> ent, ref LocalPlayerAttachedEvent args)
{
ShowHUD();
}

private void OnPlayerDetached(Entity<ShowElectrocutionHUDComponent> ent, ref LocalPlayerDetachedEvent args)
{
RemoveHUD();
}

private void OnInit(Entity<ShowElectrocutionHUDComponent> ent, ref ComponentInit args)
{
if (_playerMan.LocalEntity == ent)
{
ShowHUD();
}
}

private void OnShutdown(Entity<ShowElectrocutionHUDComponent> ent, ref ComponentShutdown args)
{
if (_playerMan.LocalEntity == ent)
{
RemoveHUD();
}
}

// Show the HUD to the client.
// We have to look for all current entities that can be electrified and toggle the HUD layer on if they are.
private void ShowHUD()
{
var electrifiedQuery = AllEntityQuery<ElectrocutionHUDVisualsComponent, AppearanceComponent, SpriteComponent>();
while (electrifiedQuery.MoveNext(out var uid, out var _, out var appearanceComp, out var spriteComp))
{
if (!AppearanceSystem.TryGetData<bool>(uid, ElectrifiedVisuals.IsElectrified, out var electrified, appearanceComp))
continue;

if (electrified)
spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, true);
else
spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, false);
}
}

// Remove the HUD from the client.
// Find all current entities that can be electrified and hide the HUD layer.
private void RemoveHUD()
{
var electrifiedQuery = AllEntityQuery<ElectrocutionHUDVisualsComponent, AppearanceComponent, SpriteComponent>();
while (electrifiedQuery.MoveNext(out var uid, out var _, out var appearanceComp, out var spriteComp))
{

spriteComp.LayerSetVisible(ElectrifiedLayers.HUD, false);
}
}

// Toggle the HUD layer if an entity becomes (de-)electrified
protected override void OnAppearanceChange(EntityUid uid, ElectrocutionHUDVisualsComponent comp, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;

if (!AppearanceSystem.TryGetData<bool>(uid, ElectrifiedVisuals.IsElectrified, out var electrified, args.Component))
return;

var player = _playerMan.LocalEntity;
if (electrified && HasComp<ShowElectrocutionHUDComponent>(player))
args.Sprite.LayerSetVisible(ElectrifiedLayers.HUD, true);
else
args.Sprite.LayerSetVisible(ElectrifiedLayers.HUD, false);
}
}
2 changes: 1 addition & 1 deletion Content.Client/Eui/BaseEui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public virtual void HandleMessage(EuiMessageBase msg)
/// </summary>
protected void SendMessage(EuiMessageBase msg)
{
var netMsg = _netManager.CreateNetMessage<MsgEuiMessage>();
var netMsg = new MsgEuiMessage();
netMsg.Id = Id;
netMsg.Message = msg;

Expand Down
4 changes: 1 addition & 3 deletions Content.Client/Info/LinkBanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ public LinkBanner()
AddInfoButton("server-info-website-button", CCVars.InfoLinksWebsite);
AddInfoButton("server-info-wiki-button", CCVars.InfoLinksWiki);
AddInfoButton("server-info-forum-button", CCVars.InfoLinksForum);
// Sunrise-Start
AddInfoButton("server-info-telegram-button", SunriseCCVars.InfoLinksTelegram);
// Sunrise-End
AddInfoButton("server-info-telegram-button", CCVars.InfoLinksTelegram);

var guidebookController = UserInterfaceManager.GetUIController<GuidebookUIController>();
var guidebookButton = new Button() { Text = Loc.GetString("server-info-guidebook-button") };
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Launcher/LauncherConnectingGui.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public sealed partial class LauncherConnectingGui : Control
{
[Dependency] private readonly IUriOpener _uri = default!; // Sunrise-Edit

private const float RedialWaitTimeSeconds = 30f; // Sunrise-edit
private const float RedialWaitTimeSeconds = 10f; // Sunrise-edit
private readonly LauncherConnecting _state;
private float _waitTime;

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/OptionsMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
<tabs:KeyRebindTab Name="KeyRebindTab" />
<tabs:AudioTab Name="AudioTab" />
<tabs:AccessibilityTab Name="AccessibilityTab" />
<tabs:SunriseTab Name="SunriseTab" />
</TabContainer>
</DefaultWindow>
1 change: 1 addition & 0 deletions Content.Client/Options/UI/OptionsMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public OptionsMenu()
Tabs.SetTabTitle(2, Loc.GetString("ui-options-tab-controls"));
Tabs.SetTabTitle(3, Loc.GetString("ui-options-tab-audio"));
Tabs.SetTabTitle(4, Loc.GetString("ui-options-tab-accessibility"));
Tabs.SetTabTitle(5, Loc.GetString("ui-options-tab-sunrise"));

UpdateTabs();
}
Expand Down
9 changes: 0 additions & 9 deletions Content.Client/Options/UI/Tabs/AudioTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,10 @@
<ui:OptionSlider Name="SliderVolumeAmbience" Title="{Loc 'ui-options-ambience-volume'}" />
<ui:OptionSlider Name="SliderVolumeLobby" Title="{Loc 'ui-options-lobby-volume'}" />
<ui:OptionSlider Name="SliderVolumeInterface" Title="{Loc 'ui-options-interface-volume'}" />
<!-- Sunrise-TTS-Start -->
<ui:OptionSlider Name="SliderTts" Title="{Loc 'ui-options-tts-volume'}" />
<ui:OptionSlider Name="SliderTtsRadio" Title="{Loc 'ui-options-tts-radio-volume'}" />
<ui:OptionSlider Name="SliderTtsAnnounce" Title="{Loc 'ui-options-tts-announce-volume'}" />
<!-- Sunrise-TTS-End -->
<CheckBox Name="LobbyMusicCheckBox" Text="{Loc 'ui-options-lobby-music'}" />
<CheckBox Name="RestartSoundsCheckBox" Text="{Loc 'ui-options-restart-sounds'}" />
<CheckBox Name="EventMusicCheckBox" Text="{Loc 'ui-options-event-music'}" />
<CheckBox Name="AdminSoundsCheckBox" Text="{Loc 'ui-options-admin-sounds'}" />
<!-- Sunrise-Start -->
<CheckBox Name="TtsClientCheckBox" Text="{Loc 'ui-options-tts-enabled'}" />
<CheckBox Name="TapePlayerClientCheckBox" Text="{Loc 'ui-options-tape-player-enabled'}" />
<!-- Sunrise-End -->
</BoxContainer>
</BoxContainer>
<ui:OptionsTabControlRow Name="Control" Access="Public" />
Expand Down
17 changes: 0 additions & 17 deletions Content.Client/Options/UI/Tabs/AudioTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,10 @@ public AudioTab()
SliderVolumeInterface,
scale: ContentAudioSystem.InterfaceMultiplier);

Control.AddOptionPercentSlider(
SunriseCCVars.TTSVolume,
SliderTts,
scale: ContentAudioSystem.TtsMultiplier);

Control.AddOptionPercentSlider(
SunriseCCVars.TTSRadioVolume,
SliderTtsRadio,
scale: ContentAudioSystem.TtsMultiplier);

Control.AddOptionPercentSlider(
SunriseCCVars.TTSAnnounceVolume,
SliderTtsAnnounce,
scale: ContentAudioSystem.TtsMultiplier);

Control.AddOptionCheckBox(CCVars.LobbyMusicEnabled, LobbyMusicCheckBox);
Control.AddOptionCheckBox(CCVars.RestartSoundsEnabled, RestartSoundsCheckBox);
Control.AddOptionCheckBox(CCVars.EventMusicEnabled, EventMusicCheckBox);
Control.AddOptionCheckBox(CCVars.AdminSoundsEnabled, AdminSoundsCheckBox);
Control.AddOptionCheckBox(SunriseCCVars.TTSClientEnabled, TtsClientCheckBox);
Control.AddOptionCheckBox(SunriseCCVars.TapePlayerClientEnabled, TapePlayerClientCheckBox);

Control.Initialize();
}
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.CCVar;
using Content.Shared._Sunrise.SunriseCCVars;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
Expand Down
12 changes: 0 additions & 12 deletions Content.Client/Options/UI/Tabs/MiscTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@
StyleClasses="LabelKeyText"/>
<ui:OptionDropDown Name="DropDownHudTheme" Title="{Loc 'ui-options-hud-theme'}" />
<ui:OptionDropDown Name="DropDownHudLayout" Title="{Loc 'ui-options-hud-layout'}" />
<!-- Sunrise-Start -->
<Label Text="{Loc 'ui-options-general-lobby'}"
StyleClasses="LabelKeyText"/>
<ui:OptionDropDown Name="DropDownLobbyBackgroundType" Title="{Loc 'ui-options-lobby-background-type'}" />
<ui:OptionDropDown Name="DropDownLobbyArt" Title="{Loc 'ui-options-lobby-art'}" />
<ui:OptionDropDown Name="DropDownLobbyAnimation" Title="{Loc 'ui-options-lobby-animation'}" />
<ui:OptionDropDown Name="DropDownLobbyParallax" Title="{Loc 'ui-options-lobby-parallax'}" />
<ui:OptionSlider Name="LobbyOpacitySlider" Title="{Loc 'ui-options-lobby-opacity'}" />
<Label Text="{Loc 'ui-options-general-figth'}"
StyleClasses="LabelKeyText"/>
<CheckBox Name="DamageOverlayCheckBox" Text="{Loc 'ui-options-damage-overlay'}" />
<!-- Sunrise-End -->
<Label Text="{Loc 'ui-options-general-discord'}"
StyleClasses="LabelKeyText"/>
<CheckBox Name="DiscordRich" Text="{Loc 'ui-options-discordrich'}" />
Expand Down
88 changes: 0 additions & 88 deletions Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@ public sealed partial class MiscTab : Control
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!;

public MiscTab()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

_configurationManager.OnValueChanged(SunriseCCVars.LobbyBackgroundType, OnLobbyBackgroundTypeChanged, true);

var themes = _prototypeManager.EnumeratePrototypes<HudThemePrototype>().ToList();
themes.Sort();
var themeEntries = new List<OptionDropDownCVar<string>.ValueOption>();
Expand All @@ -51,54 +48,6 @@ public MiscTab()
Control.AddOptionDropDown(CVars.InterfaceTheme, DropDownHudTheme, themeEntries);
Control.AddOptionDropDown(CCVars.UILayout, DropDownHudLayout, layoutEntries);

// Sunrise-Start
var lobbyBackgroundTypes = new List<OptionDropDownCVar<string>.ValueOption>
{
new("Random", Loc.GetString("background-type-Random")),
};
var lobbyArts = new List<OptionDropDownCVar<string>.ValueOption>
{
new("Random", Loc.GetString("lobby-art-Random")),
};
var lobbyParallaxes = new List<OptionDropDownCVar<string>.ValueOption>
{
new ("Random", Loc.GetString("lobby-parallax-Random")),
};
var lobbyAnimations = new List<OptionDropDownCVar<string>.ValueOption>
{
new("Random", Loc.GetString("lobby-animation-Random")),
};
foreach (var backgroundType in Enum.GetValues(typeof(LobbyBackgroundType)))
{
var layoutLoc = Loc.GetString($"background-type-{backgroundType}");
lobbyBackgroundTypes.Add(new OptionDropDownCVar<string>.ValueOption(backgroundType.ToString()!, layoutLoc));
}
var lobbyParallaxesPrototypes = _prototypeManager.EnumeratePrototypes<LobbyParallaxPrototype>();
foreach (var lobbyParallax in lobbyParallaxesPrototypes)
{
var layoutLoc = Loc.GetString($"lobby-parallax-{lobbyParallax.ID}");
lobbyParallaxes.Add(new OptionDropDownCVar<string>.ValueOption(lobbyParallax.ID, layoutLoc));
}
var lobbyArtsPrototypes = _prototypeManager.EnumeratePrototypes<LobbyBackgroundPrototype>();
foreach (var lobbyArt in lobbyArtsPrototypes)
{
var layoutLoc = Loc.GetString($"lobby-art-{lobbyArt.ID}");
lobbyArts.Add(new OptionDropDownCVar<string>.ValueOption(lobbyArt.ID, layoutLoc));
}
var lobbyAnimationsPrototypes = _prototypeManager.EnumeratePrototypes<LobbyAnimationPrototype>();
foreach (var lobbyAnimation in lobbyAnimationsPrototypes)
{
var layoutLoc = Loc.GetString($"lobby-animation-{lobbyAnimation.ID}");
lobbyAnimations.Add(new OptionDropDownCVar<string>.ValueOption(lobbyAnimation.ID, layoutLoc));
}
Control.AddOptionDropDown(SunriseCCVars.LobbyBackgroundType, DropDownLobbyBackgroundType, lobbyBackgroundTypes);
Control.AddOptionDropDown(SunriseCCVars.LobbyArt, DropDownLobbyArt, lobbyArts);
Control.AddOptionDropDown(SunriseCCVars.LobbyAnimation, DropDownLobbyAnimation, lobbyAnimations);
Control.AddOptionDropDown(SunriseCCVars.LobbyParallax, DropDownLobbyParallax, lobbyParallaxes);
Control.AddOptionPercentSlider(SunriseCCVars.LobbyOpacity, LobbyOpacitySlider);
Control.AddOptionCheckBox(SunriseCCVars.DamageOverlay, DamageOverlayCheckBox);
// Sunrise-End

Control.AddOptionCheckBox(CVars.DiscordEnabled, DiscordRich);
Control.AddOptionCheckBox(CCVars.ShowOocPatronColor, ShowOocPatronColor);
Control.AddOptionCheckBox(CCVars.LoocAboveHeadShow, ShowLoocAboveHeadCheckBox);
Expand All @@ -111,41 +60,4 @@ public MiscTab()

Control.Initialize();
}

// Sunrise-Start
private void OnLobbyBackgroundTypeChanged(string lobbyBackgroundTypeString)
{
if (lobbyBackgroundTypeString == "Random")
{
DropDownLobbyArt.Visible = true;
DropDownLobbyAnimation.Visible = true;
DropDownLobbyParallax.Visible = true;
return;
}

if (!Enum.TryParse(lobbyBackgroundTypeString, out LobbyBackgroundType lobbyBackgroundType))
{
lobbyBackgroundType = default;
}

switch (lobbyBackgroundType)
{
case LobbyBackgroundType.Parallax:
DropDownLobbyArt.Visible = false;
DropDownLobbyAnimation.Visible = false;
DropDownLobbyParallax.Visible = true;
break;
case LobbyBackgroundType.Art:
DropDownLobbyArt.Visible = true;
DropDownLobbyAnimation.Visible = false;
DropDownLobbyParallax.Visible = false;
break;
case LobbyBackgroundType.Animation:
DropDownLobbyArt.Visible = false;
DropDownLobbyAnimation.Visible = true;
DropDownLobbyParallax.Visible = false;
break;
}
}
// Sunrise-End
}
Loading

0 comments on commit 3cd8d53

Please sign in to comment.