aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs32
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs82
2 files changed, 99 insertions, 15 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 972e71c..16dd834 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1978,25 +1978,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1978 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 1978 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
1979 } 1979 }
1980 1980
1981 private LSL_Rotation GetPartRot( SceneObjectPart part ) 1981 private LSL_Rotation GetPartRot(SceneObjectPart part)
1982 { 1982 {
1983 Quaternion q; 1983 Quaternion q;
1984 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim 1984 if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim
1985 { 1985 {
1986 if (part.ParentGroup.RootPart.AttachmentPoint != 0) 1986 if (part.ParentGroup.RootPart.AttachmentPoint != 0)
1987 { 1987 {
1988 ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar); 1988 ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar);
1989 if (avatar != null) 1989 if (avatar != null)
1990 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) 1990 {
1991 q = avatar.CameraRotation; // Mouselook 1991 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
1992 else 1992 q = avatar.CameraRotation; // Mouselook
1993 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate 1993 else
1994 else 1994 q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
1995 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case 1995 }
1996 } 1996 else
1997 else 1997 q = part.ParentGroup.GroupRotation; // Likely never get here but just in case
1998 q = part.ParentGroup.GroupRotation; // just the group rotation 1998 }
1999 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 1999 else
2000 q = part.ParentGroup.GroupRotation; // just the group rotation
2001 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
2000 } 2002 }
2001 q = part.GetWorldRotation(); 2003 q = part.GetWorldRotation();
2002 return new LSL_Rotation(q.X, q.Y, q.Z, q.W); 2004 return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 6e3a3ab..b1c357c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -31,12 +31,14 @@ using System.Collections.Generic;
31using System.Runtime.Remoting.Lifetime; 31using System.Runtime.Remoting.Lifetime;
32using System.Text; 32using System.Text;
33using System.Net; 33using System.Net;
34using System.Threading;
34using OpenMetaverse; 35using OpenMetaverse;
35using Nini.Config; 36using Nini.Config;
36using OpenSim; 37using OpenSim;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Console; 40using OpenSim.Framework.Console;
41using OpenSim.Region.CoreModules.Avatar.NPC;
40using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Scenes.Hypergrid; 44using OpenSim.Region.Framework.Scenes.Hypergrid;
@@ -831,6 +833,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
831 return drawList; 833 return drawList;
832 } 834 }
833 835
836 public string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y)
837 {
838 CheckThreatLevel(ThreatLevel.None, "osDrawFilledPolygon");
839
840 m_host.AddScriptLPS(1);
841
842 if (x.Length != y.Length || x.Length < 3)
843 {
844 return "";
845 }
846 drawList += "FillPolygon " + x.GetLSLStringItem(0) + "," + y.GetLSLStringItem(0);
847 for (int i = 1; i < x.Length; i++)
848 {
849 drawList += "," + x.GetLSLStringItem(i) + "," + y.GetLSLStringItem(i);
850 }
851 drawList += "; ";
852 return drawList;
853 }
854
834 public string osSetFontSize(string drawList, int fontSize) 855 public string osSetFontSize(string drawList, int fontSize)
835 { 856 {
836 CheckThreatLevel(ThreatLevel.None, "osSetFontSize"); 857 CheckThreatLevel(ThreatLevel.None, "osSetFontSize");
@@ -858,6 +879,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
858 return drawList; 879 return drawList;
859 } 880 }
860 881
882 public string osSetPenCap(string drawList, string direction, string type)
883 {
884 CheckThreatLevel(ThreatLevel.None, "osSetPenColour");
885
886 m_host.AddScriptLPS(1);
887 drawList += "PenCap " + direction + "," + type + "; ";
888 return drawList;
889 }
890
861 public string osDrawImage(string drawList, int width, int height, string imageUrl) 891 public string osDrawImage(string drawList, int width, int height, string imageUrl)
862 { 892 {
863 CheckThreatLevel(ThreatLevel.None, "osDrawImage"); 893 CheckThreatLevel(ThreatLevel.None, "osDrawImage");
@@ -1762,5 +1792,57 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1762 return retVal; 1792 return retVal;
1763 } 1793 }
1764 1794
1795 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom)
1796 {
1797 CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
1798 //QueueUserWorkItem
1799
1800 INPCModule module = World.RequestModuleInterface<INPCModule>();
1801 if (module != null)
1802 {
1803 UUID x = module.CreateNPC(firstname,
1804 lastname,
1805 new Vector3((float) position.x, (float) position.y, (float) position.z),
1806 World,
1807 new UUID(cloneFrom));
1808
1809 return new LSL_Key(x.ToString());
1810 }
1811 return new LSL_Key(UUID.Zero.ToString());
1812 }
1813
1814 public void osNpcMoveTo(LSL_Key npc, LSL_Vector position)
1815 {
1816 CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
1817
1818 INPCModule module = World.RequestModuleInterface<INPCModule>();
1819 if (module != null)
1820 {
1821 Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z);
1822 module.Autopilot(new UUID(npc.m_string), World, pos);
1823 }
1824 }
1825
1826 public void osNpcSay(LSL_Key npc, string message)
1827 {
1828 CheckThreatLevel(ThreatLevel.High, "osNpcSay");
1829
1830 INPCModule module = World.RequestModuleInterface<INPCModule>();
1831 if (module != null)
1832 {
1833 module.Say(new UUID(npc.m_string), World, message);
1834 }
1835 }
1836
1837 public void osNpcRemove(LSL_Key npc)
1838 {
1839 CheckThreatLevel(ThreatLevel.High, "osNpcRemove");
1840
1841 INPCModule module = World.RequestModuleInterface<INPCModule>();
1842 if (module != null)
1843 {
1844 module.DeleteNPC(new UUID(npc.m_string), World);
1845 }
1846 }
1765 } 1847 }
1766} 1848}