fix llstopanimation patch, as i did on master

This commit is contained in:
UbitUmarov
2022-12-29 21:53:33 +00:00
parent 8cb18e9eb2
commit c2fbd10f89

View File

@@ -4142,7 +4142,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
if (presence != null)
if (presence is not null)
{
// Do NOT try to parse UUID, animations cannot be triggered by ID
UUID animID = ScriptUtils.GetAssetIdFromItemName(m_host, anim, (int)AssetType.Animation);
@@ -4164,16 +4164,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
if (presence != null)
if (presence is not null)
{
UUID animID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, anim);
if (animID.IsNotZero())
presence.Animator.RemoveAnimation(animID, true);
else if (MovementAnimationsForLSL.TryGetValue(anim.ToUpper(), out string lslMovementAnimation))
{
if (presence.TryGetAnimationOverride(anim.ToUpper(), out UUID sitanimID))
presence.Animator.RemoveAnimation(sitanimID, true);
}
else if (presence.TryGetAnimationOverride(anim.ToUpper(), out UUID sitanimID))
presence.Animator.RemoveAnimation(sitanimID, true);
else
presence.Animator.RemoveAnimation(anim);
}
@@ -4186,7 +4183,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID animID = ScriptUtils.GetAssetIdFromItemName(m_host, anim, (int)AssetType.Animation);
if (animID.IsZero())
animID = DefaultAvatarAnimations.GetDefaultAnimation(anim);
if (!animID.IsZero())
if (animID.IsNotZero())
m_host.AddAnimation(animID, anim);
}
@@ -4197,9 +4194,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llGetObjectAnimationNames()
{
LSL_List ret = new LSL_List();
LSL_List ret = new();
if(m_host.AnimationsNames == null || m_host.AnimationsNames.Count == 0)
if(m_host.AnimationsNames is null || m_host.AnimationsNames.Count == 0)
return ret;
foreach (string name in m_host.AnimationsNames.Values)