Фикс лежания (#430)

* Fix

* commit

* clear

* commit

* / WD EDIT
This commit is contained in:
Spatison
2024-07-10 16:26:50 +03:00
committed by GitHub
parent 0b374ebd7c
commit 8deece0091
12 changed files with 145 additions and 26 deletions

View File

@@ -2,6 +2,7 @@ using System.Numerics;
using Content.Client.Stylesheets;
using Content.Shared.CCVar;
using Content.Shared.Input;
using Content.Shared._White;
using Robust.Client.AutoGenerated;
using Robust.Client.Input;
using Robust.Client.UserInterface;
@@ -97,6 +98,12 @@ namespace Content.Client.Options.UI.Tabs
_deferCommands.Add(_inputManager.SaveToUserData);
}
private void HandleToggleAutoGetUp(BaseButton.ButtonToggledEventArgs args) // WD EDIT
{
_cfg.SetCVar(WhiteCVars.AutoGetUp, args.Pressed);
_cfg.SaveToFile();
}
private void HandleStaticStorageUI(BaseButton.ButtonToggledEventArgs args)
{
_cfg.SetCVar(CCVars.StaticStorageUI, args.Pressed);
@@ -185,6 +192,7 @@ namespace Content.Client.Options.UI.Tabs
AddButton(ContentKeyFunctions.RotateStoredItem);
AddButton(ContentKeyFunctions.SaveItemLocation);
AddButton(ContentKeyFunctions.LieDown); // WD EDIT
AddCheckBox("ui-options-function-auto-get-up", _cfg.GetCVar(WhiteCVars.AutoGetUp), HandleToggleAutoGetUp); // WD EDIT
AddHeader("ui-options-header-interaction-adv");
AddButton(ContentKeyFunctions.SmartEquipBackpack);

View File

@@ -6,4 +6,4 @@ namespace Content.Client.Standing;
public sealed class StandingStateSystem : SharedStandingStateSystem
{
}
}

View File

@@ -0,0 +1,41 @@
using Content.Shared.Rotation;
using Robust.Client.GameObjects;
namespace Content.Client._White.Rotation;
public sealed class RotationVisualizerSystem : EntitySystem
{
[Dependency] private readonly AppearanceSystem _appearance = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize()
{
SubscribeLocalEvent<RotationVisualsComponent, MoveEvent>(OnMove);
}
private void OnMove(EntityUid uid, RotationVisualsComponent component, ref MoveEvent args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite) ||
!TryComp<AppearanceComponent>(uid, out var appearance))
return;
_appearance.TryGetData<RotationState>(uid, RotationVisuals.RotationState, out var state, appearance);
var rotation = _transform.GetWorldRotation(uid);
if (rotation.GetDir() is Direction.East or Direction.North or Direction.NorthEast or Direction.SouthEast)
{
if (state == RotationState.Horizontal &&
sprite.Rotation == component.DefaultRotation)
{
sprite.Rotation = Angle.FromDegrees(270);
}
return;
}
if (state == RotationState.Horizontal &&
sprite.Rotation == Angle.FromDegrees(270))
{
sprite.Rotation = component.DefaultRotation;
}
}
}