2018-03-15 12:41:31 -07:00
|
|
|
|
using SS14.Server.Interfaces.GameObjects;
|
2018-08-02 08:29:55 +02:00
|
|
|
|
using SS14.Shared.Interfaces.GameObjects.Components;
|
2018-03-15 12:41:31 -07:00
|
|
|
|
using SS14.Shared.Interfaces.Map;
|
|
|
|
|
|
using SS14.Shared.IoC;
|
|
|
|
|
|
using SS14.Shared.Map;
|
|
|
|
|
|
using SS14.Shared.Maths;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Placement
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Helper function for spawning more complex multi-entity structures
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static class SpawnHelpers
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Spawns a spotlight ground turret that will track any living entities in range.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="grid"></param>
|
|
|
|
|
|
/// <param name="localPosition"></param>
|
|
|
|
|
|
public static void SpawnLightTurret(IMapGrid grid, Vector2 localPosition)
|
|
|
|
|
|
{
|
|
|
|
|
|
var entMan = IoCManager.Resolve<IServerEntityManager>();
|
|
|
|
|
|
var tBase = entMan.SpawnEntity("TurretBase");
|
2019-01-18 11:40:30 +01:00
|
|
|
|
tBase.GetComponent<ITransformComponent>().GridPosition = new GridCoordinates(localPosition, grid);
|
2018-03-15 12:41:31 -07:00
|
|
|
|
|
|
|
|
|
|
var tTop = entMan.SpawnEntity("TurretTopLight");
|
2018-08-02 08:29:55 +02:00
|
|
|
|
var topTransform = tTop.GetComponent<ITransformComponent>();
|
2019-01-18 11:40:30 +01:00
|
|
|
|
topTransform.GridPosition = new GridCoordinates(localPosition, grid);
|
2018-08-02 08:29:55 +02:00
|
|
|
|
topTransform.AttachParent(tBase);
|
2018-03-15 12:41:31 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|