CatStation/Content.Server/Weapons/Ranged/Systems/GunSystem.TargetFinder.cs
Samuka 838984971c
Xenoborg guided missile (#45247)
* update math

* target finder system

* ports

* guns with projectiles

* make sure

* custom sprites for the laser

* add auto link

* add module

* sprite for the missile

* update animation speed

* ops

* make it glow

* overlay sprite

* stuff that doesn't work

* update launcher

* fix it

* make it see from far

* make it work

* sprite for the module

* 30 seconds is too much

* sprite for the range finder

* why was that here?

* update sprite of the missile

* update module icon

* ops

* update missile and missile launcher

* make it look like the launcher item

* remove ammo counter from range finder

* increase to 15 seconds

* no longer show the battery percentage

* use comp

* change summary

* ops

* new line

* make it last longer

* commentary

* acme moment

* fix bug when shooter was also the target and the projectile wouldn't move

* empty commit

* fix test fail

* replace with global behavior

* forgot to remove from the yml

* important

* check to see if the target exists

* fix autorefill bug

* remove unused system

* make it reload a tad slower

---------

Co-authored-by: beck-thompson <beck314159@hotmail.com>
2026-08-16 05:10:57 +00:00

30 lines
1 KiB
C#

using Content.Server.Physics.Components;
using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Weapons.Ranged.Events;
using Robust.Shared.Random;
namespace Content.Server.Weapons.Ranged.Systems;
public sealed partial class GunSystem
{
[SubscribeLocalEvent]
public void OnProjectileShot(Entity<TargetAssignComponent> entity, ref AmmoShotEvent args)
{
if (entity.Comp.Target is null || TerminatingOrDeleted(entity.Comp.Target))
return;
if (args.FiredProjectiles.Count == 0)
return;
foreach (var projectile in args.FiredProjectiles)
{
var projectileChasingWalkComp = Comp<ChasingWalkComponent>(projectile);
projectileChasingWalkComp.ChasingEntity = entity.Comp.Target;
projectileChasingWalkComp.NextChangeVectorTime = TimeSpan.MaxValue;
var targetedProjectile = EnsureComp<TargetedProjectileComponent>(projectile);
targetedProjectile.Target = entity.Comp.Target.Value;
}
}
}