diff --git a/.editorconfig b/.editorconfig index ef68433a3c..4bebc53999 100644 --- a/.editorconfig +++ b/.editorconfig @@ -332,5 +332,8 @@ dotnet_naming_symbols.types_and_namespaces_symbols.applicable_kinds = namespace, dotnet_naming_symbols.type_parameters_symbols.applicable_accessibilities = * dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter +# ReSharper properties +resharper_braces_for_ifelse = required_for_multiline + [*.{csproj,xml,yml,dll.config,msbuildproj,targets}] indent_size = 2 diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 1c2735046c..a53887f4b7 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -26,7 +26,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 3.1.300 + dotnet-version: 5.0.100 - name: Install dependencies run: dotnet restore - name: Build diff --git a/Content.Benchmarks/NetSerializerIntBenchmark.cs b/Content.Benchmarks/NetSerializerIntBenchmark.cs new file mode 100644 index 0000000000..a111d98dbb --- /dev/null +++ b/Content.Benchmarks/NetSerializerIntBenchmark.cs @@ -0,0 +1,263 @@ +using System; +using System.Buffers.Binary; +using System.IO; +using BenchmarkDotNet.Attributes; + +namespace Content.Benchmarks +{ + [SimpleJob] + public class NetSerializerIntBenchmark + { + private MemoryStream _writeStream; + private MemoryStream _readStream; + private ushort _x16 = 5; + private uint _x32 = 5; + private ulong _x64 = 5; + private ushort _read16; + private uint _read32; + private ulong _read64; + + [GlobalSetup] + public void Setup() + { + _writeStream = new MemoryStream(64); + _readStream = new MemoryStream(); + _readStream.Write(new byte[]{0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8}); + } + + [Benchmark] + public void BenchWrite16Span() + { + _writeStream.Position = 0; + WriteUInt16Span(_writeStream, _x16); + } + + [Benchmark] + public void BenchWrite32Span() + { + _writeStream.Position = 0; + WriteUInt32Span(_writeStream, _x32); + } + + [Benchmark] + public void BenchWrite64Span() + { + _writeStream.Position = 0; + WriteUInt64Span(_writeStream, _x64); + } + + [Benchmark] + public void BenchRead16Span() + { + _readStream.Position = 0; + _read16 = ReadUInt16Span(_readStream); + } + + [Benchmark] + public void BenchRead32Span() + { + _readStream.Position = 0; + _read32 = ReadUInt32Span(_readStream); + } + + [Benchmark] + public void BenchRead64Span() + { + _readStream.Position = 0; + _read64 = ReadUInt64Span(_readStream); + } + + [Benchmark] + public void BenchWrite16Byte() + { + _writeStream.Position = 0; + WriteUInt16Byte(_writeStream, _x16); + } + + [Benchmark] + public void BenchWrite32Byte() + { + _writeStream.Position = 0; + WriteUInt32Byte(_writeStream, _x32); + } + + [Benchmark] + public void BenchWrite64Byte() + { + _writeStream.Position = 0; + WriteUInt64Byte(_writeStream, _x64); + } + + [Benchmark] + public void BenchRead16Byte() + { + _readStream.Position = 0; + _read16 = ReadUInt16Byte(_readStream); + } + [Benchmark] + public void BenchRead32Byte() + { + _readStream.Position = 0; + _read32 = ReadUInt32Byte(_readStream); + } + + [Benchmark] + public void BenchRead64Byte() + { + _readStream.Position = 0; + _read64 = ReadUInt64Byte(_readStream); + } + + private static void WriteUInt16Byte(Stream stream, ushort value) + { + stream.WriteByte((byte) value); + stream.WriteByte((byte) (value >> 8)); + } + + private static void WriteUInt32Byte(Stream stream, uint value) + { + stream.WriteByte((byte) value); + stream.WriteByte((byte) (value >> 8)); + stream.WriteByte((byte) (value >> 16)); + stream.WriteByte((byte) (value >> 24)); + } + + private static void WriteUInt64Byte(Stream stream, ulong value) + { + stream.WriteByte((byte) value); + stream.WriteByte((byte) (value >> 8)); + stream.WriteByte((byte) (value >> 16)); + stream.WriteByte((byte) (value >> 24)); + stream.WriteByte((byte) (value >> 32)); + stream.WriteByte((byte) (value >> 40)); + stream.WriteByte((byte) (value >> 48)); + stream.WriteByte((byte) (value >> 56)); + } + + private static ushort ReadUInt16Byte(Stream stream) + { + ushort a = 0; + + for (var i = 0; i < 16; i += 8) + { + var val = stream.ReadByte(); + if (val == -1) + throw new EndOfStreamException(); + + a |= (ushort) (val << i); + } + + return a; + } + + private static uint ReadUInt32Byte(Stream stream) + { + uint a = 0; + + for (var i = 0; i < 32; i += 8) + { + var val = stream.ReadByte(); + if (val == -1) + throw new EndOfStreamException(); + + a |= (uint) (val << i); + } + + return a; + } + + private static ulong ReadUInt64Byte(Stream stream) + { + ulong a = 0; + + for (var i = 0; i < 64; i += 8) + { + var val = stream.ReadByte(); + if (val == -1) + throw new EndOfStreamException(); + + a |= (ulong) (val << i); + } + + return a; + } + + private static void WriteUInt16Span(Stream stream, ushort value) + { + Span buf = stackalloc byte[2]; + BinaryPrimitives.WriteUInt16LittleEndian(buf, value); + + stream.Write(buf); + } + + private static void WriteUInt32Span(Stream stream, uint value) + { + Span buf = stackalloc byte[4]; + BinaryPrimitives.WriteUInt32LittleEndian(buf, value); + + stream.Write(buf); + } + + private static void WriteUInt64Span(Stream stream, ulong value) + { + Span buf = stackalloc byte[8]; + BinaryPrimitives.WriteUInt64LittleEndian(buf, value); + + stream.Write(buf); + } + + private static ushort ReadUInt16Span(Stream stream) + { + Span buf = stackalloc byte[2]; + var wSpan = buf; + + while (true) + { + var read = stream.Read(wSpan); + if (read == 0) + throw new EndOfStreamException(); + if (read == wSpan.Length) + break; + wSpan = wSpan[read..]; + } + + return BinaryPrimitives.ReadUInt16LittleEndian(buf); + } + + private static uint ReadUInt32Span(Stream stream) + { + Span buf = stackalloc byte[4]; + var wSpan = buf; + + while (true) + { + var read = stream.Read(wSpan); + if (read == 0) + throw new EndOfStreamException(); + if (read == wSpan.Length) + break; + wSpan = wSpan[read..]; + } + + return BinaryPrimitives.ReadUInt32LittleEndian(buf); + } + + private static ulong ReadUInt64Span(Stream stream) + { + Span buf = stackalloc byte[8]; + var wSpan = buf; + + while (true) + { + var read = stream.Read(wSpan); + if (read == 0) + throw new EndOfStreamException(); + if (read == wSpan.Length) + break; + wSpan = wSpan[read..]; + } + + return BinaryPrimitives.ReadUInt64LittleEndian(buf); + } + } +} diff --git a/Content.Client/Arcade/BlockGameMenu.cs b/Content.Client/Arcade/BlockGameMenu.cs index 7dc8776c9e..cada939096 100644 --- a/Content.Client/Arcade/BlockGameMenu.cs +++ b/Content.Client/Arcade/BlockGameMenu.cs @@ -1,11 +1,8 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Net.Mime; using Content.Client.GameObjects.Components.Arcade; using Content.Client.Utility; using Content.Shared.Arcade; -using Content.Shared.GameObjects.Components.Arcade; using Content.Shared.Input; using Robust.Client.Graphics; using Robust.Client.Graphics.Drawing; @@ -13,7 +10,6 @@ using Robust.Client.Interfaces.ResourceManagement; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; -using Robust.Shared.Input; using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.Utility; @@ -22,15 +18,14 @@ namespace Content.Client.Arcade { public class BlockGameMenu : SS14Window { + private static readonly Color OverlayBackgroundColor = new Color(74,74,81,180); + private static readonly Color OverlayShadowColor = new Color(0,0,0,83); - private static Color overlayBackgroundColor = new Color(74,74,81,180); - private static Color overlayShadowColor = new Color(0,0,0,83); + private static readonly Vector2 BlockSize = new Vector2(15,15); - private static Vector2 blockSize = new Vector2(15,15); + private readonly BlockGameBoundUserInterface _owner; - private BlockGameBoundUserInterface _owner; - - private PanelContainer _mainPanel; + private readonly PanelContainer _mainPanel; private VBoxContainer _gameRootContainer; private GridContainer _gameGrid; @@ -88,7 +83,7 @@ namespace Content.Client.Arcade var rootBack = new StyleBoxTexture { Texture = backgroundTexture, - Modulate = overlayShadowColor + Modulate = OverlayShadowColor }; rootBack.SetPatchMargin(StyleBox.Margin.All, 10); _highscoresRootContainer = new PanelContainer @@ -98,7 +93,7 @@ namespace Content.Client.Arcade SizeFlagsHorizontal = SizeFlags.ShrinkCenter }; - var c = new Color(overlayBackgroundColor.R,overlayBackgroundColor.G,overlayBackgroundColor.B,220); + var c = new Color(OverlayBackgroundColor.R,OverlayBackgroundColor.G,OverlayBackgroundColor.B,220); var innerBack = new StyleBoxTexture { Texture = backgroundTexture, @@ -154,7 +149,7 @@ namespace Content.Client.Arcade var rootBack = new StyleBoxTexture { Texture = backgroundTexture, - Modulate = overlayShadowColor + Modulate = OverlayShadowColor }; rootBack.SetPatchMargin(StyleBox.Margin.All, 10); _gameOverRootContainer = new PanelContainer @@ -167,7 +162,7 @@ namespace Content.Client.Arcade var innerBack = new StyleBoxTexture { Texture = backgroundTexture, - Modulate = overlayBackgroundColor + Modulate = OverlayBackgroundColor }; innerBack.SetPatchMargin(StyleBox.Margin.All, 10); var menuInnerPanel = new PanelContainer @@ -212,7 +207,7 @@ namespace Content.Client.Arcade var rootBack = new StyleBoxTexture { Texture = backgroundTexture, - Modulate = overlayShadowColor + Modulate = OverlayShadowColor }; rootBack.SetPatchMargin(StyleBox.Margin.All, 10); _menuRootContainer = new PanelContainer @@ -225,7 +220,7 @@ namespace Content.Client.Arcade var innerBack = new StyleBoxTexture { Texture = backgroundTexture, - Modulate = overlayBackgroundColor + Modulate = OverlayBackgroundColor }; innerBack.SetPatchMargin(StyleBox.Margin.All, 10); var menuInnerPanel = new PanelContainer @@ -404,7 +399,7 @@ namespace Content.Client.Arcade var nextBlockPanel = new PanelContainer { PanelOverride = previewBack, - CustomMinimumSize = blockSize * 6.5f, + CustomMinimumSize = BlockSize * 6.5f, SizeFlagsHorizontal = SizeFlags.None, SizeFlagsVertical = SizeFlags.None }; @@ -442,7 +437,7 @@ namespace Content.Client.Arcade var holdBlockPanel = new PanelContainer { PanelOverride = previewBack, - CustomMinimumSize = blockSize * 6.5f, + CustomMinimumSize = BlockSize * 6.5f, SizeFlagsHorizontal = SizeFlags.None, SizeFlagsVertical = SizeFlags.None }; @@ -623,7 +618,7 @@ namespace Content.Client.Arcade _nextBlockGrid.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat {BackgroundColor = c}, - CustomMinimumSize = blockSize, + CustomMinimumSize = BlockSize, RectDrawClipMargin = 0 }); } @@ -645,7 +640,7 @@ namespace Content.Client.Arcade _holdBlockGrid.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat {BackgroundColor = c}, - CustomMinimumSize = blockSize, + CustomMinimumSize = BlockSize, RectDrawClipMargin = 0 }); } @@ -663,7 +658,7 @@ namespace Content.Client.Arcade _gameGrid.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat {BackgroundColor = c}, - CustomMinimumSize = blockSize, + CustomMinimumSize = BlockSize, RectDrawClipMargin = 0 }); } diff --git a/Content.Client/Arcade/SpaceVillainArcadeMenu.cs b/Content.Client/Arcade/SpaceVillainArcadeMenu.cs index 529d4b6fa7..e8897e7ebd 100644 --- a/Content.Client/Arcade/SpaceVillainArcadeMenu.cs +++ b/Content.Client/Arcade/SpaceVillainArcadeMenu.cs @@ -1,5 +1,4 @@ -using System.Linq; -using Content.Client.GameObjects.Components.Arcade; +using Content.Client.GameObjects.Components.Arcade; using Content.Shared.GameObjects.Components.Arcade; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; @@ -13,13 +12,13 @@ namespace Content.Client.Arcade protected override Vector2? CustomSize => (400, 200); public SpaceVillainArcadeBoundUserInterface Owner { get; set; } - private Label _enemyNameLabel; - private Label _playerInfoLabel; - private Label _enemyInfoLabel; - private Label _playerActionLabel; - private Label _enemyActionLabel; + private readonly Label _enemyNameLabel; + private readonly Label _playerInfoLabel; + private readonly Label _enemyInfoLabel; + private readonly Label _playerActionLabel; + private readonly Label _enemyActionLabel; - private Button[] _gameButtons = new Button[3]; //used to disable/enable all game buttons + private readonly Button[] _gameButtons = new Button[3]; //used to disable/enable all game buttons public SpaceVillainArcadeMenu(SpaceVillainArcadeBoundUserInterface owner) { Title = Loc.GetString("Space Villain"); @@ -97,8 +96,8 @@ namespace Content.Client.Arcade private class ActionButton : Button { - private SpaceVillainArcadeBoundUserInterface _owner; - private SharedSpaceVillainArcadeComponent.PlayerAction _playerAction; + private readonly SpaceVillainArcadeBoundUserInterface _owner; + private readonly SharedSpaceVillainArcadeComponent.PlayerAction _playerAction; public ActionButton(SpaceVillainArcadeBoundUserInterface owner,SharedSpaceVillainArcadeComponent.PlayerAction playerAction) { diff --git a/Content.Client/Construction/ConstructionMenu.cs b/Content.Client/Construction/ConstructionMenu.cs index de5f0ee049..8b7481326e 100644 --- a/Content.Client/Construction/ConstructionMenu.cs +++ b/Content.Client/Construction/ConstructionMenu.cs @@ -250,6 +250,9 @@ namespace Content.Client.Construction case StackType.Cable: return _resourceCache.GetTexture("/Textures/Objects/Tools/cables.rsi/coil-30.png"); + case StackType.MetalRod: + return _resourceCache.GetTexture("/Textures/Objects/Materials/materials.rsi/rods.png"); + } break; diff --git a/Content.Client/Eui/EuiManager.cs b/Content.Client/Eui/EuiManager.cs index 60e4d84047..3831f0b766 100644 --- a/Content.Client/Eui/EuiManager.cs +++ b/Content.Client/Eui/EuiManager.cs @@ -62,7 +62,7 @@ namespace Content.Client.Eui private sealed class EuiData { - public BaseEui Eui; + public readonly BaseEui Eui; public EuiData(BaseEui eui) { diff --git a/Content.Client/GameObjects/Components/Cargo/CargoOrderDatabaseComponent.cs b/Content.Client/GameObjects/Components/Cargo/CargoOrderDatabaseComponent.cs index c29e62464b..baad228915 100644 --- a/Content.Client/GameObjects/Components/Cargo/CargoOrderDatabaseComponent.cs +++ b/Content.Client/GameObjects/Components/Cargo/CargoOrderDatabaseComponent.cs @@ -9,7 +9,7 @@ namespace Content.Client.GameObjects.Components.Cargo [RegisterComponent] public class CargoOrderDatabaseComponent : SharedCargoOrderDatabaseComponent { - private List _orders = new List(); + private readonly List _orders = new List(); public IReadOnlyList Orders => _orders; /// diff --git a/Content.Client/GameObjects/Components/CloningPod/CloningPodWindow.cs b/Content.Client/GameObjects/Components/CloningPod/CloningPodWindow.cs index accc6363c6..04e638ccc5 100644 --- a/Content.Client/GameObjects/Components/CloningPod/CloningPodWindow.cs +++ b/Content.Client/GameObjects/Components/CloningPod/CloningPodWindow.cs @@ -25,9 +25,9 @@ namespace Content.Client.GameObjects.Components.CloningPod public readonly Button EjectButton; private readonly CloningScanButton _measureButton; private CloningScanButton? _selectedButton; - private Label _progressLabel; + private readonly Label _progressLabel; private readonly ProgressBar _cloningProgressBar; - private Label _mindState; + private readonly Label _mindState; protected override Vector2 ContentsMinimumSize => _mainVBox?.CombinedMinimumSize ?? Vector2.Zero; private CloningPodBoundUserInterfaceState _lastUpdate = null!; diff --git a/Content.Client/GameObjects/Components/Gravity/GravityGeneratorVisualizer.cs b/Content.Client/GameObjects/Components/Gravity/GravityGeneratorVisualizer.cs index 0862d7725b..60eb02d45b 100644 --- a/Content.Client/GameObjects/Components/Gravity/GravityGeneratorVisualizer.cs +++ b/Content.Client/GameObjects/Components/Gravity/GravityGeneratorVisualizer.cs @@ -11,7 +11,7 @@ namespace Content.Client.GameObjects.Components.Gravity { public class GravityGeneratorVisualizer : AppearanceVisualizer { - private Dictionary _spriteMap = new Dictionary(); + private readonly Dictionary _spriteMap = new Dictionary(); public override void InitializeEntity(IEntity entity) { diff --git a/Content.Client/GameObjects/Components/Items/ItemComponent.cs b/Content.Client/GameObjects/Components/Items/ItemComponent.cs index 42acb64a2e..07a5c33c9a 100644 --- a/Content.Client/GameObjects/Components/Items/ItemComponent.cs +++ b/Content.Client/GameObjects/Components/Items/ItemComponent.cs @@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components.Items [ComponentReference(typeof(IItemComponent))] public class ItemComponent : Component, IItemComponent, IDraggable { - [Dependency] private IResourceCache _resourceCache = default!; + [Dependency] private readonly IResourceCache _resourceCache = default!; public override string Name => "Item"; public override uint? NetID => ContentNetIDs.ITEM; diff --git a/Content.Client/GameObjects/Components/Kitchen/MicrowaveBoundUserInterface.cs b/Content.Client/GameObjects/Components/Kitchen/MicrowaveBoundUserInterface.cs index b838914889..802a410699 100644 --- a/Content.Client/GameObjects/Components/Kitchen/MicrowaveBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Kitchen/MicrowaveBoundUserInterface.cs @@ -26,8 +26,8 @@ namespace Content.Client.GameObjects.Components.Kitchen private MicrowaveMenu _menu; - private Dictionary _solids = new Dictionary(); - private Dictionary _reagents =new Dictionary(); + private readonly Dictionary _solids = new Dictionary(); + private readonly Dictionary _reagents =new Dictionary(); public MicrowaveBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner,uiKey) { diff --git a/Content.Client/GameObjects/Components/LightBehaviourComponent.cs b/Content.Client/GameObjects/Components/LightBehaviourComponent.cs index 70dc1fc695..d15ecf5bc9 100644 --- a/Content.Client/GameObjects/Components/LightBehaviourComponent.cs +++ b/Content.Client/GameObjects/Components/LightBehaviourComponent.cs @@ -361,7 +361,7 @@ namespace Content.Client.GameObjects.Components } [ViewVariables(VVAccess.ReadOnly)] - private List _animations = new List(); + private readonly List _animations = new List(); private float _originalRadius = default; private float _originalEnergy = default; diff --git a/Content.Client/GameObjects/Components/Mobs/AlertControl.cs b/Content.Client/GameObjects/Components/Mobs/AlertControl.cs index b799783594..b723550d33 100644 --- a/Content.Client/GameObjects/Components/Mobs/AlertControl.cs +++ b/Content.Client/GameObjects/Components/Mobs/AlertControl.cs @@ -20,7 +20,7 @@ namespace Content.Client.GameObjects.Components.Mobs private short? _severity; private readonly TextureRect _icon; - private CooldownGraphic _cooldownGraphic; + private readonly CooldownGraphic _cooldownGraphic; private readonly IResourceCache _resourceCache; diff --git a/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs b/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs index 8dbbed08b5..15bce99a2a 100644 --- a/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs +++ b/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using Content.Client.UserInterface; using Content.Client.UserInterface.Stylesheets; -using Content.Client.Utility; using Content.Shared.Alert; using Content.Shared.GameObjects.Components.Mobs; using Robust.Client.GameObjects; @@ -19,11 +18,9 @@ using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Timing; using Robust.Shared.IoC; using Robust.Shared.Log; -using Robust.Shared.Maths; using Robust.Shared.Prototypes; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; -using Serilog; namespace Content.Client.GameObjects.Components.Mobs { @@ -47,7 +44,7 @@ namespace Content.Client.GameObjects.Components.Mobs private bool _tooltipReady; [ViewVariables] - private Dictionary _alertControls + private readonly Dictionary _alertControls = new Dictionary(); /// diff --git a/Content.Client/GameObjects/Components/PDA/PDABoundUserInterface.cs b/Content.Client/GameObjects/Components/PDA/PDABoundUserInterface.cs index 1ba1ce1eea..1bfcee4f8e 100644 --- a/Content.Client/GameObjects/Components/PDA/PDABoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/PDA/PDABoundUserInterface.cs @@ -228,7 +228,7 @@ namespace Content.Client.GameObjects.Components.PDA public Button EjectIDButton { get; } public Button EjectPenButton { get; } - public TabContainer MasterTabContainer; + public readonly TabContainer MasterTabContainer; public RichTextLabel PDAOwnerLabel { get; } public PanelContainer IDInfoContainer { get; } @@ -236,14 +236,14 @@ namespace Content.Client.GameObjects.Components.PDA public VBoxContainer UplinkTabContainer { get; } - protected HSplitContainer CategoryAndListingsContainer; + protected readonly HSplitContainer CategoryAndListingsContainer; - private IPrototypeManager _prototypeManager; + private readonly IPrototypeManager _prototypeManager; - public VBoxContainer UplinkListingsContainer; + public readonly VBoxContainer UplinkListingsContainer; - public VBoxContainer CategoryListContainer; - public RichTextLabel BalanceInfo; + public readonly VBoxContainer CategoryListContainer; + public readonly RichTextLabel BalanceInfo; public event Action OnListingButtonPressed; public event Action OnCategoryButtonPressed; diff --git a/Content.Client/GameObjects/Components/ParticleAcceleratorPartVisualizer.cs b/Content.Client/GameObjects/Components/ParticleAcceleratorPartVisualizer.cs index 6ff0ed061a..e2e2dc8be2 100644 --- a/Content.Client/GameObjects/Components/ParticleAcceleratorPartVisualizer.cs +++ b/Content.Client/GameObjects/Components/ParticleAcceleratorPartVisualizer.cs @@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components { public class ParticleAcceleratorPartVisualizer : AppearanceVisualizer { - private Dictionary _states = new Dictionary(); + private readonly Dictionary _states = new Dictionary(); public override void LoadData(YamlMappingNode node) { diff --git a/Content.Client/GameObjects/Components/Power/SolarControlConsoleBoundUserInterface.cs b/Content.Client/GameObjects/Components/Power/SolarControlConsoleBoundUserInterface.cs index 17ce456aff..c892f1cd90 100644 --- a/Content.Client/GameObjects/Components/Power/SolarControlConsoleBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Power/SolarControlConsoleBoundUserInterface.cs @@ -14,8 +14,7 @@ namespace Content.Client.GameObjects.Components.Power { public class SolarControlConsoleBoundUserInterface : BoundUserInterface { - [Dependency] - private IGameTiming _gameTiming = default; + [Dependency] private readonly IGameTiming _gameTiming = default; private SolarControlWindow _window; private SolarControlConsoleBoundInterfaceState _lastState = new SolarControlConsoleBoundInterfaceState(0, 0, 0, 0); @@ -93,13 +92,13 @@ namespace Content.Client.GameObjects.Components.Power private sealed class SolarControlWindow : SS14Window { - public Label OutputPower; - public Label SunAngle; + public readonly Label OutputPower; + public readonly Label SunAngle; - public SolarControlNotARadar NotARadar; + public readonly SolarControlNotARadar NotARadar; - public LineEdit PanelRotation; - public LineEdit PanelVelocity; + public readonly LineEdit PanelRotation; + public readonly LineEdit PanelVelocity; public SolarControlWindow(IGameTiming igt) { diff --git a/Content.Client/GameObjects/Components/Research/LatheBoundUserInterface.cs b/Content.Client/GameObjects/Components/Research/LatheBoundUserInterface.cs index 923b798e39..49f7169f67 100644 --- a/Content.Client/GameObjects/Components/Research/LatheBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Research/LatheBoundUserInterface.cs @@ -25,7 +25,7 @@ namespace Content.Client.GameObjects.Components.Research [ViewVariables] public Queue QueuedRecipes => _queuedRecipes; - private Queue _queuedRecipes = new Queue(); + private readonly Queue _queuedRecipes = new Queue(); public LatheBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) { diff --git a/Content.Client/GameObjects/Components/Research/ResearchClientServerSelectionMenu.cs b/Content.Client/GameObjects/Components/Research/ResearchClientServerSelectionMenu.cs index 052f48c452..4b76477d58 100644 --- a/Content.Client/GameObjects/Components/Research/ResearchClientServerSelectionMenu.cs +++ b/Content.Client/GameObjects/Components/Research/ResearchClientServerSelectionMenu.cs @@ -8,7 +8,7 @@ namespace Content.Client.GameObjects.Components.Research { public class ResearchClientServerSelectionMenu : SS14Window { - private ItemList _servers; + private readonly ItemList _servers; private int _serverCount = 0; private string[] _serverNames = new string[]{}; private int[] _serverIds = new int[]{}; diff --git a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs index f3607ae1d2..94d8e1e8d4 100644 --- a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs +++ b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs @@ -134,12 +134,12 @@ namespace Content.Client.GameObjects.Components.Storage private class StorageWindow : SS14Window { private Control VSplitContainer; - private VBoxContainer EntityList; - private Label Information; + private readonly VBoxContainer _entityList; + private readonly Label _information; public ClientStorageComponent StorageEntity; - private StyleBoxFlat _HoveredBox = new StyleBoxFlat { BackgroundColor = Color.Black.WithAlpha(0.35f) }; - private StyleBoxFlat _unHoveredBox = new StyleBoxFlat { BackgroundColor = Color.Black.WithAlpha(0.0f) }; + private readonly StyleBoxFlat _hoveredBox = new StyleBoxFlat { BackgroundColor = Color.Black.WithAlpha(0.35f) }; + private readonly StyleBoxFlat _unHoveredBox = new StyleBoxFlat { BackgroundColor = Color.Black.WithAlpha(0.0f) }; protected override Vector2? CustomSize => (180, 320); @@ -179,12 +179,12 @@ namespace Content.Client.GameObjects.Components.Storage MouseFilter = MouseFilterMode.Ignore, }; containerButton.AddChild(VSplitContainer); - Information = new Label + _information = new Label { Text = "Items: 0 Volume: 0/0 Stuff", SizeFlagsVertical = SizeFlags.ShrinkCenter }; - VSplitContainer.AddChild(Information); + VSplitContainer.AddChild(_information); var listScrollContainer = new ScrollContainer { @@ -193,18 +193,18 @@ namespace Content.Client.GameObjects.Components.Storage HScrollEnabled = true, VScrollEnabled = true, }; - EntityList = new VBoxContainer + _entityList = new VBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand }; - listScrollContainer.AddChild(EntityList); + listScrollContainer.AddChild(_entityList); VSplitContainer.AddChild(listScrollContainer); Contents.AddChild(containerButton); listScrollContainer.OnMouseEntered += args => { - innerContainerButton.PanelOverride = _HoveredBox; + innerContainerButton.PanelOverride = _hoveredBox; }; listScrollContainer.OnMouseExited += args => @@ -224,7 +224,7 @@ namespace Content.Client.GameObjects.Components.Storage /// public void BuildEntityList() { - EntityList.DisposeAllChildren(); + _entityList.DisposeAllChildren(); var storageList = StorageEntity.StoredEntities; @@ -254,18 +254,18 @@ namespace Content.Client.GameObjects.Components.Storage button.EntitySpriteView.Sprite = sprite; } - EntityList.AddChild(button); + _entityList.AddChild(button); } //Sets information about entire storage container current capacity if (StorageEntity.StorageCapacityMax != 0) { - Information.Text = String.Format("Items: {0}, Stored: {1}/{2}", storageList.Count, + _information.Text = String.Format("Items: {0}, Stored: {1}/{2}", storageList.Count, StorageEntity.StorageSizeUsed, StorageEntity.StorageCapacityMax); } else { - Information.Text = String.Format("Items: {0}", storageList.Count); + _information.Text = String.Format("Items: {0}", storageList.Count); } } diff --git a/Content.Client/GameObjects/Components/VendingMachines/VendingMachineVisualizer.cs b/Content.Client/GameObjects/Components/VendingMachines/VendingMachineVisualizer.cs index a91136b6c7..9b8f363df3 100644 --- a/Content.Client/GameObjects/Components/VendingMachines/VendingMachineVisualizer.cs +++ b/Content.Client/GameObjects/Components/VendingMachines/VendingMachineVisualizer.cs @@ -39,7 +39,7 @@ namespace Content.Client.GameObjects.Components.VendingMachines {"broken", VendingMachineVisualLayers.Unlit}, }; - private Dictionary _animations = new Dictionary(); + private readonly Dictionary _animations = new Dictionary(); public override void LoadData(YamlMappingNode node) { diff --git a/Content.Client/GameObjects/Components/Wires/WiresMenu.cs b/Content.Client/GameObjects/Components/Wires/WiresMenu.cs index 7469f31a8d..9999f35bf2 100644 --- a/Content.Client/GameObjects/Components/Wires/WiresMenu.cs +++ b/Content.Client/GameObjects/Components/Wires/WiresMenu.cs @@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components.Wires { public class WiresMenu : BaseWindow { - [Dependency] private IResourceCache _resourceCache = default!; + [Dependency] private readonly IResourceCache _resourceCache = default!; public WiresBoundUserInterface Owner { get; } @@ -424,7 +424,7 @@ namespace Content.Client.GameObjects.Components.Wires "/Textures/Interface/WireHacking/wire_2_copper.svg.96dpi.png" }; - private IResourceCache _resourceCache; + private readonly IResourceCache _resourceCache; public WireRender(WireColor color, bool isCut, bool flip, bool mirror, int type, IResourceCache resourceCache) { diff --git a/Content.Client/GameObjects/EntitySystems/AI/ClientPathfindingDebugSystem.cs b/Content.Client/GameObjects/EntitySystems/AI/ClientPathfindingDebugSystem.cs index c1c0addaa8..9b80244405 100644 --- a/Content.Client/GameObjects/EntitySystems/AI/ClientPathfindingDebugSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/AI/ClientPathfindingDebugSystem.cs @@ -169,8 +169,8 @@ namespace Content.Client.GameObjects.EntitySystems.AI internal sealed class DebugPathfindingOverlay : Overlay { - private IEyeManager _eyeManager; - private IPlayerManager _playerManager; + private readonly IEyeManager _eyeManager; + private readonly IPlayerManager _playerManager; // TODO: Add a box like the debug one and show the most recent path stuff public override OverlaySpace Space => OverlaySpace.ScreenSpace; diff --git a/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterBar.cs b/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterBar.cs index b6a1af64da..172c05d047 100644 --- a/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterBar.cs +++ b/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterBar.cs @@ -14,8 +14,8 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter public sealed class DoAfterBar : Control { private IGameTiming _gameTiming = default!; - - private ShaderInstance _shader; + + private readonly ShaderInstance _shader; /// /// Set from 0.0f to 1.0f to reflect bar progress @@ -40,13 +40,13 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter { return; } - + _cancelled = value; if (_cancelled) { _gameTiming = IoCManager.Resolve(); _lastFlash = _gameTiming.CurTime; - } + } } } @@ -87,7 +87,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter _lastFlash = _gameTiming.CurTime; _flash = !_flash; } - } + } } protected override void Draw(DrawingHandleScreen handle) diff --git a/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterGui.cs b/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterGui.cs index 5228ab4bd1..ec87507a76 100644 --- a/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterGui.cs +++ b/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterGui.cs @@ -21,11 +21,11 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter [Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; - private Dictionary _doAfterControls = new Dictionary(); - private Dictionary _doAfterBars = new Dictionary(); + private readonly Dictionary _doAfterControls = new Dictionary(); + private readonly Dictionary _doAfterBars = new Dictionary(); // We'll store cancellations for a little bit just so we can flash the graphic to indicate it's cancelled - private Dictionary _cancelledDoAfters = new Dictionary(); + private readonly Dictionary _cancelledDoAfters = new Dictionary(); public IEntity? AttachedEntity { get; set; } private ScreenCoordinates _playerPosition; @@ -48,12 +48,12 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter base.Dispose(disposing); if (Disposed) return; - + foreach (var (_, control) in _doAfterControls) { control.Dispose(); } - + _doAfterControls.Clear(); _doAfterBars.Clear(); _cancelledDoAfters.Clear(); @@ -109,10 +109,10 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter RemoveChild(control); _doAfterControls.Remove(id); _doAfterBars.Remove(id); - + if (_cancelledDoAfters.ContainsKey(id)) _cancelledDoAfters.Remove(id); - + } /// @@ -130,7 +130,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter doAfterBar = new DoAfterBar(); _doAfterBars[id] = doAfterBar; } - + doAfterBar.Cancelled = true; _cancelledDoAfters.Add(id, _gameTiming.CurTime); } @@ -139,7 +139,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter { base.FrameUpdate(args); - if (AttachedEntity?.IsValid() != true || + if (AttachedEntity?.IsValid() != true || !AttachedEntity.TryGetComponent(out DoAfterComponent? doAfterComponent)) { return; diff --git a/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterSystem.cs b/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterSystem.cs index 4a89a54b78..28d350b880 100644 --- a/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/DoAfter/DoAfterSystem.cs @@ -35,7 +35,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter // Each component in range will have its own vBox which we need to keep track of so if they go out of range or // come into range it needs altering - private HashSet _knownComponents = new HashSet(); + private readonly HashSet _knownComponents = new HashSet(); private IEntity? _attachedEntity; diff --git a/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs b/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs index a145bbacff..2288e33936 100644 --- a/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs @@ -71,7 +71,7 @@ namespace Content.Client.GameObjects.EntitySystems private SharedInteractionSystem _interactionSystem; private InputSystem _inputSystem; - private List highlightedSprites = new List(); + private readonly List _highlightedSprites = new List(); private enum DragState { @@ -298,7 +298,7 @@ namespace Content.Client.GameObjects.EntitySystems var inRange = _interactionSystem.InRangeUnobstructed(_dragger, pvsEntity); inRangeSprite.PostShader = inRange ? _dropTargetInRangeShader : _dropTargetOutOfRangeShader; inRangeSprite.RenderOrder = EntityManager.CurrentTick.Value; - highlightedSprites.Add(inRangeSprite); + _highlightedSprites.Add(inRangeSprite); } } } @@ -306,12 +306,12 @@ namespace Content.Client.GameObjects.EntitySystems private void RemoveHighlights() { - foreach (var highlightedSprite in highlightedSprites) + foreach (var highlightedSprite in _highlightedSprites) { highlightedSprite.PostShader = null; highlightedSprite.RenderOrder = 0; } - highlightedSprites.Clear(); + _highlightedSprites.Clear(); } /// diff --git a/Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs b/Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs index e235c2f06e..1c9afa5b3e 100644 --- a/Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs +++ b/Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs @@ -41,7 +41,7 @@ namespace Content.Client.GameObjects.EntitySystems private readonly int[] _fireFrameCounter = new int[FireStates]; private readonly Texture[][] _fireFrames = new Texture[FireStates][]; - private Dictionary> _tileData = + private readonly Dictionary> _tileData = new Dictionary>(); private AtmosphereSystem _atmosphereSystem = default!; diff --git a/Content.Client/Graphics/Overlays/FlashOverlay.cs b/Content.Client/Graphics/Overlays/FlashOverlay.cs index d8c37ad376..278e2c0884 100644 --- a/Content.Client/Graphics/Overlays/FlashOverlay.cs +++ b/Content.Client/Graphics/Overlays/FlashOverlay.cs @@ -22,8 +22,8 @@ namespace Content.Client.Graphics.Overlays public override OverlaySpace Space => OverlaySpace.ScreenSpace; private readonly ShaderInstance _shader; - private double _startTime; - private int lastsFor = 5000; + private readonly double _startTime; + private int _lastsFor = 5000; private Texture _screenshotTexture; public FlashOverlay() : base(nameof(SharedOverlayID.FlashOverlay)) @@ -42,7 +42,7 @@ namespace Content.Client.Graphics.Overlays protected override void Draw(DrawingHandleBase handle, OverlaySpace currentSpace) { handle.UseShader(_shader); - var percentComplete = (float) ((_gameTiming.CurTime.TotalMilliseconds - _startTime) / lastsFor); + var percentComplete = (float) ((_gameTiming.CurTime.TotalMilliseconds - _startTime) / _lastsFor); _shader?.SetParameter("percentComplete", percentComplete); var screenSpaceHandle = handle as DrawingHandleScreen; @@ -63,7 +63,7 @@ namespace Content.Client.Graphics.Overlays public void Configure(TimedOverlayParameter parameters) { - lastsFor = parameters.Length; + _lastsFor = parameters.Length; } } } diff --git a/Content.Client/Instruments/InstrumentMenu.cs b/Content.Client/Instruments/InstrumentMenu.cs index 1612aec48f..9c9769f7c6 100644 --- a/Content.Client/Instruments/InstrumentMenu.cs +++ b/Content.Client/Instruments/InstrumentMenu.cs @@ -1,7 +1,6 @@ using Content.Client.GameObjects.Components.Instruments; using Content.Client.UserInterface.Stylesheets; using Content.Client.Utility; -using Content.Shared.GameObjects.EntitySystems; using Robust.Client.Audio.Midi; using Robust.Client.Graphics.Drawing; using Robust.Client.Interfaces.UserInterface; @@ -23,10 +22,10 @@ namespace Content.Client.Instruments [Dependency] private readonly IMidiManager _midiManager = default!; [Dependency] private readonly IFileDialogManager _fileDialogManager = default!; - private InstrumentBoundUserInterface _owner; - private Button midiLoopButton; - private Button midiStopButton; - private Button midiInputButton; + private readonly InstrumentBoundUserInterface _owner; + private readonly Button _midiLoopButton; + private readonly Button _midiStopButton; + private readonly Button _midiInputButton; protected override Vector2? CustomSize => (400, 150); @@ -59,7 +58,7 @@ namespace Content.Client.Instruments Align = BoxContainer.AlignMode.Center }; - midiInputButton = new Button() + _midiInputButton = new Button() { Text = Loc.GetString("MIDI Input"), TextAlign = Label.AlignMode.Center, @@ -69,7 +68,7 @@ namespace Content.Client.Instruments Pressed = _owner.Instrument.IsInputOpen, }; - midiInputButton.OnToggled += MidiInputButtonOnOnToggled; + _midiInputButton.OnToggled += MidiInputButtonOnOnToggled; var topSpacer = new Control() { @@ -95,7 +94,7 @@ namespace Content.Client.Instruments Align = BoxContainer.AlignMode.Center }; - midiLoopButton = new Button() + _midiLoopButton = new Button() { Text = Loc.GetString("Loop"), TextAlign = Label.AlignMode.Center, @@ -106,7 +105,7 @@ namespace Content.Client.Instruments Pressed = _owner.Instrument.LoopMidi, }; - midiLoopButton.OnToggled += MidiLoopButtonOnOnToggled; + _midiLoopButton.OnToggled += MidiLoopButtonOnOnToggled; var bottomSpacer = new Control() { @@ -114,7 +113,7 @@ namespace Content.Client.Instruments SizeFlagsStretchRatio = 2, }; - midiStopButton = new Button() + _midiStopButton = new Button() { Text = Loc.GetString("Stop"), TextAlign = Label.AlignMode.Center, @@ -123,13 +122,13 @@ namespace Content.Client.Instruments Disabled = !_owner.Instrument.IsMidiOpen, }; - midiStopButton.OnPressed += MidiStopButtonOnPressed; + _midiStopButton.OnPressed += MidiStopButtonOnPressed; - hBoxBottomButtons.AddChild(midiLoopButton); + hBoxBottomButtons.AddChild(_midiLoopButton); hBoxBottomButtons.AddChild(bottomSpacer); - hBoxBottomButtons.AddChild(midiStopButton); + hBoxBottomButtons.AddChild(_midiStopButton); - hBoxTopButtons.AddChild(midiInputButton); + hBoxTopButtons.AddChild(_midiInputButton); hBoxTopButtons.AddChild(topSpacer); hBoxTopButtons.AddChild(midiFileButton); @@ -168,8 +167,8 @@ namespace Content.Client.Instruments public void MidiPlaybackSetButtonsDisabled(bool disabled) { - midiLoopButton.Disabled = disabled; - midiStopButton.Disabled = disabled; + _midiLoopButton.Disabled = disabled; + _midiStopButton.Disabled = disabled; } private async void MidiFileButtonOnOnPressed(BaseButton.ButtonEventArgs obj) @@ -195,8 +194,8 @@ namespace Content.Client.Instruments await Timer.Delay(100); if (!_owner.Instrument.OpenMidi(filename)) return; MidiPlaybackSetButtonsDisabled(false); - if (midiInputButton.Pressed) - midiInputButton.Pressed = false; + if (_midiInputButton.Pressed) + _midiInputButton.Pressed = false; } private void MidiInputButtonOnOnToggled(BaseButton.ButtonToggledEventArgs obj) diff --git a/Content.Client/Research/LatheMenu.cs b/Content.Client/Research/LatheMenu.cs index c275be681b..bbb7407111 100644 --- a/Content.Client/Research/LatheMenu.cs +++ b/Content.Client/Research/LatheMenu.cs @@ -16,10 +16,10 @@ namespace Content.Client.Research { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - private ItemList Items; - private ItemList Materials; - private LineEdit AmountLineEdit; - private LineEdit SearchBar; + private readonly ItemList _items; + private readonly ItemList _materials; + private readonly LineEdit _amountLineEdit; + private readonly LineEdit _searchBar; public Button QueueButton; public Button ServerConnectButton; public Button ServerSyncButton; @@ -27,8 +27,8 @@ namespace Content.Client.Research public LatheBoundUserInterface Owner { get; set; } - private List _recipes = new List(); - private List _shownRecipes = new List(); + private readonly List _recipes = new List(); + private readonly List _shownRecipes = new List(); public LatheMenu(LatheBoundUserInterface owner = null) { @@ -94,14 +94,14 @@ namespace Content.Client.Research SizeFlagsStretchRatio = 1 }; - SearchBar = new LineEdit() + _searchBar = new LineEdit() { PlaceHolder = "Search Designs", SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3 }; - SearchBar.OnTextChanged += Populate; + _searchBar.OnTextChanged += Populate; var filterButton = new Button() { @@ -112,25 +112,25 @@ namespace Content.Client.Research Disabled = true, }; - Items = new ItemList() + _items = new ItemList() { SizeFlagsStretchRatio = 8, SizeFlagsVertical = SizeFlags.FillExpand, SelectMode = ItemList.ItemListSelectMode.Button, }; - Items.OnItemSelected += ItemSelected; + _items.OnItemSelected += ItemSelected; - AmountLineEdit = new LineEdit() + _amountLineEdit = new LineEdit() { PlaceHolder = "Amount", Text = "1", SizeFlagsHorizontal = SizeFlags.FillExpand, }; - AmountLineEdit.OnTextChanged += PopulateDisabled; + _amountLineEdit.OnTextChanged += PopulateDisabled; - Materials = new ItemList() + _materials = new ItemList() { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3 @@ -145,14 +145,14 @@ namespace Content.Client.Research } hBoxButtons.AddChild(QueueButton); - hBoxFilter.AddChild(SearchBar); + hBoxFilter.AddChild(_searchBar); hBoxFilter.AddChild(filterButton); vBox.AddChild(hBoxButtons); vBox.AddChild(hBoxFilter); - vBox.AddChild(Items); - vBox.AddChild(AmountLineEdit); - vBox.AddChild(Materials); + vBox.AddChild(_items); + vBox.AddChild(_amountLineEdit); + vBox.AddChild(_materials); margin.AddChild(vBox); @@ -161,20 +161,20 @@ namespace Content.Client.Research public void ItemSelected(ItemList.ItemListSelectedEventArgs args) { - int.TryParse(AmountLineEdit.Text, out var quantity); + int.TryParse(_amountLineEdit.Text, out var quantity); if (quantity <= 0) quantity = 1; Owner.Queue(_shownRecipes[args.ItemIndex], quantity); } public void PopulateMaterials() { - Materials.Clear(); + _materials.Clear(); foreach (var (id, amount) in Owner.Storage) { if (!_prototypeManager.TryIndex(id, out MaterialPrototype materialPrototype)) continue; var material = materialPrototype.Material; - Materials.AddItem($"{material.Name} {amount} cm³", material.Icon.Frame0(), false); + _materials.AddItem($"{material.Name} {amount} cm³", material.Icon.Frame0(), false); } } @@ -183,12 +183,12 @@ namespace Content.Client.Research /// public void PopulateDisabled() { - int.TryParse(AmountLineEdit.Text, out var quantity); + int.TryParse(_amountLineEdit.Text, out var quantity); if (quantity <= 0) quantity = 1; for (var i = 0; i < _shownRecipes.Count; i++) { var prototype = _shownRecipes[i]; - Items[i].Disabled = !Owner.Lathe.CanProduce(prototype, quantity); + _items[i].Disabled = !Owner.Lathe.CanProduce(prototype, quantity); } } @@ -203,10 +203,10 @@ namespace Content.Client.Research /// public void PopulateList() { - Items.Clear(); + _items.Clear(); foreach (var prototype in _shownRecipes) { - Items.AddItem(prototype.Name, prototype.Icon.Frame0()); + _items.AddItem(prototype.Name, prototype.Icon.Frame0()); } PopulateDisabled(); @@ -221,9 +221,9 @@ namespace Content.Client.Research foreach (var prototype in Owner.Database) { - if (SearchBar.Text.Trim().Length != 0) + if (_searchBar.Text.Trim().Length != 0) { - if (prototype.Name.ToLowerInvariant().Contains(SearchBar.Text.Trim().ToLowerInvariant())) + if (prototype.Name.ToLowerInvariant().Contains(_searchBar.Text.Trim().ToLowerInvariant())) _shownRecipes.Add(prototype); continue; } diff --git a/Content.Client/Research/LatheQueueMenu.cs b/Content.Client/Research/LatheQueueMenu.cs index 7c6537c5c5..1f619281d4 100644 --- a/Content.Client/Research/LatheQueueMenu.cs +++ b/Content.Client/Research/LatheQueueMenu.cs @@ -16,10 +16,10 @@ namespace Content.Client.Research public LatheBoundUserInterface Owner { get; set; } [ViewVariables] - private ItemList QueueList; - private Label NameLabel; - private Label Description; - private TextureRect Icon; + private readonly ItemList _queueList; + private readonly Label _nameLabel; + private readonly Label _description; + private readonly TextureRect _icon; public LatheQueueMenu() { @@ -54,7 +54,7 @@ namespace Content.Client.Research SizeFlagsHorizontal = SizeFlags.FillExpand, }; - Icon = new TextureRect() + _icon = new TextureRect() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2, @@ -66,13 +66,13 @@ namespace Content.Client.Research SizeFlagsStretchRatio = 3, }; - NameLabel = new Label() + _nameLabel = new Label() { RectClipContent = true, SizeFlagsHorizontal = SizeFlags.Fill, }; - Description = new Label() + _description = new Label() { RectClipContent = true, SizeFlagsVertical = SizeFlags.FillExpand, @@ -80,7 +80,7 @@ namespace Content.Client.Research }; - QueueList = new ItemList() + _queueList = new ItemList() { SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsVertical = SizeFlags.FillExpand, @@ -88,16 +88,16 @@ namespace Content.Client.Research SelectMode = ItemList.ItemListSelectMode.None }; - vBoxInfo.AddChild(NameLabel); - vBoxInfo.AddChild(Description); + vBoxInfo.AddChild(_nameLabel); + vBoxInfo.AddChild(_description); - hBox.AddChild(Icon); + hBox.AddChild(_icon); hBox.AddChild(vBoxInfo); descMargin.AddChild(hBox); vBox.AddChild(descMargin); - vBox.AddChild(QueueList); + vBox.AddChild(_queueList); margin.AddChild(vBox); @@ -108,27 +108,27 @@ namespace Content.Client.Research public void SetInfo(LatheRecipePrototype recipe) { - Icon.Texture = recipe.Icon.Frame0(); + _icon.Texture = recipe.Icon.Frame0(); if (recipe.Name != null) - NameLabel.Text = recipe.Name; + _nameLabel.Text = recipe.Name; if (recipe.Description != null) - Description.Text = recipe.Description; + _description.Text = recipe.Description; } public void ClearInfo() { - Icon.Texture = Texture.Transparent; - NameLabel.Text = "-------"; - Description.Text = "Not producing anything."; + _icon.Texture = Texture.Transparent; + _nameLabel.Text = "-------"; + _description.Text = "Not producing anything."; } public void PopulateList() { - QueueList.Clear(); + _queueList.Clear(); var idx = 1; foreach (var recipe in Owner.QueuedRecipes) { - QueueList.AddItem($"{idx}. {recipe.Name}", recipe.Icon.Frame0()); + _queueList.AddItem($"{idx}. {recipe.Name}", recipe.Icon.Frame0()); idx++; } } diff --git a/Content.Client/Research/ResearchConsoleMenu.cs b/Content.Client/Research/ResearchConsoleMenu.cs index 2b26fb69ac..a17a20a2a8 100644 --- a/Content.Client/Research/ResearchConsoleMenu.cs +++ b/Content.Client/Research/ResearchConsoleMenu.cs @@ -18,19 +18,19 @@ namespace Content.Client.Research protected override Vector2? CustomSize => (800, 400); - private List _unlockedTechnologyPrototypes = new List(); - private List _unlockableTechnologyPrototypes = new List(); - private List _futureTechnologyPrototypes = new List(); + private readonly List _unlockedTechnologyPrototypes = new List(); + private readonly List _unlockableTechnologyPrototypes = new List(); + private readonly List _futureTechnologyPrototypes = new List(); - private Label _pointLabel; - private Label _pointsPerSecondLabel; - private Label _technologyName; - private Label _technologyDescription; - private Label _technologyRequirements; - private TextureRect _technologyIcon; - private ItemList _unlockedTechnologies; - private ItemList _unlockableTechnologies; - private ItemList _futureTechnologies; + private readonly Label _pointLabel; + private readonly Label _pointsPerSecondLabel; + private readonly Label _technologyName; + private readonly Label _technologyDescription; + private readonly Label _technologyRequirements; + private readonly TextureRect _technologyIcon; + private readonly ItemList _unlockedTechnologies; + private readonly ItemList _unlockableTechnologies; + private readonly ItemList _futureTechnologies; public Button UnlockButton { get; private set; } public Button ServerSelectionButton { get; private set; } diff --git a/Content.Client/Sandbox/SandboxManager.cs b/Content.Client/Sandbox/SandboxManager.cs index 5faff03d31..4d432d0fa6 100644 --- a/Content.Client/Sandbox/SandboxManager.cs +++ b/Content.Client/Sandbox/SandboxManager.cs @@ -20,19 +20,19 @@ namespace Content.Client.Sandbox // Layout for the SandboxWindow public class SandboxWindow : SS14Window { - public Button RespawnButton; - public Button SpawnEntitiesButton; - public Button SpawnTilesButton; - public Button GiveFullAccessButton; //A button that just puts a captain's ID in your hands. - public Button GiveAghostButton; - public Button ToggleLightButton; - public Button ToggleFovButton; - public Button ToggleShadowsButton; - public Button SuicideButton; - public Button ToggleSubfloorButton; - public Button ShowMarkersButton; //Shows spawn points - public Button ShowBbButton; //Shows bounding boxes - public Button MachineLinkingButton; // Enables/disables machine linking mode. + public readonly Button RespawnButton; + public readonly Button SpawnEntitiesButton; + public readonly Button SpawnTilesButton; + public readonly Button GiveFullAccessButton; //A button that just puts a captain's ID in your hands. + public readonly Button GiveAghostButton; + public readonly Button ToggleLightButton; + public readonly Button ToggleFovButton; + public readonly Button ToggleShadowsButton; + public readonly Button SuicideButton; + public readonly Button ToggleSubfloorButton; + public readonly Button ShowMarkersButton; //Shows spawn points + public readonly Button ShowBbButton; //Shows bounding boxes + public readonly Button MachineLinkingButton; // Enables/disables machine linking mode. public SandboxWindow() { diff --git a/Content.Client/UserInterface/AdminMenu/AdminMenuWindow.cs b/Content.Client/UserInterface/AdminMenu/AdminMenuWindow.cs index f45ac25c88..24b39739d6 100644 --- a/Content.Client/UserInterface/AdminMenu/AdminMenuWindow.cs +++ b/Content.Client/UserInterface/AdminMenu/AdminMenuWindow.cs @@ -607,7 +607,7 @@ namespace Content.Client.UserInterface.AdminMenu GetValueFromData = (obj) => ((GasPrototype) obj).ID.ToString(), }; - private CommandUISpinBox _amount = new CommandUISpinBox + private readonly CommandUISpinBox _amount = new CommandUISpinBox { Name = "Amount" }; diff --git a/Content.Client/UserInterface/Cargo/CargoConsoleMenu.cs b/Content.Client/UserInterface/Cargo/CargoConsoleMenu.cs index 3621ab326d..e8f41156ea 100644 --- a/Content.Client/UserInterface/Cargo/CargoConsoleMenu.cs +++ b/Content.Client/UserInterface/Cargo/CargoConsoleMenu.cs @@ -23,7 +23,7 @@ namespace Content.Client.UserInterface.Cargo public event Action OnOrderApproved; public event Action OnOrderCanceled; - private List _categoryStrings = new List(); + private readonly List _categoryStrings = new List(); private Label _accountNameLabel { get; set; } private Label _pointsLabel { get; set; } diff --git a/Content.Client/UserInterface/Cargo/GalacticBankSelectionMenu.cs b/Content.Client/UserInterface/Cargo/GalacticBankSelectionMenu.cs index 5727db3fce..be6a5035e1 100644 --- a/Content.Client/UserInterface/Cargo/GalacticBankSelectionMenu.cs +++ b/Content.Client/UserInterface/Cargo/GalacticBankSelectionMenu.cs @@ -10,7 +10,7 @@ namespace Content.Client.UserInterface.Cargo { public class GalacticBankSelectionMenu : SS14Window { - private ItemList _accounts; + private readonly ItemList _accounts; private int _accountCount = 0; private string[] _accountNames = new string[] { }; private int[] _accountIds = new int[] { }; diff --git a/Content.Client/UserInterface/CooldownGraphic.cs b/Content.Client/UserInterface/CooldownGraphic.cs index d281c73e99..a2da053a92 100644 --- a/Content.Client/UserInterface/CooldownGraphic.cs +++ b/Content.Client/UserInterface/CooldownGraphic.cs @@ -14,7 +14,7 @@ namespace Content.Client.UserInterface [Dependency] private readonly IPrototypeManager _protoMan = default!; - private ShaderInstance _shader; + private readonly ShaderInstance _shader; public CooldownGraphic() { diff --git a/Content.Client/UserInterface/LateJoinGui.cs b/Content.Client/UserInterface/LateJoinGui.cs index 0924a4eb94..2f6e5b29c9 100644 --- a/Content.Client/UserInterface/LateJoinGui.cs +++ b/Content.Client/UserInterface/LateJoinGui.cs @@ -26,7 +26,7 @@ namespace Content.Client.UserInterface public event Action SelectedId; - private Dictionary JobButtons = new Dictionary(); + private readonly Dictionary _jobButtons = new Dictionary(); public LateJoinGui() { @@ -95,7 +95,7 @@ namespace Content.Client.UserInterface jobButton.Disabled = true; } - JobButtons[job.ID] = jobButton; + _jobButtons[job.ID] = jobButton; } SelectedId += jobId => @@ -115,7 +115,7 @@ namespace Content.Client.UserInterface private void JobsAvailableUpdated(IReadOnlyList jobs) { - foreach (var (id, button) in JobButtons) + foreach (var (id, button) in _jobButtons) { button.Disabled = !jobs.Contains(id); } @@ -128,7 +128,7 @@ namespace Content.Client.UserInterface if (disposing) { _gameTicker.LobbyJobsAvailableUpdated -= JobsAvailableUpdated; - JobButtons.Clear(); + _jobButtons.Clear(); } } } diff --git a/Content.Client/UserInterface/LobbyCharacterPreviewPanel.cs b/Content.Client/UserInterface/LobbyCharacterPreviewPanel.cs index 3a76eab6b8..de0af99932 100644 --- a/Content.Client/UserInterface/LobbyCharacterPreviewPanel.cs +++ b/Content.Client/UserInterface/LobbyCharacterPreviewPanel.cs @@ -23,8 +23,8 @@ namespace Content.Client.UserInterface private readonly IClientPreferencesManager _preferencesManager; private IEntity _previewDummy; private readonly Label _summaryLabel; - private VBoxContainer _loaded; - private Label _unloaded; + private readonly VBoxContainer _loaded; + private readonly Label _unloaded; public LobbyCharacterPreviewPanel(IEntityManager entityManager, IClientPreferencesManager preferencesManager) diff --git a/Content.Client/UserInterface/LobbyGui.cs b/Content.Client/UserInterface/LobbyGui.cs index 2fbc9df8f0..d445202fef 100644 --- a/Content.Client/UserInterface/LobbyGui.cs +++ b/Content.Client/UserInterface/LobbyGui.cs @@ -258,8 +258,8 @@ namespace Content.Client.UserInterface public class LobbyPlayerList : Control { - private ScrollContainer _scroll; - private VBoxContainer _vBox; + private readonly ScrollContainer _scroll; + private readonly VBoxContainer _vBox; public LobbyPlayerList() { diff --git a/Content.Client/UserInterface/ParticleAccelerator/ParticleAcceleratorControlMenu.cs b/Content.Client/UserInterface/ParticleAccelerator/ParticleAcceleratorControlMenu.cs index 2e9ab07227..1e451e9bf9 100644 --- a/Content.Client/UserInterface/ParticleAccelerator/ParticleAcceleratorControlMenu.cs +++ b/Content.Client/UserInterface/ParticleAccelerator/ParticleAcceleratorControlMenu.cs @@ -24,7 +24,7 @@ namespace Content.Client.ParticleAccelerator { public sealed class ParticleAcceleratorControlMenu : BaseWindow { - private ShaderInstance _greyScaleShader; + private readonly ShaderInstance _greyScaleShader; private readonly ParticleAcceleratorBoundUserInterface Owner; diff --git a/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs b/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs index 4d57b08519..69db28af24 100644 --- a/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs +++ b/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs @@ -9,7 +9,7 @@ namespace Content.Server.AI.Operators.Combat.Melee { public class SwingMeleeWeaponOperator : AiOperator { - private float _burstTime; + private readonly float _burstTime; private float _elapsedTime; private readonly IEntity _owner; diff --git a/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs b/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs index f509844fc3..3d00db189d 100644 --- a/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs +++ b/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs @@ -8,7 +8,7 @@ namespace Content.Server.AI.Operators.Combat.Melee { public sealed class UnarmedCombatOperator : AiOperator { - private float _burstTime; + private readonly float _burstTime; private float _elapsedTime; private readonly IEntity _owner; diff --git a/Content.Server/AI/Operators/Movement/MoveToEntityOperator.cs b/Content.Server/AI/Operators/Movement/MoveToEntityOperator.cs index 35a15293e7..0b84e525fa 100644 --- a/Content.Server/AI/Operators/Movement/MoveToEntityOperator.cs +++ b/Content.Server/AI/Operators/Movement/MoveToEntityOperator.cs @@ -16,12 +16,12 @@ namespace Content.Server.AI.Operators.Movement public float ArrivalDistance { get; } public float PathfindingProximity { get; } - private bool _requiresInRangeUnobstructed; + private readonly bool _requiresInRangeUnobstructed; public MoveToEntityOperator( - IEntity owner, - IEntity target, - float arrivalDistance = 1.0f, + IEntity owner, + IEntity target, + float arrivalDistance = 1.0f, float pathfindingProximity = 1.5f, bool requiresInRangeUnobstructed = false) { @@ -44,7 +44,7 @@ namespace Content.Server.AI.Operators.Movement steering.Register(_owner, _request); return true; } - + public override void Shutdown(Outcome outcome) { base.Shutdown(outcome); @@ -71,4 +71,4 @@ namespace Content.Server.AI.Operators.Movement } } } -} \ No newline at end of file +} diff --git a/Content.Server/AI/Utility/Actions/Clothing/Gloves/EquipGloves.cs b/Content.Server/AI/Utility/Actions/Clothing/Gloves/EquipGloves.cs index 1804f2e798..d3cfcd94cf 100644 --- a/Content.Server/AI/Utility/Actions/Clothing/Gloves/EquipGloves.cs +++ b/Content.Server/AI/Utility/Actions/Clothing/Gloves/EquipGloves.cs @@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Gloves { public sealed class EquipGloves : UtilityAction { - private IEntity _entity; + private readonly IEntity _entity; public EquipGloves(IEntity owner, IEntity entity, float weight) : base(owner) { @@ -35,7 +35,7 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Gloves base.UpdateBlackboard(context); context.GetState().SetValue(_entity); } - + protected override IReadOnlyCollection> GetConsiderations(Blackboard context) { var considerationsManager = IoCManager.Resolve(); diff --git a/Content.Server/AI/Utility/Actions/Clothing/Head/EquipHead.cs b/Content.Server/AI/Utility/Actions/Clothing/Head/EquipHead.cs index 144aa99430..c0337464cc 100644 --- a/Content.Server/AI/Utility/Actions/Clothing/Head/EquipHead.cs +++ b/Content.Server/AI/Utility/Actions/Clothing/Head/EquipHead.cs @@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Head { public sealed class EquipHead : UtilityAction { - private IEntity _entity; + private readonly IEntity _entity; public EquipHead(IEntity owner, IEntity entity, float weight) : base(owner) { diff --git a/Content.Server/AI/Utility/Actions/Clothing/OuterClothing/EquipOuterClothing.cs b/Content.Server/AI/Utility/Actions/Clothing/OuterClothing/EquipOuterClothing.cs index 4a2460e63c..51982ca0e2 100644 --- a/Content.Server/AI/Utility/Actions/Clothing/OuterClothing/EquipOuterClothing.cs +++ b/Content.Server/AI/Utility/Actions/Clothing/OuterClothing/EquipOuterClothing.cs @@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Actions.Clothing.OuterClothing { public sealed class EquipOuterClothing : UtilityAction { - private IEntity _entity; + private readonly IEntity _entity; public EquipOuterClothing(IEntity owner, IEntity entity, float weight) : base(owner) { diff --git a/Content.Server/AI/Utility/Actions/Clothing/Shoes/EquipShoes.cs b/Content.Server/AI/Utility/Actions/Clothing/Shoes/EquipShoes.cs index b15bb5e82b..69b5871215 100644 --- a/Content.Server/AI/Utility/Actions/Clothing/Shoes/EquipShoes.cs +++ b/Content.Server/AI/Utility/Actions/Clothing/Shoes/EquipShoes.cs @@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Shoes { public sealed class EquipShoes : UtilityAction { - private IEntity _entity; + private readonly IEntity _entity; public EquipShoes(IEntity owner, IEntity entity, float weight) : base(owner) { diff --git a/Content.Server/AI/Utility/Actions/Combat/Melee/EquipMelee.cs b/Content.Server/AI/Utility/Actions/Combat/Melee/EquipMelee.cs index ce42bfd6dd..bf823ccfb3 100644 --- a/Content.Server/AI/Utility/Actions/Combat/Melee/EquipMelee.cs +++ b/Content.Server/AI/Utility/Actions/Combat/Melee/EquipMelee.cs @@ -15,7 +15,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee { public sealed class EquipMelee : UtilityAction { - private IEntity _entity; + private readonly IEntity _entity; public EquipMelee(IEntity owner, IEntity entity, float weight) : base(owner) { diff --git a/Content.Server/AI/Utility/Actions/Combat/Melee/MeleeWeaponAttackEntity.cs b/Content.Server/AI/Utility/Actions/Combat/Melee/MeleeWeaponAttackEntity.cs index e0df81467c..d18ce81802 100644 --- a/Content.Server/AI/Utility/Actions/Combat/Melee/MeleeWeaponAttackEntity.cs +++ b/Content.Server/AI/Utility/Actions/Combat/Melee/MeleeWeaponAttackEntity.cs @@ -21,7 +21,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee { public sealed class MeleeWeaponAttackEntity : UtilityAction { - private IEntity _entity; + private readonly IEntity _entity; public MeleeWeaponAttackEntity(IEntity owner, IEntity entity, float weight) : base(owner) { @@ -58,7 +58,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee var equipped = context.GetState().GetValue(); context.GetState().SetValue(equipped); } - + protected override IReadOnlyCollection> GetConsiderations(Blackboard context) { var considerationsManager = IoCManager.Resolve(); diff --git a/Content.Server/AI/Utility/Actions/Combat/Melee/PickUpMeleeWeapon.cs b/Content.Server/AI/Utility/Actions/Combat/Melee/PickUpMeleeWeapon.cs index fed29d402a..495e6dbbc6 100644 --- a/Content.Server/AI/Utility/Actions/Combat/Melee/PickUpMeleeWeapon.cs +++ b/Content.Server/AI/Utility/Actions/Combat/Melee/PickUpMeleeWeapon.cs @@ -15,7 +15,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee { public sealed class PickUpMeleeWeapon : UtilityAction { - private IEntity _entity; + private readonly IEntity _entity; public PickUpMeleeWeapon(IEntity owner, IEntity entity, float weight) : base(owner) { @@ -34,7 +34,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee context.GetState().SetValue(_entity); context.GetState().SetValue(_entity); } - + protected override IReadOnlyCollection> GetConsiderations(Blackboard context) { var considerationsManager = IoCManager.Resolve(); diff --git a/Content.Server/AI/Utility/Actions/Combat/Melee/UnarmedAttackEntity.cs b/Content.Server/AI/Utility/Actions/Combat/Melee/UnarmedAttackEntity.cs index 62c15cffd7..bd64519dd7 100644 --- a/Content.Server/AI/Utility/Actions/Combat/Melee/UnarmedAttackEntity.cs +++ b/Content.Server/AI/Utility/Actions/Combat/Melee/UnarmedAttackEntity.cs @@ -19,7 +19,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee { public sealed class UnarmedAttackEntity : UtilityAction { - private IEntity _entity; + private readonly IEntity _entity; public UnarmedAttackEntity(IEntity owner, IEntity entity, float weight) : base(owner) { @@ -44,7 +44,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee ActionOperators = new Queue(new AiOperator[] { moveOperator, - new UnarmedCombatOperator(Owner, _entity), + new UnarmedCombatOperator(Owner, _entity), }); } @@ -60,7 +60,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee protected override IReadOnlyCollection> GetConsiderations(Blackboard context) { var considerationsManager = IoCManager.Resolve(); - + return new[] { considerationsManager.Get() diff --git a/Content.Server/AI/Utility/Actions/Nutrition/Drink/PickUpDrink.cs b/Content.Server/AI/Utility/Actions/Nutrition/Drink/PickUpDrink.cs index 3612b646ec..5adf2af6a7 100644 --- a/Content.Server/AI/Utility/Actions/Nutrition/Drink/PickUpDrink.cs +++ b/Content.Server/AI/Utility/Actions/Nutrition/Drink/PickUpDrink.cs @@ -14,7 +14,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Drink { public sealed class PickUpDrink : UtilityAction { - private IEntity _entity; + private readonly IEntity _entity; public PickUpDrink(IEntity owner, IEntity entity, float weight) : base(owner) { @@ -26,17 +26,17 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Drink { ActionOperators = new GoPickupEntitySequence(Owner, _entity).Sequence; } - + protected override void UpdateBlackboard(Blackboard context) { base.UpdateBlackboard(context); context.GetState().SetValue(_entity); } - + protected override IReadOnlyCollection> GetConsiderations(Blackboard context) { var considerationsManager = IoCManager.Resolve(); - + return new[] { considerationsManager.Get() diff --git a/Content.Server/AI/Utility/Actions/Nutrition/Drink/UseDrinkInInventory.cs b/Content.Server/AI/Utility/Actions/Nutrition/Drink/UseDrinkInInventory.cs index e94cd74356..075a1f58f3 100644 --- a/Content.Server/AI/Utility/Actions/Nutrition/Drink/UseDrinkInInventory.cs +++ b/Content.Server/AI/Utility/Actions/Nutrition/Drink/UseDrinkInInventory.cs @@ -15,7 +15,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Drink { public sealed class UseDrinkInInventory : UtilityAction { - private IEntity _entity; + private readonly IEntity _entity; public UseDrinkInInventory(IEntity owner, IEntity entity, float weight) : base(owner) { @@ -31,13 +31,13 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Drink new UseDrinkInInventoryOperator(Owner, _entity), }); } - + protected override void UpdateBlackboard(Blackboard context) { base.UpdateBlackboard(context); context.GetState().SetValue(_entity); - } - + } + protected override IReadOnlyCollection> GetConsiderations(Blackboard context) { var considerationsManager = IoCManager.Resolve(); diff --git a/Content.Server/AI/Utility/Actions/Nutrition/Food/PickUpFood.cs b/Content.Server/AI/Utility/Actions/Nutrition/Food/PickUpFood.cs index 4c4dd08cfa..741d611a68 100644 --- a/Content.Server/AI/Utility/Actions/Nutrition/Food/PickUpFood.cs +++ b/Content.Server/AI/Utility/Actions/Nutrition/Food/PickUpFood.cs @@ -14,7 +14,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food { public sealed class PickUpFood : UtilityAction { - private IEntity _entity; + private readonly IEntity _entity; public PickUpFood(IEntity owner, IEntity entity, float weight) : base(owner) { @@ -31,8 +31,8 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food { base.UpdateBlackboard(context); context.GetState().SetValue(_entity); - } - + } + protected override IReadOnlyCollection> GetConsiderations(Blackboard context) { var considerationsManager = IoCManager.Resolve(); diff --git a/Content.Server/AI/Utility/Actions/Nutrition/Food/UseFoodInInventory.cs b/Content.Server/AI/Utility/Actions/Nutrition/Food/UseFoodInInventory.cs index b12c40dbf8..4528035a95 100644 --- a/Content.Server/AI/Utility/Actions/Nutrition/Food/UseFoodInInventory.cs +++ b/Content.Server/AI/Utility/Actions/Nutrition/Food/UseFoodInInventory.cs @@ -15,7 +15,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food { public sealed class UseFoodInInventory : UtilityAction { - private IEntity _entity; + private readonly IEntity _entity; public UseFoodInInventory(IEntity owner, IEntity entity, float weight) : base(owner) { @@ -28,7 +28,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food ActionOperators = new Queue(new AiOperator[] { new EquipEntityOperator(Owner, _entity), - new UseFoodInInventoryOperator(Owner, _entity), + new UseFoodInInventoryOperator(Owner, _entity), }); } @@ -36,8 +36,8 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food { base.UpdateBlackboard(context); context.GetState().SetValue(_entity); - } - + } + protected override IReadOnlyCollection> GetConsiderations(Blackboard context) { var considerationsManager = IoCManager.Resolve(); diff --git a/Content.Server/AI/Utility/Considerations/ConsiderationsManager.cs b/Content.Server/AI/Utility/Considerations/ConsiderationsManager.cs index 1ff677f402..9de6fc5af7 100644 --- a/Content.Server/AI/Utility/Considerations/ConsiderationsManager.cs +++ b/Content.Server/AI/Utility/Considerations/ConsiderationsManager.cs @@ -7,23 +7,23 @@ namespace Content.Server.AI.Utility.Considerations { public class ConsiderationsManager { - private Dictionary _considerations = new Dictionary(); + private readonly Dictionary _considerations = new Dictionary(); public void Initialize() { var reflectionManager = IoCManager.Resolve(); var typeFactory = IoCManager.Resolve(); - + foreach (var conType in reflectionManager.GetAllChildren(typeof(Consideration))) { var con = (Consideration) typeFactory.CreateInstance(conType); _considerations.Add(conType, con); } } - + public T Get() where T : Consideration { return (T) _considerations[typeof(T)]; } } -} \ No newline at end of file +} diff --git a/Content.Server/AI/WorldState/BlackboardManager.cs b/Content.Server/AI/WorldState/BlackboardManager.cs index f0ef10f5d2..a2cd836ff2 100644 --- a/Content.Server/AI/WorldState/BlackboardManager.cs +++ b/Content.Server/AI/WorldState/BlackboardManager.cs @@ -14,7 +14,7 @@ namespace Content.Server.AI.WorldState { // Cache the known types public IReadOnlyCollection AiStates => _aiStates; - private List _aiStates = new List(); + private readonly List _aiStates = new List(); public void Initialize() { @@ -24,8 +24,8 @@ namespace Content.Server.AI.WorldState { _aiStates.Add(state); } - + DebugTools.AssertNotNull(_aiStates); } } -} \ No newline at end of file +} diff --git a/Content.Server/Administration/AdminManager.cs b/Content.Server/Administration/AdminManager.cs index 4c1b9fc4d5..0ee2b7839d 100644 --- a/Content.Server/Administration/AdminManager.cs +++ b/Content.Server/Administration/AdminManager.cs @@ -460,7 +460,7 @@ namespace Content.Server.Administration private sealed class AdminReg { - public IPlayerSession Session; + public readonly IPlayerSession Session; public AdminData Data; public int? RankId; diff --git a/Content.Server/Atmos/HighPressureMovementController.cs b/Content.Server/Atmos/HighPressureMovementController.cs index c344a25496..352a5d77f8 100644 --- a/Content.Server/Atmos/HighPressureMovementController.cs +++ b/Content.Server/Atmos/HighPressureMovementController.cs @@ -4,19 +4,17 @@ using Content.Server.GameObjects.Components.Atmos; using Content.Shared.Atmos; using Content.Shared.Physics; using Robust.Shared.GameObjects.Components; -using Robust.Shared.Interfaces.Physics; using Robust.Shared.Interfaces.Random; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; -using Robust.Shared.Physics; using Robust.Shared.Random; namespace Content.Server.Atmos { public class HighPressureMovementController : FrictionController { - [Dependency] private IRobustRandom _robustRandom = default!; + [Dependency] private readonly IRobustRandom _robustRandom = default!; public override IPhysicsComponent? ControlledComponent { protected get; set; } private const float MoveForcePushRatio = 1f; diff --git a/Content.Server/Cargo/CargoOrderDatabase.cs b/Content.Server/Cargo/CargoOrderDatabase.cs index 924a424071..9c4f362273 100644 --- a/Content.Server/Cargo/CargoOrderDatabase.cs +++ b/Content.Server/Cargo/CargoOrderDatabase.cs @@ -7,7 +7,7 @@ namespace Content.Server.Cargo { public class CargoOrderDatabase { - private Dictionary _orders = new Dictionary(); + private readonly Dictionary _orders = new Dictionary(); private int _orderNumber = 0; public CargoOrderDatabase(int id) @@ -84,7 +84,7 @@ namespace Content.Server.Cargo { return _orders.Remove(orderNumber); } - + /// /// Approves an order in the database. /// @@ -96,7 +96,7 @@ namespace Content.Server.Cargo if (!_orders.TryGetValue(orderNumber, out var order)) return; else if (CurrentOrderSize + order.Amount > MaxOrderSize) - { + { AddOrder(order.Requester, Loc.GetString("{0} (Overflow)", order.Reason.Replace(" (Overflow)","")), order.ProductId, order.Amount - MaxOrderSize - CurrentOrderSize, order.PayingAccountId); order.Amount = MaxOrderSize - CurrentOrderSize; diff --git a/Content.Server/Construction/Completions/SetStackCount.cs b/Content.Server/Construction/Completions/SetStackCount.cs new file mode 100644 index 0000000000..3879e92a5e --- /dev/null +++ b/Content.Server/Construction/Completions/SetStackCount.cs @@ -0,0 +1,36 @@ +#nullable enable +using System.Threading.Tasks; +using Content.Server.GameObjects.Components.Stack; +using Content.Shared.Construction; +using JetBrains.Annotations; +using Robust.Shared.Interfaces.GameObjects; +using System; +using Robust.Shared.Log; +using Robust.Shared.Serialization; + +namespace Content.Server.Construction.Completions +{ + [UsedImplicitly] + public class SetStackCount : IGraphAction + { + public int Amount { get; private set; } + + public void ExposeData(ObjectSerializer serializer) + { + serializer.DataField(this, x => x.Amount, "amount", 1); + } + + public async Task PerformAction(IEntity entity, IEntity? user) + { + if (entity.Deleted) return; + if(!entity.TryGetComponent(out StackComponent? stackComponent)) return; + + stackComponent.Count = Math.Min(stackComponent.MaxCount, Amount); + + if (Amount > stackComponent.MaxCount) + { + Logger.Warning("StackCount is bigger than maximum stack capacity, for entity " + entity.Name); + } + } + } +} diff --git a/Content.Server/Construction/Completions/SpawnPrototype.cs b/Content.Server/Construction/Completions/SpawnPrototype.cs index 0752b83c26..30e891bed6 100644 --- a/Content.Server/Construction/Completions/SpawnPrototype.cs +++ b/Content.Server/Construction/Completions/SpawnPrototype.cs @@ -1,6 +1,9 @@ #nullable enable +using System; using System.Threading.Tasks; +using Content.Server.GameObjects.Components.Stack; using Content.Shared.Construction; +using Content.Shared.Utility; using JetBrains.Annotations; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.IoC; @@ -20,6 +23,7 @@ namespace Content.Server.Construction.Completions serializer.DataField(this, x => x.Amount, "amount", 1); } + public async Task PerformAction(IEntity entity, IEntity? user) { if (entity.Deleted || string.IsNullOrEmpty(Prototype)) return; @@ -27,10 +31,21 @@ namespace Content.Server.Construction.Completions var entityManager = IoCManager.Resolve(); var coordinates = entity.Transform.Coordinates; - for (var i = 0; i < Amount; i++) + if (EntityPrototypeHelpers.HasComponent(Prototype)) { - entityManager.SpawnEntity(Prototype, coordinates); + var _entity = entityManager.SpawnEntity(Prototype, coordinates); + StackComponent stackComponent = _entity.GetComponent(); + + stackComponent.Count = Math.Min(stackComponent.MaxCount, Amount); } + else + { + for (var i = 0; i < Amount; i++) + { + entityManager.SpawnEntity(Prototype, coordinates); + } + } + } } } diff --git a/Content.Server/Construction/Conditions/DoorWelded.cs b/Content.Server/Construction/Conditions/DoorWelded.cs new file mode 100644 index 0000000000..1eb3267bee --- /dev/null +++ b/Content.Server/Construction/Conditions/DoorWelded.cs @@ -0,0 +1,42 @@ +using System.Threading.Tasks; +using Content.Server.GameObjects.Components.Atmos; +using Content.Server.GameObjects.Components.Doors; +using Content.Shared.Construction; +using JetBrains.Annotations; +using Robust.Shared.GameObjects.Components; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Localization; +using Robust.Shared.Log; +using Robust.Shared.Serialization; +using Robust.Shared.Utility; + +namespace Content.Server.Construction.Conditions +{ + [UsedImplicitly] + public class DoorWelded : IEdgeCondition + { + public bool Welded { get; private set; } + public void ExposeData(ObjectSerializer serializer) + { + serializer.DataField(this, x => x.Welded, "welded", true); + } + + public async Task Condition(IEntity entity) + { + if (!entity.TryGetComponent(out ServerDoorComponent doorComponent)) return false; + return doorComponent.IsWeldedShut == Welded; + } + + public void DoExamine(IEntity entity, FormattedMessage message, bool inDetailsRange) + { + if (!entity.TryGetComponent(out ServerDoorComponent doorComponent)) return; + + if (doorComponent.State == ServerDoorComponent.DoorState.Closed && Welded) + message.AddMarkup(Loc.GetString("First, weld the door.\n")); + else if (doorComponent.IsWeldedShut && !Welded) + { + message.AddMarkup(Loc.GetString("First, unweld the door.\n")); + } + } + } +} diff --git a/Content.Server/GameObjects/Components/Arcade/BlockGameArcadeComponent.cs b/Content.Server/GameObjects/Components/Arcade/BlockGameArcadeComponent.cs index b60dc31c95..681187f7c0 100644 --- a/Content.Server/GameObjects/Components/Arcade/BlockGameArcadeComponent.cs +++ b/Content.Server/GameObjects/Components/Arcade/BlockGameArcadeComponent.cs @@ -26,18 +26,20 @@ namespace Content.Server.GameObjects.Components.Arcade [ComponentReference(typeof(IActivate))] public class BlockGameArcadeComponent : Component, IActivate { - [Dependency] private IRobustRandom _random = null!; + [Dependency] private readonly IRobustRandom _random = default!; public override string Name => "BlockGameArcade"; public override uint? NetID => ContentNetIDs.BLOCKGAME_ARCADE; - [ComponentDependency] private PowerReceiverComponent? _powerReceiverComponent = default!; + + [ComponentDependency] private readonly PowerReceiverComponent? _powerReceiverComponent = default!; + private bool Powered => _powerReceiverComponent?.Powered ?? false; private BoundUserInterface? UserInterface => Owner.GetUIOrNull(BlockGameUiKey.Key); private BlockGame? _game; private IPlayerSession? _player; - private List _spectators = new List(); + private readonly List _spectators = new List(); public void Activate(ActivateEventArgs eventArgs) { @@ -162,9 +164,9 @@ namespace Content.Server.GameObjects.Components.Arcade { //note: field is 10(0 -> 9) wide and 20(0 -> 19) high - private BlockGameArcadeComponent _component; + private readonly BlockGameArcadeComponent _component; - private List _field = new List(); + private readonly List _field = new List(); private BlockGamePiece _currentPiece; diff --git a/Content.Server/GameObjects/Components/Arcade/SpaceVillainArcadeComponent.cs b/Content.Server/GameObjects/Components/Arcade/SpaceVillainArcadeComponent.cs index 2a5a9c878c..30098ee021 100644 --- a/Content.Server/GameObjects/Components/Arcade/SpaceVillainArcadeComponent.cs +++ b/Content.Server/GameObjects/Components/Arcade/SpaceVillainArcadeComponent.cs @@ -29,10 +29,10 @@ namespace Content.Server.GameObjects.Components.Arcade [ComponentReference(typeof(IActivate))] public class SpaceVillainArcadeComponent : SharedSpaceVillainArcadeComponent, IActivate, IWires { - [Dependency] private IRobustRandom _random = null!; + [Dependency] private readonly IRobustRandom _random = null!; - [ComponentDependency] private PowerReceiverComponent? _powerReceiverComponent = default!; - [ComponentDependency] private WiresComponent? _wiresComponent = default!; + [ComponentDependency] private readonly PowerReceiverComponent? _powerReceiverComponent = default!; + [ComponentDependency] private readonly WiresComponent? _wiresComponent = default!; private bool Powered => _powerReceiverComponent != null && _powerReceiverComponent.Powered; @@ -240,7 +240,7 @@ namespace Content.Server.GameObjects.Components.Arcade { [Dependency] private readonly IRobustRandom _random = default!; - [ViewVariables] private SpaceVillainArcadeComponent Owner; + [ViewVariables] private readonly SpaceVillainArcadeComponent _owner; [ViewVariables] public string Name => $"{_fightVerb} {_enemyName}"; [ViewVariables(VVAccess.ReadWrite)] private int _playerHp = 30; @@ -253,8 +253,8 @@ namespace Content.Server.GameObjects.Components.Arcade [ViewVariables(VVAccess.ReadWrite)] private int _enemyMpMax = 20; [ViewVariables(VVAccess.ReadWrite)] private int _turtleTracker; - [ViewVariables(VVAccess.ReadWrite)] private string _fightVerb; - [ViewVariables(VVAccess.ReadWrite)] private string _enemyName; + [ViewVariables(VVAccess.ReadWrite)] private readonly string _fightVerb; + [ViewVariables(VVAccess.ReadWrite)] private readonly string _enemyName; [ViewVariables] private bool _running = true; @@ -266,7 +266,7 @@ namespace Content.Server.GameObjects.Components.Arcade public SpaceVillainGame(SpaceVillainArcadeComponent owner, string fightVerb, string enemyName) { IoCManager.InjectDependencies(this); - Owner = owner; + _owner = owner; //todo defeat the curse secret game mode _fightVerb = fightVerb; _enemyName = enemyName; @@ -278,7 +278,7 @@ namespace Content.Server.GameObjects.Components.Arcade /// private void ValidateVars() { - if(Owner._overflowFlag) return; + if(_owner._overflowFlag) return; if (_playerHp > _playerHpMax) _playerHp = _playerHpMax; if (_playerMp > _playerMpMax) _playerMp = _playerMpMax; @@ -299,23 +299,23 @@ namespace Content.Server.GameObjects.Components.Arcade case PlayerAction.Attack: var attackAmount = _random.Next(2, 6); _latestPlayerActionMessage = Loc.GetString("You attack {0} for {1}!", _enemyName, attackAmount); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/player_attack.ogg", Owner.Owner, AudioParams.Default.WithVolume(-4f)); - if(!Owner._enemyInvincibilityFlag) _enemyHp -= attackAmount; + EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/player_attack.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); + if(!_owner._enemyInvincibilityFlag) _enemyHp -= attackAmount; _turtleTracker -= _turtleTracker > 0 ? 1 : 0; break; case PlayerAction.Heal: var pointAmount = _random.Next(1, 3); var healAmount = _random.Next(6, 8); _latestPlayerActionMessage = Loc.GetString("You use {0} magic to heal for {1} damage!", pointAmount, healAmount); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/player_heal.ogg", Owner.Owner, AudioParams.Default.WithVolume(-4f)); - if(!Owner._playerInvincibilityFlag) _playerMp -= pointAmount; + EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/player_heal.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); + if(!_owner._playerInvincibilityFlag) _playerMp -= pointAmount; _playerHp += healAmount; _turtleTracker++; break; case PlayerAction.Recharge: var chargeAmount = _random.Next(4, 7); _latestPlayerActionMessage = Loc.GetString("You regain {0} points", chargeAmount); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/player_charge.ogg", Owner.Owner, AudioParams.Default.WithVolume(-4f)); + EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/player_charge.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); _playerMp += chargeAmount; _turtleTracker -= _turtleTracker > 0 ? 1 : 0; break; @@ -347,8 +347,8 @@ namespace Content.Server.GameObjects.Components.Arcade { _running = false; UpdateUi(Loc.GetString("You won!"), Loc.GetString("{0} dies.", _enemyName), true); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/win.ogg", Owner.Owner, AudioParams.Default.WithVolume(-4f)); - Owner.ProcessWin(); + EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/win.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); + _owner.ProcessWin(); return false; } @@ -358,14 +358,14 @@ namespace Content.Server.GameObjects.Components.Arcade { _running = false; UpdateUi(Loc.GetString("You lost!"), Loc.GetString("{0} cheers.", _enemyName), true); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/gameover.ogg", Owner.Owner, AudioParams.Default.WithVolume(-4f)); + EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/gameover.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); return false; } if (_enemyHp <= 0 || _enemyMp <= 0) { _running = false; UpdateUi(Loc.GetString("You lost!"), Loc.GetString("{0} dies, but takes you with him.", _enemyName), true); - EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/gameover.ogg", Owner.Owner, AudioParams.Default.WithVolume(-4f)); + EntitySystem.Get().PlayFromEntity("/Audio/Effects/Arcade/gameover.ogg", _owner.Owner, AudioParams.Default.WithVolume(-4f)); return false; } @@ -377,7 +377,7 @@ namespace Content.Server.GameObjects.Components.Arcade /// private void UpdateUi(bool metadata = false) { - Owner.UserInterface?.SendMessage(metadata ? GenerateMetaDataMessage() : GenerateUpdateMessage()); + _owner.UserInterface?.SendMessage(metadata ? GenerateMetaDataMessage() : GenerateUpdateMessage()); } private void UpdateUi(string message1, string message2, bool metadata = false) @@ -397,14 +397,14 @@ namespace Content.Server.GameObjects.Components.Arcade { var boomAmount = _random.Next(5, 10); _latestEnemyActionMessage = Loc.GetString("{0} throws a bomb, exploding you for {1} damage!", _enemyName, boomAmount); - if (Owner._playerInvincibilityFlag) return; + if (_owner._playerInvincibilityFlag) return; _playerHp -= boomAmount; _turtleTracker--; }else if (_enemyMp <= 5 && _random.Prob(0.7f)) { var stealAmount = _random.Next(2, 3); _latestEnemyActionMessage = Loc.GetString("{0} steals {1} of your power!", _enemyName, stealAmount); - if (Owner._playerInvincibilityFlag) return; + if (_owner._playerInvincibilityFlag) return; _playerMp -= stealAmount; _enemyMp += stealAmount; }else if (_enemyHp <= 10 && _enemyMp > 4) @@ -418,7 +418,7 @@ namespace Content.Server.GameObjects.Components.Arcade var attackAmount = _random.Next(3, 6); _latestEnemyActionMessage = Loc.GetString("{0} attacks you for {1} damage!", _enemyName, attackAmount); - if (Owner._playerInvincibilityFlag) return; + if (_owner._playerInvincibilityFlag) return; _playerHp -= attackAmount; } } diff --git a/Content.Server/GameObjects/Components/Atmos/FirelockComponent.cs b/Content.Server/GameObjects/Components/Atmos/FirelockComponent.cs index 5724e64a4c..5a8fd241f4 100644 --- a/Content.Server/GameObjects/Components/Atmos/FirelockComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/FirelockComponent.cs @@ -13,6 +13,7 @@ using Robust.Shared.Interfaces.GameObjects; namespace Content.Server.GameObjects.Components.Atmos { [RegisterComponent] + [ComponentReference(typeof(ServerDoorComponent))] public class FirelockComponent : ServerDoorComponent, IInteractUsing, ICollideBehavior { public override string Name => "Firelock"; @@ -68,30 +69,38 @@ namespace Content.Server.GameObjects.Components.Atmos public override async Task InteractUsing(InteractUsingEventArgs eventArgs) { + if (await base.InteractUsing(eventArgs)) + return false; + if (!eventArgs.Using.TryGetComponent(out var tool)) return false; - if (tool.HasQuality(ToolQuality.Prying)) + if (tool.HasQuality(ToolQuality.Prying) && !IsWeldedShut) { var holdingPressure = IsHoldingPressure(); var holdingFire = IsHoldingFire(); if (State == DoorState.Closed) { - if(holdingPressure) + if (holdingPressure) Owner.PopupMessage(eventArgs.User, "A gush of air blows in your face... Maybe you should reconsider."); } - if (!await tool.UseTool(eventArgs.User, Owner, holdingPressure || holdingFire ? 1.5f : 0.25f, ToolQuality.Prying)) return false; - + if (IsWeldedShut || !await tool.UseTool(eventArgs.User, Owner, holdingPressure || holdingFire ? 1.5f : 0.25f, ToolQuality.Prying)) return false; if (State == DoorState.Closed) + { Open(); + } else if (State == DoorState.Open) + { Close(); + } + return true; } + return false; } } diff --git a/Content.Server/GameObjects/Components/Damage/DamageOnHighSpeedImpactComponent.cs b/Content.Server/GameObjects/Components/Damage/DamageOnHighSpeedImpactComponent.cs index cb843a2c57..e8cc275d80 100644 --- a/Content.Server/GameObjects/Components/Damage/DamageOnHighSpeedImpactComponent.cs +++ b/Content.Server/GameObjects/Components/Damage/DamageOnHighSpeedImpactComponent.cs @@ -19,8 +19,8 @@ namespace Content.Server.GameObjects.Components.Damage [RegisterComponent] public class DamageOnHighSpeedImpactComponent : Component, ICollideBehavior { - [Dependency] private IRobustRandom _robustRandom = default!; - [Dependency] private IGameTiming _gameTiming = default!; + [Dependency] private readonly IRobustRandom _robustRandom = default!; + [Dependency] private readonly IGameTiming _gameTiming = default!; public override string Name => "DamageOnHighSpeedImpact"; diff --git a/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs b/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs index 5033eea168..a54160d12d 100644 --- a/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs +++ b/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs @@ -17,7 +17,6 @@ using Content.Shared.GameObjects.Components.Doors; using Content.Shared.GameObjects.Components.Interactable; using Content.Shared.GameObjects.Components.Movement; using Content.Shared.Interfaces.GameObjects.Components; -using Content.Shared.Physics; using Robust.Server.GameObjects; using Robust.Server.GameObjects.EntitySystems; using Robust.Shared.Audio; @@ -64,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Doors [ViewVariables(VVAccess.ReadWrite)] protected float CloseSpeed = AutoCloseDelay; - private CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); + private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); protected virtual TimeSpan CloseTimeOne => TimeSpan.FromSeconds(0.3f); protected virtual TimeSpan CloseTimeTwo => TimeSpan.FromSeconds(0.9f); diff --git a/Content.Server/GameObjects/Components/Items/FirelockElectronics.cs b/Content.Server/GameObjects/Components/Items/FirelockElectronics.cs new file mode 100644 index 0000000000..88b5fc2e53 --- /dev/null +++ b/Content.Server/GameObjects/Components/Items/FirelockElectronics.cs @@ -0,0 +1,11 @@ +using Robust.Shared.GameObjects; + + +namespace Content.Server.GameObjects.Components.Items +{ + [RegisterComponent] + class FirelockElectronics : Component + { + public override string Name => "FirelockElectronics"; + } +} diff --git a/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs b/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs index a9df905b61..cf504d52c6 100644 --- a/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs +++ b/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs @@ -11,6 +11,7 @@ using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Serialization; +using System.Collections.Generic; namespace Content.Server.GameObjects.Components.Items { @@ -18,15 +19,15 @@ namespace Content.Server.GameObjects.Components.Items public class FloorTileItemComponent : Component, IAfterInteract { [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; - [Dependency] private readonly IMapManager _mapManager = default!; public override string Name => "FloorTile"; - private string _outputTile; + private List _outputTiles; + public override void ExposeData(ObjectSerializer serializer) { base.ExposeData(serializer); - serializer.DataField(ref _outputTile, "output", "floor_steel"); + serializer.DataField(ref _outputTiles, "outputs", null); } public override void Initialize() @@ -58,31 +59,38 @@ namespace Content.Server.GameObjects.Components.Items { if (!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true)) return; if (!Owner.TryGetComponent(out StackComponent stack)) return; + var mapManager = IoCManager.Resolve(); var location = eventArgs.ClickLocation.AlignWithClosestGridTile(); var locationMap = location.ToMap(Owner.EntityManager); - - var desiredTile = (ContentTileDefinition)_tileDefinitionManager[_outputTile]; - - if (_mapManager.TryGetGrid(location.GetGridId(Owner.EntityManager), out var mapGrid)) + mapManager.TryGetGrid(location.GetGridId(Owner.EntityManager), out var mapGrid); + foreach (var currentTile in _outputTiles) { - var tile = mapGrid.GetTileRef(location); - var baseTurf = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId]; + var currentTileDefinition = (ContentTileDefinition) _tileDefinitionManager[currentTile]; - if (HasBaseTurf(desiredTile, baseTurf.Name) && eventArgs.Target == null && stack.Use(1)) + if (mapGrid != null) { - PlaceAt(mapGrid, location, desiredTile.TileId); + var tile = mapGrid.GetTileRef(location); + var baseTurf = (ContentTileDefinition) _tileDefinitionManager[tile.Tile.TypeId]; + + if (HasBaseTurf(currentTileDefinition, baseTurf.Name) && stack.Use(1)) + { + PlaceAt(mapGrid, location, currentTileDefinition.TileId); + break; + } } - } - else if(HasBaseTurf(desiredTile, "space")) - { - mapGrid = _mapManager.CreateGrid(locationMap.MapId); - mapGrid.WorldPosition = locationMap.Position; - location = new EntityCoordinates(mapGrid.GridEntityId, Vector2.Zero); - PlaceAt(mapGrid, location, desiredTile.TileId, mapGrid.TileSize/2f); + else if (HasBaseTurf(currentTileDefinition, "space")) + { + mapGrid = mapManager.CreateGrid(locationMap.MapId); + mapGrid.WorldPosition = locationMap.Position; + location = new EntityCoordinates(mapGrid.GridEntityId, Vector2.Zero); + PlaceAt(mapGrid, location, _tileDefinitionManager[_outputTiles[0]].TileId, mapGrid.TileSize / 2f); + break; + } + + } } - } } diff --git a/Content.Server/GameObjects/Components/Items/Storage/CursedEntityStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/CursedEntityStorageComponent.cs index 6018872270..a7d6b836ae 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/CursedEntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/CursedEntityStorageComponent.cs @@ -4,7 +4,6 @@ using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects.EntitySystems; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; -using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Random; using Robust.Shared.IoC; using Robust.Shared.Random; @@ -17,7 +16,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage [RegisterComponent] public class CursedEntityStorageComponent : EntityStorageComponent { - [Dependency] private IRobustRandom _robustRandom = default!; + [Dependency] private readonly IRobustRandom _robustRandom = default!; public override string Name => "CursedEntityStorage"; diff --git a/Content.Server/GameObjects/Components/Markers/ConditionalSpawnerComponent.cs b/Content.Server/GameObjects/Components/Markers/ConditionalSpawnerComponent.cs index c0f1978962..052976632c 100644 --- a/Content.Server/GameObjects/Components/Markers/ConditionalSpawnerComponent.cs +++ b/Content.Server/GameObjects/Components/Markers/ConditionalSpawnerComponent.cs @@ -4,7 +4,6 @@ using Content.Server.GameTicking; using Content.Server.Interfaces.GameTicking; using Robust.Server.Interfaces.GameObjects; using Robust.Shared.GameObjects; -using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Random; using Robust.Shared.Interfaces.Reflection; using Robust.Shared.IoC; @@ -28,7 +27,7 @@ namespace Content.Server.GameObjects.Components.Markers public List Prototypes { get; set; } = new List(); [ViewVariables(VVAccess.ReadWrite)] - private List _gameRules = new List(); + private readonly List _gameRules = new List(); [ViewVariables(VVAccess.ReadWrite)] public float Chance { get; set; } = 1.0f; diff --git a/Content.Server/GameObjects/Components/Morgue/BodyBagEntityStorageComponent.cs b/Content.Server/GameObjects/Components/Morgue/BodyBagEntityStorageComponent.cs index ef3e1bb8d3..3c8d91150b 100644 --- a/Content.Server/GameObjects/Components/Morgue/BodyBagEntityStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Morgue/BodyBagEntityStorageComponent.cs @@ -32,7 +32,7 @@ namespace Content.Server.GameObjects.Components.Morgue public override string Name => "BodyBagEntityStorage"; [ViewVariables] - [ComponentDependency] private AppearanceComponent? _appearance = null; + [ComponentDependency] private readonly AppearanceComponent? _appearance = null; [ViewVariables] public ContainerSlot? LabelContainer { get; private set; } diff --git a/Content.Server/GameObjects/Components/NodeContainer/NodeGroups/AMENodeGroup.cs b/Content.Server/GameObjects/Components/NodeContainer/NodeGroups/AMENodeGroup.cs index 57f54a9f26..2574a294bd 100644 --- a/Content.Server/GameObjects/Components/NodeContainer/NodeGroups/AMENodeGroup.cs +++ b/Content.Server/GameObjects/Components/NodeContainer/NodeGroups/AMENodeGroup.cs @@ -25,7 +25,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups public AMEControllerComponent MasterController => _masterController; - private List _cores = new List(); + private readonly List _cores = new List(); public int CoreCount => _cores.Count; diff --git a/Content.Server/GameObjects/Components/Nutrition/HungerComponent.cs b/Content.Server/GameObjects/Components/Nutrition/HungerComponent.cs index 32e13a360a..d4b1daf95e 100644 --- a/Content.Server/GameObjects/Components/Nutrition/HungerComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/HungerComponent.cs @@ -4,7 +4,6 @@ using Content.Server.GameObjects.Components.Mobs; using Content.Shared.Alert; using Content.Shared.Damage; using Content.Shared.GameObjects.Components.Damage; -using Content.Shared.GameObjects.Components.Mobs; using Content.Shared.GameObjects.Components.Movement; using Content.Shared.GameObjects.Components.Nutrition; using Robust.Shared.GameObjects; @@ -55,7 +54,7 @@ namespace Content.Server.GameObjects.Components.Nutrition [ViewVariables(VVAccess.ReadOnly)] public Dictionary HungerThresholds => _hungerThresholds; - private Dictionary _hungerThresholds = new Dictionary + private readonly Dictionary _hungerThresholds = new Dictionary { {HungerThreshold.Overfed, 600.0f}, {HungerThreshold.Okay, 450.0f}, diff --git a/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs b/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs index 056aba614f..34e40e69d5 100644 --- a/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs +++ b/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs @@ -32,7 +32,7 @@ namespace Content.Server.GameObjects.Components } [ViewVariables] - int IInteractUsing.Priority => 1; + int IInteractUsing.Priority => -10; public override void ExposeData(ObjectSerializer serializer) { diff --git a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs index 366756931a..224e288001 100644 --- a/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcNetComponents/PowerReceiverUsers/PoweredLightComponent.cs @@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece [RegisterComponent] public class PoweredLightComponent : Component, IInteractHand, IInteractUsing, IMapInit, ISignalReceiver, ISignalReceiver { - [Dependency] private IGameTiming _gameTiming = default!; + [Dependency] private readonly IGameTiming _gameTiming = default!; public override string Name => "PoweredLight"; diff --git a/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs b/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs index 9405fbdb4c..5236a99aac 100644 --- a/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs +++ b/Content.Server/GameObjects/Components/Recycling/RecyclerComponent.cs @@ -3,7 +3,6 @@ using System.Diagnostics.CodeAnalysis; using Content.Server.GameObjects.Components.Conveyor; using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Power.ApcNetComponents; -using Content.Server.GameObjects.EntitySystems; using Content.Shared.Construction; using Content.Shared.GameObjects.Components.Body; using Content.Shared.GameObjects.Components.Recycling; @@ -13,9 +12,7 @@ using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Components; using Robust.Shared.GameObjects.Components.Map; -using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; @@ -28,7 +25,7 @@ namespace Content.Server.GameObjects.Components.Recycling { public override string Name => "Recycler"; - private List _intersecting = new List(); + private readonly List _intersecting = new List(); /// /// Whether or not sentient beings will be recycled diff --git a/Content.Server/GameObjects/Components/Singularity/ContainmentFieldConnection.cs b/Content.Server/GameObjects/Components/Singularity/ContainmentFieldConnection.cs index 15b5b88d37..e1d0a63f18 100644 --- a/Content.Server/GameObjects/Components/Singularity/ContainmentFieldConnection.cs +++ b/Content.Server/GameObjects/Components/Singularity/ContainmentFieldConnection.cs @@ -15,9 +15,9 @@ namespace Content.Server.GameObjects.Components.Singularity { public readonly ContainmentFieldGeneratorComponent Generator1; public readonly ContainmentFieldGeneratorComponent Generator2; - private List _fields = new List(); + private readonly List _fields = new List(); private int _sharedEnergyPool; - private CancellationTokenSource _powerDecreaseCancellationTokenSource = new CancellationTokenSource(); + private readonly CancellationTokenSource _powerDecreaseCancellationTokenSource = new CancellationTokenSource(); public int SharedEnergyPool { get => _sharedEnergyPool; diff --git a/Content.Server/GameObjects/Components/Singularity/ContainmentFieldGeneratorComponent.cs b/Content.Server/GameObjects/Components/Singularity/ContainmentFieldGeneratorComponent.cs index c211d464fc..62423d18bc 100644 --- a/Content.Server/GameObjects/Components/Singularity/ContainmentFieldGeneratorComponent.cs +++ b/Content.Server/GameObjects/Components/Singularity/ContainmentFieldGeneratorComponent.cs @@ -1,24 +1,18 @@ #nullable enable using System; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using Content.Server.GameObjects.Components.Projectiles; using Content.Server.Utility; -using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Physics; -using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Components; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Physics; using Robust.Shared.IoC; -using Robust.Shared.Localization; using Robust.Shared.Log; -using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Physics; -using Robust.Shared.Utility; using Robust.Shared.ViewVariables; namespace Content.Server.GameObjects.Components.Singularity @@ -26,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Singularity [RegisterComponent] public class ContainmentFieldGeneratorComponent : Component, ICollideBehavior { - [Dependency] private IPhysicsManager _physicsManager = null!; + [Dependency] private readonly IPhysicsManager _physicsManager = null!; public override string Name => "ContainmentFieldGenerator"; diff --git a/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs b/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs index 3a5ce91118..9968edd2e8 100644 --- a/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs +++ b/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs @@ -16,7 +16,6 @@ using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.ComponentDependencies; using Robust.Shared.GameObjects.Components; using Robust.Shared.GameObjects.Systems; -using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Random; using Robust.Shared.IoC; using Robust.Shared.Localization; @@ -37,8 +36,8 @@ namespace Content.Server.GameObjects.Components.Singularity { [Dependency] private readonly IRobustRandom _robustRandom = default!; - [ComponentDependency] private AppearanceComponent? _appearance = default; - [ComponentDependency] private AccessReader? _accessReader = default; + [ComponentDependency] private readonly AppearanceComponent? _appearance = default; + [ComponentDependency] private readonly AccessReader? _accessReader = default; public override string Name => "Emitter"; diff --git a/Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs b/Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs index 3f0ab51504..e7dfb89c05 100644 --- a/Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs +++ b/Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs @@ -1,10 +1,8 @@ #nullable enable -using System; using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.Components.StationEvents; using Content.Shared.GameObjects; -using Content.Shared.GameObjects.EntitySystemMessages; using Content.Shared.Physics; using Robust.Server.GameObjects; using Robust.Server.GameObjects.EntitySystems; @@ -15,7 +13,6 @@ using Robust.Shared.GameObjects.Components; using Robust.Shared.GameObjects.Components.Map; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; -using Robust.Shared.Interfaces.Map; using Robust.Shared.Interfaces.Random; using Robust.Shared.IoC; using Robust.Shared.Log; @@ -29,9 +26,7 @@ namespace Content.Server.GameObjects.Components.Singularity [RegisterComponent] public class SingularityComponent : Component, ICollideBehavior { - [Dependency] private IEntityManager _entityManager = null!; - [Dependency] private IRobustRandom _random = null!; - + [Dependency] private readonly IRobustRandom _random = default!; public override uint? NetID => ContentNetIDs.SINGULARITY; @@ -163,17 +158,17 @@ namespace Content.Server.GameObjects.Components.Singularity _singularityController?.Push(pushVector.Normalized, 2); } - List _previousPulledEntites = new List(); + private readonly List _previousPulledEntities = new List(); public void PullUpdate() { - foreach (var previousPulledEntity in _previousPulledEntites) + foreach (var previousPulledEntity in _previousPulledEntities) { if(previousPulledEntity.Deleted) continue; if (!previousPulledEntity.TryGetComponent(out var collidableComponent)) continue; var controller = collidableComponent.EnsureController(); controller.StopPull(); } - _previousPulledEntites.Clear(); + _previousPulledEntities.Clear(); var entitiesToPull = Owner.EntityManager.GetEntitiesInRange(Owner.Transform.Coordinates, Level * 10); foreach (var entity in entitiesToPull) @@ -187,7 +182,7 @@ namespace Content.Server.GameObjects.Components.Singularity var speed = 10 / vec.Length * Level; controller.Pull(vec.Normalized, speed); - _previousPulledEntites.Add(entity); + _previousPulledEntities.Add(entity); } } diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/RangedMagazineComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/RangedMagazineComponent.cs index 9c6d4c4d5d..7a12ce427b 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/RangedMagazineComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Ammunition/RangedMagazineComponent.cs @@ -24,7 +24,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition { public override string Name => "RangedMagazine"; - private Stack _spawnedAmmo = new Stack(); + private readonly Stack _spawnedAmmo = new Stack(); private Container _ammoContainer; public int ShotsLeft => _spawnedAmmo.Count + _unspawnedCount; diff --git a/Content.Server/GameObjects/EntitySystems/AI/AiFactionTagSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/AiFactionTagSystem.cs index ea35dceb99..5801a15c46 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/AiFactionTagSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/AiFactionTagSystem.cs @@ -24,7 +24,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI public Faction GetHostileFactions(Faction faction) => _hostileFactions.TryGetValue(faction, out var hostiles) ? hostiles : Faction.None; - private Dictionary _hostileFactions = new Dictionary + private readonly Dictionary _hostileFactions = new Dictionary { {Faction.NanoTransen, Faction.SimpleHostile | Faction.Syndicate | Faction.Xeno}, diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs index 83e3766405..af610df01d 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs @@ -45,7 +45,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible /// /// Queued region updates /// - private HashSet _queuedUpdates = new HashSet(); + private readonly HashSet _queuedUpdates = new HashSet(); // Oh god the nesting. Shouldn't need to go beyond this /// @@ -53,7 +53,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible /// Regions are groups of nodes with the same profile (for pathfinding purposes) /// i.e. same collision, not-space, same access, etc. /// - private Dictionary>> _regions = + private readonly Dictionary>> _regions = new Dictionary>>(); /// @@ -70,7 +70,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible // Also, didn't use a dictionary because there didn't seem to be a clean way to do the lookup // Plus this way we can check if everything is equal except for vision so an entity with a lower vision radius can use an entity with a higher vision radius' cached result - private Dictionary Regions)>> _cachedAccessible = + private readonly Dictionary Regions)>> _cachedAccessible = new Dictionary)>>(); private readonly List _queuedCacheDeletions = new List(); diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Pathfinders/AStarPathfindingJob.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Pathfinders/AStarPathfindingJob.cs index d934f373ed..80ba5e19e3 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Pathfinders/AStarPathfindingJob.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Pathfinders/AStarPathfindingJob.cs @@ -15,9 +15,9 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Pathfinders public static event Action DebugRoute; #endif - private PathfindingNode _startNode; + private readonly PathfindingNode _startNode; private PathfindingNode _endNode; - private PathfindingArgs _pathfindingArgs; + private readonly PathfindingArgs _pathfindingArgs; public AStarPathfindingJob( double maxTime, diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Pathfinders/JpsPathfindingJob.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Pathfinders/JpsPathfindingJob.cs index a426caeb9a..728004a829 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Pathfinders/JpsPathfindingJob.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Pathfinders/JpsPathfindingJob.cs @@ -19,9 +19,9 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Pathfinders public static event Action DebugRoute; #endif - private PathfindingNode _startNode; + private readonly PathfindingNode _startNode; private PathfindingNode _endNode; - private PathfindingArgs _pathfindingArgs; + private readonly PathfindingArgs _pathfindingArgs; public JpsPathfindingJob(double maxTime, PathfindingNode startNode, diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingChunk.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingChunk.cs index 8bd0122010..50d16a4e79 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingChunk.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingChunk.cs @@ -32,7 +32,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding // Nodes per chunk row public static int ChunkSize => 8; public PathfindingNode[,] Nodes => _nodes; - private PathfindingNode[,] _nodes = new PathfindingNode[ChunkSize,ChunkSize]; + private readonly PathfindingNode[,] _nodes = new PathfindingNode[ChunkSize,ChunkSize]; public PathfindingChunk(GridId gridId, Vector2i indices) { diff --git a/Content.Server/GameObjects/EntitySystems/AI/Steering/EntityTargetSteeringRequest.cs b/Content.Server/GameObjects/EntitySystems/AI/Steering/EntityTargetSteeringRequest.cs index e0c8651744..ee777a175c 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Steering/EntityTargetSteeringRequest.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Steering/EntityTargetSteeringRequest.cs @@ -9,7 +9,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering public MapCoordinates TargetMap => _target.Transform.MapPosition; public EntityCoordinates TargetGrid => _target.Transform.Coordinates; public IEntity Target => _target; - private IEntity _target; + private readonly IEntity _target; /// public float ArrivalDistance { get; } diff --git a/Content.Server/GameObjects/EntitySystems/Atmos/GasTileOverlaySystem.cs b/Content.Server/GameObjects/EntitySystems/Atmos/GasTileOverlaySystem.cs index c26bbc6320..14074c22b4 100644 --- a/Content.Server/GameObjects/EntitySystems/Atmos/GasTileOverlaySystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Atmos/GasTileOverlaySystem.cs @@ -17,32 +17,35 @@ using Robust.Shared.Interfaces.Configuration; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Map; using Robust.Shared.Interfaces.Timing; +// ReSharper disable once RedundantUsingDirective +using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Timing; +using Dependency = Robust.Shared.IoC.DependencyAttribute; namespace Content.Server.GameObjects.EntitySystems.Atmos { [UsedImplicitly] internal sealed class GasTileOverlaySystem : SharedGasTileOverlaySystem, IResettingEntitySystem { - [Robust.Shared.IoC.Dependency] private readonly IGameTiming _gameTiming = default!; - [Robust.Shared.IoC.Dependency] private readonly IPlayerManager _playerManager = default!; - [Robust.Shared.IoC.Dependency] private readonly IMapManager _mapManager = default!; - [Robust.Shared.IoC.Dependency] private readonly IConfigurationManager _configManager = default!; + [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly IPlayerManager _playerManager = default!; + [Dependency] private readonly IMapManager _mapManager = default!; + [Dependency] private readonly IConfigurationManager _configManager = default!; /// /// The tiles that have had their atmos data updated since last tick /// - private Dictionary> _invalidTiles = new Dictionary>(); + private readonly Dictionary> _invalidTiles = new Dictionary>(); - private Dictionary _knownPlayerChunks = + private readonly Dictionary _knownPlayerChunks = new Dictionary(); /// /// Gas data stored in chunks to make PVS / bubbling easier. /// - private Dictionary> _overlay = + private readonly Dictionary> _overlay = new Dictionary>(); /// diff --git a/Content.Server/GameObjects/EntitySystems/DoAfter/DoAfter.cs b/Content.Server/GameObjects/EntitySystems/DoAfter/DoAfter.cs index 7a37e924ef..59b847effd 100644 --- a/Content.Server/GameObjects/EntitySystems/DoAfter/DoAfter.cs +++ b/Content.Server/GameObjects/EntitySystems/DoAfter/DoAfter.cs @@ -32,8 +32,8 @@ namespace Content.Server.GameObjects.EntitySystems.DoAfter public DoAfterStatus Status => AsTask.IsCompletedSuccessfully ? AsTask.Result : DoAfterStatus.Running; // NeedHand - private string? _activeHand; - private ItemComponent? _activeItem; + private readonly string? _activeHand; + private readonly ItemComponent? _activeItem; public DoAfter(DoAfterEventArgs eventArgs) { diff --git a/Content.Server/GameObjects/EntitySystems/DoorSystem.cs b/Content.Server/GameObjects/EntitySystems/DoorSystem.cs index f5c257826b..26e44f87e2 100644 --- a/Content.Server/GameObjects/EntitySystems/DoorSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/DoorSystem.cs @@ -34,8 +34,8 @@ namespace Content.Server.GameObjects.EntitySystems /// Allows everyone to open all doors. AllowAll } - - private List _activeDoors = new List(); + + private readonly List _activeDoors = new List(); public override void Initialize() { @@ -71,7 +71,7 @@ namespace Content.Server.GameObjects.EntitySystems var comp = _activeDoors[i]; if (comp.Deleted) _activeDoors.RemoveAt(i); - + comp.OnUpdate(frameTime); } } diff --git a/Content.Server/GameObjects/EntitySystems/EmergencyLightSystem.cs b/Content.Server/GameObjects/EntitySystems/EmergencyLightSystem.cs index 7cc406c8f8..ce0c0e0d3c 100644 --- a/Content.Server/GameObjects/EntitySystems/EmergencyLightSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/EmergencyLightSystem.cs @@ -9,7 +9,7 @@ namespace Content.Server.GameObjects.EntitySystems [UsedImplicitly] internal sealed class EmergencyLightSystem : EntitySystem { - private List _activeLights = new List(); + private readonly List _activeLights = new List(); public override void Initialize() { @@ -24,7 +24,7 @@ namespace Content.Server.GameObjects.EntitySystems case EmergencyLightComponent.EmergencyLightState.Charging: if (_activeLights.Contains(message.Component)) _activeLights.Add(message.Component); - + break; case EmergencyLightComponent.EmergencyLightState.Full: case EmergencyLightComponent.EmergencyLightState.Empty: diff --git a/Content.Server/GameObjects/EntitySystems/StationEvents/StationEventSystem.cs b/Content.Server/GameObjects/EntitySystems/StationEvents/StationEventSystem.cs index 6da998d840..3cf87305c4 100644 --- a/Content.Server/GameObjects/EntitySystems/StationEvents/StationEventSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/StationEvents/StationEventSystem.cs @@ -33,7 +33,7 @@ namespace Content.Server.GameObjects.EntitySystems.StationEvents public StationEvent CurrentEvent { get; private set; } public IReadOnlyCollection StationEvents => _stationEvents; - private List _stationEvents = new List(); + private readonly List _stationEvents = new List(); private const float MinimumTimeUntilFirstEvent = 300; diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 0efeed6880..0b04576b86 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -1025,15 +1025,15 @@ The current game mode is: [color=white]{0}[/color]. return preset; } - [Dependency] private IEntityManager _entityManager = default!; - [Dependency] private IMapManager _mapManager = default!; - [Dependency] private IMapLoader _mapLoader = default!; - [Dependency] private IGameTiming _gameTiming = default!; - [Dependency] private IConfigurationManager _configurationManager = default!; - [Dependency] private IChatManager _chatManager = default!; - [Dependency] private IServerNetManager _netManager = default!; - [Dependency] private IDynamicTypeFactory _dynamicTypeFactory = default!; - [Dependency] private IPrototypeManager _prototypeManager = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; + [Dependency] private readonly IMapManager _mapManager = default!; + [Dependency] private readonly IMapLoader _mapLoader = default!; + [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly IConfigurationManager _configurationManager = default!; + [Dependency] private readonly IChatManager _chatManager = default!; + [Dependency] private readonly IServerNetManager _netManager = default!; + [Dependency] private readonly IDynamicTypeFactory _dynamicTypeFactory = default!; + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly IServerPreferencesManager _prefsManager = default!; [Dependency] private readonly IBaseServer _baseServer = default!; diff --git a/Content.Server/StationEvents/PowerGridCheck.cs b/Content.Server/StationEvents/PowerGridCheck.cs index 8a961c2d5c..ab7e778f5c 100644 --- a/Content.Server/StationEvents/PowerGridCheck.cs +++ b/Content.Server/StationEvents/PowerGridCheck.cs @@ -29,18 +29,16 @@ namespace Content.Server.StationEvents private float _elapsedTime; private int _failDuration; - + /// /// So we don't overlap the announcement with power-down sounds we'll delay it a few seconds. /// private bool _announced; private CancellationTokenSource _announceCancelToken; - - private List _powered = new List(); - - + private readonly List _powered = new List(); + public override void Startup() { base.Startup(); @@ -49,7 +47,7 @@ namespace Content.Server.StationEvents _elapsedTime = 0.0f; _failDuration = IoCManager.Resolve().Next(60, 120); var componentManager = IoCManager.Resolve(); - + foreach (PowerReceiverComponent component in componentManager.EntityQuery()) { component.PowerDisabled = true; @@ -64,13 +62,13 @@ namespace Content.Server.StationEvents foreach (var entity in _powered) { if (entity.Deleted) continue; - + if (entity.TryGetComponent(out PowerReceiverComponent powerReceiverComponent)) { powerReceiverComponent.PowerDisabled = false; } } - + _announceCancelToken?.Cancel(); _announceCancelToken = new CancellationTokenSource(); Timer.Spawn(3000, () => @@ -92,7 +90,7 @@ namespace Content.Server.StationEvents EntitySystem.Get().PlayGlobal("/Audio/Announcements/power_off.ogg"); _announced = true; } - + _elapsedTime += frameTime; if (_elapsedTime < _failDuration) diff --git a/Content.Shared/Alert/AlertOrderPrototype.cs b/Content.Shared/Alert/AlertOrderPrototype.cs index 0fd5ee35c3..6bd84ed4ca 100644 --- a/Content.Shared/Alert/AlertOrderPrototype.cs +++ b/Content.Shared/Alert/AlertOrderPrototype.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Utility; @@ -13,8 +12,8 @@ namespace Content.Shared.Alert [Prototype("alertOrder")] public class AlertOrderPrototype : IPrototype, IComparer { - private Dictionary _typeToIdx = new Dictionary(); - private Dictionary _categoryToIdx = new Dictionary(); + private readonly Dictionary _typeToIdx = new Dictionary(); + private readonly Dictionary _categoryToIdx = new Dictionary(); public void LoadFrom(YamlMappingNode mapping) { diff --git a/Content.Shared/Construction/ConstructionConditions/TileType.cs b/Content.Shared/Construction/ConstructionConditions/TileType.cs new file mode 100644 index 0000000000..e7e16240b5 --- /dev/null +++ b/Content.Shared/Construction/ConstructionConditions/TileType.cs @@ -0,0 +1,40 @@ +using Content.Shared.Maps; +using JetBrains.Annotations; +using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Map; +using Robust.Shared.Maths; +using Robust.Shared.Serialization; +using System.Collections.Generic; + +namespace Content.Shared.Construction.ConstructionConditions +{ + [UsedImplicitly] + public class TileType : IConstructionCondition + { + + public List TargetTiles { get; private set; } + public void ExposeData(ObjectSerializer serializer) + { + serializer.DataField(this, x => x.TargetTiles, "targets", null); + } + + public bool Condition(IEntity user, EntityCoordinates location, Direction direction) + { + if (TargetTiles == null) return true; + + var tileFound = location.GetTileRef(); + + if (tileFound == null) + return false; + + var tile = TurfHelpers.GetContentTileDefinition(tileFound.Value.Tile); + foreach (var targetTile in TargetTiles) + { + if (tile.Name == targetTile) { + return true; + } + } + return false; + } + } +} diff --git a/Content.Shared/Construction/ConstructionGraphPrototype.cs b/Content.Shared/Construction/ConstructionGraphPrototype.cs index d9146745fc..5d557effd9 100644 --- a/Content.Shared/Construction/ConstructionGraphPrototype.cs +++ b/Content.Shared/Construction/ConstructionGraphPrototype.cs @@ -13,7 +13,7 @@ namespace Content.Shared.Construction public class ConstructionGraphPrototype : IPrototype, IIndexedPrototype { private readonly Dictionary _nodes = new Dictionary(); - private Dictionary, ConstructionGraphNode[]> _paths = new Dictionary, ConstructionGraphNode[]>(); + private readonly Dictionary, ConstructionGraphNode[]> _paths = new Dictionary, ConstructionGraphNode[]>(); private Dictionary _pathfinding = new Dictionary(); [ViewVariables] diff --git a/Content.Shared/GameObjects/Components/Body/Part/SharedBodyPartComponent.cs b/Content.Shared/GameObjects/Components/Body/Part/SharedBodyPartComponent.cs index a7ddb84857..148f432bb5 100644 --- a/Content.Shared/GameObjects/Components/Body/Part/SharedBodyPartComponent.cs +++ b/Content.Shared/GameObjects/Components/Body/Part/SharedBodyPartComponent.cs @@ -27,7 +27,7 @@ namespace Content.Shared.GameObjects.Components.Body.Part public IReadOnlyList MechanismIds => _mechanismIds; [ViewVariables] - private HashSet _mechanisms = new HashSet(); + private readonly HashSet _mechanisms = new HashSet(); [ViewVariables] public IBody? Body diff --git a/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs index 3044aeef52..14fd21a913 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs @@ -14,7 +14,7 @@ namespace Content.Shared.GameObjects.Components.Research public override string Name => "LatheDatabase"; public override uint? NetID => ContentNetIDs.LATHE_DATABASE; - private List _recipes = new List(); + private readonly List _recipes = new List(); /// /// Removes all recipes from the database if it's not static. diff --git a/Content.Shared/GameObjects/Components/Research/SharedProtolatheDatabaseComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedProtolatheDatabaseComponent.cs index 39d5d82051..ceffd45057 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedProtolatheDatabaseComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedProtolatheDatabaseComponent.cs @@ -15,7 +15,7 @@ namespace Content.Shared.GameObjects.Components.Research public override string Name => "ProtolatheDatabase"; public sealed override uint? NetID => ContentNetIDs.PROTOLATHE_DATABASE; - private List _protolatheRecipes = new List(); + private readonly List _protolatheRecipes = new List(); /// /// A full list of recipes this protolathe can print. diff --git a/Content.Shared/GameObjects/Components/SharedStackComponent.cs b/Content.Shared/GameObjects/Components/SharedStackComponent.cs index f1867d291e..a70af9a823 100644 --- a/Content.Shared/GameObjects/Components/SharedStackComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedStackComponent.cs @@ -125,6 +125,7 @@ namespace Content.Shared.GameObjects.Components { Metal, Glass, + ReinforcedGlass, Plasteel, Cable, Wood, @@ -139,6 +140,7 @@ namespace Content.Shared.GameObjects.Components FloorTileCarpet, FloorTileWhite, FloorTileDark, - FloorTileWood + FloorTileWood, + MetalRod } } diff --git a/Content.Shared/Maps/TurfHelpers.cs b/Content.Shared/Maps/TurfHelpers.cs index 3da39ad24a..da3f322c57 100644 --- a/Content.Shared/Maps/TurfHelpers.cs +++ b/Content.Shared/Maps/TurfHelpers.cs @@ -54,11 +54,13 @@ namespace Content.Shared.Maps if (!coordinates.IsValid(entityManager)) return null; + mapManager ??= IoCManager.Resolve(); if (!mapManager.TryGetGrid(coordinates.GetGridId(entityManager), out var grid)) return null; + if (!grid.TryGetTileRef(coordinates, out var tile)) return null; diff --git a/Content.Shared/Physics/FrictionController.cs b/Content.Shared/Physics/FrictionController.cs index 92e9e17baf..0b9eb019ce 100644 --- a/Content.Shared/Physics/FrictionController.cs +++ b/Content.Shared/Physics/FrictionController.cs @@ -7,7 +7,7 @@ namespace Content.Shared.Physics { public abstract class FrictionController : VirtualController { - [Dependency] private IPhysicsManager _physicsManager = default!; + [Dependency] private readonly IPhysicsManager _physicsManager = default!; public override void UpdateAfterProcessing() { diff --git a/Resources/Locale/nl-NL/tools.yml b/Resources/Locale/nl-NL/tools.yml index 6a9f974c3f..a0dd9a8380 100644 --- a/Resources/Locale/nl-NL/tools.yml +++ b/Resources/Locale/nl-NL/tools.yml @@ -1,19 +1,19 @@ # Example Dutch translations -- msgid: Wrench - msgstr: Moersleutel +- msgid: wrench + msgstr: moersleutel -- msgid: Welding Tool - msgstr: Lasapparaat +- msgid: welding tool + msgstr: lasapparaat -- msgid: Crowbar - msgstr: Koevoet +- msgid: crowbar + msgstr: koevoet -- msgid: Screwdriver - msgstr: Schroevendraaier +- msgid: screwdriver + msgstr: schroevendraaier -- msgid: Wirecutters - msgstr: Draadtang +- msgid: wirecutters + msgstr: draadtang -- msgid: Multitool - msgstr: Multi Tool # This is what google translate gives me idk. +- msgid: multitool + msgstr: multi tool # This is what google translate gives me idk. diff --git a/Resources/Prototypes/Entities/Constructible/Doors/firelock.yml b/Resources/Prototypes/Entities/Constructible/Doors/firelock.yml index 3da88aa3f5..a9bd8b3f3d 100644 --- a/Resources/Prototypes/Entities/Constructible/Doors/firelock.yml +++ b/Resources/Prototypes/Entities/Constructible/Doors/firelock.yml @@ -58,6 +58,10 @@ enabled: false - type: SnapGrid offset: Center + - type: Construction + graph: Firelock + node: Firelock + placement: mode: SnapgridCenter diff --git a/Resources/Prototypes/Entities/Constructible/Doors/firelock_frame.yml b/Resources/Prototypes/Entities/Constructible/Doors/firelock_frame.yml new file mode 100644 index 0000000000..e4d8931124 --- /dev/null +++ b/Resources/Prototypes/Entities/Constructible/Doors/firelock_frame.yml @@ -0,0 +1,25 @@ +- type: entity + id: FirelockFrame + name: Firelock Frame + description: That is a firelock frame. + components: + - type: Sprite + sprite: Constructible/Structures/Doors/firelock.rsi + state: frame1 + - type: Construction + graph: Firelock + node: frame1 + - type: Clickable + - type: InteractionOutline + - type: Physics + shapes: + - !type:PhysShapeAabb + bounds: "-0.49,-0.49,0.49,0.49" + mask: + - Impassable + layer: + - Opaque + - Impassable + - MobImpassable + - VaultImpassable + - SmallImpassable diff --git a/Resources/Prototypes/Entities/Constructible/Furniture/tables.yml b/Resources/Prototypes/Entities/Constructible/Furniture/tables.yml index 41e388ba4b..16651ae08a 100644 --- a/Resources/Prototypes/Entities/Constructible/Furniture/tables.yml +++ b/Resources/Prototypes/Entities/Constructible/Furniture/tables.yml @@ -1,4 +1,4 @@ -- type: entity +- type: entity id: TableBase name: "table" description: A square piece of metal standing on four metal legs. @@ -62,6 +62,9 @@ SteelSheet1: Min: 1 Max: 1 + - type: Construction + graph: Tables + node: TableFrame - type: entity id: TableBar @@ -100,6 +103,9 @@ SteelSheet1: Min: 1 Max: 1 + - type: Construction + graph: Tables + node: MetalTable - type: entity id: TableR @@ -119,6 +125,9 @@ SteelSheet1: Min: 1 Max: 1 + - type: Construction + graph: Tables + node: ReinforcedTable - type: entity id: TableGlass @@ -138,6 +147,9 @@ ShardGlass: Min: 1 Max: 1 + - type: Construction + graph: Tables + node: GlassTable - type: entity id: TableGlassR @@ -157,6 +169,9 @@ ShardGlass: Min: 1 Max: 1 + - type: Construction + graph: Tables + node: RGlassTable - type: entity id: TableWood @@ -176,6 +191,9 @@ WoodPlank: Min: 1 Max: 1 + - type: Construction + graph: Tables + node: WoodTable - type: entity id: TableCarpet @@ -195,6 +213,9 @@ WoodPlank: Min: 1 Max: 1 + - type: Construction + graph: Tables + node: PokerTable - type: entity id: TableStone diff --git a/Resources/Prototypes/Entities/Constructible/Ground/catwalk.yml b/Resources/Prototypes/Entities/Constructible/Ground/catwalk.yml index 5f7993755c..b37a374bbe 100644 --- a/Resources/Prototypes/Entities/Constructible/Ground/catwalk.yml +++ b/Resources/Prototypes/Entities/Constructible/Ground/catwalk.yml @@ -23,3 +23,6 @@ key: catwalk base: catwalk_ - type: Catwalk + - type: Construction + graph: Catwalk + node: Catwalk diff --git a/Resources/Prototypes/Entities/Constructible/Items/metal_rod.yml b/Resources/Prototypes/Entities/Constructible/Items/metal_rod.yml new file mode 100644 index 0000000000..9ed9af1a4e --- /dev/null +++ b/Resources/Prototypes/Entities/Constructible/Items/metal_rod.yml @@ -0,0 +1,35 @@ +- type: entity + name: Metal Rod + parent: BaseItem + id: MetalRod + suffix: full + components: + - type: Sprite + sprite: Objects/Materials/materials.rsi + state: rods + - type: Item + size: 24 + icon: + sprite: /Textures/Constructible/Structures/Walls/materials.rsi + state: rods + prefix: inhand + - type: Construction + graph: metalRod + node: MetalRod + - type: Stack + stacktype: enum.StackType.MetalRod + count: 50 + max: 50 + - type: FloorTile + outputs: + - lattice + - floor_reinforced + +- type: entity + parent: MetalRod + id: MetalRodStack1 + components: + - type: Stack + stacktype: enum.StackType.MetalRod + count: 1 + max: 50 diff --git a/Resources/Prototypes/Entities/Constructible/Power/power_base.yml b/Resources/Prototypes/Entities/Constructible/Power/power_base.yml index a39c8d9568..3b35c9b988 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/power_base.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/power_base.yml @@ -187,6 +187,9 @@ interfaces: - key: enum.ApcUiKey.Key type: ApcBoundUserInterface + - type: Construction + graph: apc + node: apc - type: entity id: SolarPanel diff --git a/Resources/Prototypes/Entities/Objects/Misc/apc_electronics.yml b/Resources/Prototypes/Entities/Objects/Misc/apc_electronics.yml new file mode 100644 index 0000000000..e0f70e9a87 --- /dev/null +++ b/Resources/Prototypes/Entities/Objects/Misc/apc_electronics.yml @@ -0,0 +1,9 @@ +- type: entity + id: APCElectronics + parent: BaseItem + name: APC Electronics + description: Circuit used in APC construction. + components: + - type: Sprite + sprite: Constructible/Misc/module.rsi + state: charger_APC diff --git a/Resources/Prototypes/Entities/Objects/Misc/firelock_electronics.yml b/Resources/Prototypes/Entities/Objects/Misc/firelock_electronics.yml new file mode 100644 index 0000000000..88df2eb6dd --- /dev/null +++ b/Resources/Prototypes/Entities/Objects/Misc/firelock_electronics.yml @@ -0,0 +1,10 @@ +- type: entity + id: FirelockElectronics + parent: BaseItem + name: Firelock Electronics + description: Advanced circuit board used to detect differences in pressure, temperature and gas concentrations between the two sides of the door. + components: + - type: Sprite + sprite: Constructible/Misc/module.rsi + state: mainboard + - type: FirelockElectronics diff --git a/Resources/Prototypes/Entities/Objects/materials.yml b/Resources/Prototypes/Entities/Objects/materials.yml index ce955eae16..a1d7a55269 100644 --- a/Resources/Prototypes/Entities/Objects/materials.yml +++ b/Resources/Prototypes/Entities/Objects/materials.yml @@ -26,6 +26,9 @@ - type: Item sprite: Objects/Materials/sheets.rsi HeldPrefix: metal + - type: FloorTile + outputs: + - underplating - type: entity id: SteelSheet1 @@ -66,6 +69,36 @@ stacktype: enum.StackType.Glass count: 1 +- type: entity + name: Reinforced Glass + parent: MaterialStack + id: rglass + suffix: Full + components: + - type: Material + materials: + - key: enum.MaterialKeys.Stack + mat: rglass + - type: Stack + stacktype: enum.StackType.ReinforcedGlass + - type: Sprite + sprite: Objects/Materials/sheets.rsi + state: rglass + - type: Item + sprite: Objects/Materials/sheets.rsi + HeldPrefix: rglass + +- type: entity + name: Reinforced Glass sheet + id: RGlassSheet1 + parent: rglass + suffix: 1 + components: + - type: Stack + StackType: enum.StackType.ReinforcedGlass + count: 1 + + - type: entity name: plasteel sheet id: PlasteelStack diff --git a/Resources/Prototypes/Entities/Objects/tiles.yml b/Resources/Prototypes/Entities/Objects/tiles.yml index 5c2fa2e9a5..710426f140 100644 --- a/Resources/Prototypes/Entities/Objects/tiles.yml +++ b/Resources/Prototypes/Entities/Objects/tiles.yml @@ -1,4 +1,4 @@ -- type: entity +- type: entity parent: BaseItem id: FloorTileItemBase description: These could work as a pretty decent throwing weapon. @@ -8,7 +8,9 @@ sprite: Objects/Tiles/tile.rsi state: tile_steel - type: FloorTile - output: floor_steel + outputs: + - plating + - floor_steel - type: Stack stacktype: FloorTileSteel count: 1 @@ -35,7 +37,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_wood - type: FloorTile - output: floor_wood + outputs: + - plating + - floor_wood - type: Stack stacktype: FloorTileWood count: 1 @@ -53,7 +57,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_white - type: FloorTile - output: floor_white + outputs: + - plating + - floor_white - type: Stack stacktype: FloorTileWhite count: 1 @@ -71,7 +77,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_dark - type: FloorTile - output: floor_dark + outputs: + - plating + - floor_dark - type: Stack stacktype: FloorTileDark count: 1 @@ -89,7 +97,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_dark - type: FloorTile - output: floor_techmaint + outputs: + - plating + - floor_techmaint - type: entity name: floor tile freezer @@ -103,7 +113,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_showroom - type: FloorTile - output: floor_freezer + outputs: + - plating + - floor_freezer - type: entity name: floor tile showroom @@ -117,7 +129,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_showroom - type: FloorTile - output: floor_showroom + outputs: + - plating + - floor_showroom - type: entity name: floor tile snow @@ -131,7 +145,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_silver - type: FloorTile - output: floor_snow + outputs: + - plating + - floor_snow - type: entity name: floor tile green circuit @@ -145,7 +161,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_silver - type: FloorTile - output: floor_green_circuit + outputs: + - plating + - floor_green_circuit - type: entity name: floor tile gold @@ -159,7 +177,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_gold - type: FloorTile - output: floor_gold + outputs: + - plating + - floor_gold - type: entity name: floor tile reinforced @@ -173,7 +193,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_reinforced - type: FloorTile - output: floor_reinforced + outputs: + - plating + - floor_reinforced - type: entity name: floor tile rock @@ -187,7 +209,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_steel - type: FloorTile - output: floor_rockvault + outputs: + - plating + - floor_rockvault - type: entity name: floor tile mono @@ -201,7 +225,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_steel - type: FloorTile - output: floor_mono + outputs: + - plating + - floor_mono - type: entity name: floor tile linoleum @@ -215,7 +241,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_steel - type: FloorTile - output: floor_lino + outputs: + - plating + - floor_lino - type: entity name: floor tile asteroid @@ -229,7 +257,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_brown - type: FloorTile - output: floor_asteroid_tile + outputs: + - plating + - floor_asteroid_tile - type: entity name: floor tile hydro @@ -243,7 +273,9 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_hydro - type: FloorTile - output: floor_hydro + outputs: + - plating + - floor_hydro - type: entity name: floor tile dirty @@ -257,4 +289,6 @@ sprite: Objects/Tiles/tile.rsi HeldPrefix: tile_brown - type: FloorTile - output: floor_steel_dirty + outputs: + - plating + - floor_steel_dirty diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/APC.yml b/Resources/Prototypes/Recipes/Construction/Graphs/APC.yml new file mode 100644 index 0000000000..b36718ef3c --- /dev/null +++ b/Resources/Prototypes/Recipes/Construction/Graphs/APC.yml @@ -0,0 +1,13 @@ +- type: constructionGraph + id: apc + start: start + graph: + - node: start + edges: + - to: apc + steps: + - material: Metal + amount: 3 + + - node: apc + entity: BaseAPC diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/catwalk.yml b/Resources/Prototypes/Recipes/Construction/Graphs/catwalk.yml new file mode 100644 index 0000000000..a218cf8e4c --- /dev/null +++ b/Resources/Prototypes/Recipes/Construction/Graphs/catwalk.yml @@ -0,0 +1,24 @@ +- type: constructionGraph + id: Catwalk + start: start + graph: + - node: start + edges: + - to: Catwalk + completed: + - !type:SnapToGrid { } + steps: + - material: MetalRod + amount: 2 + + - node: Catwalk + entity: Catwalk + edges: + - to: start + completed: + - !type:SpawnPrototype + prototype: MetalRodStack1 + amount: 2 + - !type:DeleteEntity {} + steps: + - tool: Cutting diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/firelock.yml b/Resources/Prototypes/Recipes/Construction/Graphs/firelock.yml new file mode 100644 index 0000000000..017f099970 --- /dev/null +++ b/Resources/Prototypes/Recipes/Construction/Graphs/firelock.yml @@ -0,0 +1,166 @@ +- type: constructionGraph + id: Firelock + start: start + graph: + - node: start + edges: + - to: frame1 + completed: + - !type:SnapToGrid { } + steps: + - material: Metal + amount: 3 + doAfter: 1 + + + - node: frame1 + entity: FirelockFrame + actions: + - !type:SpriteStateChange + state: frame1 + edges: + - to: frame2 + conditions: + - !type:EntityAnchored + anchored: true + steps: + - material: Cable + amount: 2 + doAfter: 1 + - to: start + completed: + - !type:SpawnPrototype + prototype: SteelSheet1 + amount: 3 + - !type:DeleteEntity {} + conditions: + - !type:EntityAnchored + anchored: true + steps: + - tool: Welding + doAfter: 1 + + - node: frame2 + actions: + - !type:SpriteStateChange + state: frame2 + edges: + - to: frame3 + conditions: + - !type:EntityAnchored + anchored: true + steps: + - component: FirelockElectronics + store: Firelock Electornics + name: Firelock Electornics + icon: + sprite: "Constructible/Misc/module.rsi" + state: "mainboard" + + - to: frame1 + completed: + - !type:SpawnPrototype + prototype: ApcExtensionCableStack1 + amount: 2 + conditions: + - !type:EntityAnchored + anchored: true + steps: + - tool: Cutting + doAfter: 1.5 + + - node: frame3 + actions: + - !type:SpriteStateChange + state: frame3 + edges: + - to: frame4 + conditions: + - !type:EntityAnchored + anchored: true + steps: + - tool: Screwing + doAfter: 0.25 + - to: frame2 + completed: + - !type:SpawnPrototype + prototype: FirelockElectronics + amount: 1 + conditions: + - !type:EntityAnchored + anchored: true + steps: + - tool: Prying + doAfter: 0.25 + + - node: frame4 + entity: FirelockFrame + actions: + - !type:SpriteStateChange + state: frame4 + edges: + - to: Firelock + conditions: + - !type:EntityAnchored + anchored: true + steps: + - tool: Anchoring + doAfter: 1 + + - to: FirelockGlassFrame + conditions: + - !type:EntityAnchored + anchored: true + steps: + - material: Glass + amount: 2 + doAfter: 2 + + - to: frame3 + conditions: + - !type:EntityAnchored + anchored: true + steps: + - tool: Screwing + doAfter: 0.75 + + - node: Firelock + entity: Firelock + edges: + - to: frame4 + conditions: + - !type:DoorWelded + welded: true + steps: + - tool: Anchoring + doAfter: 0.25 + + - node: FirelockGlassFrame + edges: + - to: FirelockGlass + conditions: + - !type:EntityAnchored + anchored: true + steps: + - tool: Anchoring + doAfter: 1 + - to: frame4 + completed: + - !type:SpawnPrototype + prototype: GlassSheet1 + amount: 2 + steps: + - tool: Screwing + doAfter: 1 + + + - node: FirelockGlass + entity: FirelockGlass + edges: + - to: FirelockGlassFrame + conditions: + - !type:EntityAnchored + anchored: true + steps: + - tool: Anchoring + doAfter: 1 diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/metal_rod.yml b/Resources/Prototypes/Recipes/Construction/Graphs/metal_rod.yml new file mode 100644 index 0000000000..955fb37b43 --- /dev/null +++ b/Resources/Prototypes/Recipes/Construction/Graphs/metal_rod.yml @@ -0,0 +1,16 @@ +- type: constructionGraph + id: metalRod + start: start + graph: + - node: start + edges: + - to: MetalRod + completed: + - !type:SetStackCount + amount: 2 + steps: + - material: Metal + amount: 1 + + - node: MetalRod + entity: MetalRod diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/plating.yml b/Resources/Prototypes/Recipes/Construction/Graphs/plating.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/tables.yml b/Resources/Prototypes/Recipes/Construction/Graphs/tables.yml new file mode 100644 index 0000000000..afe3f1753c --- /dev/null +++ b/Resources/Prototypes/Recipes/Construction/Graphs/tables.yml @@ -0,0 +1,82 @@ +- type: constructionGraph + id: Tables + start: start + graph: + - node: start + edges: + - to: TableFrame + completed: + - !type:SnapToGrid { } + steps: + - material: MetalRod + amount: 2 + doAfter: 1 + + - node: PokerTable + entity: TableCarpet + + - node: TableFrame + entity: TableFrame + edges: + - to: start + completed: + - !type:SpawnPrototype + prototype: MetalRod + amount: 2 + - !type:DeleteEntity {} + steps: + - tool: Anchoring + doAfter: 1 + + - to: MetalTable + steps: + - material: Metal + amount: 1 + doAfter: 1 + + - to: ReinforcedTable + steps: + - material: Plasteel + amount: 1 + doAfter: 1 + + - to: GlassTable + steps: + - material: Glass + amount: 1 + doAfter: 1 + + - to: WoodTable + steps: + - material: Wood + amount: 1 + doAfter: 1 + + - to: RGlassTable + steps: + - material: ReinforcedGlass + amount: 1 + doAfter: 1 + + + + - node: MetalTable + entity: TableMetal + + - node: ReinforcedTable + entity: TableR + + - node: GlassTable + entity: TableGlass + + - node: WoodTable + entity: TableWood + edges: + - to: PokerTable + steps: + - material: Wood + amount: 1 + doAfter: 1 + + - node: RGlassTable + entity: TableGlassR diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/window.yml b/Resources/Prototypes/Recipes/Construction/Graphs/window.yml index 12c4d9a11a..069646137a 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/window.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/window.yml @@ -1,4 +1,4 @@ -- type: constructionGraph +- type: constructionGraph id: window start: start graph: @@ -17,10 +17,7 @@ - to: reinforcedWindow steps: - - material: Metal - amount: 2 - doAfter: 2 - - material: Glass + - material: ReinforcedGlass amount: 2 doAfter: 2 @@ -51,10 +48,7 @@ - to: start completed: - !type:SpawnPrototype - prototype: GlassSheet1 - amount: 2 - - !type:SpawnPrototype - prototype: MetalSheet1 + prototype: RGlassSheet1 amount: 2 - !type:DeleteEntity {} steps: diff --git a/Resources/Prototypes/Recipes/Construction/materials.yml b/Resources/Prototypes/Recipes/Construction/materials.yml new file mode 100644 index 0000000000..408466aadf --- /dev/null +++ b/Resources/Prototypes/Recipes/Construction/materials.yml @@ -0,0 +1,10 @@ +- type: construction + name: Metal Rod + id: metalRod + graph: metalRod + startNode: start + targetNode: MetalRod + category: Materials + description: A sturdy metal rod that can be used for various purposes. + icon: Objects/Materials/materials.rsi/rods.png + objectType: Item diff --git a/Resources/Prototypes/Recipes/Construction/structures.yml b/Resources/Prototypes/Recipes/Construction/structures.yml index 5cb4f76115..c79a587150 100644 --- a/Resources/Prototypes/Recipes/Construction/structures.yml +++ b/Resources/Prototypes/Recipes/Construction/structures.yml @@ -110,3 +110,79 @@ objectType: Structure placementMode: SnapgridCenter canRotate: false + +- type: construction + name: Firelock + id: Firelock + graph: Firelock + startNode: start + targetNode: Firelock + category: Structures + description: This is a firelock - it locks an area when a fire alarm in the area is triggered. Don't get squished! + icon: + sprite: Constructible/Structures/Doors/firelock.rsi + state: closed + objectType: Structure + placementMode: SnapgridCenter + +- type: construction + name: Table Frame + id: TableFrame + graph: Tables + startNode: start + targetNode: TableFrame + category: Structures + description: A sturdy frame used in the construction of tables + icon: + sprite: Constructible/Structures/Tables/frame.rsi + state: full + objectType: Structure + placementMode: SnapgridCenter + +- type: construction + name: Poker Table + id: PokerTable + graph: Tables + startNode: start + targetNode: PokerTable + category: Structures + description: A square piece of wood standing on four legs. (What did you expect?) + icon: + sprite: Constructible/Structures/Tables/carpet.rsi + state: full + objectType: Structure + placementMode: SnapgridCenter + +- type: construction + name: Catwalk + id: Catwalk + graph: Catwalk + startNode: start + targetNode: Catwalk + category: Structures + description: Just like a lattice. Except it looks better. + conditions: + - !type:TileType + targets: + - lattice + - plating + - underplating + icon: + sprite: Constructible/Tiles/catwalk.rsi + state: catwalk_preview + objectType: Structure + placementMode: SnapgridCenter + +- type: construction + name: APC + id: apc + graph: apc + startNode: start + targetNode: apc + category: Structures + description: Area Power Controller (APC). Controls power. In an area. + icon: + sprite: Constructible/Power/apc.rsi + state: apc0 + objectType: Structure + placementMode: AlignWallProper diff --git a/Resources/Prototypes/Recipes/Construction/weapons.yml b/Resources/Prototypes/Recipes/Construction/weapons.yml index 4ccda3b552..35a701155e 100644 --- a/Resources/Prototypes/Recipes/Construction/weapons.yml +++ b/Resources/Prototypes/Recipes/Construction/weapons.yml @@ -4,7 +4,7 @@ graph: spear startNode: start targetNode: spear - category: Items/Weapons + category: Weapons description: A crude spear for when you need to put holes in somebody. icon: Objects/Weapons/Melee/spear.rsi/spear.png objectType: Item diff --git a/Resources/Prototypes/Tiles/floors.yml b/Resources/Prototypes/Tiles/floors.yml index 368e32b604..2678975766 100644 --- a/Resources/Prototypes/Tiles/floors.yml +++ b/Resources/Prototypes/Tiles/floors.yml @@ -1,9 +1,8 @@ -- type: tile +- type: tile name: floor_dark display_name: Dark floor texture: "dark" base_turfs: - - space - plating is_subfloor: false can_crowbar: true @@ -16,7 +15,6 @@ display_name: Elevator shaft texture: "elevator_shaft" base_turfs: - - space - plating is_subfloor: false can_crowbar: true @@ -28,7 +26,6 @@ display_name: Freezer texture: "freezer" base_turfs: - - space - plating is_subfloor: false can_crowbar: true @@ -41,7 +38,6 @@ display_name: Hydro floor texture: "hydro" base_turfs: - - space - plating is_subfloor: false can_crowbar: true @@ -53,7 +49,6 @@ display_name: Green circuit floor texture: "green_circuit" base_turfs: - - space - plating is_subfloor: false can_crowbar: true @@ -66,7 +61,6 @@ display_name: Linoleum floor texture: "lino" base_turfs: - - space - plating is_subfloor: false can_crowbar: true @@ -79,7 +73,6 @@ display_name: Mono floor texture: "mono" base_turfs: - - space - plating is_subfloor: false can_crowbar: true @@ -92,7 +85,6 @@ display_name: Reinforced floor texture: "reinforced" base_turfs: - - space - plating is_subfloor: false can_crowbar: true @@ -105,7 +97,6 @@ display_name: rock floor texture: "rock_vault" base_turfs: - - space - plating is_subfloor: false can_crowbar: true @@ -118,7 +109,6 @@ display_name: Showroom floor texture: "showroom" base_turfs: - - space - plating is_subfloor: false can_crowbar: true @@ -131,7 +121,6 @@ display_name: Steel floor texture: "steel" base_turfs: - - space - plating is_subfloor: false can_crowbar: true @@ -144,7 +133,6 @@ display_name: Dirty steel floor texture: "steel_dirty" base_turfs: - - space - plating is_subfloor: false can_crowbar: true @@ -157,8 +145,7 @@ display_name: Techmaint Floor texture: "tech_maint" base_turfs: - - space - - underplating + - plating is_subfloor: false can_crowbar: true footstep_sounds: footstep_floor @@ -170,8 +157,7 @@ display_name: White Floor texture: "white" base_turfs: - - space - - underplating + - plating is_subfloor: false can_crowbar: true footstep_sounds: footstep_floor @@ -194,8 +180,7 @@ display_name: Asteroid Tile texture: Asteroid/asteroid_tile base_turfs: - - space - - underplating + - plating is_subfloor: false can_crowbar: true footstep_sounds: footstep_asteroid @@ -262,8 +247,7 @@ display_name: Gold Tile texture: gold base_turfs: - - space - - underplating + - plating is_subfloor: false can_crowbar: true footstep_sounds: footstep_floor diff --git a/Resources/Prototypes/Tiles/plating.yml b/Resources/Prototypes/Tiles/plating.yml index 63a8ec4dc2..653b604980 100644 --- a/Resources/Prototypes/Tiles/plating.yml +++ b/Resources/Prototypes/Tiles/plating.yml @@ -3,6 +3,16 @@ display_name: Plating texture: plating base_turfs: + - underplating + is_subfloor: true + footstep_sounds: footstep_plating + friction: 0.5 + +- type: tile + name: lattice + display_name: lattice + texture: lattice + base_turfs: - space is_subfloor: true footstep_sounds: footstep_plating @@ -13,7 +23,7 @@ display_name: Underplating texture: underplating base_turfs: - - space + - lattice is_subfloor: true footstep_sounds: footstep_plating friction: 0.5 diff --git a/Resources/Prototypes/materials.yml b/Resources/Prototypes/materials.yml index 0cd57bf107..b39ba30366 100644 --- a/Resources/Prototypes/materials.yml +++ b/Resources/Prototypes/materials.yml @@ -1,4 +1,4 @@ -- type: material +- type: material id: steel name: steel color: gray @@ -18,6 +18,16 @@ thermalConductivity: 0.9 specificHeat: 840 +- type: material + id: rglass + name: Reinforced glass + color: '#49c9a7' + icon: Objects/Materials/sheets.rsi/rglass.png + density: 5000 + electricResistivity: 1.0e+13 + thermalConductivity: 0.9 + specificHeat: 5000 + - type: material id: gold name: gold diff --git a/Resources/Textures/Constructible/Tiles/lattice.png b/Resources/Textures/Constructible/Tiles/lattice.png new file mode 100644 index 0000000000..9a33ae0f9a Binary files /dev/null and b/Resources/Textures/Constructible/Tiles/lattice.png differ diff --git a/Resources/Textures/Objects/Materials/sheets.rsi/meta.json b/Resources/Textures/Objects/Materials/sheets.rsi/meta.json index 23a0a0978e..3f5c791c9c 100644 --- a/Resources/Textures/Objects/Materials/sheets.rsi/meta.json +++ b/Resources/Textures/Objects/Materials/sheets.rsi/meta.json @@ -165,6 +165,18 @@ "name": "plasteel", "directions": 1 }, + { + "name": "rglass", + "directions": 1 + }, + { + "name": "rglass-inhand-left", + "directions": 4 + }, + { + "name": "rglass-inhand-right", + "directions": 4 + }, { "name": "researchicon", "directions": 1 diff --git a/Resources/Textures/Objects/Materials/sheets.rsi/rglass-inhand-left.png b/Resources/Textures/Objects/Materials/sheets.rsi/rglass-inhand-left.png new file mode 100644 index 0000000000..4c4c76a770 Binary files /dev/null and b/Resources/Textures/Objects/Materials/sheets.rsi/rglass-inhand-left.png differ diff --git a/Resources/Textures/Objects/Materials/sheets.rsi/rglass-inhand-right.png b/Resources/Textures/Objects/Materials/sheets.rsi/rglass-inhand-right.png new file mode 100644 index 0000000000..ea661a816a Binary files /dev/null and b/Resources/Textures/Objects/Materials/sheets.rsi/rglass-inhand-right.png differ diff --git a/Resources/Textures/Objects/Materials/sheets.rsi/rglass.png b/Resources/Textures/Objects/Materials/sheets.rsi/rglass.png new file mode 100644 index 0000000000..6f81392e50 Binary files /dev/null and b/Resources/Textures/Objects/Materials/sheets.rsi/rglass.png differ diff --git a/SpaceStation14.sln.DotSettings b/SpaceStation14.sln.DotSettings index 5a253ba69d..712b9fce50 100644 --- a/SpaceStation14.sln.DotSettings +++ b/SpaceStation14.sln.DotSettings @@ -27,7 +27,7 @@ Required Required Required - RequiredForMultilineStatement + RequiredForMultiline Required Required Required