Well the command itself didn't set the seed properly so.
using Content.Server.Administration;
using Content.Server.Atmos;
using Content.Server.Atmos.Components;
+using Content.Server.Parallax;
using Content.Shared.Administration;
using Content.Shared.Atmos;
using Content.Shared.Gravity;
MetaDataComponent? metadata = null;
var biome = _entManager.EnsureComponent<BiomeComponent>(mapUid);
- biome.BiomePrototype = args[1];
- biome.Seed = _random.Next();
+ _entManager.System<BiomeSystem>().SetPrototype(biome, args[1]);
+ _entManager.System<BiomeSystem>().SetSeed(biome, _random.Next());
_entManager.Dirty(biome);
var gravity = _entManager.EnsureComponent<GravityComponent>(mapUid);
private void OnBiomeMapInit(EntityUid uid, BiomeComponent component, MapInitEvent args)
{
- component.Seed = _random.Next();
- component.Noise.SetSeed(component.Seed);
+ SetSeed(component, _random.Next());
+ }
+
+ public void SetPrototype(BiomeComponent component, string proto)
+ {
+ if (component.BiomePrototype == proto)
+ return;
+
+ component.BiomePrototype = proto;
+ Dirty(component);
+ }
+
+ public void SetSeed(BiomeComponent component, int seed)
+ {
+ component.Seed = seed;
+ component.Noise.SetSeed(seed);
Dirty(component);
}
namespace Content.Shared.Parallax.Biomes;
-[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true), Access(typeof(SharedBiomeSystem))]
public sealed partial class BiomeComponent : Component
{
public FastNoiseLite Noise = new();