* temp * #3898 some progress on DrinkCanVisualizer * Fixed implementation * Moved drink can sprite layer definition to abstract parent * Added open drink can sprites * #3898 - fixes for drink cans' sprite field after merge + moved UpdateAppeareance from DrinkComponent to DrinkSystem * Update Content.Server/Nutrition/EntitySystems/DrinkSystem.cs * #3898 removed obsolete comment Co-authored-by: Javier Guardia Fernández <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
using Content.Server.Fluids.Components;
|
||||
using Content.Server.Fluids.Components;
|
||||
using Content.Server.Nutrition.Components;
|
||||
using Content.Shared.Chemistry.Components.SolutionManager;
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Throwing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -35,6 +37,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
_solutionContainerSystem.TryGetDrainableSolution(uid, out var interactions))
|
||||
{
|
||||
component.Opened = true;
|
||||
UpdateAppearance(component);
|
||||
|
||||
var entity = EntityManager.GetEntity(uid);
|
||||
|
||||
@@ -60,13 +63,25 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
_solutionContainerSystem.EnsureSolution(owner, component.SolutionName);
|
||||
}
|
||||
|
||||
component.UpdateAppearance();
|
||||
UpdateAppearance(component);
|
||||
}
|
||||
|
||||
|
||||
private void OnSolutionChange(EntityUid uid, DrinkComponent component, SolutionChangedEvent args)
|
||||
{
|
||||
component.UpdateAppearance();
|
||||
UpdateAppearance(component);
|
||||
}
|
||||
|
||||
public void UpdateAppearance(DrinkComponent component)
|
||||
{
|
||||
if (!component.Owner.TryGetComponent(out AppearanceComponent? appearance) ||
|
||||
!component.Owner.HasComponent<SolutionContainerManagerComponent>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var drainAvailable = Get<SolutionContainerSystem>().DrainAvailable(component.Owner);
|
||||
appearance.SetData(FoodVisuals.Visual, drainAvailable.Float());
|
||||
appearance.SetData(DrinkCanStateVisual.Opened, component.Opened);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user