29 using System.Collections.Generic;
30 using System.Reflection;
35 using OpenMetaverse.Packets;
36 using OpenMetaverse.StructuredData;
37 using OpenSim.Framework;
38 using OpenSim.Region.Framework;
39 using OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule;
40 using OpenSim.Region.Framework.Interfaces;
41 using OpenSim.Region.Framework.Scenes;
48 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"DOExampleModule")]
53 public int Moves {
get; set; }
61 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
63 private static readonly
bool ENABLED =
false;
65 private Scene m_scene;
68 public string Name {
get {
return "DO"; } }
69 public Type ReplaceableInterface {
get {
return null; } }
78 m_scene.EventManager.OnObjectAddedToScene += OnObjectAddedToScene;
79 m_scene.EventManager.OnSceneGroupMove += OnSceneGroupMove;
80 m_dialogMod = m_scene.RequestModuleInterface<
IDialogModule>();
88 m_scene.EventManager.OnSceneGroupMove -= OnSceneGroupMove;
96 RemoveRegion(m_scene);
111 movesSoFar = attrs[
"moves"].AsInteger();
114 "[DO EXAMPLE MODULE]: Found saved moves {0} for {1} in {2}", movesSoFar, so.Name, m_scene.Name);
117 rootPart.DynObjs.Add(DAExampleModule.Namespace, Name,
new MyObject(movesSoFar));
120 private bool OnSceneGroupMove(UUID groupId, Vector3 delta)
127 object rawObj = so.RootPart.DynObjs.Get(Name);
131 MyObject myObj = (MyObject)rawObj;
133 m_dialogMod.SendGeneralAlert(string.Format(
"{0} {1} moved {2} times", so.Name, so.UUID, ++myObj.Moves));
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
bool TryGetStore(string ns, string storeName, out OSDMap store)
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
OpenMetaverse.StructuredData.OSDMap OSDMap
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
Example module for experimenting with and demonstrating dynamic object ideas.
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
Interactive OpenSim region server
void Initialise(IConfigSource source)
This is called to initialize the region module. For shared modules, this is called exactly once...
DAMap DynAttrs
Dynamic attributes can be created and deleted as required.