diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 64 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 12 |
2 files changed, 75 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 1c7e98e..ee52a66 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1353,7 +1353,69 @@ namespace OpenSim.Region.Environment.Scenes | |||
1353 | } | 1353 | } |
1354 | return null; | 1354 | return null; |
1355 | } | 1355 | } |
1356 | 1356 | ||
1357 | public virtual SceneObjectGroup RezObject(TaskInventoryItem item, LLVector3 pos, LLQuaternion rot, LLVector3 vel, int param) | ||
1358 | { | ||
1359 | // Rez object | ||
1360 | if (item != null) | ||
1361 | { | ||
1362 | LLUUID ownerID = item.OwnerID; | ||
1363 | |||
1364 | if (!PermissionsMngr.CanRezObject(ownerID, pos)) | ||
1365 | { | ||
1366 | return null; | ||
1367 | } | ||
1368 | |||
1369 | AssetBase rezAsset = AssetCache.GetAsset(item.AssetID, false); | ||
1370 | |||
1371 | if (rezAsset != null) | ||
1372 | { | ||
1373 | string xmlData = Helpers.FieldToUTF8String(rezAsset.Data); | ||
1374 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); | ||
1375 | group.ResetIDs(); | ||
1376 | AddEntity(group); | ||
1377 | |||
1378 | // we set it's position in world. | ||
1379 | group.AbsolutePosition = pos; | ||
1380 | |||
1381 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | ||
1382 | |||
1383 | // Since renaming the item in the inventory does not affect the name stored | ||
1384 | // in the serialization, transfer the correct name from the inventory to the | ||
1385 | // object itself before we rez. | ||
1386 | rootPart.Name = item.Name; | ||
1387 | rootPart.Description = item.Description; | ||
1388 | |||
1389 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | ||
1390 | foreach (SceneObjectPart part in partList) | ||
1391 | { | ||
1392 | if (part.OwnerID != item.OwnerID) | ||
1393 | { | ||
1394 | part.LastOwnerID = part.OwnerID; | ||
1395 | part.OwnerID = item.OwnerID; | ||
1396 | part.EveryoneMask = item.EveryoneMask; | ||
1397 | part.BaseMask = item.BaseMask; | ||
1398 | part.OwnerMask = item.OwnerMask; | ||
1399 | part.NextOwnerMask = item.NextOwnerMask; | ||
1400 | part.ChangeInventoryOwner(item.OwnerID); | ||
1401 | } | ||
1402 | } | ||
1403 | rootPart.TrimPermissions(); | ||
1404 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | ||
1405 | { | ||
1406 | group.ClearPartAttachmentData(); | ||
1407 | } | ||
1408 | group.UpdateGroupRotation(rot); | ||
1409 | group.ApplyPhysics(m_physicalPrim); | ||
1410 | group.Velocity = vel; | ||
1411 | group.StartScripts(); | ||
1412 | rootPart.ScheduleFullUpdate(); | ||
1413 | return rootPart.ParentGroup; | ||
1414 | } | ||
1415 | |||
1416 | } | ||
1417 | return null; | ||
1418 | } | ||
1357 | 1419 | ||
1358 | } | 1420 | } |
1359 | } | 1421 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 5d39790..9ed5990 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -2526,5 +2526,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
2526 | } | 2526 | } |
2527 | } | 2527 | } |
2528 | } | 2528 | } |
2529 | public float GetMass() | ||
2530 | { | ||
2531 | float retmass = 0f; | ||
2532 | lock (m_parts) | ||
2533 | { | ||
2534 | foreach (SceneObjectPart part in m_parts.Values) | ||
2535 | { | ||
2536 | retmass += part.GetMass(); | ||
2537 | } | ||
2538 | } | ||
2539 | return retmass; | ||
2540 | } | ||
2529 | } | 2541 | } |
2530 | } | 2542 | } |