* First pass * Fix access and rename banananium to bananium * Fix captialization of CookTimeInfoLabel * Fix InteractUsing calls * Remove unused [Dependency] * Replace obsolete references to Anchored with BodyType * Assign default value to shoving someone in disposals * Fix naming * Replace Initialize TryGetComponents with EnsureComponent * Rework AnchorableComponent * Fix singularity component * Replace obsolete usages of Angle.South * Fix efcore warning * Fix container tests * Fix DebugPressurePump invalid PressurePump yaml * Fix getting pathfinding region of grid 0 * Fix atmos plaque missing layer and add info message when it happens * Fix AiSteeringSystem steering in an invalid grid in entity test * Make content able to choose which log level leads to test failures * Revert container test fix for Acruid * Fix sprite, pipe and saving errors Make EntityTest print all errors instead of stopping on the first * Reorder singularity visualizer * Disable pvs for container occlusion adn simple predict reconcile, they use entities other than map ones Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com> Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
88 lines
2.7 KiB
C#
88 lines
2.7 KiB
C#
#nullable enable
|
|
using Content.Server.GameObjects.EntitySystems;
|
|
using Content.Server.Interfaces.GameObjects;
|
|
using Content.Server.Utility;
|
|
using Content.Shared.Audio;
|
|
using Content.Shared.GameObjects.Components.Mobs;
|
|
using Content.Shared.GameObjects.Components.Mobs.State;
|
|
using Content.Shared.Interfaces;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Localization;
|
|
using Robust.Shared.Player;
|
|
using Robust.Shared.Players;
|
|
using Robust.Shared.Random;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Server.GameObjects.Components.Mobs
|
|
{
|
|
[RegisterComponent]
|
|
[ComponentReference(typeof(SharedStunnableComponent))]
|
|
public class StunnableComponent : SharedStunnableComponent, IDisarmedAct
|
|
{
|
|
protected override void OnKnockdown()
|
|
{
|
|
EntitySystem.Get<StandingStateSystem>().Down(Owner);
|
|
}
|
|
|
|
protected override void OnKnockdownEnd()
|
|
{
|
|
if(Owner.TryGetComponent(out IMobStateComponent? mobState) && !mobState.IsIncapacitated())
|
|
EntitySystem.Get<StandingStateSystem>().Standing(Owner);
|
|
}
|
|
|
|
public void CancelAll()
|
|
{
|
|
KnockdownTimer = null;
|
|
StunnedTimer = null;
|
|
Dirty();
|
|
}
|
|
|
|
public void ResetStuns()
|
|
{
|
|
StunnedTimer = null;
|
|
SlowdownTimer = null;
|
|
|
|
if (KnockedDown &&
|
|
Owner.TryGetComponent(out IMobStateComponent? mobState) && !mobState.IsIncapacitated())
|
|
{
|
|
EntitySystem.Get<StandingStateSystem>().Standing(Owner);
|
|
}
|
|
|
|
KnockdownTimer = null;
|
|
Dirty();
|
|
}
|
|
|
|
protected override void OnInteractHand()
|
|
{
|
|
SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/thudswoosh.ogg", Owner, AudioHelpers.WithVariation(0.05f));
|
|
}
|
|
|
|
bool IDisarmedAct.Disarmed(DisarmedActEventArgs eventArgs)
|
|
{
|
|
if (!IoCManager.Resolve<IRobustRandom>().Prob(eventArgs.PushProbability))
|
|
return false;
|
|
|
|
Paralyze(4f);
|
|
|
|
var source = eventArgs.Source;
|
|
var target = eventArgs.Target;
|
|
|
|
if (source != null)
|
|
{
|
|
SoundSystem.Play(Filter.Pvs(source), "/Audio/Effects/thudswoosh.ogg", source,
|
|
AudioHelpers.WithVariation(0.025f));
|
|
if (target != null)
|
|
{
|
|
source.PopupMessageOtherClients(Loc.GetString("{0} pushes {1}!", source.Name, target.Name));
|
|
source.PopupMessageCursor(Loc.GetString("You push {0}!", target.Name));
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|