* World generation (squash) * Test fixes. * command * o * Access cleanup. * Documentation touchups. * Use a prototype serializer for BiomeSelectionComponent * Struct enumerator in SimpleFloorPlanPopulatorSystem * Safety margins around PoissonDiskSampler, cookie acquisition methodologies * Struct enumerating PoissonDiskSampler; internal side * Struct enumerating PoissonDiskSampler: Finish it * Update WorldgenConfigSystem.cs awa --------- Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com> Co-authored-by: 20kdc <asdd2808@gmail.com>
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using Content.Server.Worldgen.Components.Carvers;
|
|
using Content.Server.Worldgen.Systems.Debris;
|
|
|
|
namespace Content.Server.Worldgen.Systems.Carvers;
|
|
|
|
/// <summary>
|
|
/// This handles carving out holes in world generation according to a noise channel.
|
|
/// </summary>
|
|
public sealed class NoiseRangeCarverSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly NoiseIndexSystem _index = default!;
|
|
|
|
/// <inheritdoc />
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<NoiseRangeCarverComponent, PrePlaceDebrisFeatureEvent>(OnPrePlaceDebris);
|
|
}
|
|
|
|
private void OnPrePlaceDebris(EntityUid uid, NoiseRangeCarverComponent component,
|
|
ref PrePlaceDebrisFeatureEvent args)
|
|
{
|
|
var coords = WorldGen.WorldToChunkCoords(args.Coords.ToMapPos(EntityManager));
|
|
var val = _index.Evaluate(uid, component.NoiseChannel, coords);
|
|
|
|
foreach (var (low, high) in component.Ranges)
|
|
{
|
|
if (low > val || high < val)
|
|
continue;
|
|
|
|
args.Handled = true;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|