diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 149 |
1 files changed, 58 insertions, 91 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5ae8017..4d8482b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -128,6 +128,59 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
128 | return World.GetCommander(name); | 128 | return World.GetCommander(name); |
129 | } | 129 | } |
130 | 130 | ||
131 | private List<SceneObjectPart> GetLinkParts(int linkType) | ||
132 | { | ||
133 | List<SceneObjectPart> ret = new List<SceneObjectPart>(); | ||
134 | ret.Add(m_host); | ||
135 | |||
136 | switch (linkType) | ||
137 | { | ||
138 | case ScriptBaseClass.LINK_SET: | ||
139 | if (m_host.ParentGroup != null) | ||
140 | return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); | ||
141 | return ret; | ||
142 | break; | ||
143 | case ScriptBaseClass.LINK_ROOT: | ||
144 | if (m_host.ParentGroup != null) | ||
145 | { | ||
146 | ret = new List<SceneObjectPart>(); | ||
147 | ret.Add(m_host.ParentGroup.RootPart); | ||
148 | return ret; | ||
149 | } | ||
150 | return ret; | ||
151 | break; | ||
152 | case ScriptBaseClass.LINK_ALL_OTHERS: | ||
153 | if (m_host.ParentGroup == null) | ||
154 | return new List<SceneObjectPart>(); | ||
155 | ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); | ||
156 | if (ret.Contains(m_host)) | ||
157 | ret.Remove(m_host); | ||
158 | return ret; | ||
159 | break; | ||
160 | case ScriptBaseClass.LINK_ALL_CHILDREN: | ||
161 | if (m_host.ParentGroup == null) | ||
162 | return new List<SceneObjectPart>(); | ||
163 | ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); | ||
164 | if (ret.Contains(m_host.ParentGroup.RootPart)) | ||
165 | ret.Remove(m_host.ParentGroup.RootPart); | ||
166 | return ret; | ||
167 | break; | ||
168 | case ScriptBaseClass.LINK_THIS: | ||
169 | return ret; | ||
170 | break; | ||
171 | default: | ||
172 | if (linkType < 0 || m_host.ParentGroup == null) | ||
173 | return new List<SceneObjectPart>(); | ||
174 | SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType); | ||
175 | if (target == null) | ||
176 | return new List<SceneObjectPart>(); | ||
177 | ret = new List<SceneObjectPart>(); | ||
178 | ret.Add(target); | ||
179 | return ret; | ||
180 | break; | ||
181 | } | ||
182 | } | ||
183 | |||
131 | private UUID InventorySelf() | 184 | private UUID InventorySelf() |
132 | { | 185 | { |
133 | UUID invItemID = new UUID(); | 186 | UUID invItemID = new UUID(); |
@@ -999,7 +1052,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
999 | } | 1052 | } |
1000 | else if (face == -1) | 1053 | else if (face == -1) |
1001 | { | 1054 | { |
1002 | for (uint i = 0; i < 32; i++) | 1055 | for (uint i = 0; i < llGetNumberOfSides(); i++) |
1003 | { | 1056 | { |
1004 | if (tex.FaceTextures[i] != null) | 1057 | if (tex.FaceTextures[i] != null) |
1005 | { | 1058 | { |
@@ -2702,96 +2755,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2702 | 2755 | ||
2703 | public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) | 2756 | public void llSetLinkColor(int linknumber, LSL_Types.Vector3 color, int face) |
2704 | { | 2757 | { |
2705 | m_host.AddScriptLPS(1); | 2758 | List<SceneObjectPart> parts = GetLinkParts(linknumber); |
2706 | SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknumber); | 2759 | |
2707 | if (linknumber > -1) | 2760 | foreach (SceneObjectPart part in parts) |
2708 | { | 2761 | SetColor(part, color, face); |
2709 | Primitive.TextureEntry tex = part.Shape.Textures; | ||
2710 | Color4 texcolor; | ||
2711 | if (face > -1) | ||
2712 | { | ||
2713 | texcolor = tex.CreateFace((uint)face).RGBA; | ||
2714 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
2715 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
2716 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
2717 | tex.FaceTextures[face].RGBA = texcolor; | ||
2718 | part.UpdateTexture(tex); | ||
2719 | return; | ||
2720 | } | ||
2721 | else if (face == -1) | ||
2722 | { | ||
2723 | texcolor = tex.DefaultTexture.RGBA; | ||
2724 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
2725 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
2726 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
2727 | tex.DefaultTexture.RGBA = texcolor; | ||
2728 | for (uint i = 0; i < 32; i++) | ||
2729 | { | ||
2730 | if (tex.FaceTextures[i] != null) | ||
2731 | { | ||
2732 | texcolor = tex.FaceTextures[i].RGBA; | ||
2733 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
2734 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
2735 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
2736 | tex.FaceTextures[i].RGBA = texcolor; | ||
2737 | } | ||
2738 | } | ||
2739 | texcolor = tex.DefaultTexture.RGBA; | ||
2740 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
2741 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
2742 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
2743 | tex.DefaultTexture.RGBA = texcolor; | ||
2744 | part.UpdateTexture(tex); | ||
2745 | return; | ||
2746 | } | ||
2747 | return; | ||
2748 | } | ||
2749 | else if (linknumber == -1) | ||
2750 | { | ||
2751 | int num = m_host.ParentGroup.PrimCount; | ||
2752 | for (int w = 0; w < num; w++) | ||
2753 | { | ||
2754 | linknumber = w; | ||
2755 | part = m_host.ParentGroup.GetLinkNumPart(linknumber); | ||
2756 | Primitive.TextureEntry tex = part.Shape.Textures; | ||
2757 | Color4 texcolor; | ||
2758 | if (face > -1) | ||
2759 | { | ||
2760 | texcolor = tex.CreateFace((uint)face).RGBA; | ||
2761 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
2762 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
2763 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
2764 | tex.FaceTextures[face].RGBA = texcolor; | ||
2765 | part.UpdateTexture(tex); | ||
2766 | } | ||
2767 | else if (face == -1) | ||
2768 | { | ||
2769 | texcolor = tex.DefaultTexture.RGBA; | ||
2770 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
2771 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
2772 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
2773 | tex.DefaultTexture.RGBA = texcolor; | ||
2774 | for (uint i = 0; i < 32; i++) | ||
2775 | { | ||
2776 | if (tex.FaceTextures[i] != null) | ||
2777 | { | ||
2778 | texcolor = tex.FaceTextures[i].RGBA; | ||
2779 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
2780 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
2781 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
2782 | tex.FaceTextures[i].RGBA = texcolor; | ||
2783 | } | ||
2784 | } | ||
2785 | texcolor = tex.DefaultTexture.RGBA; | ||
2786 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
2787 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
2788 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
2789 | tex.DefaultTexture.RGBA = texcolor; | ||
2790 | part.UpdateTexture(tex); | ||
2791 | } | ||
2792 | } | ||
2793 | return; | ||
2794 | } | ||
2795 | } | 2762 | } |
2796 | 2763 | ||
2797 | public void llCreateLink(string target, int parent) | 2764 | public void llCreateLink(string target, int parent) |