Skip to content

Commit

Permalink
Revert "Upstream sync (space-wizards#264)" (space-wizards#265)
Browse files Browse the repository at this point in the history
This reverts commit bbf7dea.
  • Loading branch information
Morb0 authored Jun 18, 2022
1 parent e0a8590 commit 9f4170f
Show file tree
Hide file tree
Showing 515 changed files with 3,549 additions and 7,739 deletions.
1 change: 0 additions & 1 deletion .github/workflows/conflict-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
jobs:
Label:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- name: Check for Merge Conflicts
uses: eps1lon/actions-label-merge-conflict@513a24fc7dca40990863be2935e059e650728400
Expand Down
1 change: 0 additions & 1 deletion Content.Client/EscapeMenu/UI/EscapeMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<ui:VoteCallMenuButton />
<Button Name="OptionsButton" Text="{Loc 'ui-escape-options'}" />
<Button Name="RulesButton" Text="{Loc 'ui-escape-rules'}" />
<Button Name="WikiButton" Text="{Loc 'ui-escape-wiki'}" />
<Button Name="DisconnectButton" Text="{Loc 'ui-escape-disconnect'}" />
<Button Name="QuitButton" Text="{Loc 'ui-escape-quit'}" />
</BoxContainer>
Expand Down
9 changes: 0 additions & 9 deletions Content.Client/EscapeMenu/UI/EscapeMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Client.UserInterface;
using Content.Client.Links;
using Robust.Shared.GameObjects;

namespace Content.Client.EscapeMenu.UI
Expand All @@ -30,7 +28,6 @@ public EscapeMenu(IClientConsoleHost consoleHost)
QuitButton.OnPressed += OnQuitButtonClicked;
RulesButton.OnPressed += _ => new RulesAndInfoWindow().Open();
DisconnectButton.OnPressed += OnDisconnectButtonClicked;
WikiButton.OnPressed += OnWikiButtonClicked;
}

private void OnQuitButtonClicked(BaseButton.ButtonEventArgs args)
Expand All @@ -50,12 +47,6 @@ private void OnOptionsButtonClicked(BaseButton.ButtonEventArgs args)
_optionsMenu.OpenCentered();
}

private void OnWikiButtonClicked(BaseButton.ButtonEventArgs args)
{
var uriOpener = IoCManager.Resolve<IUriOpener>();
uriOpener.OpenUri(UILinks.Wiki);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
Expand Down
24 changes: 5 additions & 19 deletions Content.Client/Ghost/Roles/UI/GhostRoleRulesWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,51 +1,37 @@
using System;
using Content.Shared.Ghost.Roles;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Localization;
using Robust.Shared.Timing;
using Robust.Shared.Utility;

using Content.Shared.CCVar;
using Robust.Shared.Configuration;

namespace Content.Client.Ghost.Roles.UI
{
[GenerateTypedNameReferences]
public sealed partial class GhostRoleRulesWindow : DefaultWindow
{
[Dependency] private readonly IConfigurationManager _cfg = IoCManager.Resolve<IConfigurationManager>();
private float _timer;

private float _timer = 5.0f;
public GhostRoleRulesWindow(string rules, Action<BaseButton.ButtonEventArgs> requestAction)
{
RobustXamlLoader.Load(this);
var ghostRoleTime = _cfg.GetCVar(CCVars.GhostRoleTime);
_timer = ghostRoleTime;

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

TopBanner.SetMessage(FormattedMessage.FromMarkupPermissive(rules + "\n" + Loc.GetString("ghost-roles-window-rules-footer")));
RequestButton.OnPressed += requestAction;
}


protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
if (!RequestButton.Disabled) return;
if (_timer > 0.0)
{
_timer -= args.DeltaSeconds;
RequestButton.Text = Loc.GetString("ghost-roles-window-request-role-button-timer", ("time", $"{_timer:0.0}"));
}
else
{
RequestButton.Disabled = false;
RequestButton.Text = Loc.GetString("ghost-roles-window-request-role-button");
}
}
}
Expand Down
109 changes: 109 additions & 0 deletions Content.Client/MobState/DamageStateVisualizer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
using System.Collections.Generic;
using Content.Shared.MobState;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;

namespace Content.Client.MobState
{
[UsedImplicitly]
public sealed class DamageStateVisualizer : AppearanceVisualizer, ISerializationHooks
{
private DamageState _data = DamageState.Alive;
private Dictionary<DamageState, string> _stateMap = new();
private int? _originalDrawDepth;

[DataField("normal")]
private string? _normal;

[DataField("crit")]
private string? _crit;

[DataField("dead")]
private string? _dead;

/// <summary>
/// Should noRot be turned off when crit / dead.
/// </summary>
[DataField("rotate")]
private bool _rotate;

void ISerializationHooks.BeforeSerialization()
{
_stateMap.TryGetValue(DamageState.Alive, out _normal);
_stateMap.TryGetValue(DamageState.Critical, out _crit);
_stateMap.TryGetValue(DamageState.Dead, out _dead);
}

void ISerializationHooks.AfterDeserialization()
{
if (_normal != null)
{
_stateMap.Add(DamageState.Alive, _normal);
}

if (_crit != null)
{
_stateMap.Add(DamageState.Critical, _crit);
}

if (_dead != null)
{
_stateMap.Add(DamageState.Dead, _dead);
}
}

public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner);
if (!component.TryGetData(DamageStateVisuals.State, out DamageState data))
{
return;
}

if (_data == data)
{
return;
}

_data = data;

if (_rotate)
{
sprite.NoRotation = data switch
{
DamageState.Critical => false,
DamageState.Dead => false,
_ => true
};
}

if (_stateMap.TryGetValue(_data, out var state))
{
sprite.LayerSetState(DamageStateVisualLayers.Base, state);
}

// So they don't draw over mobs anymore
if (_data == DamageState.Dead && sprite.DrawDepth > (int) DrawDepth.Items)
{
_originalDrawDepth = sprite.DrawDepth;
sprite.DrawDepth = (int) DrawDepth.Items;
}
else if (_originalDrawDepth != null)
{
sprite.DrawDepth = _originalDrawDepth.Value;
_originalDrawDepth = null;
}
}
}

public enum DamageStateVisualLayers : byte
{
Base
}
}
62 changes: 0 additions & 62 deletions Content.Client/MobState/DamageStateVisualizerSystem.cs

This file was deleted.

22 changes: 0 additions & 22 deletions Content.Client/MobState/DamageStateVisualsComponent.cs

This file was deleted.

33 changes: 1 addition & 32 deletions Content.Client/PowerCell/PowerCellSystem.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,7 @@
using Content.Shared.PowerCell;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

namespace Content.Client.PowerCell;

[UsedImplicitly]
public sealed class PowerCellSystem : SharedPowerCellSystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PowerCellVisualsComponent, AppearanceChangeEvent>(OnPowerCellVisualsChange);
}

private void OnPowerCellVisualsChange(EntityUid uid, PowerCellVisualsComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null) return;

if (args.Component.TryGetData(PowerCellVisuals.ChargeLevel, out byte level))
{
if (level == 0)
{
args.Sprite.LayerSetVisible(PowerCellVisualLayers.Unshaded, false);
return;
}

args.Sprite.LayerSetVisible(PowerCellVisualLayers.Unshaded, true);
args.Sprite.LayerSetState(PowerCellVisualLayers.Unshaded, $"o{level}");
}
}

private enum PowerCellVisualLayers : byte
{
Base,
Unshaded,
}
}
public sealed class PowerCellSystem : SharedPowerCellSystem { }
46 changes: 46 additions & 0 deletions Content.Client/PowerCell/PowerCellVisualizer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Content.Shared.PowerCell;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Serialization.Manager.Attributes;

namespace Content.Client.PowerCell
{
[UsedImplicitly]
public sealed class PowerCellVisualizer : AppearanceVisualizer
{
[DataField("prefix")]
private string? _prefix;

public override void InitializeEntity(EntityUid entity)
{
base.InitializeEntity(entity);

var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity);

if (_prefix != null)
{
sprite.LayerMapSet(Layers.Charge, sprite.AddLayerState($"{_prefix}_100"));
sprite.LayerSetShader(Layers.Charge, "unshaded");
}
}

public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);

var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner);
if (component.TryGetData(PowerCellVisuals.ChargeLevel, out byte level))
{
var adjustedLevel = level * 25;
sprite.LayerSetState(Layers.Charge, $"{_prefix}_{adjustedLevel}");
}
}

private enum Layers : byte
{
Charge
}
}
}
4 changes: 0 additions & 4 deletions Content.Client/PowerCell/PowerCellVisualsComponent.cs

This file was deleted.

8 changes: 8 additions & 0 deletions Content.Client/Radar/RadarConsoleWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:radar="clr-namespace:Content.Client.Radar"
Title="{Loc 'radar-window-title'}"
Resizable="False">
<BoxContainer Orientation="Horizontal">
<radar:RadarControl Name="Radar"/>
</BoxContainer>
</DefaultWindow>
Loading

0 comments on commit 9f4170f

Please sign in to comment.