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

@@ -0,0 +1,53 @@
using System;
using Content.Shared.GameObjects.Components.Power;
using Content.Shared.Utility;
using SS14.Server.GameObjects;
using SS14.Shared.GameObjects;
namespace Content.Server.GameObjects.Components.Power
{
/// <summary>
/// Handles the "user-facing" side of the actual SMES object.
/// This is operations that are specific to the SMES, like UI and visuals.
/// Code interfacing with the powernet is handled in <see cref="PowerStorageComponent" />.
/// </summary>
public class SmesComponent : Component
{
public override string Name => "Smes";
PowerStorageComponent Storage;
AppearanceComponent Appearance;
int LastChargeLevel = 0;
ChargeState LastChargeState;
public override void Initialize()
{
base.Initialize();
Storage = Owner.GetComponent<PowerStorageComponent>();
Appearance = Owner.GetComponent<AppearanceComponent>();
}
public override void Update(float frameTime)
{
var newLevel = CalcChargeLevel();
if (newLevel != LastChargeLevel)
{
LastChargeLevel = newLevel;
Appearance.SetData(SmesVisuals.LastChargeLevel, newLevel);
}
var newState = Storage.GetChargeState();
if (newState != LastChargeState)
{
LastChargeState = newState;
Appearance.SetData(SmesVisuals.LastChargeState, newState);
}
}
int CalcChargeLevel()
{
return ContentHelpers.RoundToLevels(Storage.Charge, Storage.Capacity, 6);
}
}
}