diff options
author | Charles Krinke | 2008-06-28 16:08:12 +0000 |
---|---|---|
committer | Charles Krinke | 2008-06-28 16:08:12 +0000 |
commit | 9a0ef22ed979433f4d017a252173f38fe5e56892 (patch) | |
tree | 98bd25e3a49a38922b37728df4de9e0fa5b7366a /OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |
parent | plumbing for multiple inventory servers. Mostly done on the region server side. (diff) | |
download | opensim-SC-9a0ef22ed979433f4d017a252173f38fe5e56892.zip opensim-SC-9a0ef22ed979433f4d017a252173f38fe5e56892.tar.gz opensim-SC-9a0ef22ed979433f4d017a252173f38fe5e56892.tar.bz2 opensim-SC-9a0ef22ed979433f4d017a252173f38fe5e56892.tar.xz |
Mantis#1616. Applied Melanie's patch. This may or may
not break trunk.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 60 |
1 files changed, 43 insertions, 17 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index f030e12..d134ea3 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
46 | /// <summary> | 46 | /// <summary> |
47 | /// Start all the scripts in the scene which should be started. | 47 | /// Start all the scripts in the scene which should be started. |
48 | /// </summary> | 48 | /// </summary> |
49 | public void StartScripts() | 49 | public void CreateScriptInstances() |
50 | { | 50 | { |
51 | m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); | 51 | m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); |
52 | 52 | ||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
54 | { | 54 | { |
55 | if (group is SceneObjectGroup) | 55 | if (group is SceneObjectGroup) |
56 | { | 56 | { |
57 | ((SceneObjectGroup) group).StartScripts(); | 57 | ((SceneObjectGroup) group).CreateScriptInstances(0, false); |
58 | } | 58 | } |
59 | } | 59 | } |
60 | } | 60 | } |
@@ -234,6 +234,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
234 | AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data); | 234 | AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data); |
235 | AssetCache.AddAsset(asset); | 235 | AssetCache.AddAsset(asset); |
236 | 236 | ||
237 | if (isScriptRunning) | ||
238 | { | ||
239 | part.RemoveScriptInstance(item.ItemID); | ||
240 | } | ||
237 | // Update item with new asset | 241 | // Update item with new asset |
238 | item.AssetID = asset.FullID; | 242 | item.AssetID = asset.FullID; |
239 | group.UpdateInventoryItem(item); | 243 | group.UpdateInventoryItem(item); |
@@ -242,8 +246,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
242 | // Trigger rerunning of script (use TriggerRezScript event, see RezScript) | 246 | // Trigger rerunning of script (use TriggerRezScript event, see RezScript) |
243 | if (isScriptRunning) | 247 | if (isScriptRunning) |
244 | { | 248 | { |
245 | group.StopScript(part.LocalId, item.ItemID); | 249 | part.CreateScriptInstance(item.ItemID, 0, false); |
246 | group.StartScript(part.LocalId, item.ItemID); | ||
247 | } | 250 | } |
248 | } | 251 | } |
249 | 252 | ||
@@ -1219,7 +1222,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1219 | if (ExternalChecks.ExternalChecksCanRunScript(item.ID, part.UUID, remoteClient.AgentId)) | 1222 | if (ExternalChecks.ExternalChecksCanRunScript(item.ID, part.UUID, remoteClient.AgentId)) |
1220 | { | 1223 | { |
1221 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); | 1224 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); |
1222 | part.ParentGroup.StartScript(localID, copyID); | 1225 | // TODO: set this to "true" when scripts in inventory have persistent state to fire on_rez |
1226 | part.CreateScriptInstance(copyID, 0, false); | ||
1223 | part.GetProperties(remoteClient); | 1227 | part.GetProperties(remoteClient); |
1224 | 1228 | ||
1225 | // m_log.InfoFormat("[PRIMINVENTORY]: " + | 1229 | // m_log.InfoFormat("[PRIMINVENTORY]: " + |
@@ -1280,7 +1284,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1280 | 1284 | ||
1281 | if (ExternalChecks.ExternalChecksCanRunScript(taskItem.AssetID, part.UUID, remoteClient.AgentId)) | 1285 | if (ExternalChecks.ExternalChecksCanRunScript(taskItem.AssetID, part.UUID, remoteClient.AgentId)) |
1282 | { | 1286 | { |
1283 | part.StartScript(taskItem); | 1287 | part.CreateScriptInstance(taskItem, 0, false); |
1284 | } | 1288 | } |
1285 | } | 1289 | } |
1286 | } | 1290 | } |
@@ -1312,6 +1316,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1312 | return; | 1316 | return; |
1313 | } | 1317 | } |
1314 | 1318 | ||
1319 | // Must own the object, and have modify rights | ||
1320 | if(srcPart.OwnerID != destPart.OwnerID) | ||
1321 | return; | ||
1322 | |||
1323 | if((destPart.OwnerMask & (uint)PermissionMask.Modify) == 0) | ||
1324 | return; | ||
1325 | |||
1315 | if (destPart.ScriptAccessPin != pin) | 1326 | if (destPart.ScriptAccessPin != pin) |
1316 | { | 1327 | { |
1317 | m_log.WarnFormat( | 1328 | m_log.WarnFormat( |
@@ -1362,17 +1373,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1362 | destTaskItem.InvType = srcTaskItem.InvType; | 1373 | destTaskItem.InvType = srcTaskItem.InvType; |
1363 | destTaskItem.Type = srcTaskItem.Type; | 1374 | destTaskItem.Type = srcTaskItem.Type; |
1364 | 1375 | ||
1365 | // need something like destPart.AddInventoryItemExclusive(destTaskItem); | 1376 | destPart.AddInventoryItemExclusive(destTaskItem); |
1366 | // this function is supposed to silently overwrite an existing script with the same name | ||
1367 | |||
1368 | destPart.AddInventoryItem(destTaskItem); | ||
1369 | 1377 | ||
1370 | if ( running > 0 ) | 1378 | if ( running > 0 ) |
1371 | { | 1379 | { |
1372 | if (ExternalChecks.ExternalChecksCanRunScript(destTaskItem.AssetID, destPart.UUID, destPart.OwnerID)) | 1380 | if (ExternalChecks.ExternalChecksCanRunScript(destTaskItem.AssetID, destPart.UUID, destPart.OwnerID)) |
1373 | { | 1381 | { |
1374 | // why doesn't the start_param propogate? | 1382 | destPart.CreateScriptInstance(destTaskItem, 0, false); |
1375 | destPart.StartScript(destTaskItem, start_param); | ||
1376 | } | 1383 | } |
1377 | } | 1384 | } |
1378 | 1385 | ||
@@ -1874,7 +1881,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1874 | //group.ApplyPhysics(m_physicalPrim); | 1881 | //group.ApplyPhysics(m_physicalPrim); |
1875 | } | 1882 | } |
1876 | 1883 | ||
1877 | group.StartScripts(); | 1884 | // TODO: make this true to fire on_rez when scripts have state while in inventory |
1885 | group.CreateScriptInstances(0, false); | ||
1878 | 1886 | ||
1879 | if (!attachment) | 1887 | if (!attachment) |
1880 | rootPart.ScheduleFullUpdate(); | 1888 | rootPart.ScheduleFullUpdate(); |
@@ -1919,9 +1927,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1919 | 1927 | ||
1920 | AddNewSceneObject(group, true); | 1928 | AddNewSceneObject(group, true); |
1921 | 1929 | ||
1922 | // Set the startup parameter for on_rez event and llGetStartParameter() function | ||
1923 | group.StartParameter = param; | ||
1924 | |||
1925 | // we set it's position in world. | 1930 | // we set it's position in world. |
1926 | group.AbsolutePosition = pos; | 1931 | group.AbsolutePosition = pos; |
1927 | 1932 | ||
@@ -1970,7 +1975,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1970 | group.UpdateGroupRotation(rot); | 1975 | group.UpdateGroupRotation(rot); |
1971 | group.ApplyPhysics(m_physicalPrim); | 1976 | group.ApplyPhysics(m_physicalPrim); |
1972 | group.Velocity = vel; | 1977 | group.Velocity = vel; |
1973 | group.StartScripts(param); | 1978 | group.CreateScriptInstances(param, true); |
1974 | rootPart.ScheduleFullUpdate(); | 1979 | rootPart.ScheduleFullUpdate(); |
1975 | return rootPart.ParentGroup; | 1980 | return rootPart.ParentGroup; |
1976 | } | 1981 | } |
@@ -2120,5 +2125,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
2120 | 2125 | ||
2121 | } | 2126 | } |
2122 | 2127 | ||
2128 | public void GetScriptRunning(IClientAPI controllingClient, LLUUID objectID, LLUUID itemID) | ||
2129 | { | ||
2130 | IScriptModule scriptModule = RequestModuleInterface<IScriptModule>(); | ||
2131 | if(scriptModule == null) | ||
2132 | return; | ||
2133 | |||
2134 | controllingClient.SendScriptRunningReply(objectID, itemID, | ||
2135 | scriptModule.GetScriptRunning(objectID, itemID)); | ||
2136 | } | ||
2137 | |||
2138 | public void SetScriptRunning(IClientAPI controllingClient, LLUUID objectID, LLUUID itemID, bool running) | ||
2139 | { | ||
2140 | SceneObjectPart part = GetSceneObjectPart(objectID); | ||
2141 | if(part == null) | ||
2142 | return; | ||
2143 | |||
2144 | if(running) | ||
2145 | EventManager.TriggerStartScript(part.LocalId, itemID); | ||
2146 | else | ||
2147 | EventManager.TriggerStopScript(part.LocalId, itemID); | ||
2148 | } | ||
2123 | } | 2149 | } |
2124 | } | 2150 | } |