Magic 4 (#345)
* - fix: Fix teleport scroll. * - add: Spell book. * - add: Smite scroll & update shuttle. * - tweak: Tweak cost.
This commit is contained in:
@@ -736,7 +736,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
RaiseLocalEvent(uid, new EnergyDomeClothesTurnOffEvent());
|
||||
}
|
||||
|
||||
private bool CanCast(BaseActionEvent msg)
|
||||
public bool CanCast(BaseActionEvent msg)
|
||||
{
|
||||
return !msg.Handled && CheckRequirements(msg.Action, msg.Performer) &&
|
||||
!_statusEffectsSystem.HasStatusEffect(msg.Performer, "Incorporeal");
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Content.Server._White.Wizard.Teleport;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class TeleportLocationTargetStationComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Shared._White.Wizard.Teleport;
|
||||
using Content.Shared.Eui;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -13,7 +12,7 @@ public sealed class TeleportSpellEui : BaseEui
|
||||
{
|
||||
[Dependency] private readonly EntityManager _entityManager = default!;
|
||||
private readonly SharedTransformSystem _transformSystem;
|
||||
private readonly StationSystem _station;
|
||||
private readonly TeleportLocationSystem _teleportLocation;
|
||||
private readonly PopupSystem _popupSystem;
|
||||
|
||||
private readonly EntityUid _performer;
|
||||
@@ -25,7 +24,7 @@ public sealed class TeleportSpellEui : BaseEui
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
_transformSystem = _entityManager.System<SharedTransformSystem>();
|
||||
_station = _entityManager.System<StationSystem>();
|
||||
_teleportLocation = _entityManager.System<TeleportLocationSystem>();
|
||||
_popupSystem = _entityManager.System<PopupSystem>();
|
||||
|
||||
_performer = performer;
|
||||
@@ -40,12 +39,8 @@ public sealed class TeleportSpellEui : BaseEui
|
||||
|
||||
while (locationQuery.MoveNext(out var locationUid, out var locationComponent, out var transformComponent))
|
||||
{
|
||||
var station = _station.GetOwningStation(locationUid, transformComponent);
|
||||
if (_entityManager.EntityQuery<WizardRuleComponent>(true)
|
||||
.Any(wizardRule => wizardRule.TargetStation == station))
|
||||
{
|
||||
if (_teleportLocation.CanTeleport(locationUid, transformComponent))
|
||||
state.Locations.Add((int) locationUid, locationComponent.Location);
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
|
||||
@@ -14,7 +14,7 @@ public sealed partial class WizardRuleComponent : Component
|
||||
{
|
||||
public readonly List<EntityUid> WizardMinds = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[ViewVariables]
|
||||
public EntityUid? TargetStation;
|
||||
|
||||
[DataField("minPlayers")]
|
||||
|
||||
@@ -310,7 +310,7 @@ public sealed class WizardRuleSystem : GameRuleSystem<WizardRuleComponent>
|
||||
if (meta.EntityPrototype?.ID != component.SpawnPointProto.Id)
|
||||
continue;
|
||||
|
||||
if (xform.ParentUid != component.ShuttleMap)
|
||||
if (xform.MapUid != component.ShuttleMap)
|
||||
continue;
|
||||
|
||||
spawn = xform.Coordinates;
|
||||
|
||||
Reference in New Issue
Block a user