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/Framework | |
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/Framework')
8 files changed, 302 insertions, 37 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 367ff3d..6cf2a2e 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -31,7 +31,7 @@ using OpenSim.Framework; | |||
31 | using OpenSim.Region.Framework.Scenes; | 31 | using OpenSim.Region.Framework.Scenes; |
32 | 32 | ||
33 | namespace OpenSim.Region.Framework.Interfaces | 33 | namespace OpenSim.Region.Framework.Interfaces |
34 | { | 34 | { |
35 | public interface IAttachmentsModule | 35 | public interface IAttachmentsModule |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
@@ -43,7 +43,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
43 | /// <param name="rot"></param> | 43 | /// <param name="rot"></param> |
44 | /// <param name="pos"></param> | 44 | /// <param name="pos"></param> |
45 | /// <param name="silent"></param> | 45 | /// <param name="silent"></param> |
46 | /// <returns>true if the object was successfully attached, false otherwise</returns> | 46 | /// <returns>true if the object was successfully attached, false otherwise</returns> |
47 | bool AttachObject( | 47 | bool AttachObject( |
48 | IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent); | 48 | IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent); |
49 | 49 | ||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
54 | /// <param name="remoteClient"></param> | 54 | /// <param name="remoteClient"></param> |
55 | /// <param name="itemID"></param> | 55 | /// <param name="itemID"></param> |
56 | /// <param name="AttachmentPt"></param> | 56 | /// <param name="AttachmentPt"></param> |
57 | /// <returns></returns> | 57 | /// <returns></returns> |
58 | UUID SetAttachmentInventoryStatus( | 58 | UUID SetAttachmentInventoryStatus( |
59 | SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt); | 59 | SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt); |
60 | 60 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs index 2401402..8185258 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs | |||
@@ -1,4 +1,31 @@ | |||
1 | using System; | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
2 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
3 | 30 | ||
4 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index f0d346f..dc9ae19 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -113,15 +113,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
113 | /// Fired when an object is touched/grabbed. | 113 | /// Fired when an object is touched/grabbed. |
114 | /// </summary> | 114 | /// </summary> |
115 | /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of | 115 | /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of |
116 | /// the root part. | 116 | /// the root part. |
117 | public event ObjectGrabDelegate OnObjectGrab; | 117 | public event ObjectGrabDelegate OnObjectGrab; |
118 | public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); | 118 | public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); |
119 | 119 | ||
120 | public event ObjectGrabDelegate OnObjectGrabbing; | 120 | public event ObjectGrabDelegate OnObjectGrabbing; |
121 | public event ObjectDeGrabDelegate OnObjectDeGrab; | 121 | public event ObjectDeGrabDelegate OnObjectDeGrab; |
122 | public event ScriptResetDelegate OnScriptReset; | 122 | public event ScriptResetDelegate OnScriptReset; |
123 | 123 | ||
124 | public event OnPermissionErrorDelegate OnPermissionError; | 124 | public event OnPermissionErrorDelegate OnPermissionError; |
125 | 125 | ||
126 | /// <summary> | 126 | /// <summary> |
127 | /// Fired when a new script is created. | 127 | /// Fired when a new script is created. |
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
169 | 169 | ||
170 | public delegate void ClientClosed(UUID clientID, Scene scene); | 170 | public delegate void ClientClosed(UUID clientID, Scene scene); |
171 | 171 | ||
172 | public event ClientClosed OnClientClosed; | 172 | public event ClientClosed OnClientClosed; |
173 | 173 | ||
174 | /// <summary> | 174 | /// <summary> |
175 | /// This is fired when a scene object property that a script might be interested in (such as color, scale or | 175 | /// This is fired when a scene object property that a script might be interested in (such as color, scale or |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index dad0efd..7277527 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1102,18 +1102,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1102 | if (folder == null) | 1102 | if (folder == null) |
1103 | return; | 1103 | return; |
1104 | 1104 | ||
1105 | m_log.DebugFormat("[AGENT INVENTORY]: Send Inventory Folder {0} Update to {1} {2}", folder.Name, client.FirstName, client.LastName); | 1105 | // Fetch the folder contents |
1106 | InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID); | 1106 | InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID); |
1107 | InventoryFolderBase containingFolder = new InventoryFolderBase(); | 1107 | |
1108 | containingFolder.ID = folder.ID; | 1108 | // Fetch the folder itself to get its current version |
1109 | containingFolder.Owner = client.AgentId; | 1109 | InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId); |
1110 | containingFolder = InventoryService.GetFolder(containingFolder); | 1110 | containingFolder = InventoryService.GetFolder(containingFolder); |
1111 | if (containingFolder != null) | ||
1112 | { | ||
1113 | int version = containingFolder.Version; | ||
1114 | 1111 | ||
1115 | client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, version, fetchFolders, fetchItems); | 1112 | //m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}", |
1116 | } | 1113 | // contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); |
1114 | |||
1115 | if (containingFolder != null) | ||
1116 | client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems); | ||
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | /// <summary> | 1119 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1eb3117..87a753e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Diagnostics; | ||
30 | using System.Drawing; | 31 | using System.Drawing; |
31 | using System.Drawing.Imaging; | 32 | using System.Drawing.Imaging; |
32 | using System.IO; | 33 | using System.IO; |
@@ -1975,7 +1976,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1975 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 1976 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
1976 | { | 1977 | { |
1977 | return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); | 1978 | return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); |
1978 | } | 1979 | } |
1979 | 1980 | ||
1980 | /// <summary> | 1981 | /// <summary> |
1981 | /// Delete every object from the scene | 1982 | /// Delete every object from the scene |
@@ -2643,7 +2644,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2643 | public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) | 2644 | public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) |
2644 | { | 2645 | { |
2645 | client.OnRezSingleAttachmentFromInv += RezSingleAttachment; | 2646 | client.OnRezSingleAttachmentFromInv += RezSingleAttachment; |
2646 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; | 2647 | client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; |
2647 | client.OnObjectAttach += m_sceneGraph.AttachObject; | 2648 | client.OnObjectAttach += m_sceneGraph.AttachObject; |
2648 | client.OnObjectDetach += m_sceneGraph.DetachObject; | 2649 | client.OnObjectDetach += m_sceneGraph.DetachObject; |
2649 | 2650 | ||
@@ -2695,7 +2696,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2695 | } | 2696 | } |
2696 | 2697 | ||
2697 | protected virtual void UnsubscribeToClientEvents(IClientAPI client) | 2698 | protected virtual void UnsubscribeToClientEvents(IClientAPI client) |
2698 | { | 2699 | { |
2699 | } | 2700 | } |
2700 | 2701 | ||
2701 | /// <summary> | 2702 | /// <summary> |
@@ -2796,13 +2797,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2796 | } | 2797 | } |
2797 | 2798 | ||
2798 | public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) | 2799 | public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) |
2799 | { | 2800 | { |
2800 | client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; | 2801 | client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; |
2801 | client.OnRezSingleAttachmentFromInv -= RezSingleAttachment; | 2802 | client.OnRezSingleAttachmentFromInv -= RezSingleAttachment; |
2802 | client.OnObjectAttach -= m_sceneGraph.AttachObject; | 2803 | client.OnObjectAttach -= m_sceneGraph.AttachObject; |
2803 | client.OnObjectDetach -= m_sceneGraph.DetachObject; | 2804 | client.OnObjectDetach -= m_sceneGraph.DetachObject; |
2804 | 2805 | ||
2805 | if (AttachmentsModule != null) | 2806 | if (AttachmentsModule != null) |
2806 | client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory; | 2807 | client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory; |
2807 | } | 2808 | } |
2808 | 2809 | ||
@@ -3224,6 +3225,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3224 | /// also return a reason.</returns> | 3225 | /// also return a reason.</returns> |
3225 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) | 3226 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) |
3226 | { | 3227 | { |
3228 | TeleportFlags tp = (TeleportFlags)teleportFlags; | ||
3227 | //Teleport flags: | 3229 | //Teleport flags: |
3228 | // | 3230 | // |
3229 | // TeleportFlags.ViaGodlikeLure - Border Crossing | 3231 | // TeleportFlags.ViaGodlikeLure - Border Crossing |
@@ -3257,6 +3259,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3257 | 3259 | ||
3258 | CapsModule.NewUserConnection(agent); | 3260 | CapsModule.NewUserConnection(agent); |
3259 | 3261 | ||
3262 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3263 | |||
3264 | //On login or border crossing test land permisions | ||
3265 | if (tp != TeleportFlags.Default) | ||
3266 | { | ||
3267 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | ||
3268 | { | ||
3269 | return false; | ||
3270 | } | ||
3271 | } | ||
3272 | |||
3260 | ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID); | 3273 | ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID); |
3261 | if (sp != null) | 3274 | if (sp != null) |
3262 | { | 3275 | { |
@@ -3329,7 +3342,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3329 | } | 3342 | } |
3330 | } | 3343 | } |
3331 | // Honor parcel landing type and position. | 3344 | // Honor parcel landing type and position. |
3332 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3333 | if (land != null) | 3345 | if (land != null) |
3334 | { | 3346 | { |
3335 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 3347 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3345,6 +3357,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
3345 | return true; | 3357 | return true; |
3346 | } | 3358 | } |
3347 | 3359 | ||
3360 | private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) | ||
3361 | { | ||
3362 | |||
3363 | bool banned = land.IsBannedFromLand(agent.AgentID); | ||
3364 | bool restricted = land.IsRestrictedFromLand(agent.AgentID); | ||
3365 | |||
3366 | if (banned || restricted) | ||
3367 | { | ||
3368 | ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); | ||
3369 | if (nearestParcel != null) | ||
3370 | { | ||
3371 | //Move agent to nearest allowed | ||
3372 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | ||
3373 | agent.startpos.X = newPosition.X; | ||
3374 | agent.startpos.Y = newPosition.Y; | ||
3375 | } | ||
3376 | else | ||
3377 | { | ||
3378 | if (banned) | ||
3379 | { | ||
3380 | reason = "Cannot regioncross into banned parcel."; | ||
3381 | } | ||
3382 | else | ||
3383 | { | ||
3384 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", | ||
3385 | RegionInfo.RegionName); | ||
3386 | } | ||
3387 | return false; | ||
3388 | } | ||
3389 | } | ||
3390 | reason = ""; | ||
3391 | return true; | ||
3392 | } | ||
3393 | |||
3348 | /// <summary> | 3394 | /// <summary> |
3349 | /// Verifies that the user has a presence on the Grid | 3395 | /// Verifies that the user has a presence on the Grid |
3350 | /// </summary> | 3396 | /// </summary> |
@@ -3476,6 +3522,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3476 | return true; | 3522 | return true; |
3477 | } | 3523 | } |
3478 | 3524 | ||
3525 | private ILandObject GetParcelAtPoint(float x, float y) | ||
3526 | { | ||
3527 | foreach (var parcel in AllParcels()) | ||
3528 | { | ||
3529 | if (parcel.ContainsPoint((int)x,(int)y)) | ||
3530 | { | ||
3531 | return parcel; | ||
3532 | } | ||
3533 | } | ||
3534 | return null; | ||
3535 | } | ||
3536 | |||
3479 | /// <summary> | 3537 | /// <summary> |
3480 | /// Update an AgentCircuitData object with new information | 3538 | /// Update an AgentCircuitData object with new information |
3481 | /// </summary> | 3539 | /// </summary> |
@@ -4748,5 +4806,175 @@ namespace OpenSim.Region.Framework.Scenes | |||
4748 | { | 4806 | { |
4749 | get { return m_allowScriptCrossings; } | 4807 | get { return m_allowScriptCrossings; } |
4750 | } | 4808 | } |
4809 | |||
4810 | public Vector3? GetNearestAllowedPosition(ScenePresence avatar) | ||
4811 | { | ||
4812 | //simulate to make sure we have pretty up to date positions | ||
4813 | PhysicsScene.Simulate(0); | ||
4814 | |||
4815 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | ||
4816 | |||
4817 | if (nearestParcel != null) | ||
4818 | { | ||
4819 | Vector3 dir = Vector3.Normalize(Vector3.Multiply(avatar.Velocity, -1)); | ||
4820 | //Try to get a location that feels like where they came from | ||
4821 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | ||
4822 | if (nearestPoint != null) | ||
4823 | { | ||
4824 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); | ||
4825 | return nearestPoint.Value; | ||
4826 | } | ||
4827 | |||
4828 | //Sometimes velocity might be zero (local teleport), so try finding point along path from avatar to center of nearest parcel | ||
4829 | Vector3 directionToParcelCenter = Vector3.Subtract(GetParcelCenterAtGround(nearestParcel), avatar.AbsolutePosition); | ||
4830 | dir = Vector3.Normalize(directionToParcelCenter); | ||
4831 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | ||
4832 | if (nearestPoint != null) | ||
4833 | { | ||
4834 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); | ||
4835 | return nearestPoint.Value; | ||
4836 | } | ||
4837 | |||
4838 | //Ultimate backup if we have no idea where they are | ||
4839 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | ||
4840 | return avatar.lastKnownAllowedPosition; | ||
4841 | |||
4842 | } | ||
4843 | |||
4844 | //Go to the edge, this happens in teleporting to a region with no available parcels | ||
4845 | Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); | ||
4846 | //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); | ||
4847 | return nearestRegionEdgePoint; | ||
4848 | return null; | ||
4849 | } | ||
4850 | |||
4851 | private Vector3 GetParcelCenterAtGround(ILandObject parcel) | ||
4852 | { | ||
4853 | Vector2 center = GetParcelCenter(parcel); | ||
4854 | return GetPositionAtGround(center.X, center.Y); | ||
4855 | } | ||
4856 | |||
4857 | private Vector3? GetNearestPointInParcelAlongDirectionFromPoint(Vector3 pos, Vector3 direction, ILandObject parcel) | ||
4858 | { | ||
4859 | Vector3 unitDirection = Vector3.Normalize(direction); | ||
4860 | //Making distance to search go through some sane limit of distance | ||
4861 | for (float distance = 0; distance < Constants.RegionSize * 2; distance += .5f) | ||
4862 | { | ||
4863 | Vector3 testPos = Vector3.Add(pos, Vector3.Multiply(unitDirection, distance)); | ||
4864 | if (parcel.ContainsPoint((int)testPos.X, (int)testPos.Y)) | ||
4865 | { | ||
4866 | return testPos; | ||
4867 | } | ||
4868 | } | ||
4869 | return null; | ||
4870 | } | ||
4871 | |||
4872 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) | ||
4873 | { | ||
4874 | List<ILandObject> all = AllParcels(); | ||
4875 | float minParcelDistance = float.MaxValue; | ||
4876 | ILandObject nearestParcel = null; | ||
4877 | |||
4878 | foreach (var parcel in all) | ||
4879 | { | ||
4880 | if (!parcel.IsEitherBannedOrRestricted(avatarId)) | ||
4881 | { | ||
4882 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); | ||
4883 | if (parcelDistance < minParcelDistance) | ||
4884 | { | ||
4885 | minParcelDistance = parcelDistance; | ||
4886 | nearestParcel = parcel; | ||
4887 | } | ||
4888 | } | ||
4889 | } | ||
4890 | |||
4891 | return nearestParcel; | ||
4892 | } | ||
4893 | |||
4894 | private List<ILandObject> AllParcels() | ||
4895 | { | ||
4896 | return LandChannel.AllParcels(); | ||
4897 | } | ||
4898 | |||
4899 | private float GetParcelDistancefromPoint(ILandObject parcel, float x, float y) | ||
4900 | { | ||
4901 | return Vector2.Distance(new Vector2(x, y), GetParcelCenter(parcel)); | ||
4902 | } | ||
4903 | |||
4904 | //calculate the average center point of a parcel | ||
4905 | private Vector2 GetParcelCenter(ILandObject parcel) | ||
4906 | { | ||
4907 | int count = 0; | ||
4908 | int avgx = 0; | ||
4909 | int avgy = 0; | ||
4910 | for (int x = 0; x < Constants.RegionSize; x++) | ||
4911 | { | ||
4912 | for (int y = 0; y < Constants.RegionSize; y++) | ||
4913 | { | ||
4914 | //Just keep a running average as we check if all the points are inside or not | ||
4915 | if (parcel.ContainsPoint(x, y)) | ||
4916 | { | ||
4917 | if (count == 0) | ||
4918 | { | ||
4919 | avgx = x; | ||
4920 | avgy = y; | ||
4921 | } | ||
4922 | else | ||
4923 | { | ||
4924 | avgx = (avgx * count + x) / (count + 1); | ||
4925 | avgy = (avgy * count + y) / (count + 1); | ||
4926 | } | ||
4927 | count += 1; | ||
4928 | } | ||
4929 | } | ||
4930 | } | ||
4931 | return new Vector2(avgx, avgy); | ||
4932 | } | ||
4933 | |||
4934 | private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar) | ||
4935 | { | ||
4936 | float xdistance = avatar.AbsolutePosition.X < Constants.RegionSize / 2 ? avatar.AbsolutePosition.X : Constants.RegionSize - avatar.AbsolutePosition.X; | ||
4937 | float ydistance = avatar.AbsolutePosition.Y < Constants.RegionSize / 2 ? avatar.AbsolutePosition.Y : Constants.RegionSize - avatar.AbsolutePosition.Y; | ||
4938 | |||
4939 | //find out what vertical edge to go to | ||
4940 | if (xdistance < ydistance) | ||
4941 | { | ||
4942 | if (avatar.AbsolutePosition.X < Constants.RegionSize / 2) | ||
4943 | { | ||
4944 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, 0.0f, avatar.AbsolutePosition.Y); | ||
4945 | } | ||
4946 | else | ||
4947 | { | ||
4948 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, Constants.RegionSize, avatar.AbsolutePosition.Y); | ||
4949 | } | ||
4950 | } | ||
4951 | //find out what horizontal edge to go to | ||
4952 | else | ||
4953 | { | ||
4954 | if (avatar.AbsolutePosition.Y < Constants.RegionSize / 2) | ||
4955 | { | ||
4956 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, 0.0f); | ||
4957 | } | ||
4958 | else | ||
4959 | { | ||
4960 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, Constants.RegionSize); | ||
4961 | } | ||
4962 | } | ||
4963 | } | ||
4964 | |||
4965 | private Vector3 GetPositionAtAvatarHeightOrGroundHeight(ScenePresence avatar, float x, float y) | ||
4966 | { | ||
4967 | Vector3 ground = GetPositionAtGround(x, y); | ||
4968 | if (avatar.AbsolutePosition.Z > ground.Z) | ||
4969 | { | ||
4970 | ground.Z = avatar.AbsolutePosition.Z; | ||
4971 | } | ||
4972 | return ground; | ||
4973 | } | ||
4974 | |||
4975 | private Vector3 GetPositionAtGround(float x, float y) | ||
4976 | { | ||
4977 | return new Vector3(x, y, GetGroundHeight(x, y)); | ||
4978 | } | ||
4751 | } | 4979 | } |
4752 | } | 4980 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 37b4fd6..88deedf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -569,7 +569,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
569 | ApplyPhysics(m_scene.m_physicalPrim); | 569 | ApplyPhysics(m_scene.m_physicalPrim); |
570 | 570 | ||
571 | // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled | 571 | // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled |
572 | // for the same object with very different properties. The caller must schedule the update. | 572 | // for the same object with very different properties. The caller must schedule the update. |
573 | //ScheduleGroupForFullUpdate(); | 573 | //ScheduleGroupForFullUpdate(); |
574 | } | 574 | } |
575 | 575 | ||
@@ -2032,11 +2032,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2032 | /// Immediately send a full update for this scene object. | 2032 | /// Immediately send a full update for this scene object. |
2033 | /// </summary> | 2033 | /// </summary> |
2034 | public void SendGroupFullUpdate() | 2034 | public void SendGroupFullUpdate() |
2035 | { | 2035 | { |
2036 | if (IsDeleted) | 2036 | if (IsDeleted) |
2037 | return; | 2037 | return; |
2038 | 2038 | ||
2039 | // m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID); | 2039 | // m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID); |
2040 | 2040 | ||
2041 | RootPart.SendFullUpdateToAllClients(); | 2041 | RootPart.SendFullUpdateToAllClients(); |
2042 | 2042 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4729382..8967252 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2869,7 +2869,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2869 | { | 2869 | { |
2870 | SendFullUpdateToClient(remoteClient, clientFlags); | 2870 | SendFullUpdateToClient(remoteClient, clientFlags); |
2871 | } | 2871 | } |
2872 | } | 2872 | } |
2873 | 2873 | ||
2874 | /// <summary> | 2874 | /// <summary> |
2875 | /// Send a full update for this part to all clients. | 2875 | /// Send a full update for this part to all clients. |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4256be9..7661f1e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -146,7 +146,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
146 | 146 | ||
147 | private float m_sitAvatarHeight = 2.0f; | 147 | private float m_sitAvatarHeight = 2.0f; |
148 | 148 | ||
149 | private float m_godlevel; | 149 | private int m_godLevel; |
150 | private int m_userLevel; | ||
150 | 151 | ||
151 | private bool m_invulnerable = true; | 152 | private bool m_invulnerable = true; |
152 | 153 | ||
@@ -294,9 +295,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
294 | get { return m_invulnerable; } | 295 | get { return m_invulnerable; } |
295 | } | 296 | } |
296 | 297 | ||
297 | public float GodLevel | 298 | public int UserLevel |
298 | { | 299 | { |
299 | get { return m_godlevel; } | 300 | get { return m_userLevel; } |
301 | } | ||
302 | |||
303 | public int GodLevel | ||
304 | { | ||
305 | get { return m_godLevel; } | ||
300 | } | 306 | } |
301 | 307 | ||
302 | public ulong RegionHandle | 308 | public ulong RegionHandle |
@@ -668,6 +674,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
668 | m_regionInfo = reginfo; | 674 | m_regionInfo = reginfo; |
669 | m_localId = m_scene.AllocateLocalId(); | 675 | m_localId = m_scene.AllocateLocalId(); |
670 | 676 | ||
677 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); | ||
678 | |||
679 | m_userLevel = account.UserLevel; | ||
680 | |||
671 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | 681 | IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); |
672 | if (gm != null) | 682 | if (gm != null) |
673 | m_grouptitle = gm.GetGroupTitle(m_uuid); | 683 | m_grouptitle = gm.GetGroupTitle(m_uuid); |
@@ -2967,17 +2977,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2967 | if (account != null) | 2977 | if (account != null) |
2968 | { | 2978 | { |
2969 | if (account.UserLevel > 0) | 2979 | if (account.UserLevel > 0) |
2970 | m_godlevel = account.UserLevel; | 2980 | m_godLevel = account.UserLevel; |
2971 | else | 2981 | else |
2972 | m_godlevel = 200; | 2982 | m_godLevel = 200; |
2973 | } | 2983 | } |
2974 | } | 2984 | } |
2975 | else | 2985 | else |
2976 | { | 2986 | { |
2977 | m_godlevel = 0; | 2987 | m_godLevel = 0; |
2978 | } | 2988 | } |
2979 | 2989 | ||
2980 | ControllingClient.SendAdminResponse(token, (uint)m_godlevel); | 2990 | ControllingClient.SendAdminResponse(token, (uint)m_godLevel); |
2981 | } | 2991 | } |
2982 | 2992 | ||
2983 | #region Child Agent Updates | 2993 | #region Child Agent Updates |
@@ -3068,7 +3078,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3068 | cAgent.ControlFlags = (uint)m_AgentControlFlags; | 3078 | cAgent.ControlFlags = (uint)m_AgentControlFlags; |
3069 | 3079 | ||
3070 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) | 3080 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) |
3071 | cAgent.GodLevel = (byte)m_godlevel; | 3081 | cAgent.GodLevel = (byte)m_godLevel; |
3072 | else | 3082 | else |
3073 | cAgent.GodLevel = (byte) 0; | 3083 | cAgent.GodLevel = (byte) 0; |
3074 | 3084 | ||
@@ -3157,7 +3167,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3157 | m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; | 3167 | m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; |
3158 | 3168 | ||
3159 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) | 3169 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) |
3160 | m_godlevel = cAgent.GodLevel; | 3170 | m_godLevel = cAgent.GodLevel; |
3161 | m_setAlwaysRun = cAgent.AlwaysRun; | 3171 | m_setAlwaysRun = cAgent.AlwaysRun; |
3162 | 3172 | ||
3163 | uint i = 0; | 3173 | uint i = 0; |