aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2012-03-18 20:44:56 +0000
committerMelanie2012-03-18 20:44:56 +0000
commitc7e302864a2eef7f9587ed22286c96a6074ac5b3 (patch)
tree8f0df2f66811309fd790966770434fa3ff68bfdf /OpenSim/Region/Framework
parentMerge branch 'ubitwork' (diff)
parentAmend to previous commit: normalize strings ToLower. (diff)
downloadopensim-SC_OLD-c7e302864a2eef7f9587ed22286c96a6074ac5b3.zip
opensim-SC_OLD-c7e302864a2eef7f9587ed22286c96a6074ac5b3.tar.gz
opensim-SC_OLD-c7e302864a2eef7f9587ed22286c96a6074ac5b3.tar.bz2
opensim-SC_OLD-c7e302864a2eef7f9587ed22286c96a6074ac5b3.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModule.cs12
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs56
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs31
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/TerrainChannel.cs60
7 files changed, 79 insertions, 118 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index 2d6758b..ce66100 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic;
30using OpenMetaverse; 31using OpenMetaverse;
31 32
32namespace OpenSim.Region.Framework.Interfaces 33namespace OpenSim.Region.Framework.Interfaces
@@ -76,5 +77,14 @@ namespace OpenSim.Region.Framework.Interfaces
76 /// Starts the processing threads. 77 /// Starts the processing threads.
77 /// </summary> 78 /// </summary>
78 void StartProcessing(); 79 void StartProcessing();
80
81 /// <summary>
82 /// Get the execution times of all scripts in each object.
83 /// </summary>
84 /// <returns>
85 /// A dictionary where the key is the root object ID of a linkset
86 /// and the value is a representative execution time in milliseconds of all scripts in that linkset.
87 /// </returns>
88 Dictionary<uint, float> GetObjectScriptsExecutionTimes();
79 } 89 }
80} 90} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
index d7fa316..bb4c788 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
@@ -31,6 +31,7 @@ using OpenMetaverse;
31namespace OpenSim.Region.Framework.Interfaces 31namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public delegate void ScriptCommand(UUID script, string id, string module, string command, string k); 33 public delegate void ScriptCommand(UUID script, string id, string module, string command, string k);
34 public delegate object ScriptInvocation(UUID script, object[] parms);
34 35
35 /// <summary> 36 /// <summary>
36 /// Interface for communication between OpenSim modules and in-world scripts 37 /// Interface for communication between OpenSim modules and in-world scripts
@@ -45,6 +46,15 @@ namespace OpenSim.Region.Framework.Interfaces
45 /// </summary> 46 /// </summary>
46 event ScriptCommand OnScriptCommand; 47 event ScriptCommand OnScriptCommand;
47 48
49 void RegisterScriptInvocation(string name, ScriptInvocation fn, Type[] csig, Type rsig);
50
51 ScriptInvocation LookupScriptInvocation(string fname);
52 string LookupModInvocation(string fname);
53 Type[] LookupTypeSignature(string fname);
54 Type LookupReturnType(string fname);
55
56 object InvokeOperation(UUID scriptId, string fname, params object[] parms);
57
48 /// <summary> 58 /// <summary>
49 /// Send a link_message event to an in-world script 59 /// Send a link_message event to an in-world script
50 /// </summary> 60 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index b006045..35ac908 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -341,62 +341,6 @@ namespace OpenSim.Region.Framework.Scenes
341 EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg); 341 EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg);
342 } 342 }
343 343
344 public void ProcessAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query)
345 {
346 //EventManager.TriggerAvatarPickerRequest();
347
348 List<UserAccount> accounts = UserAccountService.GetUserAccounts(RegionInfo.ScopeID, query);
349
350 if (accounts == null)
351 {
352 m_log.DebugFormat("[LLCIENT]: ProcessAvatarPickerRequest: returned null result");
353 return;
354 }
355
356 AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply);
357 // TODO: don't create new blocks if recycling an old packet
358
359 AvatarPickerReplyPacket.DataBlock[] searchData =
360 new AvatarPickerReplyPacket.DataBlock[accounts.Count];
361 AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock();
362
363 agentData.AgentID = avatarID;
364 agentData.QueryID = RequestID;
365 replyPacket.AgentData = agentData;
366 //byte[] bytes = new byte[AvatarResponses.Count*32];
367
368 int i = 0;
369 foreach (UserAccount item in accounts)
370 {
371 UUID translatedIDtem = item.PrincipalID;
372 searchData[i] = new AvatarPickerReplyPacket.DataBlock();
373 searchData[i].AvatarID = translatedIDtem;
374 searchData[i].FirstName = Utils.StringToBytes((string) item.FirstName);
375 searchData[i].LastName = Utils.StringToBytes((string) item.LastName);
376 i++;
377 }
378 if (accounts.Count == 0)
379 {
380 searchData = new AvatarPickerReplyPacket.DataBlock[0];
381 }
382 replyPacket.Data = searchData;
383
384 AvatarPickerReplyAgentDataArgs agent_data = new AvatarPickerReplyAgentDataArgs();
385 agent_data.AgentID = replyPacket.AgentData.AgentID;
386 agent_data.QueryID = replyPacket.AgentData.QueryID;
387
388 List<AvatarPickerReplyDataArgs> data_args = new List<AvatarPickerReplyDataArgs>();
389 for (i = 0; i < replyPacket.Data.Length; i++)
390 {
391 AvatarPickerReplyDataArgs data_arg = new AvatarPickerReplyDataArgs();
392 data_arg.AvatarID = replyPacket.Data[i].AvatarID;
393 data_arg.FirstName = replyPacket.Data[i].FirstName;
394 data_arg.LastName = replyPacket.Data[i].LastName;
395 data_args.Add(data_arg);
396 }
397 client.SendAvatarPickerReply(agent_data, data_args);
398 }
399
400 public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID, 344 public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID,
401 UUID itemID) 345 UUID itemID)
402 { 346 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index de1517b..753effc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1632,8 +1632,15 @@ namespace OpenSim.Region.Framework.Scenes
1632 double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID); 1632 double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID);
1633 if (map == null) 1633 if (map == null)
1634 { 1634 {
1635 m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain."); 1635 // This should be in the Terrain module, but it isn't because
1636 Heightmap = new TerrainChannel(); 1636 // the heightmap is needed _way_ before the modules are initialized...
1637 IConfig terrainConfig = m_config.Configs["Terrain"];
1638 String m_InitialTerrain = "pinhead-island";
1639 if (terrainConfig != null)
1640 m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain);
1641
1642 m_log.InfoFormat("[TERRAIN]: No default terrain. Generating a new terrain {0}.", m_InitialTerrain);
1643 Heightmap = new TerrainChannel(m_InitialTerrain);
1637 1644
1638 SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); 1645 SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
1639 } 1646 }
@@ -2894,7 +2901,6 @@ namespace OpenSim.Region.Framework.Scenes
2894 { 2901 {
2895 //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; 2902 //client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
2896 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; 2903 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
2897 client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
2898 client.OnSetStartLocationRequest += SetHomeRezPoint; 2904 client.OnSetStartLocationRequest += SetHomeRezPoint;
2899 client.OnRegionHandleRequest += RegionHandleRequest; 2905 client.OnRegionHandleRequest += RegionHandleRequest;
2900 } 2906 }
@@ -3022,7 +3028,6 @@ namespace OpenSim.Region.Framework.Scenes
3022 { 3028 {
3023 //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; 3029 //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest;
3024 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; 3030 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
3025 client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest;
3026 client.OnSetStartLocationRequest -= SetHomeRezPoint; 3031 client.OnSetStartLocationRequest -= SetHomeRezPoint;
3027 client.OnRegionHandleRequest -= RegionHandleRequest; 3032 client.OnRegionHandleRequest -= RegionHandleRequest;
3028 } 3033 }
@@ -3693,9 +3698,9 @@ namespace OpenSim.Region.Framework.Scenes
3693 if (!AuthorizationService.IsAuthorizedForRegion( 3698 if (!AuthorizationService.IsAuthorizedForRegion(
3694 agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) 3699 agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason))
3695 { 3700 {
3696 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", 3701 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because {4}",
3697 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3702 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason);
3698 3703
3699 return false; 3704 return false;
3700 } 3705 }
3701 } 3706 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 4e9a8f8..18069af 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -814,6 +814,7 @@ namespace OpenSim.Region.Framework.Scenes
814 #endregion 814 #endregion
815 815
816 #region Get Methods 816 #region Get Methods
817
817 /// <summary> 818 /// <summary>
818 /// Get the controlling client for the given avatar, if there is one. 819 /// Get the controlling client for the given avatar, if there is one.
819 /// 820 ///
@@ -1155,36 +1156,6 @@ namespace OpenSim.Region.Framework.Scenes
1155 return Entities.GetEntities(); 1156 return Entities.GetEntities();
1156 } 1157 }
1157 1158
1158 public Dictionary<uint, float> GetTopScripts()
1159 {
1160 Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
1161
1162 EntityBase[] EntityList = GetEntities();
1163 int limit = 0;
1164 foreach (EntityBase ent in EntityList)
1165 {
1166 if (ent is SceneObjectGroup)
1167 {
1168 SceneObjectGroup grp = (SceneObjectGroup)ent;
1169 if ((grp.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
1170 {
1171 if (grp.scriptScore >= 0.01)
1172 {
1173 topScripts.Add(grp.LocalId, grp.scriptScore);
1174 limit++;
1175 if (limit >= 100)
1176 {
1177 break;
1178 }
1179 }
1180 grp.scriptScore = 0;
1181 }
1182 }
1183 }
1184
1185 return topScripts;
1186 }
1187
1188 #endregion 1159 #endregion
1189 1160
1190 #region Other Methods 1161 #region Other Methods
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 5507aa0..0d1adcb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -293,8 +293,6 @@ namespace OpenSim.Region.Framework.Scenes
293 get { return RootPart.VolumeDetectActive; } 293 get { return RootPart.VolumeDetectActive; }
294 } 294 }
295 295
296 public float scriptScore;
297
298 private Vector3 lastPhysGroupPos; 296 private Vector3 lastPhysGroupPos;
299 private Quaternion lastPhysGroupRot; 297 private Quaternion lastPhysGroupRot;
300 298
@@ -1622,12 +1620,7 @@ namespace OpenSim.Region.Framework.Scenes
1622 1620
1623 public void AddScriptLPS(int count) 1621 public void AddScriptLPS(int count)
1624 { 1622 {
1625 if (scriptScore + count >= float.MaxValue - count) 1623 m_scene.SceneGraph.AddToScriptLPS(count);
1626 scriptScore = 0;
1627
1628 scriptScore += (float)count;
1629 SceneGraph d = m_scene.SceneGraph;
1630 d.AddToScriptLPS(count);
1631 } 1624 }
1632 1625
1633 public void AddActiveScriptCount(int count) 1626 public void AddActiveScriptCount(int count)
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
index ca6210d..c0ca48e 100644
--- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
+++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
@@ -46,23 +46,20 @@ namespace OpenSim.Region.Framework.Scenes
46 public TerrainChannel() 46 public TerrainChannel()
47 { 47 {
48 map = new double[Constants.RegionSize, Constants.RegionSize]; 48 map = new double[Constants.RegionSize, Constants.RegionSize];
49 taint = new bool[Constants.RegionSize / 16,Constants.RegionSize / 16]; 49 taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16];
50 50
51 int x; 51 PinHeadIsland();
52 for (x = 0; x < Constants.RegionSize; x++) 52 }
53 { 53
54 int y; 54 public TerrainChannel(String type)
55 for (y = 0; y < Constants.RegionSize; y++) 55 {
56 { 56 map = new double[Constants.RegionSize, Constants.RegionSize];
57 map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10; 57 taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16];
58 double spherFacA = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 50) * 0.01; 58
59 double spherFacB = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 100) * 0.001; 59 if (type.Equals("flat"))
60 if (map[x, y] < spherFacA) 60 FlatLand();
61 map[x, y] = spherFacA; 61 else
62 if (map[x, y] < spherFacB) 62 PinHeadIsland();
63 map[x, y] = spherFacB;
64 }
65 }
66 } 63 }
67 64
68 public TerrainChannel(double[,] import) 65 public TerrainChannel(double[,] import)
@@ -238,5 +235,36 @@ namespace OpenSim.Region.Framework.Scenes
238 } 235 }
239 } 236 }
240 } 237 }
238
239 private void PinHeadIsland()
240 {
241 int x;
242 for (x = 0; x < Constants.RegionSize; x++)
243 {
244 int y;
245 for (y = 0; y < Constants.RegionSize; y++)
246 {
247 map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10;
248 double spherFacA = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 50) * 0.01;
249 double spherFacB = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 100) * 0.001;
250 if (map[x, y] < spherFacA)
251 map[x, y] = spherFacA;
252 if (map[x, y] < spherFacB)
253 map[x, y] = spherFacB;
254 }
255 }
256 }
257
258 private void FlatLand()
259 {
260 int x;
261 for (x = 0; x < Constants.RegionSize; x++)
262 {
263 int y;
264 for (y = 0; y < Constants.RegionSize; y++)
265 map[x, y] = 21;
266 }
267 }
268
241 } 269 }
242} 270}