diff options
author | MW | 2007-05-27 18:52:42 +0000 |
---|---|---|
committer | MW | 2007-05-27 18:52:42 +0000 |
commit | c746a2f9f4f0b1e7eea564effdae63472f79ab22 (patch) | |
tree | 54d23af3d168958bfec995cf2987cf5af79ac149 /Common/OpenSim.Framework/Types/RegionInfo.cs | |
parent | Goodbye World (diff) | |
download | opensim-SC_OLD-c746a2f9f4f0b1e7eea564effdae63472f79ab22.zip opensim-SC_OLD-c746a2f9f4f0b1e7eea564effdae63472f79ab22.tar.gz opensim-SC_OLD-c746a2f9f4f0b1e7eea564effdae63472f79ab22.tar.bz2 opensim-SC_OLD-c746a2f9f4f0b1e7eea564effdae63472f79ab22.tar.xz |
Should allow multiple worlds (and UDP servers) to be ran in one instance, just missing backend comms and working Avatar/primitives classes.
Diffstat (limited to 'Common/OpenSim.Framework/Types/RegionInfo.cs')
-rw-r--r-- | Common/OpenSim.Framework/Types/RegionInfo.cs | 198 |
1 files changed, 198 insertions, 0 deletions
diff --git a/Common/OpenSim.Framework/Types/RegionInfo.cs b/Common/OpenSim.Framework/Types/RegionInfo.cs new file mode 100644 index 0000000..fd3b24f --- /dev/null +++ b/Common/OpenSim.Framework/Types/RegionInfo.cs | |||
@@ -0,0 +1,198 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Framework.Interfaces; | ||
5 | using OpenSim.Framework.Utilities; | ||
6 | using OpenSim.Framework.Console; | ||
7 | using libsecondlife; | ||
8 | |||
9 | namespace OpenSim.Framework.Types | ||
10 | { | ||
11 | public class RegionInfo | ||
12 | { | ||
13 | public LLUUID SimUUID; | ||
14 | public string RegionName; | ||
15 | public uint RegionLocX; | ||
16 | public uint RegionLocY; | ||
17 | public ulong RegionHandle; | ||
18 | public ushort RegionWaterHeight = 20; | ||
19 | public bool RegionTerraform = true; | ||
20 | |||
21 | public int IPListenPort; | ||
22 | public string IPListenAddr; | ||
23 | |||
24 | private bool isSandbox; | ||
25 | public string DataStore; | ||
26 | |||
27 | // Region Information | ||
28 | // Low resolution 'base' textures. No longer used. | ||
29 | public LLUUID TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); // Default | ||
30 | public LLUUID TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); // Default | ||
31 | public LLUUID TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); // Default | ||
32 | public LLUUID TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); // Default | ||
33 | // Higher resolution terrain textures | ||
34 | public LLUUID TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
35 | public LLUUID TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
36 | public LLUUID TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
37 | public LLUUID TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
38 | // First quad - each point is bilinearly interpolated at each meter of terrain | ||
39 | public float TerrainStartHeight00 = 10.0f; // NW Corner ( I think ) | ||
40 | public float TerrainStartHeight01 = 10.0f; // NE Corner ( I think ) | ||
41 | public float TerrainStartHeight10 = 10.0f; // SW Corner ( I think ) | ||
42 | public float TerrainStartHeight11 = 10.0f; // SE Corner ( I think ) | ||
43 | // Second quad - also bilinearly interpolated. | ||
44 | // Terrain texturing is done that: | ||
45 | // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y] | ||
46 | public float TerrainHeightRange00 = 60.0f; | ||
47 | public float TerrainHeightRange01 = 60.0f; | ||
48 | public float TerrainHeightRange10 = 60.0f; | ||
49 | public float TerrainHeightRange11 = 60.0f; | ||
50 | |||
51 | // Terrain Default (Must be in F32 Format!) | ||
52 | public string TerrainFile = "default.r32"; | ||
53 | public double TerrainMultiplier = 60.0; | ||
54 | |||
55 | public RegionInfo() | ||
56 | { | ||
57 | |||
58 | } | ||
59 | |||
60 | |||
61 | public void InitConfig(bool sandboxMode, IGenericConfig configData) | ||
62 | { | ||
63 | this.isSandbox = sandboxMode; | ||
64 | try | ||
65 | { | ||
66 | // Sim UUID | ||
67 | string attri = ""; | ||
68 | attri = configData.GetAttribute("SimUUID"); | ||
69 | if (attri == "") | ||
70 | { | ||
71 | this.SimUUID = LLUUID.Random(); | ||
72 | configData.SetAttribute("SimUUID", this.SimUUID.ToString()); | ||
73 | } | ||
74 | else | ||
75 | { | ||
76 | this.SimUUID = new LLUUID(attri); | ||
77 | } | ||
78 | |||
79 | // Sim name | ||
80 | attri = ""; | ||
81 | attri = configData.GetAttribute("SimName"); | ||
82 | if (attri == "") | ||
83 | { | ||
84 | this.RegionName = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Name", "OpenSim test"); | ||
85 | configData.SetAttribute("SimName", this.RegionName); | ||
86 | } | ||
87 | else | ||
88 | { | ||
89 | this.RegionName = attri; | ||
90 | } | ||
91 | // Sim/Grid location X | ||
92 | attri = ""; | ||
93 | attri = configData.GetAttribute("SimLocationX"); | ||
94 | if (attri == "") | ||
95 | { | ||
96 | string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location X", "997"); | ||
97 | configData.SetAttribute("SimLocationX", location); | ||
98 | this.RegionLocX = (uint)Convert.ToUInt32(location); | ||
99 | } | ||
100 | else | ||
101 | { | ||
102 | this.RegionLocX = (uint)Convert.ToUInt32(attri); | ||
103 | } | ||
104 | // Sim/Grid location Y | ||
105 | attri = ""; | ||
106 | attri = configData.GetAttribute("SimLocationY"); | ||
107 | if (attri == "") | ||
108 | { | ||
109 | string location = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location Y", "996"); | ||
110 | configData.SetAttribute("SimLocationY", location); | ||
111 | this.RegionLocY = (uint)Convert.ToUInt32(location); | ||
112 | } | ||
113 | else | ||
114 | { | ||
115 | this.RegionLocY = (uint)Convert.ToUInt32(attri); | ||
116 | } | ||
117 | |||
118 | // Local storage datastore | ||
119 | attri = ""; | ||
120 | attri = configData.GetAttribute("Datastore"); | ||
121 | if (attri == "") | ||
122 | { | ||
123 | string datastore = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Filename for local storage", "localworld.yap"); | ||
124 | configData.SetAttribute("Datastore", datastore); | ||
125 | this.DataStore = datastore; | ||
126 | } | ||
127 | else | ||
128 | { | ||
129 | this.DataStore = attri; | ||
130 | } | ||
131 | |||
132 | //Sim Listen Port | ||
133 | attri = ""; | ||
134 | attri = configData.GetAttribute("SimListenPort"); | ||
135 | if (attri == "") | ||
136 | { | ||
137 | string port = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("UDP port for client connections", "9000"); | ||
138 | configData.SetAttribute("SimListenPort", port); | ||
139 | this.IPListenPort = Convert.ToInt32(port); | ||
140 | } | ||
141 | else | ||
142 | { | ||
143 | this.IPListenPort = Convert.ToInt32(attri); | ||
144 | } | ||
145 | |||
146 | //Sim Listen Address | ||
147 | attri = ""; | ||
148 | attri = configData.GetAttribute("SimListenAddress"); | ||
149 | if (attri == "") | ||
150 | { | ||
151 | this.IPListenAddr = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections", "127.0.0.1"); | ||
152 | configData.SetAttribute("SimListenAddress", this.IPListenAddr); | ||
153 | } | ||
154 | else | ||
155 | { | ||
156 | // Probably belongs elsewhere, but oh well. | ||
157 | if (attri.Trim().StartsWith("SYSTEMIP")) | ||
158 | { | ||
159 | string localhostname = System.Net.Dns.GetHostName(); | ||
160 | System.Net.IPAddress[] ips = System.Net.Dns.GetHostAddresses(localhostname); | ||
161 | try | ||
162 | { | ||
163 | this.IPListenAddr = ips[0].ToString(); | ||
164 | } | ||
165 | catch (Exception e) | ||
166 | { | ||
167 | e.ToString(); | ||
168 | this.IPListenAddr = "127.0.0.1"; // Use the default if we fail | ||
169 | } | ||
170 | } | ||
171 | else | ||
172 | { | ||
173 | this.IPListenAddr = attri; | ||
174 | } | ||
175 | } | ||
176 | |||
177 | |||
178 | this.RegionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); | ||
179 | |||
180 | configData.Commit(); | ||
181 | } | ||
182 | catch (Exception e) | ||
183 | { | ||
184 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"Config.cs:InitConfig() - Exception occured"); | ||
185 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,e.ToString()); | ||
186 | } | ||
187 | |||
188 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Sim settings loaded:"); | ||
189 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "UUID: " + this.SimUUID.ToStringHyphenated()); | ||
190 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Name: " + this.RegionName); | ||
191 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); | ||
192 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Region Handle: " + this.RegionHandle.ToString()); | ||
193 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); | ||
194 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Sandbox Mode? " + isSandbox.ToString()); | ||
195 | |||
196 | } | ||
197 | } | ||
198 | } | ||