aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/DynamicAttributes
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-03-15 00:49:35 +0000
committerJustin Clark-Casey (justincc)2013-03-15 00:49:35 +0000
commitd3e76730bd8e89b684cb856bcb7192246f201c2a (patch)
tree5e11614b05afa1b9f30d701d30fa4a4075d56894 /OpenSim/Region/CoreModules/Framework/DynamicAttributes
parentAdd ParentGroup.HasGroupChanged = true setting to DAExampleModule as this is ... (diff)
downloadopensim-SC_OLD-d3e76730bd8e89b684cb856bcb7192246f201c2a.zip
opensim-SC_OLD-d3e76730bd8e89b684cb856bcb7192246f201c2a.tar.gz
opensim-SC_OLD-d3e76730bd8e89b684cb856bcb7192246f201c2a.tar.bz2
opensim-SC_OLD-d3e76730bd8e89b684cb856bcb7192246f201c2a.tar.xz
Add example code to DOExampleModule to pull data from that previously saved by DAExampleModule when instantiating a dynamc object.
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/DynamicAttributes')
-rw-r--r--OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs26
2 files changed, 29 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs
index 854e00d..1f1568f 100644
--- a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs
@@ -39,7 +39,7 @@ using OpenSim.Region.Framework;
39using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41 41
42namespace OpenSim.Region.Framework.DynamicAttributes.DAExampleModule 42namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule
43{ 43{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DAExampleModule")] 44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DAExampleModule")]
45 public class DAExampleModule : INonSharedRegionModule 45 public class DAExampleModule : INonSharedRegionModule
@@ -48,6 +48,8 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DAExampleModule
48 48
49 private static readonly bool ENABLED = false; // enable for testing 49 private static readonly bool ENABLED = false; // enable for testing
50 50
51 public const string DANamespace = "DAExample Module";
52
51 protected Scene m_scene; 53 protected Scene m_scene;
52 protected IDialogModule m_dialogMod; 54 protected IDialogModule m_dialogMod;
53 55
@@ -89,7 +91,7 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DAExampleModule
89 if (sop == null) 91 if (sop == null)
90 return true; 92 return true;
91 93
92 if (!sop.DynAttrs.TryGetValue(Name, out attrs)) 94 if (!sop.DynAttrs.TryGetValue(DANamespace, out attrs))
93 attrs = new OSDMap(); 95 attrs = new OSDMap();
94 96
95 OSDInteger newValue; 97 OSDInteger newValue;
@@ -104,7 +106,7 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DAExampleModule
104 106
105 attrs["moves"] = newValue; 107 attrs["moves"] = newValue;
106 108
107 sop.DynAttrs[Name] = attrs; 109 sop.DynAttrs[DANamespace] = attrs;
108 } 110 }
109 111
110 sop.ParentGroup.HasGroupChanged = true; 112 sop.ParentGroup.HasGroupChanged = true;
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs
index 71bb3f0..650aa35 100644
--- a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs
@@ -36,6 +36,7 @@ using OpenMetaverse.Packets;
36using OpenMetaverse.StructuredData; 36using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Region.Framework; 38using OpenSim.Region.Framework;
39using OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule;
39using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
41 42
@@ -50,9 +51,14 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule
50 public class MyObject 51 public class MyObject
51 { 52 {
52 public int Moves { get; set; } 53 public int Moves { get; set; }
54
55 public MyObject(int moves)
56 {
57 Moves = moves;
58 }
53 } 59 }
54 60
55 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 61 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
56 62
57 private static readonly bool ENABLED = false; // enable for testing 63 private static readonly bool ENABLED = false; // enable for testing
58 64
@@ -92,7 +98,23 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule
92 98
93 private void OnObjectAddedToScene(SceneObjectGroup so) 99 private void OnObjectAddedToScene(SceneObjectGroup so)
94 { 100 {
95 so.RootPart.DynObjs.Add(Name, new MyObject()); 101 SceneObjectPart rootPart = so.RootPart;
102
103 OSDMap attrs;
104
105 int movesSoFar = 0;
106
107// Console.WriteLine("Here for {0}", so.Name);
108
109 if (rootPart.DynAttrs.TryGetValue(DAExampleModule.DANamespace, out attrs))
110 {
111 movesSoFar = attrs["moves"].AsInteger();
112
113 m_log.DebugFormat(
114 "[DO EXAMPLE MODULE]: Found saved moves {0} for {1} in {2}", movesSoFar, so.Name, m_scene.Name);
115 }
116
117 rootPart.DynObjs.Add(Name, new MyObject(movesSoFar));
96 } 118 }
97 119
98 private bool OnSceneGroupMove(UUID groupId, Vector3 delta) 120 private bool OnSceneGroupMove(UUID groupId, Vector3 delta)