aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs110
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs13
-rw-r--r--OpenSim/Services/GridService/GridService.cs53
3 files changed, 110 insertions, 66 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ed3c2a4..5316d08 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -8639,7 +8639,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8639 8639
8640 LSL_List result = new LSL_List(); 8640 LSL_List result = new LSL_List();
8641 8641
8642 GetPrimParams(m_host, rules, ref result); 8642 LSL_List remaining = GetPrimParams(m_host, rules, ref result);
8643
8644 while (remaining != null && remaining.Length > 2)
8645 {
8646 int linknumber = remaining.GetLSLIntegerItem(0);
8647 rules = remaining.GetSublist(1, -1);
8648 List<SceneObjectPart> parts = GetLinkParts(linknumber);
8649
8650 foreach (SceneObjectPart part in parts)
8651 remaining = GetPrimParams(part, rules, ref result);
8652 }
8643 8653
8644 return result; 8654 return result;
8645 } 8655 }
@@ -8651,30 +8661,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8651 // acording to SL wiki this must indicate a single link number or link_root or link_this. 8661 // acording to SL wiki this must indicate a single link number or link_root or link_this.
8652 // keep other options as before 8662 // keep other options as before
8653 8663
8654 List<SceneObjectPart> parts = GetLinkParts(linknumber); 8664 List<SceneObjectPart> parts;
8655 List<ScenePresence> avatars = GetLinkAvatars(linknumber); 8665 List<ScenePresence> avatars;
8656 8666
8657 LSL_List res = new LSL_List(); 8667 LSL_List res = new LSL_List();
8668 LSL_List remaining = null;
8658 8669
8659 if (parts.Count > 0) 8670 while (rules.Length > 0)
8660 { 8671 {
8661 foreach (var part in parts) 8672 parts = GetLinkParts(linknumber);
8673 avatars = GetLinkAvatars(linknumber);
8674
8675 remaining = null;
8676 foreach (SceneObjectPart part in parts)
8662 { 8677 {
8663 GetPrimParams(part, rules, ref res); 8678 remaining = GetPrimParams(part, rules, ref res);
8664 } 8679 }
8665 }
8666 if (avatars.Count > 0)
8667 {
8668 foreach (ScenePresence avatar in avatars) 8680 foreach (ScenePresence avatar in avatars)
8669 { 8681 {
8670 GetPrimParams(avatar, rules, ref res); 8682 remaining = GetPrimParams(avatar, rules, ref res);
8683 }
8684
8685 if (remaining != null && remaining.Length > 0)
8686 {
8687 linknumber = remaining.GetLSLIntegerItem(0);
8688 rules = remaining.GetSublist(1, -1);
8671 } 8689 }
8672 // TODO: FINISH MERGE
8673 } 8690 }
8691
8674 return res; 8692 return res;
8675 } 8693 }
8676 8694
8677 public void GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) 8695 public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res)
8678 { 8696 {
8679 int idx=0; 8697 int idx=0;
8680 while (idx < rules.Length) 8698 while (idx < rules.Length)
@@ -8813,7 +8831,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8813 8831
8814 case (int)ScriptBaseClass.PRIM_TEXTURE: 8832 case (int)ScriptBaseClass.PRIM_TEXTURE:
8815 if (remain < 1) 8833 if (remain < 1)
8816 return; 8834 return null;
8817 8835
8818 int face = (int)rules.GetLSLIntegerItem(idx++); 8836 int face = (int)rules.GetLSLIntegerItem(idx++);
8819 Primitive.TextureEntry tex = part.Shape.Textures; 8837 Primitive.TextureEntry tex = part.Shape.Textures;
@@ -8853,7 +8871,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8853 8871
8854 case (int)ScriptBaseClass.PRIM_COLOR: 8872 case (int)ScriptBaseClass.PRIM_COLOR:
8855 if (remain < 1) 8873 if (remain < 1)
8856 return; 8874 return null;
8857 8875
8858 face=(int)rules.GetLSLIntegerItem(idx++); 8876 face=(int)rules.GetLSLIntegerItem(idx++);
8859 8877
@@ -8882,7 +8900,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8882 8900
8883 case (int)ScriptBaseClass.PRIM_BUMP_SHINY: 8901 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
8884 if (remain < 1) 8902 if (remain < 1)
8885 return; 8903 return null;
8904
8886 face = (int)rules.GetLSLIntegerItem(idx++); 8905 face = (int)rules.GetLSLIntegerItem(idx++);
8887 8906
8888 tex = part.Shape.Textures; 8907 tex = part.Shape.Textures;
@@ -8938,7 +8957,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8938 8957
8939 case (int)ScriptBaseClass.PRIM_FULLBRIGHT: 8958 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
8940 if (remain < 1) 8959 if (remain < 1)
8941 return; 8960 return null;
8961
8942 face = (int)rules.GetLSLIntegerItem(idx++); 8962 face = (int)rules.GetLSLIntegerItem(idx++);
8943 8963
8944 tex = part.Shape.Textures; 8964 tex = part.Shape.Textures;
@@ -8992,7 +9012,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8992 case (int)ScriptBaseClass.PRIM_TEXGEN: 9012 case (int)ScriptBaseClass.PRIM_TEXGEN:
8993 // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) 9013 // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR)
8994 if (remain < 1) 9014 if (remain < 1)
8995 return; 9015 return null;
9016
8996 face = (int)rules.GetLSLIntegerItem(idx++); 9017 face = (int)rules.GetLSLIntegerItem(idx++);
8997 9018
8998 tex = part.Shape.Textures; 9019 tex = part.Shape.Textures;
@@ -9040,7 +9061,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9040 9061
9041 case (int)ScriptBaseClass.PRIM_GLOW: 9062 case (int)ScriptBaseClass.PRIM_GLOW:
9042 if (remain < 1) 9063 if (remain < 1)
9043 return; 9064 return null;
9065
9044 face = (int)rules.GetLSLIntegerItem(idx++); 9066 face = (int)rules.GetLSLIntegerItem(idx++);
9045 9067
9046 tex = part.Shape.Textures; 9068 tex = part.Shape.Textures;
@@ -9084,14 +9106,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9084 case (int)ScriptBaseClass.PRIM_POS_LOCAL: 9106 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
9085 res.Add(new LSL_Vector(GetPartLocalPos(part))); 9107 res.Add(new LSL_Vector(GetPartLocalPos(part)));
9086 break; 9108 break;
9087 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
9088 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
9089 return;
9090 LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++);
9091 LSL_List new_rules = rules.GetSublist(idx, -1);
9092 LSL_List tres = llGetLinkPrimitiveParams((int)new_linknumber, new_rules);
9093 res += tres;
9094 return;
9095 case (int)ScriptBaseClass.PRIM_SLICE: 9109 case (int)ScriptBaseClass.PRIM_SLICE:
9096 PrimType prim_type = part.GetPrimType(); 9110 PrimType prim_type = part.GetPrimType();
9097 bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING); 9111 bool useProfileBeginEnd = (prim_type == PrimType.SPHERE || prim_type == PrimType.TORUS || prim_type == PrimType.TUBE || prim_type == PrimType.RING);
@@ -9101,8 +9115,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9101 0 9115 0
9102 )); 9116 ));
9103 break; 9117 break;
9118 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
9119 if(remain < 3)
9120 return null;
9121
9122 return rules.GetSublist(idx, -1);
9104 } 9123 }
9105 } 9124 }
9125
9126 return null;
9106 } 9127 }
9107 9128
9108 public LSL_List llGetPrimMediaParams(int face, LSL_List rules) 9129 public LSL_List llGetPrimMediaParams(int face, LSL_List rules)
@@ -11668,7 +11689,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11668 11689
11669 if (obj != null && obj.OwnerID != m_host.OwnerID) 11690 if (obj != null && obj.OwnerID != m_host.OwnerID)
11670 { 11691 {
11671 GetPrimParams(obj, rules, ref result); 11692 LSL_List remaining = GetPrimParams(obj, rules, ref result);
11693
11694 while (remaining != null && remaining.Length > 2)
11695 {
11696 int linknumber = remaining.GetLSLIntegerItem(0);
11697 rules = remaining.GetSublist(1, -1);
11698 List<SceneObjectPart> parts = GetLinkParts(linknumber);
11699
11700 foreach (SceneObjectPart part in parts)
11701 remaining = GetPrimParams(part, rules, ref result);
11702 }
11672 } 11703 }
11673 11704
11674 return result; 11705 return result;
@@ -12792,7 +12823,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12792 return null; 12823 return null;
12793 } 12824 }
12794 12825
12795 public void GetPrimParams(ScenePresence avatar, LSL_List rules, ref LSL_List res) 12826 public LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules, ref LSL_List res)
12796 { 12827 {
12797 // avatars case 12828 // avatars case
12798 // replies as SL wiki 12829 // replies as SL wiki
@@ -12864,7 +12895,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12864 12895
12865 case (int)ScriptBaseClass.PRIM_TEXTURE: 12896 case (int)ScriptBaseClass.PRIM_TEXTURE:
12866 if (remain < 1) 12897 if (remain < 1)
12867 return; 12898 return null;
12868 12899
12869 int face = (int)rules.GetLSLIntegerItem(idx++); 12900 int face = (int)rules.GetLSLIntegerItem(idx++);
12870 if (face == ScriptBaseClass.ALL_SIDES) 12901 if (face == ScriptBaseClass.ALL_SIDES)
@@ -12891,7 +12922,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12891 12922
12892 case (int)ScriptBaseClass.PRIM_COLOR: 12923 case (int)ScriptBaseClass.PRIM_COLOR:
12893 if (remain < 1) 12924 if (remain < 1)
12894 return; 12925 return null;
12895 12926
12896 face = (int)rules.GetLSLIntegerItem(idx++); 12927 face = (int)rules.GetLSLIntegerItem(idx++);
12897 12928
@@ -12912,7 +12943,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12912 12943
12913 case (int)ScriptBaseClass.PRIM_BUMP_SHINY: 12944 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
12914 if (remain < 1) 12945 if (remain < 1)
12915 return; 12946 return null;
12916 face = (int)rules.GetLSLIntegerItem(idx++); 12947 face = (int)rules.GetLSLIntegerItem(idx++);
12917 12948
12918 if (face == ScriptBaseClass.ALL_SIDES) 12949 if (face == ScriptBaseClass.ALL_SIDES)
@@ -12932,7 +12963,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12932 12963
12933 case (int)ScriptBaseClass.PRIM_FULLBRIGHT: 12964 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
12934 if (remain < 1) 12965 if (remain < 1)
12935 return; 12966 return null;
12936 face = (int)rules.GetLSLIntegerItem(idx++); 12967 face = (int)rules.GetLSLIntegerItem(idx++);
12937 12968
12938 if (face == ScriptBaseClass.ALL_SIDES) 12969 if (face == ScriptBaseClass.ALL_SIDES)
@@ -12961,7 +12992,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12961 case (int)ScriptBaseClass.PRIM_TEXGEN: 12992 case (int)ScriptBaseClass.PRIM_TEXGEN:
12962 // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) 12993 // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR)
12963 if (remain < 1) 12994 if (remain < 1)
12964 return; 12995 return null;
12965 face = (int)rules.GetLSLIntegerItem(idx++); 12996 face = (int)rules.GetLSLIntegerItem(idx++);
12966 12997
12967 if (face == ScriptBaseClass.ALL_SIDES) 12998 if (face == ScriptBaseClass.ALL_SIDES)
@@ -12987,7 +13018,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12987 13018
12988 case (int)ScriptBaseClass.PRIM_GLOW: 13019 case (int)ScriptBaseClass.PRIM_GLOW:
12989 if (remain < 1) 13020 if (remain < 1)
12990 return; 13021 return null;
12991 face = (int)rules.GetLSLIntegerItem(idx++); 13022 face = (int)rules.GetLSLIntegerItem(idx++);
12992 13023
12993 if (face == ScriptBaseClass.ALL_SIDES) 13024 if (face == ScriptBaseClass.ALL_SIDES)
@@ -13041,14 +13072,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13041 13072
13042 case (int)ScriptBaseClass.PRIM_LINK_TARGET: 13073 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
13043 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. 13074 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
13044 return; 13075 return null;
13045 LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++);
13046 LSL_List new_rules = rules.GetSublist(idx, -1);
13047 13076
13048 res += llGetLinkPrimitiveParams((int)new_linknumber, new_rules); 13077 return rules.GetSublist(idx, -1);
13049 return;
13050 } 13078 }
13051 } 13079 }
13080
13081 return null;
13052 } 13082 }
13053 } 13083 }
13054 13084
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 43cfea2..5bc78d6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2261,10 +2261,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2261 // on the ILSL_Api interface. 2261 // on the ILSL_Api interface.
2262 LSL_Api LSL_Api = (LSL_Api)m_LSL_Api; 2262 LSL_Api LSL_Api = (LSL_Api)m_LSL_Api;
2263 LSL_List retVal = new LSL_List(); 2263 LSL_List retVal = new LSL_List();
2264 LSL_List remaining = null;
2264 List<SceneObjectPart> parts = LSL_Api.GetLinkParts(linknumber); 2265 List<SceneObjectPart> parts = LSL_Api.GetLinkParts(linknumber);
2265 foreach (SceneObjectPart part in parts) 2266 foreach (SceneObjectPart part in parts)
2266 { 2267 {
2267 LSL_Api.GetPrimParams(part, rules, ref retVal); 2268 remaining = LSL_Api.GetPrimParams(part, rules, ref retVal);
2269 }
2270
2271 while (remaining != null && remaining.Length > 2)
2272 {
2273 linknumber = remaining.GetLSLIntegerItem(0);
2274 rules = remaining.GetSublist(1, -1);
2275 parts = LSL_Api.GetLinkParts(linknumber);
2276
2277 foreach (SceneObjectPart part in parts)
2278 remaining = LSL_Api.GetPrimParams(part, rules, ref retVal);
2268 } 2279 }
2269 return retVal; 2280 return retVal;
2270 } 2281 }
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index aab403a..5bdea06 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -137,9 +137,14 @@ namespace OpenSim.Services.GridService
137 if (regionInfos.RegionID == UUID.Zero) 137 if (regionInfos.RegionID == UUID.Zero)
138 return "Invalid RegionID - cannot be zero UUID"; 138 return "Invalid RegionID - cannot be zero UUID";
139 139
140 // This needs better sanity testing. What if regionInfo is registering in
141 // overlapping coords?
142 RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); 140 RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
141 if ((region != null) && (region.RegionID != regionInfos.RegionID))
142 {
143 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.",
144 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
145 return "Region overlaps another region";
146 }
147
143 if (region != null) 148 if (region != null)
144 { 149 {
145 // There is a preexisting record 150 // There is a preexisting record
@@ -176,19 +181,36 @@ namespace OpenSim.Services.GridService
176 } 181 }
177 } 182 }
178 183
179 if ((region != null) && (region.RegionID != regionInfos.RegionID)) 184 // If we get here, the destination is clear. Now for the real check.
185
186 if (!m_AllowDuplicateNames)
180 { 187 {
181 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", 188 List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID);
182 regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); 189 if (dupe != null && dupe.Count > 0)
183 return "Region overlaps another region"; 190 {
191 foreach (RegionData d in dupe)
192 {
193 if (d.RegionID != regionInfos.RegionID)
194 {
195 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.",
196 regionInfos.RegionName, regionInfos.RegionID);
197 return "Duplicate region name";
198 }
199 }
200 }
184 } 201 }
185 202
203 // If there is an old record for us, delete it if it is elsewhere.
204 region = m_Database.Get(regionInfos.RegionID, scopeID);
186 if ((region != null) && (region.RegionID == regionInfos.RegionID) && 205 if ((region != null) && (region.RegionID == regionInfos.RegionID) &&
187 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) 206 ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY)))
188 { 207 {
189 if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0) 208 if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0)
190 return "Can't move this region"; 209 return "Can't move this region";
191 210
211 if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.LockedOut) != 0)
212 return "Region locked out";
213
192 // Region reregistering in other coordinates. Delete the old entry 214 // Region reregistering in other coordinates. Delete the old entry
193 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", 215 m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.",
194 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); 216 regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY);
@@ -203,23 +225,6 @@ namespace OpenSim.Services.GridService
203 } 225 }
204 } 226 }
205 227
206 if (!m_AllowDuplicateNames)
207 {
208 List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID);
209 if (dupe != null && dupe.Count > 0)
210 {
211 foreach (RegionData d in dupe)
212 {
213 if (d.RegionID != regionInfos.RegionID)
214 {
215 m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.",
216 regionInfos.RegionName, regionInfos.RegionID);
217 return "Duplicate region name";
218 }
219 }
220 }
221 }
222
223 // Everything is ok, let's register 228 // Everything is ok, let's register
224 RegionData rdata = RegionInfo2RegionData(regionInfos); 229 RegionData rdata = RegionInfo2RegionData(regionInfos);
225 rdata.ScopeID = scopeID; 230 rdata.ScopeID = scopeID;
@@ -227,8 +232,6 @@ namespace OpenSim.Services.GridService
227 if (region != null) 232 if (region != null)
228 { 233 {
229 int oldFlags = Convert.ToInt32(region.Data["flags"]); 234 int oldFlags = Convert.ToInt32(region.Data["flags"]);
230 if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0)
231 return "Region locked out";
232 235
233 oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation; 236 oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation;
234 237