diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 98 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 45 |
3 files changed, 148 insertions, 2 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 | { |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index b5a3ad9..0514573 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -4660,13 +4660,54 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4660 | public void llSetRemoteScriptAccessPin(int pin) | 4660 | public void llSetRemoteScriptAccessPin(int pin) |
4661 | { | 4661 | { |
4662 | m_host.AddScriptLPS(1); | 4662 | m_host.AddScriptLPS(1); |
4663 | NotImplemented("llSetRemoteScriptAccessPin"); | 4663 | |
4664 | m_host.ScriptAccessPin = pin; | ||
4664 | } | 4665 | } |
4665 | 4666 | ||
4666 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) | 4667 | public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) |
4667 | { | 4668 | { |
4668 | m_host.AddScriptLPS(1); | 4669 | m_host.AddScriptLPS(1); |
4669 | NotImplemented("llRemoteLoadScriptPin"); | 4670 | bool found = false; |
4671 | LLUUID destId = LLUUID.Zero; | ||
4672 | LLUUID srcId = LLUUID.Zero; | ||
4673 | |||
4674 | if (!LLUUID.TryParse(target, out destId)) | ||
4675 | { | ||
4676 | llSay(0, "Could not parse key " + target); | ||
4677 | return; | ||
4678 | } | ||
4679 | |||
4680 | // target must be a different prim than the one containing the script | ||
4681 | if (m_host.UUID == destId) | ||
4682 | { | ||
4683 | return; | ||
4684 | } | ||
4685 | |||
4686 | // copy the first script found with this inventory name | ||
4687 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
4688 | { | ||
4689 | if (inv.Value.Name == name) | ||
4690 | { | ||
4691 | // make sure the object is a script | ||
4692 | if(10 == inv.Value.Type) | ||
4693 | { | ||
4694 | found = true; | ||
4695 | srcId = inv.Key; | ||
4696 | break; | ||
4697 | } | ||
4698 | } | ||
4699 | } | ||
4700 | |||
4701 | if (!found) | ||
4702 | { | ||
4703 | llSay(0, "Could not find script " + name); | ||
4704 | return; | ||
4705 | } | ||
4706 | |||
4707 | // the rest of the permission checks are done in RezScript, so check the pin there as well | ||
4708 | World.RezScript(srcId, m_host, destId, pin, running, start_param); | ||
4709 | // this will cause the delay even if the script pin or permissions were wrong - seems ok | ||
4710 | System.Threading.Thread.Sleep(3000); | ||
4670 | } | 4711 | } |
4671 | 4712 | ||
4672 | // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) | 4713 | // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval) |