diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 28 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 82 |
2 files changed, 109 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2dbbf70..16dd834 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1978,6 +1978,32 @@ 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) | ||
1982 | { | ||
1983 | Quaternion q; | ||
1984 | if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim | ||
1985 | { | ||
1986 | if (part.ParentGroup.RootPart.AttachmentPoint != 0) | ||
1987 | { | ||
1988 | ScenePresence avatar = World.GetScenePresence(part.AttachedAvatar); | ||
1989 | if (avatar != null) | ||
1990 | { | ||
1991 | if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0) | ||
1992 | q = avatar.CameraRotation; // Mouselook | ||
1993 | else | ||
1994 | q = avatar.Rotation; // Currently infrequently updated so may be inaccurate | ||
1995 | } | ||
1996 | else | ||
1997 | q = part.ParentGroup.GroupRotation; // Likely never get here but just in case | ||
1998 | } | ||
1999 | else | ||
2000 | q = part.ParentGroup.GroupRotation; // just the group rotation | ||
2001 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | ||
2002 | } | ||
2003 | q = part.GetWorldRotation(); | ||
2004 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | ||
2005 | } | ||
2006 | |||
1981 | public LSL_Rotation llGetLocalRot() | 2007 | public LSL_Rotation llGetLocalRot() |
1982 | { | 2008 | { |
1983 | m_host.AddScriptLPS(1); | 2009 | m_host.AddScriptLPS(1); |
@@ -7299,7 +7325,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7299 | break; | 7325 | break; |
7300 | 7326 | ||
7301 | case (int)ScriptBaseClass.PRIM_ROTATION: | 7327 | case (int)ScriptBaseClass.PRIM_ROTATION: |
7302 | res.Add(llGetRot()); | 7328 | res.Add(GetPartRot(part)); |
7303 | break; | 7329 | break; |
7304 | 7330 | ||
7305 | case (int)ScriptBaseClass.PRIM_TYPE: | 7331 | case (int)ScriptBaseClass.PRIM_TYPE: |
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; | |||
31 | using System.Runtime.Remoting.Lifetime; | 31 | using System.Runtime.Remoting.Lifetime; |
32 | using System.Text; | 32 | using System.Text; |
33 | using System.Net; | 33 | using System.Net; |
34 | using System.Threading; | ||
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using Nini.Config; | 36 | using Nini.Config; |
36 | using OpenSim; | 37 | using OpenSim; |
37 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications.Cache; | 39 | using OpenSim.Framework.Communications.Cache; |
39 | using OpenSim.Framework.Console; | 40 | using OpenSim.Framework.Console; |
41 | using OpenSim.Region.CoreModules.Avatar.NPC; | ||
40 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.Framework.Scenes.Hypergrid; | 44 | using 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 | } |