Merge branch 'master' into 2020-08-19-firelocks

This commit is contained in:
Víctor Aguilera Puerto
2020-09-11 19:54:12 +02:00
73 changed files with 1818 additions and 1519 deletions

View File

@@ -6,6 +6,7 @@ using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using YamlDotNet.RepresentationModel;
using System;
namespace Content.Shared.Chemistry
{
@@ -19,6 +20,7 @@ namespace Content.Shared.Chemistry
private string _id;
private string _name;
private string _description;
private string _physicalDescription;
private Color _substanceColor;
private List<IMetabolizable> _metabolism;
private string _spritePath;
@@ -26,7 +28,9 @@ namespace Content.Shared.Chemistry
public string ID => _id;
public string Name => _name;
public string Description => _description;
public string PhysicalDescription => _physicalDescription;
public Color SubstanceColor => _substanceColor;
//List of metabolism effects this reagent has, should really only be used server-side.
public List<IMetabolizable> Metabolism => _metabolism;
public string SpriteReplacementPath => _spritePath;
@@ -43,13 +47,36 @@ namespace Content.Shared.Chemistry
serializer.DataField(ref _id, "id", string.Empty);
serializer.DataField(ref _name, "name", string.Empty);
serializer.DataField(ref _description, "desc", string.Empty);
serializer.DataField(ref _physicalDescription, "physicalDesc", string.Empty);
serializer.DataField(ref _substanceColor, "color", Color.White);
serializer.DataField(ref _spritePath, "spritePath", string.Empty);
if (_moduleManager.IsServerModule)
serializer.DataField(ref _metabolism, "metabolism", new List<IMetabolizable> {new DefaultMetabolizable()});
{
serializer.DataField(ref _metabolism, "metabolism", new List<IMetabolizable> { new DefaultMetabolizable() });
}
else
{
_metabolism = new List<IMetabolizable> { new DefaultMetabolizable() };
}
}
/// <summary>
/// If the substance color is too dark we user a lighter version to make the text color readable when the user examines a solution.
/// </summary>
public Color GetSubstanceTextColor()
{
var highestValue = MathF.Max(SubstanceColor.R, MathF.Max(SubstanceColor.G, SubstanceColor.B));
var difference = 0.5f - highestValue;
if (difference > 0f)
{
return new Color(SubstanceColor.R + difference,
SubstanceColor.G + difference,
SubstanceColor.B + difference);
}
return SubstanceColor;
}
}
}

View File

@@ -246,7 +246,7 @@ namespace Content.Shared.Chemistry
}
[Serializable, NetSerializable]
public readonly struct ReagentQuantity
public readonly struct ReagentQuantity: IComparable<ReagentQuantity>
{
public readonly string ReagentId;
public readonly ReagentUnit Quantity;
@@ -262,6 +262,8 @@ namespace Content.Shared.Chemistry
{
return $"{ReagentId}:{Quantity}";
}
public int CompareTo(ReagentQuantity other) { return Quantity.Float().CompareTo(other.Quantity.Float()); }
}
#region Enumeration

View File

@@ -8,15 +8,19 @@ namespace Content.Shared.Chemistry
/// </summary>
[Flags]
[Serializable, NetSerializable]
public enum SolutionCaps
public enum SolutionContainerCaps
{
None = 0,
None = 0,
PourIn = 1,
PourOut = 2,
/// <summary>
/// Can solutions be added into the container?
/// </summary>
AddTo = 1,
Injector = 4,
Injectable = 8,
/// <summary>
/// Can solutions be removed from the container?
/// </summary>
RemoveFrom = 2,
/// <summary>
/// Allows the container to be placed in a <c>ReagentDispenserComponent</c>.
@@ -24,8 +28,11 @@ namespace Content.Shared.Chemistry
/// <para>Allows us to have obscenely large containers that are harder to abuse in chem dispensers
/// since they can't be placed directly in them.</para>
/// </summary>
FitsInDispenser = 16,
FitsInDispenser = 4,
NoExamine = 32,
/// <summary>
/// Can people examine the solution in the container or is it impossible to see?
/// </summary>
NoExamine = 8,
}
}

View File

@@ -4,9 +4,9 @@ using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Chemistry
{
public class SharedSolutionComponent : Component
public class SharedSolutionContainerComponent : Component
{
public override string Name => "Solution";
public override string Name => "SolutionContainer";
/// <inheritdoc />
public sealed override uint? NetID => ContentNetIDs.SOLUTION;
@@ -28,13 +28,13 @@ namespace Content.Shared.GameObjects.Components.Chemistry
{
base.HandleComponentState(curState, nextState);
if(curState == null)
if (curState == null)
{
return;
var compState = (SolutionComponentState)curState;
//TODO: Make me work!
}
// var compState = (SolutionComponentState)curState;
// Is there anything we even need to sync with client?
}
}
}