diff options
author | Adam Frisby | 2008-02-14 12:16:33 +0000 |
---|---|---|
committer | Adam Frisby | 2008-02-14 12:16:33 +0000 |
commit | f3afa68a2af6ad5999e6efe3e4725cb17293108d (patch) | |
tree | 4253a44bee39976d6b3dd6813439f5966cf12632 /OpenSim/Region/Environment/Modules | |
parent | * Exposed AddHandlers in response to mantis #534. Thanks, kmeisthax! (diff) | |
download | opensim-SC-f3afa68a2af6ad5999e6efe3e4725cb17293108d.zip opensim-SC-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.gz opensim-SC-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.bz2 opensim-SC-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.xz |
* Made new Framework.Constants class, added RegionSize member.
* Converted all instances of "256" spotted to use RegionSize instead. Some approximations used for border crossings (ie 255.9f) are still using that value, but should be updated to use something based on RegionSize.
* Moving Terrain to a RegionModule, implemented ITerrainChannel and TerrainModule - nonfunctional, but will be soon.
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r-- | OpenSim/Region/Environment/Modules/ChatModule.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/TerrainModule.cs | 131 |
2 files changed, 133 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index 82bd2ec..a34bd96 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -223,7 +223,7 @@ namespace OpenSim.Region.Environment.Modules | |||
223 | 223 | ||
224 | // Filled in since it's easier than rewriting right now. | 224 | // Filled in since it's easier than rewriting right now. |
225 | LLVector3 fromPos = e.Position; | 225 | LLVector3 fromPos = e.Position; |
226 | LLVector3 regionPos = new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0); | 226 | LLVector3 regionPos = new LLVector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); |
227 | 227 | ||
228 | string fromName = e.From; | 228 | string fromName = e.From; |
229 | string message = e.Message; | 229 | string message = e.Message; |
@@ -237,7 +237,7 @@ namespace OpenSim.Region.Environment.Modules | |||
237 | if (avatar != null) | 237 | if (avatar != null) |
238 | { | 238 | { |
239 | fromPos = avatar.AbsolutePosition; | 239 | fromPos = avatar.AbsolutePosition; |
240 | regionPos = new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0); | 240 | regionPos = new LLVector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, scene.RegionInfo.RegionLocY * Constants.RegionSize, 0); |
241 | fromName = avatar.Firstname + " " + avatar.Lastname; | 241 | fromName = avatar.Firstname + " " + avatar.Lastname; |
242 | fromAgentID = e.Sender.AgentId; | 242 | fromAgentID = e.Sender.AgentId; |
243 | } | 243 | } |
diff --git a/OpenSim/Region/Environment/Modules/TerrainModule.cs b/OpenSim/Region/Environment/Modules/TerrainModule.cs new file mode 100644 index 0000000..7e163a3 --- /dev/null +++ b/OpenSim/Region/Environment/Modules/TerrainModule.cs | |||
@@ -0,0 +1,131 @@ | |||
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 OpenSim 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 | |||
29 | using Nini.Config; | ||
30 | using System; | ||
31 | using System.Collections; | ||
32 | using System.Collections.Generic; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Region.Environment.Interfaces; | ||
36 | using OpenSim.Region.Environment.Scenes; | ||
37 | using libsecondlife; | ||
38 | |||
39 | namespace OpenSim.Region.Environment.Modules | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// A new version of the old Channel class, simplified | ||
43 | /// </summary> | ||
44 | public class TerrainChannel : ITerrainChannel | ||
45 | { | ||
46 | private double[,] map; | ||
47 | |||
48 | public int Width | ||
49 | { | ||
50 | get { return map.GetLength(0); } | ||
51 | } | ||
52 | |||
53 | public int Height | ||
54 | { | ||
55 | get { return map.GetLength(1); } | ||
56 | } | ||
57 | |||
58 | public TerrainChannel Copy() | ||
59 | { | ||
60 | TerrainChannel copy = new TerrainChannel(false); | ||
61 | copy.map = (double[,])this.map.Clone(); | ||
62 | |||
63 | return copy; | ||
64 | } | ||
65 | |||
66 | public double this[int x, int y] | ||
67 | { | ||
68 | get | ||
69 | { | ||
70 | return map[x, y]; | ||
71 | } | ||
72 | set | ||
73 | { | ||
74 | map[x, y] = value; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | public TerrainChannel() | ||
79 | { | ||
80 | map = new double[Constants.RegionSize, Constants.RegionSize]; | ||
81 | } | ||
82 | |||
83 | public TerrainChannel(bool createMap) | ||
84 | { | ||
85 | if (createMap) | ||
86 | map = new double[Constants.RegionSize, Constants.RegionSize]; | ||
87 | } | ||
88 | |||
89 | public TerrainChannel(int w, int h) | ||
90 | { | ||
91 | map = new double[w, h]; | ||
92 | } | ||
93 | } | ||
94 | |||
95 | public class TerrainModule : IRegionModule | ||
96 | { | ||
97 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
98 | |||
99 | Scene m_scene; | ||
100 | |||
101 | private IConfigSource m_gConfig; | ||
102 | |||
103 | public void Initialise(Scene scene, IConfigSource config) | ||
104 | { | ||
105 | m_scene = scene; | ||
106 | m_gConfig = config; | ||
107 | } | ||
108 | |||
109 | public void Close() | ||
110 | { | ||
111 | |||
112 | } | ||
113 | |||
114 | public string Name | ||
115 | { | ||
116 | get { return "TerrainModule"; } | ||
117 | } | ||
118 | |||
119 | public bool IsSharedModule | ||
120 | { | ||
121 | get { return false; } | ||
122 | } | ||
123 | |||
124 | public void PostInitialise() | ||
125 | { | ||
126 | |||
127 | } | ||
128 | |||
129 | } | ||
130 | |||
131 | } | ||