mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 05:59:03 +03:00
# Description This PR un-hardcodes the JukeSystem timer, such that individual NPC HTN Blackboards can directly state how often, and how far they wish to juke. The effect of this is that NPCs are no longer completely impossible to hit with left-clicks in melee combat, while also allowing for more "Elite" enemies that juke more aggressively and more often to be created. Additionally, by introducing an exit condition based on this new "Juke Cooldown", I have made the Juke Operator run a metric shitload of expensive calculations 5000 times less often. <details><summary><h1>Media</h1></summary> <p> Melee enemy with the new default juke settings, 0.5 second juke duration, with 5 second juke Cooldown. The reagent slime will attempt to close to melee with its enemy, but will now only attempt to evade melee attacks once per 5 seconds. They will otherwise attempt to stay within melee range. https://github.com/user-attachments/assets/653e2064-e404-4be6-a958-da43096de502 </p> </details> # Changelog 🆑 - tweak: JukeOperator now allows for JukeDuration and JukeCooldown arguments. JukeCooldown is a new feature where enemies must wait an amount of time in seconds equal to the JukeCooldown, before they are allowed to attempt to dodge a melee attack. - tweak: By default, NPCs will only attempt to dodge attacks once every 5 seconds. - fix: JukeOperator now performs extremely expensive math 5000 times less often. EXIT CONDITIONS PEOPLE!
37 lines
823 B
C#
37 lines
823 B
C#
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
|
|
|
namespace Content.Server.NPC.Components;
|
|
|
|
[RegisterComponent, AutoGenerateComponentPause]
|
|
public sealed partial class NPCJukeComponent : Component
|
|
{
|
|
[DataField]
|
|
public JukeType JukeType = JukeType.Away;
|
|
|
|
[DataField]
|
|
public float JukeDuration = 0.5f;
|
|
|
|
[DataField]
|
|
public float JukeCooldown = 3f;
|
|
|
|
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
|
|
[AutoPausedField]
|
|
public TimeSpan NextJuke;
|
|
|
|
[DataField]
|
|
public Vector2i? TargetTile;
|
|
}
|
|
|
|
public enum JukeType : byte
|
|
{
|
|
/// <summary>
|
|
/// Will move directly away from target if applicable.
|
|
/// </summary>
|
|
Away,
|
|
|
|
/// <summary>
|
|
/// Move to the adjacent tile for the specified duration.
|
|
/// </summary>
|
|
AdjacentTile
|
|
}
|