Adds disarm action (#2950)
* Adds disarming * Disarm acts * yaml * much better icon for disarm * Apply Remie's suggestions, improve code!
This commit is contained in:
committed by
GitHub
parent
1fe25049a3
commit
d81a5faac4
@@ -1,17 +1,23 @@
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using Content.Shared.Interfaces;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using NFluidsynth;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components.Timers;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timers;
|
||||
using Logger = Robust.Shared.Log.Logger;
|
||||
|
||||
@@ -19,7 +25,7 @@ namespace Content.Server.GameObjects.Components.Mobs
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedStunnableComponent))]
|
||||
public class StunnableComponent : SharedStunnableComponent
|
||||
public class StunnableComponent : SharedStunnableComponent, IDisarmedAct
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
@@ -121,5 +127,23 @@ namespace Content.Server.GameObjects.Components.Mobs
|
||||
return new StunnableComponentState(StunnedTimer, KnockdownTimer, SlowdownTimer, WalkModifierOverride,
|
||||
RunModifierOverride);
|
||||
}
|
||||
|
||||
bool IDisarmedAct.Disarmed(DisarmedActEventArgs eventArgs)
|
||||
{
|
||||
if (!IoCManager.Resolve<IRobustRandom>().Prob(eventArgs.PushProbability))
|
||||
return false;
|
||||
|
||||
Paralyze(4f);
|
||||
|
||||
var source = eventArgs.Source;
|
||||
|
||||
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/thudswoosh.ogg", source,
|
||||
AudioHelpers.WithVariation(0.025f));
|
||||
|
||||
source.PopupMessageOtherClients(Loc.GetString("{0} pushes {1}!", source, eventArgs.Target.Name));
|
||||
source.PopupMessageCursor(Loc.GetString("You push {0}!", eventArgs.Target.Name));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user