Demiplan modifiers (#526)

* simple modifiers

* modifier tag filtering

* Update CP14DemiplanSystem.Generation.cs

* Update rocks.yml

* move loot to modifier

* move enemies to modificators

* fix filtering

* modifier rariry

* reward and difficulty limits

* rebalance and optimize calculation

* Update test.yml

* wizden PR copy

* move all alchemy reagents to modifiers
This commit is contained in:
Ed
2024-11-01 18:08:57 +03:00
committed by GitHub
parent 7124eb5335
commit 3b520ac69c
19 changed files with 564 additions and 235 deletions

View File

@@ -1,3 +1,4 @@
using Content.Shared.Maps;
using Robust.Shared.Prototypes;
namespace Content.Shared.Procedural.DungeonLayers;
@@ -12,10 +13,16 @@ namespace Content.Shared.Procedural.DungeonLayers;
public partial class OreDunGen : IDunGenLayer
{
/// <summary>
/// If the vein generation should occur on top of existing entities what are we replacing.
/// This vein can only be generated by replacing the specified entities.
/// </summary>
[DataField]
public EntProtoId? Replacement;
public HashSet<EntProtoId>? EntityMask;
/// <summary>
/// This vein can only be generated on the specified tiles
/// </summary>
[DataField]
public HashSet<ProtoId<ContentTileDefinition>>? TileMask;
/// <summary>
/// Entity to spawn.

View File

@@ -1,4 +1,5 @@
using Content.Shared.Procedural;
using Content.Shared.Tag;
using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.Demiplane.Prototypes;
@@ -14,12 +15,15 @@ public sealed partial class CP14DemiplaneLocationPrototype : IPrototype
[DataField(required: true)]
public ProtoId<DungeonConfigPrototype> LocationConfig;
/// <summary>
/// Components that will be automatically added to the demiplane when it is generated
/// </summary>
[DataField]
public ComponentRegistry Components = new();
//Player faced description
//Tier restriction
//Some abstract restriction?
/// <summary>
/// Tags allow modifiers to filter which ones can apply to the current location and which ones cannot.
/// </summary>
[DataField]
public List<ProtoId<TagPrototype>> Tags = new();
}

View File

@@ -0,0 +1,62 @@
using Content.Shared.Procedural;
using Content.Shared.Tag;
using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.Demiplane.Prototypes;
/// <summary>
/// Demiplane modifier prototype. The answer to the question “Which” in terms of the combinatorics of demiplane generation is
/// </summary>
[Prototype("cp14DemiplaneModifier")]
public sealed partial class CP14DemiplaneModifierPrototype : IPrototype
{
[IdDataField] public string ID { get; } = default!;
/// <summary>
/// Abstract danger of this modifier. The demiplane has a threat limit, which it gains from modifiers until it reaches the limit.
/// </summary>
[DataField]
public float Difficulty = 0;
/// <summary>
/// The abstract value of this modifier. The demiplane has a limit of rewards it gains from modifiers until it reaches the limit.
/// </summary>
[DataField]
public float Reward = 0;
/// <summary>
/// How often can this modifier be generated? Determined by weight from all modifiers available for the location
/// </summary>
[DataField]
public float GenerationWeight = 1;
/// <summary>
/// Can this modifier be generated multiple times within a single demiplane?
/// </summary>
[DataField]
public bool Unique = true;
/// <summary>
/// Generation layers that will be added to the location generation after the main layers.
/// </summary>
[DataField]
public List<IDunGenLayer> Layers = new();
/// <summary>
/// Components that will be added to the map
/// </summary>
[DataField]
public ComponentRegistry Components = new();
/// <summary>
/// Modifier cannot be applied to locations with the following tags. Leave empty for disable
/// </summary>
[DataField]
public List<ProtoId<TagPrototype>> BlacklistTags = new();
/// <summary>
/// Modifier can only be applied to locations that have all of the following tags. Leave empty for disable
/// </summary>
[DataField]
public List<ProtoId<TagPrototype>> RequiredTags = new();
}