Make Dionas Slow And Steady (#704)

# Description

Dionas now have 25% slower movement speed in exchange for total slip
immunity and slow immunity (except lying down).

Note that this also prevents slowdowns from hunger and thirst.

This also fixes an existing bug with Sluggish and Snail-Paced related to
`TraitSpeedModifierSystem`, as it was not applying the reduced movement
speed upon spawning, only when the movement speed has been modified by
another source. `TraitSpeedModifierSystem` has been moved from
`Content.Server` to `Content.Shared`.

This used to be a trait costing 3 points, but is now given for free to
all Dionas per request of @VMSolidus.

## Media

<details><summary>Expand</summary>

**Speed with no items**


![image](https://github.com/user-attachments/assets/b723614a-79fe-401c-ae53-2ad98ff9a6d3)

**Speed wearing a jugsuit, wearing a duffel bag, holding one duffel bag
in each arm, and walking through a puddle of glue covered in spider
webs.**


![image](https://github.com/user-attachments/assets/a934d2c1-437f-463c-8fe3-63b7b54a1f58)

</details>

# Changelog

🆑 Skubman
- add: Dionas have been given a 25% slower movement speed. In exchange
for that, they gain absolute slip immunity and movement speed modifier
immunity. This makes them immune to slowdown from things like
duffelbags, hardsuits, and spider webs.
- fix: Sluggish and Snail-Paced will now properly apply their movement
penalties upon joining.
This commit is contained in:
Angelo Fallaria
2024-08-10 01:28:01 +08:00
committed by GitHub
parent f0340314ad
commit f4d2e3551b
9 changed files with 88 additions and 26 deletions

View File

@@ -1,5 +1,6 @@
using Content.Shared.Inventory;
using Content.Shared.Movement.Components;
using Content.Shared.Traits.Assorted.Components;
using Robust.Shared.Timing;
namespace Content.Shared.Movement.Systems
@@ -16,7 +17,11 @@ namespace Content.Shared.Movement.Systems
if (_timing.ApplyingState)
return;
var ev = new RefreshMovementSpeedModifiersEvent();
var isImmune = false;
if (HasComp<SpeedModifierImmunityComponent>(uid))
isImmune = true;
var ev = new RefreshMovementSpeedModifiersEvent(isImmune);
RaiseLocalEvent(uid, ev);
if (MathHelper.CloseTo(ev.WalkSpeedModifier, move.WalkSpeedModifier) &&
@@ -64,10 +69,24 @@ namespace Content.Shared.Movement.Systems
public float WalkSpeedModifier { get; private set; } = 1.0f;
public float SprintSpeedModifier { get; private set; } = 1.0f;
public void ModifySpeed(float walk, float sprint)
/// <summary>
/// Whether this entity is immune to most movement speed modifiers.
/// Bypassable by setting bypassImmunity to true.
/// </summary
private bool IsImmune = false;
public void ModifySpeed(float walk, float sprint, bool bypassImmunity = false)
{
if (IsImmune && !bypassImmunity)
return;
WalkSpeedModifier *= walk;
SprintSpeedModifier *= sprint;
}
public RefreshMovementSpeedModifiersEvent(bool isImmune = false)
{
IsImmune = isImmune;
}
}
}