Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/sunrise_public/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Resources/Locale/ru-RU/_prototypes/_sunrise/entities/clothing/eyes/glasses.ftl
  • Loading branch information
VigersRay committed Nov 26, 2024
2 parents 209dc3d + f444ece commit fcaf47d
Show file tree
Hide file tree
Showing 213 changed files with 103,804 additions and 15,264 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
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<!-- Misc -->
<Label Text="{Loc 'ui-options-misc-label'}" StyleClasses="LabelKeyText"/>
<CheckBox Name="FpsCounterCheckBox" Text="{Loc 'ui-options-fps-counter'}" />
<CheckBox Name="ShowFootprintsCheckBox" Text="{Loc 'ui-options-show-footprints'}" />
</BoxContainer>
</ScrollContainer>
<ui:OptionsTabControlRow Name="Control" Access="Public" />
Expand Down
2 changes: 2 additions & 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 Expand Up @@ -60,6 +61,7 @@ public GraphicsTab()
Control.AddOptionCheckBox(CCVars.ViewportScaleRender, ViewportLowResCheckBox, invert: true);
Control.AddOptionCheckBox(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox);
Control.AddOptionCheckBox(CCVars.HudFpsCounterVisible, FpsCounterCheckBox);
Control.AddOptionCheckBox(SunriseCCVars.ShowFootprints, ShowFootprintsCheckBox);

Control.Initialize();

Expand Down
13 changes: 4 additions & 9 deletions Content.Client/Shuttles/UI/BaseShuttleControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protected void DrawCircles(DrawingHandleScreen handle)
}
}

protected void DrawGrid(DrawingHandleScreen handle, Matrix3x2 matrix, Entity<MapGridComponent> grid, Color color, float alpha = 0.01f)
protected void DrawGrid(DrawingHandleScreen handle, Matrix3x2 gridToView, Entity<MapGridComponent> grid, Color color, float alpha = 0.01f)
{
var rator = Maps.GetAllTilesEnumerator(grid.Owner, grid.Comp);
var minimapScale = MinimapScale;
Expand Down Expand Up @@ -264,7 +264,7 @@ protected void DrawGrid(DrawingHandleScreen handle, Matrix3x2 matrix, Entity<Map
Extensions.EnsureLength(ref _allVertices, totalData);

_drawJob.MidPoint = midpoint;
_drawJob.Matrix = matrix;
_drawJob.Matrix = gridToView;
_drawJob.MinimapScale = minimapScale;
_drawJob.Vertices = gridData.Vertices;
_drawJob.ScaledVertices = _allVertices;
Expand All @@ -286,7 +286,7 @@ protected void DrawGrid(DrawingHandleScreen handle, Matrix3x2 matrix, Entity<Map

private record struct GridDrawJob : IParallelRobustJob
{
public int BatchSize => 16;
public int BatchSize => 64;

public float MinimapScale;
public Vector2 MidPoint;
Expand All @@ -297,12 +297,7 @@ private record struct GridDrawJob : IParallelRobustJob

public void Execute(int index)
{
var vert = Vertices[index];
var adjustedVert = Vector2.Transform(vert, Matrix);
adjustedVert = adjustedVert with { Y = -adjustedVert.Y };

var scaledVert = ScalePosition(adjustedVert, MinimapScale, MidPoint);
ScaledVertices[index] = scaledVert;
ScaledVertices[index] = Vector2.Transform(Vertices[index], Matrix);
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions Content.Client/Shuttles/UI/NavScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public sealed partial class NavScreen : BoxContainer
[Dependency] private readonly IEntityManager _entManager = default!;
private SharedTransformSystem _xformSystem;

private EntityUid? _consoleEntity; // Entity of controlling console
private EntityUid? _shuttleEntity;

public NavScreen()
Expand All @@ -35,6 +36,12 @@ public void SetShuttle(EntityUid? shuttle)
_shuttleEntity = shuttle;
}

public void SetConsole(EntityUid? console)
{
_consoleEntity = console;
NavRadar.SetConsole(console);
}

private void OnIFFTogglePressed(BaseButton.ButtonEventArgs args)
{
NavRadar.ShowIFF ^= true;
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public void UpdateState(EntityUid owner, ShuttleBoundUserInterfaceState cState)
{
var coordinates = _entManager.GetCoordinates(cState.NavState.Coordinates);
NavContainer.SetShuttle(coordinates?.EntityId);
NavContainer.SetConsole(owner);
MapContainer.SetShuttle(coordinates?.EntityId);
MapContainer.SetConsole(owner);

Expand Down
Loading

0 comments on commit fcaf47d

Please sign in to comment.