diff options
8 files changed, 163 insertions, 9 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 71b8eb0..8aac9ce 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -299,7 +299,8 @@ namespace OpenSim.Framework | |||
299 | public delegate void ScriptReset(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID); | 299 | public delegate void ScriptReset(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID); |
300 | public delegate void GetScriptRunning(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID); | 300 | public delegate void GetScriptRunning(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID); |
301 | public delegate void SetScriptRunning(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID, bool running); | 301 | public delegate void SetScriptRunning(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID, bool running); |
302 | 302 | public delegate void ActivateGesture(IClientAPI client, LLUUID gestureid, LLUUID assetId); | |
303 | public delegate void DeactivateGesture(IClientAPI client, LLUUID gestureid); | ||
303 | 304 | ||
304 | public delegate void TerrainUnacked(IClientAPI remoteClient, int patchX, int patchY); | 305 | public delegate void TerrainUnacked(IClientAPI remoteClient, int patchX, int patchY); |
305 | 306 | ||
@@ -512,6 +513,10 @@ namespace OpenSim.Framework | |||
512 | event UpdateVector OnAutoPilotGo; | 513 | event UpdateVector OnAutoPilotGo; |
513 | 514 | ||
514 | event TerrainUnacked OnUnackedTerrain; | 515 | event TerrainUnacked OnUnackedTerrain; |
516 | event ActivateGesture OnActivateGesture; | ||
517 | event DeactivateGesture OnDeactivateGesture; | ||
518 | |||
519 | // void ActivateGesture(LLUUID assetId, LLUUID gestureId); | ||
515 | 520 | ||
516 | // [Obsolete("IClientAPI.OutPacket SHOULD NOT EXIST outside of LLClientView please refactor appropriately.")] | 521 | // [Obsolete("IClientAPI.OutPacket SHOULD NOT EXIST outside of LLClientView please refactor appropriately.")] |
517 | void OutPacket(Packet newPack, ThrottleOutPacketType packType); | 522 | void OutPacket(Packet newPack, ThrottleOutPacketType packType); |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 059255f..83a1181 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -247,6 +247,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
247 | private GetScriptRunning handlerGetScriptRunning = null; | 247 | private GetScriptRunning handlerGetScriptRunning = null; |
248 | private SetScriptRunning handlerSetScriptRunning = null; | 248 | private SetScriptRunning handlerSetScriptRunning = null; |
249 | private UpdateVector handlerAutoPilotGo = null; | 249 | private UpdateVector handlerAutoPilotGo = null; |
250 | //Gesture | ||
251 | private ActivateGesture handlerActivateGesture = null; | ||
252 | private DeactivateGesture handlerDeactivateGesture = null; | ||
250 | 253 | ||
251 | //private TerrainUnacked handlerUnackedTerrain = null; | 254 | //private TerrainUnacked handlerUnackedTerrain = null; |
252 | 255 | ||
@@ -931,6 +934,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
931 | 934 | ||
932 | public event TerrainUnacked OnUnackedTerrain; | 935 | public event TerrainUnacked OnUnackedTerrain; |
933 | 936 | ||
937 | public event ActivateGesture OnActivateGesture; | ||
938 | public event DeactivateGesture OnDeactivateGesture; | ||
939 | |||
940 | |||
941 | // voire si c'est necessaire | ||
942 | public void ActivateGesture(LLUUID assetId, LLUUID gestureId) | ||
943 | { | ||
944 | } | ||
945 | public void DeactivateGesture(LLUUID assetId, LLUUID gestureId) | ||
946 | { | ||
947 | } | ||
934 | #region Scene/Avatar to Client | 948 | #region Scene/Avatar to Client |
935 | 949 | ||
936 | /// <summary> | 950 | /// <summary> |
@@ -2065,6 +2079,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2065 | 2079 | ||
2066 | #endregion | 2080 | #endregion |
2067 | 2081 | ||
2082 | // Gesture | ||
2083 | |||
2084 | |||
2085 | |||
2068 | #region Appearance/ Wearables Methods | 2086 | #region Appearance/ Wearables Methods |
2069 | 2087 | ||
2070 | /// <summary> | 2088 | /// <summary> |
@@ -5879,6 +5897,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5879 | 5897 | ||
5880 | #endregion | 5898 | #endregion |
5881 | 5899 | ||
5900 | #region Gesture Managment | ||
5901 | |||
5902 | case PacketType.ActivateGestures: | ||
5903 | ActivateGesturesPacket activateGesturePacket = (ActivateGesturesPacket)Pack; | ||
5904 | handlerActivateGesture = OnActivateGesture; | ||
5905 | if (handlerActivateGesture != null) | ||
5906 | { | ||
5907 | handlerActivateGesture(this, | ||
5908 | activateGesturePacket.Data[0].AssetID, | ||
5909 | activateGesturePacket.Data[0].ItemID); | ||
5910 | } | ||
5911 | else m_log.Error("Null pointer for activateGesture"); | ||
5912 | |||
5913 | break; | ||
5914 | |||
5915 | case PacketType.DeactivateGestures: | ||
5916 | DeactivateGesturesPacket deactivateGesturePacket = (DeactivateGesturesPacket)Pack; | ||
5917 | handlerDeactivateGesture = OnDeactivateGesture; | ||
5918 | if (handlerDeactivateGesture != null) | ||
5919 | { | ||
5920 | handlerDeactivateGesture(this, deactivateGesturePacket.Data[0].ItemID); | ||
5921 | } | ||
5922 | break; | ||
5923 | |||
5924 | #endregion | ||
5925 | |||
5926 | |||
5882 | #region unimplemented handlers | 5927 | #region unimplemented handlers |
5883 | 5928 | ||
5884 | case PacketType.StartPingCheck: | 5929 | case PacketType.StartPingCheck: |
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 09f12b2..0b0f4c1 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | |||
@@ -306,9 +306,19 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
306 | public event RegionHandleRequest OnRegionHandleRequest; | 306 | public event RegionHandleRequest OnRegionHandleRequest; |
307 | public event ParcelInfoRequest OnParcelInfoRequest; | 307 | public event ParcelInfoRequest OnParcelInfoRequest; |
308 | 308 | ||
309 | public event ActivateGesture OnActivateGesture; | ||
310 | public event DeactivateGesture OnDeactivateGesture; | ||
311 | |||
309 | #pragma warning restore 67 | 312 | #pragma warning restore 67 |
310 | 313 | ||
311 | #endregion | 314 | #endregion |
315 | |||
316 | public void ActivateGesture(LLUUID assetId, LLUUID gestureId) | ||
317 | { | ||
318 | } | ||
319 | public void DeactivateGesture(LLUUID assetId, LLUUID gestureId) | ||
320 | { | ||
321 | } | ||
312 | 322 | ||
313 | #region Overrriden Methods IGNORE | 323 | #region Overrriden Methods IGNORE |
314 | 324 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 171868b..9c91725 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -2343,6 +2343,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
2343 | } | 2343 | } |
2344 | } | 2344 | } |
2345 | 2345 | ||
2346 | public void AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, LLQuaternion rot, LLVector3 pos) | ||
2347 | { | ||
2348 | m_innerScene.AttachObject(controllingClient, localID, attachPoint, rot, pos); | ||
2349 | } | ||
2350 | |||
2346 | public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient) | 2351 | public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient) |
2347 | { | 2352 | { |
2348 | ScenePresence presence; | 2353 | ScenePresence presence; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 363d0f8..fb2cbb6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -2020,7 +2020,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2020 | // with the deeded object, it goes back to them | 2020 | // with the deeded object, it goes back to them |
2021 | 2021 | ||
2022 | grp.SetFromAssetID(grp.RootPart.LastOwnerID); | 2022 | grp.SetFromAssetID(grp.RootPart.LastOwnerID); |
2023 | m_innerScene.AttachObject(sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition); | 2023 | AttachObject(sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition); |
2024 | } | 2024 | } |
2025 | } | 2025 | } |
2026 | } | 2026 | } |
@@ -2161,9 +2161,56 @@ namespace OpenSim.Region.Environment.Scenes | |||
2161 | 2161 | ||
2162 | client.OnUnackedTerrain += TerrainUnAcked; | 2162 | client.OnUnackedTerrain += TerrainUnAcked; |
2163 | 2163 | ||
2164 | //Gesture | ||
2165 | client.OnActivateGesture += ActivateGesture; | ||
2166 | client.OnDeactivateGesture += DeactivateGesture; | ||
2167 | |||
2164 | // EventManager.TriggerOnNewClient(client); | 2168 | // EventManager.TriggerOnNewClient(client); |
2165 | } | 2169 | } |
2166 | 2170 | ||
2171 | // Gesture | ||
2172 | public virtual void ActivateGesture(IClientAPI client, LLUUID assetId, LLUUID gestureId) | ||
2173 | { | ||
2174 | // UserProfileCacheService User = CommsManager.SecureInventoryService.UpdateItem(gestureid, agentID); | ||
2175 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId); | ||
2176 | |||
2177 | if (userInfo != null) | ||
2178 | { | ||
2179 | |||
2180 | InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId); | ||
2181 | if (item != null) | ||
2182 | { | ||
2183 | item.Flags = 1; | ||
2184 | userInfo.UpdateItem(item); | ||
2185 | } | ||
2186 | else m_log.Error("Unable to find gesture"); | ||
2187 | } | ||
2188 | else m_log.Error("Gesture : Unable to find user "); | ||
2189 | |||
2190 | m_log.DebugFormat("Asset : {0} gesture :{1}", gestureId.ToString(), assetId.ToString()); | ||
2191 | } | ||
2192 | |||
2193 | public virtual void DeactivateGesture(IClientAPI client, LLUUID gestureId) | ||
2194 | { | ||
2195 | // UserProfileCacheService User = CommsManager.SecureInventoryService.UpdateItem(gestureid, agentID); | ||
2196 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId); | ||
2197 | |||
2198 | if (userInfo != null) | ||
2199 | { | ||
2200 | |||
2201 | InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId); | ||
2202 | if (item != null) | ||
2203 | { | ||
2204 | item.Flags = 0; | ||
2205 | userInfo.UpdateItem(item); | ||
2206 | } | ||
2207 | else m_log.Error("Unable to find gesture"); | ||
2208 | } | ||
2209 | else m_log.Error("Gesture : Unable to find user "); | ||
2210 | |||
2211 | m_log.DebugFormat("gesture : {0} ", gestureId.ToString()); | ||
2212 | } | ||
2213 | |||
2167 | public virtual void TeleportClientHome(LLUUID agentId, IClientAPI client) | 2214 | public virtual void TeleportClientHome(LLUUID agentId, IClientAPI client) |
2168 | { | 2215 | { |
2169 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); | 2216 | UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index f1af15f..4823aa1 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |||
@@ -615,6 +615,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
615 | 615 | ||
616 | if (destRegionUp) | 616 | if (destRegionUp) |
617 | { | 617 | { |
618 | if(!avatar.ValidateAttachments()) | ||
619 | { | ||
620 | avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); | ||
621 | return; | ||
622 | } | ||
623 | |||
618 | avatar.Close(); | 624 | avatar.Close(); |
619 | 625 | ||
620 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport | 626 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index cc70210..cf24c73 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -1972,7 +1972,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1972 | LLVector3 vel = m_velocity; | 1972 | LLVector3 vel = m_velocity; |
1973 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); | 1973 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); |
1974 | SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); | 1974 | SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); |
1975 | if (neighbourRegion != null) | 1975 | if (neighbourRegion != null && ValidateAttachments()) |
1976 | { | 1976 | { |
1977 | // When the neighbour is informed of the border crossing, it will set up CAPS handlers for the avatar | 1977 | // When the neighbour is informed of the border crossing, it will set up CAPS handlers for the avatar |
1978 | // This means we need to remove the current caps handler here and possibly compensate later, | 1978 | // This means we need to remove the current caps handler here and possibly compensate later, |
@@ -2343,15 +2343,41 @@ namespace OpenSim.Region.Environment.Scenes | |||
2343 | } | 2343 | } |
2344 | } | 2344 | } |
2345 | 2345 | ||
2346 | public void CrossAttachmentsIntoNewRegion(ulong regionHandle) | 2346 | public bool ValidateAttachments() |
2347 | { | ||
2348 | lock (m_attachments) | ||
2349 | { | ||
2350 | // Validate | ||
2351 | foreach (SceneObjectGroup gobj in m_attachments) | ||
2352 | { | ||
2353 | if(gobj == null) | ||
2354 | return false; | ||
2355 | |||
2356 | if(gobj.RootPart == null) | ||
2357 | { | ||
2358 | return false; | ||
2359 | } | ||
2360 | } | ||
2361 | } | ||
2362 | return true; | ||
2363 | } | ||
2364 | |||
2365 | public bool CrossAttachmentsIntoNewRegion(ulong regionHandle) | ||
2347 | { | 2366 | { |
2348 | m_attachmentsTransported = true; | 2367 | m_attachmentsTransported = true; |
2349 | lock (m_attachments) | 2368 | lock (m_attachments) |
2350 | { | 2369 | { |
2370 | // Validate | ||
2371 | foreach (SceneObjectGroup gobj in m_attachments) | ||
2372 | { | ||
2373 | if(gobj == null || gobj.RootPart == null) | ||
2374 | return false; | ||
2375 | } | ||
2376 | |||
2351 | foreach (SceneObjectGroup gobj in m_attachments) | 2377 | foreach (SceneObjectGroup gobj in m_attachments) |
2352 | { | 2378 | { |
2353 | // If the prim group is null then something must have happened to it! | 2379 | // If the prim group is null then something must have happened to it! |
2354 | if (gobj != null) | 2380 | if (gobj != null && gobj.RootPart != null) |
2355 | { | 2381 | { |
2356 | // Set the parent localID to 0 so it transfers over properly. | 2382 | // Set the parent localID to 0 so it transfers over properly. |
2357 | gobj.RootPart.SetParentLocalId(0); | 2383 | gobj.RootPart.SetParentLocalId(0); |
@@ -2362,6 +2388,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2362 | } | 2388 | } |
2363 | } | 2389 | } |
2364 | m_attachments.Clear(); | 2390 | m_attachments.Clear(); |
2391 | |||
2392 | return true; | ||
2365 | } | 2393 | } |
2366 | } | 2394 | } |
2367 | 2395 | ||
@@ -2903,10 +2931,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
2903 | m_log.InfoFormat("[ATTACHEMENT] Attach from world {0}", | 2931 | m_log.InfoFormat("[ATTACHEMENT] Attach from world {0}", |
2904 | itemID.ToString()); | 2932 | itemID.ToString()); |
2905 | 2933 | ||
2906 | // Attach from world | 2934 | // Attach from world, if not already attached |
2907 | if (att.ParentGroup != null) | 2935 | if (att.ParentGroup != null && !att.IsAttachment) |
2908 | m_scene.RezSingleAttachment(att.ParentGroup, | 2936 | m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, (uint)0, att.ParentGroup.GroupRotation, LLVector3.Zero); |
2909 | ControllingClient, itemID, (uint)attachpoint, 0, 0); | ||
2910 | } | 2937 | } |
2911 | } | 2938 | } |
2912 | } | 2939 | } |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 61ea966..e2e7081 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -207,6 +207,10 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
207 | public event RegionHandleRequest OnRegionHandleRequest; | 207 | public event RegionHandleRequest OnRegionHandleRequest; |
208 | public event ParcelInfoRequest OnParcelInfoRequest; | 208 | public event ParcelInfoRequest OnParcelInfoRequest; |
209 | 209 | ||
210 | public event ActivateGesture OnActivateGesture; | ||
211 | public event DeactivateGesture OnDeactivateGesture; | ||
212 | |||
213 | |||
210 | #pragma warning restore 67 | 214 | #pragma warning restore 67 |
211 | 215 | ||
212 | private LLUUID myID = LLUUID.Random(); | 216 | private LLUUID myID = LLUUID.Random(); |
@@ -295,6 +299,11 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
295 | get { return m_scene; } | 299 | get { return m_scene; } |
296 | } | 300 | } |
297 | 301 | ||
302 | public virtual void ActivateGesture(LLUUID assetId, LLUUID gestureId) | ||
303 | { | ||
304 | } | ||
305 | |||
306 | |||
298 | public virtual void OutPacket(Packet newPack, ThrottleOutPacketType packType) | 307 | public virtual void OutPacket(Packet newPack, ThrottleOutPacketType packType) |
299 | { | 308 | { |
300 | } | 309 | } |