Remove combat mode component reference (#15206)

This commit is contained in:
DrSmugleaf
2023-04-08 13:16:48 -07:00
committed by GitHub
parent b4164e62b1
commit 34bcd042d1
29 changed files with 126 additions and 159 deletions

View File

@@ -1,6 +1,6 @@
using Content.Server.CombatMode;
using Content.Server.NPC.Components;
using Content.Server.NPC.Events;
using Content.Shared.CombatMode;
using Content.Shared.NPC;
using Content.Shared.Weapons.Melee;
using Robust.Shared.Map;
@@ -69,7 +69,7 @@ public sealed partial class NPCCombatSystem
{
if (TryComp<CombatModeComponent>(uid, out var combatMode))
{
combatMode.IsInCombatMode = false;
_combat.SetInCombatMode(uid, false, combatMode);
}
_steering.Unregister(component.Owner);
@@ -79,7 +79,7 @@ public sealed partial class NPCCombatSystem
{
if (TryComp<CombatModeComponent>(uid, out var combatMode))
{
combatMode.IsInCombatMode = true;
_combat.SetInCombatMode(uid, true, combatMode);
}
// TODO: Cleanup later, just looking for parity for now.

View File

@@ -8,6 +8,7 @@ namespace Content.Server.NPC.Systems;
public sealed partial class NPCCombatSystem
{
[Dependency] private readonly SharedCombatModeSystem _combat = default!;
[Dependency] private readonly RotateToFaceSystem _rotate = default!;
// TODO: Don't predict for hitscan
@@ -26,9 +27,9 @@ public sealed partial class NPCCombatSystem
private void OnRangedStartup(EntityUid uid, NPCRangedCombatComponent component, ComponentStartup args)
{
if (TryComp<SharedCombatModeComponent>(uid, out var combat))
if (TryComp<CombatModeComponent>(uid, out var combat))
{
combat.IsInCombatMode = true;
_combat.SetInCombatMode(uid, true, combat);
}
else
{
@@ -38,9 +39,9 @@ public sealed partial class NPCCombatSystem
private void OnRangedShutdown(EntityUid uid, NPCRangedCombatComponent component, ComponentShutdown args)
{
if (TryComp<SharedCombatModeComponent>(uid, out var combat))
if (TryComp<CombatModeComponent>(uid, out var combat))
{
combat.IsInCombatMode = false;
_combat.SetInCombatMode(uid, false, combat);
}
}
@@ -48,7 +49,7 @@ public sealed partial class NPCCombatSystem
{
var bodyQuery = GetEntityQuery<PhysicsComponent>();
var xformQuery = GetEntityQuery<TransformComponent>();
var combatQuery = GetEntityQuery<SharedCombatModeComponent>();
var combatQuery = GetEntityQuery<CombatModeComponent>();
var query = EntityQueryEnumerator<NPCRangedCombatComponent, TransformComponent>();
while (query.MoveNext(out var uid, out var comp, out var xform))
@@ -73,7 +74,7 @@ public sealed partial class NPCCombatSystem
if (combatQuery.TryGetComponent(uid, out var combatMode))
{
combatMode.IsInCombatMode = true;
_combat.SetInCombatMode(uid, true, combatMode);
}
if (!_gun.TryGetGun(uid, out var gunUid, out var gun))

View File

@@ -1,7 +1,7 @@
using Content.Server.CombatMode;
using Content.Server.Destructible;
using Content.Server.NPC.Components;
using Content.Server.NPC.Pathfinding;
using Content.Shared.CombatMode;
using Content.Shared.Doors.Components;
using Content.Shared.NPC;
using Robust.Shared.Physics;
@@ -115,7 +115,7 @@ public sealed partial class NPCSteeringSystem
{
if (_melee.TryGetWeapon(uid, out var meleeUid, out var meleeWeapon) && meleeWeapon.NextAttack <= _timing.CurTime && TryComp<CombatModeComponent>(uid, out var combatMode))
{
combatMode.IsInCombatMode = true;
_combat.SetInCombatMode(uid, true, combatMode);
var destructibleQuery = GetEntityQuery<DestructibleComponent>();
// TODO: This is a hack around grilles and windows.
@@ -131,7 +131,7 @@ public sealed partial class NPCSteeringSystem
}
}
combatMode.IsInCombatMode = false;
_combat.SetInCombatMode(uid, false, combatMode);
if (obstacleEnts.Count == 0)
return SteeringObstacleStatus.Completed;

View File

@@ -7,6 +7,7 @@ using Content.Server.NPC.Components;
using Content.Server.NPC.Events;
using Content.Server.NPC.Pathfinding;
using Content.Shared.CCVar;
using Content.Shared.CombatMode;
using Content.Shared.Interaction;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
@@ -55,6 +56,7 @@ namespace Content.Server.NPC.Systems
[Dependency] private readonly SharedMoverController _mover = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedCombatModeSystem _combat = default!;
/// <summary>
/// Enabled antistuck detection so if an NPC is in the same spot for a while it will re-path.