* 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,5 +1,3 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Body.Behavior;
|
||||
using Content.Server.Fluids.Components;
|
||||
using Content.Shared.Body.Components;
|
||||
@@ -21,6 +19,8 @@ using Robust.Shared.Player;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Content.Server.Nutrition.Components
|
||||
{
|
||||
@@ -61,7 +61,7 @@ namespace Content.Server.Nutrition.Components
|
||||
}
|
||||
|
||||
_opened = value;
|
||||
OpenedChanged();
|
||||
OnOpenedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Content.Server.Nutrition.Components
|
||||
|
||||
[DataField("burstSound")] public SoundSpecifier BurstSound = new SoundPathSpecifier("/Audio/Effects/flash_bang.ogg");
|
||||
|
||||
private void OpenedChanged()
|
||||
private void OnOpenedChanged()
|
||||
{
|
||||
var solutionSys = EntitySystem.Get<SolutionContainerSystem>();
|
||||
if (!solutionSys.TryGetSolution(Owner, SolutionName, out _))
|
||||
@@ -89,6 +89,11 @@ namespace Content.Server.Nutrition.Components
|
||||
return;
|
||||
}
|
||||
|
||||
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(DrinkCanStateVisual.Opened, Opened);
|
||||
}
|
||||
|
||||
if (Opened)
|
||||
{
|
||||
var refillable = Owner.EnsureComponent<RefillableSolutionComponent>();
|
||||
@@ -103,19 +108,6 @@ namespace Content.Server.Nutrition.Components
|
||||
}
|
||||
}
|
||||
|
||||
// TODO move to DrinkSystem
|
||||
public void UpdateAppearance()
|
||||
{
|
||||
if (!Owner.TryGetComponent(out AppearanceComponent? appearance) ||
|
||||
!Owner.HasComponent<SolutionContainerManagerComponent>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var drainAvailable = EntitySystem.Get<SolutionContainerSystem>().DrainAvailable(Owner);
|
||||
appearance.SetData(SharedFoodComponent.FoodVisuals.Visual, drainAvailable.Float());
|
||||
}
|
||||
|
||||
bool IUse.UseEntity(UseEntityEventArgs args)
|
||||
{
|
||||
if (!Opened)
|
||||
@@ -218,7 +210,6 @@ namespace Content.Server.Nutrition.Components
|
||||
SoundSystem.Play(Filter.Pvs(target), _useSound.GetSound(), target, AudioParams.Default.WithVolume(-2f));
|
||||
|
||||
target.PopupMessage(Loc.GetString("drink-component-try-use-drink-success-slurp"));
|
||||
UpdateAppearance();
|
||||
|
||||
// TODO: Account for partial transfer.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user