diff options
author | Robert Adams | 2014-01-28 08:50:28 -0800 |
---|---|---|
committer | Robert Adams | 2014-01-28 08:50:28 -0800 |
commit | 8eec717f5f0f34354a73dcfeecdd3e9514d5e435 (patch) | |
tree | fec59ef61f8782d21641a3a16080493d20a420b1 | |
parent | varregion: fix for teleporting by double clicking on a map location. (diff) | |
parent | Merge branch 'justincc-master' (diff) | |
download | opensim-SC-8eec717f5f0f34354a73dcfeecdd3e9514d5e435.zip opensim-SC-8eec717f5f0f34354a73dcfeecdd3e9514d5e435.tar.gz opensim-SC-8eec717f5f0f34354a73dcfeecdd3e9514d5e435.tar.bz2 opensim-SC-8eec717f5f0f34354a73dcfeecdd3e9514d5e435.tar.xz |
Merge branch 'master' into varregion
Diffstat (limited to '')
6 files changed, 107 insertions, 43 deletions
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index e3e0c01..52e520c 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs | |||
@@ -124,7 +124,7 @@ namespace OpenSim | |||
124 | else | 124 | else |
125 | { | 125 | { |
126 | Application.iniFilePath = Path.GetFullPath( | 126 | Application.iniFilePath = Path.GetFullPath( |
127 | Path.Combine(Util.configDir(), iniFileName)); | 127 | Path.Combine(Util.configDir(), iniFileName)); |
128 | 128 | ||
129 | if (!File.Exists(Application.iniFilePath)) | 129 | if (!File.Exists(Application.iniFilePath)) |
130 | { | 130 | { |
@@ -139,12 +139,29 @@ namespace OpenSim | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | m_config = new OpenSimConfigSource(); | ||
143 | m_config.Source = new IniConfigSource(); | ||
144 | m_config.Source.Merge(DefaultConfig()); | ||
145 | |||
146 | m_log.Info("[CONFIG]: Reading configuration settings"); | ||
147 | |||
148 | for (int i = 0 ; i < sources.Count ; i++) | ||
149 | { | ||
150 | if (ReadConfig(m_config, sources[i])) | ||
151 | { | ||
152 | iniFileExists = true; | ||
153 | AddIncludes(m_config, sources); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | // Override distro settings with contents of inidirectory | ||
142 | string iniDirName = startupConfig.GetString("inidirectory", "config"); | 158 | string iniDirName = startupConfig.GetString("inidirectory", "config"); |
143 | string iniDirPath = Path.Combine(Util.configDir(), iniDirName); | 159 | string iniDirPath = Path.Combine(Util.configDir(), iniDirName); |
144 | 160 | ||
145 | if (Directory.Exists(iniDirPath)) | 161 | if (Directory.Exists(iniDirPath)) |
146 | { | 162 | { |
147 | m_log.InfoFormat("Searching folder {0} for config ini files", iniDirPath); | 163 | m_log.InfoFormat("[CONFIG]: Searching folder {0} for config ini files", iniDirPath); |
164 | List<string> overrideSources = new List<string>(); | ||
148 | 165 | ||
149 | string[] fileEntries = Directory.GetFiles(iniDirName); | 166 | string[] fileEntries = Directory.GetFiles(iniDirName); |
150 | foreach (string filePath in fileEntries) | 167 | foreach (string filePath in fileEntries) |
@@ -152,33 +169,38 @@ namespace OpenSim | |||
152 | if (Path.GetExtension(filePath).ToLower() == ".ini") | 169 | if (Path.GetExtension(filePath).ToLower() == ".ini") |
153 | { | 170 | { |
154 | if (!sources.Contains(Path.GetFullPath(filePath))) | 171 | if (!sources.Contains(Path.GetFullPath(filePath))) |
172 | { | ||
173 | overrideSources.Add(Path.GetFullPath(filePath)); | ||
174 | // put it in sources too, to avoid circularity | ||
155 | sources.Add(Path.GetFullPath(filePath)); | 175 | sources.Add(Path.GetFullPath(filePath)); |
176 | } | ||
156 | } | 177 | } |
157 | } | 178 | } |
158 | } | ||
159 | 179 | ||
160 | m_config = new OpenSimConfigSource(); | ||
161 | m_config.Source = new IniConfigSource(); | ||
162 | m_config.Source.Merge(DefaultConfig()); | ||
163 | 180 | ||
164 | m_log.Info("[CONFIG]: Reading configuration settings"); | 181 | if (overrideSources.Count > 0) |
182 | { | ||
183 | OpenSimConfigSource overrideConfig = new OpenSimConfigSource(); | ||
184 | overrideConfig.Source = new IniConfigSource(); | ||
185 | |||
186 | for (int i = 0 ; i < overrideSources.Count ; i++) | ||
187 | { | ||
188 | if (ReadConfig(overrideConfig, overrideSources[i])) | ||
189 | { | ||
190 | iniFileExists = true; | ||
191 | AddIncludes(overrideConfig, overrideSources); | ||
192 | } | ||
193 | } | ||
194 | m_config.Source.Merge(overrideConfig.Source); | ||
195 | } | ||
196 | } | ||
165 | 197 | ||
166 | if (sources.Count == 0) | 198 | if (sources.Count == 0) |
167 | { | 199 | { |
168 | m_log.FatalFormat("[CONFIG]: Could not load any configuration"); | 200 | m_log.FatalFormat("[CONFIG]: Could not load any configuration"); |
169 | Environment.Exit(1); | 201 | Environment.Exit(1); |
170 | } | 202 | } |
171 | 203 | else if (!iniFileExists) | |
172 | for (int i = 0 ; i < sources.Count ; i++) | ||
173 | { | ||
174 | if (ReadConfig(sources[i])) | ||
175 | { | ||
176 | iniFileExists = true; | ||
177 | AddIncludes(sources); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | if (!iniFileExists) | ||
182 | { | 204 | { |
183 | m_log.FatalFormat("[CONFIG]: Could not load any configuration"); | 205 | m_log.FatalFormat("[CONFIG]: Could not load any configuration"); |
184 | m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!"); | 206 | m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!"); |
@@ -214,10 +236,10 @@ namespace OpenSim | |||
214 | /// Adds the included files as ini configuration files | 236 | /// Adds the included files as ini configuration files |
215 | /// </summary> | 237 | /// </summary> |
216 | /// <param name="sources">List of URL strings or filename strings</param> | 238 | /// <param name="sources">List of URL strings or filename strings</param> |
217 | private void AddIncludes(List<string> sources) | 239 | private void AddIncludes(OpenSimConfigSource configSource, List<string> sources) |
218 | { | 240 | { |
219 | //loop over config sources | 241 | //loop over config sources |
220 | foreach (IConfig config in m_config.Source.Configs) | 242 | foreach (IConfig config in configSource.Source.Configs) |
221 | { | 243 | { |
222 | // Look for Include-* in the key name | 244 | // Look for Include-* in the key name |
223 | string[] keys = config.GetKeys(); | 245 | string[] keys = config.GetKeys(); |
@@ -284,7 +306,7 @@ namespace OpenSim | |||
284 | /// </summary> | 306 | /// </summary> |
285 | /// <param name="iniPath">Full path to the ini</param> | 307 | /// <param name="iniPath">Full path to the ini</param> |
286 | /// <returns></returns> | 308 | /// <returns></returns> |
287 | private bool ReadConfig(string iniPath) | 309 | private bool ReadConfig(OpenSimConfigSource configSource, string iniPath) |
288 | { | 310 | { |
289 | bool success = false; | 311 | bool success = false; |
290 | 312 | ||
@@ -292,7 +314,7 @@ namespace OpenSim | |||
292 | { | 314 | { |
293 | m_log.InfoFormat("[CONFIG]: Reading configuration file {0}", Path.GetFullPath(iniPath)); | 315 | m_log.InfoFormat("[CONFIG]: Reading configuration file {0}", Path.GetFullPath(iniPath)); |
294 | 316 | ||
295 | m_config.Source.Merge(new IniConfigSource(iniPath)); | 317 | configSource.Source.Merge(new IniConfigSource(iniPath)); |
296 | success = true; | 318 | success = true; |
297 | } | 319 | } |
298 | else | 320 | else |
@@ -305,7 +327,7 @@ namespace OpenSim | |||
305 | { | 327 | { |
306 | XmlReader r = XmlReader.Create(iniPath); | 328 | XmlReader r = XmlReader.Create(iniPath); |
307 | XmlConfigSource cs = new XmlConfigSource(r); | 329 | XmlConfigSource cs = new XmlConfigSource(r); |
308 | m_config.Source.Merge(cs); | 330 | configSource.Source.Merge(cs); |
309 | 331 | ||
310 | success = true; | 332 | success = true; |
311 | } | 333 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b4274ba..715a9b6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1193,22 +1193,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
1193 | // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently | 1193 | // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently |
1194 | // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are | 1194 | // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are |
1195 | // not transporting the required data. | 1195 | // not transporting the required data. |
1196 | lock (m_attachments) | 1196 | // |
1197 | // We need to restart scripts here so that they receive the correct changed events (CHANGED_TELEPORT | ||
1198 | // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently | ||
1199 | // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are | ||
1200 | // not transporting the required data. | ||
1201 | // | ||
1202 | // We must take a copy of the attachments list here (rather than locking) to avoid a deadlock where a script in one of | ||
1203 | // the attachments may start processing an event (which locks ScriptInstance.m_Script) that then calls a method here | ||
1204 | // which needs to lock m_attachments. ResumeScripts() needs to take a ScriptInstance.m_Script lock to try to unset the Suspend status. | ||
1205 | // | ||
1206 | // FIXME: In theory, this deadlock should not arise since scripts should not be processing events until ResumeScripts(). | ||
1207 | // But XEngine starts all scripts unsuspended. Starting them suspended will not currently work because script rezzing | ||
1208 | // is placed in an asynchronous queue in XEngine and so the ResumeScripts() call will almost certainly execute before the | ||
1209 | // script is rezzed. This means the ResumeScripts() does absolutely nothing when using XEngine. | ||
1210 | // | ||
1211 | // One cannot simply iterate over attachments in a fire and forget thread because this would no longer | ||
1212 | // be locked, allowing race conditions if other code changes the attachments list. | ||
1213 | List<SceneObjectGroup> attachments = GetAttachments(); | ||
1214 | |||
1215 | if (attachments.Count > 0) | ||
1197 | { | 1216 | { |
1198 | if (HasAttachments()) | 1217 | m_log.DebugFormat( |
1199 | { | 1218 | "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); |
1200 | m_log.DebugFormat( | ||
1201 | "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); | ||
1202 | 1219 | ||
1203 | // Resume scripts | 1220 | // Resume scripts |
1204 | Util.FireAndForget(delegate(object x) { | 1221 | foreach (SceneObjectGroup sog in attachments) |
1205 | foreach (SceneObjectGroup sog in m_attachments) | 1222 | { |
1206 | { | 1223 | sog.ScheduleGroupForFullUpdate(); |
1207 | sog.ScheduleGroupForFullUpdate(); | 1224 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); |
1208 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); | 1225 | sog.ResumeScripts(); |
1209 | sog.ResumeScripts(); | ||
1210 | } | ||
1211 | }); | ||
1212 | } | 1226 | } |
1213 | } | 1227 | } |
1214 | } | 1228 | } |
@@ -2912,7 +2926,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2912 | Rotation = newRot; | 2926 | Rotation = newRot; |
2913 | 2927 | ||
2914 | // ParentPosition = part.AbsolutePosition; | 2928 | // ParentPosition = part.AbsolutePosition; |
2915 | part.ParentGroup.AddAvatar(UUID); | ||
2916 | } | 2929 | } |
2917 | else | 2930 | else |
2918 | { | 2931 | { |
@@ -2921,13 +2934,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2921 | m_pos -= part.GroupPosition; | 2934 | m_pos -= part.GroupPosition; |
2922 | 2935 | ||
2923 | // ParentPosition = part.AbsolutePosition; | 2936 | // ParentPosition = part.AbsolutePosition; |
2924 | part.ParentGroup.AddAvatar(UUID); | ||
2925 | 2937 | ||
2926 | // m_log.DebugFormat( | 2938 | // m_log.DebugFormat( |
2927 | // "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", | 2939 | // "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", |
2928 | // Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); | 2940 | // Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); |
2929 | } | 2941 | } |
2930 | 2942 | ||
2943 | part.ParentGroup.AddAvatar(UUID); | ||
2931 | ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); | 2944 | ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); |
2932 | ParentID = m_requestedSitTargetID; | 2945 | ParentID = m_requestedSitTargetID; |
2933 | m_AngularVelocity = Vector3.Zero; | 2946 | m_AngularVelocity = Vector3.Zero; |
@@ -3231,6 +3244,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3231 | // again here... this comes after the cached appearance check because the avatars | 3244 | // again here... this comes after the cached appearance check because the avatars |
3232 | // appearance goes into the avatar update packet | 3245 | // appearance goes into the avatar update packet |
3233 | SendAvatarDataToAllAgents(); | 3246 | SendAvatarDataToAllAgents(); |
3247 | |||
3248 | // This invocation always shows up in the viewer logs as an error. Is it needed? | ||
3234 | SendAppearanceToAgent(this); | 3249 | SendAppearanceToAgent(this); |
3235 | 3250 | ||
3236 | // If we are using the the cached appearance then send it out to everyone | 3251 | // If we are using the the cached appearance then send it out to everyone |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 7f9e440..c65794e 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -110,8 +110,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
110 | // ScenePresence.SendInitialData() to reset our entire appearance. | 110 | // ScenePresence.SendInitialData() to reset our entire appearance. |
111 | m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); | 111 | m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); |
112 | 112 | ||
113 | /* | 113 | m_afMod.SetAppearance(sp, originalTe, null, null); |
114 | m_afMod.SetAppearance(sp, originalTe, null); | ||
115 | 114 | ||
116 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); | 115 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); |
117 | 116 | ||
@@ -126,7 +125,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
126 | 125 | ||
127 | // Have to account for both SP and NPC. | 126 | // Have to account for both SP and NPC. |
128 | Assert.That(m_scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(2)); | 127 | Assert.That(m_scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(2)); |
129 | */ | ||
130 | } | 128 | } |
131 | 129 | ||
132 | [Test] | 130 | [Test] |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 31ea067..73174b4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2927,6 +2927,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2927 | return ret; | 2927 | return ret; |
2928 | } | 2928 | } |
2929 | 2929 | ||
2930 | public LSL_Vector osGetRegionSize() | ||
2931 | { | ||
2932 | CheckThreatLevel(ThreatLevel.None, "osGetRegionSize"); | ||
2933 | m_host.AddScriptLPS(1); | ||
2934 | |||
2935 | bool isMegaregion; | ||
2936 | IRegionCombinerModule rcMod = World.RequestModuleInterface<IRegionCombinerModule>(); | ||
2937 | if (rcMod != null) | ||
2938 | isMegaregion = rcMod.IsRootForMegaregion(World.RegionInfo.RegionID); | ||
2939 | else | ||
2940 | isMegaregion = false; | ||
2941 | |||
2942 | if (isMegaregion) | ||
2943 | { | ||
2944 | Vector2 size = rcMod.GetSizeOfMegaregion(World.RegionInfo.RegionID); | ||
2945 | return new LSL_Vector(size.X, size.Y, Constants.RegionHeight); | ||
2946 | } | ||
2947 | else | ||
2948 | { | ||
2949 | return new LSL_Vector((float)Constants.RegionSize, (float)Constants.RegionSize, Constants.RegionHeight); | ||
2950 | } | ||
2951 | } | ||
2952 | |||
2930 | public int osGetSimulatorMemory() | 2953 | public int osGetSimulatorMemory() |
2931 | { | 2954 | { |
2932 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); | 2955 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 51d0581..519779e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -337,6 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
337 | key osGetMapTexture(); | 337 | key osGetMapTexture(); |
338 | key osGetRegionMapTexture(string regionName); | 338 | key osGetRegionMapTexture(string regionName); |
339 | LSL_List osGetRegionStats(); | 339 | LSL_List osGetRegionStats(); |
340 | vector osGetRegionSize(); | ||
340 | 341 | ||
341 | int osGetSimulatorMemory(); | 342 | int osGetSimulatorMemory(); |
342 | void osKickAvatar(string FirstName,string SurName,string alert); | 343 | void osKickAvatar(string FirstName,string SurName,string alert); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index d81cddc..9c060e5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -865,6 +865,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
865 | return m_OSSL_Functions.osGetRegionStats(); | 865 | return m_OSSL_Functions.osGetRegionStats(); |
866 | } | 866 | } |
867 | 867 | ||
868 | public vector osGetRegionSize() | ||
869 | { | ||
870 | return m_OSSL_Functions.osGetRegionSize(); | ||
871 | } | ||
872 | |||
868 | /// <summary> | 873 | /// <summary> |
869 | /// Returns the amount of memory in use by the Simulator Daemon. | 874 | /// Returns the amount of memory in use by the Simulator Daemon. |
870 | /// Amount in bytes - if >= 4GB, returns 4GB. (LSL is not 64-bit aware) | 875 | /// Amount in bytes - if >= 4GB, returns 4GB. (LSL is not 64-bit aware) |