aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs189
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/EventManager.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs9
3 files changed, 38 insertions, 167 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ee2a94c..e77425a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -55,7 +55,7 @@ using OpenSim.Services.Interfaces;
55using OpenSim.Services.Interfaces; 55using OpenSim.Services.Interfaces;
56using GridRegion = OpenSim.Services.Interfaces.GridRegion; 56using GridRegion = OpenSim.Services.Interfaces.GridRegion;
57using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; 57using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
58 58using PrimType = OpenSim.Region.Framework.Scenes.PrimType;
59using AssetLandmark = OpenSim.Framework.AssetLandmark; 59using AssetLandmark = OpenSim.Framework.AssetLandmark;
60 60
61using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; 61using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
@@ -1331,44 +1331,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1331 { 1331 {
1332 m_host.AddScriptLPS(1); 1332 m_host.AddScriptLPS(1);
1333 1333
1334 SetColor(m_host, color, face); 1334 if (face == ScriptBaseClass.ALL_SIDES)
1335 } 1335 face = SceneObjectPart.ALL_SIDES;
1336 1336
1337 protected void SetColor(SceneObjectPart part, LSL_Vector color, int face) 1337 m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
1338 {
1339 Primitive.TextureEntry tex = part.Shape.Textures;
1340 Color4 texcolor;
1341 if (face >= 0 && face < GetNumberOfSides(part))
1342 {
1343 texcolor = tex.CreateFace((uint)face).RGBA;
1344 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
1345 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
1346 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
1347 tex.FaceTextures[face].RGBA = texcolor;
1348 part.UpdateTexture(tex);
1349 return;
1350 }
1351 else if (face == ScriptBaseClass.ALL_SIDES)
1352 {
1353 for (uint i = 0; i < GetNumberOfSides(part); i++)
1354 {
1355 if (tex.FaceTextures[i] != null)
1356 {
1357 texcolor = tex.FaceTextures[i].RGBA;
1358 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
1359 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
1360 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
1361 tex.FaceTextures[i].RGBA = texcolor;
1362 }
1363 texcolor = tex.DefaultTexture.RGBA;
1364 texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
1365 texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
1366 texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
1367 tex.DefaultTexture.RGBA = texcolor;
1368 }
1369 part.UpdateTexture(tex);
1370 return;
1371 }
1372 } 1338 }
1373 1339
1374 public void SetTexGen(SceneObjectPart part, int face,int style) 1340 public void SetTexGen(SceneObjectPart part, int face,int style)
@@ -1515,7 +1481,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1515 { 1481 {
1516 int i; 1482 int i;
1517 double sum = 0.0; 1483 double sum = 0.0;
1518 for (i = 0 ; i < GetNumberOfSides(part) ; i++) 1484 for (i = 0 ; i < GetNumberOfSides(part); i++)
1519 sum += (double)tex.GetFace((uint)i).RGBA.A; 1485 sum += (double)tex.GetFace((uint)i).RGBA.A;
1520 return sum; 1486 return sum;
1521 } 1487 }
@@ -1662,7 +1628,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1662 { 1628 {
1663 int i; 1629 int i;
1664 1630
1665 for (i = 0 ; i < GetNumberOfSides(part) ; i++) 1631 for (i = 0 ; i < GetNumberOfSides(part); i++)
1666 { 1632 {
1667 texcolor = tex.GetFace((uint)i).RGBA; 1633 texcolor = tex.GetFace((uint)i).RGBA;
1668 rgb.x += texcolor.R; 1634 rgb.x += texcolor.R;
@@ -3415,7 +3381,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3415 List<SceneObjectPart> parts = GetLinkParts(linknumber); 3381 List<SceneObjectPart> parts = GetLinkParts(linknumber);
3416 3382
3417 foreach (SceneObjectPart part in parts) 3383 foreach (SceneObjectPart part in parts)
3418 SetColor(part, color, face); 3384 part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
3419 } 3385 }
3420 3386
3421 public void llCreateLink(string target, int parent) 3387 public void llCreateLink(string target, int parent)
@@ -4262,7 +4228,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4262 { 4228 {
4263 if (item.Type == 10 && item.ItemID == m_itemID) 4229 if (item.Type == 10 && item.ItemID == m_itemID)
4264 { 4230 {
4265 result = item.Name!=null?item.Name:String.Empty; 4231 result = item.Name != null ? item.Name : String.Empty;
4266 break; 4232 break;
4267 } 4233 }
4268 } 4234 }
@@ -4271,63 +4237,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4271 return result; 4237 return result;
4272 } 4238 }
4273 4239
4274 // this function to understand which shape it is (taken from meshmerizer)
4275 // quite useful can be used by meshmerizer to have a centralized point of understanding the shape
4276 // except that it refers to scripting constants
4277 public int getScriptPrimType(PrimitiveBaseShape primShape)
4278 {
4279 if (primShape.SculptEntry)
4280 return ScriptBaseClass.PRIM_TYPE_SCULPT;
4281 if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
4282 {
4283 if (primShape.PathCurve == (byte)Extrusion.Straight)
4284 return ScriptBaseClass.PRIM_TYPE_BOX;
4285 else if (primShape.PathCurve == (byte)Extrusion.Curve1)
4286 return ScriptBaseClass.PRIM_TYPE_TUBE;
4287 }
4288 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle)
4289 {
4290 if (primShape.PathCurve == (byte)Extrusion.Straight)
4291 return ScriptBaseClass.PRIM_TYPE_CYLINDER;
4292 // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits
4293 else if (primShape.PathCurve == (byte)Extrusion.Curve1)
4294 return ScriptBaseClass.PRIM_TYPE_TORUS;
4295 }
4296 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle)
4297 {
4298 if (primShape.PathCurve == (byte)Extrusion.Curve1 || primShape.PathCurve == (byte)Extrusion.Curve2)
4299 return ScriptBaseClass.PRIM_TYPE_SPHERE;
4300 }
4301 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle)
4302 {
4303 if (primShape.PathCurve == (byte)Extrusion.Straight)
4304 return ScriptBaseClass.PRIM_TYPE_PRISM;
4305 else if (primShape.PathCurve == (byte)Extrusion.Curve1)
4306 return ScriptBaseClass.PRIM_TYPE_RING;
4307 }
4308 return ScriptBaseClass.PRIM_TYPE_BOX;
4309 }
4310
4311 // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces
4312 protected void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow,
4313 out bool hasDimple, out bool hasProfileCut)
4314 {
4315 if (primType == ScriptBaseClass.PRIM_TYPE_BOX
4316 ||
4317 primType == ScriptBaseClass.PRIM_TYPE_CYLINDER
4318 ||
4319 primType == ScriptBaseClass.PRIM_TYPE_PRISM)
4320
4321 hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0);
4322 else
4323 hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0);
4324
4325 hasHollow = shape.ProfileHollow > 0;
4326 hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms
4327 hasProfileCut = hasDimple; // is it the same thing?
4328
4329 }
4330
4331 public LSL_Integer llGetNumberOfSides() 4240 public LSL_Integer llGetNumberOfSides()
4332 { 4241 {
4333 m_host.AddScriptLPS(1); 4242 m_host.AddScriptLPS(1);
@@ -4337,63 +4246,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4337 4246
4338 protected int GetNumberOfSides(SceneObjectPart part) 4247 protected int GetNumberOfSides(SceneObjectPart part)
4339 { 4248 {
4340 int ret = 0; 4249 int sides = part.GetNumberOfSides();
4341 bool hasCut;
4342 bool hasHollow;
4343 bool hasDimple;
4344 bool hasProfileCut;
4345
4346 int primType = getScriptPrimType(part.Shape);
4347 hasCutHollowDimpleProfileCut(primType, part.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
4348 4250
4349 switch (primType) 4251 if (part.GetPrimType() == PrimType.SPHERE && part.Shape.ProfileHollow > 0)
4350 { 4252 {
4351 case ScriptBaseClass.PRIM_TYPE_BOX: 4253 // Make up for a bug where LSL shows 4 sides rather than 2
4352 ret = 6; 4254 sides += 2;
4353 if (hasCut) ret += 2;
4354 if (hasHollow) ret += 1;
4355 break;
4356 case ScriptBaseClass.PRIM_TYPE_CYLINDER:
4357 ret = 3;
4358 if (hasCut) ret += 2;
4359 if (hasHollow) ret += 1;
4360 break;
4361 case ScriptBaseClass.PRIM_TYPE_PRISM:
4362 ret = 5;
4363 if (hasCut) ret += 2;
4364 if (hasHollow) ret += 1;
4365 break;
4366 case ScriptBaseClass.PRIM_TYPE_SPHERE:
4367 ret = 1;
4368 if (hasCut) ret += 2;
4369 if (hasDimple) ret += 2;
4370 if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1)
4371 break;
4372 case ScriptBaseClass.PRIM_TYPE_TORUS:
4373 ret = 1;
4374 if (hasCut) ret += 2;
4375 if (hasProfileCut) ret += 2;
4376 if (hasHollow) ret += 1;
4377 break;
4378 case ScriptBaseClass.PRIM_TYPE_TUBE:
4379 ret = 4;
4380 if (hasCut) ret += 2;
4381 if (hasProfileCut) ret += 2;
4382 if (hasHollow) ret += 1;
4383 break;
4384 case ScriptBaseClass.PRIM_TYPE_RING:
4385 ret = 3;
4386 if (hasCut) ret += 2;
4387 if (hasProfileCut) ret += 2;
4388 if (hasHollow) ret += 1;
4389 break;
4390 case ScriptBaseClass.PRIM_TYPE_SCULPT:
4391 ret = 1;
4392 break;
4393 } 4255 }
4394 return ret;
4395 }
4396 4256
4257 return sides;
4258 }
4259
4397 4260
4398 /* The new / changed functions were tested with the following LSL script: 4261 /* The new / changed functions were tested with the following LSL script:
4399 4262
@@ -4418,8 +4281,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4418 } 4281 }
4419 */ 4282 */
4420 4283
4421
4422
4423 // Xantor 29/apr/2008 4284 // Xantor 29/apr/2008
4424 // Returns rotation described by rotating angle radians about axis. 4285 // Returns rotation described by rotating angle radians about axis.
4425 // q = cos(a/2) + i (x * sin(a/2)) + j (y * sin(a/2)) + k (z * sin(a/2)) 4286 // q = cos(a/2) + i (x * sin(a/2)) + j (y * sin(a/2)) + k (z * sin(a/2))
@@ -7020,10 +6881,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7020 LSL_Vector color=rules.GetVector3Item(idx++); 6881 LSL_Vector color=rules.GetVector3Item(idx++);
7021 double alpha=(double)rules.GetLSLFloatItem(idx++); 6882 double alpha=(double)rules.GetLSLFloatItem(idx++);
7022 6883
7023 SetColor(part, color, face); 6884 part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
7024 SetAlpha(part, alpha, face); 6885 SetAlpha(part, alpha, face);
7025 6886
7026 break; 6887 break;
6888
7027 case (int)ScriptBaseClass.PRIM_FLEXIBLE: 6889 case (int)ScriptBaseClass.PRIM_FLEXIBLE:
7028 if (remain < 7) 6890 if (remain < 7)
7029 return; 6891 return;
@@ -7039,6 +6901,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7039 SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); 6901 SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force);
7040 6902
7041 break; 6903 break;
6904
7042 case (int)ScriptBaseClass.PRIM_POINT_LIGHT: 6905 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
7043 if (remain < 5) 6906 if (remain < 5)
7044 return; 6907 return;
@@ -7051,6 +6914,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7051 SetPointLight(part, light, lightcolor, intensity, radius, falloff); 6914 SetPointLight(part, light, lightcolor, intensity, radius, falloff);
7052 6915
7053 break; 6916 break;
6917
7054 case (int)ScriptBaseClass.PRIM_GLOW: 6918 case (int)ScriptBaseClass.PRIM_GLOW:
7055 if (remain < 2) 6919 if (remain < 2)
7056 return; 6920 return;
@@ -7060,6 +6924,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7060 SetGlow(part, face, glow); 6924 SetGlow(part, face, glow);
7061 6925
7062 break; 6926 break;
6927
7063 case (int)ScriptBaseClass.PRIM_BUMP_SHINY: 6928 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
7064 if (remain < 3) 6929 if (remain < 3)
7065 return; 6930 return;
@@ -7070,6 +6935,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7070 SetShiny(part, face, shiny, bump); 6935 SetShiny(part, face, shiny, bump);
7071 6936
7072 break; 6937 break;
6938
7073 case (int)ScriptBaseClass.PRIM_FULLBRIGHT: 6939 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
7074 if (remain < 2) 6940 if (remain < 2)
7075 return; 6941 return;
@@ -7077,6 +6943,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7077 bool st = rules.GetLSLIntegerItem(idx++); 6943 bool st = rules.GetLSLIntegerItem(idx++);
7078 SetFullBright(part, face , st); 6944 SetFullBright(part, face , st);
7079 break; 6945 break;
6946
7080 case (int)ScriptBaseClass.PRIM_MATERIAL: 6947 case (int)ScriptBaseClass.PRIM_MATERIAL:
7081 if (remain < 1) 6948 if (remain < 1)
7082 return; 6949 return;
@@ -7086,6 +6953,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7086 6953
7087 part.Material = Convert.ToByte(mat); 6954 part.Material = Convert.ToByte(mat);
7088 break; 6955 break;
6956
7089 case (int)ScriptBaseClass.PRIM_PHANTOM: 6957 case (int)ScriptBaseClass.PRIM_PHANTOM:
7090 if (remain < 1) 6958 if (remain < 1)
7091 return; 6959 return;
@@ -7100,6 +6968,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7100 6968
7101 part.ScriptSetPhantomStatus(phantom); 6969 part.ScriptSetPhantomStatus(phantom);
7102 break; 6970 break;
6971
7103 case (int)ScriptBaseClass.PRIM_PHYSICS: 6972 case (int)ScriptBaseClass.PRIM_PHYSICS:
7104 if (remain < 1) 6973 if (remain < 1)
7105 return; 6974 return;
@@ -7113,6 +6982,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7113 6982
7114 part.ScriptSetPhysicsStatus(physics); 6983 part.ScriptSetPhysicsStatus(physics);
7115 break; 6984 break;
6985
7116 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: 6986 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
7117 if (remain < 1) 6987 if (remain < 1)
7118 return; 6988 return;
@@ -7380,7 +7250,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7380 7250
7381 public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) 7251 public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules)
7382 { 7252 {
7383
7384 LSL_List res = new LSL_List(); 7253 LSL_List res = new LSL_List();
7385 int idx=0; 7254 int idx=0;
7386 while (idx < rules.Length) 7255 while (idx < rules.Length)
@@ -7442,7 +7311,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7442 case (int)ScriptBaseClass.PRIM_TYPE: 7311 case (int)ScriptBaseClass.PRIM_TYPE:
7443 // implementing box 7312 // implementing box
7444 PrimitiveBaseShape Shape = part.Shape; 7313 PrimitiveBaseShape Shape = part.Shape;
7445 int primType = getScriptPrimType(part.Shape); 7314 int primType = (int)part.GetPrimType();
7446 res.Add(new LSL_Integer(primType)); 7315 res.Add(new LSL_Integer(primType));
7447 double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX 7316 double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX
7448 double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY. 7317 double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY.
@@ -7522,7 +7391,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7522 Primitive.TextureEntry tex = part.Shape.Textures; 7391 Primitive.TextureEntry tex = part.Shape.Textures;
7523 if (face == ScriptBaseClass.ALL_SIDES) 7392 if (face == ScriptBaseClass.ALL_SIDES)
7524 { 7393 {
7525 for (face = 0 ; face < GetNumberOfSides(part) ; face++) 7394 for (face = 0 ; face < GetNumberOfSides(part); face++)
7526 { 7395 {
7527 Primitive.TextureEntryFace texface = tex.GetFace((uint)face); 7396 Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
7528 7397
@@ -7564,7 +7433,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7564 Color4 texcolor; 7433 Color4 texcolor;
7565 if (face == ScriptBaseClass.ALL_SIDES) 7434 if (face == ScriptBaseClass.ALL_SIDES)
7566 { 7435 {
7567 for (face = 0 ; face < GetNumberOfSides(part) ; face++) 7436 for (face = 0 ; face < GetNumberOfSides(part); face++)
7568 { 7437 {
7569 texcolor = tex.GetFace((uint)face).RGBA; 7438 texcolor = tex.GetFace((uint)face).RGBA;
7570 res.Add(new LSL_Vector(texcolor.R, 7439 res.Add(new LSL_Vector(texcolor.R,
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
index 16309ef..09b79d0 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
55 m_log.Info("[XEngine] Hooking up to server events"); 55 m_log.Info("[XEngine] Hooking up to server events");
56 myScriptEngine.World.EventManager.OnAttach += attach; 56 myScriptEngine.World.EventManager.OnAttach += attach;
57 myScriptEngine.World.EventManager.OnObjectGrab += touch_start; 57 myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
58 myScriptEngine.World.EventManager.OnObjectGrabbing += touch;
58 myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; 59 myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end;
59 myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; 60 myScriptEngine.World.EventManager.OnScriptChangedEvent += changed;
60 myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; 61 myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target;
@@ -148,7 +149,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
148 } 149 }
149 150
150 public void touch(uint localID, uint originalID, Vector3 offsetPos, 151 public void touch(uint localID, uint originalID, Vector3 offsetPos,
151 IClientAPI remoteClient) 152 IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
152 { 153 {
153 // Add to queue for all scripts in ObjectID object 154 // Add to queue for all scripts in ObjectID object
154 DetectParams[] det = new DetectParams[1]; 155 DetectParams[] det = new DetectParams[1];
@@ -172,6 +173,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
172 SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID); 173 SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID);
173 det[0].LinkNum = originalPart.LinkNum; 174 det[0].LinkNum = originalPart.LinkNum;
174 } 175 }
176 if (surfaceArgs != null)
177 {
178 det[0].SurfaceTouchArgs = surfaceArgs;
179 }
175 180
176 myScriptEngine.PostObjectEvent(localID, new EventParams( 181 myScriptEngine.PostObjectEvent(localID, new EventParams(
177 "touch", new Object[] { new LSL_Types.LSLInteger(1) }, 182 "touch", new Object[] { new LSL_Types.LSLInteger(1) },
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 6dd94bb..c552b92 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -806,12 +806,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
806 instance.ClearQueue(); 806 instance.ClearQueue();
807 instance.Stop(0); 807 instance.Stop(0);
808 808
809 SceneObjectPart part =
810 m_Scene.GetSceneObjectPart(localID);
811
812 if (part != null)
813 part.RemoveScriptEvents(itemID);
814
815// bool objectRemoved = false; 809// bool objectRemoved = false;
816 810
817 lock (m_PrimObjects) 811 lock (m_PrimObjects)
@@ -846,7 +840,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
846 840
847 ObjectRemoved handlerObjectRemoved = OnObjectRemoved; 841 ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
848 if (handlerObjectRemoved != null) 842 if (handlerObjectRemoved != null)
843 {
844 SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
849 handlerObjectRemoved(part.UUID); 845 handlerObjectRemoved(part.UUID);
846 }
850 847
851 CleanAssemblies(); 848 CleanAssemblies();
852 } 849 }