Skip to content

Commit

Permalink
ToolTipsForGasesBegin
Browse files Browse the repository at this point in the history
  • Loading branch information
Alwayswannahunt committed Aug 19, 2024
1 parent 63475c3 commit e15b5f5
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
<BoxContainer Name="LowerDataContainer" MinHeight="256" HorizontalExpand="True" Orientation="Horizontal" Margin="4 4">
<plot:Pseudo3DColoredView Name="ColorState" HorizontalExpand="True" MaxSize="512 256" MinSize="384 256" MouseFilter="Stop" Margin="4 4"/>
<ScrollContainer Name="GasScroll" HScrollEnabled="False" HorizontalExpand="True"
MaxSize="256 256" MinSize="192 192" Margin="2 2 2 20">
<BoxContainer Name="GasContainer" MinSize="192 256" Orientation="Vertical" HorizontalExpand="True" SizeFlagsStretchRatio ="4" Margin="0 0 4 0">
MaxSize="256 256" MinSize="192 192" Margin="2 2 2 20" MouseFilter="Pass">
<BoxContainer Name="GasContainer" MinSize="192 256" Orientation="Vertical" HorizontalExpand="True" MouseFilter="Pass" Margin="0 0 4 0">
<!-- Gas Ratio Bars goes here-->
</BoxContainer>
</ScrollContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Gas, (float RelativeInfluence, float flatInfluence)>? DecayInfluenceGases;
[DataField, ViewVariables(VVAccess.ReadOnly)]
// It is used to define how much matter will be added if 1 mole of gas consumed
public Dictionary<Gas, float>? GasesToMatterConvertRatio;
[DataField, ViewVariables(VVAccess.ReadOnly)]
public Dictionary<Gas, (float OptimalRatio, float RelativeInfluence)>? EnergyEfficiencyChangerGases;

#endregion

// ProtoId Sector

[DataField]
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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;
}
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,17 @@ private float SynthesizeMatterFromGas(Entity<SuperMatterComponent> 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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Gas, (float RelativeInfluence, float flatInfluence)>? DecayInfluenceGases;
// It is used to define how much matter will be added if 1 mole of gas consumed
public static Dictionary<Gas, float>? GasesToMatterConvertRatio;
public static Dictionary<Gas, (float OptimalRatio, float RelativeInfluence)>? EnergyEfficiencyChangerGases;
}
49 changes: 0 additions & 49 deletions Resources/Textures/SS220/Objects/Specific/smCrystal.rsi/meta.json

This file was deleted.

0 comments on commit e15b5f5

Please sign in to comment.