Class SingularitySystem
The server-side version of SharedSingularitySystem. Primarily responsible for managing SingularityComponents. Handles their accumulation of energy upon consuming entities (see EventHorizonComponent) and gradual dissipation. Also handles synchronizing server-side components with the singuarities level.
Namespace: Content.Server.Singularity.EntitySystems
Assembly: Content.Server.dll
Syntax
public sealed class SingularitySystem : SharedSingularitySystem
Fields
| Improve this Doc View SourceBaseEntityEnergy
The amount of energy singulos accumulate when they eat an entity.
Declaration
public const float BaseEntityEnergy = null
Field Value
Type | Description |
---|---|
System.Single |
BaseTileEnergy
The amount of energy singulos accumulate when they eat a tile.
Declaration
public const float BaseTileEnergy = null
Field Value
Type | Description |
---|---|
System.Single |
Methods
| Improve this Doc View SourceAdjustEnergy(EntityUid, Single, Single, Single, Boolean, Boolean, SingularityComponent)
Adjusts the amount of energy the singularity has accumulated.
Declaration
public void AdjustEnergy(EntityUid uid, float delta, float min = null, float max = null, bool snapMin = true, bool snapMax = true, SingularityComponent singularity = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | The uid of the singularity to adjust the energy of. |
System.Single | delta | The amount to adjust the energy of the singuarity. |
System.Single | min | The minimum amount of energy for the singularity to be adjusted to. |
System.Single | max | The maximum amount of energy for the singularity to be adjusted to. |
System.Boolean | snapMin | Whether the amount of energy in the singularity should be forced to within the specified range if it already is below it. |
System.Boolean | snapMax | Whether the amount of energy in the singularity should be forced to within the specified range if it already is above it. |
SingularityComponent | singularity | The state of the singularity to adjust the energy of. |
Initialize()
Declaration
public override void Initialize()
Overrides
| Improve this Doc View SourceOnConsumed(EntityUid, SinguloFoodComponent, ref EventHorizonConsumedEntityEvent)
Adds some bonus energy from any singularity food to the singularity that consumes it.
Declaration
public void OnConsumed(EntityUid uid, SinguloFoodComponent comp, ref EventHorizonConsumedEntityEvent args)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | The entity UID of the singularity food that is being consumed. |
SinguloFoodComponent | comp | The component of the singularity food that is being consumed. |
Content.Server.Singularity.Events.EventHorizonConsumedEntityEvent | args | The event arguments. |
OnConsumedEntity(EntityUid, SingularityComponent, ref EntityConsumedByEventHorizonEvent)
Adds the energy of any entities that are consumed to the singularity that consumed them.
Declaration
public void OnConsumedEntity(EntityUid uid, SingularityComponent comp, ref EntityConsumedByEventHorizonEvent args)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | The entity UID of the singularity that is consuming the entity. |
SingularityComponent | comp | The component of the singularity that is consuming the entity. |
Content.Server.Singularity.Events.EntityConsumedByEventHorizonEvent | args | The event arguments. |
OnConsumedTiles(EntityUid, SingularityComponent, ref TilesConsumedByEventHorizonEvent)
Adds the energy of any tiles that are consumed to the singularity that consumed them.
Declaration
public void OnConsumedTiles(EntityUid uid, SingularityComponent comp, ref TilesConsumedByEventHorizonEvent args)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | The entity UID of the singularity that is consuming the tiles. |
SingularityComponent | comp | The component of the singularity that is consuming the tiles. |
Content.Server.Singularity.Events.TilesConsumedByEventHorizonEvent | args | The event arguments. |
OnDistortionStartup(EntityUid, SingularityDistortionComponent, ComponentStartup)
Makes entities that have the singularity distortion visual warping always get their state shared with the client. This prevents some major popin with large distortion ranges.
Declaration
public void OnDistortionStartup(EntityUid uid, SingularityDistortionComponent comp, ComponentStartup args)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | The entity UID of the entity that is gaining the shader. |
SingularityDistortionComponent | comp | The component of the shader that the entity is gaining. |
ComponentStartup | args | The event arguments. |
OnSingularityShutdown(EntityUid, SingularityComponent, ComponentShutdown)
Handles playing the shutdown sounds when a singulo dissipates. Always stops the ambient singularity rumble. The dissipations sound only plays if the singularity is being destroyed.
Declaration
public void OnSingularityShutdown(EntityUid uid, SingularityComponent comp, ComponentShutdown args)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | The entity UID of the singularity that is dissipating. |
SingularityComponent | comp | The component of the singularity that is dissipating. |
ComponentShutdown | args | The event arguments. |
OnSingularityStartup(EntityUid, SingularityComponent, ComponentStartup)
Handles playing the startup sounds when a singulo forms. Always sets up the ambient singularity rumble. The formation sound only plays if the singularity is being created.
Declaration
protected override void OnSingularityStartup(EntityUid uid, SingularityComponent comp, ComponentStartup args)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | The entity UID of the singularity that is forming. |
SingularityComponent | comp | The component of the singularity that is forming. |
ComponentStartup | args | The event arguments. |
SetEnergy(EntityUid, Single, SingularityComponent)
Setter for Energy. Also updates the level of the singularity accordingly.
Declaration
public void SetEnergy(EntityUid uid, float value, SingularityComponent singularity = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | The uid of the singularity to set the energy of. |
System.Single | value | The amount of energy for the singularity to have. |
SingularityComponent | singularity | The state of the singularity to set the energy of. |
SetUpdatePeriod(EntityUid, TimeSpan, SingularityComponent)
Setter for TargetUpdatePeriod. If the new target time implies that the singularity should have updated it does so immediately.
Declaration
public void SetUpdatePeriod(EntityUid uid, TimeSpan value, SingularityComponent singularity = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | The uid of the singularity to set the update period for. |
TimeSpan | value | The new update period for the singularity. |
SingularityComponent | singularity | The state of the singularity to set the update period for. |
Shutdown()
Declaration
public override void Shutdown()
Overrides
| Improve this Doc View SourceUpdate(EntityUid, SingularityComponent)
Handles the gradual energy loss and dissipation of singularity.
Declaration
public void Update(EntityUid uid, SingularityComponent singularity = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | The uid of the singularity to update. |
SingularityComponent | singularity | The state of the singularity to update. |
Update(EntityUid, TimeSpan, SingularityComponent)
Handles the gradual energy loss and dissipation of a singularity.
Declaration
public void Update(EntityUid uid, TimeSpan frameTime, SingularityComponent singularity = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | The uid of the singularity to update. |
TimeSpan | frameTime | The amount of time that has elapsed since the last update. |
SingularityComponent | singularity | The state of the singularity to update. |
Update(Single)
Handles the gradual dissipation of all singularities.
Declaration
public override void Update(float frameTime)
Parameters
Type | Name | Description |
---|---|---|
System.Single | frameTime | The amount of time since the last set of updates. |
UpdateEnergyDrain(EntityUid, SingularityComponent, SingularityLevelChangedEvent)
Updates the rate at which the singularities energy drains at when its level changes.
Declaration
public void UpdateEnergyDrain(EntityUid uid, SingularityComponent comp, SingularityLevelChangedEvent args)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | The entity UID of the singularity that changed in level. |
SingularityComponent | comp | The component of the singularity that changed in level. |
SingularityLevelChangedEvent | args | The event arguments. |