APC & SMES appearances. (#78)

* CEV-Eris SMES sprite as RSI.

Has been modified so that the light overlay states use alpha blending.

* Add tiny glow to SMES display sprite.

* Appearances work v2

* More WiP

* RoundToLevels works correctly on even level counts now.

* SMES -> Smes because MS guidelines.

* CEV-Eris APC sprite.

* APC visuals.

* Reduce SMES scale again to normal levels.

* Update submodule
This commit is contained in:
Pieter-Jan Briers
2018-07-17 11:39:55 +02:00
committed by GitHub
parent 7629d447aa
commit ad5c82fec9
69 changed files with 1253 additions and 29 deletions

View File

@@ -1,4 +1,5 @@
using SS14.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Power;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.IoC;
using SS14.Shared.Utility;
@@ -14,6 +15,9 @@ namespace Content.Server.GameObjects.Components.Power
{
public override string Name => "PowerStorage";
public ChargeState LastChargeState { get; private set; } = ChargeState.Still;
public DateTime LastChargeStateChange { get; private set; }
/// <summary>
/// Maximum amount of energy the internal battery can store.
/// In Joules.
@@ -38,6 +42,8 @@ namespace Content.Server.GameObjects.Components.Power
/// </summary>
public float DistributionRate { get; private set; } = 1000;
public bool Full => Charge >= Capacity;
private bool _chargepowernet = false;
/// <summary>
@@ -129,15 +135,19 @@ namespace Content.Server.GameObjects.Components.Power
public void DeductCharge(float todeduct)
{
Charge = Math.Max(0, Charge - todeduct);
LastChargeState = ChargeState.Discharging;
LastChargeStateChange = DateTime.Now;
}
public void AddCharge(float charge)
{
Charge = Math.Min(Capacity, Charge + charge);
LastChargeState = ChargeState.Charging;
LastChargeStateChange = DateTime.Now;
}
/// <summary>
/// Returns the charge available from the energy storage
/// Returns the amount of energy that can be taken in by this storage in the specified amount of time.
/// </summary>
public float RequestCharge(float frameTime)
{
@@ -145,15 +155,33 @@ namespace Content.Server.GameObjects.Components.Power
}
/// <summary>
/// Returns the charge available from the energy storage
/// Returns the amount of energy available for discharge in the specified amount of time.
/// </summary>
public float AvailableCharge(float frameTime)
{
return Math.Min(DistributionRate * frameTime, Charge);
}
public ChargeState GetChargeState()
{
return GetChargeState(TimeSpan.FromSeconds(1));
}
public ChargeState GetChargeState(TimeSpan timeout)
{
if (LastChargeStateChange + timeout > DateTime.Now)
{
return LastChargeState;
}
return ChargeState.Still;
}
public void ChargePowerTick(float frameTime)
{
if (Full)
{
return;
}
AddCharge(RequestCharge(frameTime));
}