diff options
author | John Hurliman | 2010-03-10 14:06:12 -0800 |
---|---|---|
committer | John Hurliman | 2010-03-10 14:06:12 -0800 |
commit | b18ca2fee6624d63faf0d44dd2d4b7b64c93fc5a (patch) | |
tree | c20d8f5be598d70caff0589629427f6450573cf4 /OpenSim/Region/CoreModules | |
parent | * Cleaned up and commented the messy SendInventoryUpdate, fixed a broken debu... (diff) | |
parent | Reintroduce a check that was dropped from permissions (diff) | |
download | opensim-SC_OLD-b18ca2fee6624d63faf0d44dd2d4b7b64c93fc5a.zip opensim-SC_OLD-b18ca2fee6624d63faf0d44dd2d4b7b64c93fc5a.tar.gz opensim-SC_OLD-b18ca2fee6624d63faf0d44dd2d4b7b64c93fc5a.tar.bz2 opensim-SC_OLD-b18ca2fee6624d63faf0d44dd2d4b7b64c93fc5a.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to '')
11 files changed, 154 insertions, 54 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d458364..3b7fe88 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -36,7 +36,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | 37 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | 38 | namespace OpenSim.Region.CoreModules.Avatar.Attachments |
39 | { | 39 | { |
40 | public class AttachmentsModule : IAttachmentsModule, IRegionModule | 40 | public class AttachmentsModule : IAttachmentsModule, IRegionModule |
41 | { | 41 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -204,7 +204,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
204 | if (m_scene.AvatarFactory != null) | 204 | if (m_scene.AvatarFactory != null) |
205 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 205 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) | 209 | public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) |
210 | { | 210 | { |
@@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
222 | } | 222 | } |
223 | 223 | ||
224 | DetachSingleAttachmentToInv(itemID, remoteClient); | 224 | DetachSingleAttachmentToInv(itemID, remoteClient); |
225 | } | 225 | } |
226 | 226 | ||
227 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. | 227 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. |
228 | // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? | 228 | // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? |
@@ -252,6 +252,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
252 | } | 252 | } |
253 | } | 253 | } |
254 | } | 254 | } |
255 | } | 255 | } |
256 | } | 256 | } |
257 | } \ No newline at end of file | 257 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index de324c0..312db38 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -394,11 +394,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
394 | public IClientAPI LocateClientObject(UUID agentID) | 394 | public IClientAPI LocateClientObject(UUID agentID) |
395 | { | 395 | { |
396 | Scene scene = GetClientScene(agentID); | 396 | Scene scene = GetClientScene(agentID); |
397 | if(scene == null) | 397 | if (scene == null) |
398 | return null; | 398 | return null; |
399 | 399 | ||
400 | ScenePresence presence = scene.GetScenePresence(agentID); | 400 | ScenePresence presence = scene.GetScenePresence(agentID); |
401 | if(presence == null) | 401 | if (presence == null) |
402 | return null; | 402 | return null; |
403 | 403 | ||
404 | return presence.ControllingClient; | 404 | return presence.ControllingClient; |
@@ -481,7 +481,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
481 | m_log.DebugFormat("[FRIENDS]: {0} offered friendship to {1}", principalID, friendID); | 481 | m_log.DebugFormat("[FRIENDS]: {0} offered friendship to {1}", principalID, friendID); |
482 | 482 | ||
483 | // This user wants to be friends with the other user. | 483 | // This user wants to be friends with the other user. |
484 | // Let's add both relations to the DB, but one of them is inactive (-1) | 484 | // Let's add the relation backwards, in case the other is not online |
485 | FriendsService.StoreFriend(friendID, principalID.ToString(), 0); | 485 | FriendsService.StoreFriend(friendID, principalID.ToString(), 0); |
486 | 486 | ||
487 | // Now let's ask the other user to be friends with this user | 487 | // Now let's ask the other user to be friends with this user |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index c0d3f31..ad050a1 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -108,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
108 | if (!m_Enabled) | 108 | if (!m_Enabled) |
109 | return; | 109 | return; |
110 | 110 | ||
111 | lock(m_Scenes) | 111 | lock (m_Scenes) |
112 | { | 112 | { |
113 | m_Scenes.Remove(scene); | 113 | m_Scenes.Remove(scene); |
114 | } | 114 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 0fc467b..16e05b7 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -576,7 +576,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
576 | foreach (SceneObjectPart part in partList) | 576 | foreach (SceneObjectPart part in partList) |
577 | { | 577 | { |
578 | if (part.OwnerID != item.Owner) | 578 | if (part.OwnerID != item.Owner) |
579 | { | 579 | { |
580 | part.LastOwnerID = part.OwnerID; | 580 | part.LastOwnerID = part.OwnerID; |
581 | part.OwnerID = item.Owner; | 581 | part.OwnerID = item.Owner; |
582 | part.Inventory.ChangeInventoryOwner(item.Owner); | 582 | part.Inventory.ChangeInventoryOwner(item.Owner); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs index 292ff8e..63a28fc 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests | |||
61 | m_LocalConnector = new LocalPresenceServicesConnector(config); | 61 | m_LocalConnector = new LocalPresenceServicesConnector(config); |
62 | 62 | ||
63 | // Let's stick in a test presence | 63 | // Let's stick in a test presence |
64 | m_LocalConnector.m_PresenceService.LoginAgent(UUID.Zero.ToString(), UUID.Zero, UUID.Zero); | 64 | m_LocalConnector.m_PresenceService.LoginAgent(UUID.Zero.ToString(), UUID.Zero, UUID.Zero); |
65 | } | 65 | } |
66 | 66 | ||
67 | /// <summary> | 67 | /// <summary> |
@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests | |||
80 | p.Data = new Dictionary<string, string>(); | 80 | p.Data = new Dictionary<string, string>(); |
81 | p.Data["Online"] = true.ToString(); | 81 | p.Data["Online"] = true.ToString(); |
82 | m_presenceData.Add(UUID.Zero, p); | 82 | m_presenceData.Add(UUID.Zero, p); |
83 | */ | 83 | */ |
84 | 84 | ||
85 | string user1 = UUID.Zero.ToString(); | 85 | string user1 = UUID.Zero.ToString(); |
86 | UUID session1 = UUID.Zero; | 86 | UUID session1 = UUID.Zero; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 07fee79..ce0ca40 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs | |||
@@ -142,26 +142,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
142 | 142 | ||
143 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) | 143 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) |
144 | { | 144 | { |
145 | UserAccount account = m_Cache.Get(userID); | 145 | bool inCache = false; |
146 | if (account != null) | 146 | UserAccount account = m_Cache.Get(userID, out inCache); |
147 | if (inCache) | ||
147 | return account; | 148 | return account; |
148 | 149 | ||
149 | account = m_UserService.GetUserAccount(scopeID, userID); | 150 | account = m_UserService.GetUserAccount(scopeID, userID); |
150 | if (account != null) | 151 | m_Cache.Cache(userID, account); |
151 | m_Cache.Cache(account); | ||
152 | 152 | ||
153 | return account; | 153 | return account; |
154 | } | 154 | } |
155 | 155 | ||
156 | public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) | 156 | public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) |
157 | { | 157 | { |
158 | UserAccount account = m_Cache.Get(firstName + " " + lastName); | 158 | bool inCache = false; |
159 | if (account != null) | 159 | UserAccount account = m_Cache.Get(firstName + " " + lastName, out inCache); |
160 | if (inCache) | ||
160 | return account; | 161 | return account; |
161 | 162 | ||
162 | account = m_UserService.GetUserAccount(scopeID, firstName, lastName); | 163 | account = m_UserService.GetUserAccount(scopeID, firstName, lastName); |
163 | if (account != null) | 164 | if (account != null) |
164 | m_Cache.Cache(account); | 165 | m_Cache.Cache(account.PrincipalID, account); |
165 | 166 | ||
166 | return account; | 167 | return account; |
167 | } | 168 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs index 1140692..488dbd5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs | |||
@@ -119,26 +119,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
119 | 119 | ||
120 | public override UserAccount GetUserAccount(UUID scopeID, UUID userID) | 120 | public override UserAccount GetUserAccount(UUID scopeID, UUID userID) |
121 | { | 121 | { |
122 | UserAccount account = m_Cache.Get(userID); | 122 | bool inCache = false; |
123 | if (account != null) | 123 | UserAccount account = m_Cache.Get(userID, out inCache); |
124 | if (inCache) | ||
124 | return account; | 125 | return account; |
125 | 126 | ||
126 | account = base.GetUserAccount(scopeID, userID); | 127 | account = base.GetUserAccount(scopeID, userID); |
127 | if (account != null) | 128 | m_Cache.Cache(userID, account); |
128 | m_Cache.Cache(account); | ||
129 | 129 | ||
130 | return account; | 130 | return account; |
131 | } | 131 | } |
132 | 132 | ||
133 | public override UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) | 133 | public override UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) |
134 | { | 134 | { |
135 | UserAccount account = m_Cache.Get(firstName + " " + lastName); | 135 | bool inCache = false; |
136 | if (account != null) | 136 | UserAccount account = m_Cache.Get(firstName + " " + lastName, out inCache); |
137 | if (inCache) | ||
137 | return account; | 138 | return account; |
138 | 139 | ||
139 | account = base.GetUserAccount(scopeID, firstName, lastName); | 140 | account = base.GetUserAccount(scopeID, firstName, lastName); |
140 | if (account != null) | 141 | if (account != null) |
141 | m_Cache.Cache(account); | 142 | m_Cache.Cache(account.PrincipalID, account); |
142 | 143 | ||
143 | return account; | 144 | return account; |
144 | } | 145 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index e430fc7..a355661 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | |||
@@ -36,50 +36,58 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
36 | { | 36 | { |
37 | public class UserAccountCache | 37 | public class UserAccountCache |
38 | { | 38 | { |
39 | //private static readonly ILog m_log = | 39 | private static readonly ILog m_log = |
40 | // LogManager.GetLogger( | 40 | LogManager.GetLogger( |
41 | // MethodBase.GetCurrentMethod().DeclaringType); | 41 | MethodBase.GetCurrentMethod().DeclaringType); |
42 | 42 | private ExpiringCache<UUID, UserAccount> m_UUIDCache; | |
43 | private ICnmCache<UUID, UserAccount> m_UUIDCache; | 43 | private ExpiringCache<string, UUID> m_NameCache; |
44 | private Dictionary<string, UUID> m_NameCache; | ||
45 | 44 | ||
46 | public UserAccountCache() | 45 | public UserAccountCache() |
47 | { | 46 | { |
48 | // Warning: the size values are a bit fuzzy. What matters | 47 | // Warning: the size values are a bit fuzzy. What matters |
49 | // most for this cache is the count value (128 entries). | 48 | // most for this cache is the count value (128 entries). |
50 | m_UUIDCache = CnmSynchronizedCache<UUID, UserAccount>.Synchronized(new CnmMemoryCache<UUID, UserAccount>( | 49 | m_UUIDCache = new ExpiringCache<UUID, UserAccount>(); |
51 | 128, 128*512, TimeSpan.FromMinutes(30.0))); | 50 | m_NameCache = new ExpiringCache<string, UUID>(); // this one is unbound |
52 | m_NameCache = new Dictionary<string, UUID>(); // this one is unbound | ||
53 | } | 51 | } |
54 | 52 | ||
55 | public void Cache(UserAccount account) | 53 | public void Cache(UUID userID, UserAccount account) |
56 | { | 54 | { |
57 | m_UUIDCache.Set(account.PrincipalID, account, 512); | 55 | // Cache even null accounts |
58 | m_NameCache[account.Name] = account.PrincipalID; | 56 | m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); |
57 | if (account != null) | ||
58 | m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d)); | ||
59 | 59 | ||
60 | //m_log.DebugFormat("[USER CACHE]: cached user {0} {1}", account.FirstName, account.LastName); | 60 | m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); |
61 | } | 61 | } |
62 | 62 | ||
63 | public UserAccount Get(UUID userID) | 63 | public UserAccount Get(UUID userID, out bool inCache) |
64 | { | 64 | { |
65 | UserAccount account = null; | 65 | UserAccount account = null; |
66 | inCache = false; | ||
66 | if (m_UUIDCache.TryGetValue(userID, out account)) | 67 | if (m_UUIDCache.TryGetValue(userID, out account)) |
67 | { | 68 | { |
68 | //m_log.DebugFormat("[USER CACHE]: Account {0} {1} found in cache", account.FirstName, account.LastName); | 69 | //m_log.DebugFormat("[USER CACHE]: Account {0} {1} found in cache", account.FirstName, account.LastName); |
70 | inCache = true; | ||
69 | return account; | 71 | return account; |
70 | } | 72 | } |
71 | 73 | ||
72 | return null; | 74 | return null; |
73 | } | 75 | } |
74 | 76 | ||
75 | public UserAccount Get(string name) | 77 | public UserAccount Get(string name, out bool inCache) |
76 | { | 78 | { |
77 | if (!m_NameCache.ContainsKey(name)) | 79 | inCache = false; |
80 | if (!m_NameCache.Contains(name)) | ||
78 | return null; | 81 | return null; |
79 | 82 | ||
80 | UserAccount account = null; | 83 | UserAccount account = null; |
81 | if (m_UUIDCache.TryGetValue(m_NameCache[name], out account)) | 84 | UUID uuid = UUID.Zero; |
82 | return account; | 85 | if (m_NameCache.TryGetValue(name, out uuid)) |
86 | if (m_UUIDCache.TryGetValue(uuid, out account)) | ||
87 | { | ||
88 | inCache = true; | ||
89 | return account; | ||
90 | } | ||
83 | 91 | ||
84 | return null; | 92 | return null; |
85 | } | 93 | } |
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; |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 2211f3e..5c7f3b7 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -490,6 +490,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
490 | 490 | ||
491 | if (m_allowGridGods) | 491 | if (m_allowGridGods) |
492 | { | 492 | { |
493 | ScenePresence sp = m_scene.GetScenePresence(user); | ||
494 | if (sp != null) | ||
495 | { | ||
496 | if (sp.UserLevel >= 200) | ||
497 | return true; | ||
498 | return false; | ||
499 | } | ||
500 | |||
493 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); | 501 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); |
494 | if (account != null) | 502 | if (account != null) |
495 | { | 503 | { |
@@ -610,7 +618,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
610 | return objectOwnerMask; | 618 | return objectOwnerMask; |
611 | 619 | ||
612 | // Estate users should be able to edit anything in the sim if RegionOwnerIsGod is set | 620 | // Estate users should be able to edit anything in the sim if RegionOwnerIsGod is set |
613 | if (IsEstateManager(user) && m_RegionOwnerIsGod) | 621 | if (m_RegionOwnerIsGod && IsEstateManager(user) && !IsAdministrator(objectOwner)) |
614 | return objectOwnerMask; | 622 | return objectOwnerMask; |
615 | 623 | ||
616 | // Admin should be able to edit anything in the sim (including admin objects) | 624 | // Admin should be able to edit anything in the sim (including admin objects) |