mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 13:55:35 +08:00
Make ban, eject, freeze and the scripted versions of those work.
This commit is contained in:
@@ -6101,16 +6101,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public void llEjectFromLand(string pest)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
UUID agentId = new UUID();
|
||||
if (UUID.TryParse(pest, out agentId))
|
||||
UUID agentID = new UUID();
|
||||
if (UUID.TryParse(pest, out agentID))
|
||||
{
|
||||
ScenePresence presence = World.GetScenePresence(agentId);
|
||||
ScenePresence presence = World.GetScenePresence(agentID);
|
||||
if (presence != null)
|
||||
{
|
||||
// agent must be over the owners land
|
||||
if (m_host.OwnerID == World.LandChannel.GetLandObject(
|
||||
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
|
||||
World.TeleportClientHome(agentId, presence.ControllingClient);
|
||||
ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y);
|
||||
if (land == null)
|
||||
return;
|
||||
|
||||
if (m_host.OwnerID == land.LandData.OwnerID)
|
||||
{
|
||||
Vector3 pos = World.GetNearestAllowedPosition(presence, land);
|
||||
presence.TeleportWithMomentum(pos);
|
||||
presence.ControllingClient.SendAlertMessage("You have been ejected from this land");
|
||||
}
|
||||
}
|
||||
}
|
||||
ScriptSleep(5000);
|
||||
@@ -6804,24 +6811,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_host.AddScriptLPS(1);
|
||||
UUID key;
|
||||
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
|
||||
if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed))
|
||||
if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
int expires = 0;
|
||||
if (hours != 0)
|
||||
expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours);
|
||||
|
||||
if (UUID.TryParse(avatar, out key))
|
||||
{
|
||||
if (land.LandData.ParcelAccessList.FindIndex(
|
||||
delegate(ParcelManager.ParcelAccessEntry e)
|
||||
int idx = land.LandData.ParcelAccessList.FindIndex(
|
||||
delegate(LandAccessEntry e)
|
||||
{
|
||||
if (e.AgentID == key && e.Flags == AccessList.Access)
|
||||
return true;
|
||||
return false;
|
||||
}) == -1)
|
||||
{
|
||||
entry.AgentID = key;
|
||||
entry.Flags = AccessList.Access;
|
||||
entry.Time = DateTime.Now.AddHours(hours);
|
||||
land.LandData.ParcelAccessList.Add(entry);
|
||||
}
|
||||
});
|
||||
|
||||
if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires)))
|
||||
return;
|
||||
|
||||
if (idx != -1)
|
||||
land.LandData.ParcelAccessList.RemoveAt(idx);
|
||||
|
||||
LandAccessEntry entry = new LandAccessEntry();
|
||||
|
||||
entry.AgentID = key;
|
||||
entry.Flags = AccessList.Access;
|
||||
entry.Expires = expires;
|
||||
|
||||
land.LandData.ParcelAccessList.Add(entry);
|
||||
|
||||
World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
|
||||
}
|
||||
}
|
||||
ScriptSleep(100);
|
||||
@@ -10242,22 +10262,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
|
||||
if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
|
||||
int expires = 0;
|
||||
if (hours != 0)
|
||||
expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours);
|
||||
|
||||
if (UUID.TryParse(avatar, out key))
|
||||
{
|
||||
if (land.LandData.ParcelAccessList.FindIndex(
|
||||
delegate(ParcelManager.ParcelAccessEntry e)
|
||||
int idx = land.LandData.ParcelAccessList.FindIndex(
|
||||
delegate(LandAccessEntry e)
|
||||
{
|
||||
if (e.AgentID == key && e.Flags == AccessList.Ban)
|
||||
return true;
|
||||
return false;
|
||||
}) == -1)
|
||||
{
|
||||
entry.AgentID = key;
|
||||
entry.Flags = AccessList.Ban;
|
||||
entry.Time = DateTime.Now.AddHours(hours);
|
||||
land.LandData.ParcelAccessList.Add(entry);
|
||||
}
|
||||
});
|
||||
|
||||
if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires)))
|
||||
return;
|
||||
|
||||
if (idx != -1)
|
||||
land.LandData.ParcelAccessList.RemoveAt(idx);
|
||||
|
||||
LandAccessEntry entry = new LandAccessEntry();
|
||||
|
||||
entry.AgentID = key;
|
||||
entry.Flags = AccessList.Ban;
|
||||
entry.Expires = expires;
|
||||
|
||||
land.LandData.ParcelAccessList.Add(entry);
|
||||
|
||||
World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
|
||||
}
|
||||
}
|
||||
ScriptSleep(100);
|
||||
@@ -10273,7 +10306,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (UUID.TryParse(avatar, out key))
|
||||
{
|
||||
int idx = land.LandData.ParcelAccessList.FindIndex(
|
||||
delegate(ParcelManager.ParcelAccessEntry e)
|
||||
delegate(LandAccessEntry e)
|
||||
{
|
||||
if (e.AgentID == key && e.Flags == AccessList.Access)
|
||||
return true;
|
||||
@@ -10281,7 +10314,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
});
|
||||
|
||||
if (idx != -1)
|
||||
{
|
||||
land.LandData.ParcelAccessList.RemoveAt(idx);
|
||||
World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
|
||||
}
|
||||
}
|
||||
}
|
||||
ScriptSleep(100);
|
||||
@@ -10297,7 +10333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (UUID.TryParse(avatar, out key))
|
||||
{
|
||||
int idx = land.LandData.ParcelAccessList.FindIndex(
|
||||
delegate(ParcelManager.ParcelAccessEntry e)
|
||||
delegate(LandAccessEntry e)
|
||||
{
|
||||
if (e.AgentID == key && e.Flags == AccessList.Ban)
|
||||
return true;
|
||||
@@ -10305,7 +10341,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
});
|
||||
|
||||
if (idx != -1)
|
||||
{
|
||||
land.LandData.ParcelAccessList.RemoveAt(idx);
|
||||
World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
|
||||
}
|
||||
}
|
||||
}
|
||||
ScriptSleep(100);
|
||||
@@ -10625,7 +10664,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
|
||||
if (land.OwnerID == m_host.OwnerID)
|
||||
{
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList)
|
||||
foreach (LandAccessEntry entry in land.ParcelAccessList)
|
||||
{
|
||||
if (entry.Flags == AccessList.Ban)
|
||||
{
|
||||
@@ -10642,7 +10681,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
|
||||
if (land.OwnerID == m_host.OwnerID)
|
||||
{
|
||||
foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList)
|
||||
foreach (LandAccessEntry entry in land.ParcelAccessList)
|
||||
{
|
||||
if (entry.Flags == AccessList.Access)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user