Added very basic support for maps (likely to only work in sandbox mode due to the non functioning remote asset server), also currently just uses textures that we already had added to the asset server (this is the first thing that needs fixing)
parent
dd6f96bf2b
commit
05d9593198
|
@ -225,7 +225,7 @@ namespace OpenSim
|
|||
|
||||
m_console.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL,"Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString());
|
||||
m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Initialising world");
|
||||
LocalWorld = new World(this._packetServer.ClientThreads, regionData.RegionHandle, regionData.RegionName);
|
||||
LocalWorld = new World(this._packetServer.ClientThreads, regionData, regionData.RegionHandle, regionData.RegionName);
|
||||
LocalWorld.InventoryCache = InventoryCache;
|
||||
LocalWorld.AssetCache = AssetCache;
|
||||
|
||||
|
|
|
@ -642,6 +642,13 @@ namespace OpenSim
|
|||
}
|
||||
}
|
||||
break;
|
||||
case PacketType.MapLayerRequest:
|
||||
this.RequestMapLayer();
|
||||
break;
|
||||
case PacketType.MapBlockRequest:
|
||||
MapBlockRequestPacket MapRequest = (MapBlockRequestPacket)Pack;
|
||||
this.RequestMapBlock( MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1116,5 +1123,29 @@ namespace OpenSim
|
|||
m_assetCache.AddAsset(asset);
|
||||
m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset);
|
||||
}
|
||||
|
||||
public void RequestMapLayer() //should be getting the map layer from the grid server
|
||||
{
|
||||
//send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area)
|
||||
MapLayerReplyPacket mapReply = new MapLayerReplyPacket();
|
||||
mapReply.AgentData.AgentID = this.AgentID;
|
||||
mapReply.AgentData.Flags = 0;
|
||||
mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1];
|
||||
mapReply.LayerData[0] = new MapLayerReplyPacket.LayerDataBlock();
|
||||
mapReply.LayerData[0].Bottom = 800;
|
||||
mapReply.LayerData[0].Left = 800;
|
||||
mapReply.LayerData[0].Top = 1200;
|
||||
mapReply.LayerData[0].Right = 1200;
|
||||
mapReply.LayerData[0].ImageID = new LLUUID("00000000-0000-0000-9999-000000000001");
|
||||
this.OutPacket(mapReply);
|
||||
}
|
||||
|
||||
public void RequestMapBlock( int minX, int minY, int maxX, int maxY)
|
||||
{
|
||||
//check if our own map was requested
|
||||
this.m_world.RequestMapBlock(this, minX, minY, maxX, maxY);
|
||||
|
||||
//now should get other regions maps from gridserver
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,17 @@ namespace OpenSim.world
|
|||
this._physActor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override LLVector3 Pos
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Pos;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Pos = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public Primitive2(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, World world)
|
||||
|
@ -106,6 +116,11 @@ namespace OpenSim.world
|
|||
|
||||
#region Packet handlers
|
||||
|
||||
public void UpdatePosition(LLVector3 pos)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket)
|
||||
{
|
||||
this.primData.PathBegin = addPacket.PathBegin;
|
||||
|
@ -230,6 +245,7 @@ namespace OpenSim.world
|
|||
|
||||
#region Update viewers Methods
|
||||
|
||||
//should change these mehtods, so that outgoing packets are sent through the avatar class
|
||||
public void SendFullUpdateToClient(SimClient remoteClient)
|
||||
{
|
||||
LLVector3 lPos;
|
||||
|
@ -346,7 +362,7 @@ namespace OpenSim.world
|
|||
objdata.ObjectData[47] = 63;
|
||||
}
|
||||
|
||||
protected void UpdatePacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData)
|
||||
protected void SetPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData)
|
||||
{
|
||||
objectData.OwnerID = this.primData.OwnerID;
|
||||
objectData.PCode = this.primData.PCode;
|
||||
|
@ -378,7 +394,7 @@ namespace OpenSim.world
|
|||
ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock();
|
||||
this.SetDefaultPacketValues(objupdate);
|
||||
objupdate.UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456;
|
||||
this.UpdatePacketShapeData(objupdate);
|
||||
this.SetPacketShapeData(objupdate);
|
||||
byte[] pb = this.Pos.GetBytes();
|
||||
Array.Copy(pb, 0, objupdate.ObjectData, 0, pb.Length);
|
||||
return objupdate;
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace OpenSim.world
|
|||
private InventoryCache _inventoryCache;
|
||||
private AssetCache _assetCache;
|
||||
private Mutex updateLock;
|
||||
|
||||
private RegionInfo m_regInfo;
|
||||
public string m_datastore;
|
||||
|
||||
/// <summary>
|
||||
|
@ -52,7 +52,7 @@ namespace OpenSim.world
|
|||
/// <param name="clientThreads">Dictionary to contain client threads</param>
|
||||
/// <param name="regionHandle">Region Handle for this region</param>
|
||||
/// <param name="regionName">Region Name for this region</param>
|
||||
public World(Dictionary<uint, SimClient> clientThreads, ulong regionHandle, string regionName)
|
||||
public World(Dictionary<uint, SimClient> clientThreads, RegionInfo regInfo, ulong regionHandle, string regionName)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -60,6 +60,7 @@ namespace OpenSim.world
|
|||
m_clientThreads = clientThreads;
|
||||
m_regionHandle = regionHandle;
|
||||
m_regionName = regionName;
|
||||
m_regInfo = regInfo;
|
||||
|
||||
m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>();
|
||||
m_scripts = new Dictionary<string, ScriptFactory>();
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace OpenSim.world
|
|||
switch (inchatpack.ChatData.Type)
|
||||
{
|
||||
case 0:
|
||||
int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X),(int)( client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
|
||||
int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
|
||||
if ((dis < 10) && (dis > -10))
|
||||
{
|
||||
client.OutPacket(reply);
|
||||
|
@ -79,7 +79,7 @@ namespace OpenSim.world
|
|||
}
|
||||
break;
|
||||
case 2:
|
||||
dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X),(int)( client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
|
||||
dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
|
||||
if ((dis < 100) && (dis > -100))
|
||||
{
|
||||
client.OutPacket(reply);
|
||||
|
@ -203,5 +203,27 @@ namespace OpenSim.world
|
|||
return true;
|
||||
}
|
||||
|
||||
public void RequestMapBlock(SimClient simClient, int minX, int minY, int maxX, int maxY)
|
||||
{
|
||||
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||
if (((m_regInfo.RegionLocX > minX) && (m_regInfo.RegionLocX < maxX)) && ((m_regInfo.RegionLocY > minY) && (m_regInfo.RegionLocY < maxY)))
|
||||
{
|
||||
MapBlockReplyPacket mapReply = new MapBlockReplyPacket();
|
||||
mapReply.AgentData.AgentID = simClient.AgentID;
|
||||
mapReply.AgentData.Flags = 0;
|
||||
mapReply.Data = new MapBlockReplyPacket.DataBlock[1];
|
||||
mapReply.Data[0] = new MapBlockReplyPacket.DataBlock();
|
||||
mapReply.Data[0].MapImageID = new LLUUID("00000000-0000-0000-9999-000000000002");
|
||||
mapReply.Data[0].X = (ushort)m_regInfo.RegionLocX;
|
||||
mapReply.Data[0].Y = (ushort)m_regInfo.RegionLocY;
|
||||
mapReply.Data[0].WaterHeight =(byte) m_regInfo.RegionWaterHeight;
|
||||
mapReply.Data[0].Name = _enc.GetBytes(this.m_regionName);
|
||||
mapReply.Data[0].RegionFlags = 72458694;
|
||||
mapReply.Data[0].Access = 13;
|
||||
mapReply.Data[0].Agents = 1; //should send number of clients connected
|
||||
simClient.OutPacket(mapReply);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,21 +168,21 @@ namespace OpenSim.UserServer
|
|||
XmlRpcResponse response = loginResponse.ToXmlRpcResponse();
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
|
||||
// inventory
|
||||
// ArrayList InventoryList = (ArrayList)responseData["inventory-skeleton"];
|
||||
// Hashtable Inventory1 = (Hashtable)InventoryList[0];
|
||||
// Hashtable Inventory2 = (Hashtable)InventoryList[1];
|
||||
// LLUUID BaseFolderID = LLUUID.Random();
|
||||
// LLUUID InventoryFolderID = LLUUID.Random();
|
||||
// Inventory2["name"] = "Textures";
|
||||
// Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
|
||||
// Inventory2["type_default"] = 0;
|
||||
// Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||
|
||||
// ArrayList InventoryRoot = (ArrayList)responseData["inventory-root"];
|
||||
// Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
|
||||
// Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||
//inventory
|
||||
/* ArrayList InventoryList = (ArrayList)responseData["inventory-skeleton"];
|
||||
Hashtable Inventory1 = (Hashtable)InventoryList[0];
|
||||
Hashtable Inventory2 = (Hashtable)InventoryList[1];
|
||||
LLUUID BaseFolderID = LLUUID.Random();
|
||||
LLUUID InventoryFolderID = LLUUID.Random();
|
||||
Inventory2["name"] = "Textures";
|
||||
Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
|
||||
Inventory2["type_default"] = 0;
|
||||
Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||
|
||||
ArrayList InventoryRoot = (ArrayList)responseData["inventory-root"];
|
||||
Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
|
||||
Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||
*/
|
||||
CustomiseLoginResponse(responseData, first, last);
|
||||
|
||||
Login _login = new Login();
|
||||
|
|
|
@ -31,11 +31,11 @@ namespace OpenSim
|
|||
sandBoxMode = true;
|
||||
startLoginServer = true;
|
||||
}
|
||||
|
||||
/*
|
||||
if (args[i] == "-loginserver")
|
||||
{
|
||||
startLoginServer = true;
|
||||
}
|
||||
}*/
|
||||
if (args[i] == "-accounts")
|
||||
{
|
||||
userAccounts = true;
|
||||
|
|
Loading…
Reference in New Issue