* plants and seeds go brrrr * update plants * P L A N T * brrrr * Hydroponics actually work! How about that? * Reuse resource path in visualizer * They lied to us. * Several stuffs * more werk * Add a bunch of plants * Logs go brr. * Brrr moment. * Remove unused method * Important comment. * Seed inventory, yo! * tomato moment * Balance consumption * Makes hydroponics pourable * Adds plant metabolism effect for sugar, the same as glucose. * Eggplant moment * Apple moment * Corn moment * Chanterelle mushroom moment * prototype tweaks * Seed extractor moment * typo * IPlantMetabolizable doc improvement * I should trust my gut instinct more often. * egg-plant..... * localization * Make WaterLevel and NutritionLevel setters private * Less code repetition! Wooo!
61 lines
1.8 KiB
C#
61 lines
1.8 KiB
C#
using Content.Shared.GameObjects.Components.Nutrition;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.Interfaces.GameObjects.Components;
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
using Robust.Shared.Utility;
|
|
using YamlDotNet.RepresentationModel;
|
|
|
|
namespace Content.Client.GameObjects.Components.Nutrition
|
|
{
|
|
[UsedImplicitly]
|
|
public class CreamPiedVisualizer : AppearanceVisualizer
|
|
{
|
|
private string _state;
|
|
|
|
public override void InitializeEntity(IEntity entity)
|
|
{
|
|
base.InitializeEntity(entity);
|
|
|
|
var sprite = entity.GetComponent<ISpriteComponent>();
|
|
|
|
sprite.LayerMapReserveBlank(CreamPiedVisualLayers.Pie);
|
|
sprite.LayerSetRSI(CreamPiedVisualLayers.Pie, "Effects/creampie.rsi");
|
|
sprite.LayerSetVisible(CreamPiedVisualLayers.Pie, false);
|
|
}
|
|
|
|
public override void LoadData(YamlMappingNode node)
|
|
{
|
|
base.LoadData(node);
|
|
|
|
if (node.TryGetNode("state", out var otherNode))
|
|
{
|
|
_state = otherNode.AsString();
|
|
}
|
|
}
|
|
|
|
public override void OnChangeData(AppearanceComponent component)
|
|
{
|
|
base.OnChangeData(component);
|
|
|
|
if (component.TryGetData<bool>(CreamPiedVisuals.Creamed, out var pied))
|
|
{
|
|
SetPied(component, pied);
|
|
}
|
|
}
|
|
|
|
private void SetPied(AppearanceComponent component, bool pied)
|
|
{
|
|
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
|
|
|
sprite.LayerSetVisible(CreamPiedVisualLayers.Pie, pied);
|
|
sprite.LayerSetState(CreamPiedVisualLayers.Pie, _state);
|
|
}
|
|
}
|
|
|
|
public enum CreamPiedVisualLayers
|
|
{
|
|
Pie,
|
|
}
|
|
}
|