Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 1 addition & 31 deletions Content.Server/Worldgen/Prototypes/BiomePrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Content.Server.Worldgen.Prototypes;
public sealed partial class BiomePrototype : IPrototype, IInheritingPrototype
{
/// <inheritdoc />
[ParentDataField(typeof(AbstractPrototypeIdArraySerializer<BiomePrototype>))] // Frontier: EntityPrototype<BiomePrototype
[ParentDataField(typeof(AbstractPrototypeIdArraySerializer<EntityPrototype>))]
public string[]? Parents { get; }

/// <inheritdoc />
Expand All @@ -25,36 +25,6 @@ public sealed partial class BiomePrototype : IPrototype, IInheritingPrototype
[IdDataField]
public string ID { get; private set; } = default!;

// Frontier: distances
/// <summary>
/// The valid range of biome coordinate lengths (3000, 4000) => 5000
/// Chunks with center points within this range may be generated with this biome.
/// </summary>
[ViewVariables]
private Vector2? _distanceRange;

/// <summary>
/// Accessor for range
/// </summary>
[DataField]
public Vector2? DistanceRange
{
get { return _distanceRange; }
private set
{
_distanceRange = value;

if (value == null)
DistanceRangeSquared = null;
else
DistanceRangeSquared = value * value;
}
}

[ViewVariables]
public Vector2? DistanceRangeSquared { get; private set; }
// Frontier: distances

/// <summary>
/// The valid ranges of noise values under which this biome can be picked.
/// </summary>
Expand Down
19 changes: 0 additions & 19 deletions Content.Server/Worldgen/Systems/Biomes/BiomeSelectionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,9 @@ public override void Initialize()
private void OnWorldChunkAdded(EntityUid uid, BiomeSelectionComponent component, ref WorldChunkAddedEvent args)
{
var coords = args.Coords;
var lengthSquared = WorldGen.ChunkToWorldCoordsCentered(coords).LengthSquared(); // Frontier: cache world coords of center of chunk

foreach (var biomeId in component.Biomes)
{
var biome = _proto.Index<BiomePrototype>(biomeId);

// Frontier: check range
if (!CheckBiomeRange(biome, lengthSquared))
continue;
// End Frontier

if (!CheckBiomeValidity(args.Chunk, biome, coords))
continue;

Expand All @@ -53,17 +45,6 @@ private void OnBiomeSelectionStartup(EntityUid uid, BiomeSelectionComponent comp
.Select(x => x.Id)
.ToList();

// Frontier: check that a given point (passed as the square of its length) meets the range requirements of a biome
private bool CheckBiomeRange(BiomePrototype biome, float centerLengthSquared)
{
if (biome.DistanceRangeSquared == null)
return true;

return centerLengthSquared >= biome.DistanceRangeSquared.Value.X
&& centerLengthSquared <= biome.DistanceRangeSquared.Value.Y;
}
// End Frontier

private bool CheckBiomeValidity(EntityUid chunk, BiomePrototype biome, Vector2i coords) =>
(biome.MinX is null || biome.MaxX is null || biome.MinY is null || biome.MaxY is null)
? CheckNoiseRanges(chunk, biome, coords) : CheckSpecificChunkRange(biome, coords);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ public override void Initialize()
private void OnPrePlaceDebris(EntityUid uid, NoiseRangeCarverComponent component,
ref PrePlaceDebrisFeatureEvent args)
{
// Frontier: something handled this, nothing to do
if (args.Handled)
return;
// End Frontier

var coords = WorldGen.WorldToChunkCoords(args.Coords.ToMapPos(EntityManager, _transform));
var val = _index.Evaluate(uid, component.NoiseChannel, coords);

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading