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:
37
Content.Server/Worldgen/Systems/BlueprintPlacerSystem.cs
Normal file
37
Content.Server/Worldgen/Systems/BlueprintPlacerSystem.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Content.Server.Worldgen.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Maps;
|
||||
using Robust.Shared.Serialization.Manager;
|
||||
|
||||
namespace Content.Server.Worldgen.Systems;
|
||||
|
||||
public sealed class BlueprintPlacerSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly MapLoaderSystem _mapLoader = default!;
|
||||
[Dependency] private readonly IComponentFactory _componentFactory = default!;
|
||||
[Dependency] private readonly ISerializationManager _serialization = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<BlueprintPlacerComponent, MapInitEvent>(OnMapInit);
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, BlueprintPlacerComponent component, MapInitEvent args)
|
||||
{
|
||||
var xform = Transform(uid);
|
||||
var options = new MapLoadOptions()
|
||||
{
|
||||
LoadMap = false,
|
||||
Offset = xform.WorldPosition,
|
||||
Rotation = xform.LocalRotation,
|
||||
};
|
||||
|
||||
_mapLoader.TryLoad(xform.MapID, component.Blueprint.ToString(), out var root, options);
|
||||
|
||||
if (root is null)
|
||||
return;
|
||||
|
||||
component.Apply(root[0], _serialization, EntityManager, _componentFactory);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user