diff options
author | Justin Clark-Casey (justincc) | 2010-03-12 17:58:25 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-03-12 17:58:25 +0000 |
commit | db61d66e746df4b1919b031de72bee7cf3a796f3 (patch) | |
tree | 770a8101a52222f87f298de79fabbd4aad176333 /OpenSim/Region/CoreModules/World/Land | |
parent | minor: add some more documentation for IHttpServer.AddHTTPHandler() to tell t... (diff) | |
parent | Changed some properties and methods from private to protected in LLLoginRespo... (diff) | |
download | opensim-SC_OLD-db61d66e746df4b1919b031de72bee7cf3a796f3.zip opensim-SC_OLD-db61d66e746df4b1919b031de72bee7cf3a796f3.tar.gz opensim-SC_OLD-db61d66e746df4b1919b031de72bee7cf3a796f3.tar.bz2 opensim-SC_OLD-db61d66e746df4b1919b031de72bee7cf3a796f3.tar.xz |
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 93 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandObject.cs | 9 |
2 files changed, 92 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index f0c87f4..1279ac1 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Diagnostics; | ||
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using log4net; | 33 | using log4net; |
33 | using Nini.Config; | 34 | using Nini.Config; |
@@ -84,6 +85,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
84 | 85 | ||
85 | // caches ExtendedLandData | 86 | // caches ExtendedLandData |
86 | private Cache parcelInfoCache; | 87 | private Cache parcelInfoCache; |
88 | private Vector3? forcedPosition = null; | ||
87 | 89 | ||
88 | #region INonSharedRegionModule Members | 90 | #region INonSharedRegionModule Members |
89 | 91 | ||
@@ -136,6 +138,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
136 | { | 138 | { |
137 | } | 139 | } |
138 | 140 | ||
141 | private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) | ||
142 | { | ||
143 | ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y); | ||
144 | reason = "You are not allowed to enter this sim."; | ||
145 | return nearestParcel != null; | ||
146 | } | ||
147 | |||
139 | void EventManagerOnNewClient(IClientAPI client) | 148 | void EventManagerOnNewClient(IClientAPI client) |
140 | { | 149 | { |
141 | //Register some client events | 150 | //Register some client events |
@@ -153,6 +162,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
153 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; | 162 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; |
154 | client.OnParcelDwellRequest += ClientOnParcelDwellRequest; | 163 | client.OnParcelDwellRequest += ClientOnParcelDwellRequest; |
155 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; | 164 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; |
165 | client.OnPreAgentUpdate += ClientOnPreAgentUpdate; | ||
156 | 166 | ||
157 | EntityBase presenceEntity; | 167 | EntityBase presenceEntity; |
158 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) | 168 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) |
@@ -162,6 +172,40 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
162 | } | 172 | } |
163 | } | 173 | } |
164 | 174 | ||
175 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | ||
176 | { | ||
177 | //If we are forcing a position for them to go | ||
178 | if (forcedPosition != null) | ||
179 | { | ||
180 | ScenePresence clientAvatar = m_scene.GetScenePresence(remoteClient.AgentId); | ||
181 | |||
182 | //Putting the user into flying, both keeps the avatar in fligth when it bumps into something and stopped from going another direction AND | ||
183 | //When the avatar walks into a ban line on the ground, it prevents getting stuck | ||
184 | agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
185 | |||
186 | |||
187 | //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines | ||
188 | if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) < .2) | ||
189 | { | ||
190 | Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); | ||
191 | forcedPosition = null; | ||
192 | } | ||
193 | //if we are far away, teleport | ||
194 | else if (Vector3.Distance(clientAvatar.AbsolutePosition,forcedPosition.Value) > 3) | ||
195 | { | ||
196 | Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}",forcedPosition.Value,clientAvatar.AbsolutePosition)); | ||
197 | clientAvatar.Teleport(forcedPosition.Value); | ||
198 | forcedPosition = null; | ||
199 | } | ||
200 | else | ||
201 | { | ||
202 | //Forces them toward the forced position we want if they aren't there yet | ||
203 | agentData.UseClientAgentPosition = true; | ||
204 | agentData.ClientAgentPosition = forcedPosition.Value; | ||
205 | } | ||
206 | } | ||
207 | } | ||
208 | |||
165 | 209 | ||
166 | public void PostInitialise() | 210 | public void PostInitialise() |
167 | { | 211 | { |
@@ -267,9 +311,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
267 | { | 311 | { |
268 | avatar.ControllingClient.SendAlertMessage( | 312 | avatar.ControllingClient.SendAlertMessage( |
269 | "You are not allowed on this parcel because you are banned. Please go away."); | 313 | "You are not allowed on this parcel because you are banned. Please go away."); |
270 | |||
271 | avatar.PhysicsActor.Position = avatar.lastKnownAllowedPosition; | ||
272 | avatar.PhysicsActor.Velocity = Vector3.Zero; | ||
273 | } | 314 | } |
274 | else | 315 | else |
275 | { | 316 | { |
@@ -278,6 +319,24 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
278 | } | 319 | } |
279 | } | 320 | } |
280 | 321 | ||
322 | |||
323 | |||
324 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) | ||
325 | { | ||
326 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; | ||
327 | if (position.HasValue) | ||
328 | { | ||
329 | forcedPosition = position; | ||
330 | } | ||
331 | } | ||
332 | |||
333 | public void SendYouAreRestrictedNotice(ScenePresence avatar) | ||
334 | { | ||
335 | avatar.ControllingClient.SendAlertMessage( | ||
336 | "You are not allowed on this parcel because the land owner has restricted access."); | ||
337 | |||
338 | } | ||
339 | |||
281 | public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) | 340 | public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) |
282 | { | 341 | { |
283 | if (m_scene.RegionInfo.RegionID == regionID) | 342 | if (m_scene.RegionInfo.RegionID == regionID) |
@@ -295,11 +354,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
295 | if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) | 354 | if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) |
296 | { | 355 | { |
297 | SendYouAreBannedNotice(avatar); | 356 | SendYouAreBannedNotice(avatar); |
357 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | ||
298 | } | 358 | } |
299 | else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID)) | 359 | else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID)) |
300 | { | 360 | { |
301 | avatar.ControllingClient.SendAlertMessage( | 361 | SendYouAreRestrictedNotice(avatar); |
302 | "You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!)."); | 362 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); |
303 | } | 363 | } |
304 | else | 364 | else |
305 | { | 365 | { |
@@ -400,7 +460,26 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
400 | else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && | 460 | else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && |
401 | parcel.IsBannedFromLand(clientAvatar.UUID)) | 461 | parcel.IsBannedFromLand(clientAvatar.UUID)) |
402 | { | 462 | { |
403 | SendYouAreBannedNotice(clientAvatar); | 463 | //once we've sent the message once, keep going toward the target until we are done |
464 | if (forcedPosition == null) | ||
465 | { | ||
466 | SendYouAreBannedNotice(clientAvatar); | ||
467 | ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar)); | ||
468 | } | ||
469 | } | ||
470 | else if (parcel.IsRestrictedFromLand(clientAvatar.UUID)) | ||
471 | { | ||
472 | //once we've sent the message once, keep going toward the target until we are done | ||
473 | if (forcedPosition == null) | ||
474 | { | ||
475 | SendYouAreRestrictedNotice(clientAvatar); | ||
476 | ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar)); | ||
477 | } | ||
478 | } | ||
479 | else | ||
480 | { | ||
481 | //when we are finally in a safe place, lets release the forced position lock | ||
482 | forcedPosition = null; | ||
404 | } | 483 | } |
405 | } | 484 | } |
406 | } | 485 | } |
@@ -412,7 +491,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
412 | ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 491 | ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); |
413 | if (over != null) | 492 | if (over != null) |
414 | { | 493 | { |
415 | if (!over.IsBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= LandChannel.BAN_LINE_SAFETY_HIEGHT) | 494 | if (!over.IsRestrictedFromLand(avatar.UUID) && (!over.IsBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= LandChannel.BAN_LINE_SAFETY_HIEGHT)) |
416 | { | 495 | { |
417 | avatar.lastKnownAllowedPosition = | 496 | avatar.lastKnownAllowedPosition = |
418 | new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); | 497 | new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 1fa8630..e85136a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
104 | /// <returns>Returns true if the piece of land contains the specified point</returns> | 104 | /// <returns>Returns true if the piece of land contains the specified point</returns> |
105 | public bool ContainsPoint(int x, int y) | 105 | public bool ContainsPoint(int x, int y) |
106 | { | 106 | { |
107 | if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize) | 107 | if (x >= 0 && y >= 0 && x <= Constants.RegionSize && y <= Constants.RegionSize) |
108 | { | 108 | { |
109 | return (LandBitmap[x / 4, y / 4] == true); | 109 | return (LandBitmap[x / 4, y / 4] == true); |
110 | } | 110 | } |
@@ -286,7 +286,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
286 | entry.AgentID = avatar; | 286 | entry.AgentID = avatar; |
287 | entry.Flags = AccessList.Ban; | 287 | entry.Flags = AccessList.Ban; |
288 | entry.Time = new DateTime(); | 288 | entry.Time = new DateTime(); |
289 | if (LandData.ParcelAccessList.Contains(entry)) | 289 | //See if they are on the list, but make sure the owner isn't banned |
290 | if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) | ||
290 | { | 291 | { |
291 | //They are banned, so lets send them a notice about this parcel | 292 | //They are banned, so lets send them a notice about this parcel |
292 | return true; | 293 | return true; |
@@ -303,7 +304,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
303 | entry.AgentID = avatar; | 304 | entry.AgentID = avatar; |
304 | entry.Flags = AccessList.Access; | 305 | entry.Flags = AccessList.Access; |
305 | entry.Time = new DateTime(); | 306 | entry.Time = new DateTime(); |
306 | if (!LandData.ParcelAccessList.Contains(entry)) | 307 | |
308 | //If they are not on the access list and are not the owner | ||
309 | if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) | ||
307 | { | 310 | { |
308 | //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel | 311 | //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel |
309 | return true; | 312 | return true; |