Vending visualizer update (#9962)
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.VendingMachines;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Animations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using static Content.Shared.VendingMachines.SharedVendingMachineComponent;
|
||||
@@ -139,7 +142,18 @@ namespace Content.Client.VendingMachines.UI
|
||||
base.OnChangeData(component);
|
||||
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var sprite = entMan.GetComponent<ISpriteComponent>(component.Owner);
|
||||
var sprite = entMan.GetComponent<SpriteComponent>(component.Owner);
|
||||
|
||||
// TODO when moving to a system visualizer, re work how this is done
|
||||
// Currently this only gets called during init, so unless it NEEEDS to be configurable, just make this party of the entity prototype.
|
||||
if (component.TryGetData(VendingMachineVisuals.Inventory, out string? invId) &&
|
||||
IoCManager.Resolve<IPrototypeManager>().TryIndex(invId, out VendingMachineInventoryPrototype? prototype) &&
|
||||
IoCManager.Resolve<IResourceCache>().TryGetResource<RSIResource>(
|
||||
SharedSpriteComponent.TextureRoot / $"Structures/Machines/VendingMachines/{prototype.SpriteName}.rsi", out var res))
|
||||
{
|
||||
sprite.BaseRSI = res.RSI;
|
||||
}
|
||||
|
||||
var animPlayer = entMan.GetComponent<AnimationPlayerComponent>(component.Owner);
|
||||
if (!component.TryGetData(VendingMachineVisuals.VisualState, out VendingMachineVisualState state))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user