* 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.
74 lines
2.2 KiB
C#
74 lines
2.2 KiB
C#
using System.Reflection;
|
|
using Content.Server.Power.Generation.Teg;
|
|
using Robust.Shared.Reflection;
|
|
|
|
namespace Content.Server.NodeContainer.NodeGroups
|
|
{
|
|
public interface INodeGroupFactory
|
|
{
|
|
/// <summary>
|
|
/// Performs reflection to associate <see cref="INodeGroup"/> implementations with the
|
|
/// string specified in their <see cref="NodeGroupAttribute"/>.
|
|
/// </summary>
|
|
void Initialize();
|
|
|
|
/// <summary>
|
|
/// Returns a new <see cref="INodeGroup"/> instance.
|
|
/// </summary>
|
|
INodeGroup MakeNodeGroup(NodeGroupID id);
|
|
}
|
|
|
|
public sealed class NodeGroupFactory : INodeGroupFactory
|
|
{
|
|
[Dependency] private readonly IReflectionManager _reflectionManager = default!;
|
|
[Dependency] private readonly IDynamicTypeFactory _typeFactory = default!;
|
|
|
|
private readonly Dictionary<NodeGroupID, Type> _groupTypes = new();
|
|
|
|
public void Initialize()
|
|
{
|
|
var nodeGroupTypes = _reflectionManager.GetAllChildren<INodeGroup>();
|
|
foreach (var nodeGroupType in nodeGroupTypes)
|
|
{
|
|
var att = nodeGroupType.GetCustomAttribute<NodeGroupAttribute>();
|
|
if (att != null)
|
|
{
|
|
foreach (var groupID in att.NodeGroupIDs)
|
|
{
|
|
_groupTypes.Add(groupID, nodeGroupType);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public INodeGroup MakeNodeGroup(NodeGroupID id)
|
|
{
|
|
if (!_groupTypes.TryGetValue(id, out var type))
|
|
throw new ArgumentException($"{id} did not have an associated {nameof(INodeGroup)} implementation.");
|
|
|
|
var instance = _typeFactory.CreateInstance<INodeGroup>(type);
|
|
instance.Create(id);
|
|
return instance;
|
|
}
|
|
}
|
|
|
|
public enum NodeGroupID : byte
|
|
{
|
|
Default,
|
|
HVPower,
|
|
MVPower,
|
|
Apc,
|
|
AMEngine,
|
|
Pipe,
|
|
WireNet,
|
|
Spreader,
|
|
|
|
/// <summary>
|
|
/// Group used by the TEG.
|
|
/// </summary>
|
|
/// <seealso cref="TegSystem"/>
|
|
/// <seealso cref="TegNodeGroup"/>
|
|
Teg,
|
|
}
|
|
}
|