Material cleanup (#4025)

* work

* more work
This commit is contained in:
Vera Aguilera Puerto
2021-05-20 10:37:34 +02:00
committed by GitHub
parent afc8c9163c
commit 3a27490c59
17 changed files with 267 additions and 318 deletions

View File

@@ -1,91 +0,0 @@
#nullable enable
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
namespace Content.Shared.Materials
{
/// <summary>
/// Materials are read-only storage for the properties of specific materials.
/// Properties should be intrinsic (or at least as much is necessary for game purposes).
/// </summary>
[Prototype("material")]
[DataDefinition]
public class MaterialPrototype : IPrototype, IInheritingPrototype
{
[ViewVariables]
[DataField("id", required: true)]
public string ID { get; } = default!;
[DataField("name")] public string Name { get; private set; } = "unobtanium";
[DataField("color")] public Color Color { get; private set; } = Color.Gray;
/// <summary>
/// Volumetric mass density, in kg.m^-3.
/// </summary>
[DataField("density")]
public double Density { get; private set; } = 1;
/// <summary>
/// Electrical resistivity, NOT resistance.
/// Unit is ohm-meter (Ω⋅m).
/// </summary>
[DataField("electricResistivity")]
public double ElectricResistivity { get; private set; } = 1;
/// <summary>
/// Thermal conductivity, in W.m-1.K-1
/// </summary>
[DataField("thermalConductivity")]
public double ThermalConductivity { get; private set; } = 1;
/// <summary>
/// Specific heat, in J.kg-1.K-1
/// </summary>
[DataField("specificHeat")]
public double SpecificHeat { get; private set; } = 1;
/// <summary>
/// Controls how durable the material is.
/// Basically how slowly it degrades.
/// </summary>
[DataField("durability")]
public double Durability { get; private set; } = 1;
/// <summary>
/// Multiplier for how much this resists damage.
/// So higher means armor is more effective, for example.
/// </summary>
[DataField("hardness")]
public double Hardness { get; private set; } = 1;
/// <summary>
/// Multiplier that determines damage on sharpness-based weapons like knives.
/// Higher means more damage is done.
/// </summary>
[DataField("sharpDamage")]
public double SharpDamage { get; private set; } = 1;
/// <summary>
/// Multiplier that determines damage on blunt-based weapons like clubs.
/// Higher means more damage is done.
/// </summary>
[DataField("bluntDamage")]
public double BluntDamage { get; private set; } = 1;
/// <summary>
/// An icon used to represent the material in graphic interfaces.
/// </summary>
[DataField("icon")]
public SpriteSpecifier Icon { get; private set; } = SpriteSpecifier.Invalid;
[DataField("parent")]
public string? Parent { get; }
[DataField("abstract")]
public bool Abstract { get; }
}
}

View File

@@ -0,0 +1,50 @@
#nullable enable
using Content.Shared.Stacks;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
namespace Content.Shared.Materials
{
/// <summary>
/// Materials are read-only storage for the properties of specific materials.
/// Properties should be intrinsic (or at least as much is necessary for game purposes).
/// </summary>
[Prototype("material")]
public class MaterialPrototype : IPrototype, IInheritingPrototype
{
[ViewVariables]
[DataField("parent")]
public string? Parent { get; } = null;
[ViewVariables]
[DataField("abstract")]
public bool Abstract { get; } = false;
[ViewVariables]
[DataField("id", required: true)]
public string ID { get; } = default!;
[ViewVariables]
[DataField("stack", customTypeSerializer:typeof(PrototypeIdSerializer<StackPrototype>))]
public string? StackId { get; } = null;
[ViewVariables]
[DataField("name")]
public string Name { get; } = "unobtanium";
[ViewVariables]
[DataField("color")]
public Color Color { get; } = Color.Gray;
/// <summary>
/// An icon used to represent the material in graphic interfaces.
/// </summary>
[ViewVariables]
[DataField("icon")]
public SpriteSpecifier Icon { get; } = SpriteSpecifier.Invalid;
}
}