diff options
* Some work in progress code: Inventory cache, start of inventory server/service, userprofile cache, inventory handling. (non of it is enabled yet (or at least it shouldn't be).
* Fixed some of the problems with crossing regions when flying: you should no longer sink to ground level when crossing (should keep roughly your right height). Should no longer sometimes get sent back to the centre of the current region when attempting to border cross. But instead sometimes you will find you avatar stop at the edge of region and you will need to start moving again to retry the crossing (which should then work). This code is partly based on Babblefrog's issue #212 patch. [I think I have some ideas of how to solve the stopping at edges problem, just want to get the inventory code done first]
* Capabilities code has now been moved to the OpenSim.Framework.Communications project as some of the caps code will be tightly tied to inventory/asset handling and it was causing a two way reference problem when it was in its own project/dll.
This is a Big commit as I was going to keep my inventory work local until I had it in a working state, in case it brakes anything, but its getting harder to keep in sync with svn.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Primitive.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 72 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 21 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneBase.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObject.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 10 |
6 files changed, 100 insertions, 20 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index f421529..93e4959 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs | |||
@@ -587,6 +587,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
587 | 587 | ||
588 | #endregion | 588 | #endregion |
589 | 589 | ||
590 | #region Inventory | ||
591 | public void GetInventory(IClientAPI client, uint localID) | ||
592 | { | ||
593 | if (localID == this.m_localId) | ||
594 | { | ||
595 | client.SendTaskInventory(this.m_uuid, 0, new byte[0]); | ||
596 | } | ||
597 | } | ||
598 | #endregion | ||
599 | |||
590 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) | 600 | public void UpdateExtraParam(ushort type, bool inUse, byte[] data) |
591 | { | 601 | { |
592 | this.m_Shape.ExtraParams = new byte[data.Length + 7]; | 602 | this.m_Shape.ExtraParams = new byte[data.Length + 7]; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index e963737..126b636 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -26,11 +26,14 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using libsecondlife; | 31 | using libsecondlife; |
31 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
32 | using OpenSim.Framework.Interfaces; | 33 | using OpenSim.Framework.Interfaces; |
33 | using OpenSim.Framework.Types; | 34 | using OpenSim.Framework.Types; |
35 | using OpenSim.Framework.Communications.Caches; | ||
36 | using OpenSim.Framework.Data; | ||
34 | 37 | ||
35 | namespace OpenSim.Region.Environment.Scenes | 38 | namespace OpenSim.Region.Environment.Scenes |
36 | { | 39 | { |
@@ -139,7 +142,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
139 | /// <param name="fromAgentID"></param> | 142 | /// <param name="fromAgentID"></param> |
140 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 143 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
141 | { | 144 | { |
142 | ScenePresence avatar = null; | 145 | ScenePresence avatar = null; |
143 | if (this.Avatars.ContainsKey(fromAgentID)) | 146 | if (this.Avatars.ContainsKey(fromAgentID)) |
144 | { | 147 | { |
145 | avatar = this.Avatars[fromAgentID]; | 148 | avatar = this.Avatars[fromAgentID]; |
@@ -343,6 +346,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
343 | } | 346 | } |
344 | } | 347 | } |
345 | } | 348 | } |
349 | |||
350 | /// <summary> | ||
351 | /// | ||
352 | /// </summary> | ||
353 | /// <param name="remoteClient"></param> | ||
354 | /// <param name="primLocalID"></param> | ||
355 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) | ||
356 | { | ||
357 | Primitive prim = null; | ||
358 | foreach (EntityBase ent in Entities.Values) | ||
359 | { | ||
360 | if (ent is SceneObject) | ||
361 | { | ||
362 | prim = ((SceneObject)ent).HasChildPrim(primLocalID); | ||
363 | if (prim != null) | ||
364 | { | ||
365 | prim.GetInventory(remoteClient, primLocalID); | ||
366 | break; | ||
367 | } | ||
368 | } | ||
369 | } | ||
370 | } | ||
371 | |||
346 | /// <summary> | 372 | /// <summary> |
347 | /// | 373 | /// |
348 | /// </summary> | 374 | /// </summary> |
@@ -623,6 +649,50 @@ namespace OpenSim.Region.Environment.Scenes | |||
623 | } | 649 | } |
624 | 650 | ||
625 | /// <summary> | 651 | /// <summary> |
652 | /// temporary method to test out creating new inventory items | ||
653 | /// </summary> | ||
654 | /// <param name="remoteClient"></param> | ||
655 | /// <param name="transActionID"></param> | ||
656 | /// <param name="folderID"></param> | ||
657 | /// <param name="callbackID"></param> | ||
658 | /// <param name="description"></param> | ||
659 | /// <param name="name"></param> | ||
660 | /// <param name="invType"></param> | ||
661 | /// <param name="type"></param> | ||
662 | /// <param name="wearableType"></param> | ||
663 | /// <param name="nextOwnerMask"></param> | ||
664 | public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) | ||
665 | { | ||
666 | CachedUserInfo userInfo = commsManager.UserProfilesCache.GetUserDetails(remoteClient.AgentId); | ||
667 | if (userInfo != null) | ||
668 | { | ||
669 | AssetBase asset = new AssetBase(); | ||
670 | asset.Name = name; | ||
671 | asset.Description = description; | ||
672 | asset.InvType = invType; | ||
673 | asset.Type = type; | ||
674 | asset.FullID = LLUUID.Random(); | ||
675 | asset.Data = new byte[0]; | ||
676 | this.assetCache.AddAsset(asset); | ||
677 | |||
678 | InventoryItemBase item = new InventoryItemBase(); | ||
679 | item.avatarID = remoteClient.AgentId; | ||
680 | item.creatorsID = remoteClient.AgentId; | ||
681 | item.inventoryID = LLUUID.Random(); | ||
682 | item.assetID = asset.FullID; | ||
683 | item.inventoryDescription = description; | ||
684 | item.inventoryName = name; | ||
685 | item.type = invType; | ||
686 | item.parentFolderID = folderID; | ||
687 | item.inventoryCurrentPermissions = 2147483647; | ||
688 | item.inventoryNextPermissions = nextOwnerMask; | ||
689 | |||
690 | userInfo.ItemReceive(remoteClient.AgentId, item); | ||
691 | remoteClient.SendInventoryItemUpdate(item); | ||
692 | } | ||
693 | } | ||
694 | |||
695 | /// <summary> | ||
626 | /// Sends prims to a client | 696 | /// Sends prims to a client |
627 | /// </summary> | 697 | /// </summary> |
628 | /// <param name="RemoteClient">Client to send to</param> | 698 | /// <param name="RemoteClient">Client to send to</param> |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 64676f0..518a53f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -37,7 +37,7 @@ using OpenSim.Framework.Interfaces; | |||
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | using OpenSim.Framework.Types; | 38 | using OpenSim.Framework.Types; |
39 | using OpenSim.Physics.Manager; | 39 | using OpenSim.Physics.Manager; |
40 | using OpenSim.Region.Caches; | 40 | using OpenSim.Framework.Communications.Caches; |
41 | using OpenSim.Region.Environment.LandManagement; | 41 | using OpenSim.Region.Environment.LandManagement; |
42 | using OpenSim.Region.Scripting; | 42 | using OpenSim.Region.Scripting; |
43 | using OpenSim.Region.Terrain; | 43 | using OpenSim.Region.Terrain; |
@@ -550,13 +550,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
550 | m_estateManager.sendRegionHandshake(client); | 550 | m_estateManager.sendRegionHandshake(client); |
551 | CreateAndAddScenePresence(client); | 551 | CreateAndAddScenePresence(client); |
552 | m_LandManager.sendParcelOverlay(client); | 552 | m_LandManager.sendParcelOverlay(client); |
553 | //commsManager.UserProfilesCache.AddNewUser(client.AgentId); | 553 | commsManager.UserProfilesCache.AddNewUser(client.AgentId); |
554 | } | 554 | } |
555 | 555 | ||
556 | protected virtual void SubscribeToClientEvents(IClientAPI client) | 556 | protected virtual void SubscribeToClientEvents(IClientAPI client) |
557 | { | 557 | { |
558 | client.OnRegionHandShakeReply += SendLayerData; | 558 | client.OnRegionHandShakeReply += SendLayerData; |
559 | //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); | 559 | //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); |
560 | client.OnModifyTerrain += ModifyTerrain; | ||
560 | client.OnChatFromViewer += SimChat; | 561 | client.OnChatFromViewer += SimChat; |
561 | client.OnInstantMessage += InstantMessage; | 562 | client.OnInstantMessage += InstantMessage; |
562 | client.OnRequestWearables += InformClientOfNeighbours; | 563 | client.OnRequestWearables += InformClientOfNeighbours; |
@@ -592,9 +593,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
592 | new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); | 593 | new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); |
593 | 594 | ||
594 | client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); | 595 | client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); |
595 | 596 | ||
596 | //client.OnCreateNewInventoryFolder += commsManager.UserProfilesCache.HandleCreateInventoryFolder; | 597 | // client.OnCreateNewInventoryItem += CreateNewInventoryItem; |
598 | // client.OnCreateNewInventoryFolder += commsManager.UserProfilesCache.HandleCreateInventoryFolder; | ||
597 | // client.OnFetchInventoryDescendents += commsManager.UserProfilesCache.HandleFecthInventoryDescendents; | 599 | // client.OnFetchInventoryDescendents += commsManager.UserProfilesCache.HandleFecthInventoryDescendents; |
600 | // client.OnRequestTaskInventory += RequestTaskInventory; | ||
598 | } | 601 | } |
599 | 602 | ||
600 | protected ScenePresence CreateAndAddScenePresence(IClientAPI client) | 603 | protected ScenePresence CreateAndAddScenePresence(IClientAPI client) |
@@ -819,13 +822,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
819 | } | 822 | } |
820 | } | 823 | } |
821 | 824 | ||
822 | public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position) | 825 | public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) |
823 | { | 826 | { |
824 | if (regionHandle == m_regInfo.RegionHandle) | 827 | if (regionHandle == m_regInfo.RegionHandle) |
825 | { | 828 | { |
826 | if (Avatars.ContainsKey(agentID)) | 829 | if (Avatars.ContainsKey(agentID)) |
827 | { | 830 | { |
828 | Avatars[agentID].MakeAvatar(position); | 831 | Avatars[agentID].MakeAvatar(position, isFlying); |
829 | } | 832 | } |
830 | } | 833 | } |
831 | } | 834 | } |
@@ -909,7 +912,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
909 | agent.startpos = new LLVector3(128, 128, 70); | 912 | agent.startpos = new LLVector3(128, 128, 70); |
910 | agent.child = true; | 913 | agent.child = true; |
911 | commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); | 914 | commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent); |
912 | commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position); | 915 | commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position, false); |
913 | 916 | ||
914 | remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); | 917 | remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4)); |
915 | } | 918 | } |
@@ -922,9 +925,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
922 | /// <param name="regionhandle"></param> | 925 | /// <param name="regionhandle"></param> |
923 | /// <param name="agentID"></param> | 926 | /// <param name="agentID"></param> |
924 | /// <param name="position"></param> | 927 | /// <param name="position"></param> |
925 | public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position) | 928 | public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying) |
926 | { | 929 | { |
927 | return commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); | 930 | return commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying); |
928 | } | 931 | } |
929 | 932 | ||
930 | public void performParcelPrimCountUpdate() | 933 | public void performParcelPrimCountUpdate() |
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index c91c654..3c2193e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs | |||
@@ -32,7 +32,7 @@ using libsecondlife; | |||
32 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
33 | using OpenSim.Framework.Interfaces; | 33 | using OpenSim.Framework.Interfaces; |
34 | using OpenSim.Framework.Types; | 34 | using OpenSim.Framework.Types; |
35 | using OpenSim.Region.Caches; | 35 | using OpenSim.Framework.Communications.Caches; |
36 | using OpenSim.Region.Terrain; | 36 | using OpenSim.Region.Terrain; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | 38 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 294087f..d513634 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs | |||
@@ -40,13 +40,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
40 | private Encoding enc = Encoding.ASCII; | 40 | private Encoding enc = Encoding.ASCII; |
41 | private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group | 41 | private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group |
42 | public Primitive rootPrimitive; | 42 | public Primitive rootPrimitive; |
43 | private new Scene m_world; | ||
44 | protected ulong m_regionHandle; | 43 | protected ulong m_regionHandle; |
45 | 44 | ||
46 | private bool physicsEnabled = false; // HOUSEKEEPING : Do we really need this? | ||
47 | private PhysicsScene m_PhysScene; // HOUSEKEEPING : Do we really need this? | ||
48 | private PhysicsActor m_PhysActor; // HOUSEKEEPING : Do we really need this? | ||
49 | |||
50 | private EventManager m_eventManager; | 45 | private EventManager m_eventManager; |
51 | 46 | ||
52 | public bool isSelected = false; | 47 | public bool isSelected = false; |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 2bb4fb2..e81ac7b 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -66,6 +66,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
66 | private IScenePresenceBody m_body; // HOUSEKEEPING : Do we really need this? | 66 | private IScenePresenceBody m_body; // HOUSEKEEPING : Do we really need this? |
67 | 67 | ||
68 | protected RegionInfo m_regionInfo; | 68 | protected RegionInfo m_regionInfo; |
69 | protected ulong crossingFromRegion = 0; | ||
69 | 70 | ||
70 | private Vector3[] Dir_Vectors = new Vector3[6]; | 71 | private Vector3[] Dir_Vectors = new Vector3[6]; |
71 | private enum Dir_ControlFlags | 72 | private enum Dir_ControlFlags |
@@ -183,10 +184,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
183 | /// | 184 | /// |
184 | /// </summary> | 185 | /// </summary> |
185 | /// <param name="pos"></param> | 186 | /// <param name="pos"></param> |
186 | public void MakeAvatar(LLVector3 pos) | 187 | public void MakeAvatar(LLVector3 pos, bool isFlying) |
187 | { | 188 | { |
188 | //this.childAvatar = false; | 189 | //this.childAvatar = false; |
189 | this.Pos = pos; | 190 | this.Pos = pos; |
191 | this._physActor.Flying = isFlying; | ||
190 | this.newAvatar = true; | 192 | this.newAvatar = true; |
191 | this.childAgent = false; | 193 | this.childAgent = false; |
192 | } | 194 | } |
@@ -194,8 +196,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
194 | protected void MakeChildAgent() | 196 | protected void MakeChildAgent() |
195 | { | 197 | { |
196 | this.Velocity = new LLVector3(0, 0, 0); | 198 | this.Velocity = new LLVector3(0, 0, 0); |
197 | this.Pos = new LLVector3(128, 128, 70); | ||
198 | this.childAgent = true; | 199 | this.childAgent = true; |
200 | //this.Pos = new LLVector3(128, 128, 70); | ||
199 | } | 201 | } |
200 | 202 | ||
201 | /// <summary> | 203 | /// <summary> |
@@ -551,11 +553,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
551 | RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); | 553 | RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle); |
552 | if (neighbourRegion != null) | 554 | if (neighbourRegion != null) |
553 | { | 555 | { |
554 | bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos); | 556 | bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos, this._physActor.Flying); |
555 | if (res) | 557 | if (res) |
556 | { | 558 | { |
557 | this.MakeChildAgent(); | ||
558 | this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint); | 559 | this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint); |
560 | this.MakeChildAgent(); | ||
559 | } | 561 | } |
560 | } | 562 | } |
561 | } | 563 | } |