mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* documentation pass on content.server -> E! * APi pass on content.server for the E folder. * documentation pass on content.shared for e. * Apply suggestions from code review Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> * fixing documentation according to review part 1. * typo * Very minor fixes * And a short explanation about EUI --------- Co-authored-by: SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
47 lines
1.7 KiB
C#
47 lines
1.7 KiB
C#
using System.Linq;
|
|
using Content.Shared.Physics;
|
|
using Content.Shared.Slippery;
|
|
using Content.Shared.StepTrigger.Components;
|
|
using Robust.Shared.Physics;
|
|
using Robust.Shared.Physics.Systems;
|
|
|
|
namespace Content.Shared.EntityEffects.Effects;
|
|
|
|
/// <summary>
|
|
/// This effect permanently creates a slippery fixture for this entity and then makes this entity slippery like soap.
|
|
/// </summary>
|
|
/// <inheritdoc cref="EntityEffectSystem{T,TEffect}"/>
|
|
public sealed partial class SlipifyEntityEffectSystem : EntityEffectSystem<FixturesComponent, Slipify>
|
|
{
|
|
[Dependency] private CollisionWakeSystem _collisionWake = default!;
|
|
[Dependency] private FixtureSystem _fixture = default!;
|
|
|
|
protected override void Effect(Entity<FixturesComponent> entity, ref EntityEffectEvent<Slipify> args)
|
|
{
|
|
EnsureComp<SlipperyComponent>(entity, out var slippery);
|
|
slippery.SlipData = args.Effect.Slippery;
|
|
|
|
Dirty(entity, slippery);
|
|
|
|
EnsureComp<StepTriggerComponent>(entity);
|
|
|
|
if (entity.Comp.Fixtures.FirstOrDefault(x => x.Value.Hard).Value.Shape is not { } shape)
|
|
return;
|
|
|
|
_fixture.TryCreateFixture(entity, shape, "slips", 1, false, (int)CollisionGroup.SlipLayer, manager: entity.Comp);
|
|
|
|
// Need to disable collision wake so that mobs can collide with and slip on it
|
|
EnsureComp<CollisionWakeComponent>(entity, out var collisionWake);
|
|
_collisionWake.SetEnabled(entity, false, collisionWake);
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc cref="EntityEffect"/>
|
|
public sealed partial class Slipify : EntityEffectBase<Slipify>
|
|
{
|
|
/// <summary>
|
|
/// The slippery properties to apply upon the target.
|
|
/// </summary>
|
|
[DataField]
|
|
public SlipperyEffectEntry Slippery = new();
|
|
}
|