add LSL_Integer osAvatarType(LSL_Key avkey)

This commit is contained in:
UbitUmarov
2021-04-21 15:52:09 +01:00
parent 1b9a77f08d
commit 9d1bd02d12
6 changed files with 31 additions and 0 deletions

View File

@@ -71,6 +71,8 @@ using PrimType = OpenSim.Region.Framework.Scenes.PrimType;
using RegionFlags = OpenSim.Framework.RegionFlags;
using RegionInfo = OpenSim.Framework.RegionInfo;
#pragma warning disable IDE1006
namespace OpenSim.Region.ScriptEngine.Shared.Api
{
/// <summary>

View File

@@ -59,6 +59,8 @@ using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
using PermissionMask = OpenSim.Framework.PermissionMask;
using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
#pragma warning disable IDE1006
namespace OpenSim.Region.ScriptEngine.Shared.Api
{
//////////////////////////////////////////////////////////////
@@ -6126,5 +6128,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return 0;
}
public LSL_Integer osAvatarType(LSL_Key avkey)
{
if (!UUID.TryParse(avkey.m_string, out UUID avId))
return -1;
ScenePresence av = World.GetScenePresence(avId);
if(av == null || av.IsDeleted)
return 0;
return av.IsNPC ? 2 : 1;
}
}
}

View File

@@ -35,6 +35,8 @@ using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
#pragma warning disable IDE1006
namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
{
public interface ILSL_Api

View File

@@ -25,6 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma warning disable IDE1006
using System;
using System.Collections;
using OpenSim.Region.ScriptEngine.Interfaces;
@@ -591,5 +593,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osLinkParticleSystem(LSL_Integer linknumber, LSL_List rules);
LSL_Integer osNpcLookAt(LSL_Key npckey, LSL_Integer type, LSL_Key objkey, vector offset);
LSL_Integer osAvatarType(LSL_Key avkey);
}
}

View File

@@ -43,6 +43,8 @@ using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
#pragma warning disable IDE1006
namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
public partial class ScriptBaseClass : MarshalByRefObject

View File

@@ -45,6 +45,8 @@ using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
#pragma warning disable IDE1006
namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
public partial class ScriptBaseClass : MarshalByRefObject
@@ -1548,5 +1550,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_OSSL_Functions.osNpcLookAt(npckey, type, objkey, offset);
}
public LSL_Integer osAvatarType(LSL_Key avkey)
{
return m_OSSL_Functions.osAvatarType(avkey);
}
}
}