mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 08:06:27 +08:00
* Fleshes more of NPCModule out.
* Implements some OSSL commands:
key osNpcCreate(string user, string name, vector position, key cloneFrom);
void osNpcMoveTo(key npc, vector position);
void osNpcSay(key npc, string message);
void osNpcRemove(key npc);
* Untested. Requires ThreatLevel.High.
This commit is contained in:
@@ -37,6 +37,7 @@ using OpenSim;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Region.CoreModules.Avatar.NPC;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Hypergrid;
|
||||
@@ -1762,5 +1763,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
|
||||
|
||||
INPCModule module = World.RequestModuleInterface<INPCModule>();
|
||||
if (module != null)
|
||||
{
|
||||
UUID x = module.CreateNPC(firstname,
|
||||
lastname,
|
||||
new Vector3((float) position.x, (float) position.y, (float) position.z),
|
||||
World,
|
||||
new UUID(cloneFrom));
|
||||
|
||||
return new LSL_Key(x.ToString());
|
||||
}
|
||||
return new LSL_Key(UUID.Zero.ToString());
|
||||
}
|
||||
|
||||
public void osNpcMoveTo(LSL_Key npc, LSL_Vector position)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
|
||||
|
||||
INPCModule module = World.RequestModuleInterface<INPCModule>();
|
||||
if (module != null)
|
||||
{
|
||||
Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z);
|
||||
module.Autopilot(new UUID(npc.m_string), World, pos);
|
||||
}
|
||||
}
|
||||
|
||||
public void osNpcSay(LSL_Key npc, string message)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osNpcSay");
|
||||
|
||||
INPCModule module = World.RequestModuleInterface<INPCModule>();
|
||||
if (module != null)
|
||||
{
|
||||
module.Say(new UUID(npc.m_string), World, message);
|
||||
}
|
||||
}
|
||||
|
||||
public void osNpcRemove(LSL_Key npc)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osNpcRemove");
|
||||
|
||||
INPCModule module = World.RequestModuleInterface<INPCModule>();
|
||||
if (module != null)
|
||||
{
|
||||
module.DeleteNPC(new UUID(npc.m_string), World);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,5 +149,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
|
||||
LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules);
|
||||
|
||||
|
||||
key osNpcCreate(string user, string name, vector position, key cloneFrom);
|
||||
void osNpcMoveTo(key npc, vector position);
|
||||
void osNpcSay(key npc, string message);
|
||||
void osNpcRemove(key npc);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user