From 952a8e709a05c4891d298ebdad270b618db8bdd3 Mon Sep 17 00:00:00 2001 From: WlarusFromDaSpace <44726328+WlarusFromDaSpace@users.noreply.github.com> Date: Thu, 4 Mar 2021 10:38:43 +0200 Subject: [PATCH] Fixes a fatal error when opening the PA control computer interface. (#3478) * Fixes a fatal crash when opening the PA control computer interface. * Fix to make PA emitters work. * Turned _pos and _afterUnderscore into local variables. * Explicit states Co-authored-by: Metal Gear Sloth --- .../ParticleAcceleratorControlMenu.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Content.Client/UserInterface/ParticleAccelerator/ParticleAcceleratorControlMenu.cs b/Content.Client/UserInterface/ParticleAccelerator/ParticleAcceleratorControlMenu.cs index ca5b06fa9e..119a6ab4dd 100644 --- a/Content.Client/UserInterface/ParticleAccelerator/ParticleAcceleratorControlMenu.cs +++ b/Content.Client/UserInterface/ParticleAccelerator/ParticleAcceleratorControlMenu.cs @@ -259,17 +259,17 @@ namespace Content.Client.ParticleAccelerator Children = { new Control {MinSize = imgSize}, - (_endCapTexture = Segment("end_cap")), + (_endCapTexture = Segment("end_cap", "capc")), new Control {MinSize = imgSize}, - (_controlBoxTexture = Segment("control_box")), - (_fuelChamberTexture = Segment("fuel_chamber")), + (_controlBoxTexture = Segment("control_box", "boxc")), + (_fuelChamberTexture = Segment("fuel_chamber", "chamberc")), new Control {MinSize = imgSize}, new Control {MinSize = imgSize}, - (_powerBoxTexture = Segment("power_box")), + (_powerBoxTexture = Segment("power_box", "boxc")), new Control {MinSize = imgSize}, - (_emitterLeftTexture = Segment("emitter_left")), - (_emitterCenterTexture = Segment("emitter_center")), - (_emitterRightTexture = Segment("emitter_right")), + (_emitterLeftTexture = Segment("emitter_left", "leftc")), + (_emitterCenterTexture = Segment("emitter_center", "centerc")), + (_emitterRightTexture = Segment("emitter_right", "rightc")), } } } @@ -325,9 +325,9 @@ namespace Content.Client.ParticleAccelerator } }; - PASegmentControl Segment(string name) + PASegmentControl Segment(string name, string state) { - return new(this, resourceCache, name); + return new(this, resourceCache, name, state); } } @@ -461,13 +461,13 @@ namespace Content.Client.ParticleAccelerator private readonly TextureRect _unlit; private readonly RSI _rsi; - public PASegmentControl(ParticleAcceleratorControlMenu menu, IResourceCache cache, string name) + public PASegmentControl(ParticleAcceleratorControlMenu menu, IResourceCache cache, string name, string state) { _menu = menu; _baseState = name; - _rsi = cache.GetResource($"/Textures/Constructible/Power/PA/{name}.rsi").RSI; + _rsi = cache.GetResource($"/Textures/Constructible/Specific/Engines/PA/{name}.rsi").RSI; - AddChild(_base = new TextureRect {Texture = _rsi[$"{name}c"].Frame0}); + AddChild(_base = new TextureRect {Texture = _rsi[$"{state}"].Frame0}); AddChild(_unlit = new TextureRect()); MinSize = _rsi.Size; }