Salvage expeditions (#12745)

This commit is contained in:
metalgearsloth
2023-04-20 10:43:13 +10:00
committed by GitHub
parent 486d7c179e
commit 122350f19c
79 changed files with 2764 additions and 662 deletions

View File

@@ -0,0 +1,34 @@
using Content.Shared.Decals;
using Content.Shared.Maps;
using Robust.Shared.Noise;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Parallax.Biomes.Layers;
[Serializable, NetSerializable]
public sealed class BiomeDecalLayer : IBiomeWorldLayer
{
/// <inheritdoc/>
[DataField("allowedTiles", customTypeSerializer:typeof(PrototypeIdListSerializer<ContentTileDefinition>))]
public List<string> AllowedTiles { get; } = new();
/// <summary>
/// Divide each tile up by this amount.
/// </summary>
[DataField("divisions")]
public float Divisions = 1f;
[DataField("noise")]
public FastNoiseLite Noise { get; } = new(0);
/// <inheritdoc/>
[DataField("threshold")]
public float Threshold { get; } = 0.8f;
/// <inheritdoc/>
[DataField("invert")] public bool Invert { get; } = false;
[DataField("decals", required: true, customTypeSerializer:typeof(PrototypeIdListSerializer<DecalPrototype>))]
public List<string> Decals = new();
}

View File

@@ -0,0 +1,18 @@
using Robust.Shared.Noise;
using Robust.Shared.Serialization;
namespace Content.Shared.Parallax.Biomes.Layers;
/// <summary>
/// Dummy layer that specifies a marker to be replaced by external code.
/// For example if they wish to add their own layers at specific points across different templates.
/// </summary>
[Serializable, NetSerializable]
public sealed class BiomeDummyLayer : IBiomeLayer
{
[DataField("id", required: true)] public string ID = string.Empty;
public FastNoiseLite Noise { get; } = new();
public float Threshold { get; }
public bool Invert { get; }
}

View File

@@ -0,0 +1,27 @@
using Content.Shared.Maps;
using Robust.Shared.Noise;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Parallax.Biomes.Layers;
[Serializable, NetSerializable]
public sealed class BiomeEntityLayer : IBiomeWorldLayer
{
/// <inheritdoc/>
[DataField("allowedTiles", customTypeSerializer:typeof(PrototypeIdListSerializer<ContentTileDefinition>))]
public List<string> AllowedTiles { get; } = new();
[DataField("noise")] public FastNoiseLite Noise { get; } = new(0);
/// <inheritdoc/>
[DataField("threshold")]
public float Threshold { get; } = 0.5f;
/// <inheritdoc/>
[DataField("invert")] public bool Invert { get; } = false;
[DataField("entities", required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public List<string> Entities = new();
}

View File

@@ -0,0 +1,28 @@
using Content.Shared.Maps;
using Robust.Shared.Noise;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Parallax.Biomes.Layers;
[Serializable, NetSerializable]
public sealed class BiomeTileLayer : IBiomeLayer
{
[DataField("noise")] public FastNoiseLite Noise { get; } = new(0);
/// <inheritdoc/>
[DataField("threshold")]
public float Threshold { get; } = 0.5f;
/// <inheritdoc/>
[DataField("invert")] public bool Invert { get; } = false;
/// <summary>
/// Which tile variants to use for this layer. Uses all of the tile's variants if none specified
/// </summary>
[DataField("variants")]
public List<byte>? Variants = null;
[DataField("tile", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<ContentTileDefinition>))]
public string Tile = string.Empty;
}

View File

@@ -0,0 +1,22 @@
using Robust.Shared.Noise;
namespace Content.Shared.Parallax.Biomes.Layers;
[ImplicitDataDefinitionForInheritors]
public interface IBiomeLayer
{
/// <summary>
/// Seed is used an offset from the relevant BiomeComponent's seed.
/// </summary>
FastNoiseLite Noise { get; }
/// <summary>
/// Threshold for this layer to be present. If set to 0 forces it for every tile.
/// </summary>
float Threshold { get; }
/// <summary>
/// Is the thresold inverted so we need to be lower than it.
/// </summary>
public bool Invert { get; }
}

View File

@@ -0,0 +1,12 @@
namespace Content.Shared.Parallax.Biomes.Layers;
/// <summary>
/// Handles actual objects such as decals and entities.
/// </summary>
public interface IBiomeWorldLayer : IBiomeLayer
{
/// <summary>
/// What tiles we're allowed to spawn on, real or biome.
/// </summary>
List<string> AllowedTiles { get; }
}