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.cs87
1 files changed, 38 insertions, 49 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 72748b6..eecfd70 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -6,7 +6,7 @@
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyrightD
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
@@ -259,6 +259,11 @@ namespace OpenSim.Region.Environment.Scenes
259 } 259 }
260 260
261 public int objectCapacity = 45000; 261 public int objectCapacity = 45000;
262
263 /// <value>
264 /// Registered classes that are capable of creating entities.
265 /// </value>
266 protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>();
262 267
263 #endregion 268 #endregion
264 269
@@ -1753,63 +1758,24 @@ namespace OpenSim.Region.Environment.Scenes
1753 } 1758 }
1754 } 1759 }
1755 1760
1756 public virtual SceneObjectGroup AddNewPrim(UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) 1761 public virtual SceneObjectGroup AddNewPrim(
1762 UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
1757 { 1763 {
1758 //m_log.DebugFormat( 1764 //m_log.DebugFormat(
1759 // "[SCENE]: Scene.AddNewPrim() called for agent {0} in {1}", ownerID, RegionInfo.RegionName); 1765 // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName);
1766
1767 // If an entity creator has been registered for this prim type then use that
1768 if (m_entityCreators.ContainsKey((PCode)shape.PCode))
1769 return m_entityCreators[(PCode)shape.PCode].CreateEntity(ownerID, groupID, pos, rot, shape);
1760 1770
1771 // Otherwise, use this default creation code;
1761 SceneObjectGroup sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape); 1772 SceneObjectGroup sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
1762
1763 SceneObjectPart rootPart = sceneObject.GetChildPart(sceneObject.UUID);
1764 // if grass or tree, make phantom
1765 //rootPart.TrimPermissions();
1766 if ((rootPart.Shape.PCode == (byte)PCode.Grass)
1767 || (rootPart.Shape.PCode == (byte)PCode.Tree) || (rootPart.Shape.PCode == (byte)PCode.NewTree))
1768 {
1769 rootPart.AddFlag(PrimFlags.Phantom);
1770 //rootPart.ObjectFlags += (uint)PrimFlags.Phantom;
1771 if (rootPart.Shape.PCode != (byte)PCode.Grass)
1772 AdaptTree(ref shape);
1773 }
1774
1775 AddNewSceneObject(sceneObject, true); 1773 AddNewSceneObject(sceneObject, true);
1776 sceneObject.SetGroup(groupID, null); 1774 sceneObject.SetGroup(groupID, null);
1777 1775
1778 return sceneObject; 1776 return sceneObject;
1779 } 1777 }
1780 1778
1781 protected void AdaptTree(ref PrimitiveBaseShape tree)
1782 {
1783 // Tree size has to be adapted depending on its type
1784 switch ((Tree)tree.State)
1785 {
1786 case Tree.Cypress1:
1787 case Tree.Cypress2:
1788 tree.Scale = new Vector3(4, 4, 10);
1789 break;
1790
1791 // case... other tree types
1792 // tree.Scale = new Vector3(?, ?, ?);
1793 // break;
1794
1795 default:
1796 tree.Scale = new Vector3(4, 4, 4);
1797 break;
1798 }
1799 }
1800
1801 public SceneObjectGroup AddTree(UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position,
1802 Tree treeType, bool newTree)
1803 {
1804 PrimitiveBaseShape treeShape = new PrimitiveBaseShape();
1805 treeShape.PathCurve = 16;
1806 treeShape.PathEnd = 49900;
1807 treeShape.PCode = newTree ? (byte)PCode.NewTree : (byte)PCode.Tree;
1808 treeShape.Scale = scale;
1809 treeShape.State = (byte)treeType;
1810 return AddNewPrim(uuid, groupID, position, rotation, treeShape);
1811 }
1812
1813 /// <summary> 1779 /// <summary>
1814 /// Add an object into the scene that has come from storage 1780 /// Add an object into the scene that has come from storage
1815 /// </summary> 1781 /// </summary>
@@ -3299,6 +3265,15 @@ namespace OpenSim.Region.Environment.Scenes
3299 List<Object> l = new List<Object>(); 3265 List<Object> l = new List<Object>();
3300 l.Add(mod); 3266 l.Add(mod);
3301 ModuleInterfaces.Add(typeof(M), l); 3267 ModuleInterfaces.Add(typeof(M), l);
3268
3269 if (mod is IEntityCreator)
3270 {
3271 IEntityCreator entityCreator = (IEntityCreator)mod;
3272 foreach (PCode pcode in entityCreator.CreationCapabilities)
3273 {
3274 m_entityCreators[pcode] = entityCreator;
3275 }
3276 }
3302 } 3277 }
3303 } 3278 }
3304 3279
@@ -3314,13 +3289,23 @@ namespace OpenSim.Region.Environment.Scenes
3314 return; 3289 return;
3315 3290
3316 l.Add(mod); 3291 l.Add(mod);
3292
3293 if (mod is IEntityCreator)
3294 {
3295 IEntityCreator entityCreator = (IEntityCreator)mod;
3296 foreach (PCode pcode in entityCreator.CreationCapabilities)
3297 {
3298 m_entityCreators[pcode] = entityCreator;
3299 }
3300 }
3301
3317 ModuleInterfaces[typeof(M)] = l; 3302 ModuleInterfaces[typeof(M)] = l;
3318 } 3303 }
3319 3304
3320 /// <summary> 3305 /// <summary>
3321 /// For the given interface, retrieve the region module which implements it. 3306 /// For the given interface, retrieve the region module which implements it.
3322 /// </summary> 3307 /// </summary>
3323 /// <returns>null if there is no module implementing that interface</returns> 3308 /// <returns>null if there is no registered module implementing that interface</returns>
3324 public override T RequestModuleInterface<T>() 3309 public override T RequestModuleInterface<T>()
3325 { 3310 {
3326 if (ModuleInterfaces.ContainsKey(typeof(T))) 3311 if (ModuleInterfaces.ContainsKey(typeof(T)))
@@ -3333,6 +3318,10 @@ namespace OpenSim.Region.Environment.Scenes
3333 } 3318 }
3334 } 3319 }
3335 3320
3321 /// <summary>
3322 /// For the given interface, retrieve an array of region modules that implement it.
3323 /// </summary>
3324 /// <returns>an empty array if there are no registered modules implementing that interface</returns>
3336 public override T[] RequestModuleInterfaces<T>() 3325 public override T[] RequestModuleInterfaces<T>()
3337 { 3326 {
3338 if (ModuleInterfaces.ContainsKey(typeof(T))) 3327 if (ModuleInterfaces.ContainsKey(typeof(T)))