diff --git a/EXILED/Exiled.API/Exiled.API.csproj b/EXILED/Exiled.API/Exiled.API.csproj index 31fe36e00..70f81bf0d 100644 --- a/EXILED/Exiled.API/Exiled.API.csproj +++ b/EXILED/Exiled.API/Exiled.API.csproj @@ -34,6 +34,7 @@ + diff --git a/EXILED/Exiled.API/Features/Roles/FpcRole.cs b/EXILED/Exiled.API/Features/Roles/FpcRole.cs index 2b0d75cf0..9a1156833 100644 --- a/EXILED/Exiled.API/Features/Roles/FpcRole.cs +++ b/EXILED/Exiled.API/Features/Roles/FpcRole.cs @@ -300,6 +300,30 @@ public BasicRagdoll Ragdoll /// public SpectatableModuleBase SpectatableModuleBase => FirstPersonController.SpectatorModule; + /// + /// Tries to get the of a specified bone. + /// + /// The bone to get the of. + /// + /// When this method returns, contains the of the specified bone, if found; + /// otherwise, null. + /// + /// true if the bone transform was found; otherwise, false. + public bool TryGetBoneTransform(HumanBodyBones bone, out Transform boneTransform) + { + boneTransform = null; + + if (Model is not AnimatedCharacterModel animatedModel) + return false; + + Animator animator = animatedModel.Animator; + if (animator == null || animator.avatar == null || !animator.avatar.isValid || !animator.avatar.isHuman) + return false; + + boneTransform = animator.GetBoneTransform(bone); + return boneTransform != null; + } + /// /// Resets the 's stamina. /// diff --git a/EXILED/Exiled.API/Features/Roles/Scp096Role.cs b/EXILED/Exiled.API/Features/Roles/Scp096Role.cs index a59e699ac..6e78b6c66 100644 --- a/EXILED/Exiled.API/Features/Roles/Scp096Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Scp096Role.cs @@ -16,6 +16,8 @@ namespace Exiled.API.Features.Roles using PlayerRoles.PlayableScps.Scp096; using PlayerRoles.Subroutines; + using UnityEngine; + using Scp096GameRole = PlayerRoles.PlayableScps.Scp096.Scp096Role; /// @@ -139,6 +141,20 @@ internal Scp096Role(Scp096GameRole baseRole) /// public bool AttackPossible => AttackAbility.AttackPossible; + /// + /// Gets the head transform of SCP-096's character model. + /// + public Transform HeadTransform + { + get + { + if (Model is not Scp096CharacterModel scp96AnimatedCharacterModel) + return null; + + return scp96AnimatedCharacterModel.Head; + } + } + /// /// Gets or sets the Charge Ability Cooldown. /// @@ -306,4 +322,4 @@ public void Charge(float cooldown = 1f) /// The Spawn Chance. public float GetSpawnChance(List alreadySpawned) => Base.GetSpawnChance(alreadySpawned); } -} \ No newline at end of file +}