From 264c83aec4151a93647c14e317067d8646f38680 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 2 Feb 2012 22:48:36 +0000 Subject: Add llGetLinkNumberOfSides to LSL_Stub and ILSL_Api It already existed in LSL_Api but it also needs to exist in these two other places for a script to be able to see it. Hopefully resolves http://opensimulator.org/mantis/view.php?id=5489 --- OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 3 ++- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index b66537f..6106a65 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -138,7 +138,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Key llGetLinkKey(int linknum); LSL_String llGetLinkName(int linknum); LSL_Integer llGetLinkNumber(); - LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); + LSL_Integer llGetLinkNumberOfSides(int link); + LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); LSL_Integer llGetListEntryType(LSL_List src, int index); LSL_Integer llGetListLength(LSL_List src); LSL_Vector llGetLocalPos(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 840d3a4..d1a5e2f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -539,6 +539,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetLinkNumber(); } + public LSL_Integer llGetLinkNumberOfSides(int link) + { + return m_LSL_Functions.llGetLinkNumber(); + } + public LSL_Integer llGetListEntryType(LSL_List src, int index) { return m_LSL_Functions.llGetListEntryType(src, index); -- cgit v1.1 From 54d473e2000643d083e51a09ca31b1cd54de363b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 2 Feb 2012 23:35:16 +0000 Subject: D'oh - we want to call llGetLinkNumberOfSides() in the LSL_Stub, not llGetLinkNumber(). --- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index d1a5e2f..83550a5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -541,7 +541,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public LSL_Integer llGetLinkNumberOfSides(int link) { - return m_LSL_Functions.llGetLinkNumber(); + return m_LSL_Functions.llGetLinkNumberOfSides(link); } public LSL_Integer llGetListEntryType(LSL_List src, int index) -- cgit v1.1 From 447a66d66005c5ec54a786d1d0a532738729251c Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 2 Feb 2012 23:40:56 +0000 Subject: Replace ParcelAccessEntry with a new struct, LandAccessEntry, which more accurately reflects the data sent by the viewer. Add times bans and the expiration of timed bans. Warning: Contains a Migration (and nuts) --- .../Shared/Api/Implementation/LSL_Api.cs | 99 +++++++++++++++------- 1 file changed, 68 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') 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 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) + { + World.TeleportClientHome(agentID, presence.ControllingClient); + } } } ScriptSleep(5000); @@ -6408,24 +6413,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); @@ -9679,22 +9697,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); @@ -9710,7 +9741,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; @@ -9718,7 +9749,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); @@ -9734,7 +9768,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; @@ -9742,7 +9776,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); @@ -9997,7 +10034,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) { @@ -10014,7 +10051,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) { -- cgit v1.1