CatStation/Content.Server/ForceAttack/ForceAttackComponent.cs
Booblesnoot42 81be6f2571
Force Vent Critters to Attack (#42399)
* Create force attack component, system and add to spider

* Add check for incapacitated enemies

* minor cleanup

* Fix networking stuff, hopefully

* Add component to slimes

* Move system and component to server, add localization

* Fixed attack animation not playing for server-forced attacks, hopefully didn't break anything godo

* Add feedback popup

* pretty big optimization

---------

Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
2026-04-03 06:03:23 +00:00

35 lines
1 KiB
C#

using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.ForceAttack;
/// <summary>
/// This is used to force a player-controlled mob to attack nearby enemies, preventing "friendly antag"ing.
/// </summary>
[RegisterComponent]
[AutoGenerateComponentPause]
public sealed partial class ForceAttackComponent : Component
{
/// <summary>
/// The next time this component will attempt to force an attack.
/// </summary>
[AutoPausedField]
public TimeSpan NextAttack = TimeSpan.MaxValue;
/// <summary>
/// Whether an enemy is in range.
/// </summary>
public bool InRange = false;
/// <summary>
/// The time this component will wait before forcing an attack when an enemy is in range.
/// </summary>
[DataField]
public TimeSpan PassiveTime = TimeSpan.FromSeconds(5);
/// <summary>
/// The message displayed on forced attack
/// </summary>
[DataField]
public LocId Message = "force-attack-component-message";
}