Make ore loot use walls as a mask (#16377)

This commit is contained in:
metalgearsloth
2023-05-15 12:01:29 +10:00
committed by GitHub
parent 7065341171
commit ea4440be44
9 changed files with 187 additions and 135 deletions

View File

@@ -1,20 +1,36 @@
using Content.Shared.Parallax.Biomes.Points;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Parallax.Biomes.Markers;
/// <summary>
/// Spawns entities inside of the specified area with the minimum specified radius.
/// </summary>
[Prototype("biomeMarkerLayer")]
public sealed class BiomeMarkerLayerPrototype : IBiomeMarkerLayer
{
[IdDataField] public string ID { get; } = default!;
[DataField("proto", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string Prototype = string.Empty;
public string Prototype { get; } = string.Empty;
/// <inheritdoc />
/// <summary>
/// Checks for the relevant entity for the tile before spawning. Useful for substituting walls with ore veins for example.
/// </summary>
[DataField("entityMask", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? EntityMask { get; }
/// <summary>
/// Minimum radius between 2 points
/// </summary>
[DataField("radius")]
public float Radius { get; } = 32f;
public float Radius = 32f;
/// <summary>
/// Maximum amount of group spawns
/// </summary>
[DataField("maxCount")]
public int MaxCount = int.MaxValue;
/// <summary>
/// How many mobs to spawn in one group.

View File

@@ -1,6 +1,6 @@
using Robust.Shared.Prototypes;
namespace Content.Shared.Parallax.Biomes.Points;
namespace Content.Shared.Parallax.Biomes.Markers;
/// <summary>
/// Specifies one-off marker points to be used. This could be for dungeon markers, mob markers, etc.
@@ -9,14 +9,14 @@ namespace Content.Shared.Parallax.Biomes.Points;
public interface IBiomeMarkerLayer : IPrototype
{
/// <summary>
/// Minimum radius between 2 points
/// Biome template to use as a mask for this layer.
/// </summary>
[DataField("radius")]
public float Radius { get; }
public string? EntityMask { get; }
public string Prototype { get; }
/// <summary>
/// How large the pre-generated points area is.
/// </summary>
[DataField("size")]
public int Size { get; }
}

View File

@@ -0,0 +1,13 @@
using Content.Shared.Parallax.Biomes.Markers;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Procedural.Loot;
/// <summary>
/// Adds a biome marker layer for dungeon loot.
/// </summary>
public sealed class BiomeMarkerLoot : IDungeonLoot
{
[DataField("proto", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<BiomeMarkerLayerPrototype>))]
public string Prototype = string.Empty;
}

View File

@@ -3,12 +3,8 @@ using Content.Shared.Audio;
using Content.Shared.Hands.Components;
using Robust.Shared.GameStates;
using Content.Shared.Weapons.Ranged.Events;
using System.Diagnostics.CodeAnalysis;
using Robust.Shared.Physics.Components;
using Content.Shared.Popups;
using Content.Shared.Projectiles;
using Content.Shared.Weapons.Ranged.Events;
using Robust.Shared.GameStates;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Random;