From ebb49b3377db722b3b4b8cdd643bc1e017dcf95a Mon Sep 17 00:00:00 2001 From: zumorica Date: Thu, 14 May 2020 17:49:40 +0200 Subject: [PATCH] Document some stun code --- .../Components/Items/IHandsComponent.cs | 1 + .../Components/Mobs/StunnableComponent.cs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Content.Client/Interfaces/GameObjects/Components/Items/IHandsComponent.cs b/Content.Client/Interfaces/GameObjects/Components/Items/IHandsComponent.cs index 031f760198..0915f66599 100644 --- a/Content.Client/Interfaces/GameObjects/Components/Items/IHandsComponent.cs +++ b/Content.Client/Interfaces/GameObjects/Components/Items/IHandsComponent.cs @@ -14,5 +14,6 @@ namespace Content.Client.Interfaces.GameObjects void AttackByInHand(string index); void UseActiveHand(); void ActivateItemInHand(string handIndex); + void RefreshInHands(); } } diff --git a/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs b/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs index 11cc8a765d..9890cb8a38 100644 --- a/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs @@ -85,6 +85,10 @@ namespace Content.Server.GameObjects.Components.Mobs } } + /// + /// Stuns the entity, disallowing it from doing many interactions temporarily. + /// + /// How many seconds the mob will stay stunned public void Stun(float seconds) { seconds = Math.Min(seconds + _stunnedTimer, _stunCap); @@ -95,6 +99,10 @@ namespace Content.Server.GameObjects.Components.Mobs _lastStun = _gameTiming.CurTime; } + /// + /// Knocks down the mob, making it fall to the ground. + /// + /// How many seconds the mob will stay on the ground public void Knockdown(float seconds) { seconds = MathF.Min(_knockdownTimer + seconds, _knockdownCap); @@ -105,12 +113,22 @@ namespace Content.Server.GameObjects.Components.Mobs _lastStun = _gameTiming.CurTime; } + /// + /// Applies knockdown and stun to the mob temporarily + /// + /// How many seconds the mob will be paralyzed public void Paralyze(float seconds) { Stun(seconds); Knockdown(seconds); } + /// + /// Slows down the mob's walking/running speed temporarily + /// + /// How many seconds the mob will be slowed down + /// Walk speed modifier. Set to 0 or negative for default value. (0.5f) + /// Run speed modifier. Set to 0 or negative for default value. (0.5f) public void Slowdown(float seconds, float walkModifierOverride = 0f, float runModifierOverride = 0f) { seconds = MathF.Min(_slowdownTimer + seconds, _slowdownCap);