Files
wwdpublic/Content.Shared/Standing/LayingDownComponent.cs
Mnemotechnican 64f30dca54 Feat: Togglable Under-Table Crawling (#1036)
# Description
This reverts most code changes done by
https://github.com/Simple-Station/Einstein-Engines/pull/939 and
re-implements them in a better way:
- Players can now toggle under-furniture crawling with a keybind
(shift-R by default)
- Crawling that way is 50% slower for obvious balancing reasons
- The respective cvar for it is now true by default and prevents players
from beginning the "crawl under furniture" thing

Also cleaned up a few methods I was seriously pissed off by. There is
still a lot to clean up and fix, but I will leave it for a dedicated PR
in the future.

# Why (balancing)
Let me lie on the bed instead of under it!!!!!!!

<details><summary><h1>Media</h1></summary>
<p>


https://github.com/user-attachments/assets/5f04c82a-b88b-4005-8052-a1a6f011bcc9

</p>
</details>

# Changelog
🆑
- add: You can now toggle crawling under furniture! The default keybind
is Shift-R, you can change it in settings.
2024-10-19 13:45:49 +07:00

38 lines
1.2 KiB
C#

using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Standing;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class LayingDownComponent : Component
{
[DataField, AutoNetworkedField]
public TimeSpan StandingUpTime = TimeSpan.FromSeconds(1);
[DataField, AutoNetworkedField]
public float LyingSpeedModifier = 0.35f,
CrawlingUnderSpeedModifier = 0.5f;
[DataField, AutoNetworkedField]
public bool AutoGetUp;
/// <summary>
/// If true, the entity is choosing to crawl under furniture. This is purely visual and has no effect on physics.
/// </summary>
[DataField, AutoNetworkedField]
public bool IsCrawlingUnder = false;
[DataField, AutoNetworkedField]
public int NormalDrawDepth = (int) DrawDepth.DrawDepth.Mobs,
CrawlingUnderDrawDepth = (int) DrawDepth.DrawDepth.SmallMobs;
}
[Serializable, NetSerializable]
public sealed class ChangeLayingDownEvent : CancellableEntityEventArgs;
[Serializable, NetSerializable]
public sealed class CheckAutoGetUpEvent(NetEntity user) : CancellableEntityEventArgs
{
public NetEntity User = user;
}