From e15b5f5357ac4dad51d629b2acdde3dc97abb964 Mon Sep 17 00:00:00 2001 From: Anri Date: Mon, 19 Aug 2024 21:52:28 +0300 Subject: [PATCH] ToolTipsForGasesBegin --- .../Ui/SuperMatterObserverMenu.xaml | 4 +- .../Ui/SuperMatterObserverMenu.xaml.cs | 7 +++ .../Components/SuperMatterComponent.cs | 11 ----- .../SuperMatterGasResponse.cs | 18 ++++--- .../SuperMatterSystem.Thermodynamics.cs | 7 +-- .../Functions/SuperMatterGasInteraction.cs | 11 +++++ .../Objects/Specific/smCrystal.rsi/meta.json | 49 ------------------- 7 files changed, 34 insertions(+), 73 deletions(-) create mode 100644 Content.Shared/SS220/SuperMatter/Functions/SuperMatterGasInteraction.cs delete mode 100644 Resources/Textures/SS220/Objects/Specific/smCrystal.rsi/meta.json diff --git a/Content.Client/SS220/SuperMatter/Ui/SuperMatterObserverMenu.xaml b/Content.Client/SS220/SuperMatter/Ui/SuperMatterObserverMenu.xaml index 1f267d8d5ce781..49c9b6c1f328c8 100644 --- a/Content.Client/SS220/SuperMatter/Ui/SuperMatterObserverMenu.xaml +++ b/Content.Client/SS220/SuperMatter/Ui/SuperMatterObserverMenu.xaml @@ -44,8 +44,8 @@ - + MaxSize="256 256" MinSize="192 192" Margin="2 2 2 20" MouseFilter="Pass"> + diff --git a/Content.Client/SS220/SuperMatter/Ui/SuperMatterObserverMenu.xaml.cs b/Content.Client/SS220/SuperMatter/Ui/SuperMatterObserverMenu.xaml.cs index de5191b4027295..4b40e417045620 100644 --- a/Content.Client/SS220/SuperMatter/Ui/SuperMatterObserverMenu.xaml.cs +++ b/Content.Client/SS220/SuperMatter/Ui/SuperMatterObserverMenu.xaml.cs @@ -11,6 +11,8 @@ using System.Linq; using Robust.Client.Graphics; using Content.Shared.Atmos; +using Robust.Client.UserInterface; +using Linguini.Syntax.Ast; namespace Content.Client.SS220.SuperMatter.Ui; @@ -182,7 +184,12 @@ private ProgressBar MakeGasRatioProgressBar(Gas gas) Value = 0.5f, BackgroundStyleBoxOverride = retBackground, ForegroundStyleBoxOverride = retForeground, + MouseFilter = MouseFilterMode.Stop, + TrackingTooltip = true, + TooltipDelay = 0, + ToolTip = gas + Environment.NewLine + gas.ToString(), }; + // gasBar.OnMouseEntered += _ =>; var gasLabel = new Label { diff --git a/Content.Server/SS220/SuperMatter/Crystal/Components/SuperMatterComponent.cs b/Content.Server/SS220/SuperMatter/Crystal/Components/SuperMatterComponent.cs index 821215cc47582d..3702f7062ccb30 100644 --- a/Content.Server/SS220/SuperMatter/Crystal/Components/SuperMatterComponent.cs +++ b/Content.Server/SS220/SuperMatter/Crystal/Components/SuperMatterComponent.cs @@ -66,17 +66,6 @@ public sealed partial class SuperMatterComponent : Component [ViewVariables(VVAccess.ReadOnly)] public float InternalEnergy = 0f; - #region GasInteraction - [DataField, ViewVariables(VVAccess.ReadOnly)] - public Dictionary? DecayInfluenceGases; - [DataField, ViewVariables(VVAccess.ReadOnly)] - // It is used to define how much matter will be added if 1 mole of gas consumed - public Dictionary? GasesToMatterConvertRatio; - [DataField, ViewVariables(VVAccess.ReadOnly)] - public Dictionary? EnergyEfficiencyChangerGases; - - #endregion - // ProtoId Sector [DataField] diff --git a/Content.Server/SS220/SuperMatter/Crystal/SuperMatterInterior/SuperMatterGasResponse.cs b/Content.Server/SS220/SuperMatter/Crystal/SuperMatterInterior/SuperMatterGasResponse.cs index fa3549436f9299..2a830f3e54096d 100644 --- a/Content.Server/SS220/SuperMatter/Crystal/SuperMatterInterior/SuperMatterGasResponse.cs +++ b/Content.Server/SS220/SuperMatter/Crystal/SuperMatterInterior/SuperMatterGasResponse.cs @@ -1,6 +1,7 @@ // © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt using Content.Shared.Atmos; using Content.Server.SS220.SuperMatterCrystal.Components; +using Content.Shared.SS220.SuperMatter.Functions; namespace Content.Server.SS220.SuperMatterCrystal; @@ -11,26 +12,27 @@ public static class SuperMatterGasResponse public static float GetRelativeGasesInfluenceToMatterDecay(SuperMatterComponent smComp, GasMixture gasMixture) { var resultRelativeInfluence = 0f; - if (smComp.DecayInfluenceGases == null) + var decayInfluenceGases = SuperMatterGasInteraction.DecayInfluenceGases; + if (decayInfluenceGases == null) return resultRelativeInfluence; - foreach (var gasId in smComp.DecayInfluenceGases.Keys) + foreach (var gasId in decayInfluenceGases.Keys) { var gasEfficiency = GetGasInfluenceEfficiency(gasId, gasMixture); resultRelativeInfluence = (resultRelativeInfluence + 1) - * (smComp.DecayInfluenceGases[gasId].RelativeInfluence * gasEfficiency + 1) - 1; + * (decayInfluenceGases[gasId].RelativeInfluence * gasEfficiency + 1) - 1; } return resultRelativeInfluence; } public static float GetFlatGasesInfluenceToMatterDecay(SuperMatterComponent smComp, GasMixture gasMixture) { var resultFlatInfluence = 0f; - - if (smComp.DecayInfluenceGases == null) + var decayInfluenceGases = SuperMatterGasInteraction.DecayInfluenceGases; + if (decayInfluenceGases == null) return resultFlatInfluence; - foreach (var gasId in smComp.DecayInfluenceGases.Keys) + foreach (var gasId in decayInfluenceGases.Keys) { var gasEfficiency = GetGasInfluenceEfficiency(gasId, gasMixture); - resultFlatInfluence += smComp.DecayInfluenceGases[gasId].flatInfluence * gasEfficiency; + resultFlatInfluence += decayInfluenceGases[gasId].flatInfluence * gasEfficiency; } return resultFlatInfluence; } @@ -39,7 +41,7 @@ public static float GetFlatGasesInfluenceToMatterDecay(SuperMatterComponent smCo public static float GetGasInfluenceReleaseEnergyEfficiency(SuperMatterComponent smComp, GasMixture gasMixture) { var resultEfficiency = 0f; - var affectGases = smComp.EnergyEfficiencyChangerGases; + var affectGases = SuperMatterGasInteraction.EnergyEfficiencyChangerGases; if (affectGases == null) return resultEfficiency; foreach (var gasId in affectGases.Keys) diff --git a/Content.Server/SS220/SuperMatter/Crystal/SuperMatterSystem.Thermodynamics.cs b/Content.Server/SS220/SuperMatter/Crystal/SuperMatterSystem.Thermodynamics.cs index d5bc87abb1b66a..f10ae24d0b8255 100644 --- a/Content.Server/SS220/SuperMatter/Crystal/SuperMatterSystem.Thermodynamics.cs +++ b/Content.Server/SS220/SuperMatter/Crystal/SuperMatterSystem.Thermodynamics.cs @@ -86,16 +86,17 @@ private float SynthesizeMatterFromGas(Entity crystal, GasM { var (crystalUid, smComp) = crystal; var resultAdditionalMatter = 0f; - if (smComp.GasesToMatterConvertRatio == null) + var gasesToMatterConvertRatio = SuperMatterGasInteraction.GasesToMatterConvertRatio; + if (gasesToMatterConvertRatio == null) return resultAdditionalMatter; - foreach (var gasId in smComp.GasesToMatterConvertRatio.Keys) + foreach (var gasId in gasesToMatterConvertRatio.Keys) { var gasMolesInReact = gasMixture.GetMoles(gasId) * GetMolesReactionEfficiency(smComp.Temperature, gasMixture.Pressure); if (deleteUsedGases) gasMixture.AdjustMoles(gasId, gasMolesInReact * frameTime); - resultAdditionalMatter += gasMolesInReact * smComp.GasesToMatterConvertRatio[gasId]; + resultAdditionalMatter += gasMolesInReact * gasesToMatterConvertRatio[gasId]; } return resultAdditionalMatter; diff --git a/Content.Shared/SS220/SuperMatter/Functions/SuperMatterGasInteraction.cs b/Content.Shared/SS220/SuperMatter/Functions/SuperMatterGasInteraction.cs new file mode 100644 index 00000000000000..47e5b05a3cb1ca --- /dev/null +++ b/Content.Shared/SS220/SuperMatter/Functions/SuperMatterGasInteraction.cs @@ -0,0 +1,11 @@ +// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt +using Content.Shared.Atmos; + +namespace Content.Shared.SS220.SuperMatter.Functions; +public struct SuperMatterGasInteraction +{ + public static Dictionary? DecayInfluenceGases; + // It is used to define how much matter will be added if 1 mole of gas consumed + public static Dictionary? GasesToMatterConvertRatio; + public static Dictionary? EnergyEfficiencyChangerGases; +} diff --git a/Resources/Textures/SS220/Objects/Specific/smCrystal.rsi/meta.json b/Resources/Textures/SS220/Objects/Specific/smCrystal.rsi/meta.json deleted file mode 100644 index 463f91364e0016..00000000000000 --- a/Resources/Textures/SS220/Objects/Specific/smCrystal.rsi/meta.json +++ /dev/null @@ -1,49 +0,0 @@ -{ -"version": 1, - "license": "CC-BY-SA-3.0", - "copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/3f2ebd858fa918a0bd4afad227731376475d599f", - "size": { - "x": 32, - "y": 48 - }, - "states": [ - { - "name": "icon" - }, - { - "name": "psy" - }, - { - "name": "base", - "delays": [ - [ - 0.7, - 0.5, - 1 - ] - ] - }, - { - "name": "glow", - "delays": [ - [ - 1, - 0.5, - 0.1, - 1 - ] - ] - }, - { - "name": "field", - "delays": [ - [ - 10, - 1, - 1, - 1 - ] - ] - } - ] - }