* - fix: Fix teleport scroll.

* - add: Spell book.

* - add: Smite scroll & update shuttle.

* - tweak: Tweak cost.
This commit is contained in:
Aviu00
2024-06-10 10:57:32 +00:00
committed by GitHub
parent d8e71e4926
commit 01511adbb2
24 changed files with 650 additions and 328 deletions

View File

@@ -1,11 +1,17 @@
using Content.Server.Pinpointer;
using Content.Server.Station.Systems;
using Content.Server.Warps;
using Content.Shared.Coordinates.Helpers;
using Content.Shared.Maps;
using Content.Shared.Physics;
namespace Content.Server._White.Wizard.Teleport;
public sealed class TeleportLocationSystem : EntitySystem
{
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly TurfSystem _turf = default!;
public override void Initialize()
{
@@ -20,10 +26,30 @@ public sealed class TeleportLocationSystem : EntitySystem
if (!TryComp(ent, out WarpPointComponent? warpPoint) || warpPoint.Location == null)
return;
var newEnt = Spawn(null, Transform(ent).Coordinates);
var xForm = EnsureComp<TransformComponent>(newEnt);
_transformSystem.AttachToGridOrMap(newEnt, xForm);
var xForm = Transform(ent);
if (!CanTeleport(ent, xForm))
return;
var newEnt = Spawn(null, xForm.Coordinates);
var newXForm = EnsureComp<TransformComponent>(newEnt);
_transformSystem.AttachToGridOrMap(newEnt, newXForm);
var location = EnsureComp<TeleportLocationComponent>(newEnt);
location.Location = warpPoint.Location;
}
public bool CanTeleport(EntityUid uid, TransformComponent xForm)
{
var station = _station.GetOwningStation(uid, xForm);
if (!HasComp<TeleportLocationTargetStationComponent>(station))
return false;
var turf = xForm.Coordinates.SnapToGrid(EntityManager).GetTileRef(EntityManager);
if (turf == null)
return false;
return !_turf.IsTileBlocked(turf.Value, CollisionGroup.Impassable);
}
}