Files
crystall-punk-14/Content.Shared/_CP14/MagicSpell/Spells/CP14SpellCasterTeleport.cs
Ed 1f4b7f68bf Playtest polishing (#383)
* fix predicting sharpening

* finish shadow step

* tweak ice dagger

* shadow grab test

* fireball spell

* ice shards spell

* battle royale crates

* loot tables

* remove expedition ship

* dev update

* br map update

* spells tweak

* tips update

* some fixes

* biome forest spawner

* give keys to orgs

* mobs and aura spawners

* expedition update: goal, new ship, new map

* fix doors layers

* add new map proto

* translate keys

* Update crates.yml

* Update PostMapInitTest.cs

* fix spawning on expedition ship

* Fuck you, Randy. Remove nails

* fix lock systems

* localize tips

* some tweaks

* update ship, remove shrooms.

* fixes

* Update StationSystem.cs

* Revert "Update StationSystem.cs"

This reverts commit f632241324.

* Update expedition_test.yml
2024-08-05 15:22:14 +03:00

38 lines
1.3 KiB
C#

using Content.Shared.Examine;
using Content.Shared.Popups;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.MagicSpell.Spells;
public sealed partial class CP14SpellCasterTeleport : CP14SpellEffect
{
[DataField]
public bool NeedVision = true;
public override void Effect(EntityManager entManager, CP14SpellEffectBaseArgs args)
{
EntityCoordinates? targetPoint = null;
if (args.Position is not null)
targetPoint = args.Position.Value;
else if (args.Target is not null && entManager.TryGetComponent<TransformComponent>(args.Target.Value, out var transformComponent))
targetPoint = transformComponent.Coordinates;
if (targetPoint is null || args.User is null)
return;
var transform = entManager.System<SharedTransformSystem>();
var examine = entManager.System<ExamineSystemShared>();
var popup = entManager.System<SharedPopupSystem>();
if (NeedVision && !examine.InRangeUnOccluded(args.User.Value, targetPoint.Value))
{
// can only dash if the destination is visible on screen
popup.PopupEntity(Loc.GetString("dash-ability-cant-see"), args.User.Value, args.User.Value);
return;
}
transform.SetCoordinates(args.User.Value, targetPoint.Value);
}
}