fish-station/Content.Server/_Sunrise/RoundStartFtl/RoundStartFtlSystem.cs
pacable e5658dcdba
Фикс КТ + несколько мелких изменений (#214)
* у ОСЩ майндщилд

Signed-off-by: JDtrimble <igor.mamaev1@gmail.com>

* Revert "у ОСЩ майндщилд"

This reverts commit 595f8867cc29c5cf248d9da06c03de22ed80eae4.

* Исправлено выделение сообщений в чате некоторых ролей. Исправлено расположение ролей в меню выбора персонажа

Signed-off-by: JDtrimble <igor.mamaev1@gmail.com>

* Убраны играбельные ксеносы из космической тюрьмы. Исправлен спавн шаттла пилота КТ

Signed-off-by: JDtrimble <igor.mamaev1@gmail.com>

* Теперь шаттл летит мгновенно

Signed-off-by: JDtrimble <igor.mamaev1@gmail.com>

* Update blueshield.yml

---------

Signed-off-by: JDtrimble <igor.mamaev1@gmail.com>
Co-authored-by: Vigers Ray <60344369+VigersRay@users.noreply.github.com>
2024-07-18 17:28:46 +03:00

49 lines
1.8 KiB
C#

using Content.Server.Chat.Systems;
using Content.Server.Pinpointer;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Systems;
using Content.Server.Station.Systems;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Shared.Map;
using Robust.Shared.Physics.Components;
namespace Content.Server._Sunrise.RoundStartFtl;
/// <summary>
/// This handles...
/// </summary>
public sealed class RoundStartFtlSystem : EntitySystem
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly MapLoaderSystem _loader = default!;
[Dependency] private readonly ShuttleSystem _shuttles = default!;
[Dependency] private readonly TransformSystem _transform = default!;
public override void Initialize()
{
SubscribeLocalEvent<RoundstartFtlTargetComponent, MapInitEvent>(OnMapInit);
}
private void OnMapInit(EntityUid targetUid, RoundstartFtlTargetComponent ftlTargetComponent, MapInitEvent args)
{
var mapId = _mapManager.CreateMap();
if (!_loader.TryLoad(mapId,
ftlTargetComponent.Path,
out var rootUids,
new MapLoadOptions()
{
DoMapInit = true,
}))
return;
if (!TryComp<ShuttleComponent>(rootUids[0], out var shuttleComp))
return;
var xform = Transform(targetUid);
if (!TryComp(rootUids[0], out PhysicsComponent? shuttlePhysics))
return;
var targetCoordinates = new EntityCoordinates(xform.MapUid!.Value, _transform.GetWorldPosition(xform)).Offset(Angle.Zero.RotateVec(-shuttlePhysics.LocalCenter));
_shuttles.FTLToCoordinates(rootUids[0], shuttleComp, targetCoordinates, Angle.Zero, 0, 0);
Log.Debug($"onmapinit, ftlsuccessful: {rootUids[0]}, {targetCoordinates}");
}
}