aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-02-23 00:08:31 +0100
committerMelanie2012-02-23 00:08:31 +0100
commitc0b8f3d0bcc71d31cd92bb47e10a7d6a96d7900e (patch)
tree8ab6a1a778808090f5be5a50093517553c200780 /OpenSim
parentCount agents for LSL instead of relying on SceneGraph to have the correct (diff)
downloadopensim-SC_OLD-c0b8f3d0bcc71d31cd92bb47e10a7d6a96d7900e.zip
opensim-SC_OLD-c0b8f3d0bcc71d31cd92bb47e10a7d6a96d7900e.tar.gz
opensim-SC_OLD-c0b8f3d0bcc71d31cd92bb47e10a7d6a96d7900e.tar.bz2
opensim-SC_OLD-c0b8f3d0bcc71d31cd92bb47e10a7d6a96d7900e.tar.xz
Add permission checks to scripted object movements, which didn't respect bans
and parcel settings until now. Add llSetRegionPos() function according to LL spec
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs54
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs5
3 files changed, 59 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 a7341a9..d0430f4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2177,6 +2177,54 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2177 return real_vec; 2177 return real_vec;
2178 } 2178 }
2179 2179
2180 public LSL_Integer llSetRegionPos(LSL_Vector pos)
2181 {
2182 return new LSL_Integer(SetRegionPos(m_host, pos));
2183 }
2184
2185 protected int SetRegionPos(SceneObjectPart part, LSL_Vector targetPos)
2186 {
2187 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
2188 return 0;
2189
2190 SceneObjectGroup grp = part.ParentGroup;
2191
2192 if (grp.IsAttachment)
2193 return 0;
2194
2195 if (grp.RootPart.PhysActor != null && grp.RootPart.PhysActor.IsPhysical)
2196 return 0;
2197
2198 if (targetPos.x < -10.0f || targetPos.x >= (float)Constants.RegionSize || targetPos.y < -10.0f || targetPos.y >= (float)Constants.RegionSize || targetPos.z < 0 || targetPos.z >= 4096.0f)
2199 return 0;
2200
2201 float constrainedX = (float)targetPos.x;
2202 float constrainedY = (float)targetPos.y;
2203
2204 if (constrainedX < 0.0f)
2205 constrainedX = 0.0f;
2206 if (constrainedY < 0.0f)
2207 constrainedY = 0.0f;
2208 if (constrainedX >= (float)Constants.RegionSize)
2209 constrainedX = (float)Constants.RegionSize - 0.1f;
2210 if (constrainedY >= (float)Constants.RegionSize)
2211 constrainedY = (float)Constants.RegionSize -0.1f;
2212
2213 float ground = World.GetGroundHeight(constrainedX, constrainedY);
2214
2215 if (targetPos.z < ground)
2216 targetPos.z = ground;
2217
2218 Vector3 dest = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z);
2219
2220 if (!World.Permissions.CanObjectEntry(grp.UUID, false, dest))
2221 return 0;
2222
2223 grp.UpdateGroupPosition(dest);
2224
2225 return 1;
2226 }
2227
2180 protected void SetPos(SceneObjectPart part, LSL_Vector targetPos) 2228 protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
2181 { 2229 {
2182 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) 2230 if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
@@ -2185,11 +2233,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2185 LSL_Vector currentPos = GetPartLocalPos(part); 2233 LSL_Vector currentPos = GetPartLocalPos(part);
2186 LSL_Vector toPos = GetSetPosTarget(part, targetPos, currentPos); 2234 LSL_Vector toPos = GetSetPosTarget(part, targetPos, currentPos);
2187 2235
2236
2188 if (part.ParentGroup.RootPart == part) 2237 if (part.ParentGroup.RootPart == part)
2189 { 2238 {
2190 SceneObjectGroup parent = part.ParentGroup; 2239 SceneObjectGroup parent = part.ParentGroup;
2240 Vector3 dest = new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z);
2241 if (!World.Permissions.CanObjectEntry(parent.UUID, false, dest))
2242 return;
2191 Util.FireAndForget(delegate(object x) { 2243 Util.FireAndForget(delegate(object x) {
2192 parent.UpdateGroupPosition(new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z)); 2244 parent.UpdateGroupPosition(dest);
2193 }); 2245 });
2194 } 2246 }
2195 else 2247 else
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index f2d4399..9679798 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -346,6 +346,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
346 void llSetParcelMusicURL(string url); 346 void llSetParcelMusicURL(string url);
347 void llSetPayPrice(int price, LSL_List quick_pay_buttons); 347 void llSetPayPrice(int price, LSL_List quick_pay_buttons);
348 void llSetPos(LSL_Vector pos); 348 void llSetPos(LSL_Vector pos);
349 LSL_Integer llSetRegionPos(LSL_Vector pos);
349 LSL_Integer llSetPrimMediaParams(int face, LSL_List rules); 350 LSL_Integer llSetPrimMediaParams(int face, LSL_List rules);
350 void llSetPrimitiveParams(LSL_List rules); 351 void llSetPrimitiveParams(LSL_List rules);
351 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); 352 void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index fad6c35..dcaa3b4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -1580,6 +1580,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1580 m_LSL_Functions.llSetPos(pos); 1580 m_LSL_Functions.llSetPos(pos);
1581 } 1581 }
1582 1582
1583 public LSL_Integer llSetRegionPos(LSL_Vector pos)
1584 {
1585 return m_LSL_Functions.llSetRegionPos(pos);
1586 }
1587
1583 public void llSetPrimitiveParams(LSL_List rules) 1588 public void llSetPrimitiveParams(LSL_List rules)
1584 { 1589 {
1585 m_LSL_Functions.llSetPrimitiveParams(rules); 1590 m_LSL_Functions.llSetPrimitiveParams(rules);