@@ -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);
|
||||
|
||||
41
Content.Client/_White/Rotation/RotationVisualizerSystem.cs
Normal file
41
Content.Client/_White/Rotation/RotationVisualizerSystem.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,6 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Standing;
|
||||
using Content.Shared.Standing.Systems;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Stunnable;
|
||||
using Content.Shared.Throwing;
|
||||
@@ -35,8 +33,6 @@ public abstract partial class SharedBuckleSystem
|
||||
SubscribeLocalEvent<BuckleComponent, InsertIntoEntityStorageAttemptEvent>(OnBuckleInsertIntoEntityStorageAttempt);
|
||||
|
||||
SubscribeLocalEvent<BuckleComponent, PreventCollideEvent>(OnBucklePreventCollide);
|
||||
SubscribeLocalEvent<BuckleComponent, DownAttemptEvent>(OnBuckleDownAttempt);
|
||||
SubscribeLocalEvent<BuckleComponent, StandAttemptEvent>(OnBuckleStandAttempt);
|
||||
SubscribeLocalEvent<BuckleComponent, ThrowPushbackAttemptEvent>(OnBuckleThrowPushbackAttempt);
|
||||
SubscribeLocalEvent<BuckleComponent, UpdateCanMoveEvent>(OnBuckleUpdateCanMove);
|
||||
}
|
||||
@@ -114,18 +110,6 @@ public abstract partial class SharedBuckleSystem
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void OnBuckleDownAttempt(EntityUid uid, BuckleComponent component, DownAttemptEvent args)
|
||||
{
|
||||
if (component.Buckled)
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnBuckleStandAttempt(EntityUid uid, BuckleComponent component, StandAttemptEvent args)
|
||||
{
|
||||
if (component.Buckled)
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnBuckleThrowPushbackAttempt(EntityUid uid, BuckleComponent component, ThrowPushbackAttemptEvent args)
|
||||
{
|
||||
if (component.Buckled)
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Content.Shared.Standing.Systems;
|
||||
using Content.Shared._White.Standing;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Standing
|
||||
{
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedStandingStateSystem))]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedStandingStateSystem), typeof(StandingStateSystem))]
|
||||
public sealed partial class StandingStateComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||
@@ -24,6 +25,10 @@ namespace Content.Shared.Standing
|
||||
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool CanLieDown = false;
|
||||
|
||||
// WD EDIT
|
||||
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool AutoGetUp = false;
|
||||
|
||||
/// <summary>
|
||||
/// List of fixtures that had their collision mask changed when the entity was downed.
|
||||
/// Required for re-adding the collision mask.
|
||||
@@ -35,7 +40,13 @@ namespace Content.Shared.Standing
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class ChangeStandingStateEvent : EntityEventArgs
|
||||
public sealed class ChangeStandingStateEvent : CancellableEntityEventArgs
|
||||
{
|
||||
}
|
||||
|
||||
// WD EDIT
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class CheckAutoGetUpEvent : CancellableEntityEventArgs
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ using Content.Shared.Physics;
|
||||
using Content.Shared.Rotation;
|
||||
using Content.Shared.Slippery;
|
||||
using Content.Shared.Stunnable;
|
||||
using Content.Shared._White.Wizard.Timestop;
|
||||
using Content.Shared.Buckle;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Physics;
|
||||
@@ -14,6 +17,7 @@ using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
namespace Content.Shared.Standing.Systems;
|
||||
|
||||
public abstract partial class SharedStandingStateSystem : EntitySystem
|
||||
@@ -25,6 +29,9 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!; // WD EDIT
|
||||
[Dependency] private readonly SharedStunSystem _stun = default!; // WD EDIT
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!; // WD EDIT
|
||||
[Dependency] private readonly SharedBuckleSystem _buckle = default!; // WD EDIT
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!; // WD EDIT
|
||||
[Dependency] private readonly SharedRotationVisualsSystem _rotation = default!; // WD EDIT
|
||||
|
||||
// If StandingCollisionLayer value is ever changed to more than one layer, the logic needs to be edited.
|
||||
private const int StandingCollisionLayer = (int)CollisionGroup.MidImpassable;
|
||||
@@ -53,6 +60,9 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
||||
|
||||
private void OnChangeState(ChangeStandingStateEvent ev, EntitySessionEventArgs args)
|
||||
{
|
||||
if (TryComp<FrozenComponent>(args.SenderSession.AttachedEntity, out _)) // WD EDIT
|
||||
return;
|
||||
|
||||
if (!args.SenderSession.AttachedEntity.HasValue)
|
||||
{
|
||||
return;
|
||||
@@ -60,6 +70,11 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
||||
|
||||
var uid = args.SenderSession.AttachedEntity.Value;
|
||||
|
||||
if (!TryComp(uid, out StandingStateComponent? standing)) // WD EDIT
|
||||
return;
|
||||
|
||||
RaiseNetworkEvent(new CheckAutoGetUpEvent());
|
||||
|
||||
if (_stun.IsParalyzed(uid))
|
||||
{
|
||||
return;
|
||||
@@ -70,18 +85,23 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsDown(uid))
|
||||
if (IsDown(uid, standing))
|
||||
{
|
||||
TryStandUp(uid);
|
||||
TryStandUp(uid, standing);
|
||||
}
|
||||
else
|
||||
{
|
||||
TryLieDown(uid);
|
||||
TryLieDown(uid, standing);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStandingUpDoAfter(EntityUid uid, StandingStateComponent component, StandingUpDoAfterEvent args)
|
||||
{
|
||||
if (args.Handled) // WD EDIT
|
||||
{
|
||||
component.CurrentState = StandingState.Lying;
|
||||
return;
|
||||
}
|
||||
Stand(uid);
|
||||
}
|
||||
|
||||
@@ -192,6 +212,9 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
||||
// Optional component.
|
||||
Resolve(uid, ref appearance, ref hands, false);
|
||||
|
||||
if (TryComp(uid, out BuckleComponent? buckle) && buckle.Buckled && !_buckle.TryUnbuckle(uid, uid, buckleComp: buckle)) // WD EDIT
|
||||
return false;
|
||||
|
||||
// This is just to avoid most callers doing this manually saving boilerplate
|
||||
// 99% of the time you'll want to drop items but in some scenarios (e.g. buckling) you don't want to.
|
||||
// We do this BEFORE downing because something like buckle may be blocking downing but we want to drop hand items anyway
|
||||
@@ -212,6 +235,14 @@ public abstract partial class SharedStandingStateSystem : EntitySystem
|
||||
|
||||
standingState.CurrentState = StandingState.Lying;
|
||||
Dirty(uid, standingState);
|
||||
|
||||
var rotation = _transform.GetWorldRotation(uid);
|
||||
|
||||
if (rotation.GetDir() is Direction.East or Direction.North or Direction.NorthEast or Direction.SouthEast)
|
||||
_rotation.SetHorizontalAngle(uid, Angle.FromDegrees(270));
|
||||
else
|
||||
_rotation.ResetHorizontalAngle(uid);
|
||||
|
||||
RaiseLocalEvent(uid, new DownedEvent());
|
||||
|
||||
// Seemed like the best place to put it
|
||||
|
||||
@@ -104,6 +104,7 @@ public abstract class SharedStunSystem : EntitySystem
|
||||
|
||||
private void OnKnockInit(EntityUid uid, KnockedDownComponent component, ComponentInit args)
|
||||
{
|
||||
RaiseNetworkEvent(new CheckAutoGetUpEvent()); // WD EDIT
|
||||
_standingState.Down(uid);
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ public abstract class SharedStunSystem : EntitySystem
|
||||
{
|
||||
// WD EDIT START
|
||||
// Don't stand up if we can lie down via keybind
|
||||
if (!TryComp(uid, out StandingStateComponent? standing) || standing.CanLieDown)
|
||||
if (!TryComp(uid, out StandingStateComponent? standing) || !(!standing.CanLieDown || standing.AutoGetUp)) // WD EDIT
|
||||
return;
|
||||
|
||||
_standingState.Stand(uid, standing);
|
||||
|
||||
29
Content.Shared/_White/Standing/StandingStateSystem.cs
Normal file
29
Content.Shared/_White/Standing/StandingStateSystem.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Content.Shared.Standing;
|
||||
using Robust.Shared.Configuration;
|
||||
|
||||
namespace Content.Shared._White.Standing;
|
||||
|
||||
public sealed class StandingStateSystem : EntitySystem
|
||||
{
|
||||
|
||||
[Dependency] private readonly INetConfigurationManager _cfg = default!;
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeNetworkEvent<CheckAutoGetUpEvent>(OnCheckAutoGetUp);
|
||||
}
|
||||
|
||||
|
||||
private void OnCheckAutoGetUp(CheckAutoGetUpEvent ev, EntitySessionEventArgs args)
|
||||
{
|
||||
if (!args.SenderSession.AttachedEntity.HasValue)
|
||||
return;
|
||||
|
||||
var uid = args.SenderSession.AttachedEntity.Value;
|
||||
|
||||
if (!TryComp(uid, out StandingStateComponent? standing))
|
||||
return;
|
||||
|
||||
standing.AutoGetUp = _cfg.GetClientCVar(args.SenderSession.Channel, WhiteCVars.AutoGetUp);
|
||||
Dirty(args.SenderSession.AttachedEntity.Value, standing);
|
||||
}
|
||||
}
|
||||
@@ -307,6 +307,12 @@ public sealed class WhiteCVars
|
||||
public static readonly CVarDef<bool> LogChatActions =
|
||||
CVarDef.Create("white.log_to_chat", true, CVar.CLIENT | CVar.ARCHIVE | CVar.REPLICATED);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether automatic get up is required
|
||||
/// </summary>
|
||||
public static readonly CVarDef<bool> AutoGetUp =
|
||||
CVarDef.Create("white.auto_get_up", true, CVar.CLIENT | CVar.ARCHIVE | CVar.REPLICATED);
|
||||
|
||||
/*
|
||||
* Aspects
|
||||
*/
|
||||
|
||||
@@ -36,6 +36,7 @@ public sealed class FreezeContactsSystem : EntitySystem
|
||||
SubscribeLocalEvent<FrozenComponent, ComponentRemove>(OnRemove);
|
||||
SubscribeLocalEvent<FrozenComponent, PreventCollideEvent>(OnPreventCollide);
|
||||
SubscribeLocalEvent<FrozenComponent, EntGotInsertedIntoContainerMessage>(OnGetInserted);
|
||||
SubscribeLocalEvent<FrozenComponent, StandingUpDoAfterEvent>(OnStandingUpDoAfter);
|
||||
|
||||
SubscribeLocalEvent<FrozenComponent, StandAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<FrozenComponent, DownAttemptEvent>(OnAttempt);
|
||||
@@ -61,6 +62,11 @@ public sealed class FreezeContactsSystem : EntitySystem
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnStandingUpDoAfter(EntityUid uid, FrozenComponent component, StandingUpDoAfterEvent args)
|
||||
{
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void OnAttempt(EntityUid uid, FrozenComponent component, CancellableEntityEventArgs args)
|
||||
{
|
||||
args.Cancel();
|
||||
|
||||
@@ -137,6 +137,7 @@ ui-options-function-swap-hands = Swap hands
|
||||
ui-options-function-move-stored-item = Move stored item
|
||||
ui-options-function-rotate-stored-item = Rotate stored item
|
||||
ui-options-function-lie-down = Lie down/Get up
|
||||
ui-options-function-auto-get-up = Automatically get up when falling
|
||||
ui-options-function-save-item-location = Save item location
|
||||
ui-options-static-storage-ui = Lock storage window to hotbar
|
||||
|
||||
|
||||
@@ -139,6 +139,7 @@ ui-options-function-swap-hands = Поменять руки
|
||||
ui-options-function-move-stored-item = Переместить хранящийся объект
|
||||
ui-options-function-rotate-stored-item = Повернуть хранящийся объект
|
||||
ui-options-function-lie-down = Лечь/встать
|
||||
ui-options-function-auto-get-up = Автоматически вставать при падении
|
||||
ui-options-function-save-item-location = Сохранить позицию предмета
|
||||
ui-options-static-storage-ui = Закрепить интерфейс хранилища на хотбаре
|
||||
|
||||
|
||||
Reference in New Issue
Block a user