aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMelanie2012-02-02 21:36:45 +0100
committerMelanie2012-02-02 21:36:45 +0100
commit07c487a28f6ce6d85cf32fba0c2ded724f7b5af7 (patch)
tree7852ae5fa1c6a9d91f6c5b7930615a45245b694e /OpenSim/Region/ScriptEngine
parentStreamline banning code using existing methods. (diff)
downloadopensim-SC_OLD-07c487a28f6ce6d85cf32fba0c2ded724f7b5af7.zip
opensim-SC_OLD-07c487a28f6ce6d85cf32fba0c2ded724f7b5af7.tar.gz
opensim-SC_OLD-07c487a28f6ce6d85cf32fba0c2ded724f7b5af7.tar.bz2
opensim-SC_OLD-07c487a28f6ce6d85cf32fba0c2ded724f7b5af7.tar.xz
Make ban, eject, freeze and the scripted versions of those work.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs101
1 files changed, 70 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 3e9529f..b0b1b16 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6101,16 +6101,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6101 public void llEjectFromLand(string pest) 6101 public void llEjectFromLand(string pest)
6102 { 6102 {
6103 m_host.AddScriptLPS(1); 6103 m_host.AddScriptLPS(1);
6104 UUID agentId = new UUID(); 6104 UUID agentID = new UUID();
6105 if (UUID.TryParse(pest, out agentId)) 6105 if (UUID.TryParse(pest, out agentID))
6106 { 6106 {
6107 ScenePresence presence = World.GetScenePresence(agentId); 6107 ScenePresence presence = World.GetScenePresence(agentID);
6108 if (presence != null) 6108 if (presence != null)
6109 { 6109 {
6110 // agent must be over the owners land 6110 // agent must be over the owners land
6111 if (m_host.OwnerID == World.LandChannel.GetLandObject( 6111 ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y);
6112 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) 6112 if (land == null)
6113 World.TeleportClientHome(agentId, presence.ControllingClient); 6113 return;
6114
6115 if (m_host.OwnerID == land.LandData.OwnerID)
6116 {
6117 Vector3 pos = World.GetNearestAllowedPosition(presence, land);
6118 presence.TeleportWithMomentum(pos);
6119 presence.ControllingClient.SendAlertMessage("You have been ejected from this land");
6120 }
6114 } 6121 }
6115 } 6122 }
6116 ScriptSleep(5000); 6123 ScriptSleep(5000);
@@ -6804,24 +6811,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6804 m_host.AddScriptLPS(1); 6811 m_host.AddScriptLPS(1);
6805 UUID key; 6812 UUID key;
6806 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 6813 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
6807 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) 6814 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
6808 { 6815 {
6809 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 6816 int expires = 0;
6817 if (hours != 0)
6818 expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours);
6819
6810 if (UUID.TryParse(avatar, out key)) 6820 if (UUID.TryParse(avatar, out key))
6811 { 6821 {
6812 if (land.LandData.ParcelAccessList.FindIndex( 6822 int idx = land.LandData.ParcelAccessList.FindIndex(
6813 delegate(ParcelManager.ParcelAccessEntry e) 6823 delegate(LandAccessEntry e)
6814 { 6824 {
6815 if (e.AgentID == key && e.Flags == AccessList.Access) 6825 if (e.AgentID == key && e.Flags == AccessList.Access)
6816 return true; 6826 return true;
6817 return false; 6827 return false;
6818 }) == -1) 6828 });
6819 { 6829
6820 entry.AgentID = key; 6830 if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires)))
6821 entry.Flags = AccessList.Access; 6831 return;
6822 entry.Time = DateTime.Now.AddHours(hours); 6832
6823 land.LandData.ParcelAccessList.Add(entry); 6833 if (idx != -1)
6824 } 6834 land.LandData.ParcelAccessList.RemoveAt(idx);
6835
6836 LandAccessEntry entry = new LandAccessEntry();
6837
6838 entry.AgentID = key;
6839 entry.Flags = AccessList.Access;
6840 entry.Expires = expires;
6841
6842 land.LandData.ParcelAccessList.Add(entry);
6843
6844 World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
6825 } 6845 }
6826 } 6846 }
6827 ScriptSleep(100); 6847 ScriptSleep(100);
@@ -10242,22 +10262,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10242 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 10262 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
10243 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) 10263 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
10244 { 10264 {
10245 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 10265 int expires = 0;
10266 if (hours != 0)
10267 expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours);
10268
10246 if (UUID.TryParse(avatar, out key)) 10269 if (UUID.TryParse(avatar, out key))
10247 { 10270 {
10248 if (land.LandData.ParcelAccessList.FindIndex( 10271 int idx = land.LandData.ParcelAccessList.FindIndex(
10249 delegate(ParcelManager.ParcelAccessEntry e) 10272 delegate(LandAccessEntry e)
10250 { 10273 {
10251 if (e.AgentID == key && e.Flags == AccessList.Ban) 10274 if (e.AgentID == key && e.Flags == AccessList.Ban)
10252 return true; 10275 return true;
10253 return false; 10276 return false;
10254 }) == -1) 10277 });
10255 { 10278
10256 entry.AgentID = key; 10279 if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires)))
10257 entry.Flags = AccessList.Ban; 10280 return;
10258 entry.Time = DateTime.Now.AddHours(hours); 10281
10259 land.LandData.ParcelAccessList.Add(entry); 10282 if (idx != -1)
10260 } 10283 land.LandData.ParcelAccessList.RemoveAt(idx);
10284
10285 LandAccessEntry entry = new LandAccessEntry();
10286
10287 entry.AgentID = key;
10288 entry.Flags = AccessList.Ban;
10289 entry.Expires = expires;
10290
10291 land.LandData.ParcelAccessList.Add(entry);
10292
10293 World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
10261 } 10294 }
10262 } 10295 }
10263 ScriptSleep(100); 10296 ScriptSleep(100);
@@ -10273,7 +10306,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10273 if (UUID.TryParse(avatar, out key)) 10306 if (UUID.TryParse(avatar, out key))
10274 { 10307 {
10275 int idx = land.LandData.ParcelAccessList.FindIndex( 10308 int idx = land.LandData.ParcelAccessList.FindIndex(
10276 delegate(ParcelManager.ParcelAccessEntry e) 10309 delegate(LandAccessEntry e)
10277 { 10310 {
10278 if (e.AgentID == key && e.Flags == AccessList.Access) 10311 if (e.AgentID == key && e.Flags == AccessList.Access)
10279 return true; 10312 return true;
@@ -10281,7 +10314,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10281 }); 10314 });
10282 10315
10283 if (idx != -1) 10316 if (idx != -1)
10317 {
10284 land.LandData.ParcelAccessList.RemoveAt(idx); 10318 land.LandData.ParcelAccessList.RemoveAt(idx);
10319 World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
10320 }
10285 } 10321 }
10286 } 10322 }
10287 ScriptSleep(100); 10323 ScriptSleep(100);
@@ -10297,7 +10333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10297 if (UUID.TryParse(avatar, out key)) 10333 if (UUID.TryParse(avatar, out key))
10298 { 10334 {
10299 int idx = land.LandData.ParcelAccessList.FindIndex( 10335 int idx = land.LandData.ParcelAccessList.FindIndex(
10300 delegate(ParcelManager.ParcelAccessEntry e) 10336 delegate(LandAccessEntry e)
10301 { 10337 {
10302 if (e.AgentID == key && e.Flags == AccessList.Ban) 10338 if (e.AgentID == key && e.Flags == AccessList.Ban)
10303 return true; 10339 return true;
@@ -10305,7 +10341,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10305 }); 10341 });
10306 10342
10307 if (idx != -1) 10343 if (idx != -1)
10344 {
10308 land.LandData.ParcelAccessList.RemoveAt(idx); 10345 land.LandData.ParcelAccessList.RemoveAt(idx);
10346 World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
10347 }
10309 } 10348 }
10310 } 10349 }
10311 ScriptSleep(100); 10350 ScriptSleep(100);
@@ -10625,7 +10664,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10625 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 10664 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
10626 if (land.OwnerID == m_host.OwnerID) 10665 if (land.OwnerID == m_host.OwnerID)
10627 { 10666 {
10628 foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) 10667 foreach (LandAccessEntry entry in land.ParcelAccessList)
10629 { 10668 {
10630 if (entry.Flags == AccessList.Ban) 10669 if (entry.Flags == AccessList.Ban)
10631 { 10670 {
@@ -10642,7 +10681,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10642 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 10681 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
10643 if (land.OwnerID == m_host.OwnerID) 10682 if (land.OwnerID == m_host.OwnerID)
10644 { 10683 {
10645 foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) 10684 foreach (LandAccessEntry entry in land.ParcelAccessList)
10646 { 10685 {
10647 if (entry.Flags == AccessList.Access) 10686 if (entry.Flags == AccessList.Access)
10648 { 10687 {