Fix hostile simplemob rotation (#20900)

This commit is contained in:
Nemanja
2023-10-14 03:15:20 -04:00
committed by GitHub
parent 65f5703731
commit 5ecd5f7521
3 changed files with 19 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
using Content.Client.Hands.Systems; using Content.Client.Hands.Systems;
using Content.Client.NPC.HTN;
using Content.Shared.CCVar; using Content.Shared.CCVar;
using Content.Shared.CombatMode; using Content.Shared.CombatMode;
using Robust.Client.Graphics; using Robust.Client.Graphics;
@@ -59,6 +60,11 @@ public sealed class CombatModeSystem : SharedCombatModeSystem
UpdateHud(entity); UpdateHud(entity);
} }
protected override bool IsNpc(EntityUid uid)
{
return HasComp<HTNComponent>(uid);
}
private void UpdateHud(EntityUid entity) private void UpdateHud(EntityUid entity)
{ {
if (entity != _playerManager.LocalPlayer?.ControlledEntity || !Timing.IsFirstTimePredicted) if (entity != _playerManager.LocalPlayer?.ControlledEntity || !Timing.IsFirstTimePredicted)

View File

@@ -1,7 +1,12 @@
using Content.Server.NPC.HTN;
using Content.Shared.CombatMode; using Content.Shared.CombatMode;
namespace Content.Server.CombatMode; namespace Content.Server.CombatMode;
public sealed class CombatModeSystem : SharedCombatModeSystem public sealed class CombatModeSystem : SharedCombatModeSystem
{ {
protected override bool IsNpc(EntityUid uid)
{
return HasComp<HTNComponent>(uid);
}
} }

View File

@@ -82,7 +82,7 @@ public abstract class SharedCombatModeSystem : EntitySystem
_actionsSystem.SetToggled(component.CombatToggleActionEntity, component.IsInCombatMode); _actionsSystem.SetToggled(component.CombatToggleActionEntity, component.IsInCombatMode);
// Change mouse rotator comps if flag is set // Change mouse rotator comps if flag is set
if (!component.ToggleMouseRotator) if (!component.ToggleMouseRotator || IsNpc(entity))
return; return;
SetMouseRotatorComponents(entity, value); SetMouseRotatorComponents(entity, value);
@@ -101,6 +101,12 @@ public abstract class SharedCombatModeSystem : EntitySystem
RemComp<NoRotateOnMoveComponent>(uid); RemComp<NoRotateOnMoveComponent>(uid);
} }
} }
// todo: When we stop making fucking garbage abstract shared components, remove this shit too.
protected abstract bool IsNpc(EntityUid uid);
} }
public sealed partial class ToggleCombatActionEvent : InstantActionEvent { } public sealed partial class ToggleCombatActionEvent : InstantActionEvent
{
}