*Made a much more network friendly method of ban and pass line sending
*Added an event that is triggered when an agent enters a new parcelafrisby
parent
24bd5ad399
commit
a596b7696a
|
@ -227,10 +227,14 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
}
|
||||
}
|
||||
|
||||
public bool isBannedFromLand(ParcelManager.ParcelAccessEntry entry, IClientAPI remote_client)
|
||||
public bool isBannedFromLand(LLUUID avatar)
|
||||
{
|
||||
if ((this.landData.landFlags & (uint)Parcel.ParcelFlags.UseBanList) > 0)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
entry.AgentID = avatar;
|
||||
entry.Flags = ParcelManager.AccessList.Ban;
|
||||
entry.Time = new DateTime();
|
||||
if (this.landData.parcelAccessList.Contains(entry))
|
||||
{
|
||||
//They are banned, so lets send them a notice about this parcel
|
||||
|
@ -239,6 +243,24 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool isRestrictedFromLand(LLUUID avatar)
|
||||
{
|
||||
if ((this.landData.landFlags & (uint)Parcel.ParcelFlags.UseAccessList) > 0)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
entry.AgentID = avatar;
|
||||
entry.Flags = ParcelManager.AccessList.Access;
|
||||
entry.Time = new DateTime();
|
||||
if (!this.landData.parcelAccessList.Contains(entry))
|
||||
{
|
||||
//They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void sendLandUpdateToClient(IClientAPI remote_client)
|
||||
{
|
||||
sendLandProperties(0, false, 0, remote_client);
|
||||
|
|
|
@ -76,35 +76,6 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
|
||||
#endregion
|
||||
|
||||
#region Events and Triggers
|
||||
public delegate void LandObjectAdded(Land newParcel, LLUUID regionUUID);
|
||||
public delegate void LandObjectRemoved(LLUUID globalID);
|
||||
|
||||
public event LandObjectAdded OnLandObjectAdded;
|
||||
public event LandObjectRemoved OnLandObjectRemoved;
|
||||
|
||||
public void triggerLandObjectAdded(Land newParcel)
|
||||
{
|
||||
if (OnLandObjectAdded != null)
|
||||
{
|
||||
OnLandObjectAdded(newParcel, m_scene.RegionInfo.RegionID);
|
||||
}
|
||||
}
|
||||
public void triggerLandObjectRemoved(LLUUID globalID)
|
||||
{
|
||||
if (OnLandObjectRemoved != null)
|
||||
{
|
||||
OnLandObjectRemoved(globalID);
|
||||
}
|
||||
}
|
||||
public void triggerLandObjectUpdated(uint localParcelID, Land newParcel)
|
||||
{
|
||||
//triggerLandObjectRemoved(localParcelID);
|
||||
triggerLandObjectAdded(newParcel);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Member Variables
|
||||
|
||||
public Dictionary<int, Land> landList = new Dictionary<int, Land>();
|
||||
|
@ -128,6 +99,8 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
m_scene = scene;
|
||||
m_regInfo = reginfo;
|
||||
landIDList.Initialize();
|
||||
scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(handleAvatarChangingParcel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -170,6 +143,7 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
/// <returns></returns>
|
||||
public Land createBaseLand()
|
||||
{
|
||||
|
||||
return new Land(LLUUID.Zero, false, m_scene);
|
||||
}
|
||||
|
||||
|
@ -197,7 +171,7 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
}
|
||||
}
|
||||
landList[lastLandLocalID].forceUpdateLandInfo();
|
||||
triggerLandObjectAdded(new_land);
|
||||
m_scene.EventManager.TriggerLandObjectAdded(new_land,m_scene.RegionInfo.RegionID);
|
||||
return new_land;
|
||||
}
|
||||
|
||||
|
@ -219,7 +193,7 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
}
|
||||
}
|
||||
|
||||
triggerLandObjectRemoved(landList[local_id].landData.globalID);
|
||||
m_scene.EventManager.TriggerLandObjectRemoved(landList[local_id].landData.globalID);
|
||||
landList.Remove(local_id);
|
||||
}
|
||||
|
||||
|
@ -228,7 +202,7 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
if (landList.ContainsKey(local_id))
|
||||
{
|
||||
landList[local_id].landData = newData.Copy();
|
||||
triggerLandObjectUpdated((uint)local_id, landList[local_id]);
|
||||
m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, landList[local_id]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -590,18 +564,70 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
addLandObject(fullSimParcel);
|
||||
}
|
||||
|
||||
public List<Land> parcelsNearPoint(LLVector3 position)
|
||||
{
|
||||
|
||||
List<Land> parcelsNear = new List<Land>();
|
||||
int x, y;
|
||||
for (x = -4; x <= 4; x += 4)
|
||||
{
|
||||
for (y = -4; y <= 4; y += 4)
|
||||
{
|
||||
Land check = getLandObject(position.X + x, position.Y + y);
|
||||
if (!parcelsNear.Contains(check))
|
||||
{
|
||||
parcelsNear.Add(check);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parcelsNear;
|
||||
|
||||
}
|
||||
|
||||
public void handleAvatarChangingParcel(ScenePresence avatar, int localLandID, LLUUID regionID)
|
||||
{
|
||||
if (m_scene.RegionInfo.RegionID == regionID)
|
||||
{
|
||||
if (landList[localLandID] != null)
|
||||
{
|
||||
Land parcelAvatarIsEntering = landList[localLandID];
|
||||
if (parcelAvatarIsEntering.isBannedFromLand(avatar.UUID))
|
||||
{
|
||||
avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because you are banned. Please go away. <3 OpenSim Developers");
|
||||
|
||||
}
|
||||
else if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID))
|
||||
{
|
||||
avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because the land owner has restricted access. Please go away. <3 OpenSim Developers");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sendOutBannedNotices(IClientAPI avatar)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
entry.AgentID = avatar.AgentId;
|
||||
entry.Flags = ParcelManager.AccessList.Ban;
|
||||
entry.Time = new DateTime();
|
||||
|
||||
foreach (Land checkBan in landList.Values)
|
||||
List<ScenePresence> avatars = m_scene.GetAvatars();
|
||||
foreach (ScenePresence presence in avatars)
|
||||
{
|
||||
if (checkBan.isBannedFromLand(entry, avatar))
|
||||
if (presence.UUID == avatar.AgentId)
|
||||
{
|
||||
List<Land> checkLandParcels = parcelsNearPoint(presence.AbsolutePosition);
|
||||
foreach (Land checkBan in checkLandParcels)
|
||||
{
|
||||
if (checkBan.isBannedFromLand(avatar.AgentId))
|
||||
{
|
||||
checkBan.sendLandProperties(-30000, false, (int)ParcelManager.ParcelResult.Single, avatar);
|
||||
return; //Only send one
|
||||
}
|
||||
else if (checkBan.isRestrictedFromLand(avatar.AgentId))
|
||||
{
|
||||
checkBan.sendLandProperties(-40000, false, (int)ParcelManager.ParcelResult.Single, avatar);
|
||||
return; //Only send one
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -614,6 +640,11 @@ namespace OpenSim.Region.Environment.LandManagement
|
|||
if (over != null)
|
||||
{
|
||||
over.sendLandUpdateToClient(avatar.ControllingClient);
|
||||
if (avatar.currentParcelUUID != over.landData.globalID)
|
||||
{
|
||||
avatar.currentParcelUUID = over.landData.globalID;
|
||||
m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID, this.m_scene.RegionInfo.RegionID);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -230,8 +230,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_LandManager = new LandManager(this, m_regInfo);
|
||||
|
||||
//Bind Storage Manager functions to some land manager functions for this scene
|
||||
m_LandManager.OnLandObjectAdded += new LandManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject);
|
||||
m_LandManager.OnLandObjectRemoved += new LandManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject);
|
||||
EventManager.OnLandObjectAdded += new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject);
|
||||
EventManager.OnLandObjectRemoved += new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject);
|
||||
|
||||
m_estateManager = new EstateManager(this, m_regInfo);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
using libsecondlife;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.LandManagement;
|
||||
|
||||
namespace OpenSim.Region.Environment.Scenes
|
||||
{
|
||||
|
@ -78,6 +79,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
|
||||
|
||||
public event ObjectGrabDelegate OnObjectGrab;
|
||||
|
||||
public event OnPermissionErrorDelegate OnPermissionError;
|
||||
|
||||
public delegate void NewRezScript(uint localID, LLUUID itemID, string script);
|
||||
|
@ -96,6 +98,18 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
public event SceneGroupGrabed OnSceneGroupGrab;
|
||||
|
||||
public delegate void LandObjectAdded(Land newParcel, LLUUID regionUUID);
|
||||
|
||||
public event LandObjectAdded OnLandObjectAdded;
|
||||
|
||||
public delegate void LandObjectRemoved(LLUUID globalID);
|
||||
|
||||
public event LandObjectRemoved OnLandObjectRemoved;
|
||||
|
||||
public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, LLUUID regionID);
|
||||
|
||||
public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
|
||||
|
||||
public void TriggerPermissionError(LLUUID user, string reason)
|
||||
{
|
||||
if (OnPermissionError != null)
|
||||
|
@ -210,5 +224,33 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
OnSceneGroupGrab(groupID, offset, userID);
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerLandObjectAdded(Land newParcel,LLUUID regionID)
|
||||
{
|
||||
if (OnLandObjectAdded != null)
|
||||
{
|
||||
OnLandObjectAdded(newParcel, regionID);
|
||||
}
|
||||
}
|
||||
public void TriggerLandObjectRemoved(LLUUID globalID)
|
||||
{
|
||||
if (OnLandObjectRemoved != null)
|
||||
{
|
||||
OnLandObjectRemoved(globalID);
|
||||
}
|
||||
}
|
||||
public void TriggerLandObjectUpdated(uint localParcelID, Land newParcel)
|
||||
{
|
||||
//triggerLandObjectRemoved(localParcelID);
|
||||
TriggerLandObjectAdded(newParcel,newParcel.m_scene.RegionInfo.RegionID);
|
||||
}
|
||||
|
||||
public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, LLUUID regionID)
|
||||
{
|
||||
if (OnAvatarEnteringNewParcel != null)
|
||||
{
|
||||
OnAvatarEnteringNewParcel(avatar, localLandID, regionID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
public static AvatarAnimations Animations;
|
||||
public static byte[] DefaultTexture;
|
||||
|
||||
public LLUUID currentParcelUUID = LLUUID.Zero;
|
||||
private List<LLUUID> m_animations = new List<LLUUID>();
|
||||
private List<int> m_animationSeqs = new List<int>();
|
||||
|
||||
|
@ -448,6 +448,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void forceAvatarMovement(Vector3 position, Quaternion rotation)
|
||||
{
|
||||
AddNewMovement(position, rotation);
|
||||
}
|
||||
|
||||
#region Status Methods
|
||||
/// <summary>
|
||||
/// This turns a child agent, into a root agent
|
||||
|
|
Loading…
Reference in New Issue