Files
wwdpublic/Content.Server/Standing/LayingDownSystem.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

34 lines
934 B
C#

using Content.Shared.Standing;
using Content.Shared.CCVar;
using Content.Shared.Input;
using Content.Shared.Movement.Systems;
using Content.Shared.Popups;
using Robust.Shared.Configuration;
using Robust.Shared.Input.Binding;
using Robust.Shared.Player;
namespace Content.Server.Standing;
public sealed class LayingDownSystem : SharedLayingDownSystem
{
[Dependency] private readonly INetConfigurationManager _cfg = default!;
public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<CheckAutoGetUpEvent>(OnCheckAutoGetUp);
}
private void OnCheckAutoGetUp(CheckAutoGetUpEvent ev, EntitySessionEventArgs args)
{
var uid = GetEntity(ev.User);
if (!TryComp(uid, out LayingDownComponent? layingDown))
return;
layingDown.AutoGetUp = _cfg.GetClientCVar(args.SenderSession.Channel, CCVars.AutoGetUp);
Dirty(uid, layingDown);
}
}