Patch 2.5 (#136)
* derelicts-base * WonderBox update v0.7 * White MapPool * ~45-90 generated, 30 mapped * radio receive sounds * default: * add wonderbox to mappool * added tags to cargo airlocks * MORE MORE MORE MORE
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Worldgen.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed class BlueprintPlacerComponent : Component
|
||||
{
|
||||
[DataField("blueprint", required: true, customTypeSerializer: typeof(ResPathSerializer))]
|
||||
public ResPath Blueprint = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The components that get added to the target grid.
|
||||
/// </summary>
|
||||
[DataField("components", required: true)]
|
||||
public ComponentRegistry Components { get; } = default!;
|
||||
|
||||
//TODO: Get someone to make this a method on componentregistry that does it Correctly.
|
||||
/// <summary>
|
||||
/// Applies the worldgen config to the given target (presumably a grid.)
|
||||
/// </summary>
|
||||
public void Apply(EntityUid target, ISerializationManager serialization, IEntityManager entityManager, IComponentFactory componentFactory)
|
||||
{
|
||||
// Add all components required by the prototype. Engine update for this whenst.
|
||||
foreach (var data in Components.Values)
|
||||
{
|
||||
var comp = (Component) serialization.CreateCopy(data.Component, notNullableOverride: true);
|
||||
comp.Owner = target;
|
||||
entityManager.AddComponent(target, comp);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user