aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs98
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs7
2 files changed, 105 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index b67de7e..2bd2bad 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1285,7 +1285,105 @@ namespace OpenSim.Region.Environment.Scenes
1285 } 1285 }
1286 } 1286 }
1287 1287
1288 /// <summary>
1289 /// Rez a script into a prim's inventory from another prim
1290 /// </summary>
1291 /// <param name="remoteClient"></param>
1292 /// <param name="itemID"> </param>
1293 /// <param name="localID"></param>
1294 public void RezScript(LLUUID srcId, SceneObjectPart srcPart, LLUUID destId, int pin, int running, int start_param)
1295 {
1296 TaskInventoryItem srcTaskItem = srcPart.GetInventoryItem(srcId);
1297
1298 if (srcTaskItem == null)
1299 {
1300 // error was already logged
1301 return;
1302 }
1303
1304 SceneObjectPart destPart = GetSceneObjectPart(destId);
1305
1306 if (destPart == null)
1307 {
1308 m_log.ErrorFormat(
1309 "[PRIM INVENTORY]: " +
1310 "Could not find script for ID {0}",
1311 destId);
1312 return;
1313 }
1314
1315 if (destPart.ScriptAccessPin != pin)
1316 {
1317 m_log.WarnFormat(
1318 "[PRIM INVENTORY]: " +
1319 "Script in object {0} : {1}, attempted to load script {2} : {3} into object {4} : {5} with invalid pin {6}",
1320 srcPart.Name, srcId, srcTaskItem.Name, srcTaskItem.ItemID, destPart.Name, destId, pin);
1321 // the LSL Wiki says we are supposed to shout on the DEBUG_CHANNEL -
1322 // "Object: Task Object trying to illegally load script onto task Other_Object!"
1323 // How do we should from in here?
1324 return;
1325 }
1326
1327 TaskInventoryItem destTaskItem = new TaskInventoryItem();
1328
1329 destTaskItem.ItemID = LLUUID.Random();
1330 destTaskItem.CreatorID = srcTaskItem.CreatorID;
1331 destTaskItem.AssetID = srcTaskItem.AssetID;
1332 destTaskItem.GroupID = destPart.GroupID;
1333 destTaskItem.OwnerID = destPart.OwnerID;
1334 destTaskItem.ParentID = destPart.UUID;
1335 destTaskItem.ParentPartID = destPart.UUID;
1336
1337 destTaskItem.BaseMask = srcTaskItem.BaseMask;
1338 destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask;
1339 destTaskItem.GroupMask = srcTaskItem.GroupMask;
1340 destTaskItem.OwnerMask = srcTaskItem.OwnerMask;
1341 destTaskItem.NextOwnerMask = srcTaskItem.NextOwnerMask;
1342 destTaskItem.Flags = srcTaskItem.Flags;
1343
1344 if (destPart.OwnerID != srcPart.OwnerID)
1345 {
1346 if (ExternalChecks.ExternalChecksPropagatePermissions())
1347 {
1348 destTaskItem.OwnerMask = srcTaskItem.OwnerMask &
1349 srcTaskItem.NextOwnerMask;
1350 destTaskItem.GroupMask = srcTaskItem.GroupMask &
1351 srcTaskItem.NextOwnerMask;
1352 destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask &
1353 srcTaskItem.NextOwnerMask;
1354 destTaskItem.BaseMask = srcTaskItem.BaseMask &
1355 srcTaskItem.NextOwnerMask;
1356 destTaskItem.OwnerMask |= 8; // Slam!
1357 }
1358 }
1288 1359
1360 destTaskItem.Description = srcTaskItem.Description;
1361 destTaskItem.Name = srcTaskItem.Name;
1362 destTaskItem.InvType = srcTaskItem.InvType;
1363 destTaskItem.Type = srcTaskItem.Type;
1364
1365 // need something like destPart.AddInventoryItemExclusive(destTaskItem);
1366 // this function is supposed to silently overwrite an existing script with the same name
1367
1368 destPart.AddInventoryItem(destTaskItem);
1369
1370 if ( running > 0 )
1371 {
1372 if (ExternalChecks.ExternalChecksCanRunScript(destTaskItem.AssetID, destPart.UUID, destPart.OwnerID))
1373 {
1374 // why doesn't the start_param propogate?
1375 destPart.StartScript(destTaskItem, start_param);
1376 }
1377 }
1378
1379 ScenePresence avatar;
1380
1381 if(TryGetAvatar(srcTaskItem.OwnerID, out avatar))
1382 {
1383 destPart.GetProperties(avatar.ControllingClient);
1384 }
1385 }
1386
1289 /// <summary> 1387 /// <summary>
1290 /// Called when an object is removed from the environment into inventory. 1388 /// Called when an object is removed from the environment into inventory.
1291 /// </summary> 1389 /// </summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 1f5f00f..6009206 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -102,6 +102,7 @@ namespace OpenSim.Region.Environment.Scenes
102 [XmlIgnore] public scriptEvents m_aggregateScriptEvents=0; 102 [XmlIgnore] public scriptEvents m_aggregateScriptEvents=0;
103 [XmlIgnore] private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None; 103 [XmlIgnore] private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None;
104 [XmlIgnore] public bool DIE_AT_EDGE = false; 104 [XmlIgnore] public bool DIE_AT_EDGE = false;
105 [XmlIgnore] private int m_scriptAccessPin = 0;
105 106
106 [XmlIgnore] public bool m_IsAttachment = false; 107 [XmlIgnore] public bool m_IsAttachment = false;
107 [XmlIgnore] public uint m_attachmentPoint = (byte)0; 108 [XmlIgnore] public uint m_attachmentPoint = (byte)0;
@@ -211,6 +212,12 @@ namespace OpenSim.Region.Environment.Scenes
211 get { return m_regionHandle; } 212 get { return m_regionHandle; }
212 set { m_regionHandle = value; } 213 set { m_regionHandle = value; }
213 } 214 }
215
216 public int ScriptAccessPin
217 {
218 get { return m_scriptAccessPin; }
219 set { m_scriptAccessPin = (int)value; }
220 }
214 221
215 public uint GetEffectiveObjectFlags() 222 public uint GetEffectiveObjectFlags()
216 { 223 {