[Dependency] private readonly IConsoleHost _console = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IParallelManager _parallel = default!;
+ [Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly AtmosphereSystem _atmos = default!;
SetSeed(uid, component, _random.Next());
}
+ if (_proto.TryIndex(component.Template, out var biome))
+ SetTemplate(uid, component, biome);
+
var xform = Transform(uid);
var mapId = xform.MapID;
}
}
+ public void SetEnabled(Entity<BiomeComponent?> ent, bool enabled = true)
+ {
+ if (!Resolve(ent, ref ent.Comp) || ent.Comp.Enabled == enabled)
+ return;
+
+ ent.Comp.Enabled = enabled;
+ Dirty(ent, ent.Comp);
+ }
+
public void SetSeed(EntityUid uid, BiomeComponent component, int seed, bool dirty = true)
{
component.Seed = seed;
public List<IBiomeLayer> Layers = new();
/// <summary>
- /// Templates to use for <see cref="Layers"/>. Optional as this can be set elsewhere.
+ /// Templates to use for <see cref="Layers"/>.
+ /// If this is set on mapinit, it will fill out layers automatically.
+ /// If not set, use <c>BiomeSystem</c> to do it.
+ /// Prototype reloading will also use this.
/// </summary>
- /// <remarks>
- /// This is really just here for prototype reload support.
- /// </remarks>
- [ViewVariables(VVAccess.ReadWrite),
- DataField("template", customTypeSerializer: typeof(PrototypeIdSerializer<BiomeTemplatePrototype>))]
- public string? Template;
+ [DataField]
+ public ProtoId<BiomeTemplatePrototype>? Template;
/// <summary>
/// If we've already generated a tile and couldn't deload it then we won't ever reload it in future.