diff options
Diffstat (limited to 'OpenSim/Region/Examples/SimpleModule/RegionModule.cs')
-rw-r--r-- | OpenSim/Region/Examples/SimpleModule/RegionModule.cs | 147 |
1 files changed, 0 insertions, 147 deletions
diff --git a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs deleted file mode 100644 index 3b8ce37..0000000 --- a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs +++ /dev/null | |||
@@ -1,147 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using Nini.Config; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Interfaces; | ||
33 | using OpenSim.Region.Framework.Scenes; | ||
34 | |||
35 | namespace OpenSim.Region.Examples.SimpleModule | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Example region module. | ||
39 | /// </summary> | ||
40 | /// <remarks> | ||
41 | /// This is an old and unmaintained region module which uses the old style module interface. It is not loaded into | ||
42 | /// OpenSim by default. If you want to try enabling it, look in the bin folder of this project. | ||
43 | /// Please see the README.txt in this project on the filesystem for some more information. | ||
44 | /// Nonetheless, it may contain some useful example code so has been left here for now. | ||
45 | /// | ||
46 | /// You can see bare bones examples of the more modern region module system in OpenSim/Region/OptionalModules/Example | ||
47 | /// </remarks> | ||
48 | public class RegionModule : IRegionModule | ||
49 | { | ||
50 | #region IRegionModule Members | ||
51 | |||
52 | private Scene m_scene; | ||
53 | |||
54 | public void Initialise(Scene scene, IConfigSource source) | ||
55 | { | ||
56 | m_scene = scene; | ||
57 | } | ||
58 | |||
59 | public void PostInitialise() | ||
60 | { | ||
61 | // RegionInfo regionInfo = m_scene.RegionInfo; | ||
62 | |||
63 | // Vector3 pos = new Vector3(110, 129, 27); | ||
64 | |||
65 | //AddCpuCounter(regionInfo, pos); | ||
66 | // AddComplexObjects(regionInfo, pos); | ||
67 | AddAvatars(); | ||
68 | // AddFileSystemObjects(); | ||
69 | } | ||
70 | |||
71 | // private void AddFileSystemObjects() | ||
72 | // { | ||
73 | // DirectoryInfo dirInfo = new DirectoryInfo("."); | ||
74 | |||
75 | // float x = 0; | ||
76 | // float z = 0; | ||
77 | |||
78 | // foreach (FileInfo fileInfo in dirInfo.GetFiles()) | ||
79 | // { | ||
80 | // Vector3 filePos = new Vector3(100 + x, 129, 27 + z); | ||
81 | // x = x + 2; | ||
82 | // if (x > 50) | ||
83 | // { | ||
84 | // x = 0; | ||
85 | // z = z + 2; | ||
86 | // } | ||
87 | |||
88 | // FileSystemObject fileObject = new FileSystemObject(m_scene, fileInfo, filePos); | ||
89 | // m_scene.AddNewSceneObject(fileObject, true); | ||
90 | // } | ||
91 | // } | ||
92 | |||
93 | private void AddAvatars() | ||
94 | { | ||
95 | for (int i = 0; i < 1; i++) | ||
96 | { | ||
97 | MyNpcCharacter m_character = new MyNpcCharacter(m_scene); | ||
98 | m_scene.AddNewClient(m_character, PresenceType.Npc); | ||
99 | m_scene.AgentCrossing(m_character.AgentId, Vector3.Zero, false); | ||
100 | } | ||
101 | |||
102 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) | ||
103 | { | ||
104 | if (!sp.IsChildAgent) | ||
105 | sp.AbsolutePosition = | ||
106 | new Vector3((float)Util.RandomClass.Next(100, 200), (float)Util.RandomClass.Next(30, 200), 2); | ||
107 | }); | ||
108 | } | ||
109 | |||
110 | // private void AddComplexObjects(RegionInfo regionInfo, Vector3 pos) | ||
111 | // { | ||
112 | // int objs = 3; | ||
113 | |||
114 | // for (int i = 0; i < (objs*objs*objs); i++) | ||
115 | // { | ||
116 | // Vector3 posOffset = new Vector3((i % objs) * 4, ((i % (objs*objs)) / (objs)) * 4, (i / (objs*objs)) * 4); | ||
117 | // ComplexObject complexObject = | ||
118 | // new ComplexObject(m_scene, regionInfo.RegionHandle, UUID.Zero, pos + posOffset); | ||
119 | // m_scene.AddNewSceneObject(complexObject, true); | ||
120 | // } | ||
121 | // } | ||
122 | |||
123 | // private void AddCpuCounter(RegionInfo regionInfo, Vector3 pos) | ||
124 | // { | ||
125 | // SceneObjectGroup sceneObject = | ||
126 | // new CpuCounterObject(m_scene, regionInfo.RegionHandle, UUID.Zero, pos + new Vector3(1f, 1f, 1f)); | ||
127 | // m_scene.AddNewSceneObject(sceneObject, true); | ||
128 | // } | ||
129 | |||
130 | public void Close() | ||
131 | { | ||
132 | m_scene = null; | ||
133 | } | ||
134 | |||
135 | public string Name | ||
136 | { | ||
137 | get { return GetType().AssemblyQualifiedName; } | ||
138 | } | ||
139 | |||
140 | public bool IsSharedModule | ||
141 | { | ||
142 | get { return false; } | ||
143 | } | ||
144 | |||
145 | #endregion | ||
146 | } | ||
147 | } | ||