Files
wwdpublic/Content.Server/Standing/LayingDownSystem.cs
Piras314 0e1570edd6 Port Vehicles from Mira Sector (#964)
* sound swapping

* initial vehicle support

* horn and siren

* add text and tags

* add spawners

* add atv to cargo catalog

* revert sound swap

* I forgor to add JanicartKeys to tags

* fill ATV Crate

* change acceleration and friction values

* remove the hack

* Add Wheelchairs

* Add Wheelchair Bound Trait

* fixes

* surgery integration

* cleanup

* move to goob

* fix

* final _goobstation / # goobstation fixes

* fix laying down bug

* Mapping

* Final fixes

* Add wheelchairs to medivend and medlathe

* fix

* Fix infinite money glitch

---------

Co-authored-by: Scruq445 <storchdamien@gmail.com>

(cherry picked from commit 561d04cb0362ab86b048609698cf716fee67d3bf)
2025-03-29 18:14:52 +03:00

67 lines
1.9 KiB
C#

using Content.Shared.Standing;
using Content.Shared.Body.Components; // Goobstation
using Content.Shared.Body.Part; // Goobstation
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!;
[Dependency] private readonly EntityManager _entMan = 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;
// Goobstation start
bool fullyParalyzed = false;
if (_entMan.TryGetComponent<BodyComponent>(uid, out var body))
{
foreach (var legEntity in body.LegEntities)
{
if (_entMan.TryGetComponent<BodyPartComponent>(legEntity, out var partCmp))
{
if (partCmp.Enabled != true)
{
fullyParalyzed = true;
continue;
} else if (partCmp.Enabled == true)
{
fullyParalyzed = false;
break;
}
}
}
}
if (fullyParalyzed)
{
layingDown.AutoGetUp = false;
Dirty(uid, layingDown);
return;
}
// Goobstation end
layingDown.AutoGetUp = _cfg.GetClientCVar(args.SenderSession.Channel, CCVars.AutoGetUp);
Dirty(uid, layingDown);
}
}