diff options
author | Justin Clark-Casey (justincc) | 2011-09-01 01:22:28 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-09-01 01:22:28 +0100 |
commit | 095b3e5756bb3160b30c9c5670ba008fa13d2e66 (patch) | |
tree | 0052b92cf46d42d714740bb4c7404edbdbaea0de /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Fix a bug where the non-root parts of rezzed objects that had previously been... (diff) | |
download | opensim-SC-095b3e5756bb3160b30c9c5670ba008fa13d2e66.zip opensim-SC-095b3e5756bb3160b30c9c5670ba008fa13d2e66.tar.gz opensim-SC-095b3e5756bb3160b30c9c5670ba008fa13d2e66.tar.bz2 opensim-SC-095b3e5756bb3160b30c9c5670ba008fa13d2e66.tar.xz |
Remove pointless cluttering SOP.ParentGroup != null checks.
The only times when ParentGroup might be null is during regression tests (which might not be a valid thing) and when scene objects are being constructed from the database.
At all other times it's not possible for a SOP not to have a SOG parent.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 157 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 10 |
2 files changed, 58 insertions, 109 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a7f08d9..dff7269 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -234,35 +234,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
234 | switch (linkType) | 234 | switch (linkType) |
235 | { | 235 | { |
236 | case ScriptBaseClass.LINK_SET: | 236 | case ScriptBaseClass.LINK_SET: |
237 | if (m_host.ParentGroup != null) | 237 | return new List<SceneObjectPart>(m_host.ParentGroup.Parts); |
238 | { | ||
239 | return new List<SceneObjectPart>(m_host.ParentGroup.Parts); | ||
240 | } | ||
241 | return ret; | ||
242 | 238 | ||
243 | case ScriptBaseClass.LINK_ROOT: | 239 | case ScriptBaseClass.LINK_ROOT: |
244 | if (m_host.ParentGroup != null) | 240 | ret = new List<SceneObjectPart>(); |
245 | { | 241 | ret.Add(m_host.ParentGroup.RootPart); |
246 | ret = new List<SceneObjectPart>(); | ||
247 | ret.Add(m_host.ParentGroup.RootPart); | ||
248 | return ret; | ||
249 | } | ||
250 | return ret; | 242 | return ret; |
251 | 243 | ||
252 | case ScriptBaseClass.LINK_ALL_OTHERS: | 244 | case ScriptBaseClass.LINK_ALL_OTHERS: |
253 | if (m_host.ParentGroup == null) | ||
254 | return new List<SceneObjectPart>(); | ||
255 | |||
256 | ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); | 245 | ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); |
257 | 246 | ||
258 | if (ret.Contains(m_host)) | 247 | if (ret.Contains(m_host)) |
259 | ret.Remove(m_host); | 248 | ret.Remove(m_host); |
249 | |||
260 | return ret; | 250 | return ret; |
261 | 251 | ||
262 | case ScriptBaseClass.LINK_ALL_CHILDREN: | 252 | case ScriptBaseClass.LINK_ALL_CHILDREN: |
263 | if (m_host.ParentGroup == null) | ||
264 | return new List<SceneObjectPart>(); | ||
265 | |||
266 | ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); | 253 | ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts); |
267 | 254 | ||
268 | if (ret.Contains(m_host.ParentGroup.RootPart)) | 255 | if (ret.Contains(m_host.ParentGroup.RootPart)) |
@@ -273,15 +260,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
273 | return ret; | 260 | return ret; |
274 | 261 | ||
275 | default: | 262 | default: |
276 | if (linkType < 0 || m_host.ParentGroup == null) | 263 | if (linkType < 0) |
277 | return new List<SceneObjectPart>(); | 264 | return new List<SceneObjectPart>(); |
265 | |||
278 | SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType); | 266 | SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType); |
279 | if (target == null) | 267 | if (target == null) |
280 | return new List<SceneObjectPart>(); | 268 | return new List<SceneObjectPart>(); |
281 | ret = new List<SceneObjectPart>(); | 269 | ret = new List<SceneObjectPart>(); |
282 | ret.Add(target); | 270 | ret.Add(target); |
283 | return ret; | 271 | return ret; |
284 | |||
285 | } | 272 | } |
286 | } | 273 | } |
287 | 274 | ||
@@ -1199,8 +1186,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1199 | if (value != 0) | 1186 | if (value != 0) |
1200 | { | 1187 | { |
1201 | SceneObjectGroup group = m_host.ParentGroup; | 1188 | SceneObjectGroup group = m_host.ParentGroup; |
1202 | if (group == null) | ||
1203 | return; | ||
1204 | bool allow = true; | 1189 | bool allow = true; |
1205 | 1190 | ||
1206 | foreach (SceneObjectPart part in group.Parts) | 1191 | foreach (SceneObjectPart part in group.Parts) |
@@ -1214,16 +1199,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1214 | 1199 | ||
1215 | if (!allow) | 1200 | if (!allow) |
1216 | return; | 1201 | return; |
1202 | |||
1217 | m_host.ScriptSetPhysicsStatus(true); | 1203 | m_host.ScriptSetPhysicsStatus(true); |
1218 | } | 1204 | } |
1219 | else | 1205 | else |
1206 | { | ||
1220 | m_host.ScriptSetPhysicsStatus(false); | 1207 | m_host.ScriptSetPhysicsStatus(false); |
1208 | } | ||
1221 | } | 1209 | } |
1222 | 1210 | ||
1223 | if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM) | 1211 | if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM) |
1224 | { | 1212 | { |
1225 | if (m_host.ParentGroup != null) | 1213 | m_host.ParentGroup.ScriptSetPhantomStatus(value != 0); |
1226 | m_host.ParentGroup.ScriptSetPhantomStatus(value != 0); | ||
1227 | } | 1214 | } |
1228 | 1215 | ||
1229 | if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS) | 1216 | if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS) |
@@ -1365,8 +1352,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1365 | protected void SetScale(SceneObjectPart part, LSL_Vector scale) | 1352 | protected void SetScale(SceneObjectPart part, LSL_Vector scale) |
1366 | { | 1353 | { |
1367 | // TODO: this needs to trigger a persistance save as well | 1354 | // TODO: this needs to trigger a persistance save as well |
1368 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | 1355 | if (part == null || part.ParentGroup.IsDeleted) |
1369 | return; | 1356 | return; |
1357 | |||
1370 | if (scale.x < 0.01) | 1358 | if (scale.x < 0.01) |
1371 | scale.x = 0.01; | 1359 | scale.x = 0.01; |
1372 | if (scale.y < 0.01) | 1360 | if (scale.y < 0.01) |
@@ -1409,7 +1397,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1409 | { | 1397 | { |
1410 | m_host.AddScriptLPS(1); | 1398 | m_host.AddScriptLPS(1); |
1411 | m_host.ClickAction = (byte)action; | 1399 | m_host.ClickAction = (byte)action; |
1412 | if (m_host.ParentGroup != null) m_host.ParentGroup.HasGroupChanged = true; | 1400 | m_host.ParentGroup.HasGroupChanged = true; |
1413 | m_host.ScheduleFullUpdate(); | 1401 | m_host.ScheduleFullUpdate(); |
1414 | return; | 1402 | return; |
1415 | } | 1403 | } |
@@ -2033,14 +2021,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2033 | else | 2021 | else |
2034 | { | 2022 | { |
2035 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. | 2023 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. |
2036 | SceneObjectGroup group = m_host.ParentGroup; | 2024 | SceneObjectPart rootPart = m_host.ParentGroup.RootPart; |
2037 | if (group != null) // a bit paranoid, maybe | 2025 | if (rootPart != null) // better safe than sorry |
2038 | { | 2026 | { |
2039 | SceneObjectPart rootPart = group.RootPart; | 2027 | SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot)); |
2040 | if (rootPart != null) // again, better safe than sorry | ||
2041 | { | ||
2042 | SetRot(m_host, rootPart.RotationOffset * Rot2Quaternion(rot)); | ||
2043 | } | ||
2044 | } | 2028 | } |
2045 | } | 2029 | } |
2046 | 2030 | ||
@@ -2128,15 +2112,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2128 | { | 2112 | { |
2129 | m_host.AddScriptLPS(1); | 2113 | m_host.AddScriptLPS(1); |
2130 | 2114 | ||
2131 | if (m_host.ParentGroup != null) | 2115 | if (!m_host.ParentGroup.IsDeleted) |
2132 | { | 2116 | { |
2133 | if (!m_host.ParentGroup.IsDeleted) | 2117 | if (local != 0) |
2134 | { | 2118 | force *= llGetRot(); |
2135 | if (local != 0) | ||
2136 | force *= llGetRot(); | ||
2137 | 2119 | ||
2138 | m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z)); | 2120 | m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z)); |
2139 | } | ||
2140 | } | 2121 | } |
2141 | } | 2122 | } |
2142 | 2123 | ||
@@ -2146,15 +2127,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2146 | 2127 | ||
2147 | m_host.AddScriptLPS(1); | 2128 | m_host.AddScriptLPS(1); |
2148 | 2129 | ||
2149 | if (m_host.ParentGroup != null) | 2130 | if (!m_host.ParentGroup.IsDeleted) |
2150 | { | 2131 | { |
2151 | if (!m_host.ParentGroup.IsDeleted) | 2132 | Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce(); |
2152 | { | 2133 | force.x = tmpForce.X; |
2153 | Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce(); | 2134 | force.y = tmpForce.Y; |
2154 | force.x = tmpForce.X; | 2135 | force.z = tmpForce.Z; |
2155 | force.y = tmpForce.Y; | ||
2156 | force.z = tmpForce.Z; | ||
2157 | } | ||
2158 | } | 2136 | } |
2159 | 2137 | ||
2160 | return force; | 2138 | return force; |
@@ -3163,12 +3141,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3163 | public void llSetBuoyancy(double buoyancy) | 3141 | public void llSetBuoyancy(double buoyancy) |
3164 | { | 3142 | { |
3165 | m_host.AddScriptLPS(1); | 3143 | m_host.AddScriptLPS(1); |
3166 | if (m_host.ParentGroup != null) | 3144 | |
3145 | if (!m_host.ParentGroup.IsDeleted) | ||
3167 | { | 3146 | { |
3168 | if (!m_host.ParentGroup.IsDeleted) | 3147 | m_host.ParentGroup.RootPart.SetBuoyancy((float)buoyancy); |
3169 | { | ||
3170 | m_host.ParentGroup.RootPart.SetBuoyancy((float)buoyancy); | ||
3171 | } | ||
3172 | } | 3148 | } |
3173 | } | 3149 | } |
3174 | 3150 | ||
@@ -6238,12 +6214,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6238 | public void llSetVehicleType(int type) | 6214 | public void llSetVehicleType(int type) |
6239 | { | 6215 | { |
6240 | m_host.AddScriptLPS(1); | 6216 | m_host.AddScriptLPS(1); |
6241 | if (m_host.ParentGroup != null) | 6217 | |
6218 | if (!m_host.ParentGroup.IsDeleted) | ||
6242 | { | 6219 | { |
6243 | if (!m_host.ParentGroup.IsDeleted) | 6220 | m_host.ParentGroup.RootPart.SetVehicleType(type); |
6244 | { | ||
6245 | m_host.ParentGroup.RootPart.SetVehicleType(type); | ||
6246 | } | ||
6247 | } | 6221 | } |
6248 | } | 6222 | } |
6249 | 6223 | ||
@@ -6253,12 +6227,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6253 | { | 6227 | { |
6254 | m_host.AddScriptLPS(1); | 6228 | m_host.AddScriptLPS(1); |
6255 | 6229 | ||
6256 | if (m_host.ParentGroup != null) | 6230 | if (!m_host.ParentGroup.IsDeleted) |
6257 | { | 6231 | { |
6258 | if (!m_host.ParentGroup.IsDeleted) | 6232 | m_host.ParentGroup.RootPart.SetVehicleFloatParam(param, (float)value); |
6259 | { | ||
6260 | m_host.ParentGroup.RootPart.SetVehicleFloatParam(param, (float)value); | ||
6261 | } | ||
6262 | } | 6233 | } |
6263 | } | 6234 | } |
6264 | 6235 | ||
@@ -6267,13 +6238,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6267 | public void llSetVehicleVectorParam(int param, LSL_Vector vec) | 6238 | public void llSetVehicleVectorParam(int param, LSL_Vector vec) |
6268 | { | 6239 | { |
6269 | m_host.AddScriptLPS(1); | 6240 | m_host.AddScriptLPS(1); |
6270 | if (m_host.ParentGroup != null) | 6241 | |
6242 | if (!m_host.ParentGroup.IsDeleted) | ||
6271 | { | 6243 | { |
6272 | if (!m_host.ParentGroup.IsDeleted) | 6244 | m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, |
6273 | { | 6245 | new Vector3((float)vec.x, (float)vec.y, (float)vec.z)); |
6274 | m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, | ||
6275 | new Vector3((float)vec.x, (float)vec.y, (float)vec.z)); | ||
6276 | } | ||
6277 | } | 6246 | } |
6278 | } | 6247 | } |
6279 | 6248 | ||
@@ -6282,37 +6251,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6282 | public void llSetVehicleRotationParam(int param, LSL_Rotation rot) | 6251 | public void llSetVehicleRotationParam(int param, LSL_Rotation rot) |
6283 | { | 6252 | { |
6284 | m_host.AddScriptLPS(1); | 6253 | m_host.AddScriptLPS(1); |
6285 | if (m_host.ParentGroup != null) | 6254 | |
6255 | if (!m_host.ParentGroup.IsDeleted) | ||
6286 | { | 6256 | { |
6287 | if (!m_host.ParentGroup.IsDeleted) | 6257 | m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, Rot2Quaternion(rot)); |
6288 | { | ||
6289 | m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, | ||
6290 | Rot2Quaternion(rot)); | ||
6291 | } | ||
6292 | } | 6258 | } |
6293 | } | 6259 | } |
6294 | 6260 | ||
6295 | public void llSetVehicleFlags(int flags) | 6261 | public void llSetVehicleFlags(int flags) |
6296 | { | 6262 | { |
6297 | m_host.AddScriptLPS(1); | 6263 | m_host.AddScriptLPS(1); |
6298 | if (m_host.ParentGroup != null) | 6264 | |
6265 | if (!m_host.ParentGroup.IsDeleted) | ||
6299 | { | 6266 | { |
6300 | if (!m_host.ParentGroup.IsDeleted) | 6267 | m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false); |
6301 | { | ||
6302 | m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false); | ||
6303 | } | ||
6304 | } | 6268 | } |
6305 | } | 6269 | } |
6306 | 6270 | ||
6307 | public void llRemoveVehicleFlags(int flags) | 6271 | public void llRemoveVehicleFlags(int flags) |
6308 | { | 6272 | { |
6309 | m_host.AddScriptLPS(1); | 6273 | m_host.AddScriptLPS(1); |
6310 | if (m_host.ParentGroup != null) | 6274 | |
6275 | if (!m_host.ParentGroup.IsDeleted) | ||
6311 | { | 6276 | { |
6312 | if (!m_host.ParentGroup.IsDeleted) | 6277 | m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true); |
6313 | { | ||
6314 | m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true); | ||
6315 | } | ||
6316 | } | 6278 | } |
6317 | } | 6279 | } |
6318 | 6280 | ||
@@ -6467,11 +6429,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6467 | public void llVolumeDetect(int detect) | 6429 | public void llVolumeDetect(int detect) |
6468 | { | 6430 | { |
6469 | m_host.AddScriptLPS(1); | 6431 | m_host.AddScriptLPS(1); |
6470 | if (m_host.ParentGroup != null) | 6432 | |
6471 | { | 6433 | if (!m_host.ParentGroup.IsDeleted) |
6472 | if (!m_host.ParentGroup.IsDeleted) | 6434 | m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0); |
6473 | m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0); | ||
6474 | } | ||
6475 | } | 6435 | } |
6476 | 6436 | ||
6477 | /// <summary> | 6437 | /// <summary> |
@@ -7022,14 +6982,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7022 | else | 6982 | else |
7023 | { | 6983 | { |
7024 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. | 6984 | // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. |
7025 | SceneObjectGroup group = part.ParentGroup; | 6985 | SceneObjectPart rootPart = part.ParentGroup.RootPart; |
7026 | if (group != null) // a bit paranoid, maybe | 6986 | if (rootPart != null) // better safe than sorry |
7027 | { | 6987 | { |
7028 | SceneObjectPart rootPart = group.RootPart; | 6988 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); |
7029 | if (rootPart != null) // again, better safe than sorry | ||
7030 | { | ||
7031 | SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); | ||
7032 | } | ||
7033 | } | 6989 | } |
7034 | } | 6990 | } |
7035 | 6991 | ||
@@ -7278,13 +7234,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7278 | break; | 7234 | break; |
7279 | 7235 | ||
7280 | case (int)ScriptBaseClass.PRIM_PHANTOM: | 7236 | case (int)ScriptBaseClass.PRIM_PHANTOM: |
7281 | if (remain < 1) | 7237 | if (remain < 1) |
7282 | return; | 7238 | return; |
7283 | 7239 | ||
7284 | string ph = rules.Data[idx++].ToString(); | 7240 | string ph = rules.Data[idx++].ToString(); |
7285 | 7241 | m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); | |
7286 | if (m_host.ParentGroup != null) | ||
7287 | m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); | ||
7288 | 7242 | ||
7289 | break; | 7243 | break; |
7290 | 7244 | ||
@@ -7307,8 +7261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7307 | return; | 7261 | return; |
7308 | string temp = rules.Data[idx++].ToString(); | 7262 | string temp = rules.Data[idx++].ToString(); |
7309 | 7263 | ||
7310 | if (m_host.ParentGroup != null) | 7264 | m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); |
7311 | m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); | ||
7312 | 7265 | ||
7313 | break; | 7266 | break; |
7314 | 7267 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index d791885..7f3d84d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -672,13 +672,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
672 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater"); | 672 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater"); |
673 | 673 | ||
674 | m_host.AddScriptLPS(1); | 674 | m_host.AddScriptLPS(1); |
675 | if (m_host.ParentGroup != null) | 675 | |
676 | { | 676 | if (m_host.ParentGroup.RootPart != null) |
677 | if (m_host.ParentGroup.RootPart != null) | 677 | m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN); |
678 | { | ||
679 | m_host.ParentGroup.RootPart.SetFloatOnWater(floatYN); | ||
680 | } | ||
681 | } | ||
682 | } | 678 | } |
683 | 679 | ||
684 | // Teleport functions | 680 | // Teleport functions |