Xeno spitter fixes (#18573)

* Xeno spitter fixes

- Require hands for pickup compounds
- Ranged combat can force movement to ignore LOS checks if ranged wants better LOS.

* Also spirates

IDK how this worked before but TryGetGun shouldn't care about combatmode.

* 1 more
This commit is contained in:
metalgearsloth
2023-08-03 07:34:54 +10:00
committed by GitHub
parent 8d5a354592
commit 868f3298e5
7 changed files with 31 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
using Content.Server.NPC.Components;
using Content.Shared.CombatMode;
using Content.Shared.Interaction;
using Content.Shared.Physics;
using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Weapons.Ranged.Events;
using Robust.Shared.Map;
@@ -132,13 +133,20 @@ public sealed partial class NPCCombatSystem
if (comp.LOSAccumulator < 0f)
{
comp.LOSAccumulator += UnoccludedCooldown;
comp.TargetInLOS = _interaction.InRangeUnobstructed(uid, comp.Target, distance + 0.1f);
// For consistency with NPC steering.
comp.TargetInLOS = _interaction.InRangeUnobstructed(uid, Transform(comp.Target).Coordinates, distance + 0.1f);
}
if (!comp.TargetInLOS)
{
comp.ShootAccumulator = 0f;
comp.Status = CombatStatus.NotInSight;
if (TryComp(uid, out steering))
{
steering.ForceMove = true;
}
continue;
}
@@ -188,8 +196,14 @@ public sealed partial class NPCCombatSystem
targetCordinates = new EntityCoordinates(xform.MapUid!.Value, targetSpot);
}
_gun.AttemptShoot(uid, gunUid, gun, targetCordinates);
comp.Status = CombatStatus.Normal;
if (gun.NextFire > _timing.CurTime)
{
return;
}
_gun.AttemptShoot(uid, gunUid, gun, targetCordinates);
}
}
}