public void handleAvatarChangingParcel(ScenePresence avatar, int localLandID, UUID regionID) { if (m_scene.RegionInfo.RegionID == regionID) { ILandObject parcelAvatarIsEntering; lock (m_landList) { parcelAvatarIsEntering = m_landList[localLandID]; } if (parcelAvatarIsEntering != null) { Vector3 pos = avatar.AbsolutePosition; if (pos.Z < LandChannel.BAN_LINE_SAFETY_HEIGHT) { ParcelPropertiesStatus reason; if (parcelAvatarIsEntering.DenyParcelAccess(avatar.UUID, out reason)) { EntityBase.PositionInfo avatarPos = avatar.GetPosInfo(); if (avatarPos.Parent == null) // not seated RemoveAvatarFromParcel(avatar); SendNoEntryNotice(avatar, reason); return; } } avatar.lastKnownAllowedPosition = pos; } } }
public void handleAvatarChangingParcel(ScenePresence avatar, int localLandID, UUID regionID) { if (m_scene.RegionInfo.RegionID == regionID) { ILandObject parcelAvatarIsEntering; lock (m_landList) { parcelAvatarIsEntering = m_landList[localLandID]; } if (parcelAvatarIsEntering != null) { Vector3 pos = avatar.AbsolutePosition; if (pos.Z < LandChannel.BAN_LINE_SAFETY_HEIGHT) { ParcelPropertiesStatus reason; if (parcelAvatarIsEntering.DenyParcelAccess(avatar.UUID, out reason)) { // Check if the avatar is seated and unsit before reposition/teleport in SendNoEntryNotice. EntityBase.PositionInfo posInfo = avatar.GetPosInfo(); if (posInfo.Parent != null) avatar.StandUp(null, false, true); SendNoEntryNotice(avatar, reason); } else { avatar.lastKnownAllowedPosition = new Vector3(pos); } } else { avatar.lastKnownAllowedPosition = new Vector3(pos); } } } }
public void RemoveAvatarFromParcel(ScenePresence avatar) { EntityBase.PositionInfo posInfo = avatar.GetPosInfo(); if (posInfo.Parent != null) { // can't find the prim seated on, stand up avatar.StandUp(null, false, true); // fall through to unseated avatar code. } // If they are moving, stop them. This updates the physics object as well. avatar.Velocity = Vector3.Zero; Vector3 pos = avatar.AbsolutePosition; // may have changed from posInfo by StandUp above. ParcelPropertiesStatus reason2; if (!avatar.lastKnownAllowedPosition.Equals(Vector3.Zero)) { pos = avatar.lastKnownAllowedPosition; } else { // Still a forbidden parcel, they must have been above the limit or entering region for the first time. // Let's put them up higher, over the restricted parcel. // We could add 50m to avatar.Scene.Heightmap[x,y] but then we need subscript checks, etc. // For now, this is simple and safer than TPing them home. pos.Z += 50.0f; } ILandObject parcel = landChannel.GetLandObject(pos.X, pos.Y); if ((parcel != null) && parcel.DenyParcelAccess(avatar.UUID, out reason2)) { float minZ = LandChannel.BAN_LINE_SAFETY_HEIGHT + AVATAR_BOUNCE; if (pos.Z < minZ) pos.Z = minZ; } // Now force the non-sitting avatar to a position above the parcel avatar.Teleport(pos); // this is really just a move }
// Bounce constants are how far above a no-entry parcel we'll place an object or avatar. public void RemoveAvatarFromParcel(ScenePresence avatar) { EntityBase.PositionInfo posInfo = avatar.GetPosInfo(); if (posInfo.Parent != null) { // can't find the prim seated on, stand up avatar.StandUp(false, true); // fall through to unseated avatar code. } // If they are moving, stop them. This updates the physics object as well. // The avatar needs to be stopped before entering the parcel otherwise there // are timing windows where the avatar can just pound away at the parcel border // and get across it due to physics placing them there. avatar.Velocity = Vector3.Zero; Vector3 pos = avatar.AbsolutePosition; // may have changed from posInfo by StandUp above. ParcelPropertiesStatus reason2; if (!avatar.lastKnownAllowedPosition.Equals(Vector3.Zero)) { pos = avatar.lastKnownAllowedPosition; } ILandObject parcel = landChannel.GetLandObject(pos.X, pos.Y); float minZ; if ((parcel != null) && m_scene.TestBelowHeightLimit(avatar.UUID, pos, parcel, out minZ, out reason2)) { float groundZ = (float)m_scene.Heightmap.CalculateHeightAt(pos.X, pos.Y); minZ += groundZ; // make them bounce above the banned parcel if being removed if (pos.Z < minZ) pos.Z = minZ + Constants.AVATAR_BOUNCE; } // Now force the non-sitting avatar to a position above the parcel avatar.Teleport(pos); // this is really just a move }