mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 05:59:03 +03:00
## Mirror of PR #24977: [Fix bypassing vaulting clumsy check with verb action.](https://github.com/space-wizards/space-station-14/pull/24977) from <img src="https://avatars.githubusercontent.com/u/10567778?v=4" alt="space-wizards" width="22"/> [space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14) ###### `225bc3c5aeffbef6286b607b02cd24a8ad75a437` PR opened by <img src="https://avatars.githubusercontent.com/u/85356?v=4" width="16"/><a href="https://github.com/Tayrtahn"> Tayrtahn</a> at 2024-02-05 21:32:50 UTC --- PR changed 7 files with 101 additions and 39 deletions. The PR had the following labels: - Status: Needs Review --- <details open="true"><summary><h1>Original Body</h1></summary> > <!-- Please read these guidelines before opening your PR: https://docs.spacestation14.io/en/getting-started/pr-guideline --> > <!-- The text between the arrows are comments - they will not be visible on your PR. --> > > ## About the PR > <!-- What did you change in this PR? --> > Stops clumsy characters being able to climb/vault onto tables and such by using alt-click or the verb menu instead of drag-dropping. > > This also fixes a separate bug where, when a clumsy character managed to pass the bonk check, the action would just cancel and the character didn't actually climb the object. Passing the check will now let the character climb. > > Additionally, this fixes a oddity where the ability for mobs to climb was determined by whether or not they had feet/legs, which was arbitrary and problematic for creatures like slimes (which should be able to ooze up onto a table). This check could also be bypassed by using the verb instead of drag-dropping, so that was fixed too. The ability for mobs to climb is now controlled in the prototypes. > > The default chance of a clumsy character bonking on a climbable has also been reduced from 75% to 50% to compensate somewhat. > > ## Why / Balance > <!-- Why was it changed? Link any discussions or issues here. Please discuss how this would affect game balance. --> > Fixes #24951 > Fixes #17423 > Fixes #25951 > > ## Technical details > <!-- If this is a code change, summarize at high level how your new code works. This makes it easier to review. --> > ClimbSystem now raises AttemptClimbEvent as part of TryClimb, and aborts climbing if it gets cancelled. This makes sure that all code paths go through a clumsy check. BonkSystem now listens for AttemptClimbEvents and responds to them instead of trying to intercept DragDropEvents. > CanVault now gets checked in TryClimb as well, to prevent bypassing it. > > The logic for climbing capabilities is now: > - The presence of ClimbingComponent makes an entity able to be placed on surfaces like tables. > - ClimbingComponent.CanClimb controls whether it can climb onto surfaces by drag-drop or verb. > > The new field defaults to true to minimize changes to existing behavior. Some mobs will have gained the ability to climb when previously they couldn't, but that should be less impactful than the opposite and can be resolved by YML changes in the future. > > ## Media > <!-- > PRs which make ingame changes (adding clothing, items, new features, etc) are required to have media attached that showcase the changes. > Small fixes/refactors are exempt. > Any media may be used in SS14 progress reports, with clear credit given. > > If you're unsure whether your PR will require media, ask a maintainer. > > Check the box below to confirm that you have in fact seen this (put an X in the brackets, like [X]): > --> > > - [x] I have added screenshots/videos to this PR showcasing its changes ingame, **or** this PR does not require an ingame showcase > > ## Breaking changes > <!-- > List any breaking changes, including namespace, public class/method/field changes, prototype renames; and provide instructions for fixing them. This will be pasted in #codebase-changes. > --> > > > **Changelog** > <!-- > Make players aware of new features and changes that could affect how they play the game by adding a Changelog entry. Please read the Changelog guidelines located at: https://docs.spacestation14.io/en/getting-started/pr-guideline#changelog > --> > > <!-- > Make sure to take this Changelog template out of the comment block in order for it to show up. > 🆑 > - add: Added fun! > - remove: Removed fun! > - tweak: Changed fun! > - fix: Fixed fun! > --> > 🆑 > - fix: Clumsy characters can no longer avoid bonking their heads by using the Climb verb. > - tweak: Clumsy characters are less likely to bonk their heads when trying to climb. </details> Co-authored-by: SimpleStation14 <Unknown>
50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using System.Numerics;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
|
|
|
namespace Content.Shared.Climbing.Components;
|
|
|
|
/// <summary>
|
|
/// Indicates that this entity is able to be placed on top of surfaces like tables.
|
|
/// Does not by itself allow the entity to carry out the action of climbing, unless
|
|
/// <see cref="CanClimb"/> is true. Use <see cref="CanForceClimb"/> to control whether
|
|
/// the entity can force other entities onto surfaces.
|
|
/// </summary>
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause]
|
|
public sealed partial class ClimbingComponent : Component
|
|
{
|
|
/// <summary>
|
|
/// Whether the owner is able to climb onto things by their own action.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public bool CanClimb = true;
|
|
|
|
/// <summary>
|
|
/// Whether the owner is climbing on a climbable entity.
|
|
/// </summary>
|
|
[AutoNetworkedField, DataField]
|
|
public bool IsClimbing;
|
|
|
|
/// <summary>
|
|
/// Whether the owner is being moved onto the climbed entity.
|
|
/// </summary>
|
|
[AutoNetworkedField, DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
|
|
[AutoPausedField]
|
|
public TimeSpan? NextTransition;
|
|
|
|
/// <summary>
|
|
/// Direction to move when transition.
|
|
/// </summary>
|
|
[AutoNetworkedField, DataField]
|
|
public Vector2 Direction;
|
|
|
|
/// <summary>
|
|
/// How fast the entity is moved when climbing.
|
|
/// </summary>
|
|
[DataField]
|
|
public float TransitionRate = 5f;
|
|
|
|
[AutoNetworkedField, DataField]
|
|
public Dictionary<string, int> DisabledFixtureMasks = new();
|
|
}
|