Fix #4070, Visualizer Edition (#4730)

* Transform the Cloning Pod visualizer into a generic enum visualizer for simple cases like it

...I find it helpful at times like these to remind myself that our true enemy is
code. Code is what makes our programs run and generally is required for all of
these machinations to function in any way at all...

* Give the kitchen/meat spike a visualizer

* GenericEnumVisualizer: Byteify enums, switch to TryGetComponent for sprite
This commit is contained in:
20kdc
2021-10-03 00:43:47 +01:00
committed by GitHub
parent 67c4f49749
commit eb82dd3dae
7 changed files with 107 additions and 53 deletions

View File

@@ -55,10 +55,7 @@ namespace Content.Server.Kitchen.Components
}
else
{
if (Owner.TryGetComponent(out sprite))
{
sprite.LayerSetState(0, "spike");
}
UpdateAppearance();
eventArgs.User.PopupMessage(_meatSource0);
}
@@ -73,6 +70,14 @@ namespace Content.Server.Kitchen.Components
return true;
}
private void UpdateAppearance()
{
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
{
appearance.SetData(KitchenSpikeVisuals.Status, (_meatParts > 0) ? KitchenSpikeStatus.Bloody : KitchenSpikeStatus.Empty);
}
}
private bool Spikeable(IEntity user, IEntity victim, [NotNullWhen(true)] out SharedButcherableComponent? butcherable)
{
butcherable = null;
@@ -150,10 +155,7 @@ namespace Content.Server.Kitchen.Components
_meatName = Loc.GetString("comp-kitchen-spike-meat-name", ("victim", victim));
// TODO: Visualizer
if (Owner.TryGetComponent<SpriteComponent>(out var sprite))
{
sprite.LayerSetState(0, "spikebloody");
}
UpdateAppearance();
Owner.PopupMessageEveryone(Loc.GetString("comp-kitchen-spike-kill", ("user", user), ("victim", victim)));
// TODO: Need to be able to leave them on the spike to do DoT, see ss13.