From 38da8960e98c12a16bf8a25e9fe7e03ee251933c Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Thu, 10 Jul 2008 03:13:29 +0000 Subject: Mantis#1707. Thank you, Melanie for a patch that: This patch limits the maximum size of prims that can be created using libsl bots or modified clients to 65536mper side. It also limits LSL functions to that size. If a prim is already physical, the enforced constraint is 10m. A prim that is larger than 10m cannot be turned physical, either via script or UI. Linksets are handled correctly, so scaling of physical linksets is constrained by the size of it's largest component prim. Also, turning linksets physical is based on the size of it's largest ptim. --- .../Shared/Api/Implementation/LSL_Api.cs | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 57f9141..4bf3e93 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -671,7 +671,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((status & ScriptBaseClass.STATUS_PHYSICS) == ScriptBaseClass.STATUS_PHYSICS) { if (value == 1) + { + SceneObjectGroup group = m_host.ParentGroup; + if(group == null) + return; + bool allow = true; + foreach(SceneObjectPart part in group.Children.Values) + { + if(part.Scale.X > 10.0 || part.Scale.Y > 10.0 || part.Scale.Z > 10.0) + { + allow = false; + break; + } + } + + if(!allow) + return; m_host.ScriptSetPhysicsStatus(true); + } else m_host.ScriptSetPhysicsStatus(false); } @@ -802,6 +819,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private void SetScale(SceneObjectPart part, LSL_Types.Vector3 scale) { // TODO: this needs to trigger a persistance save as well + + if(part == null || part.ParentGroup == null || part.ParentGroup.RootPart == null) + return; + + if(part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical) + { + if(scale.x > 10.0) + scale.x = 10.0; + if(scale.y > 10.0) + scale.y = 10.0; + if(scale.z > 10.0) + scale.z = 10.0; + } + if(scale.x > 65536.0) + scale.x = 65536.0; + if(scale.y > 65536.0) + scale.y = 65536.0; + if(scale.z > 65536.0) + scale.z = 65536.0; LLVector3 tmp = part.Scale; tmp.X = (float)scale.x; tmp.Y = (float)scale.y; -- cgit v1.1