* Add investigator's cloak entity and sprites Introduced a new investigator's cloak for senior investigators, including its entity definition and associated sprites. Also updated helmet sprites for the guard role. * Add Investigator job to CP14 roles and assets Introduces the Investigator job, including English and Russian localization, job prototype, loadout, play time tracker, and status icon. Updates department and role loadout configurations to include the new job. Enables setPreference for Guard and Guard Commander jobs. Adds Investigator job icon and updates related metadata. * Rebalance mana splitting spell parameters Reduced mana cost from 15 to 10, adjusted mana change effect, and updated spell event to use a toggleable action with new cast time and distance threshold. Also changed visual effect colors for the spell impact. * job spawner * remove mana splitting from mana glove * Update tools.yml * reduce memory points to 0.5 for tier magics * Add CP14 spell to create beams and extend beam system Introduces CP14SpellCreateBeam, a new spell effect for creating beams using the shared beam system. Adds a virtual TryCreateBeam method to SharedBeamSystem and overrides it in BeamSystem to support shared spell functionality. * athletic branch refactor * second wind skill * minor fixes * remove skeletons specific spells * small magic splitting * Update migration.yml * clear references * guidebook species update, -0.5 people memory, innate athletic to carcat, nerf night vision * disable guards again
73 lines
2.5 KiB
C#
73 lines
2.5 KiB
C#
using System.Numerics;
|
|
using Content.Shared.ActionBlocker;
|
|
using Content.Shared.Movement.Events;
|
|
using Content.Shared.Throwing;
|
|
using Robust.Shared.Audio.Systems;
|
|
using Robust.Shared.Map;
|
|
|
|
namespace Content.Shared._CP14.Dash;
|
|
|
|
public sealed partial class CP14DashSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
|
|
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<CP14DashComponent, UpdateCanMoveEvent>(OnMoveAttempt);
|
|
SubscribeLocalEvent<CP14DashComponent, ComponentInit>(OnInit);
|
|
SubscribeLocalEvent<CP14DashComponent, ComponentShutdown>(OnShutdown);
|
|
SubscribeLocalEvent<CP14DashComponent, LandEvent>(OnLand);
|
|
}
|
|
|
|
private void OnShutdown(Entity<CP14DashComponent> ent, ref ComponentShutdown args)
|
|
{
|
|
_blocker.UpdateCanMove(ent);
|
|
}
|
|
|
|
private void OnInit(Entity<CP14DashComponent> ent, ref ComponentInit args)
|
|
{
|
|
_blocker.UpdateCanMove(ent);
|
|
}
|
|
|
|
private void OnLand(Entity<CP14DashComponent> ent, ref LandEvent args)
|
|
{
|
|
RemCompDeferred<CP14DashComponent>(ent);
|
|
}
|
|
|
|
private void OnMoveAttempt(Entity<CP14DashComponent> ent, ref UpdateCanMoveEvent args)
|
|
{
|
|
if (ent.Comp.LifeStage > ComponentLifeStage.Running)
|
|
return;
|
|
|
|
//Cant move while dashing
|
|
args.Cancel();
|
|
}
|
|
|
|
public void PerformDash(EntityUid ent, EntityCoordinates targetPosition, float speed = 10f, float maxDistance = 3.5f)
|
|
{
|
|
EnsureComp<CP14DashComponent>(ent, out var dash);
|
|
_audio.PlayPredicted(dash.DashSound, ent, ent);
|
|
|
|
var entMapPos = _transform.ToMapCoordinates(Transform(ent).Coordinates);
|
|
var targetMapPos = _transform.ToMapCoordinates(targetPosition);
|
|
|
|
var distance = Vector2.Distance(entMapPos.Position, targetMapPos.Position);
|
|
|
|
if (distance > maxDistance)
|
|
{
|
|
var direction = (targetMapPos.Position - entMapPos.Position).Normalized();
|
|
var clampedTarget = entMapPos.Position + direction * maxDistance;
|
|
targetMapPos = new MapCoordinates(clampedTarget, entMapPos.MapId);
|
|
}
|
|
|
|
var finalTarget = _transform.ToCoordinates(targetMapPos);
|
|
|
|
_throwing.TryThrow(ent, finalTarget, speed, null, 0f, 10, true, false, false, false, false);
|
|
}
|
|
}
|