diff --git a/Content.Client/Input/ContentContexts.cs b/Content.Client/Input/ContentContexts.cs index afe9ed60656..7a8a9938545 100644 --- a/Content.Client/Input/ContentContexts.cs +++ b/Content.Client/Input/ContentContexts.cs @@ -81,7 +81,6 @@ public static void SetupContexts(IInputContextContainer contexts) human.AddFunction(ContentKeyFunctions.Arcade1); human.AddFunction(ContentKeyFunctions.Arcade2); human.AddFunction(ContentKeyFunctions.Arcade3); - human.AddFunction(ContentKeyFunctions.LieDownStandUp); // actions should be common (for ghosts, mobs, etc) common.AddFunction(ContentKeyFunctions.OpenActionsMenu); diff --git a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs index 1ecf44235d1..a575f1ba51c 100644 --- a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs +++ b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs @@ -181,7 +181,6 @@ void AddCheckBox(string checkBoxName, bool currentState, Action -/// Makes the target to lie down. -/// -[Access(typeof(SharedLieDownSystem))] -[RegisterComponent, NetworkedComponent()] -public sealed partial class LyingDownComponent : Component -{ - /// - /// The action to lie down or stand up. - /// - [DataField] - public EntProtoId? MakeToStandUpAction = "action-name-make-standup"; -} - -[Serializable, NetSerializable] -public sealed class ChangeStandingStateEvent : EntityEventArgs {} diff --git a/Content.Shared/LieDown/SharedLieDownSystem.cs b/Content.Shared/LieDown/SharedLieDownSystem.cs deleted file mode 100644 index 9db46ed0c41..00000000000 --- a/Content.Shared/LieDown/SharedLieDownSystem.cs +++ /dev/null @@ -1,171 +0,0 @@ -using Content.Shared.Actions; -using Content.Shared.Examine; -using Content.Shared.IdentityManagement; -using Content.Shared.Input; -using Content.Shared.Interaction; -using Content.Shared.Movement.Systems; -using Content.Shared.Standing; -using Content.Shared.Verbs; -using Robust.Shared.Input.Binding; -using Robust.Shared.Player; - -namespace Content.Shared.LieDown; - -public class SharedLieDownSystem : EntitySystem -{ - [Dependency] private readonly SharedActionsSystem _actions = default!; - [Dependency] private readonly MovementSpeedModifierSystem _movement = default!; - [Dependency] private readonly StandingStateSystem _standing = default!; - - public override void Initialize() - { - SubscribeLocalEvent(OnInteractHand); - SubscribeLocalEvent>(AddStandUpVerb); - SubscribeLocalEvent(OnExamined); - SubscribeLocalEvent(OnRefresh); - - SubscribeLocalEvent(OnComponentStartup); - SubscribeLocalEvent(OnComponentShutdown); - - // Bind keybinds to lie down action - SubscribeNetworkEvent(OnChangeAction); - CommandBinds.Builder - .Bind(ContentKeyFunctions.LieDownStandUp, InputCmdHandler.FromDelegate(ChangeLyingState)) - .Register(); - } - - private void OnComponentShutdown(EntityUid uid, LyingDownComponent component, ComponentShutdown args) - { - SwitchActions(uid); - _movement.RefreshMovementSpeedModifiers(uid); - } - - private void OnComponentStartup(EntityUid uid, LyingDownComponent component, ComponentStartup args) - { - SwitchActions(uid); - _movement.RefreshMovementSpeedModifiers(uid); - } - - /// - /// Send an update event when player pressed keybind. - /// - private void ChangeLyingState(ICommonSession? session) - { - RaiseNetworkEvent(new ChangeStandingStateEvent()); - } - - /// - /// Process player event, that pressed keybind. - /// - private void OnChangeAction(ChangeStandingStateEvent msg, EntitySessionEventArgs args) - { - if (!args.SenderSession.AttachedEntity.HasValue) - return; - - var uid = args.SenderSession.AttachedEntity.Value; - if (_standing.IsDown(uid)) - { - TryStandUp(uid); - } - else - { - TryLieDown(uid); - } - } - - /// - /// Update movement speed according to the lying state. - /// - private void OnRefresh(EntityUid uid, LyingDownComponent component, RefreshMovementSpeedModifiersEvent args) - { - if (_standing.IsDown(uid)) - { - args.ModifySpeed(0f, 0f); - } - else - { - args.ModifySpeed(1f, 1f); - } - } - - /// - /// Change available to player actions. - /// - private void SwitchActions(EntityUid uid) - { - var standingComponent = Comp(uid); - if (_standing.IsDown(uid)) - { - _actions.AddAction(uid, ref standingComponent.StandUpActionEntity, standingComponent.StandUpAction); - _actions.RemoveAction(uid, standingComponent.LieDownActionEntity); - } - else - { - _actions.AddAction(uid, ref standingComponent.LieDownActionEntity, standingComponent.LieDownAction); - _actions.RemoveAction(uid, standingComponent.StandUpActionEntity); - } - } - - /// - /// When interacting with a lying down person, add ability to make him stand up. - /// - private void OnInteractHand(EntityUid uid, LyingDownComponent component, InteractHandEvent args) - { - TryStandUp(args.Target); - } - - /// - /// Add a verb to player menu to make him stand up. - /// - private void AddStandUpVerb(EntityUid uid, LyingDownComponent component, GetVerbsEvent args) - { - if (!args.CanInteract || !args.CanAccess) - return; - - if (args.Target == args.User) - return; - - if (!_standing.IsDown(uid)) - return; - - AlternativeVerb verb = new() - { - Act = () => - { - TryStandUp(uid); - }, - Text = Loc.GetString(component.MakeToStandUpAction!), - Priority = 2 - }; - - args.Verbs.Add(verb); - } - - /// - /// If somebody examined a lying down person, add description. - /// - private void OnExamined(EntityUid uid, LyingDownComponent component, ExaminedEvent args) - { - if (args.IsInDetailsRange && _standing.IsDown(uid)) - { - args.PushMarkup(Loc.GetString("lying-down-examined", ("target", Identity.Entity(uid, EntityManager)))); - } - } - - public void TryStandUp(EntityUid uid) - { - if (!_standing.IsDown(uid) || !_standing.Stand(uid)) - return; - - RemCompDeferred(uid); - } - - public void TryLieDown(EntityUid uid) - { - if (_standing.IsDown(uid) || !_standing.Down(uid, false, false)) - return; - - EnsureComp(uid); - } -} - diff --git a/Content.Shared/Standing/StandingStateComponent.cs b/Content.Shared/Standing/StandingStateComponent.cs index b4516dd6157..5d7bb0a59fd 100644 --- a/Content.Shared/Standing/StandingStateComponent.cs +++ b/Content.Shared/Standing/StandingStateComponent.cs @@ -1,45 +1,24 @@ using Robust.Shared.Audio; using Robust.Shared.GameStates; -using Content.Shared.Actions; -using Robust.Shared.Prototypes; -using Robust.Shared.Serialization; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; -namespace Content.Shared.Standing; - - -[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] -[Access(typeof(StandingStateSystem))] -public sealed partial class StandingStateComponent : Component +namespace Content.Shared.Standing { - [ViewVariables(VVAccess.ReadWrite)] - [DataField] - public SoundSpecifier DownSound { get; private set; } = new SoundCollectionSpecifier("BodyFall"); - - [DataField, AutoNetworkedField] - public bool Standing = true; - - /// - /// List of fixtures that had their collision mask changed when the entity was downed. - /// Required for re-adding the collision mask. - /// - [DataField, AutoNetworkedField] - public List ChangedFixtures = new(); - - [DataField] - public EntProtoId LieDownAction = "ActionLieDown"; - - [DataField, AutoNetworkedField] - public EntityUid? LieDownActionEntity; - - [DataField("stand-up-action")] - public EntProtoId StandUpAction = "ActionStandUp"; - - [DataField, AutoNetworkedField] - public EntityUid? StandUpActionEntity; + [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] + [Access(typeof(StandingStateSystem))] + public sealed partial class StandingStateComponent : Component + { + [ViewVariables(VVAccess.ReadWrite)] + [DataField] + public SoundSpecifier DownSound { get; private set; } = new SoundCollectionSpecifier("BodyFall"); + + [DataField, AutoNetworkedField] + public bool Standing { get; set; } = true; + + /// + /// List of fixtures that had their collision mask changed when the entity was downed. + /// Required for re-adding the collision mask. + /// + [DataField, AutoNetworkedField] + public List ChangedFixtures = new(); + } } - -public sealed partial class LieDownActionEvent : InstantActionEvent {} -public sealed partial class StandUpActionEvent : InstantActionEvent {} - diff --git a/Content.Shared/Standing/StandingStateSystem.cs b/Content.Shared/Standing/StandingStateSystem.cs index 1a3f59f8f02..ed586e970dc 100644 --- a/Content.Shared/Standing/StandingStateSystem.cs +++ b/Content.Shared/Standing/StandingStateSystem.cs @@ -1,7 +1,4 @@ -using Content.Shared.Actions; using Content.Shared.Hands.Components; -using Content.Shared.LieDown; -using Content.Shared.Movement.Systems; using Content.Shared.Physics; using Content.Shared.Rotation; using Robust.Shared.Audio; @@ -16,20 +13,10 @@ public sealed class StandingStateSystem : EntitySystem [Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!; - [Dependency] private readonly SharedActionsSystem _actions = default!; - [Dependency] private readonly SharedLieDownSystem _lieDown = default!; - [Dependency] private readonly ActionContainerSystem _actionContainer = default!; // If StandingCollisionLayer value is ever changed to more than one layer, the logic needs to be edited. - private const int StandingCollisionLayer = (int)CollisionGroup.MidImpassable; + private const int StandingCollisionLayer = (int) CollisionGroup.MidImpassable; - public override void Initialize() - { - SubscribeLocalEvent(OnComponentInit); - SubscribeLocalEvent(OnLieDownAction); - SubscribeLocalEvent(OnStandUpAction); - SubscribeLocalEvent(OnMapInit); - } public bool IsDown(EntityUid uid, StandingStateComponent? standingState = null) { if (!Resolve(uid, ref standingState, false)) @@ -38,37 +25,6 @@ public bool IsDown(EntityUid uid, StandingStateComponent? standingState = null) return !standingState.Standing; } - private void OnMapInit(EntityUid uid, StandingStateComponent component, MapInitEvent args) - { - _actionContainer.EnsureAction(uid, ref component.LieDownActionEntity, component.LieDownAction); - _actionContainer.EnsureAction(uid, ref component.StandUpActionEntity, component.StandUpAction); - Dirty(uid, component); - } - - /// - /// When component is added to player, add an action. - /// - private void OnComponentInit(EntityUid uid, StandingStateComponent component, ComponentStartup args) - { - _actions.AddAction(uid, ref component.LieDownActionEntity, component.LieDownAction); - } - - /// - /// Event that being risen on lie down attempt. - /// - private void OnLieDownAction(EntityUid uid, StandingStateComponent component, LieDownActionEvent args) - { - _lieDown.TryLieDown(uid); - } - - /// - /// Event that being risen on stand up attempt. - /// - private void OnStandUpAction(EntityUid uid, StandingStateComponent component, StandUpActionEvent args) - { - _lieDown.TryStandUp(uid); - } - public bool Down(EntityUid uid, bool playSound = true, bool dropHeldItems = true, StandingStateComponent? standingState = null, AppearanceComponent? appearance = null, diff --git a/Resources/Locale/en-US/actions/actions/lie-down.ftl b/Resources/Locale/en-US/actions/actions/lie-down.ftl deleted file mode 100644 index 2160f49afc2..00000000000 --- a/Resources/Locale/en-US/actions/actions/lie-down.ftl +++ /dev/null @@ -1,5 +0,0 @@ -action-name-liedown = Lie down -action-name-standup = Stand up -action-name-make-standup = Make to stand up -lying-down-examined = [color=lightblue]{CAPITALIZE(SUBJECT($target))} {CONJUGATE-BE($target)} is lying down.[/color] -ui-options-function-lie-down-stand-up = Lie on the ground diff --git a/Resources/Prototypes/Actions/liedown.yml b/Resources/Prototypes/Actions/liedown.yml deleted file mode 100644 index aee3b552bc1..00000000000 --- a/Resources/Prototypes/Actions/liedown.yml +++ /dev/null @@ -1,19 +0,0 @@ -- type: entity - id: ActionStandUp - name: Stand Up - description: Toggles all glove actions on left click. Includes your doorjack, draining power, stunning enemies, downloading research and calling in a threat. - noSpawn: true - components: - - type: InstantAction - icon: Interface/Actions/stand-up-state.png - event: !type:StandUpActionEvent {} - -- type: entity - id: ActionLieDown - name: Lie Down - description: Toggles all glove actions on left click. Includes your doorjack, draining power, stunning enemies, downloading research and calling in a threat. - noSpawn: true - components: - - type: InstantAction - icon: Interface/Actions/lie-down-state.png - event: !type:LieDownActionEvent {} diff --git a/Resources/Textures/Interface/Actions/lie-down-state.png b/Resources/Textures/Interface/Actions/lie-down-state.png deleted file mode 100644 index 436ff4ee198..00000000000 Binary files a/Resources/Textures/Interface/Actions/lie-down-state.png and /dev/null differ diff --git a/Resources/Textures/Interface/Actions/stand-up-state.png b/Resources/Textures/Interface/Actions/stand-up-state.png deleted file mode 100644 index 4318582ff4a..00000000000 Binary files a/Resources/Textures/Interface/Actions/stand-up-state.png and /dev/null differ diff --git a/Resources/keybinds.yml b/Resources/keybinds.yml index dab8819a6be..c11f59d17c9 100644 --- a/Resources/keybinds.yml +++ b/Resources/keybinds.yml @@ -1,4 +1,4 @@ -version: 1 # Not used right now, whatever. +version: 1 # Not used right now, whatever. binds: - function: UIClick type: State @@ -540,7 +540,3 @@ binds: - function: Hotbar9 type: State key: Num9 -- function: LieDownStandUp - type: State - key: Z - mod1: Shift