Portable Generator Rework (#19302)
This commit is contained in:
committed by
GitHub
parent
50828363fe
commit
bf16698efa
@@ -13,6 +13,7 @@ namespace Content.Server.Power.Components
|
||||
}
|
||||
|
||||
public abstract partial class BaseNetConnectorComponent<TNetType> : Component, IBaseNetConnectorComponent<TNetType>
|
||||
where TNetType : class
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
@@ -46,7 +47,10 @@ namespace Content.Server.Power.Components
|
||||
public void ClearNet()
|
||||
{
|
||||
if (_net != null)
|
||||
{
|
||||
RemoveSelfFromNet(_net);
|
||||
_net = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void AddSelfToNet(TNetType net);
|
||||
|
||||
@@ -4,7 +4,7 @@ using Content.Server.Power.Pow3r;
|
||||
namespace Content.Server.Power.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed partial class PowerSupplierComponent : BasePowerNetComponent
|
||||
public sealed partial class PowerSupplierComponent : BaseNetConnectorComponent<IBasePowerNet>
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("supplyRate")]
|
||||
@@ -47,12 +47,12 @@ namespace Content.Server.Power.Components
|
||||
[ViewVariables]
|
||||
public PowerState.Supply NetworkSupply { get; } = new();
|
||||
|
||||
protected override void AddSelfToNet(IPowerNet powerNet)
|
||||
protected override void AddSelfToNet(IBasePowerNet powerNet)
|
||||
{
|
||||
powerNet.AddSupplier(this);
|
||||
}
|
||||
|
||||
protected override void RemoveSelfFromNet(IPowerNet powerNet)
|
||||
protected override void RemoveSelfFromNet(IBasePowerNet powerNet)
|
||||
{
|
||||
powerNet.RemoveSupplier(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user