Biome rework (#37735)
* DungeonData rework Back to fields, serializes better, just make new layers dumby. * wawawewa * Fix this * Fixes * Port the work over * wawawewa * zoom * Kinda workin * Adjust wawa * Unloading work * Ore + entitytable fixes Iterate every dungeon not just last. * Big shot * wawawewa * Fixes * true * Fixes # Conflicts: # Content.Server/Procedural/DungeonJob/DungeonJob.cs * wawawewa * Fixes * Fix * Lot of work * wawawewa * Fixing * eh? * a * Fix a heap of stuff * Better ignored check * Reserve tile changes * biome * changes * wawawewa * Fixes & snow * Shadow fixes * wawawewa * smol * Add layer API * More work * wawawewa * Preloads and running again * wawawewa * Modified * Replacements and command * Runtime support * werk * Fix expeds + dungeon alltiles * reh --------- Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
This commit is contained in:
86
Content.Shared/Procedural/Components/BiomeComponent.cs
Normal file
86
Content.Shared/Procedural/Components/BiomeComponent.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared.Procedural.Components;
|
||||
|
||||
/// <summary>
|
||||
/// A layer inside of <see cref="BiomeComponent"/>
|
||||
/// </summary>
|
||||
[DataRecord]
|
||||
public sealed record BiomeMetaLayer
|
||||
{
|
||||
/// <summary>
|
||||
/// Chunk dimensions for this meta layer. Will try to infer it from the first layer of the dungeon if null.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public int? Size;
|
||||
|
||||
/// <summary>
|
||||
/// Meta layers that this one requires to be loaded first.
|
||||
/// Will ensure all of the chunks for our corresponding area are loaded.
|
||||
/// </summary>
|
||||
public List<string>? DependsOn;
|
||||
|
||||
/// <summary>
|
||||
/// Can this layer be unloaded if no one is in range.
|
||||
/// </summary>
|
||||
public bool CanUnload = true;
|
||||
|
||||
/// <summary>
|
||||
/// Dungeon config to load inside the specified area.
|
||||
/// </summary>
|
||||
[DataField(required: true)]
|
||||
public ProtoId<DungeonConfigPrototype> Dungeon = new();
|
||||
}
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class BiomeComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Can we load / unload chunks.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool Enabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// Areas queued for preloading. Will add these during <see cref="BiomeLoadJob"/> and then flag as modified so they retain.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public List<Box2i> PreloadAreas = new();
|
||||
|
||||
/// <summary>
|
||||
/// Is there currently a job that's loading.
|
||||
/// </summary>
|
||||
public bool Loading = false;
|
||||
|
||||
[DataField]
|
||||
public int Seed;
|
||||
|
||||
/// <summary>
|
||||
/// Layer key and associated data.
|
||||
/// </summary>
|
||||
[DataField(required: true)]
|
||||
public Dictionary<string, BiomeMetaLayer> Layers = new();
|
||||
|
||||
/// <summary>
|
||||
/// Layer removals that are pending.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public List<string> PendingRemovals = new();
|
||||
|
||||
/// <summary>
|
||||
/// Data that is currently loaded.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public Dictionary<string, Dictionary<Vector2i, DungeonData>> LoadedData = new();
|
||||
|
||||
/// <summary>
|
||||
/// Flag modified tiles so we don't try and unload / reload them.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public HashSet<Vector2i> ModifiedTiles = new();
|
||||
|
||||
/// <summary>
|
||||
/// Bounds loaded by players for this tick.
|
||||
/// </summary>
|
||||
public List<Box2i> LoadedBounds = new();
|
||||
}
|
||||
Reference in New Issue
Block a user