Singulo eats unpowered containment gens (#8343)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using Content.Shared.Singularity.Components;
|
||||||
using Timer = Robust.Shared.Timing.Timer;
|
using Timer = Robust.Shared.Timing.Timer;
|
||||||
|
|
||||||
namespace Content.Server.Singularity.Components
|
namespace Content.Server.Singularity.Components
|
||||||
@@ -65,13 +66,9 @@ namespace Content.Server.Singularity.Components
|
|||||||
Timer.SpawnRepeating(1000, () => { SharedEnergyPool--;}, _powerDecreaseCancellationTokenSource.Token);
|
Timer.SpawnRepeating(1000, () => { SharedEnergyPool--;}, _powerDecreaseCancellationTokenSource.Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanRepell(EntityUid toRepell)
|
public bool CanRepel(SharedSingularityComponent toRepel)
|
||||||
{
|
{
|
||||||
var powerNeeded = 1;
|
var powerNeeded = 2 * toRepel.Level + 1;
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<ServerSingularityComponent?>(toRepell, out var singularityComponent))
|
|
||||||
{
|
|
||||||
powerNeeded += 2*singularityComponent.Level;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _sharedEnergyPool > powerNeeded;
|
return _sharedEnergyPool > powerNeeded;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ namespace Content.Server.Singularity.Components
|
|||||||
private Tuple<Direction, ContainmentFieldConnection>? _connection1;
|
private Tuple<Direction, ContainmentFieldConnection>? _connection1;
|
||||||
private Tuple<Direction, ContainmentFieldConnection>? _connection2;
|
private Tuple<Direction, ContainmentFieldConnection>? _connection2;
|
||||||
|
|
||||||
public bool CanRepell(EntityUid toRepell) => _connection1?.Item2?.CanRepell(toRepell) == true ||
|
public bool CanRepel(SharedSingularityComponent toRepel) => _connection1?.Item2?.CanRepel(toRepel) == true ||
|
||||||
_connection2?.Item2?.CanRepell(toRepell) == true;
|
_connection2?.Item2?.CanRepel(toRepel) == true;
|
||||||
|
|
||||||
public void OnAnchoredChanged()
|
public void OnAnchoredChanged()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace Content.Server.Singularity.EntitySystems
|
|||||||
!EntityManager.HasComponent<GhostComponent>(entity) &&
|
!EntityManager.HasComponent<GhostComponent>(entity) &&
|
||||||
(component.Level > 4 ||
|
(component.Level > 4 ||
|
||||||
!EntityManager.HasComponent<ContainmentFieldComponent>(entity) &&
|
!EntityManager.HasComponent<ContainmentFieldComponent>(entity) &&
|
||||||
!EntityManager.HasComponent<ContainmentFieldGeneratorComponent>(entity));
|
!(EntityManager.TryGetComponent<ContainmentFieldGeneratorComponent>(entity, out var containFieldGen) && containFieldGen.CanRepel(component)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleDestroy(ServerSingularityComponent component, EntityUid entity)
|
private void HandleDestroy(ServerSingularityComponent component, EntityUid entity)
|
||||||
|
|||||||
Reference in New Issue
Block a user