Adds the thermo-electric generator (#18840)

* Basic TEG start.

Connects via node group.

* Basic TEG test map

* Sensor monitoring basics, TEG circulator flow

* Basic power generation (it doesn't work)

* More sensor monitoring work

* Battery (SMES) monitoring system.

* Sensor monitoring fixes

Make it work properly when mapped.

* Test map improvements

* Revise TEG power output mechanism.

Now uses a fixed supplier with a custom ramping system.

* TEG test map fixes

* Make air alarms and pumps open UI on activate.

* Clean up thermo machines power switch.

Removed separate Enabled bool from the component that always matched the power receiver's state.

This enables adding a PowerSwitch component to give us alt click/verb menu.

* TEG but now fancy

* Make sensor monitoring console obviously WiP to mappers.

* Vending machine sound, because of course.

* Terrible, terrible graph background color

* Examine improvements for the TEG.

* Account for electrical power when equalizing gas mixtures.

* Get rid of the TegCirculatorArrow logic.

Use TimedDespawn instead. The "no show in right-click menuu" goes into a new general-purpose component.

Thanks Julian.

* Put big notice of "not ready, here's why" on the sensor monitoring console.

* TryGetComponent -> TryComp

* Lol there's a HideContextMenu tag

* Test fixes

* Guidebook for TEG

Fixed rotation on GuideEntityEmbed not working correctly.

Added Margin property to GuideEntityEmbed

* Make TEG power bar default to invisible.

So it doesn't appear in the guidebook and spawn menu.
This commit is contained in:
Pieter-Jan Briers
2023-08-12 22:41:55 +02:00
committed by GitHub
parent 61bf951ec4
commit a242af506e
74 changed files with 5546 additions and 22 deletions

View File

@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Numerics;
using Content.Client.ContextMenu.UI;
using Content.Client.Examine;
@@ -15,6 +16,7 @@ using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Input;
using Robust.Shared.Map;
using Robust.Shared.Utility;
namespace Content.Client.Guidebook.Controls;
@@ -169,10 +171,17 @@ public sealed partial class GuideEntityEmbed : BoxContainer, IDocumentTag
if (args.TryGetValue("Rotation", out var rotation))
{
Sprite.Rotation = Angle.FromDegrees(double.Parse(rotation));
View.OverrideDirection = Angle.FromDegrees(double.Parse(rotation)).GetDir();
}
Margin = new Thickness(4, 8);
if (args.TryGetValue("Margin", out var margin))
{
Margin = ParseThickness(margin);
}
else
{
Margin = new Thickness(4, 8);
}
// By default, we will map-initialize guidebook entities.
if (!args.TryGetValue("Init", out var mapInit) || !bool.Parse(mapInit))
@@ -181,4 +190,20 @@ public sealed partial class GuideEntityEmbed : BoxContainer, IDocumentTag
control = this;
return true;
}
private static Thickness ParseThickness(string value)
{
if (string.IsNullOrWhiteSpace(value))
return default;
var split = value.Split(" ", StringSplitOptions.RemoveEmptyEntries).Select(x => Parse.Float(x)).ToArray();
if (split.Length == 1)
return new Thickness(split[0]);
if (split.Length == 2)
return new Thickness(split[0], split[1]);
if (split.Length == 4)
return new Thickness(split[0], split[1], split[2], split[3]);
throw new Exception("Invalid Thickness format!");
}
}