* Engine namespace changes.
* Automated remove redundant using statements.
* Simplified Graphics namespace.
* Apparently the container system stores full type names in the map file.😞 This updates those names.
* API Changes to LocalizationManager.LoadCulture.
* Update submodule to v0.3.2
44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using Content.Shared.GameObjects.Components.Nutrition;
|
|
using Content.Shared.Utility;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.Utility;
|
|
using YamlDotNet.RepresentationModel;
|
|
|
|
namespace Content.Client.GameObjects.Components.Nutrition
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed class DrinkFoodVisualizer : AppearanceVisualizer
|
|
{
|
|
private int _steps;
|
|
|
|
public override void LoadData(YamlMappingNode node)
|
|
{
|
|
base.LoadData(node);
|
|
|
|
_steps = node.GetNode("steps").AsInt();
|
|
}
|
|
|
|
public override void OnChangeData(AppearanceComponent component)
|
|
{
|
|
base.OnChangeData(component);
|
|
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
|
|
|
if (!component.TryGetData<float>(SharedFoodComponent.FoodVisuals.MaxUses, out var maxUses))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (component.TryGetData<float>(SharedFoodComponent.FoodVisuals.Visual, out var usesLeft))
|
|
{
|
|
var step = ContentHelpers.RoundToLevels(usesLeft, maxUses, _steps);
|
|
sprite.LayerSetState(0, $"icon-{step}");
|
|
}
|
|
else
|
|
{
|
|
sprite.LayerSetState(0, "icon-0");
|
|
}
|
|
}
|
|
}
|
|
}
|