Implement osIsNpc(key npc):integer. This return TRUE if the given key belongs to an NPC in the region. FALSE if not or if the NPC module isn't present.
parent
abf0dd4250
commit
7c1d075a5a
|
@ -2202,6 +2202,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return retVal;
|
||||
}
|
||||
|
||||
public LSL_Integer osIsNpc(LSL_Key npc)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.None, "osIsNpc");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
INPCModule module = World.RequestModuleInterface<INPCModule>();
|
||||
if (module != null)
|
||||
{
|
||||
UUID npcId;
|
||||
if (UUID.TryParse(npc.m_string, out npcId))
|
||||
if (module.IsNPC(npcId, World))
|
||||
return ScriptBaseClass.TRUE;
|
||||
}
|
||||
|
||||
return ScriptBaseClass.FALSE;
|
||||
}
|
||||
|
||||
public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
|
||||
|
|
|
@ -173,6 +173,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
|
||||
LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules);
|
||||
|
||||
/// <summary>
|
||||
/// Check if the given key is an npc
|
||||
/// </summary>
|
||||
/// <param name="npc"></param>
|
||||
/// <returns>TRUE if the key belongs to an npc in the scene. FALSE otherwise.</returns>
|
||||
LSL_Integer osIsNpc(LSL_Key npc);
|
||||
|
||||
key osNpcCreate(string user, string name, vector position, string notecard);
|
||||
key osNpcCreate(string user, string name, vector position, string notecard, int options);
|
||||
LSL_Key osNpcSaveAppearance(key npc, string notecard);
|
||||
|
|
|
@ -493,6 +493,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules);
|
||||
}
|
||||
|
||||
public LSL_Integer osIsNpc(LSL_Key npc)
|
||||
{
|
||||
return m_OSSL_Functions.osIsNpc(npc);
|
||||
}
|
||||
|
||||
public key osNpcCreate(string user, string name, vector position, key cloneFrom)
|
||||
{
|
||||
return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom);
|
||||
|
|
Loading…
Reference in New Issue