*Added delegates and events for parcel and estate management
*Only thing left is to get the master user setup in both sandbox and grid modeSugilite
parent
9d1eacad7a
commit
2c04171990
|
@ -34,6 +34,8 @@ namespace OpenSim.Framework.Interfaces
|
|||
public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client);
|
||||
public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); // NOTETOSELFremove the packet part
|
||||
|
||||
public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client);
|
||||
|
||||
public interface IClientAPI
|
||||
{
|
||||
event ChatFromViewer OnChatFromViewer;
|
||||
|
@ -61,6 +63,13 @@ namespace OpenSim.Framework.Interfaces
|
|||
event NewAvatar OnNewAvatar;
|
||||
event GenericCall6 OnRemoveAvatar;
|
||||
|
||||
event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
||||
event ParcelDivideRequest OnParcelDivideRequest;
|
||||
event ParcelJoinRequest OnParcelJoinRequest;
|
||||
event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
|
||||
|
||||
event EstateOwnerMessageRequest OnEstateOwnerMessage;
|
||||
|
||||
LLVector3 StartPos
|
||||
{
|
||||
get;
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Text;
|
|||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Inventory;
|
||||
using OpenSim.Framework.Types;
|
||||
|
||||
using libsecondlife;
|
||||
using libsecondlife.Packets;
|
||||
|
||||
|
@ -36,6 +37,13 @@ namespace OpenSim
|
|||
public event NewAvatar OnNewAvatar;
|
||||
public event GenericCall6 OnRemoveAvatar;
|
||||
|
||||
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
||||
public event ParcelDivideRequest OnParcelDivideRequest;
|
||||
public event ParcelJoinRequest OnParcelJoinRequest;
|
||||
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
|
||||
|
||||
public event EstateOwnerMessageRequest OnEstateOwnerMessage;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -454,6 +454,31 @@ namespace OpenSim
|
|||
break;
|
||||
#endregion
|
||||
|
||||
#region Parcel related packets
|
||||
case PacketType.ParcelPropertiesRequest:
|
||||
ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack;
|
||||
OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North), propertiesRequest.ParcelData.SequenceID, propertiesRequest.ParcelData.SnapSelection, this);
|
||||
break;
|
||||
case PacketType.ParcelDivide:
|
||||
ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack;
|
||||
OnParcelDivideRequest((int)Math.Round(parcelDivide.ParcelData.West), (int)Math.Round(parcelDivide.ParcelData.South), (int)Math.Round(parcelDivide.ParcelData.East), (int)Math.Round(parcelDivide.ParcelData.North), this);
|
||||
break;
|
||||
case PacketType.ParcelJoin:
|
||||
ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack;
|
||||
OnParcelJoinRequest((int)Math.Round(parcelJoin.ParcelData.West), (int)Math.Round(parcelJoin.ParcelData.South), (int)Math.Round(parcelJoin.ParcelData.East), (int)Math.Round(parcelJoin.ParcelData.North), this);
|
||||
break;
|
||||
case PacketType.ParcelPropertiesUpdate:
|
||||
ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack;
|
||||
OnParcelPropertiesUpdateRequest(updatePacket, this);
|
||||
break;
|
||||
#endregion
|
||||
|
||||
#region Estate Packets
|
||||
case PacketType.EstateOwnerMessage:
|
||||
EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
|
||||
OnEstateOwnerMessage(messagePacket, this);
|
||||
break;
|
||||
#endregion
|
||||
#region unimplemented handlers
|
||||
case PacketType.AgentIsNowWearing:
|
||||
// AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
|
||||
|
|
|
@ -83,6 +83,13 @@ namespace OpenSim.world
|
|||
ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
|
||||
ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
|
||||
* */
|
||||
|
||||
ControllingClient.OnParcelPropertiesRequest +=new ParcelPropertiesRequest(this.m_world.parcelManager.handleParcelPropertiesRequest);
|
||||
ControllingClient.OnParcelDivideRequest += new ParcelDivideRequest(this.m_world.parcelManager.handleParcelDivideRequest);
|
||||
ControllingClient.OnParcelJoinRequest += new ParcelJoinRequest(this.m_world.parcelManager.handleParcelJoinRequest);
|
||||
ControllingClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(this.m_world.parcelManager.handleParcelPropertiesUpdateRequest);
|
||||
|
||||
ControllingClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(this.m_world.estateManager.handleEstateOwnerMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -166,7 +166,7 @@ namespace OpenSim.world
|
|||
parcelList.Remove(local_id);
|
||||
}
|
||||
|
||||
public void performFinalParcelJoin(Parcel master, Parcel slave)
|
||||
private void performFinalParcelJoin(Parcel master, Parcel slave)
|
||||
{
|
||||
int x, y;
|
||||
bool[,] parcelBitmapSlave = slave.getParcelBitmap();
|
||||
|
@ -212,7 +212,7 @@ namespace OpenSim.world
|
|||
/// <param name="end_y">North Point</param>
|
||||
/// <param name="attempting_user_id">LLUUID of user who is trying to subdivide</param>
|
||||
/// <returns>Returns true if successful</returns>
|
||||
public bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id)
|
||||
private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id)
|
||||
{
|
||||
//First, lets loop through the points and make sure they are all in the same parcel
|
||||
//Get the parcel at start
|
||||
|
@ -278,7 +278,7 @@ namespace OpenSim.world
|
|||
/// <param name="end_y">y value in second parcel</param>
|
||||
/// <param name="attempting_user_id">LLUUID of the avatar trying to join the parcels</param>
|
||||
/// <returns>Returns true if successful</returns>
|
||||
public bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id)
|
||||
private bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id)
|
||||
{
|
||||
end_x -= 4;
|
||||
end_y -= 4;
|
||||
|
@ -406,6 +406,58 @@ namespace OpenSim.world
|
|||
packet.ParcelData.SequenceID = sequenceID; //Eh?
|
||||
remote_client.OutPacket((Packet)packet);
|
||||
}
|
||||
|
||||
public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client)
|
||||
{
|
||||
//Get the parcels within the bounds
|
||||
List<Parcel> temp = new List<Parcel>();
|
||||
int x, y, i;
|
||||
int inc_x = end_x - start_x;
|
||||
int inc_y = end_y - start_y;
|
||||
for (x = 0; x < inc_x; x++)
|
||||
{
|
||||
for (y = 0; y < inc_y; y++)
|
||||
{
|
||||
OpenSim.world.Parcel currentParcel = getParcel(start_x + x, start_y + y);
|
||||
if (!temp.Contains(currentParcel))
|
||||
{
|
||||
currentParcel.forceUpdateParcelInfo();
|
||||
temp.Add(currentParcel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int requestResult = ParcelManager.PARCEL_RESULT_ONE_PARCEL;
|
||||
if (temp.Count > 1)
|
||||
{
|
||||
requestResult = ParcelManager.PARCEL_RESULT_MULTIPLE_PARCELS;
|
||||
}
|
||||
|
||||
for (i = 0; i < temp.Count; i++)
|
||||
{
|
||||
temp[i].sendParcelProperties(sequence_id, snap_selection, requestResult, remote_client);
|
||||
}
|
||||
|
||||
|
||||
sendParcelOverlay(remote_client);
|
||||
}
|
||||
|
||||
public void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client)
|
||||
{
|
||||
if (parcelList.ContainsKey(packet.ParcelData.LocalID))
|
||||
{
|
||||
parcelList[packet.ParcelData.LocalID].updateParcelProperties(packet, remote_client);
|
||||
}
|
||||
}
|
||||
public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client)
|
||||
{
|
||||
subdivide(west, south, east, north, remote_client.AgentId);
|
||||
}
|
||||
public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client)
|
||||
{
|
||||
join(west, south, east, north, remote_client.AgentId);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -217,6 +217,16 @@ namespace OpenSim.world
|
|||
Entities[UUID].BackUp();
|
||||
}
|
||||
|
||||
//Parcel backup routines
|
||||
ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count];
|
||||
int i = 0;
|
||||
foreach (OpenSim.world.Parcel parcel in parcelManager.parcelList.Values)
|
||||
{
|
||||
parcels[i] = parcel.parcelData;
|
||||
i++;
|
||||
}
|
||||
localStorage.SaveParcels(parcels);
|
||||
|
||||
// Backup successful
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -253,6 +253,8 @@ namespace OpenSim
|
|||
LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine);
|
||||
LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D());
|
||||
LocalWorld.LoadPrimsFromStorage();
|
||||
LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager);
|
||||
|
||||
|
||||
LocalWorld.StartTimer();
|
||||
}
|
||||
|
@ -417,11 +419,14 @@ namespace OpenSim
|
|||
break;
|
||||
|
||||
case "show":
|
||||
Show(cmdparams[0]);
|
||||
if (cmdparams.Length > 0)
|
||||
{
|
||||
Show(cmdparams[0]);
|
||||
}
|
||||
break;
|
||||
|
||||
case "terrain":
|
||||
string result = "";
|
||||
//string result = "";
|
||||
/* if (!((World)m_localWorld).Terrain.RunTerrainCmd(cmdparams, ref result))
|
||||
{
|
||||
m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, result);
|
||||
|
|
Loading…
Reference in New Issue