Support separate displacement maps for left and right hand (#35820)

* Update HandsSystem.cs

* Update HandsComponent.cs
This commit is contained in:
Ed
2025-03-20 10:06:55 +03:00
committed by GitHub
parent 6351398bb6
commit 52a145f7f1
2 changed files with 21 additions and 1 deletions

View File

@@ -349,7 +349,12 @@ namespace Content.Client.Hands.Systems
sprite.LayerSetData(index, layerData); sprite.LayerSetData(index, layerData);
//Add displacement maps //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); _displacement.TryAddDisplacement(handComp.HandDisplacement, sprite, index, key, revealedLayers);
} }

View File

@@ -78,9 +78,24 @@ public sealed partial class HandsComponent : Component
[DataField, ViewVariables(VVAccess.ReadWrite)] [DataField, ViewVariables(VVAccess.ReadWrite)]
public TimeSpan ThrowCooldown = TimeSpan.FromSeconds(0.5f); public TimeSpan ThrowCooldown = TimeSpan.FromSeconds(0.5f);
/// <summary>
/// Fallback displacement map applied to all sprites in the hand, unless otherwise specified
/// </summary>
[DataField] [DataField]
public DisplacementData? HandDisplacement; public DisplacementData? HandDisplacement;
/// <summary>
/// If defined, applies to all sprites in the left hand, ignoring <see cref="HandDisplacement"/>
/// </summary>
[DataField]
public DisplacementData? LeftHandDisplacement;
/// <summary>
/// If defined, applies to all sprites in the right hand, ignoring <see cref="HandDisplacement"/>
/// </summary>
[DataField]
public DisplacementData? RightHandDisplacement;
/// <summary> /// <summary>
/// If false, hands cannot be stripped, and they do not show up in the stripping menu. /// If false, hands cannot be stripped, and they do not show up in the stripping menu.
/// </summary> /// </summary>