Chemistry revamp and bartending features
-Ability to mix drinks to create cocktails with shiny icons -New Chemistry System which can relay chemistry events to corresponding components -moved some solution logic from Shared to Server -fixed some weird stuff with DrinkComponent
This commit is contained in:
@@ -134,6 +134,7 @@ namespace Content.Client
|
|||||||
"Paper",
|
"Paper",
|
||||||
"Write",
|
"Write",
|
||||||
"Bloodstream",
|
"Bloodstream",
|
||||||
|
"TransformableContainer",
|
||||||
"Mind",
|
"Mind",
|
||||||
"MovementSpeedModifier",
|
"MovementSpeedModifier",
|
||||||
"StorageFill"
|
"StorageFill"
|
||||||
@@ -148,7 +149,7 @@ namespace Content.Client
|
|||||||
factory.Register<SharedLatheComponent>();
|
factory.Register<SharedLatheComponent>();
|
||||||
factory.Register<SharedSpawnPointComponent>();
|
factory.Register<SharedSpawnPointComponent>();
|
||||||
|
|
||||||
factory.Register<SolutionComponent>();
|
factory.Register<SharedSolutionComponent>();
|
||||||
|
|
||||||
factory.Register<SharedVendingMachineComponent>();
|
factory.Register<SharedVendingMachineComponent>();
|
||||||
factory.Register<SharedWiresComponent>();
|
factory.Register<SharedWiresComponent>();
|
||||||
|
|||||||
@@ -65,19 +65,11 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
serializer.DataField(ref _initialMaxVolume, "initialMaxVolume", 15);
|
serializer.DataField(ref _initialMaxVolume, "initialMaxVolume", 15);
|
||||||
serializer.DataField(ref _transferAmount, "transferAmount", 5);
|
serializer.DataField(ref _transferAmount, "transferAmount", 5);
|
||||||
}
|
}
|
||||||
|
protected override void Startup()
|
||||||
public override void Initialize()
|
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Startup();
|
||||||
|
_internalContents = Owner.GetComponent<SolutionComponent>();
|
||||||
//Create and setup internal storage
|
|
||||||
_internalContents = new SolutionComponent();
|
|
||||||
_internalContents.InitializeFromPrototype();
|
|
||||||
_internalContents.Init();
|
|
||||||
_internalContents.MaxVolume = _initialMaxVolume;
|
|
||||||
_internalContents.Owner = Owner; //Manually set owner to avoid crash when VV'ing this
|
|
||||||
_internalContents.Capabilities |= SolutionCaps.Injector;
|
_internalContents.Capabilities |= SolutionCaps.Injector;
|
||||||
|
|
||||||
//Set _toggleState based on prototype
|
//Set _toggleState based on prototype
|
||||||
_toggleState = _injectOnly ? InjectorToggleMode.Inject : InjectorToggleMode.Draw;
|
_toggleState = _injectOnly ? InjectorToggleMode.Inject : InjectorToggleMode.Draw;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
[ComponentReference(typeof(IActivate))]
|
||||||
[ComponentReference(typeof(IAttackBy))]
|
[ComponentReference(typeof(IAttackBy))]
|
||||||
public class ReagentDispenserComponent : SharedReagentDispenserComponent, IActivate, IAttackBy
|
public class ReagentDispenserComponent : SharedReagentDispenserComponent, IActivate, IAttackBy, ISolutionChange
|
||||||
{
|
{
|
||||||
#pragma warning disable 649
|
#pragma warning disable 649
|
||||||
[Dependency] private readonly IServerNotifyManager _notifyManager;
|
[Dependency] private readonly IServerNotifyManager _notifyManager;
|
||||||
@@ -161,7 +161,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
private bool PlayerCanUseDispenser(IEntity playerEntity)
|
private bool PlayerCanUseDispenser(IEntity playerEntity)
|
||||||
{
|
{
|
||||||
//Need player entity to check if they are still able to use the dispenser
|
//Need player entity to check if they are still able to use the dispenser
|
||||||
if (playerEntity == null)
|
if (playerEntity == null)
|
||||||
return false;
|
return false;
|
||||||
//Check if player can interact in their current state
|
//Check if player can interact in their current state
|
||||||
if (!ActionBlockerSystem.CanInteract(playerEntity) || !ActionBlockerSystem.CanUse(playerEntity))
|
if (!ActionBlockerSystem.CanInteract(playerEntity) || !ActionBlockerSystem.CanUse(playerEntity))
|
||||||
@@ -207,7 +207,6 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var beaker = _beakerContainer.ContainedEntity;
|
var beaker = _beakerContainer.ContainedEntity;
|
||||||
Solution.SolutionChanged -= HandleSolutionChangedEvent;
|
|
||||||
_beakerContainer.Remove(_beakerContainer.ContainedEntity);
|
_beakerContainer.Remove(_beakerContainer.ContainedEntity);
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
|
|
||||||
@@ -304,7 +303,6 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_beakerContainer.Insert(activeHandEntity);
|
_beakerContainer.Insert(activeHandEntity);
|
||||||
Solution.SolutionChanged += HandleSolutionChangedEvent;
|
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -317,10 +315,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleSolutionChangedEvent()
|
void ISolutionChange.SolutionChanged(SolutionChangeEventArgs eventArgs) => UpdateUserInterface();
|
||||||
{
|
|
||||||
UpdateUserInterface();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ClickSound()
|
private void ClickSound()
|
||||||
{
|
{
|
||||||
@@ -329,5 +324,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
sound.Play("/Audio/machines/machine_switch.ogg", AudioParams.Default.WithVolume(-2f));
|
sound.Play("/Audio/machines/machine_switch.ogg", AudioParams.Default.WithVolume(-2f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Design;
|
using System.ComponentModel.Design;
|
||||||
|
using System.Linq;
|
||||||
using Content.Server.Chemistry;
|
using Content.Server.Chemistry;
|
||||||
|
using Content.Shared.GameObjects.Components.Chemistry;
|
||||||
using Content.Server.GameObjects.Components.Nutrition;
|
using Content.Server.GameObjects.Components.Nutrition;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
@@ -12,16 +14,19 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Chemistry
|
namespace Content.Server.GameObjects.Components.Chemistry
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shared ECS component that manages a liquid solution of reagents.
|
/// ECS component that manages a liquid solution of reagents.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
internal class SolutionComponent : Shared.GameObjects.Components.Chemistry.SolutionComponent, IExamine
|
internal class SolutionComponent : SharedSolutionComponent, IExamine
|
||||||
{
|
{
|
||||||
#pragma warning disable 649
|
#pragma warning disable 649
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||||
@@ -31,17 +36,93 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
|
|
||||||
private IEnumerable<ReactionPrototype> _reactions;
|
private IEnumerable<ReactionPrototype> _reactions;
|
||||||
private AudioSystem _audioSystem;
|
private AudioSystem _audioSystem;
|
||||||
|
private ChemistrySystem _chemistrySystem;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
protected Solution _containedSolution = new Solution();
|
||||||
|
protected int _maxVolume;
|
||||||
|
private SolutionCaps _capabilities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The maximum volume of the container.
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public int MaxVolume
|
||||||
|
{
|
||||||
|
get => _maxVolume;
|
||||||
|
set => _maxVolume = value; // Note that the contents won't spill out if the capacity is reduced.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The total volume of all the of the reagents in the container.
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables]
|
||||||
|
public int CurrentVolume => _containedSolution.TotalVolume;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The volume without reagents remaining in the container.
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables]
|
||||||
|
public int EmptyVolume => MaxVolume - CurrentVolume;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current blended color of all the reagents in the container.
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public Color SubstanceColor { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current capabilities of this container (is the top open to pour? can I inject it into another object?).
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public SolutionCaps Capabilities
|
||||||
|
{
|
||||||
|
get => _capabilities;
|
||||||
|
set => _capabilities = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IReadOnlyList<Solution.ReagentQuantity> ReagentList => _containedSolution.Contents;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shortcut for Capabilities PourIn flag to avoid binary operators.
|
||||||
|
/// </summary>
|
||||||
|
public bool CanPourIn => (Capabilities & SolutionCaps.PourIn) != 0;
|
||||||
|
/// <summary>
|
||||||
|
/// Shortcut for Capabilities PourOut flag to avoid binary operators.
|
||||||
|
/// </summary>
|
||||||
|
public bool CanPourOut => (Capabilities & SolutionCaps.PourOut) != 0;
|
||||||
|
/// <summary>
|
||||||
|
/// Shortcut for Capabilities Injectable flag
|
||||||
|
/// </summary>
|
||||||
|
public bool Injectable => (Capabilities & SolutionCaps.Injectable) != 0;
|
||||||
|
/// <summary>
|
||||||
|
/// Shortcut for Capabilities Injector flag
|
||||||
|
/// </summary>
|
||||||
|
public bool Injector => (Capabilities & SolutionCaps.Injector) != 0;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
|
{
|
||||||
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
|
serializer.DataField(ref _maxVolume, "maxVol", 0);
|
||||||
|
serializer.DataField(ref _containedSolution, "contents", _containedSolution);
|
||||||
|
serializer.DataField(ref _capabilities, "caps", SolutionCaps.None);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
_audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
||||||
|
_chemistrySystem = _entitySystemManager.GetEntitySystem<ChemistrySystem>();
|
||||||
|
_reactions = _prototypeManager.EnumeratePrototypes<ReactionPrototype>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Startup()
|
protected override void Startup()
|
||||||
{
|
{
|
||||||
base.Startup();
|
base.Startup();
|
||||||
Init();
|
RecalculateColor();
|
||||||
}
|
|
||||||
|
|
||||||
public void Init()
|
|
||||||
{
|
|
||||||
_reactions = _prototypeManager.EnumeratePrototypes<ReactionPrototype>();
|
|
||||||
_audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -54,6 +135,85 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
_reactions = _prototypeManager.EnumeratePrototypes<ReactionPrototype>();
|
_reactions = _prototypeManager.EnumeratePrototypes<ReactionPrototype>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Shutdown()
|
||||||
|
{
|
||||||
|
base.Shutdown();
|
||||||
|
|
||||||
|
_containedSolution.RemoveAllSolution();
|
||||||
|
_containedSolution = new Solution();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveAllSolution()
|
||||||
|
{
|
||||||
|
_containedSolution.RemoveAllSolution();
|
||||||
|
OnSolutionChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryRemoveReagent(string reagentId, int quantity)
|
||||||
|
{
|
||||||
|
if (!ContainsReagent(reagentId, out var currentQuantity)) return false;
|
||||||
|
|
||||||
|
_containedSolution.RemoveReagent(reagentId, quantity);
|
||||||
|
OnSolutionChanged();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempt to remove the specified quantity from this solution
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="quantity">Quantity of this solution to remove</param>
|
||||||
|
/// <returns>Whether or not the solution was successfully removed</returns>
|
||||||
|
public bool TryRemoveSolution(int quantity)
|
||||||
|
{
|
||||||
|
if (CurrentVolume == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
_containedSolution.RemoveSolution(quantity);
|
||||||
|
OnSolutionChanged();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Solution SplitSolution(int quantity)
|
||||||
|
{
|
||||||
|
var solutionSplit = _containedSolution.SplitSolution(quantity);
|
||||||
|
OnSolutionChanged();
|
||||||
|
return solutionSplit;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void RecalculateColor()
|
||||||
|
{
|
||||||
|
if(_containedSolution.TotalVolume == 0)
|
||||||
|
SubstanceColor = Color.White;
|
||||||
|
|
||||||
|
Color mixColor = default;
|
||||||
|
float runningTotalQuantity = 0;
|
||||||
|
|
||||||
|
foreach (var reagent in _containedSolution)
|
||||||
|
{
|
||||||
|
runningTotalQuantity += reagent.Quantity;
|
||||||
|
|
||||||
|
if(!_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (mixColor == default)
|
||||||
|
mixColor = proto.SubstanceColor;
|
||||||
|
|
||||||
|
mixColor = BlendRGB(mixColor, proto.SubstanceColor, reagent.Quantity / runningTotalQuantity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color BlendRGB(Color rgb1, Color rgb2, float amount)
|
||||||
|
{
|
||||||
|
var r = (float)Math.Round(rgb1.R + (rgb2.R - rgb1.R) * amount, 1);
|
||||||
|
var g = (float)Math.Round(rgb1.G + (rgb2.G - rgb1.G) * amount, 1);
|
||||||
|
var b = (float)Math.Round(rgb1.B + (rgb2.B - rgb1.B) * amount, 1);
|
||||||
|
var alpha = (float)Math.Round(rgb1.A + (rgb2.A - rgb1.A) * amount, 1);
|
||||||
|
|
||||||
|
return new Color(r, g, b, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Transfers solution from the held container to the target container.
|
/// Transfers solution from the held container to the target container.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -121,6 +281,10 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
void IExamine.Examine(FormattedMessage message)
|
void IExamine.Examine(FormattedMessage message)
|
||||||
{
|
{
|
||||||
message.AddText(_loc.GetString("Contains:\n"));
|
message.AddText(_loc.GetString("Contains:\n"));
|
||||||
|
if (ReagentList.Count == 0)
|
||||||
|
{
|
||||||
|
message.AddText("Nothing.\n");
|
||||||
|
}
|
||||||
foreach (var reagent in ReagentList)
|
foreach (var reagent in ReagentList)
|
||||||
{
|
{
|
||||||
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto))
|
if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto))
|
||||||
@@ -256,7 +420,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
}
|
}
|
||||||
if(!skipReactionCheck)
|
if(!skipReactionCheck)
|
||||||
CheckForReaction();
|
CheckForReaction();
|
||||||
OnSolutionChanged();
|
_chemistrySystem.HandleSolutionChange(Owner);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,5 +488,37 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
|||||||
//Play reaction sound client-side
|
//Play reaction sound client-side
|
||||||
_audioSystem.Play("/Audio/effects/chemistry/bubbles.ogg", Owner.Transform.GridPosition);
|
_audioSystem.Play("/Audio/effects/chemistry/bubbles.ogg", Owner.Transform.GridPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the solution contains the specified reagent.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reagentId">The reagent to check for.</param>
|
||||||
|
/// <param name="quantity">Output the quantity of the reagent if it is contained, 0 if it isn't.</param>
|
||||||
|
/// <returns>Return true if the solution contains the reagent.</returns>
|
||||||
|
public bool ContainsReagent(string reagentId, out int quantity)
|
||||||
|
{
|
||||||
|
foreach (var reagent in _containedSolution.Contents)
|
||||||
|
{
|
||||||
|
if (reagent.ReagentId == reagentId)
|
||||||
|
{
|
||||||
|
quantity = reagent.Quantity;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
quantity = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetMajorReagentId()
|
||||||
|
{
|
||||||
|
if (_containedSolution.Contents.Count == 0)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
var majorReagent = _containedSolution.Contents.OrderByDescending(reagent => reagent.Quantity).First();;
|
||||||
|
return majorReagent.ReagentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnSolutionChanged() => _chemistrySystem.HandleSolutionChange(Owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using Content.Shared.Chemistry;
|
||||||
|
using ICSharpCode.SharpZipLib.Zip.Compression;
|
||||||
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects.Components;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
|
namespace Content.Server.GameObjects.Components.Chemistry
|
||||||
|
{
|
||||||
|
[RegisterComponent]
|
||||||
|
public class TransformableContainerComponent : Component, ISolutionChange
|
||||||
|
{
|
||||||
|
#pragma warning disable 649
|
||||||
|
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||||
|
#pragma warning restore 649
|
||||||
|
|
||||||
|
public override string Name => "TransformableContainer";
|
||||||
|
|
||||||
|
private SpriteSpecifier _initialSprite;
|
||||||
|
private string _initialName;
|
||||||
|
private string _initialDescription;
|
||||||
|
private SpriteComponent _sprite;
|
||||||
|
|
||||||
|
private ReagentPrototype _currentReagent;
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
|
||||||
|
_sprite = Owner.GetComponent<SpriteComponent>();
|
||||||
|
_initialSprite = new SpriteSpecifier.Rsi(new ResourcePath(_sprite.BaseRSIPath), "icon");
|
||||||
|
_initialName = Owner.Name;
|
||||||
|
_initialDescription = Owner.Description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CancelTransformation()
|
||||||
|
{
|
||||||
|
_currentReagent = null;
|
||||||
|
_sprite.LayerSetSprite(0, _initialSprite);
|
||||||
|
Owner.Name = _initialName;
|
||||||
|
Owner.Description = _initialDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ISolutionChange.SolutionChanged(SolutionChangeEventArgs eventArgs)
|
||||||
|
{
|
||||||
|
var solution = eventArgs.Owner.GetComponent<SolutionComponent>();
|
||||||
|
|
||||||
|
//Transform container into initial state when emptied
|
||||||
|
if (_currentReagent != null && solution.ReagentList.Count == 0)
|
||||||
|
{
|
||||||
|
CancelTransformation();
|
||||||
|
}
|
||||||
|
|
||||||
|
//the biggest reagent in the solution decides the appearance
|
||||||
|
var reagentId = solution.GetMajorReagentId();
|
||||||
|
|
||||||
|
//If biggest reagent didn't changed - don't change anything at all
|
||||||
|
if (_currentReagent != null && _currentReagent.ID == reagentId)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Only reagents with spritePath property can change appearance of transformable containers!
|
||||||
|
if (!string.IsNullOrWhiteSpace(reagentId) &&
|
||||||
|
_prototypeManager.TryIndex(reagentId, out ReagentPrototype proto) &&
|
||||||
|
!string.IsNullOrWhiteSpace(proto.SpriteReplacementPath))
|
||||||
|
{
|
||||||
|
var spriteSpec = new SpriteSpecifier.Rsi(new ResourcePath("Objects/Drinks/" + proto.SpriteReplacementPath),"icon");
|
||||||
|
_sprite.LayerSetSprite(0, spriteSpec);
|
||||||
|
Owner.Name = proto.Name;
|
||||||
|
Owner.Description = proto.Description;
|
||||||
|
_currentReagent = proto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -47,16 +47,11 @@ namespace Content.Server.GameObjects.Components.Metabolism
|
|||||||
serializer.DataField(ref _initialMaxVolume, "maxVolume", 250);
|
serializer.DataField(ref _initialMaxVolume, "maxVolume", 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Initialize()
|
protected override void Startup()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Startup();
|
||||||
|
_internalSolution = Owner.GetComponent<SolutionComponent>();
|
||||||
//Create and setup internal solution storage
|
|
||||||
_internalSolution = new SolutionComponent();
|
|
||||||
_internalSolution.InitializeFromPrototype();
|
|
||||||
_internalSolution.Init();
|
|
||||||
_internalSolution.MaxVolume = _initialMaxVolume;
|
_internalSolution.MaxVolume = _initialMaxVolume;
|
||||||
_internalSolution.Owner = Owner; //Manually set owner to avoid crash when VV'ing this
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using Robust.Shared.ViewVariables;
|
|||||||
namespace Content.Server.GameObjects.Components.Nutrition
|
namespace Content.Server.GameObjects.Components.Nutrition
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class DrinkComponent : Component, IAfterAttack, IUse
|
public class DrinkComponent : Component, IAfterAttack, IUse, ISolutionChange
|
||||||
{
|
{
|
||||||
#pragma warning disable 649
|
#pragma warning disable 649
|
||||||
[Dependency] private readonly ILocalizationManager _localizationManager;
|
[Dependency] private readonly ILocalizationManager _localizationManager;
|
||||||
@@ -42,9 +42,6 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
set => _contents.MaxVolume = value;
|
set => _contents.MaxVolume = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Solution _initialContents; // This is just for loading from yaml
|
|
||||||
private int _maxVolume;
|
|
||||||
|
|
||||||
private bool _despawnOnFinish;
|
private bool _despawnOnFinish;
|
||||||
|
|
||||||
private bool _drinking;
|
private bool _drinking;
|
||||||
@@ -63,53 +60,21 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
public override void ExposeData(ObjectSerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
serializer.DataField(ref _initialContents, "contents", null);
|
|
||||||
serializer.DataField(ref _maxVolume, "max_volume", 0);
|
|
||||||
serializer.DataField(ref _useSound, "use_sound", "/Audio/items/drink.ogg");
|
serializer.DataField(ref _useSound, "use_sound", "/Audio/items/drink.ogg");
|
||||||
// E.g. cola can when done or clear bottle, whatever
|
// E.g. cola can when done or clear bottle, whatever
|
||||||
// Currently this will enforce it has the same volume but this may change.
|
// Currently this will enforce it has the same volume but this may change. - TODO: this should be implemented in a separate component
|
||||||
serializer.DataField(ref _despawnOnFinish, "despawn_empty", true);
|
serializer.DataField(ref _despawnOnFinish, "despawn_empty", false);
|
||||||
serializer.DataField(ref _finishPrototype, "spawn_on_finish", null);
|
serializer.DataField(ref _finishPrototype, "spawn_on_finish", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Initialize()
|
|
||||||
{
|
|
||||||
base.Initialize();
|
|
||||||
if (_contents == null)
|
|
||||||
{
|
|
||||||
if (Owner.TryGetComponent(out SolutionComponent solutionComponent))
|
|
||||||
{
|
|
||||||
_contents = solutionComponent;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_contents = Owner.AddComponent<SolutionComponent>();
|
|
||||||
//Ensure SolutionComponent supports click transferring if custom one not set
|
|
||||||
_contents.Capabilities = SolutionCaps.PourIn
|
|
||||||
| SolutionCaps.PourOut
|
|
||||||
| SolutionCaps.Injectable;
|
|
||||||
|
|
||||||
var pourable = Owner.AddComponent<PourableComponent>();
|
|
||||||
pourable.TransferAmount = 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_drinking = false;
|
|
||||||
if (_maxVolume != 0)
|
|
||||||
_contents.MaxVolume = _maxVolume;
|
|
||||||
else
|
|
||||||
_contents.MaxVolume = _initialContents.TotalVolume;
|
|
||||||
_contents.SolutionChanged += HandleSolutionChangedEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Startup()
|
protected override void Startup()
|
||||||
{
|
{
|
||||||
base.Startup();
|
base.Startup();
|
||||||
if (_initialContents != null)
|
_contents = Owner.GetComponent<SolutionComponent>();
|
||||||
{
|
_contents.Capabilities = SolutionCaps.PourIn
|
||||||
_contents.TryAddSolution(_initialContents, true, true);
|
| SolutionCaps.PourOut
|
||||||
}
|
| SolutionCaps.Injectable;
|
||||||
_initialContents = null;
|
_drinking = false;
|
||||||
Owner.TryGetComponent(out AppearanceComponent appearance);
|
Owner.TryGetComponent(out AppearanceComponent appearance);
|
||||||
_appearanceComponent = appearance;
|
_appearanceComponent = appearance;
|
||||||
_appearanceComponent?.SetData(SharedFoodComponent.FoodVisuals.MaxUses, MaxVolume);
|
_appearanceComponent?.SetData(SharedFoodComponent.FoodVisuals.MaxUses, MaxVolume);
|
||||||
@@ -168,7 +133,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
_drinking = false;
|
_drinking = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Finish(user);
|
//Finish(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -177,14 +142,15 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
/// or convert it to another entity, like an empty variant.
|
/// or convert it to another entity, like an empty variant.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user">The entity that is using the drink</param>
|
/// <param name="user">The entity that is using the drink</param>
|
||||||
public void Finish(IEntity user)
|
/*
|
||||||
|
public void Finish(IEntity user)
|
||||||
{
|
{
|
||||||
// Drink containers are mostly transient.
|
// Drink containers are mostly transient.
|
||||||
|
// are you sure about that
|
||||||
if (_drinking || !_despawnOnFinish || UsesLeft() > 0)
|
if (_drinking || !_despawnOnFinish || UsesLeft() > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var gridPos = Owner.Transform.GridPosition;
|
var gridPos = Owner.Transform.GridPosition;
|
||||||
_contents.SolutionChanged -= HandleSolutionChangedEvent;
|
|
||||||
Owner.Delete();
|
Owner.Delete();
|
||||||
|
|
||||||
if (_finishPrototype == null || user == null)
|
if (_finishPrototype == null || user == null)
|
||||||
@@ -205,16 +171,8 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
{
|
{
|
||||||
drinkComponent.MaxVolume = MaxVolume;
|
drinkComponent.MaxVolume = MaxVolume;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/// <summary>
|
void ISolutionChange.SolutionChanged(SolutionChangeEventArgs eventArgs) { } //Finish(null);
|
||||||
/// Updates drink state when the solution is changed by something other
|
|
||||||
/// than this component. Without this some drinks won't properly delete
|
|
||||||
/// themselves without additional clicks/uses after them being emptied.
|
|
||||||
/// </summary>
|
|
||||||
private void HandleSolutionChangedEvent()
|
|
||||||
{
|
|
||||||
Finish(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,22 +68,15 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
serializer.DataField(ref _digestionDelay, "digestionDelay", 20);
|
serializer.DataField(ref _digestionDelay, "digestionDelay", 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Startup()
|
||||||
public override void Initialize()
|
|
||||||
{
|
{
|
||||||
base.Initialize();
|
_stomachContents = Owner.GetComponent<SolutionComponent>();
|
||||||
//Doesn't use Owner.AddComponent<>() to avoid cross-contamination (e.g. with blood or whatever they holds other solutions)
|
|
||||||
_stomachContents = new SolutionComponent();
|
|
||||||
_stomachContents.InitializeFromPrototype();
|
|
||||||
_stomachContents.MaxVolume = _initialMaxVolume;
|
_stomachContents.MaxVolume = _initialMaxVolume;
|
||||||
_stomachContents.Owner = Owner; //Manually set owner to avoid crash when VV'ing this
|
|
||||||
|
|
||||||
//Ensure bloodstream in present
|
|
||||||
if (!Owner.TryGetComponent<BloodstreamComponent>(out _bloodstream))
|
if (!Owner.TryGetComponent<BloodstreamComponent>(out _bloodstream))
|
||||||
{
|
{
|
||||||
Logger.Warning(_localizationManager.GetString(
|
Logger.Warning(_localizationManager.GetString(
|
||||||
"StomachComponent entity does not have a BloodstreamComponent, which is required for it to function. Owner entity name: {0}",
|
"StomachComponent entity does not have a BloodstreamComponent, which is required for it to function. Owner entity name: {0}",
|
||||||
Owner.Name));
|
Owner.Name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
42
Content.Server/GameObjects/EntitySystems/ChemistrySystem.cs
Normal file
42
Content.Server/GameObjects/EntitySystems/ChemistrySystem.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
|
||||||
|
namespace Content.Server.GameObjects.EntitySystems
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This interface gives components behavior on whether entities solution (implying SolutionComponent is in place) is changed
|
||||||
|
/// </summary>
|
||||||
|
public interface ISolutionChange
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Called when solution is mixed with some other solution, or when some part of the solution is removed
|
||||||
|
/// </summary>
|
||||||
|
void SolutionChanged(SolutionChangeEventArgs eventArgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SolutionChangeEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public IEntity Owner { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[UsedImplicitly]
|
||||||
|
public class ChemistrySystem : EntitySystem
|
||||||
|
{
|
||||||
|
public void HandleSolutionChange(IEntity owner)
|
||||||
|
{
|
||||||
|
var eventArgs = new SolutionChangeEventArgs
|
||||||
|
{
|
||||||
|
Owner = owner,
|
||||||
|
};
|
||||||
|
var solutionChangeArgs = owner.GetAllComponents<ISolutionChange>().ToList();
|
||||||
|
|
||||||
|
foreach (var solutionChangeArg in solutionChangeArgs)
|
||||||
|
{
|
||||||
|
solutionChangeArg.SolutionChanged(eventArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,6 +21,7 @@ namespace Content.Shared.Chemistry
|
|||||||
private string _description;
|
private string _description;
|
||||||
private Color _substanceColor;
|
private Color _substanceColor;
|
||||||
private List<IMetabolizable> _metabolism;
|
private List<IMetabolizable> _metabolism;
|
||||||
|
private string _spritePath;
|
||||||
|
|
||||||
public string ID => _id;
|
public string ID => _id;
|
||||||
public string Name => _name;
|
public string Name => _name;
|
||||||
@@ -29,6 +30,8 @@ namespace Content.Shared.Chemistry
|
|||||||
//List of metabolism effects this reagent has, should really only be used server-side.
|
//List of metabolism effects this reagent has, should really only be used server-side.
|
||||||
public List<IMetabolizable> Metabolism => _metabolism;
|
public List<IMetabolizable> Metabolism => _metabolism;
|
||||||
|
|
||||||
|
public string SpriteReplacementPath => _spritePath;
|
||||||
|
|
||||||
public ReagentPrototype()
|
public ReagentPrototype()
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
@@ -42,6 +45,7 @@ namespace Content.Shared.Chemistry
|
|||||||
serializer.DataField(ref _name, "name", string.Empty);
|
serializer.DataField(ref _name, "name", string.Empty);
|
||||||
serializer.DataField(ref _description, "desc", string.Empty);
|
serializer.DataField(ref _description, "desc", string.Empty);
|
||||||
serializer.DataField(ref _substanceColor, "color", Color.White);
|
serializer.DataField(ref _substanceColor, "color", Color.White);
|
||||||
|
serializer.DataField(ref _spritePath, "spritePath", string.Empty);
|
||||||
|
|
||||||
if (_moduleManager.IsServerModule)
|
if (_moduleManager.IsServerModule)
|
||||||
serializer.DataField(ref _metabolism, "metabolism", new List<IMetabolizable> {new DefaultMetabolizable()});
|
serializer.DataField(ref _metabolism, "metabolism", new List<IMetabolizable> {new DefaultMetabolizable()});
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Content.Shared.Chemistry;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Maths;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
|
namespace Content.Shared.GameObjects.Components.Chemistry
|
||||||
|
{
|
||||||
|
public class SharedSolutionComponent : Component
|
||||||
|
{
|
||||||
|
public override string Name => "Solution";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public sealed override uint? NetID => ContentNetIDs.SOLUTION;
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public class SolutionComponentState : ComponentState
|
||||||
|
{
|
||||||
|
public SolutionComponentState() : base(ContentNetIDs.SOLUTION) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override ComponentState GetComponentState()
|
||||||
|
{
|
||||||
|
return new SolutionComponentState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||||
|
{
|
||||||
|
base.HandleComponentState(curState, nextState);
|
||||||
|
|
||||||
|
if(curState == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var compState = (SolutionComponentState)curState;
|
||||||
|
|
||||||
|
//TODO: Make me work!
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,238 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Content.Shared.Chemistry;
|
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
using Robust.Shared.ViewVariables;
|
|
||||||
|
|
||||||
namespace Content.Shared.GameObjects.Components.Chemistry
|
|
||||||
{
|
|
||||||
public class SolutionComponent : Component
|
|
||||||
{
|
|
||||||
#pragma warning disable 649
|
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
|
||||||
#pragma warning restore 649
|
|
||||||
|
|
||||||
[ViewVariables]
|
|
||||||
protected Solution _containedSolution = new Solution();
|
|
||||||
protected int _maxVolume;
|
|
||||||
private SolutionCaps _capabilities;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Triggered when the solution contents change.
|
|
||||||
/// </summary>
|
|
||||||
public event Action SolutionChanged;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The maximum volume of the container.
|
|
||||||
/// </summary>
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
public int MaxVolume
|
|
||||||
{
|
|
||||||
get => _maxVolume;
|
|
||||||
set => _maxVolume = value; // Note that the contents won't spill out if the capacity is reduced.
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The total volume of all the of the reagents in the container.
|
|
||||||
/// </summary>
|
|
||||||
[ViewVariables]
|
|
||||||
public int CurrentVolume => _containedSolution.TotalVolume;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The volume without reagents remaining in the container.
|
|
||||||
/// </summary>
|
|
||||||
[ViewVariables]
|
|
||||||
public int EmptyVolume => MaxVolume - CurrentVolume;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The current blended color of all the reagents in the container.
|
|
||||||
/// </summary>
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
public Color SubstanceColor { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The current capabilities of this container (is the top open to pour? can I inject it into another object?).
|
|
||||||
/// </summary>
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
public SolutionCaps Capabilities
|
|
||||||
{
|
|
||||||
get => _capabilities;
|
|
||||||
set => _capabilities = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IReadOnlyList<Solution.ReagentQuantity> ReagentList => _containedSolution.Contents;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Shortcut for Capabilities PourIn flag to avoid binary operators.
|
|
||||||
/// </summary>
|
|
||||||
public bool CanPourIn => (Capabilities & SolutionCaps.PourIn) != 0;
|
|
||||||
/// <summary>
|
|
||||||
/// Shortcut for Capabilities PourOut flag to avoid binary operators.
|
|
||||||
/// </summary>
|
|
||||||
public bool CanPourOut => (Capabilities & SolutionCaps.PourOut) != 0;
|
|
||||||
/// <summary>
|
|
||||||
/// Shortcut for Capabilities Injectable flag
|
|
||||||
/// </summary>
|
|
||||||
public bool Injectable => (Capabilities & SolutionCaps.Injectable) != 0;
|
|
||||||
/// <summary>
|
|
||||||
/// Shortcut for Capabilities Injector flag
|
|
||||||
/// </summary>
|
|
||||||
public bool Injector => (Capabilities & SolutionCaps.Injector) != 0;
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override string Name => "Solution";
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public sealed override uint? NetID => ContentNetIDs.SOLUTION;
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
base.ExposeData(serializer);
|
|
||||||
|
|
||||||
serializer.DataField(ref _maxVolume, "maxVol", 0);
|
|
||||||
serializer.DataField(ref _containedSolution, "contents", _containedSolution);
|
|
||||||
serializer.DataField(ref _capabilities, "caps", SolutionCaps.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Startup()
|
|
||||||
{
|
|
||||||
base.Startup();
|
|
||||||
|
|
||||||
RecalculateColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Shutdown()
|
|
||||||
{
|
|
||||||
base.Shutdown();
|
|
||||||
|
|
||||||
_containedSolution.RemoveAllSolution();
|
|
||||||
_containedSolution = new Solution();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveAllSolution()
|
|
||||||
{
|
|
||||||
_containedSolution.RemoveAllSolution();
|
|
||||||
OnSolutionChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TryRemoveReagent(string reagentId, int quantity)
|
|
||||||
{
|
|
||||||
if (!ContainsReagent(reagentId, out var currentQuantity)) return false;
|
|
||||||
|
|
||||||
_containedSolution.RemoveReagent(reagentId, quantity);
|
|
||||||
OnSolutionChanged();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attempt to remove the specified quantity from this solution
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="quantity">Quantity of this solution to remove</param>
|
|
||||||
/// <returns>Whether or not the solution was successfully removed</returns>
|
|
||||||
public bool TryRemoveSolution(int quantity)
|
|
||||||
{
|
|
||||||
if (CurrentVolume == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
_containedSolution.RemoveSolution(quantity);
|
|
||||||
OnSolutionChanged();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Solution SplitSolution(int quantity)
|
|
||||||
{
|
|
||||||
var solutionSplit = _containedSolution.SplitSolution(quantity);
|
|
||||||
OnSolutionChanged();
|
|
||||||
return solutionSplit;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void RecalculateColor()
|
|
||||||
{
|
|
||||||
if(_containedSolution.TotalVolume == 0)
|
|
||||||
SubstanceColor = Color.White;
|
|
||||||
|
|
||||||
Color mixColor = default;
|
|
||||||
float runningTotalQuantity = 0;
|
|
||||||
|
|
||||||
foreach (var reagent in _containedSolution)
|
|
||||||
{
|
|
||||||
runningTotalQuantity += reagent.Quantity;
|
|
||||||
|
|
||||||
if(!_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (mixColor == default)
|
|
||||||
mixColor = proto.SubstanceColor;
|
|
||||||
|
|
||||||
mixColor = BlendRGB(mixColor, proto.SubstanceColor, reagent.Quantity / runningTotalQuantity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color BlendRGB(Color rgb1, Color rgb2, float amount)
|
|
||||||
{
|
|
||||||
var r = (float)Math.Round(rgb1.R + (rgb2.R - rgb1.R) * amount, 1);
|
|
||||||
var g = (float)Math.Round(rgb1.G + (rgb2.G - rgb1.G) * amount, 1);
|
|
||||||
var b = (float)Math.Round(rgb1.B + (rgb2.B - rgb1.B) * amount, 1);
|
|
||||||
var alpha = (float)Math.Round(rgb1.A + (rgb2.A - rgb1.A) * amount, 1);
|
|
||||||
|
|
||||||
return new Color(r, g, b, alpha);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override ComponentState GetComponentState()
|
|
||||||
{
|
|
||||||
return new SolutionComponentState();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
|
||||||
{
|
|
||||||
base.HandleComponentState(curState, nextState);
|
|
||||||
|
|
||||||
if(curState == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var compState = (SolutionComponentState)curState;
|
|
||||||
|
|
||||||
//TODO: Make me work!
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
|
||||||
public class SolutionComponentState : ComponentState
|
|
||||||
{
|
|
||||||
public SolutionComponentState() : base(ContentNetIDs.SOLUTION) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if the solution contains the specified reagent.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="reagentId">The reagent to check for.</param>
|
|
||||||
/// <param name="quantity">Output the quantity of the reagent if it is contained, 0 if it isn't.</param>
|
|
||||||
/// <returns>Return true if the solution contains the reagent.</returns>
|
|
||||||
public bool ContainsReagent(string reagentId, out int quantity)
|
|
||||||
{
|
|
||||||
foreach (var reagent in _containedSolution.Contents)
|
|
||||||
{
|
|
||||||
if (reagent.ReagentId == reagentId)
|
|
||||||
{
|
|
||||||
quantity = reagent.Quantity;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
quantity = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnSolutionChanged()
|
|
||||||
{
|
|
||||||
SolutionChanged?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -18,3 +18,7 @@
|
|||||||
- chem.Ale
|
- chem.Ale
|
||||||
- chem.Wine
|
- chem.Wine
|
||||||
- chem.Ice
|
- chem.Ice
|
||||||
|
- chem.Beer
|
||||||
|
- chem.Vodka
|
||||||
|
- chem.Cognac
|
||||||
|
- chem.Kahlua
|
||||||
|
|||||||
@@ -37,3 +37,4 @@
|
|||||||
- chem.K
|
- chem.K
|
||||||
- chem.Ra
|
- chem.Ra
|
||||||
- chem.Na
|
- chem.Na
|
||||||
|
- chem.U
|
||||||
|
|||||||
@@ -19,3 +19,4 @@
|
|||||||
- chem.Tea
|
- chem.Tea
|
||||||
- chem.Ice
|
- chem.Ice
|
||||||
- chem.H2O
|
- chem.H2O
|
||||||
|
- chem.Cream
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -5,12 +5,6 @@
|
|||||||
description: One sip of this and you just know you're gonna have a good time.
|
description: One sip of this and you just know you're gonna have a good time.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
max_volume: 10
|
|
||||||
spawn_on_finish: DrinkBottleAbsinthe
|
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 10
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/absinthebottle.rsi
|
sprite: Objects/Drinks/absinthebottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -23,12 +17,6 @@
|
|||||||
description: A bottle of 46 proof Emeraldine Melon Liquor. Sweet and light.
|
description: A bottle of 46 proof Emeraldine Melon Liquor. Sweet and light.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
max_volume: 10
|
|
||||||
spawn_on_finish: DrinkBottleAlcoClear
|
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 10
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/alco-green.rsi
|
sprite: Objects/Drinks/alco-green.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -40,13 +28,12 @@
|
|||||||
name: Magm-Ale
|
name: Magm-Ale
|
||||||
description: A true dorf's drink of choice.
|
description: A true dorf's drink of choice.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 10
|
maxVol: 80
|
||||||
spawn_on_finish: DrinkBottleAle
|
|
||||||
contents:
|
contents:
|
||||||
reagents:
|
reagents:
|
||||||
- ReagentId: chem.H2O
|
- ReagentId: chem.Ale
|
||||||
Quantity: 10
|
Quantity: 80
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/alebottle.rsi
|
sprite: Objects/Drinks/alebottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -59,12 +46,6 @@
|
|||||||
description: A bottle filled with nothing
|
description: A bottle filled with nothing
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
max_volume: 10
|
|
||||||
spawn_on_finish: DrinkBottleAlcoClear
|
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 10
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/bottleofnothing.rsi
|
sprite: Objects/Drinks/bottleofnothing.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -76,13 +57,12 @@
|
|||||||
name: Cognac bottle
|
name: Cognac bottle
|
||||||
description: A sweet and strongly alchoholic drink, made after numerous distillations and years of maturing. You might as well not scream 'SHITCURITY' this time.
|
description: A sweet and strongly alchoholic drink, made after numerous distillations and years of maturing. You might as well not scream 'SHITCURITY' this time.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 10
|
maxVol: 80
|
||||||
spawn_on_finish: DrinkBottleCognac
|
|
||||||
contents:
|
contents:
|
||||||
reagents:
|
reagents:
|
||||||
- ReagentId: chem.H2O
|
- ReagentId: chem.Cognac
|
||||||
Quantity: 10
|
Quantity: 80
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/cognacbottle.rsi
|
sprite: Objects/Drinks/cognacbottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -95,12 +75,6 @@
|
|||||||
description: A bottle of high quality gin, produced in the New London Space Station.
|
description: A bottle of high quality gin, produced in the New London Space Station.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
max_volume: 10
|
|
||||||
spawn_on_finish: DrinkBottleGin
|
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 10
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/ginbottle.rsi
|
sprite: Objects/Drinks/ginbottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -113,12 +87,6 @@
|
|||||||
description: 100 proof cinnamon schnapps, made for alcoholic teen girls on spring break.
|
description: 100 proof cinnamon schnapps, made for alcoholic teen girls on spring break.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
max_volume: 10
|
|
||||||
spawn_on_finish: DrinkBottleGoldschlager
|
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 10
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/goldschlagerbottle.rsi
|
sprite: Objects/Drinks/goldschlagerbottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -130,13 +98,12 @@
|
|||||||
name: Kahlua bottle
|
name: Kahlua bottle
|
||||||
description: A widely known, Mexican coffee-flavoured liqueur. In production since 1936, HONK
|
description: A widely known, Mexican coffee-flavoured liqueur. In production since 1936, HONK
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 10
|
maxVol: 80
|
||||||
spawn_on_finish: DrinkBottleKahlua
|
|
||||||
contents:
|
contents:
|
||||||
reagents:
|
reagents:
|
||||||
- ReagentId: chem.H2O
|
- ReagentId: chem.H2O
|
||||||
Quantity: 10
|
Quantity: 80
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/kahluabottle.rsi
|
sprite: Objects/Drinks/kahluabottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -149,12 +116,6 @@
|
|||||||
description: Silver laced tequilla, served in space night clubs across the galaxy.
|
description: Silver laced tequilla, served in space night clubs across the galaxy.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
max_volume: 10
|
|
||||||
spawn_on_finish: DrinkBottlePatron
|
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 10
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/patronbottle.rsi
|
sprite: Objects/Drinks/patronbottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -167,12 +128,6 @@
|
|||||||
description: What a delightful packaging for a surely high quality wine! The vintage must be amazing!
|
description: What a delightful packaging for a surely high quality wine! The vintage must be amazing!
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
max_volume: 10
|
|
||||||
spawn_on_finish: DrinkBottlePoisonWine
|
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 10
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/pwinebottle.rsi
|
sprite: Objects/Drinks/pwinebottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -185,12 +140,6 @@
|
|||||||
description: This isn't just rum, oh no. It's practically GRIFF in a bottle.
|
description: This isn't just rum, oh no. It's practically GRIFF in a bottle.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
max_volume: 10
|
|
||||||
spawn_on_finish: DrinkBottleRum
|
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 10
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/rumbottle.rsi
|
sprite: Objects/Drinks/rumbottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -203,12 +152,6 @@
|
|||||||
description: Made from premium petroleum distillates, pure thalidomide and other fine quality ingredients!
|
description: Made from premium petroleum distillates, pure thalidomide and other fine quality ingredients!
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
max_volume: 10
|
|
||||||
spawn_on_finish: DrinkBottleTequila
|
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 10
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/tequillabottle.rsi
|
sprite: Objects/Drinks/tequillabottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -221,12 +164,6 @@
|
|||||||
description: Sweet, sweet dryness~
|
description: Sweet, sweet dryness~
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
max_volume: 10
|
|
||||||
spawn_on_finish: DrinkBottleVermouth
|
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 10
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/vermouthbottle.rsi
|
sprite: Objects/Drinks/vermouthbottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -238,13 +175,12 @@
|
|||||||
name: Vodka bottle
|
name: Vodka bottle
|
||||||
description: Aah, vodka. Prime choice of drink AND fuel by Russians worldwide.
|
description: Aah, vodka. Prime choice of drink AND fuel by Russians worldwide.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 10
|
maxVol: 80
|
||||||
spawn_on_finish: DrinkBottleVodka
|
|
||||||
contents:
|
contents:
|
||||||
reagents:
|
reagents:
|
||||||
- ReagentId: chem.H2O
|
- ReagentId: chem.Vodka
|
||||||
Quantity: 10
|
Quantity: 80
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/vodkabottle.rsi
|
sprite: Objects/Drinks/vodkabottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -256,13 +192,12 @@
|
|||||||
name: Uncle Git's special reserve
|
name: Uncle Git's special reserve
|
||||||
description: A premium single-malt whiskey, gently matured inside the tunnels of a nuclear shelter. TUNNEL WHISKEY RULES.
|
description: A premium single-malt whiskey, gently matured inside the tunnels of a nuclear shelter. TUNNEL WHISKEY RULES.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 10
|
maxVol: 80
|
||||||
spawn_on_finish: DrinkBottleWhiskey
|
|
||||||
contents:
|
contents:
|
||||||
reagents:
|
reagents:
|
||||||
- ReagentId: chem.H2O
|
- ReagentId: chem.Whiskey
|
||||||
Quantity: 10
|
Quantity: 80
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/whiskeybottle.rsi
|
sprite: Objects/Drinks/whiskeybottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -274,13 +209,12 @@
|
|||||||
name: Doublebearded bearded special wine bottle
|
name: Doublebearded bearded special wine bottle
|
||||||
description: A faint aura of unease and asspainery surrounds the bottle.
|
description: A faint aura of unease and asspainery surrounds the bottle.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 10
|
maxVol: 80
|
||||||
spawn_on_finish: DrinkBottleWine
|
|
||||||
contents:
|
contents:
|
||||||
reagents:
|
reagents:
|
||||||
- ReagentId: chem.H2O
|
- ReagentId: chem.Wine
|
||||||
Quantity: 10
|
Quantity: 80
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/winebottle.rsi
|
sprite: Objects/Drinks/winebottle.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
|
|||||||
@@ -30,11 +30,12 @@
|
|||||||
name: Space cola
|
name: Space cola
|
||||||
description: A refreshing beverage.
|
description: A refreshing beverage.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
|
maxVol: 20
|
||||||
contents:
|
contents:
|
||||||
reagents:
|
reagents:
|
||||||
- ReagentId: chem.H2O
|
- ReagentId: chem.Cola
|
||||||
Quantity: 4
|
Quantity: 20
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/cola.rsi
|
sprite: Objects/Drinks/cola.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -62,10 +63,6 @@
|
|||||||
description: ''
|
description: ''
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 4
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/ice_tea_can.rsi
|
sprite: Objects/Drinks/ice_tea_can.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -93,10 +90,6 @@
|
|||||||
description: You wanted ORANGE. It gave you Lemon Lime.
|
description: You wanted ORANGE. It gave you Lemon Lime.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 4
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/lemon-lime.rsi
|
sprite: Objects/Drinks/lemon-lime.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -124,10 +117,6 @@
|
|||||||
description: ''
|
description: ''
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 4
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/purple_can.rsi
|
sprite: Objects/Drinks/purple_can.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -155,10 +144,6 @@
|
|||||||
description: Blows right through you like a space wind.
|
description: Blows right through you like a space wind.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 4
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/space_mountain_wind.rsi
|
sprite: Objects/Drinks/space_mountain_wind.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -186,10 +171,6 @@
|
|||||||
description: Tastes like a hull breach in your mouth.
|
description: Tastes like a hull breach in your mouth.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 4
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/space-up.rsi
|
sprite: Objects/Drinks/space-up.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -217,10 +198,6 @@
|
|||||||
description: The taste of a star in liquid form. And, a bit of tuna...?
|
description: The taste of a star in liquid form. And, a bit of tuna...?
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 4
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/starkist.rsi
|
sprite: Objects/Drinks/starkist.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -248,10 +225,6 @@
|
|||||||
description: The MBO has advised crew members that consumption of Thirteen Loko may result in seizures, blindness, drunkeness, or even death. Please Drink Responsibly.
|
description: The MBO has advised crew members that consumption of Thirteen Loko may result in seizures, blindness, drunkeness, or even death. Please Drink Responsibly.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Drink
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 4
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/thirteen_loko.rsi
|
sprite: Objects/Drinks/thirteen_loko.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
|
|||||||
@@ -5,8 +5,11 @@
|
|||||||
name: Base cup
|
name: Base cup
|
||||||
abstract: true
|
abstract: true
|
||||||
components:
|
components:
|
||||||
|
- type: Solution
|
||||||
|
maxVol: 20
|
||||||
|
- type: Pourable
|
||||||
|
transferAmount: 5
|
||||||
- type: Drink
|
- type: Drink
|
||||||
max_volume: 4
|
|
||||||
despawn_empty: false
|
despawn_empty: false
|
||||||
- type: Sound
|
- type: Sound
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
@@ -20,8 +23,8 @@
|
|||||||
name: Golden cup
|
name: Golden cup
|
||||||
description: A golden cup
|
description: A golden cup
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 10
|
maxVol: 10
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/golden_cup.rsi
|
sprite: Objects/Drinks/golden_cup.rsi
|
||||||
- type: Icon
|
- type: Icon
|
||||||
@@ -33,8 +36,8 @@
|
|||||||
name: Insulated pitcher
|
name: Insulated pitcher
|
||||||
description: A stainless steel insulated pitcher. Everyone's best friend in the morning.
|
description: A stainless steel insulated pitcher. Everyone's best friend in the morning.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 15
|
maxVol: 15
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/pitcher.rsi
|
sprite: Objects/Drinks/pitcher.rsi
|
||||||
state: icon-6
|
state: icon-6
|
||||||
@@ -52,8 +55,8 @@
|
|||||||
name: Mug
|
name: Mug
|
||||||
description: A plain white mug.
|
description: A plain white mug.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 4
|
maxVol: 10
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/mug.rsi
|
sprite: Objects/Drinks/mug.rsi
|
||||||
state: icon-3
|
state: icon-3
|
||||||
@@ -71,8 +74,8 @@
|
|||||||
name: Mug Black
|
name: Mug Black
|
||||||
description: A sleek black mug.
|
description: A sleek black mug.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 4
|
maxVol: 10
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/mug_black.rsi
|
sprite: Objects/Drinks/mug_black.rsi
|
||||||
state: icon-3
|
state: icon-3
|
||||||
@@ -90,8 +93,8 @@
|
|||||||
name: Mug Blue
|
name: Mug Blue
|
||||||
description: A blue and black mug.
|
description: A blue and black mug.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 4
|
maxVol: 10
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/mug_blue.rsi
|
sprite: Objects/Drinks/mug_blue.rsi
|
||||||
state: icon-3
|
state: icon-3
|
||||||
@@ -109,8 +112,8 @@
|
|||||||
name: Mug Green
|
name: Mug Green
|
||||||
description: A pale green and pink mug.
|
description: A pale green and pink mug.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 4
|
maxVol: 10
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/mug_green.rsi
|
sprite: Objects/Drinks/mug_green.rsi
|
||||||
state: icon-3
|
state: icon-3
|
||||||
@@ -128,8 +131,8 @@
|
|||||||
name: Mug Heart
|
name: Mug Heart
|
||||||
description: A white mug, it prominently features a red heart.
|
description: A white mug, it prominently features a red heart.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 4
|
maxVol: 10
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/mug_heart.rsi
|
sprite: Objects/Drinks/mug_heart.rsi
|
||||||
state: icon-3
|
state: icon-3
|
||||||
@@ -147,8 +150,8 @@
|
|||||||
name: Mug Metal
|
name: Mug Metal
|
||||||
description: A metal mug. You're not sure which metal.
|
description: A metal mug. You're not sure which metal.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 4
|
maxVol: 10
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/mug_metal.rsi
|
sprite: Objects/Drinks/mug_metal.rsi
|
||||||
state: icon-3
|
state: icon-3
|
||||||
@@ -166,8 +169,8 @@
|
|||||||
name: Mug Moebius
|
name: Mug Moebius
|
||||||
description: A mug with a Moebius Laboratories logo on it. Not even your morning coffee is safe from corporate advertising.
|
description: A mug with a Moebius Laboratories logo on it. Not even your morning coffee is safe from corporate advertising.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 4
|
maxVol: 10
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/mug_moebius.rsi
|
sprite: Objects/Drinks/mug_moebius.rsi
|
||||||
state: icon-3
|
state: icon-3
|
||||||
@@ -185,8 +188,8 @@
|
|||||||
name: "#1 mug"
|
name: "#1 mug"
|
||||||
description: "A white mug, it prominently features a #1."
|
description: "A white mug, it prominently features a #1."
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 4
|
maxVol: 10
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/mug_one.rsi
|
sprite: Objects/Drinks/mug_one.rsi
|
||||||
state: icon-3
|
state: icon-3
|
||||||
@@ -204,8 +207,8 @@
|
|||||||
name: Mug Rainbow
|
name: Mug Rainbow
|
||||||
description: A rainbow mug. The colors are almost as blinding as a welder.
|
description: A rainbow mug. The colors are almost as blinding as a welder.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 4
|
maxVol: 10
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/mug_rainbow.rsi
|
sprite: Objects/Drinks/mug_rainbow.rsi
|
||||||
state: icon-3
|
state: icon-3
|
||||||
@@ -223,8 +226,8 @@
|
|||||||
name: Mug Red
|
name: Mug Red
|
||||||
description: A red and black mug.
|
description: A red and black mug.
|
||||||
components:
|
components:
|
||||||
- type: Drink
|
- type: Solution
|
||||||
max_volume: 4
|
maxVol: 10
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Drinks/mug_red.rsi
|
sprite: Objects/Drinks/mug_red.rsi
|
||||||
state: icon-3
|
state: icon-3
|
||||||
|
|||||||
@@ -10,13 +10,12 @@
|
|||||||
state: icon
|
state: icon
|
||||||
- type: Icon
|
- type: Icon
|
||||||
state: icon
|
state: icon
|
||||||
|
- type: Solution
|
||||||
|
maxVol: 10
|
||||||
|
- type: Pourable
|
||||||
|
transferAmount: 5
|
||||||
- type: Drink
|
- type: Drink
|
||||||
despawn_empty: false
|
despawn_empty: false
|
||||||
max_volume: 10
|
|
||||||
contents:
|
|
||||||
reagents:
|
|
||||||
- ReagentId: chem.H2O
|
|
||||||
Quantity: 0
|
|
||||||
|
|
||||||
# Containers
|
# Containers
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -89,19 +88,6 @@
|
|||||||
- type: Icon
|
- type: Icon
|
||||||
sprite: Objects/TrashDrinks/ginbottle_empty.rsi
|
sprite: Objects/TrashDrinks/ginbottle_empty.rsi
|
||||||
|
|
||||||
# Couldn't think of a nice place to put this
|
|
||||||
- type: entity
|
|
||||||
name: Empty glass
|
|
||||||
parent: DrinkBottleBase
|
|
||||||
id: DrinkEmptyGlass
|
|
||||||
components:
|
|
||||||
- type: Sprite
|
|
||||||
sprite: Objects/TrashDrinks/alebottle_empty.rsi
|
|
||||||
- type: Icon
|
|
||||||
sprite: Objects/TrashDrinks/alebottle_empty.rsi
|
|
||||||
- type: Solution
|
|
||||||
max_volume: 4
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: Goldschlager bottle
|
name: Goldschlager bottle
|
||||||
parent: DrinkBottleBase
|
parent: DrinkBottleBase
|
||||||
|
|||||||
@@ -14,11 +14,14 @@
|
|||||||
- type: Hunger
|
- type: Hunger
|
||||||
- type: Thirst
|
- type: Thirst
|
||||||
# Organs
|
# Organs
|
||||||
- type: Stomach
|
- type: Solution
|
||||||
maxVolume: 100
|
maxVol: 250
|
||||||
digestionDelay: 20
|
|
||||||
- type: Bloodstream
|
- type: Bloodstream
|
||||||
maxVolume: 250
|
max_volume: 100
|
||||||
|
- type: Stomach
|
||||||
|
max_volume: 250
|
||||||
|
digestionDelay: 20
|
||||||
|
|
||||||
|
|
||||||
- type: Inventory
|
- type: Inventory
|
||||||
- type: Constructor
|
- type: Constructor
|
||||||
|
|||||||
103
Resources/Prototypes/Reactions/drinks.yml
Normal file
103
Resources/Prototypes/Reactions/drinks.yml
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
- type: reaction
|
||||||
|
id: react.ManlyDorf
|
||||||
|
reactants:
|
||||||
|
chem.Beer:
|
||||||
|
amount: 1
|
||||||
|
chem.Ale:
|
||||||
|
amount: 2
|
||||||
|
products:
|
||||||
|
chem.ManlyDorf: 3
|
||||||
|
|
||||||
|
- type: reaction
|
||||||
|
id: react.CubaLibre
|
||||||
|
reactants:
|
||||||
|
chem.Cola:
|
||||||
|
amount: 1
|
||||||
|
chem.Rum:
|
||||||
|
amount: 2
|
||||||
|
products:
|
||||||
|
chem.CubaLibre: 3
|
||||||
|
|
||||||
|
- type: reaction
|
||||||
|
id: react.IrishCream
|
||||||
|
reactants:
|
||||||
|
chem.Cream:
|
||||||
|
amount: 1
|
||||||
|
chem.Whiskey:
|
||||||
|
amount: 2
|
||||||
|
products:
|
||||||
|
chem.IrishCream: 3
|
||||||
|
|
||||||
|
- type: reaction
|
||||||
|
id: react.IrishCoffee
|
||||||
|
reactants:
|
||||||
|
chem.IrishCream:
|
||||||
|
amount: 2
|
||||||
|
chem.Coffee:
|
||||||
|
amount: 2
|
||||||
|
products:
|
||||||
|
chem.IrishCoffee: 4
|
||||||
|
|
||||||
|
- type: reaction
|
||||||
|
id: react.IrishCarBomb
|
||||||
|
reactants:
|
||||||
|
chem.IrishCream:
|
||||||
|
amount: 1
|
||||||
|
chem.Ale:
|
||||||
|
amount: 1
|
||||||
|
products:
|
||||||
|
chem.IrishCarBomb: 2
|
||||||
|
|
||||||
|
- type: reaction
|
||||||
|
id: react.B52
|
||||||
|
reactants:
|
||||||
|
chem.IrishCarBomb:
|
||||||
|
amount: 1
|
||||||
|
chem.Kahlua:
|
||||||
|
amount: 1
|
||||||
|
chem.Cognac:
|
||||||
|
amount: 1
|
||||||
|
products:
|
||||||
|
chem.B52: 3
|
||||||
|
|
||||||
|
- type: reaction
|
||||||
|
id: react.AtomicBomb
|
||||||
|
reactants:
|
||||||
|
chem.B52:
|
||||||
|
amount: 10
|
||||||
|
chem.U:
|
||||||
|
amount: 1
|
||||||
|
products:
|
||||||
|
chem.AtomicBomb: 11
|
||||||
|
|
||||||
|
- type: reaction
|
||||||
|
id: react.WhiskeyCola
|
||||||
|
reactants:
|
||||||
|
chem.Whiskey:
|
||||||
|
amount: 2
|
||||||
|
chem.Cola:
|
||||||
|
amount: 1
|
||||||
|
products:
|
||||||
|
chem.WhiskeyCola: 3
|
||||||
|
|
||||||
|
- type: reaction
|
||||||
|
id: react.SyndicateBomb
|
||||||
|
reactants:
|
||||||
|
chem.WhiskeyCola:
|
||||||
|
amount: 1
|
||||||
|
chem.Beer:
|
||||||
|
amount: 1
|
||||||
|
products:
|
||||||
|
chem.SyndicateBomb: 2
|
||||||
|
|
||||||
|
- type: reaction
|
||||||
|
id: react.Antifreeze
|
||||||
|
reactants:
|
||||||
|
chem.Vodka:
|
||||||
|
amount: 2
|
||||||
|
chem.Cream:
|
||||||
|
amount: 1
|
||||||
|
chem.Ice:
|
||||||
|
amount: 1
|
||||||
|
products:
|
||||||
|
chem.Antifreeze: 4
|
||||||
@@ -2,16 +2,103 @@
|
|||||||
id: chem.Whiskey
|
id: chem.Whiskey
|
||||||
name: Whiskey
|
name: Whiskey
|
||||||
desc: An alcoholic beverage made from fermented grain mash
|
desc: An alcoholic beverage made from fermented grain mash
|
||||||
|
spritePath: whiskeyglass.rsi
|
||||||
|
|
||||||
- type: reagent
|
- type: reagent
|
||||||
id: chem.Ale
|
id: chem.Ale
|
||||||
name: Ale
|
name: Ale
|
||||||
desc: A type of beer brewed using a warm fermentation method, resulting in a sweet, full-bodied and fruity taste.
|
desc: A type of beer brewed using a warm fermentation method, resulting in a sweet, full-bodied and fruity taste.
|
||||||
|
spritePath: aleglass.rsi
|
||||||
|
|
||||||
- type: reagent
|
- type: reagent
|
||||||
id: chem.Wine
|
id: chem.Wine
|
||||||
name: Wine
|
name: Wine
|
||||||
desc: An alcoholic drink made from fermented grapes
|
desc: An alcoholic drink made from fermented grapes
|
||||||
|
spritePath: wineglass.rsi
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.Beer
|
||||||
|
name: Beer
|
||||||
|
desc: A cold pint of pale lager.
|
||||||
|
spritePath: beerglass.rsi
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.Vodka
|
||||||
|
name: Vodka
|
||||||
|
desc: The glass contain wodka. Xynta.
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.Kahlua
|
||||||
|
name: Kahlua
|
||||||
|
desc: A widely known, Mexican coffee-flavoured liqueur. In production since 1936!
|
||||||
|
spritePath: kahluaglass.rsi
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.Cognac
|
||||||
|
name: Cognac
|
||||||
|
desc: A sweet and strongly alcoholic drink, twice distilled and left to mature for several years. Classy as fornication.
|
||||||
|
spritePath: cognacglass.rsi
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.ManlyDorf
|
||||||
|
name: Manly Dorf
|
||||||
|
desc: A dwarfy concoction made from ale and beer. Intended for stout dwarves only.
|
||||||
|
spritePath: manlydorfglass.rsi
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.CubaLibre
|
||||||
|
name: Cuba Libre
|
||||||
|
desc: A classic mix of rum and cola.
|
||||||
|
spritePath: cubalibreglass.rsi
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.IrishCarBomb
|
||||||
|
name: Irish Car Bomb
|
||||||
|
desc: A troubling mixture of irish cream and ale.
|
||||||
|
spritePath: irishcarbomb.rsi
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.IrishCoffee
|
||||||
|
name: Irish Coffee
|
||||||
|
desc: Coffee served with irish cream. Regular cream just isn't the same!
|
||||||
|
spritePath: irishcoffeeglass.rsi
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.IrishCream
|
||||||
|
name: Irish Cream
|
||||||
|
desc: Whiskey-imbued cream. What else could you expect from the Irish.
|
||||||
|
spritePath: irishcreamglass.rsi
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.B52
|
||||||
|
name: B-52
|
||||||
|
desc: Coffee, irish cream, and cognac. You will get bombed.
|
||||||
|
spritePath: b52glass.rsi
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.AtomicBomb
|
||||||
|
name: Atomic Bomb
|
||||||
|
desc: Nuclear proliferation never tasted so good.
|
||||||
|
spritePath: atomicbombglass.rsi
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.WhiskeyCola
|
||||||
|
name: Whiskey Cola
|
||||||
|
desc: An innocent-looking mixture of cola and whiskey. Delicious.
|
||||||
|
spritePath: whiskeycolaglass.rsi
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.SyndicateBomb
|
||||||
|
name: Syndicate Bomb
|
||||||
|
desc: Somebody set us up the bomb!
|
||||||
|
spritePath: syndicatebomb.rsi
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.Antifreeze
|
||||||
|
name: Antifreeze
|
||||||
|
desc: The ultimate refreshment.
|
||||||
|
spritePath: antifreeze.rsi
|
||||||
|
|
||||||
|
|
||||||
- type: reagent
|
- type: reagent
|
||||||
id: chem.Cola
|
id: chem.Cola
|
||||||
@@ -36,3 +123,19 @@
|
|||||||
metabolism:
|
metabolism:
|
||||||
- !type:DefaultDrink
|
- !type:DefaultDrink
|
||||||
rate: 1
|
rate: 1
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.Cream
|
||||||
|
name: Cream
|
||||||
|
desc: The fatty, still liquid part of milk. Why don't you mix this with sum scotch, eh?
|
||||||
|
metabolism:
|
||||||
|
- !type:DefaultDrink
|
||||||
|
rate: 1
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.Milk
|
||||||
|
name: Milk
|
||||||
|
desc: An opaque white liquid produced by the mammary glands of mammals.
|
||||||
|
metabolism:
|
||||||
|
- !type:DefaultDrink
|
||||||
|
rate: 1
|
||||||
@@ -95,3 +95,9 @@
|
|||||||
name: Sodium
|
name: Sodium
|
||||||
desc: A silvery-white alkali metal. Highly reactive in it's pure form.
|
desc: A silvery-white alkali metal. Highly reactive in it's pure form.
|
||||||
color: "#c6c8cc"
|
color: "#c6c8cc"
|
||||||
|
|
||||||
|
- type: reagent
|
||||||
|
id: chem.U
|
||||||
|
name: Uranium
|
||||||
|
desc: A silvery-white metallic chemical element in the actinide series, weakly radioactive.
|
||||||
|
color: "#00ff06"
|
||||||
Reference in New Issue
Block a user