diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 99 |
1 files changed, 68 insertions, 31 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 67dee02..0bdd84a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5714,16 +5714,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5714 | public void llEjectFromLand(string pest) | 5714 | public void llEjectFromLand(string pest) |
5715 | { | 5715 | { |
5716 | m_host.AddScriptLPS(1); | 5716 | m_host.AddScriptLPS(1); |
5717 | UUID agentId = new UUID(); | 5717 | UUID agentID = new UUID(); |
5718 | if (UUID.TryParse(pest, out agentId)) | 5718 | if (UUID.TryParse(pest, out agentID)) |
5719 | { | 5719 | { |
5720 | ScenePresence presence = World.GetScenePresence(agentId); | 5720 | ScenePresence presence = World.GetScenePresence(agentID); |
5721 | if (presence != null) | 5721 | if (presence != null) |
5722 | { | 5722 | { |
5723 | // agent must be over the owners land | 5723 | // agent must be over the owners land |
5724 | if (m_host.OwnerID == World.LandChannel.GetLandObject( | 5724 | ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); |
5725 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 5725 | if (land == null) |
5726 | World.TeleportClientHome(agentId, presence.ControllingClient); | 5726 | return; |
5727 | |||
5728 | if (m_host.OwnerID == land.LandData.OwnerID) | ||
5729 | { | ||
5730 | World.TeleportClientHome(agentID, presence.ControllingClient); | ||
5731 | } | ||
5727 | } | 5732 | } |
5728 | } | 5733 | } |
5729 | ScriptSleep(5000); | 5734 | ScriptSleep(5000); |
@@ -6408,24 +6413,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6408 | m_host.AddScriptLPS(1); | 6413 | m_host.AddScriptLPS(1); |
6409 | UUID key; | 6414 | UUID key; |
6410 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 6415 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
6411 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) | 6416 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
6412 | { | 6417 | { |
6413 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 6418 | int expires = 0; |
6419 | if (hours != 0) | ||
6420 | expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours); | ||
6421 | |||
6414 | if (UUID.TryParse(avatar, out key)) | 6422 | if (UUID.TryParse(avatar, out key)) |
6415 | { | 6423 | { |
6416 | if (land.LandData.ParcelAccessList.FindIndex( | 6424 | int idx = land.LandData.ParcelAccessList.FindIndex( |
6417 | delegate(ParcelManager.ParcelAccessEntry e) | 6425 | delegate(LandAccessEntry e) |
6418 | { | 6426 | { |
6419 | if (e.AgentID == key && e.Flags == AccessList.Access) | 6427 | if (e.AgentID == key && e.Flags == AccessList.Access) |
6420 | return true; | 6428 | return true; |
6421 | return false; | 6429 | return false; |
6422 | }) == -1) | 6430 | }); |
6423 | { | 6431 | |
6424 | entry.AgentID = key; | 6432 | if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires))) |
6425 | entry.Flags = AccessList.Access; | 6433 | return; |
6426 | entry.Time = DateTime.Now.AddHours(hours); | 6434 | |
6427 | land.LandData.ParcelAccessList.Add(entry); | 6435 | if (idx != -1) |
6428 | } | 6436 | land.LandData.ParcelAccessList.RemoveAt(idx); |
6437 | |||
6438 | LandAccessEntry entry = new LandAccessEntry(); | ||
6439 | |||
6440 | entry.AgentID = key; | ||
6441 | entry.Flags = AccessList.Access; | ||
6442 | entry.Expires = expires; | ||
6443 | |||
6444 | land.LandData.ParcelAccessList.Add(entry); | ||
6445 | |||
6446 | World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); | ||
6429 | } | 6447 | } |
6430 | } | 6448 | } |
6431 | ScriptSleep(100); | 6449 | ScriptSleep(100); |
@@ -9679,22 +9697,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9679 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 9697 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
9680 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) | 9698 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
9681 | { | 9699 | { |
9682 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 9700 | int expires = 0; |
9701 | if (hours != 0) | ||
9702 | expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours); | ||
9703 | |||
9683 | if (UUID.TryParse(avatar, out key)) | 9704 | if (UUID.TryParse(avatar, out key)) |
9684 | { | 9705 | { |
9685 | if (land.LandData.ParcelAccessList.FindIndex( | 9706 | int idx = land.LandData.ParcelAccessList.FindIndex( |
9686 | delegate(ParcelManager.ParcelAccessEntry e) | 9707 | delegate(LandAccessEntry e) |
9687 | { | 9708 | { |
9688 | if (e.AgentID == key && e.Flags == AccessList.Ban) | 9709 | if (e.AgentID == key && e.Flags == AccessList.Ban) |
9689 | return true; | 9710 | return true; |
9690 | return false; | 9711 | return false; |
9691 | }) == -1) | 9712 | }); |
9692 | { | 9713 | |
9693 | entry.AgentID = key; | 9714 | if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires))) |
9694 | entry.Flags = AccessList.Ban; | 9715 | return; |
9695 | entry.Time = DateTime.Now.AddHours(hours); | 9716 | |
9696 | land.LandData.ParcelAccessList.Add(entry); | 9717 | if (idx != -1) |
9697 | } | 9718 | land.LandData.ParcelAccessList.RemoveAt(idx); |
9719 | |||
9720 | LandAccessEntry entry = new LandAccessEntry(); | ||
9721 | |||
9722 | entry.AgentID = key; | ||
9723 | entry.Flags = AccessList.Ban; | ||
9724 | entry.Expires = expires; | ||
9725 | |||
9726 | land.LandData.ParcelAccessList.Add(entry); | ||
9727 | |||
9728 | World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); | ||
9698 | } | 9729 | } |
9699 | } | 9730 | } |
9700 | ScriptSleep(100); | 9731 | ScriptSleep(100); |
@@ -9710,7 +9741,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9710 | if (UUID.TryParse(avatar, out key)) | 9741 | if (UUID.TryParse(avatar, out key)) |
9711 | { | 9742 | { |
9712 | int idx = land.LandData.ParcelAccessList.FindIndex( | 9743 | int idx = land.LandData.ParcelAccessList.FindIndex( |
9713 | delegate(ParcelManager.ParcelAccessEntry e) | 9744 | delegate(LandAccessEntry e) |
9714 | { | 9745 | { |
9715 | if (e.AgentID == key && e.Flags == AccessList.Access) | 9746 | if (e.AgentID == key && e.Flags == AccessList.Access) |
9716 | return true; | 9747 | return true; |
@@ -9718,7 +9749,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9718 | }); | 9749 | }); |
9719 | 9750 | ||
9720 | if (idx != -1) | 9751 | if (idx != -1) |
9752 | { | ||
9721 | land.LandData.ParcelAccessList.RemoveAt(idx); | 9753 | land.LandData.ParcelAccessList.RemoveAt(idx); |
9754 | World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); | ||
9755 | } | ||
9722 | } | 9756 | } |
9723 | } | 9757 | } |
9724 | ScriptSleep(100); | 9758 | ScriptSleep(100); |
@@ -9734,7 +9768,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9734 | if (UUID.TryParse(avatar, out key)) | 9768 | if (UUID.TryParse(avatar, out key)) |
9735 | { | 9769 | { |
9736 | int idx = land.LandData.ParcelAccessList.FindIndex( | 9770 | int idx = land.LandData.ParcelAccessList.FindIndex( |
9737 | delegate(ParcelManager.ParcelAccessEntry e) | 9771 | delegate(LandAccessEntry e) |
9738 | { | 9772 | { |
9739 | if (e.AgentID == key && e.Flags == AccessList.Ban) | 9773 | if (e.AgentID == key && e.Flags == AccessList.Ban) |
9740 | return true; | 9774 | return true; |
@@ -9742,7 +9776,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9742 | }); | 9776 | }); |
9743 | 9777 | ||
9744 | if (idx != -1) | 9778 | if (idx != -1) |
9779 | { | ||
9745 | land.LandData.ParcelAccessList.RemoveAt(idx); | 9780 | land.LandData.ParcelAccessList.RemoveAt(idx); |
9781 | World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); | ||
9782 | } | ||
9746 | } | 9783 | } |
9747 | } | 9784 | } |
9748 | ScriptSleep(100); | 9785 | ScriptSleep(100); |
@@ -9997,7 +10034,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9997 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 10034 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; |
9998 | if (land.OwnerID == m_host.OwnerID) | 10035 | if (land.OwnerID == m_host.OwnerID) |
9999 | { | 10036 | { |
10000 | foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) | 10037 | foreach (LandAccessEntry entry in land.ParcelAccessList) |
10001 | { | 10038 | { |
10002 | if (entry.Flags == AccessList.Ban) | 10039 | if (entry.Flags == AccessList.Ban) |
10003 | { | 10040 | { |
@@ -10014,7 +10051,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10014 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 10051 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; |
10015 | if (land.OwnerID == m_host.OwnerID) | 10052 | if (land.OwnerID == m_host.OwnerID) |
10016 | { | 10053 | { |
10017 | foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) | 10054 | foreach (LandAccessEntry entry in land.ParcelAccessList) |
10018 | { | 10055 | { |
10019 | if (entry.Flags == AccessList.Access) | 10056 | if (entry.Flags == AccessList.Access) |
10020 | { | 10057 | { |