aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
authorDiva Canto2009-08-15 08:21:15 -0700
committerDiva Canto2009-08-15 08:21:15 -0700
commitdd8b9d581088ab08ccb71ef76bf0e32dae2a79b5 (patch)
tree24bdf22346c997460c3a437b9827e0a43acb6b4a /OpenSim/Region/Framework/Scenes/Scene.cs
parentMerge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff)
parent* whoops, missing a / (diff)
downloadopensim-SC_OLD-dd8b9d581088ab08ccb71ef76bf0e32dae2a79b5.zip
opensim-SC_OLD-dd8b9d581088ab08ccb71ef76bf0e32dae2a79b5.tar.gz
opensim-SC_OLD-dd8b9d581088ab08ccb71ef76bf0e32dae2a79b5.tar.bz2
opensim-SC_OLD-dd8b9d581088ab08ccb71ef76bf0e32dae2a79b5.tar.xz
Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs172
1 files changed, 167 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0c99166..107a4a4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1038,6 +1038,10 @@ namespace OpenSim.Region.Framework.Scenes
1038 } 1038 }
1039 } 1039 }
1040 1040
1041 /// <summary>
1042 /// Send out simstats data to all clients
1043 /// </summary>
1044 /// <param name="stats">Stats on the Simulator's performance</param>
1041 private void SendSimStatsPackets(SimStats stats) 1045 private void SendSimStatsPackets(SimStats stats)
1042 { 1046 {
1043 List<ScenePresence> StatSendAgents = GetScenePresences(); 1047 List<ScenePresence> StatSendAgents = GetScenePresences();
@@ -1050,6 +1054,9 @@ namespace OpenSim.Region.Framework.Scenes
1050 } 1054 }
1051 } 1055 }
1052 1056
1057 /// <summary>
1058 /// Recount SceneObjectPart in parcel aabb
1059 /// </summary>
1053 private void UpdateLand() 1060 private void UpdateLand()
1054 { 1061 {
1055 if (LandChannel != null) 1062 if (LandChannel != null)
@@ -1061,11 +1068,17 @@ namespace OpenSim.Region.Framework.Scenes
1061 } 1068 }
1062 } 1069 }
1063 1070
1071 /// <summary>
1072 /// Update the terrain if it needs to be updated.
1073 /// </summary>
1064 private void UpdateTerrain() 1074 private void UpdateTerrain()
1065 { 1075 {
1066 EventManager.TriggerTerrainTick(); 1076 EventManager.TriggerTerrainTick();
1067 } 1077 }
1068 1078
1079 /// <summary>
1080 /// Back up queued up changes
1081 /// </summary>
1069 private void UpdateStorageBackup() 1082 private void UpdateStorageBackup()
1070 { 1083 {
1071 if (!m_backingup) 1084 if (!m_backingup)
@@ -1078,6 +1091,9 @@ namespace OpenSim.Region.Framework.Scenes
1078 } 1091 }
1079 } 1092 }
1080 1093
1094 /// <summary>
1095 /// Sends out the OnFrame event to the modules
1096 /// </summary>
1081 private void UpdateEvents() 1097 private void UpdateEvents()
1082 { 1098 {
1083 m_eventManager.TriggerOnFrame(); 1099 m_eventManager.TriggerOnFrame();
@@ -1133,6 +1149,10 @@ namespace OpenSim.Region.Framework.Scenes
1133 } 1149 }
1134 } 1150 }
1135 1151
1152 /// <summary>
1153 /// Synchronous force backup. For deletes and links/unlinks
1154 /// </summary>
1155 /// <param name="group">Object to be backed up</param>
1136 public void ForceSceneObjectBackup(SceneObjectGroup group) 1156 public void ForceSceneObjectBackup(SceneObjectGroup group)
1137 { 1157 {
1138 if (group != null) 1158 if (group != null)
@@ -1141,6 +1161,13 @@ namespace OpenSim.Region.Framework.Scenes
1141 } 1161 }
1142 } 1162 }
1143 1163
1164 /// <summary>
1165 /// Return object to avatar Message
1166 /// </summary>
1167 /// <param name="agentID">Avatar Unique Id</param>
1168 /// <param name="objectName">Name of object returned</param>
1169 /// <param name="location">Location of object returned</param>
1170 /// <param name="reason">Reasion for object return</param>
1144 public void AddReturn(UUID agentID, string objectName, Vector3 location, string reason) 1171 public void AddReturn(UUID agentID, string objectName, Vector3 location, string reason)
1145 { 1172 {
1146 lock (m_returns) 1173 lock (m_returns)
@@ -1167,6 +1194,9 @@ namespace OpenSim.Region.Framework.Scenes
1167 1194
1168 #region Load Terrain 1195 #region Load Terrain
1169 1196
1197 /// <summary>
1198 /// Store the terrain in the persistant data store
1199 /// </summary>
1170 public void SaveTerrain() 1200 public void SaveTerrain()
1171 { 1201 {
1172 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); 1202 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
@@ -1269,6 +1299,10 @@ namespace OpenSim.Region.Framework.Scenes
1269 1299
1270 #region Load Land 1300 #region Load Land
1271 1301
1302 /// <summary>
1303 /// Loads all Parcel data from the datastore for region identified by regionID
1304 /// </summary>
1305 /// <param name="regionID">Unique Identifier of the Region to load parcel data for</param>
1272 public void loadAllLandObjectsFromStorage(UUID regionID) 1306 public void loadAllLandObjectsFromStorage(UUID regionID)
1273 { 1307 {
1274 m_log.Info("[SCENE]: Loading land objects from storage"); 1308 m_log.Info("[SCENE]: Loading land objects from storage");
@@ -1322,6 +1356,20 @@ namespace OpenSim.Region.Framework.Scenes
1322 m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); 1356 m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
1323 } 1357 }
1324 1358
1359
1360 /// <summary>
1361 /// Gets a new rez location based on the raycast and the size of the object that is being rezzed.
1362 /// </summary>
1363 /// <param name="RayStart"></param>
1364 /// <param name="RayEnd"></param>
1365 /// <param name="RayTargetID"></param>
1366 /// <param name="rot"></param>
1367 /// <param name="bypassRayCast"></param>
1368 /// <param name="RayEndIsIntersection"></param>
1369 /// <param name="frontFacesOnly"></param>
1370 /// <param name="scale"></param>
1371 /// <param name="FaceCenter"></param>
1372 /// <returns></returns>
1325 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) 1373 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter)
1326 { 1374 {
1327 Vector3 pos = Vector3.Zero; 1375 Vector3 pos = Vector3.Zero;
@@ -1412,6 +1460,19 @@ namespace OpenSim.Region.Framework.Scenes
1412 } 1460 }
1413 } 1461 }
1414 1462
1463
1464 /// <summary>
1465 /// Create a New SceneObjectGroup/Part by raycasting
1466 /// </summary>
1467 /// <param name="ownerID"></param>
1468 /// <param name="groupID"></param>
1469 /// <param name="RayEnd"></param>
1470 /// <param name="rot"></param>
1471 /// <param name="shape"></param>
1472 /// <param name="bypassRaycast"></param>
1473 /// <param name="RayStart"></param>
1474 /// <param name="RayTargetID"></param>
1475 /// <param name="RayEndIsIntersection"></param>
1415 public virtual void AddNewPrim(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape, 1476 public virtual void AddNewPrim(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape,
1416 byte bypassRaycast, Vector3 RayStart, UUID RayTargetID, 1477 byte bypassRaycast, Vector3 RayStart, UUID RayTargetID,
1417 byte RayEndIsIntersection) 1478 byte RayEndIsIntersection)
@@ -1829,6 +1890,12 @@ namespace OpenSim.Region.Framework.Scenes
1829 return true; 1890 return true;
1830 } 1891 }
1831 1892
1893 /// <summary>
1894 /// Attachment rezzing
1895 /// </summary>
1896 /// <param name="userID">Agent Unique ID</param>
1897 /// <param name="itemID">Object ID</param>
1898 /// <returns>False</returns>
1832 public virtual bool IncomingCreateObject(UUID userID, UUID itemID) 1899 public virtual bool IncomingCreateObject(UUID userID, UUID itemID)
1833 { 1900 {
1834 ScenePresence sp = GetScenePresence(userID); 1901 ScenePresence sp = GetScenePresence(userID);
@@ -1841,6 +1908,13 @@ namespace OpenSim.Region.Framework.Scenes
1841 return false; 1908 return false;
1842 } 1909 }
1843 1910
1911 /// <summary>
1912 /// Adds a Scene Object group to the Scene.
1913 /// Verifies that the creator of the object is not banned from the simulator.
1914 /// Checks if the item is an Attachment
1915 /// </summary>
1916 /// <param name="sceneObject"></param>
1917 /// <returns>True if the SceneObjectGroup was added, False if it was not</returns>
1844 public bool AddSceneObject(SceneObjectGroup sceneObject) 1918 public bool AddSceneObject(SceneObjectGroup sceneObject)
1845 { 1919 {
1846 // If the user is banned, we won't let any of their objects 1920 // If the user is banned, we won't let any of their objects
@@ -1933,6 +2007,10 @@ namespace OpenSim.Region.Framework.Scenes
1933 2007
1934 #region Add/Remove Avatar Methods 2008 #region Add/Remove Avatar Methods
1935 2009
2010 /// <summary>
2011 /// Adding a New Client and Create a Presence for it.
2012 /// </summary>
2013 /// <param name="client"></param>
1936 public override void AddNewClient(IClientAPI client) 2014 public override void AddNewClient(IClientAPI client)
1937 { 2015 {
1938 SubscribeToClientEvents(client); 2016 SubscribeToClientEvents(client);
@@ -1977,6 +2055,10 @@ namespace OpenSim.Region.Framework.Scenes
1977 EventManager.TriggerOnNewClient(client); 2055 EventManager.TriggerOnNewClient(client);
1978 } 2056 }
1979 2057
2058 /// <summary>
2059 /// Register for events from the client
2060 /// </summary>
2061 /// <param name="client">The IClientAPI of the connected client</param>
1980 protected virtual void SubscribeToClientEvents(IClientAPI client) 2062 protected virtual void SubscribeToClientEvents(IClientAPI client)
1981 { 2063 {
1982 client.OnRegionHandShakeReply += SendLayerData; 2064 client.OnRegionHandShakeReply += SendLayerData;
@@ -2070,8 +2152,8 @@ namespace OpenSim.Region.Framework.Scenes
2070 /// <summary> 2152 /// <summary>
2071 /// Teleport an avatar to their home region 2153 /// Teleport an avatar to their home region
2072 /// </summary> 2154 /// </summary>
2073 /// <param name="agentId"></param> 2155 /// <param name="agentId">The avatar's Unique ID</param>
2074 /// <param name="client"></param> 2156 /// <param name="client">The IClientAPI for the client</param>
2075 public virtual void TeleportClientHome(UUID agentId, IClientAPI client) 2157 public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
2076 { 2158 {
2077 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); 2159 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId);
@@ -2099,6 +2181,21 @@ namespace OpenSim.Region.Framework.Scenes
2099 } 2181 }
2100 } 2182 }
2101 2183
2184 /// <summary>
2185 /// Duplicates object specified by localID at position raycasted against RayTargetObject using
2186 /// RayEnd and RayStart to determine what the angle of the ray is
2187 /// </summary>
2188 /// <param name="localID">ID of object to duplicate</param>
2189 /// <param name="dupeFlags"></param>
2190 /// <param name="AgentID">Agent doing the duplication</param>
2191 /// <param name="GroupID">Group of new object</param>
2192 /// <param name="RayTargetObj">The target of the Ray</param>
2193 /// <param name="RayEnd">The ending of the ray (farthest away point)</param>
2194 /// <param name="RayStart">The Beginning of the ray (closest point)</param>
2195 /// <param name="BypassRaycast">Bool to bypass raycasting</param>
2196 /// <param name="RayEndIsIntersection">The End specified is the place to add the object</param>
2197 /// <param name="CopyCenters">Position the object at the center of the face that it's colliding with</param>
2198 /// <param name="CopyRotates">Rotate the object the same as the localID object</param>
2102 public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID, 2199 public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID,
2103 UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart, 2200 UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart,
2104 bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates) 2201 bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates)
@@ -2170,6 +2267,14 @@ namespace OpenSim.Region.Framework.Scenes
2170 } 2267 }
2171 } 2268 }
2172 2269
2270 /// <summary>
2271 /// Sets the Home Point. The GridService uses this to know where to put a user when they log-in
2272 /// </summary>
2273 /// <param name="remoteClient"></param>
2274 /// <param name="regionHandle"></param>
2275 /// <param name="position"></param>
2276 /// <param name="lookAt"></param>
2277 /// <param name="flags"></param>
2173 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 2278 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
2174 { 2279 {
2175 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); 2280 UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId);
@@ -2340,6 +2445,12 @@ namespace OpenSim.Region.Framework.Scenes
2340 } 2445 }
2341 } 2446 }
2342 2447
2448 /// <summary>
2449 /// Removes region from an avatar's known region list. This coincides with child agents. For each child agent, there will be a known region entry.
2450 ///
2451 /// </summary>
2452 /// <param name="avatarID"></param>
2453 /// <param name="regionslst"></param>
2343 public void HandleRemoveKnownRegionsFromAvatar(UUID avatarID, List<ulong> regionslst) 2454 public void HandleRemoveKnownRegionsFromAvatar(UUID avatarID, List<ulong> regionslst)
2344 { 2455 {
2345 ScenePresence av = GetScenePresence(avatarID); 2456 ScenePresence av = GetScenePresence(avatarID);
@@ -2355,12 +2466,19 @@ namespace OpenSim.Region.Framework.Scenes
2355 } 2466 }
2356 } 2467 }
2357 2468
2469 /// <summary>
2470 /// Closes all endpoints with the circuitcode provided.
2471 /// </summary>
2472 /// <param name="circuitcode">Circuit Code of the endpoint to close</param>
2358 public override void CloseAllAgents(uint circuitcode) 2473 public override void CloseAllAgents(uint circuitcode)
2359 { 2474 {
2360 // Called by ClientView to kill all circuit codes 2475 // Called by ClientView to kill all circuit codes
2361 ClientManager.CloseAllAgents(circuitcode); 2476 ClientManager.CloseAllAgents(circuitcode);
2362 } 2477 }
2363 2478
2479 /// <summary>
2480 /// Inform all other ScenePresences on this Scene that someone else has changed position on the minimap.
2481 /// </summary>
2364 public void NotifyMyCoarseLocationChange() 2482 public void NotifyMyCoarseLocationChange()
2365 { 2483 {
2366 ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); 2484 ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
@@ -2455,9 +2573,10 @@ namespace OpenSim.Region.Framework.Scenes
2455 /// The return bool should allow for connections to be refused, but as not all calling paths 2573 /// The return bool should allow for connections to be refused, but as not all calling paths
2456 /// take proper notice of it let, we allowed banned users in still. 2574 /// take proper notice of it let, we allowed banned users in still.
2457 /// </summary> 2575 /// </summary>
2458 /// <param name="regionHandle"></param> 2576 /// <param name="agent">CircuitData of the agent who is connecting</param>
2459 /// <param name="agent"></param> 2577 /// <param name="reason">Outputs the reason for the false response on this string</param>
2460 /// <param name="reason"></param> 2578 /// <returns>True if the region accepts this agent. False if it does not. False will
2579 /// also return a reason.</returns>
2461 public bool NewUserConnection(AgentCircuitData agent, out string reason) 2580 public bool NewUserConnection(AgentCircuitData agent, out string reason)
2462 { 2581 {
2463 // Don't disable this log message - it's too helpful 2582 // Don't disable this log message - it's too helpful
@@ -2530,6 +2649,13 @@ namespace OpenSim.Region.Framework.Scenes
2530 return true; 2649 return true;
2531 } 2650 }
2532 2651
2652 /// <summary>
2653 /// Verifies that the user has a session on the Grid
2654 /// </summary>
2655 /// <param name="agent">Circuit Data of the Agent we're verifying</param>
2656 /// <param name="reason">Outputs the reason for the false response on this string</param>
2657 /// <returns>True if the user has a session on the grid. False if it does not. False will
2658 /// also return a reason.</returns>
2533 public virtual bool AuthenticateUser(AgentCircuitData agent, out string reason) 2659 public virtual bool AuthenticateUser(AgentCircuitData agent, out string reason)
2534 { 2660 {
2535 reason = String.Empty; 2661 reason = String.Empty;
@@ -2542,6 +2668,13 @@ namespace OpenSim.Region.Framework.Scenes
2542 return result; 2668 return result;
2543 } 2669 }
2544 2670
2671 /// <summary>
2672 /// Verify if the user can connect to this region. Checks the banlist and ensures that the region is set for public access
2673 /// </summary>
2674 /// <param name="agent">The circuit data for the agent</param>
2675 /// <param name="reason">outputs the reason to this string</param>
2676 /// <returns>True if the region accepts this agent. False if it does not. False will
2677 /// also return a reason.</returns>
2545 protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason) 2678 protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason)
2546 { 2679 {
2547 reason = String.Empty; 2680 reason = String.Empty;
@@ -2600,16 +2733,32 @@ namespace OpenSim.Region.Framework.Scenes
2600 return true; 2733 return true;
2601 } 2734 }
2602 2735
2736 /// <summary>
2737 /// Update an AgentCircuitData object with new information
2738 /// </summary>
2739 /// <param name="data">Information to update the AgentCircuitData with</param>
2603 public void UpdateCircuitData(AgentCircuitData data) 2740 public void UpdateCircuitData(AgentCircuitData data)
2604 { 2741 {
2605 m_authenticateHandler.UpdateAgentData(data); 2742 m_authenticateHandler.UpdateAgentData(data);
2606 } 2743 }
2607 2744
2745 /// <summary>
2746 /// Change the Circuit Code for the user's Circuit Data
2747 /// </summary>
2748 /// <param name="oldcc">The old Circuit Code. Must match a previous circuit code</param>
2749 /// <param name="newcc">The new Circuit Code. Must not be an already existing circuit code</param>
2750 /// <returns>True if we successfully changed it. False if we did not</returns>
2608 public bool ChangeCircuitCode(uint oldcc, uint newcc) 2751 public bool ChangeCircuitCode(uint oldcc, uint newcc)
2609 { 2752 {
2610 return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); 2753 return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc);
2611 } 2754 }
2612 2755
2756 /// <summary>
2757 /// The Grid has requested that we log-off a user. Log them off.
2758 /// </summary>
2759 /// <param name="AvatarID">Unique ID of the avatar to log-off</param>
2760 /// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param>
2761 /// <param name="message">message to display to the user. Reason for being logged off</param>
2613 public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) 2762 public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message)
2614 { 2763 {
2615 ScenePresence loggingOffUser = null; 2764 ScenePresence loggingOffUser = null;
@@ -2675,6 +2824,13 @@ namespace OpenSim.Region.Framework.Scenes
2675 } 2824 }
2676 } 2825 }
2677 2826
2827 /// <summary>
2828 /// We've got an update about an agent that sees into this region,
2829 /// send it to ScenePresence for processing It's the full data.
2830 /// </summary>
2831 /// <param name="cAgentData">Agent that contains all of the relevant things about an agent.
2832 /// Appearance, animations, position, etc.</param>
2833 /// <returns>true if we handled it.</returns>
2678 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) 2834 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
2679 { 2835 {
2680// m_log.DebugFormat( 2836// m_log.DebugFormat(
@@ -2692,6 +2848,12 @@ namespace OpenSim.Region.Framework.Scenes
2692 return false; 2848 return false;
2693 } 2849 }
2694 2850
2851 /// <summary>
2852 /// We've got an update about an agent that sees into this region,
2853 /// send it to ScenePresence for processing It's only positional data
2854 /// </summary>
2855 /// <param name="cAgentData">AgentPosition that contains agent positional data so we can know what to send</param>
2856 /// <returns>true if we handled it.</returns>
2695 public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData) 2857 public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData)
2696 { 2858 {
2697 //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); 2859 //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName);