From 178931e54b7ec24a2dfc4432d9b03c264947e2e9 Mon Sep 17 00:00:00 2001 From: py01 <60152240+collinlunn@users.noreply.github.com> Date: Mon, 31 Aug 2020 04:33:05 -0600 Subject: [PATCH 1/7] Pump visuals (#1960) * Pipe sprites * pipe copyright * SharedPipeComponent * Pipe Visualizer draft * missing longitudinal pipe sprites * expanded rsi states * pipe prototype fixes * Fixed pipe visualizer * PressurePump and VolumePump * VolumePump fix * PressurePump fix * Shared pump # Conflicts: # Content.Server/GameObjects/Components/Atmos/Piping/Pumps/BasePumpComponent.cs # Content.Server/GameObjects/Components/NodeContainer/Nodes/PipeNode.cs * PumpVisualizer Draft * ConduitLayer enum * PipeVisualizer update * halfpipe sprites * pumpvisualizer simplification * yaml unneeded proto removal * pump visualizer draft 2 * Pump overlays * pump rsi name * merge fix * PumpVisuals ConduitLayer * merge fix Co-authored-by: py01 --- .../Components/Atmos/PipeVisualizer.cs | 3 +- .../Components/Atmos/PumpVisualizer.cs | 70 ++++++++++++++++++ .../Atmos/Piping/Pumps/BasePumpComponent.cs | 11 +++ .../GameObjects/Atmos/SharedPumpComponent.cs | 29 ++++++++ .../Entities/Constructible/Ground/pumps.yml | 9 ++- .../Atmos/pressurepump.rsi/meta.json | 31 ++++++++ .../Atmos/pressurepump.rsi/pumpEast2West2.png | Bin 0 -> 281 bytes .../pressurepump.rsi/pumpNorth2South2.png | Bin 0 -> 332 bytes .../pressurepump.rsi/pumpSouth2North2.png | Bin 0 -> 320 bytes .../Atmos/pressurepump.rsi/pumpWest2East2.png | Bin 0 -> 272 bytes 10 files changed, 148 insertions(+), 5 deletions(-) create mode 100644 Content.Client/GameObjects/Components/Atmos/PumpVisualizer.cs create mode 100644 Content.Shared/GameObjects/Atmos/SharedPumpComponent.cs create mode 100644 Resources/Textures/Constructible/Atmos/pressurepump.rsi/meta.json create mode 100644 Resources/Textures/Constructible/Atmos/pressurepump.rsi/pumpEast2West2.png create mode 100644 Resources/Textures/Constructible/Atmos/pressurepump.rsi/pumpNorth2South2.png create mode 100644 Resources/Textures/Constructible/Atmos/pressurepump.rsi/pumpSouth2North2.png create mode 100644 Resources/Textures/Constructible/Atmos/pressurepump.rsi/pumpWest2East2.png diff --git a/Content.Client/GameObjects/Components/Atmos/PipeVisualizer.cs b/Content.Client/GameObjects/Components/Atmos/PipeVisualizer.cs index 7d057e0766..add360dcce 100644 --- a/Content.Client/GameObjects/Components/Atmos/PipeVisualizer.cs +++ b/Content.Client/GameObjects/Components/Atmos/PipeVisualizer.cs @@ -1,8 +1,8 @@ using Content.Shared.GameObjects.Components.Atmos; using JetBrains.Annotations; using Robust.Client.GameObjects; -using Robust.Client.Graphics; using Robust.Client.Interfaces.GameObjects.Components; +using Robust.Client.Graphics; using Robust.Client.Interfaces.ResourceManagement; using Robust.Client.ResourceManagement; using Robust.Shared.GameObjects.Components.Renderable; @@ -10,7 +10,6 @@ using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Utility; using System; -using System.Collections.Generic; using YamlDotNet.RepresentationModel; namespace Content.Client.GameObjects.Components.Atmos diff --git a/Content.Client/GameObjects/Components/Atmos/PumpVisualizer.cs b/Content.Client/GameObjects/Components/Atmos/PumpVisualizer.cs new file mode 100644 index 0000000000..42ea6bf6ea --- /dev/null +++ b/Content.Client/GameObjects/Components/Atmos/PumpVisualizer.cs @@ -0,0 +1,70 @@ +using Content.Shared.GameObjects.Atmos; +using JetBrains.Annotations; +using Robust.Client.GameObjects; +using Robust.Client.Graphics; +using Robust.Client.Interfaces.GameObjects.Components; +using Robust.Client.Interfaces.ResourceManagement; +using Robust.Client.ResourceManagement; +using Robust.Shared.GameObjects.Components.Renderable; +using Robust.Shared.IoC; +using Robust.Shared.Log; +using Robust.Shared.Utility; +using System; +using YamlDotNet.RepresentationModel; + +namespace Content.Client.GameObjects.Components.Disposal +{ + [UsedImplicitly] + public class PumpVisualizer : AppearanceVisualizer + { + private RSI _pumpRSI; + + public override void LoadData(YamlMappingNode node) + { + base.LoadData(node); + + var rsiString = node.GetNode("pumpRSI").ToString(); + var rsiPath = SharedSpriteComponent.TextureRoot / rsiString; + try + { + var resourceCache = IoCManager.Resolve(); + var resource = resourceCache.GetResource(rsiPath); + _pumpRSI = resource.RSI; + } + catch (Exception e) + { + Logger.ErrorS("go.pumpvisualizer", "Unable to load RSI '{0}'. Trace:\n{1}", rsiPath, e); + } + } + + public override void OnChangeData(AppearanceComponent component) + { + base.OnChangeData(component); + + if (!component.Owner.TryGetComponent(out ISpriteComponent sprite)) + { + return; + } + if (!component.TryGetData(PumpVisuals.VisualState, out PumpVisualState pumpVisualState)) + { + return; + } + var pumpBaseState = "pump"; + pumpBaseState += pumpVisualState.InletDirection.ToString(); + pumpBaseState += ((int) pumpVisualState.InletConduitLayer).ToString(); + pumpBaseState += pumpVisualState.OutletDirection.ToString(); + pumpBaseState += ((int) pumpVisualState.OutletConduitLayer).ToString(); + + sprite.LayerMapReserveBlank(Layer.PumpBase); + var basePumpLayer = sprite.LayerMapGet(Layer.PumpBase); + sprite.LayerSetRSI(basePumpLayer, _pumpRSI); + sprite.LayerSetState(basePumpLayer, pumpBaseState); + sprite.LayerSetVisible(basePumpLayer, true); + } + + private enum Layer + { + PumpBase + } + } +} diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/Pumps/BasePumpComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/Pumps/BasePumpComponent.cs index 23e9f63c33..1556c9a62c 100644 --- a/Content.Server/GameObjects/Components/Atmos/Piping/Pumps/BasePumpComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/Piping/Pumps/BasePumpComponent.cs @@ -2,6 +2,8 @@ using Content.Server.GameObjects.Components.NodeContainer; using Content.Server.GameObjects.Components.NodeContainer.Nodes; using Content.Shared.GameObjects.Components.Atmos; +using Content.Shared.GameObjects.Atmos; +using Robust.Server.GameObjects; using Robust.Shared.Log; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; @@ -32,6 +34,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping [ViewVariables] private PipeNode _outletPipe; + private AppearanceComponent _appearance; + public override void ExposeData(ObjectSerializer serializer) { base.ExposeData(serializer); @@ -57,6 +61,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping Logger.Error($"{typeof(BasePumpComponent)} on entity {Owner.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); return; } + Owner.TryGetComponent(out _appearance); + UpdateAppearance(); } public override void Update() @@ -65,5 +71,10 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping } protected abstract void PumpGas(GasMixture inletGas, GasMixture outletGas); + + private void UpdateAppearance() + { + _appearance?.SetData(PumpVisuals.VisualState, new PumpVisualState(_inletDirection, _outletDirection, _inletPipe.ConduitLayer, _outletPipe.ConduitLayer)); + } } } diff --git a/Content.Shared/GameObjects/Atmos/SharedPumpComponent.cs b/Content.Shared/GameObjects/Atmos/SharedPumpComponent.cs new file mode 100644 index 0000000000..d4f304e53e --- /dev/null +++ b/Content.Shared/GameObjects/Atmos/SharedPumpComponent.cs @@ -0,0 +1,29 @@ +using Content.Shared.GameObjects.Components.Atmos; +using Robust.Shared.Serialization; +using System; + +namespace Content.Shared.GameObjects.Atmos +{ + [Serializable, NetSerializable] + public enum PumpVisuals + { + VisualState + } + + [Serializable, NetSerializable] + public class PumpVisualState + { + public readonly PipeDirection InletDirection; + public readonly PipeDirection OutletDirection; + public readonly ConduitLayer InletConduitLayer; + public readonly ConduitLayer OutletConduitLayer; + + public PumpVisualState(PipeDirection inletDirection, PipeDirection outletDirection, ConduitLayer inletConduitLayer, ConduitLayer outletConduitLayer) + { + InletDirection = inletDirection; + OutletDirection = outletDirection; + InletConduitLayer = inletConduitLayer; + OutletConduitLayer = outletConduitLayer; + } + } +} diff --git a/Resources/Prototypes/Entities/Constructible/Ground/pumps.yml b/Resources/Prototypes/Entities/Constructible/Ground/pumps.yml index d1f2ac0b5c..ff727b63f6 100644 --- a/Resources/Prototypes/Entities/Constructible/Ground/pumps.yml +++ b/Resources/Prototypes/Entities/Constructible/Ground/pumps.yml @@ -12,7 +12,12 @@ - type: Icon texture: Constructible/Power/eightdirwire.png - type: Sprite - sprite: Constructible/Power/mv_cable.rsi + - type: Appearance + visuals: + - type: PipeVisualizer + pipeRSI: Constructible/Atmos/pipe.rsi + - type: PumpVisualizer + pumpRSI: Constructible/Atmos/pressurepump.rsi - type: Destructible thresholdvalue: 100 @@ -21,8 +26,6 @@ parent: PumpBase id: NorthwardLongitudinalPump components: - - type: Sprite - state: mvcable_3 - type: NodeContainer nodes: - !type:PipeNode diff --git a/Resources/Textures/Constructible/Atmos/pressurepump.rsi/meta.json b/Resources/Textures/Constructible/Atmos/pressurepump.rsi/meta.json new file mode 100644 index 0000000000..f950406db6 --- /dev/null +++ b/Resources/Textures/Constructible/Atmos/pressurepump.rsi/meta.json @@ -0,0 +1,31 @@ +{ + "version":1, + "size":{ + "x":32, + "y":32 + }, + "license":"CC-BY-SA-3.0", + "copyright":"Taken from https://github.com/tgstation/tgstation at commit 57cd1d59ca019dd0e7811ac451f295f818e573da", + "states":[ + { + "name":"pumpEast2West2", + "directions":1, + "delays":[ [ 1.0 ] ] + }, + { + "name":"pumpNorth2South2", + "directions":1, + "delays":[ [ 1.0 ] ] + }, + { + "name":"pumpSouth2North2", + "directions":1, + "delays":[ [ 1.0 ] ] + }, + { + "name":"pumpWest2East2", + "directions":1, + "delays":[ [ 1.0 ] ] + } + ] +} \ No newline at end of file diff --git a/Resources/Textures/Constructible/Atmos/pressurepump.rsi/pumpEast2West2.png b/Resources/Textures/Constructible/Atmos/pressurepump.rsi/pumpEast2West2.png new file mode 100644 index 0000000000000000000000000000000000000000..dc07973864d14a63d8a72dec3ff506bad1385d12 GIT binary patch literal 281 zcmV+!0p|XRP)FX16ey7>XLrl4*uP8W6Z z(EBY1$A@$h5-6pV`tNps35!UG&3f;n){Y)PM8e_l%zl3tm7k_5YKWWb#>v`nvUYV+ z5ediR3wfS1JBPKF**S`$V0I2;46}1oRrOtC{Td)mQ<5ZEZT|H5K$d0P8v{UH*8nt4 z13=rh0F-69sxfY_8_Ti~!p{YG?{}|n@8NR!F7f#&HCo>pB4XzF*ZCo41pw6o!A5&N_f0OP3BAdWG}?#VxH3Hh9P}TIf+c=mcJ!3wSUTWNZ+a8sfPbtRe2E zP8nLd_zhAB`bNS3^zrzG0FTGxaSWq`IOpc?nbw*#YjKEkZo)7G03=C*wr$Zg4T_>5 zNn9@toaltWn-Bnib(T@b&;{06_G<&y1b&^AR^M&$!=g@Hq?^$B`^>wKSl$W@Wj< z_k6^D+~aWgLRs#}e*qcJxp{hgF#ml_RwbNWeld`X^RZf)AP6u`6K<6v&sqEmPB6y6 enBC%gE|VX-$8A7IW5JyO0000MhJufhVp@HV6e(mw0t2B(Y?I` z05(~s8KW2YIy8=B7-L|qonD|}#w+u;%;W;w;}KC5p)5`yFm5;k|RD)&>Li%O_sfaMK0h0EMhvh3y95h7CXOY zn&D%Zc@LCQO8s|%w9y!|NPDMg66cB;Pd zNz;_Udz^C&-jgH=mrK3b*u%Ny;oN46;sLTOTh*$n04U26fTAb>I9f{_$9$eot0BTL zB#NR W>r71yHG6^p0000 Date: Mon, 31 Aug 2020 12:11:22 -0500 Subject: [PATCH 2/7] Tweaks damage types and classes (#1969) Co-authored-by: ancientpower --- Content.Server/Chat/ChatCommands.cs | 9 ++- .../Interfaces/GameObjects/ISuicideAct.cs | 11 ++-- Content.Shared/Damage/DamageClass.cs | 12 ++-- Content.Shared/Damage/DamageType.cs | 25 +++++--- .../Prototypes/Damage/damage_containers.yml | 1 + .../Prototypes/Damage/resistance_sets.yml | 64 +++++++++++++------ 6 files changed, 82 insertions(+), 40 deletions(-) diff --git a/Content.Server/Chat/ChatCommands.cs b/Content.Server/Chat/ChatCommands.cs index a309a344f0..302d0add91 100644 --- a/Content.Server/Chat/ChatCommands.cs +++ b/Content.Server/Chat/ChatCommands.cs @@ -139,12 +139,15 @@ namespace Content.Server.Chat damageableComponent.ChangeDamage(kind switch { SuicideKind.Blunt => DamageType.Blunt, + SuicideKind.Slash => DamageType.Slash, SuicideKind.Piercing => DamageType.Piercing, SuicideKind.Heat => DamageType.Heat, - SuicideKind.Disintegration => DamageType.Disintegration, - SuicideKind.Cellular => DamageType.Cellular, - SuicideKind.DNA => DamageType.DNA, + SuicideKind.Shock => DamageType.Shock, + SuicideKind.Cold => DamageType.Cold, + SuicideKind.Poison => DamageType.Poison, + SuicideKind.Radiation => DamageType.Radiation, SuicideKind.Asphyxiation => DamageType.Asphyxiation, + SuicideKind.Bloodloss => DamageType.Bloodloss, _ => DamageType.Blunt }, 500, diff --git a/Content.Server/Interfaces/GameObjects/ISuicideAct.cs b/Content.Server/Interfaces/GameObjects/ISuicideAct.cs index 78d0d9974f..a23353adac 100644 --- a/Content.Server/Interfaces/GameObjects/ISuicideAct.cs +++ b/Content.Server/Interfaces/GameObjects/ISuicideAct.cs @@ -14,12 +14,15 @@ namespace Content.Server.Interfaces.GameObjects //Damage type suicides Blunt, + Slash, Piercing, Heat, - Disintegration, - Cellular, - DNA, - Asphyxiation + Shock, + Cold, + Poison, + Radiation, + Asphyxiation, + Bloodloss } } diff --git a/Content.Shared/Damage/DamageClass.cs b/Content.Shared/Damage/DamageClass.cs index 393b999486..406dc8bb73 100644 --- a/Content.Shared/Damage/DamageClass.cs +++ b/Content.Shared/Damage/DamageClass.cs @@ -12,7 +12,8 @@ namespace Content.Shared.Damage Brute, Burn, Toxin, - Airloss + Airloss, + Genetic } public static class DamageClassExtensions @@ -20,10 +21,11 @@ namespace Content.Shared.Damage private static readonly ImmutableDictionary> ClassToType = new Dictionary> { - {DamageClass.Brute, new List {DamageType.Blunt, DamageType.Piercing}}, - {DamageClass.Burn, new List {DamageType.Heat, DamageType.Disintegration}}, - {DamageClass.Toxin, new List {DamageType.Cellular, DamageType.DNA}}, - {DamageClass.Airloss, new List {DamageType.Asphyxiation}} + {DamageClass.Brute, new List {DamageType.Blunt, DamageType.Slash, DamageType.Piercing}}, + {DamageClass.Burn, new List {DamageType.Heat, DamageType.Shock, DamageType.Cold}}, + {DamageClass.Toxin, new List {DamageType.Poison, DamageType.Radiation}}, + {DamageClass.Airloss, new List {DamageType.Asphyxiation, DamageType.Bloodloss}}, + {DamageClass.Genetic, new List {DamageType.Cellular}} }.ToImmutableDictionary(); public static List ToTypes(this DamageClass @class) diff --git a/Content.Shared/Damage/DamageType.cs b/Content.Shared/Damage/DamageType.cs index 96cfb2eecb..0de82925f7 100644 --- a/Content.Shared/Damage/DamageType.cs +++ b/Content.Shared/Damage/DamageType.cs @@ -10,12 +10,16 @@ namespace Content.Shared.Damage public enum DamageType { Blunt, + Slash, Piercing, Heat, - Disintegration, - Cellular, - DNA, - Asphyxiation + Shock, + Cold, + Poison, + Radiation, + Asphyxiation, + Bloodloss, + Cellular } public static class DamageTypeExtensions @@ -25,12 +29,17 @@ namespace Content.Shared.Damage new Dictionary { {DamageType.Blunt, DamageClass.Brute}, + {DamageType.Slash, DamageClass.Brute}, {DamageType.Piercing, DamageClass.Brute}, {DamageType.Heat, DamageClass.Burn}, - {DamageType.Disintegration, DamageClass.Burn}, - {DamageType.Cellular, DamageClass.Toxin}, - {DamageType.DNA, DamageClass.Toxin}, - {DamageType.Asphyxiation, DamageClass.Airloss} + {DamageType.Shock, DamageClass.Burn}, + {DamageType.Cold, DamageClass.Burn}, + {DamageType.Poison, DamageClass.Toxin}, + {DamageType.Radiation, DamageClass.Toxin}, + {DamageType.Asphyxiation, DamageClass.Airloss}, + {DamageType.Bloodloss, DamageClass.Airloss}, + {DamageType.Cellular, DamageClass.Genetic } + }.ToImmutableDictionary(); public static DamageClass ToClass(this DamageType type) diff --git a/Resources/Prototypes/Damage/damage_containers.yml b/Resources/Prototypes/Damage/damage_containers.yml index bb950b47f1..5fad0c557c 100644 --- a/Resources/Prototypes/Damage/damage_containers.yml +++ b/Resources/Prototypes/Damage/damage_containers.yml @@ -5,6 +5,7 @@ - Burn - Toxin - Airloss + - Genetic - type: damageContainer id: metallicDamageContainer diff --git a/Resources/Prototypes/Damage/resistance_sets.yml b/Resources/Prototypes/Damage/resistance_sets.yml index 5b829d48df..47fe96ef92 100644 --- a/Resources/Prototypes/Damage/resistance_sets.yml +++ b/Resources/Prototypes/Damage/resistance_sets.yml @@ -2,55 +2,79 @@ id: defaultResistances coefficients: Blunt: 1.0 + Slash: 1.0 Piercing: 1.0 Heat: 1.0 - Disintegration: 1.0 - Cellular: 1.0 - DNA: 1.0 + Shock: 1.0 + Cold: 1.0 + Poison: 1.0 + Radiation: 1.0 Asphyxiation: 1.0 + Bloodloss: 1.0 + Cellular: 1.0 flatReductions: Blunt: 0 + Slash: 0 Piercing: 0 Heat: 0 - Disintegration: 0 + Shock: 0 + Cold: 0 + Poison: 0 + Radiation: 0 + Asphyxiation: 0 + Bloodloss: 0 Cellular: 0 - DNA: 0 - Asphyxiation: 0 - type: resistanceSet id: dionaResistances coefficients: Blunt: 0.5 + Slash: 1.2 Piercing: 0.7 Heat: 1.8 - Disintegration: 1.8 - Cellular: 1.0 - DNA: 1.0 + Shock: 0.5 + Cold: 1.5 + Poison: 0.8 + Radiation: 0 Asphyxiation: 1.0 + Bloodloss: 1.0 + Cellular: 1.0 flatReductions: Blunt: 0 + Slash: 0 Piercing: 0 Heat: 0 - Disintegration: 0 - Cellular: 0 - DNA: 0 + Shock: 0 + Cold: 0 + Poison: 0 + Radiation: 0 Asphyxiation: 0 + Bloodloss: 0 + Cellular: 0 - type: resistanceSet id: metallicResistances coefficients: Blunt: 0.7 + Slash: 0.5 Piercing: 0.7 Heat: 1.0 - Disintegration: 1.0 - Cellular: 0.0 - DNA: 0.0 - Asphyxiation: 0.0 + Shock: 1.2 + Cold: 0 + Poison: 0 + Radiation: 0 + Asphyxiation: 0 + Bloodloss: 0 + Cellular: 0 flatReductions: Blunt: 0 + Slash: 0 Piercing: 0 Heat: 0 - Disintegration: 0 - Cellular: 0 - DNA: 0 - Asphyxiation: 0 \ No newline at end of file + Shock: 0 + Cold: 0 + Poison: 0 + Radiation: 0 + Asphyxiation: 0 + Bloodloss: 0 + Cellular: 0 \ No newline at end of file From 4d43a15cba9ba2851d6b740ea072175fbef3582e Mon Sep 17 00:00:00 2001 From: py01 <60152240+collinlunn@users.noreply.github.com> Date: Mon, 31 Aug 2020 16:29:53 -0600 Subject: [PATCH 3/7] Pump enabled animation (#1973) * Pump enabled animation * naming fixes Co-authored-by: py01 --- .../Components/Atmos/PumpVisualizer.cs | 19 +++++++++++++++-- .../Atmos/Piping/Pumps/BasePumpComponent.cs | 20 +++++++++++++++++- .../GameObjects/Atmos/SharedPumpComponent.cs | 4 +++- .../Atmos/pressurepump.rsi/meta.json | 20 ++++++++++++++++++ .../pumpEnabledEast2West2.png | Bin 0 -> 386 bytes .../pumpEnabledNorth2South2.png | Bin 0 -> 896 bytes .../pumpEnabledSouth2North2.png | Bin 0 -> 823 bytes .../pumpEnabledWest2East2.png | Bin 0 -> 408 bytes 8 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 Resources/Textures/Constructible/Atmos/pressurepump.rsi/pumpEnabledEast2West2.png create mode 100644 Resources/Textures/Constructible/Atmos/pressurepump.rsi/pumpEnabledNorth2South2.png create mode 100644 Resources/Textures/Constructible/Atmos/pressurepump.rsi/pumpEnabledSouth2North2.png create mode 100644 Resources/Textures/Constructible/Atmos/pressurepump.rsi/pumpEnabledWest2East2.png diff --git a/Content.Client/GameObjects/Components/Atmos/PumpVisualizer.cs b/Content.Client/GameObjects/Components/Atmos/PumpVisualizer.cs index 42ea6bf6ea..a4b8c9d3dd 100644 --- a/Content.Client/GameObjects/Components/Atmos/PumpVisualizer.cs +++ b/Content.Client/GameObjects/Components/Atmos/PumpVisualizer.cs @@ -12,7 +12,7 @@ using Robust.Shared.Utility; using System; using YamlDotNet.RepresentationModel; -namespace Content.Client.GameObjects.Components.Disposal +namespace Content.Client.GameObjects.Components.Atmos { [UsedImplicitly] public class PumpVisualizer : AppearanceVisualizer @@ -60,11 +60,26 @@ namespace Content.Client.GameObjects.Components.Disposal sprite.LayerSetRSI(basePumpLayer, _pumpRSI); sprite.LayerSetState(basePumpLayer, pumpBaseState); sprite.LayerSetVisible(basePumpLayer, true); + + + + var pumpEnabledAnimationState = "pumpEnabled"; + pumpEnabledAnimationState += pumpVisualState.InletDirection.ToString(); + pumpEnabledAnimationState += ((int) pumpVisualState.InletConduitLayer).ToString(); + pumpEnabledAnimationState += pumpVisualState.OutletDirection.ToString(); + pumpEnabledAnimationState += ((int) pumpVisualState.OutletConduitLayer).ToString(); + + sprite.LayerMapReserveBlank(Layer.PumpEnabled); + var pumpEnabledAnimationLayer = sprite.LayerMapGet(Layer.PumpEnabled); + sprite.LayerSetRSI(pumpEnabledAnimationLayer, _pumpRSI); + sprite.LayerSetState(pumpEnabledAnimationLayer, pumpEnabledAnimationState); + sprite.LayerSetVisible(pumpEnabledAnimationLayer, pumpVisualState.PumpEnabled); } private enum Layer { - PumpBase + PumpBase, + PumpEnabled, } } } diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/Pumps/BasePumpComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/Pumps/BasePumpComponent.cs index 1556c9a62c..24a44ae7d8 100644 --- a/Content.Server/GameObjects/Components/Atmos/Piping/Pumps/BasePumpComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/Piping/Pumps/BasePumpComponent.cs @@ -16,6 +16,21 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping /// public abstract class BasePumpComponent : PipeNetDeviceComponent { + /// + /// If the pump is currently pumping. + /// + [ViewVariables(VVAccess.ReadWrite)] + public bool PumpEnabled + { + get => _pumpEnabled; + set + { + _pumpEnabled = value; + UpdateAppearance(); + } + } + private bool _pumpEnabled = true; + /// /// Needs to be same as that of a on this entity. /// @@ -67,6 +82,9 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping public override void Update() { + if (!PumpEnabled) + return; + PumpGas(_inletPipe.Air, _outletPipe.Air); } @@ -74,7 +92,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping private void UpdateAppearance() { - _appearance?.SetData(PumpVisuals.VisualState, new PumpVisualState(_inletDirection, _outletDirection, _inletPipe.ConduitLayer, _outletPipe.ConduitLayer)); + _appearance?.SetData(PumpVisuals.VisualState, new PumpVisualState(_inletDirection, _outletDirection, _inletPipe.ConduitLayer, _outletPipe.ConduitLayer, PumpEnabled)); } } } diff --git a/Content.Shared/GameObjects/Atmos/SharedPumpComponent.cs b/Content.Shared/GameObjects/Atmos/SharedPumpComponent.cs index d4f304e53e..8546d9d071 100644 --- a/Content.Shared/GameObjects/Atmos/SharedPumpComponent.cs +++ b/Content.Shared/GameObjects/Atmos/SharedPumpComponent.cs @@ -17,13 +17,15 @@ namespace Content.Shared.GameObjects.Atmos public readonly PipeDirection OutletDirection; public readonly ConduitLayer InletConduitLayer; public readonly ConduitLayer OutletConduitLayer; + public readonly bool PumpEnabled; - public PumpVisualState(PipeDirection inletDirection, PipeDirection outletDirection, ConduitLayer inletConduitLayer, ConduitLayer outletConduitLayer) + public PumpVisualState(PipeDirection inletDirection, PipeDirection outletDirection, ConduitLayer inletConduitLayer, ConduitLayer outletConduitLayer, bool pumpEnabled) { InletDirection = inletDirection; OutletDirection = outletDirection; InletConduitLayer = inletConduitLayer; OutletConduitLayer = outletConduitLayer; + PumpEnabled = pumpEnabled; } } } diff --git a/Resources/Textures/Constructible/Atmos/pressurepump.rsi/meta.json b/Resources/Textures/Constructible/Atmos/pressurepump.rsi/meta.json index f950406db6..d8390a7ef9 100644 --- a/Resources/Textures/Constructible/Atmos/pressurepump.rsi/meta.json +++ b/Resources/Textures/Constructible/Atmos/pressurepump.rsi/meta.json @@ -26,6 +26,26 @@ "name":"pumpWest2East2", "directions":1, "delays":[ [ 1.0 ] ] + }, + { + "name":"pumpEnabledEast2West2", + "directions":1, + "delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1 ] ] + }, + { + "name":"pumpEnabledNorth2South2", + "directions":1, + "delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1 ] ] + }, + { + "name":"pumpEnabledSouth2North2", + "directions":1, + "delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1 ] ] + }, + { + "name":"pumpEnabledWest2East2", + "directions":1, + "delays":[ [ 0.1, 0.1, 0.1, 0.1, 0.1 ] ] } ] } \ No newline at end of file diff --git a/Resources/Textures/Constructible/Atmos/pressurepump.rsi/pumpEnabledEast2West2.png b/Resources/Textures/Constructible/Atmos/pressurepump.rsi/pumpEnabledEast2West2.png new file mode 100644 index 0000000000000000000000000000000000000000..4e2d4e1a78786d3372963633e23c250f811a52b8 GIT binary patch literal 386 zcmV-|0e$|7P)423lEn_^Lh2nzX)P`F0t5xUlH5*~uDZ9-&A~}nlhwOaADTmmqk&jFatW&lj5Qveo=MPWRJOV4)?s5#%ipfk#sBuSDaNs=T gk|arzBuUrd2NkDIlq4hyo*E2Pr2AjCl_MI4g%9`|hf`;3MAeShiWkw5%?03n1B zLI@#*5MQ;iJftW}`#rzqhZIF=^!4=t00svKv9z>=N~MC?*;!xy341NS zowX4&Jp~g}fC^}pBx@OF=`|A=H=zQk1U3KjyG&rkgn9(1fIa^J>w}t+gze5FZyC(t zJdB_Qcf^L(otKlpsKM>DVg2CC=ePmuFfsAx1_Zd8V9VbdH<0571mJjgp%>3Fhx5>k zBpmNK^x^|4`9@HKch5obqRv%^`2fsxKO&(`=!x@O4Y230BNBQFJyDjFKZQu>I`qUN zt~$&IFf=v?+wDNERN-oXJ^v_dcNn?S1xfk0VY~Clm9kuQm=7Rzxd3$~iukb%R|BjH zsa{0YEo9d^6pTp72lHkDcMF!}Kw#!MERH z_Iv&|MNt~JVmBNA`eBOleQZKnIOP+v2Qa^JG=RAsMS8`wv;Xp$zXuRP2qAyuv!S8K5hPyg0^4aJ zzsp4EV+4s4a`HuCK7g^~LvTlIl&<7N_S1a+t0B0ZHcDURE@7lm_6@);2R{gKdb zvhzh@-VYea9^5e>FJnGmUcN}QAFx}=o{yKE|6h>(;$`O(LU_@BfMm2EKnNj(Nb(Em WAlmf$*F6OQ0000v`iU!nDso+o?+Qvl`9HN7zfpmBv4ubXE>pPg7-}C~>{a@a_H}8Xc03n1B z-D)58hizc#mqsS^bf^3B_v`775JI@lFpRe3t07+l48v$&9vfym37wLEfEqqIc?Djt z7dtyGJbV74-E20=cU0Y+|JN(PFpPFMJdXbUqwo#*(BtVvI6Us!OzgCL(hBf+dXZS4 z2iAcR0J*+6r5Q4hrx%IAc>uu37?7*GpFfwlKF06;l3gFqmFLZLto zS5f}Tn?F;2uO**+5svny;s0pD3N0vgfGQn51=HWcf_0TC{|!w4BP>|ol-eN=Ke?gh4(*U-C)P&N1AU%H- zz$%ae;<>{N`S+ZI6cEo{Bez3d0e0anYKU=xnbRiEwwsZ%PS#v6 z(9?}P0I}mX1~$TMHDY$`48j9H*lNUdAzuS@?GC2OS3a=j>q1@uNplbp-!|I}Oqwqd z@jX;cDn)j?T&ZdRG&DuIiMR&Tl=cS~L6I5&^7oSX7 zbbb1Bzxi(?KJOJz*nKx{>+G{`leXM{uj;w`uHU3Dl~ylb*IfI3{N=L!jn!w<`6Vpo z2Vby1$qw-al&n}}l$UU&jc?84zYSZ~PBuSw;@P^D{pV->`myQyubTAJWpc+PZtgg@ wedlZ2{rY$KB_zHxvmKK&Fz|DP8gT3(`&-dCrt Date: Tue, 1 Sep 2020 01:36:49 +0300 Subject: [PATCH 4/7] Moved the uplink creation code to the PresetSuspicion.Start method to ensure uplink created when we give the traitor role (#1974) Moved the starting TC balance to cvars --- .../GamePresets/PresetSuspicion.cs | 33 +++++++++++++++++++ Content.Server/GameTicking/GameTicker.cs | 11 ------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/Content.Server/GameTicking/GamePresets/PresetSuspicion.cs b/Content.Server/GameTicking/GamePresets/PresetSuspicion.cs index eb192dbea6..4569668edc 100644 --- a/Content.Server/GameTicking/GamePresets/PresetSuspicion.cs +++ b/Content.Server/GameTicking/GamePresets/PresetSuspicion.cs @@ -9,9 +9,14 @@ using Robust.Shared.Prototypes; using Robust.Shared.Random; using System.Collections.Generic; using System.Linq; +using Content.Server.GameObjects.Components.GUI; +using Content.Server.GameObjects.Components.Items.Storage; +using Content.Server.GameObjects.Components.PDA; using Content.Server.GameObjects.Components.Suspicion; using Content.Server.Mobs.Roles; using Content.Server.Mobs.Roles.Suspicion; +using Content.Shared.GameObjects.Components.Inventory; +using Content.Shared.GameObjects.Components.PDA; using Content.Shared.Roles; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.Configuration; @@ -32,6 +37,9 @@ namespace Content.Server.GameTicking.GamePresets public int MinTraitors { get; set; } public int PlayersPerTraitor { get; set; } + public int TraitorStartingBalance { get; set; } + + public override bool DisallowLateJoin => true; private static string TraitorID = "SuspicionTraitor"; @@ -42,6 +50,7 @@ namespace Content.Server.GameTicking.GamePresets cfg.RegisterCVar("game.suspicion_min_players", 5); cfg.RegisterCVar("game.suspicion_min_traitors", 2); cfg.RegisterCVar("game.suspicion_players_per_traitor", 5); + cfg.RegisterCVar("game.suspicion_starting_balance", 20); } public override bool Start(IReadOnlyList readyPlayers, bool force = false) @@ -49,6 +58,7 @@ namespace Content.Server.GameTicking.GamePresets MinPlayers = _cfg.GetCVar("game.suspicion_min_players"); MinTraitors = _cfg.GetCVar("game.suspicion_min_traitors"); PlayersPerTraitor = _cfg.GetCVar("game.suspicion_players_per_traitor"); + TraitorStartingBalance = _cfg.GetCVar("game.suspicion_starting_balance"); if (!force && readyPlayers.Count < MinPlayers) { @@ -109,6 +119,28 @@ namespace Content.Server.GameTicking.GamePresets var traitorRole = new SuspicionTraitorRole(mind, antagPrototype); mind.AddRole(traitorRole); traitors.Add(traitorRole); + // creadth: we need to create uplink for the antag. + // PDA should be in place already, so we just need to + // initiate uplink account. + var uplinkAccount = + new UplinkAccount(mind.OwnedEntity.Uid, + TraitorStartingBalance); + var inventory = mind.OwnedEntity.GetComponent(); + if (!inventory.TryGetSlotItem(EquipmentSlotDefines.Slots.IDCARD, out ItemComponent pdaItem)) + { + continue; + } + + var pda = pdaItem.Owner; + + var pdaComponent = pda.GetComponent(); + if (pdaComponent.IdSlotEmpty) + { + continue; + } + + pdaComponent.InitUplinkAccount(uplinkAccount); + } foreach (var player in list) @@ -127,6 +159,7 @@ namespace Content.Server.GameTicking.GamePresets return true; } + public override string ModeTitle => "Suspicion"; public override string Description => "Suspicion on the Space Station. There are traitors on board... Can you kill them before they kill you?"; } diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 19383c0f37..54407dca9a 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -861,17 +861,6 @@ namespace Content.Server.GameTicking var accessTags = access.Tags; accessTags.UnionWith(jobPrototype.Access); pdaComponent.SetPDAOwner(characterName); - var mindComponent = mob.GetComponent(); - if (mindComponent.HasMind) //Redundancy checks. - { - if (mindComponent.Mind.AllRoles.Any(role => role.Antagonist)) //Give antags a new uplinkaccount. - { - var uplinkAccount = - new UplinkAccount(mob.Uid, - 20); //TODO: make me into a variable based on server pop or something. - pdaComponent.InitUplinkAccount(uplinkAccount); - } - } } private void AddManifestEntry(string characterName, string jobId) From c8b55714ccf12b4a43bb0a2efd7dd2ad926d2161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Aguilera=20Puerto?= Date: Tue, 1 Sep 2020 02:25:19 +0200 Subject: [PATCH 5/7] Increase barotrauma timer to 3 seconds. --- Content.Server/GameObjects/EntitySystems/BarotraumaSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/GameObjects/EntitySystems/BarotraumaSystem.cs b/Content.Server/GameObjects/EntitySystems/BarotraumaSystem.cs index 2210afb488..d607c3d984 100644 --- a/Content.Server/GameObjects/EntitySystems/BarotraumaSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/BarotraumaSystem.cs @@ -7,7 +7,7 @@ namespace Content.Server.GameObjects.EntitySystems [UsedImplicitly] public class BarotraumaSystem : EntitySystem { - private const float TimePerUpdate = 0.5f; + private const float TimePerUpdate = 3f; private float _timer = 0f; From 3fb4adeb0f288dd6d3a9b67678519f3d9db4f93f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Aguilera=20Puerto?= Date: Tue, 1 Sep 2020 02:35:13 +0200 Subject: [PATCH 6/7] Update submodule. --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index 6ffe2e1750..c5573c0d33 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 6ffe2e1750a2fc2fd30664b0ea393dc4325f5143 +Subproject commit c5573c0d333b1f50b740b48e135d202fe7158d42 From fdd61d1c94cb5d7bfd3d9d6ea9cbee1483625229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Aguilera=20Puerto?= Date: Tue, 1 Sep 2020 03:08:32 +0200 Subject: [PATCH 7/7] Fix instrument crash when you put an instrument in Urist's hands --- .../Components/Instruments/InstrumentComponent.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs b/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs index 3af194ba8d..9947e7d1e9 100644 --- a/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs +++ b/Content.Server/GameObjects/Components/Instruments/InstrumentComponent.cs @@ -246,9 +246,12 @@ namespace Content.Server.GameObjects.Components.Instruments public void HandSelected(HandSelectedEventArgs eventArgs) { - var session = eventArgs.User?.GetComponent()?.playerSession; + if (eventArgs.User == null || !eventArgs.User.TryGetComponent(out BasicActorComponent? actor)) + return; - if (session == null) return; + var session = actor.playerSession; + + if (session.Status != SessionStatus.InGame) return; InstrumentPlayer = session; }