From 52a145f7f1d24ebe44df69b4f0bcef1e02fb2626 Mon Sep 17 00:00:00 2001 From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Thu, 20 Mar 2025 10:06:55 +0300 Subject: [PATCH] Support separate displacement maps for left and right hand (#35820) * Update HandsSystem.cs * Update HandsComponent.cs --- Content.Client/Hands/Systems/HandsSystem.cs | 7 ++++++- Content.Shared/Hands/Components/HandsComponent.cs | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Content.Client/Hands/Systems/HandsSystem.cs b/Content.Client/Hands/Systems/HandsSystem.cs index 68800a2afe..f879e06a20 100644 --- a/Content.Client/Hands/Systems/HandsSystem.cs +++ b/Content.Client/Hands/Systems/HandsSystem.cs @@ -349,7 +349,12 @@ namespace Content.Client.Hands.Systems sprite.LayerSetData(index, layerData); //Add displacement maps - if (handComp.HandDisplacement is not null) + if (hand.Location == HandLocation.Left && handComp.LeftHandDisplacement is not null) + _displacement.TryAddDisplacement(handComp.LeftHandDisplacement, sprite, index, key, revealedLayers); + else if (hand.Location == HandLocation.Right && handComp.RightHandDisplacement is not null) + _displacement.TryAddDisplacement(handComp.RightHandDisplacement, sprite, index, key, revealedLayers); + //Fallback to default displacement map + else if (handComp.HandDisplacement is not null) _displacement.TryAddDisplacement(handComp.HandDisplacement, sprite, index, key, revealedLayers); } diff --git a/Content.Shared/Hands/Components/HandsComponent.cs b/Content.Shared/Hands/Components/HandsComponent.cs index b3cb51ae35..0af318ba06 100644 --- a/Content.Shared/Hands/Components/HandsComponent.cs +++ b/Content.Shared/Hands/Components/HandsComponent.cs @@ -78,9 +78,24 @@ public sealed partial class HandsComponent : Component [DataField, ViewVariables(VVAccess.ReadWrite)] public TimeSpan ThrowCooldown = TimeSpan.FromSeconds(0.5f); + /// + /// Fallback displacement map applied to all sprites in the hand, unless otherwise specified + /// [DataField] public DisplacementData? HandDisplacement; + /// + /// If defined, applies to all sprites in the left hand, ignoring + /// + [DataField] + public DisplacementData? LeftHandDisplacement; + + /// + /// If defined, applies to all sprites in the right hand, ignoring + /// + [DataField] + public DisplacementData? RightHandDisplacement; + /// /// If false, hands cannot be stripped, and they do not show up in the stripping menu. ///