Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

implementing function to allow scripts to self-replicate as if the ow…

…ner duplicated them, using the same script delay as llRezObject()
  • Loading branch information...
commit 2ad9d656b3a1a0c519c9599d7680f98eba7e82b8 1 parent a3cbda0
SignpostMarv authored August 10, 2012 justincc committed August 24, 2012
50  OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3344,5 +3344,55 @@ public LSL_Key osGetRezzingObject()
3344 3344
 
3345 3345
             return new LSL_Key(m_host.ParentGroup.FromPartID.ToString());
3346 3346
         }
  3347
+
  3348
+        public void osRezDuplicate(LSL_Vector offset, LSL_Rotation rot)
  3349
+        {
  3350
+            CheckThreatLevel(ThreatLevel.High, "osRezDuplicate");
  3351
+            m_host.AddScriptLPS(1);
  3352
+
  3353
+            Vector3 v = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
  3354
+            Quaternion r = new Quaternion(
  3355
+                (float)rot.x,
  3356
+                (float)rot.y,
  3357
+                (float)rot.z,
  3358
+                (float)rot.s
  3359
+            );
  3360
+
  3361
+            Vector3 destination = m_host.ParentGroup.AbsolutePosition + v;
  3362
+
  3363
+            if (!World.Permissions.CanRezObject(
  3364
+                m_host.ParentGroup.PrimCount,
  3365
+                m_host.OwnerID,
  3366
+                destination
  3367
+            ))
  3368
+            {
  3369
+                OSSLShoutError("Cannot duplicate object to destination, owner cannot rez objects at destination parcel.");
  3370
+
  3371
+                ScriptSleep(100);
  3372
+            }
  3373
+            else
  3374
+            {
  3375
+                SceneObjectGroup duplicate = World.SceneGraph.DuplicateObject(
  3376
+                    m_host.ParentGroup.LocalId,
  3377
+                    v,
  3378
+                    m_host.ParentGroup.RootPart.GetEffectiveObjectFlags(),
  3379
+                    m_host.OwnerID,
  3380
+                    m_host.GroupID,
  3381
+                    r
  3382
+                );
  3383
+
  3384
+                m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams(
  3385
+                        "object_rez", new Object[] {
  3386
+                        new LSL_String(
  3387
+                        duplicate.RootPart.UUID.ToString()) },
  3388
+                        new DetectParams[0]));
  3389
+
  3390
+                ScriptSleep(100);
  3391
+                m_ScriptEngine.PostObjectEvent(duplicate.LocalId, new EventParams(
  3392
+                        "on_rez", new Object[]{
  3393
+                        new LSL_Integer(0)},
  3394
+                        new DetectParams[0]));
  3395
+            }
  3396
+        }
3347 3397
     }
3348 3398
 }
7  OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -306,5 +306,12 @@ public interface IOSSL_Api
306 306
         /// </summary>
307 307
         /// <returns>Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown.</returns>
308 308
         LSL_Key osGetRezzingObject();
  309
+
  310
+        /// <summary>
  311
+        /// Duplicates an object as if the owner duplicated it.
  312
+        /// </summary>
  313
+        /// <param name="offset"></param>
  314
+        /// <param name="rot"></param>
  315
+        void osRezDuplicate(vector offset, rotation rot);
309 316
     }
310 317
 }
5  OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -955,5 +955,10 @@ public LSL_Key osGetRezzingObject()
955 955
         {
956 956
             return m_OSSL_Functions.osGetRezzingObject();
957 957
         }
  958
+
  959
+        public void osRezDuplicate(vector offset, rotation rot)
  960
+        {
  961
+            m_OSSL_Functions.osRezDuplicate(offset, rot);
  962
+        }
958 963
     }
959 964
 }

0 notes on commit 2ad9d65

Please sign in to comment.
Something went wrong with that request. Please try again.