mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +08:00
* 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.
This commit is contained in:
@@ -587,6 +587,16 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
#endregion
|
||||
|
||||
#region Inventory
|
||||
public void GetInventory(IClientAPI client, uint localID)
|
||||
{
|
||||
if (localID == this.m_localId)
|
||||
{
|
||||
client.SendTaskInventory(this.m_uuid, 0, new byte[0]);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
|
||||
{
|
||||
this.m_Shape.ExtraParams = new byte[data.Length + 7];
|
||||
|
||||
@@ -26,11 +26,14 @@
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using libsecondlife;
|
||||
using libsecondlife.Packets;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Framework.Communications.Caches;
|
||||
using OpenSim.Framework.Data;
|
||||
|
||||
namespace OpenSim.Region.Environment.Scenes
|
||||
{
|
||||
@@ -139,7 +142,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
/// <param name="fromAgentID"></param>
|
||||
public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
|
||||
{
|
||||
ScenePresence avatar = null;
|
||||
ScenePresence avatar = null;
|
||||
if (this.Avatars.ContainsKey(fromAgentID))
|
||||
{
|
||||
avatar = this.Avatars[fromAgentID];
|
||||
@@ -343,6 +346,29 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="primLocalID"></param>
|
||||
public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
|
||||
{
|
||||
Primitive prim = null;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObject)
|
||||
{
|
||||
prim = ((SceneObject)ent).HasChildPrim(primLocalID);
|
||||
if (prim != null)
|
||||
{
|
||||
prim.GetInventory(remoteClient, primLocalID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -622,6 +648,50 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// temporary method to test out creating new inventory items
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="transActionID"></param>
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="callbackID"></param>
|
||||
/// <param name="description"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="invType"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="wearableType"></param>
|
||||
/// <param name="nextOwnerMask"></param>
|
||||
public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask)
|
||||
{
|
||||
CachedUserInfo userInfo = commsManager.UserProfilesCache.GetUserDetails(remoteClient.AgentId);
|
||||
if (userInfo != null)
|
||||
{
|
||||
AssetBase asset = new AssetBase();
|
||||
asset.Name = name;
|
||||
asset.Description = description;
|
||||
asset.InvType = invType;
|
||||
asset.Type = type;
|
||||
asset.FullID = LLUUID.Random();
|
||||
asset.Data = new byte[0];
|
||||
this.assetCache.AddAsset(asset);
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.avatarID = remoteClient.AgentId;
|
||||
item.creatorsID = remoteClient.AgentId;
|
||||
item.inventoryID = LLUUID.Random();
|
||||
item.assetID = asset.FullID;
|
||||
item.inventoryDescription = description;
|
||||
item.inventoryName = name;
|
||||
item.type = invType;
|
||||
item.parentFolderID = folderID;
|
||||
item.inventoryCurrentPermissions = 2147483647;
|
||||
item.inventoryNextPermissions = nextOwnerMask;
|
||||
|
||||
userInfo.ItemReceive(remoteClient.AgentId, item);
|
||||
remoteClient.SendInventoryItemUpdate(item);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends prims to a client
|
||||
/// </summary>
|
||||
|
||||
@@ -37,7 +37,7 @@ using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Physics.Manager;
|
||||
using OpenSim.Region.Caches;
|
||||
using OpenSim.Framework.Communications.Caches;
|
||||
using OpenSim.Region.Environment.LandManagement;
|
||||
using OpenSim.Region.Scripting;
|
||||
using OpenSim.Region.Terrain;
|
||||
@@ -550,13 +550,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
m_estateManager.sendRegionHandshake(client);
|
||||
CreateAndAddScenePresence(client);
|
||||
m_LandManager.sendParcelOverlay(client);
|
||||
//commsManager.UserProfilesCache.AddNewUser(client.AgentId);
|
||||
commsManager.UserProfilesCache.AddNewUser(client.AgentId);
|
||||
}
|
||||
|
||||
protected virtual void SubscribeToClientEvents(IClientAPI client)
|
||||
{
|
||||
client.OnRegionHandShakeReply += SendLayerData;
|
||||
//remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims);
|
||||
client.OnModifyTerrain += ModifyTerrain;
|
||||
client.OnChatFromViewer += SimChat;
|
||||
client.OnInstantMessage += InstantMessage;
|
||||
client.OnRequestWearables += InformClientOfNeighbours;
|
||||
@@ -592,9 +593,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest);
|
||||
|
||||
client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
|
||||
|
||||
//client.OnCreateNewInventoryFolder += commsManager.UserProfilesCache.HandleCreateInventoryFolder;
|
||||
|
||||
// client.OnCreateNewInventoryItem += CreateNewInventoryItem;
|
||||
// client.OnCreateNewInventoryFolder += commsManager.UserProfilesCache.HandleCreateInventoryFolder;
|
||||
// client.OnFetchInventoryDescendents += commsManager.UserProfilesCache.HandleFecthInventoryDescendents;
|
||||
// client.OnRequestTaskInventory += RequestTaskInventory;
|
||||
}
|
||||
|
||||
protected ScenePresence CreateAndAddScenePresence(IClientAPI client)
|
||||
@@ -819,13 +822,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position)
|
||||
public void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
|
||||
{
|
||||
if (regionHandle == m_regInfo.RegionHandle)
|
||||
{
|
||||
if (Avatars.ContainsKey(agentID))
|
||||
{
|
||||
Avatars[agentID].MakeAvatar(position);
|
||||
Avatars[agentID].MakeAvatar(position, isFlying);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -909,7 +912,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
agent.startpos = new LLVector3(128, 128, 70);
|
||||
agent.child = true;
|
||||
commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
|
||||
commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position);
|
||||
commsManager.InterRegion.ExpectAvatarCrossing(regionHandle, remoteClient.AgentId, position, false);
|
||||
|
||||
remoteClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4));
|
||||
}
|
||||
@@ -922,9 +925,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
/// <param name="regionhandle"></param>
|
||||
/// <param name="agentID"></param>
|
||||
/// <param name="position"></param>
|
||||
public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position)
|
||||
public bool InformNeighbourOfCrossing(ulong regionhandle, LLUUID agentID, LLVector3 position, bool isFlying)
|
||||
{
|
||||
return commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position);
|
||||
return commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying);
|
||||
}
|
||||
|
||||
public void performParcelPrimCountUpdate()
|
||||
|
||||
@@ -32,7 +32,7 @@ using libsecondlife;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Region.Caches;
|
||||
using OpenSim.Framework.Communications.Caches;
|
||||
using OpenSim.Region.Terrain;
|
||||
using OpenSim.Framework;
|
||||
|
||||
|
||||
@@ -40,13 +40,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
private Encoding enc = Encoding.ASCII;
|
||||
private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group
|
||||
public Primitive rootPrimitive;
|
||||
private new Scene m_world;
|
||||
protected ulong m_regionHandle;
|
||||
|
||||
private bool physicsEnabled = false; // HOUSEKEEPING : Do we really need this?
|
||||
private PhysicsScene m_PhysScene; // HOUSEKEEPING : Do we really need this?
|
||||
private PhysicsActor m_PhysActor; // HOUSEKEEPING : Do we really need this?
|
||||
|
||||
private EventManager m_eventManager;
|
||||
|
||||
public bool isSelected = false;
|
||||
|
||||
@@ -66,6 +66,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
private IScenePresenceBody m_body; // HOUSEKEEPING : Do we really need this?
|
||||
|
||||
protected RegionInfo m_regionInfo;
|
||||
protected ulong crossingFromRegion = 0;
|
||||
|
||||
private Vector3[] Dir_Vectors = new Vector3[6];
|
||||
private enum Dir_ControlFlags
|
||||
@@ -183,10 +184,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
public void MakeAvatar(LLVector3 pos)
|
||||
public void MakeAvatar(LLVector3 pos, bool isFlying)
|
||||
{
|
||||
//this.childAvatar = false;
|
||||
this.Pos = pos;
|
||||
this._physActor.Flying = isFlying;
|
||||
this.newAvatar = true;
|
||||
this.childAgent = false;
|
||||
}
|
||||
@@ -194,8 +196,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
protected void MakeChildAgent()
|
||||
{
|
||||
this.Velocity = new LLVector3(0, 0, 0);
|
||||
this.Pos = new LLVector3(128, 128, 70);
|
||||
this.childAgent = true;
|
||||
//this.Pos = new LLVector3(128, 128, 70);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -551,11 +553,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle);
|
||||
if (neighbourRegion != null)
|
||||
{
|
||||
bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos);
|
||||
bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos, this._physActor.Flying);
|
||||
if (res)
|
||||
{
|
||||
this.MakeChildAgent();
|
||||
this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint);
|
||||
this.MakeChildAgent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user