diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 172 |
1 files changed, 81 insertions, 91 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f86b3b6..eadec09 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -656,7 +656,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
656 | EventManager.OnLandObjectRemoved += | 656 | EventManager.OnLandObjectRemoved += |
657 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); | 657 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); |
658 | 658 | ||
659 | m_sceneGraph = new SceneGraph(this, m_regInfo); | 659 | m_sceneGraph = new SceneGraph(this); |
660 | 660 | ||
661 | // If the scene graph has an Unrecoverable error, restart this sim. | 661 | // If the scene graph has an Unrecoverable error, restart this sim. |
662 | // Currently the only thing that causes it to happen is two kinds of specific | 662 | // Currently the only thing that causes it to happen is two kinds of specific |
@@ -870,6 +870,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
870 | 870 | ||
871 | if (dm != null) | 871 | if (dm != null) |
872 | m_eventManager.OnPermissionError += dm.SendAlertToUser; | 872 | m_eventManager.OnPermissionError += dm.SendAlertToUser; |
873 | |||
874 | m_eventManager.OnSignificantClientMovement += HandleOnSignificantClientMovement; | ||
873 | } | 875 | } |
874 | 876 | ||
875 | public override string GetSimulatorVersion() | 877 | public override string GetSimulatorVersion() |
@@ -1170,87 +1172,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1170 | m_dialogModule = RequestModuleInterface<IDialogModule>(); | 1172 | m_dialogModule = RequestModuleInterface<IDialogModule>(); |
1171 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); | 1173 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); |
1172 | m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); | 1174 | m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); |
1173 | |||
1174 | // Shoving this in here for now, because we have the needed | ||
1175 | // interfaces at this point | ||
1176 | // | ||
1177 | // TODO: Find a better place for this | ||
1178 | // | ||
1179 | while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) | ||
1180 | { | ||
1181 | MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", m_regInfo.EstateSettings.EstateName); | ||
1182 | List<char> excluded = new List<char>(new char[1]{' '}); | ||
1183 | string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); | ||
1184 | string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); | ||
1185 | |||
1186 | UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); | ||
1187 | |||
1188 | if (account == null) | ||
1189 | { | ||
1190 | // Create a new account | ||
1191 | account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty); | ||
1192 | if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) | ||
1193 | { | ||
1194 | account.ServiceURLs = new Dictionary<string, object>(); | ||
1195 | account.ServiceURLs["HomeURI"] = string.Empty; | ||
1196 | account.ServiceURLs["GatekeeperURI"] = string.Empty; | ||
1197 | account.ServiceURLs["InventoryServerURI"] = string.Empty; | ||
1198 | account.ServiceURLs["AssetServerURI"] = string.Empty; | ||
1199 | } | ||
1200 | |||
1201 | if (UserAccountService.StoreUserAccount(account)) | ||
1202 | { | ||
1203 | string password = MainConsole.Instance.PasswdPrompt("Password"); | ||
1204 | string email = MainConsole.Instance.CmdPrompt("Email", ""); | ||
1205 | |||
1206 | account.Email = email; | ||
1207 | UserAccountService.StoreUserAccount(account); | ||
1208 | |||
1209 | bool success = false; | ||
1210 | success = AuthenticationService.SetPassword(account.PrincipalID, password); | ||
1211 | if (!success) | ||
1212 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.", | ||
1213 | first, last); | ||
1214 | |||
1215 | GridRegion home = null; | ||
1216 | if (GridService != null) | ||
1217 | { | ||
1218 | List<GridRegion> defaultRegions = GridService.GetDefaultRegions(UUID.Zero); | ||
1219 | if (defaultRegions != null && defaultRegions.Count >= 1) | ||
1220 | home = defaultRegions[0]; | ||
1221 | |||
1222 | if (GridUserService != null && home != null) | ||
1223 | GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | ||
1224 | else | ||
1225 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.", | ||
1226 | first, last); | ||
1227 | |||
1228 | } | ||
1229 | else | ||
1230 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.", | ||
1231 | first, last); | ||
1232 | |||
1233 | if (InventoryService != null) | ||
1234 | success = InventoryService.CreateUserInventory(account.PrincipalID); | ||
1235 | if (!success) | ||
1236 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.", | ||
1237 | first, last); | ||
1238 | |||
1239 | |||
1240 | m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last); | ||
1241 | |||
1242 | m_regInfo.EstateSettings.EstateOwner = account.PrincipalID; | ||
1243 | m_regInfo.EstateSettings.Save(); | ||
1244 | } | ||
1245 | else | ||
1246 | m_log.ErrorFormat("[SCENE]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first."); | ||
1247 | } | ||
1248 | else | ||
1249 | { | ||
1250 | m_regInfo.EstateSettings.EstateOwner = account.PrincipalID; | ||
1251 | m_regInfo.EstateSettings.Save(); | ||
1252 | } | ||
1253 | } | ||
1254 | } | 1175 | } |
1255 | 1176 | ||
1256 | #endregion | 1177 | #endregion |
@@ -1579,7 +1500,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1579 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1500 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1580 | msg.Position = Vector3.Zero; | 1501 | msg.Position = Vector3.Zero; |
1581 | msg.RegionID = RegionInfo.RegionID.Guid; | 1502 | msg.RegionID = RegionInfo.RegionID.Guid; |
1582 | msg.binaryBucket = new byte[0]; | 1503 | |
1504 | // We must fill in a null-terminated 'empty' string here since bytes[0] will crash viewer 3. | ||
1505 | msg.binaryBucket = Util.StringToBytes256("\0"); | ||
1583 | if (ret.Value.count > 1) | 1506 | if (ret.Value.count > 1) |
1584 | msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to {3}", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); | 1507 | msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to {3}", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); |
1585 | else | 1508 | else |
@@ -2459,14 +2382,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2459 | /// <returns>False</returns> | 2382 | /// <returns>False</returns> |
2460 | public virtual bool IncomingCreateObject(UUID userID, UUID itemID) | 2383 | public virtual bool IncomingCreateObject(UUID userID, UUID itemID) |
2461 | { | 2384 | { |
2462 | //m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID); | 2385 | m_log.DebugFormat(" >>> IncomingCreateObject(userID, itemID) <<< {0} {1}", userID, itemID); |
2463 | 2386 | ||
2464 | ScenePresence sp = GetScenePresence(userID); | 2387 | // Commented out since this is as yet unused and is arguably not the appropriate place to do this, as |
2465 | if (sp != null && AttachmentsModule != null) | 2388 | // attachments are being rezzed elsewhere in AddNewClient() |
2466 | { | 2389 | // ScenePresence sp = GetScenePresence(userID); |
2467 | uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); | 2390 | // if (sp != null && AttachmentsModule != null) |
2468 | AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt); | 2391 | // { |
2469 | } | 2392 | // uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); |
2393 | // AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt); | ||
2394 | // } | ||
2470 | 2395 | ||
2471 | return false; | 2396 | return false; |
2472 | } | 2397 | } |
@@ -5215,5 +5140,70 @@ namespace OpenSim.Region.Framework.Scenes | |||
5215 | reason = String.Empty; | 5140 | reason = String.Empty; |
5216 | return true; | 5141 | return true; |
5217 | } | 5142 | } |
5143 | |||
5144 | /// <summary> | ||
5145 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | ||
5146 | /// autopilot that moves an avatar to a sit target!. | ||
5147 | /// </summary> | ||
5148 | /// <remarks> | ||
5149 | /// This is not intended as a permament location for this method. | ||
5150 | /// </remarks> | ||
5151 | /// <param name="presence"></param> | ||
5152 | private void HandleOnSignificantClientMovement(ScenePresence presence) | ||
5153 | { | ||
5154 | if (presence.MovingToTarget) | ||
5155 | { | ||
5156 | double distanceToTarget = Util.GetDistanceTo(presence.AbsolutePosition, presence.MoveToPositionTarget); | ||
5157 | // m_log.DebugFormat( | ||
5158 | // "[SCENE]: Abs pos of {0} is {1}, target {2}, distance {3}", | ||
5159 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget); | ||
5160 | |||
5161 | // Check the error term of the current position in relation to the target position | ||
5162 | if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT) | ||
5163 | { | ||
5164 | // We are close enough to the target | ||
5165 | // m_log.DebugFormat("[SCENEE]: Stopping autopilot of {0}", presence.Name); | ||
5166 | |||
5167 | presence.Velocity = Vector3.Zero; | ||
5168 | presence.AbsolutePosition = presence.MoveToPositionTarget; | ||
5169 | presence.ResetMoveToTarget(); | ||
5170 | |||
5171 | if (presence.PhysicsActor.Flying) | ||
5172 | { | ||
5173 | // A horrible hack to stop the avatar dead in its tracks rather than having them overshoot | ||
5174 | // the target if flying. | ||
5175 | // We really need to be more subtle (slow the avatar as it approaches the target) or at | ||
5176 | // least be able to set collision status once, rather than 5 times to give it enough | ||
5177 | // weighting so that that PhysicsActor thinks it really is colliding. | ||
5178 | for (int i = 0; i < 5; i++) | ||
5179 | presence.PhysicsActor.IsColliding = true; | ||
5180 | |||
5181 | if (presence.LandAtTarget) | ||
5182 | presence.PhysicsActor.Flying = false; | ||
5183 | |||
5184 | // Vector3 targetPos = presence.MoveToPositionTarget; | ||
5185 | // float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; | ||
5186 | // if (targetPos.Z - terrainHeight < 0.2) | ||
5187 | // { | ||
5188 | // presence.PhysicsActor.Flying = false; | ||
5189 | // } | ||
5190 | } | ||
5191 | |||
5192 | // m_log.DebugFormat( | ||
5193 | // "[SCENE]: AgentControlFlags {0}, MovementFlag {1} for {2}", | ||
5194 | // presence.AgentControlFlags, presence.MovementFlag, presence.Name); | ||
5195 | } | ||
5196 | else | ||
5197 | { | ||
5198 | // m_log.DebugFormat( | ||
5199 | // "[SCENE]: Updating npc {0} at {1} for next movement to {2}", | ||
5200 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); | ||
5201 | |||
5202 | Vector3 agent_control_v3 = new Vector3(); | ||
5203 | presence.HandleMoveToTargetUpdate(ref agent_control_v3); | ||
5204 | presence.AddNewMovement(agent_control_v3); | ||
5205 | } | ||
5206 | } | ||
5207 | } | ||
5218 | } | 5208 | } |
5219 | } | 5209 | } |