29 using System.Reflection;
34 using OpenSim.Framework;
35 using OpenSim.Region.Framework.Interfaces;
36 using OpenSim.Region.Framework.Scenes;
40 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"VegetationModule")]
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 protected static readonly PCode[] creationCapabilities =
new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree };
48 public PCode[] CreationCapabilities {
get {
return creationCapabilities; } }
66 public string Name {
get {
return "Vegetation Module"; } }
68 public Type ReplaceableInterface
78 UUID uuid, UUID groupID, Vector3 scale, Quaternion
rotation, Vector3 position, Tree treeType,
bool newTree)
81 treeShape.PathCurve = 16;
82 treeShape.PathEnd = 49900;
83 treeShape.PCode = newTree ? (byte)PCode.NewTree : (byte)PCode.Tree;
84 treeShape.Scale = scale;
85 treeShape.State = (byte)treeType;
87 return m_scene.AddNewPrim(uuid, groupID, position,
rotation, treeShape);
93 if (
Array.IndexOf(creationCapabilities, (PCode)shape.
PCode) < 0)
95 m_log.DebugFormat(
"[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name);
104 rootPart.AddFlag(PrimFlags.Phantom);
105 if (rootPart.
Shape.
PCode != (byte)PCode.Grass)
106 AdaptTree(ref shape);
108 m_scene.AddNewSceneObject(sceneObject,
true);
109 sceneObject.SetGroup(groupID, null);
117 switch ((
Tree)tree.State)
121 tree.Scale *=
new Vector3(8, 8, 20);
129 tree.Scale *=
new Vector3(8, 8, 8);
void AdaptTree(ref PrimitiveBaseShape tree)
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion rotation
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
SceneObjectGroup AddTree(UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree)
Add a new tree to the scene. Used by other modules.
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
Interactive OpenSim region server
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
void Initialise(IConfigSource source)
This is called to initialize the region module. For shared modules, this is called exactly once...
SceneObjectGroup CreateEntity(UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
Create an entity