aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
authorAdam Frisby2009-08-21 11:14:55 +1000
committerAdam Frisby2009-08-21 11:14:55 +1000
commit01f394d2037be62a3d74e2d28ab9e5644f86a9a2 (patch)
tree53ff6b50c49f766f71befff01c4aafccf9661ec2 /OpenSim/Region/ScriptEngine/Shared/Api
parent* Implements a bunch of stuff in NPCModule (diff)
downloadopensim-SC_OLD-01f394d2037be62a3d74e2d28ab9e5644f86a9a2.zip
opensim-SC_OLD-01f394d2037be62a3d74e2d28ab9e5644f86a9a2.tar.gz
opensim-SC_OLD-01f394d2037be62a3d74e2d28ab9e5644f86a9a2.tar.bz2
opensim-SC_OLD-01f394d2037be62a3d74e2d28ab9e5644f86a9a2.tar.xz
* 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.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs52
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs6
2 files changed, 58 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 6e3a3ab..fcfa9fc 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -37,6 +37,7 @@ using OpenSim;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications.Cache; 38using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
40using OpenSim.Region.CoreModules.Avatar.NPC;
40using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Scenes.Hypergrid; 43using OpenSim.Region.Framework.Scenes.Hypergrid;
@@ -1762,5 +1763,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1762 return retVal; 1763 return retVal;
1763 } 1764 }
1764 1765
1766 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom)
1767 {
1768 CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
1769
1770 INPCModule module = World.RequestModuleInterface<INPCModule>();
1771 if (module != null)
1772 {
1773 UUID x = module.CreateNPC(firstname,
1774 lastname,
1775 new Vector3((float) position.x, (float) position.y, (float) position.z),
1776 World,
1777 new UUID(cloneFrom));
1778
1779 return new LSL_Key(x.ToString());
1780 }
1781 return new LSL_Key(UUID.Zero.ToString());
1782 }
1783
1784 public void osNpcMoveTo(LSL_Key npc, LSL_Vector position)
1785 {
1786 CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
1787
1788 INPCModule module = World.RequestModuleInterface<INPCModule>();
1789 if (module != null)
1790 {
1791 Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z);
1792 module.Autopilot(new UUID(npc.m_string), World, pos);
1793 }
1794 }
1795
1796 public void osNpcSay(LSL_Key npc, string message)
1797 {
1798 CheckThreatLevel(ThreatLevel.High, "osNpcSay");
1799
1800 INPCModule module = World.RequestModuleInterface<INPCModule>();
1801 if (module != null)
1802 {
1803 module.Say(new UUID(npc.m_string), World, message);
1804 }
1805 }
1806
1807 public void osNpcRemove(LSL_Key npc)
1808 {
1809 CheckThreatLevel(ThreatLevel.High, "osNpcRemove");
1810
1811 INPCModule module = World.RequestModuleInterface<INPCModule>();
1812 if (module != null)
1813 {
1814 module.DeleteNPC(new UUID(npc.m_string), World);
1815 }
1816 }
1765 } 1817 }
1766} 1818}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 0be29f2..c24dae8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -149,5 +149,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
149 149
150 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); 150 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules);
151 151
152
153 key osNpcCreate(string user, string name, vector position, key cloneFrom);
154 void osNpcMoveTo(key npc, vector position);
155 void osNpcSay(key npc, string message);
156 void osNpcRemove(key npc);
157
152 } 158 }
153} 159}