Skip to content

Commit

Permalink
Merge pull request Rxup#633 from Rxup/upstream-sync
Browse files Browse the repository at this point in the history
Upstream sync
  • Loading branch information
Rxup authored May 28, 2024
2 parents f6a30ef + 31cedc1 commit 7cff01e
Show file tree
Hide file tree
Showing 178 changed files with 121,479 additions and 121,864 deletions.
5 changes: 0 additions & 5 deletions Content.Client/Interaction/DragDropHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ public DragDropHelper(OnBeginDrag onBeginDrag, OnContinueDrag onContinueDrag, On
_cfg.OnValueChanged(CCVars.DragDropDeadZone, SetDeadZone, true);
}

~DragDropHelper()
{
_cfg.UnsubValueChanged(CCVars.DragDropDeadZone, SetDeadZone);
}

/// <summary>
/// Tell the helper that the mouse button was pressed down on
/// a target, thus a drag has the possibility to begin for this target.
Expand Down
5 changes: 3 additions & 2 deletions Content.Client/Lobby/UI/ObserveWarningWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
<BoxContainer Orientation="Vertical">
<Label Text="{Loc 'observe-warning-1'}"/>
<Label Text="{Loc 'observe-warning-2'}"/>
<BoxContainer Orientation="Horizontal" >
<BoxContainer Orientation="Horizontal">
<Button Name="NevermindButton" Text="{Loc 'observe-nevermind'}" SizeFlagsStretchRatio="1"/>
<Control HorizontalExpand="True" SizeFlagsStretchRatio="2" />
<cc:CommandButton Command="backmen" Name="ObserveButton" StyleClasses="Caution" Text="{Loc 'observe-confirm'}" SizeFlagsStretchRatio="1"/>
<cc:CommandButton Command="backmen" Name="ObserveButton" StyleClasses="Caution" Text="{Loc 'observe-confirm'}" SizeFlagsStretchRatio="1"/>
<cc:CommandButton Command="backmen admin" Name="ObserveAsAdminButton" Text="{Loc 'observe-as-admin'}" SizeFlagsStretchRatio="1" Visible="False"/>
</BoxContainer>
</BoxContainer>
</DefaultWindow>
13 changes: 13 additions & 0 deletions Content.Client/Lobby/UI/ObserveWarningWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Content.Shared.Administration.Managers;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.Player;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

Expand All @@ -9,11 +11,22 @@ namespace Content.Client.Lobby.UI;
[UsedImplicitly]
public sealed partial class ObserveWarningWindow : DefaultWindow
{
[Dependency] private readonly ISharedAdminManager _adminManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;

public ObserveWarningWindow()
{
Title = Loc.GetString("observe-warning-window-title");
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
var player = _playerManager.LocalSession;

if (player != null && _adminManager.IsAdmin(player))
{
ObserveButton.Text = Loc.GetString("observe-as-player");
ObserveAsAdminButton.Visible = true;
ObserveAsAdminButton.OnPressed += _ => { this.Close(); };
}

ObserveButton.OnPressed += _ => { this.Close(); };
NevermindButton.OnPressed += _ => { this.Close(); };
Expand Down
41 changes: 23 additions & 18 deletions Content.Client/Movement/Systems/FloorOcclusionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,56 @@ public sealed class FloorOcclusionSystem : SharedFloorOcclusionSystem
{
[Dependency] private readonly IPrototypeManager _proto = default!;

private EntityQuery<SpriteComponent> _spriteQuery;

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

_spriteQuery = GetEntityQuery<SpriteComponent>();

SubscribeLocalEvent<FloorOcclusionComponent, ComponentStartup>(OnOcclusionStartup);
SubscribeLocalEvent<FloorOcclusionComponent, ComponentShutdown>(OnOcclusionShutdown);
SubscribeLocalEvent<FloorOcclusionComponent, AfterAutoHandleStateEvent>(OnOcclusionAuto);
}

private void OnOcclusionAuto(EntityUid uid, FloorOcclusionComponent component, ref AfterAutoHandleStateEvent args)
private void OnOcclusionAuto(Entity<FloorOcclusionComponent> ent, ref AfterAutoHandleStateEvent args)
{
SetEnabled(uid, component, component.Enabled);
SetShader(ent.Owner, ent.Comp.Enabled);
}

private void OnOcclusionStartup(EntityUid uid, FloorOcclusionComponent component, ComponentStartup args)
private void OnOcclusionStartup(Entity<FloorOcclusionComponent> ent, ref ComponentStartup args)
{
if (component.Enabled && TryComp<SpriteComponent>(uid, out var sprite))
SetShader(sprite, true);
SetShader(ent.Owner, ent.Comp.Enabled);
}

protected override void SetEnabled(EntityUid uid, FloorOcclusionComponent component, bool enabled)
private void OnOcclusionShutdown(Entity<FloorOcclusionComponent> ent, ref ComponentShutdown args)
{
if (component.Enabled == enabled)
return;

base.SetEnabled(uid, component, enabled);

if (!TryComp<SpriteComponent>(uid, out var sprite))
return;
SetShader(ent.Owner, false);
}

SetShader(sprite, enabled);
protected override void SetEnabled(Entity<FloorOcclusionComponent> entity)
{
SetShader(entity.Owner, entity.Comp.Enabled);
}

private void SetShader(SpriteComponent sprite, bool enabled)
private void SetShader(Entity<SpriteComponent?> sprite, bool enabled)
{
if (!_spriteQuery.Resolve(sprite.Owner, ref sprite.Comp, false))
return;

var shader = _proto.Index<ShaderPrototype>("HorizontalCut").Instance();

if (sprite.PostShader is not null && sprite.PostShader != shader)
if (sprite.Comp.PostShader is not null && sprite.Comp.PostShader != shader)
return;

if (enabled)
{
sprite.PostShader = shader;
sprite.Comp.PostShader = shader;
}
else
{
sprite.PostShader = null;
sprite.Comp.PostShader = null;
}
}
}
1 change: 0 additions & 1 deletion Content.Client/Options/UI/OptionsMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
<tabs:GraphicsTab Name="GraphicsTab" />
<tabs:KeyRebindTab Name="KeyRebindTab" />
<tabs:AudioTab Name="AudioTab" />
<tabs:NetworkTab Name="NetworkTab" />
</TabContainer>
</DefaultWindow>
1 change: 0 additions & 1 deletion Content.Client/Options/UI/OptionsMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public OptionsMenu()
Tabs.SetTabTitle(1, Loc.GetString("ui-options-tab-graphics"));
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-network"));

UpdateTabs();
}
Expand Down
102 changes: 0 additions & 102 deletions Content.Client/Options/UI/Tabs/NetworkTab.xaml

This file was deleted.

125 changes: 0 additions & 125 deletions Content.Client/Options/UI/Tabs/NetworkTab.xaml.cs

This file was deleted.

Loading

0 comments on commit 7cff01e

Please sign in to comment.