From 78c0028179923710949fea349baad2e6bebc49bd Mon Sep 17 00:00:00 2001 From: Talun Date: Mon, 9 Apr 2012 19:58:07 +0100 Subject: Mantis5502 implementation of some of the new constants Signed-off-by: Melanie --- .../Shared/Api/Implementation/LSL_Api.cs | 42 ++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 291f52e..c38a52e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10358,19 +10358,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; // For the following 8 see the Object version below case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: - ret.Add(new LSL_Integer(0)); + ret.Add(new LSL_Integer(av.RunningScriptCount())); break; case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: - ret.Add(new LSL_Integer(0)); + ret.Add(new LSL_Integer(av.ScriptCount())); break; case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: - ret.Add(new LSL_Integer(0)); + ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384)); break; case ScriptBaseClass.OBJECT_SCRIPT_TIME: ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: - ret.Add(new LSL_Integer(0)); + ret.Add(new LSL_Integer(1)); break; case ScriptBaseClass.OBJECT_SERVER_COST: ret.Add(new LSL_Float(0)); @@ -10422,24 +10422,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.OBJECT_CREATOR: ret.Add(new LSL_String(obj.CreatorID.ToString())); break; - // The following 8 I have intentionaly coded to return zero. They are part of - // "Land Impact" calculations. These calculations are probably not applicable - // to OpenSim, required figures (cpu/memory usage) are not currently tracked - // I have intentionally left these all at zero rather than return possibly - // missleading numbers case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: - // in SL this currently includes crashed scripts - ret.Add(new LSL_Integer(0)); + ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount())); break; case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: - ret.Add(new LSL_Integer(0)); + ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount())); break; case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: // The value returned in SL for mono scripts is 65536 * number of active scripts - ret.Add(new LSL_Integer(0)); + // and 16384 * number of active scripts for LSO. since llGetFreememory + // is coded to give the LSO value use it here + ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384)); break; case ScriptBaseClass.OBJECT_SCRIPT_TIME: - // Average cpu time per simulator frame expended on all scripts in the objetc + // Average cpu time per simulator frame expended on all scripts in the object + // Not currently available at Object level ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: @@ -10447,18 +10444,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // equivalent of the number of prims in a linkset if it does not // contain a mesh anywhere in the link set or is not a normal prim // The value returned in SL for normal prims is prim count - ret.Add(new LSL_Integer(0)); + ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount)); break; + // The following 3 costs I have intentionaly coded to return zero. They are part of + // "Land Impact" calculations. These calculations are probably not applicable + // to OpenSim and are not yet complete in SL case ScriptBaseClass.OBJECT_SERVER_COST: - // The value returned in SL for normal prims is prim count + // The linden calculation is here + // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight + // The value returned in SL for normal prims looks like the prim count ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_STREAMING_COST: - // The value returned in SL for normal prims is prim count * 0.06 + // The linden calculation is here + // http://wiki.secondlife.com/wiki/Mesh/Mesh_Streaming_Cost + // The value returned in SL for normal prims looks like the prim count * 0.06 ret.Add(new LSL_Float(0)); break; case ScriptBaseClass.OBJECT_PHYSICS_COST: - // The value returned in SL for normal prims is prim count + // The linden calculation is here + // http://wiki.secondlife.com/wiki/Mesh/Mesh_physics + // The value returned in SL for normal prims looks like the prim count ret.Add(new LSL_Float(0)); break; default: -- cgit v1.1 From 78fd487a705c91720991a7572b860567f36366c4 Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Tue, 10 Apr 2012 21:49:43 +0200 Subject: New OS scripting functions osSetTerrainTexture and osSetTerrainHeight as originally proposed in SL Jira (https://jira.secondlife.com/browse/SVC-244). --- .../Shared/Api/Implementation/OSSL_Api.cs | 55 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 3 ++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++ 3 files changed, 68 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a5dcba4..339166b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3049,5 +3049,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ScriptBaseClass.TRUE; } + + /// + /// Sets terrain estate texture + /// + /// + /// + /// + public void osSetTerrainTexture(int level, LSL_Key texture) + { + CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture"); + + m_host.AddScriptLPS(1); + //Check to make sure that the script's owner is the estate manager/master + //World.Permissions.GenericEstatePermission( + if (World.Permissions.IsGod(m_host.OwnerID)) + { + if (level < 0 || level > 3) + return; + + UUID textureID = new UUID(); + if (!UUID.TryParse(texture, out textureID)) + return; + + // estate module is required + IEstateModule estate = World.RequestModuleInterface(); + if (estate != null) + estate.setEstateTerrainBaseTexture(level, textureID); + } + } + + /// + /// Sets terrain heights of estate + /// + /// + /// + /// + /// + public void osSetTerrainTextureHeight(int corner, double low, double high) + { + CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight"); + + m_host.AddScriptLPS(1); + //Check to make sure that the script's owner is the estate manager/master + //World.Permissions.GenericEstatePermission( + if (World.Permissions.IsGod(m_host.OwnerID)) + { + if (corner < 0 || corner > 3) + return; + + // estate module is required + IEstateModule estate = World.RequestModuleInterface(); + if (estate != null) + estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high); + } + } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 30bd3ef..545bbee 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -234,5 +234,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Integer osInviteToGroup(LSL_Key agentId); LSL_Integer osEjectFromGroup(LSL_Key agentId); + + void osSetTerrainTexture(int level, LSL_Key texture); + void osSetTerrainTextureHeight(int corner, double low, double high); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 680cefb4..b94b9bf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -878,5 +878,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osEjectFromGroup(agentId); } + + public void osSetTerrainTexture(int level, LSL_Key texture) + { + m_OSSL_Functions.osSetTerrainTexture(level, texture); + } + + public void osSetTerrainTextureHeight(int corner, double low, double high) + { + m_OSSL_Functions.osSetTerrainTextureHeight(corner, low, high); + } } } -- cgit v1.1 From 08e509978d81cb3451c205ed59648e3f5da91344 Mon Sep 17 00:00:00 2001 From: Talun Date: Tue, 10 Apr 2012 21:25:05 +0100 Subject: Mantis 55025 Implement script time. Signed-off-by: nebadon --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c38a52e..078a22a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10367,7 +10367,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384)); break; case ScriptBaseClass.OBJECT_SCRIPT_TIME: - ret.Add(new LSL_Float(0)); + ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f)); break; case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: ret.Add(new LSL_Integer(1)); @@ -10435,9 +10435,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384)); break; case ScriptBaseClass.OBJECT_SCRIPT_TIME: - // Average cpu time per simulator frame expended on all scripts in the object - // Not currently available at Object level - ret.Add(new LSL_Float(0)); + // Average cpu time in seconds per simulator frame expended on all scripts in the object + ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f)); break; case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: // according to the SL wiki A prim or linkset will have prim -- cgit v1.1 From ab7c0e75472b354e34325fdf6280b77edb0567fe Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Apr 2012 22:32:33 +0100 Subject: Remove hardcoded god requirement from osSetRegionWaterHeight, osSetRegionSunSettings and, osSetEstateSunSettings no matter the threat level. Change threat level on osSetRegionSunSettings and osSetEstateSunSettings from nuisance to high to match similar functions. If you had enabled these functions but had relied on the hardcoded god check in the code, then please adjust your OSSL permissions config. Thanks to Oren Hurvitz for pointing this out. --- .../Shared/Api/Implementation/OSSL_Api.cs | 61 +++++++++------------- 1 file changed, 25 insertions(+), 36 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a5dcba4..2c0de93 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1179,12 +1179,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osSetRegionWaterHeight"); m_host.AddScriptLPS(1); - //Check to make sure that the script's owner is the estate manager/master - //World.Permissions.GenericEstatePermission( - if (World.Permissions.IsGod(m_host.OwnerID)) - { - World.EventManager.TriggerRequestChangeWaterHeight((float)height); - } + + World.EventManager.TriggerRequestChangeWaterHeight((float)height); } /// @@ -1195,27 +1191,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// The "Sun Hour" that is desired, 0...24, with 0 just after SunRise public void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour) { - CheckThreatLevel(ThreatLevel.Nuisance, "osSetRegionSunSettings"); + CheckThreatLevel(ThreatLevel.High, "osSetRegionSunSettings"); m_host.AddScriptLPS(1); - //Check to make sure that the script's owner is the estate manager/master - //World.Permissions.GenericEstatePermission( - if (World.Permissions.IsGod(m_host.OwnerID)) - { - while (sunHour > 24.0) - sunHour -= 24.0; - while (sunHour < 0) - sunHour += 24.0; + while (sunHour > 24.0) + sunHour -= 24.0; + while (sunHour < 0) + sunHour += 24.0; - World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; - World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 - World.RegionInfo.RegionSettings.FixedSun = sunFixed; - World.RegionInfo.RegionSettings.Save(); + World.RegionInfo.RegionSettings.UseEstateSun = useEstateSun; + World.RegionInfo.RegionSettings.SunPosition = sunHour + 6; // LL Region Sun Hour is 6 to 30 + World.RegionInfo.RegionSettings.FixedSun = sunFixed; + World.RegionInfo.RegionSettings.Save(); - World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); - } + World.EventManager.TriggerEstateToolsSunUpdate( + World.RegionInfo.RegionHandle, sunFixed, useEstateSun, (float)sunHour); } /// @@ -1225,26 +1217,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// The "Sun Hour" that is desired, 0...24, with 0 just after SunRise public void osSetEstateSunSettings(bool sunFixed, double sunHour) { - CheckThreatLevel(ThreatLevel.Nuisance, "osSetEstateSunSettings"); + CheckThreatLevel(ThreatLevel.High, "osSetEstateSunSettings"); m_host.AddScriptLPS(1); - //Check to make sure that the script's owner is the estate manager/master - //World.Permissions.GenericEstatePermission( - if (World.Permissions.IsGod(m_host.OwnerID)) - { - while (sunHour > 24.0) - sunHour -= 24.0; - while (sunHour < 0) - sunHour += 24.0; + while (sunHour > 24.0) + sunHour -= 24.0; - World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; - World.RegionInfo.EstateSettings.SunPosition = sunHour; - World.RegionInfo.EstateSettings.FixedSun = sunFixed; - World.RegionInfo.EstateSettings.Save(); + while (sunHour < 0) + sunHour += 24.0; - World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); - } + World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; + World.RegionInfo.EstateSettings.SunPosition = sunHour; + World.RegionInfo.EstateSettings.FixedSun = sunFixed; + World.RegionInfo.EstateSettings.Save(); + + World.EventManager.TriggerEstateToolsSunUpdate( + World.RegionInfo.RegionHandle, sunFixed, World.RegionInfo.RegionSettings.UseEstateSun, (float)sunHour); } /// -- cgit v1.1 From eced0916894709e20c16ffc260599772913d7ff3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 13 Apr 2012 22:52:24 +0100 Subject: Change threat level of osNpcStopMoveToTarget from Low to High to match other NPC functions, and change OSSL permissions name to osNpcStopMoveToTarget instead of osNpcStopMoveTo Thanks to Oren Hurvitz for pointing out these mistakes. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 72c1bf6..2680ad0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2514,7 +2514,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void osNpcStopMoveToTarget(LSL_Key npc) { - CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); + CheckThreatLevel(ThreatLevel.High, "osNpcStopMoveToTarget"); m_host.AddScriptLPS(1); INPCModule module = World.RequestModuleInterface(); -- cgit v1.1 From 4d652c704186e9e399ffc6fc1bdf1f1dca056370 Mon Sep 17 00:00:00 2001 From: Talun Date: Sat, 14 Apr 2012 00:37:55 +0100 Subject: Missing or unimplemented LSL memory functions. Implemented to behave as if scripts were LSO. Signed-off-by: nebadon --- .../Shared/Api/Implementation/LSL_Api.cs | 40 +++++++++++++++------- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 7 +++- .../Shared/Api/Runtime/LSL_Constants.cs | 3 ++ .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 25 ++++++++++++++ 4 files changed, 62 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 078a22a..a19427d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10949,34 +10949,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 1; } - #region Not Implemented - // - // Listing the unimplemented lsl functions here, please move - // them from this region as they are completed - // + public LSL_Integer llGetMemoryLimit() + { + m_host.AddScriptLPS(1); + // The value returned for LSO scripts in SL + return 16384; + } - public void llGetEnv(LSL_String name) + public LSL_Integer llSetMemoryLimit(LSL_Integer limit) { m_host.AddScriptLPS(1); - NotImplemented("llGetEnv"); + // Treat as an LSO script + return ScriptBaseClass.FALSE; } - public void llGetSPMaxMemory() + public LSL_Integer llGetSPMaxMemory() { m_host.AddScriptLPS(1); - NotImplemented("llGetSPMaxMemory"); + // The value returned for LSO scripts in SL + return 16384; } - public void llGetUsedMemory() + public LSL_Integer llGetUsedMemory() { m_host.AddScriptLPS(1); - NotImplemented("llGetUsedMemory"); + // The value returned for LSO scripts in SL + return 16384; } public void llScriptProfiler(LSL_Integer flags) { m_host.AddScriptLPS(1); - NotImplemented("llScriptProfiler"); + // This does nothing for LSO scripts in SL + } + + #region Not Implemented + // + // Listing the unimplemented lsl functions here, please move + // them from this region as they are completed + // + + public void llGetEnv(LSL_String name) + { + m_host.AddScriptLPS(1); + NotImplemented("llGetEnv"); } public void llSetSoundQueueing(int queue) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 0f53bc3..11b21d4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -147,7 +147,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Vector llGetLocalPos(); LSL_Rotation llGetLocalRot(); LSL_Float llGetMass(); - void llGetNextEmail(string address, string subject); + LSL_Integer llGetMemoryLimit(); + void llGetNextEmail(string address, string subject); LSL_String llGetNotecardLine(string name, int line); LSL_Key llGetNumberOfNotecardLines(string name); LSL_Integer llGetNumberOfPrims(); @@ -185,6 +186,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String llGetScriptName(); LSL_Integer llGetScriptState(string name); LSL_String llGetSimulatorHostname(); + LSL_Integer llGetSPMaxMemory(); LSL_Integer llGetStartParameter(); LSL_Integer llGetStatus(int status); LSL_String llGetSubString(string src, int start, int end); @@ -198,6 +200,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String llGetTimestamp(); LSL_Vector llGetTorque(); LSL_Integer llGetUnixTime(); + LSL_Integer llGetUsedMemory(); LSL_Vector llGetVel(); LSL_Float llGetWallclock(); void llGiveInventory(string destination, string inventory); @@ -319,6 +322,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llSay(int channelID, string text); void llScaleTexture(double u, double v, int face); LSL_Integer llScriptDanger(LSL_Vector pos); + void llScriptProfiler(LSL_Integer flag); LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata); void llSensor(string name, string id, int type, double range, double arc); void llSensorRemove(); @@ -342,6 +346,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llSetLinkTexture(int linknumber, string texture, int face); void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); void llSetLocalRot(LSL_Rotation rot); + LSL_Integer llSetMemoryLimit(LSL_Integer limit); void llSetObjectDesc(string desc); void llSetObjectName(string name); void llSetObjectPermMask(int mask, int value); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index f58f9d6..fd7c41e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -381,6 +381,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_SCULPT_FLAG_INVERT = 64; public const int PRIM_SCULPT_FLAG_MIRROR = 128; + public const int PROFILE_NONE = 0; + public const int PROFILE_SCRIPT_MEMORY = 1; + public const int MASK_BASE = 0; public const int MASK_OWNER = 1; public const int MASK_GROUP = 2; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index f8e3c36..3c2f7bd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -569,6 +569,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetMass(); } + public LSL_Integer llGetMemoryLimit() + { + return m_LSL_Functions.llGetMemoryLimit(); + } + public void llGetNextEmail(string address, string subject) { m_LSL_Functions.llGetNextEmail(address, subject); @@ -759,6 +764,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetSimulatorHostname(); } + public LSL_Integer llGetSPMaxMemory() + { + return m_LSL_Functions.llGetSPMaxMemory(); + } + public LSL_Integer llGetStartParameter() { return m_LSL_Functions.llGetStartParameter(); @@ -824,6 +834,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetUnixTime(); } + public LSL_Integer llGetUsedMemory() + { + return m_LSL_Functions.llGetUsedMemory(); + } + public LSL_Vector llGetVel() { return m_LSL_Functions.llGetVel(); @@ -1423,6 +1438,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llScriptDanger(pos); } + public void llScriptProfiler(LSL_Integer flags) + { + m_LSL_Functions.llScriptProfiler(flags); + } + public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata) { return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); @@ -1533,6 +1553,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llSetLocalRot(rot); } + public LSL_Integer llSetMemoryLimit(LSL_Integer limit) + { + return m_LSL_Functions.llSetMemoryLimit(limit); + } + public void llSetObjectDesc(string desc) { m_LSL_Functions.llSetObjectDesc(desc); -- cgit v1.1 From 4bdd9d51bc0ccfa5b15a6e77228f69dafada03b7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 14 Apr 2012 01:04:26 +0100 Subject: Correct whitespace error introduced by previous commit --- OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 11b21d4..69df392 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -148,7 +148,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Rotation llGetLocalRot(); LSL_Float llGetMass(); LSL_Integer llGetMemoryLimit(); - void llGetNextEmail(string address, string subject); + void llGetNextEmail(string address, string subject); LSL_String llGetNotecardLine(string name, int line); LSL_Key llGetNumberOfNotecardLines(string name); LSL_Integer llGetNumberOfPrims(); -- cgit v1.1 From 5655239f440dce36cdf9288db70be567aef2d565 Mon Sep 17 00:00:00 2001 From: Talun Date: Mon, 16 Apr 2012 20:24:56 +0100 Subject: Null reference in llGetObjectMass on a seated avatar. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a19427d..5581727 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9255,7 +9255,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // child agents have a mass of 1.0 return 1; else - return (double)avatar.PhysicsActor.Mass; + return (double)avatar.GetMass(); } catch (KeyNotFoundException) { -- cgit v1.1 From 24a0cc5261f1fd1a1d8779c8fb5e7d7fba98ed68 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 17 Apr 2012 01:25:41 +0100 Subject: refactor: Rename EstateSettings.IsEstateManager() to EstateSettings.IsEstateManagerOrOwner() to reflect what it actually does. This makes it consistent with other parts of OpenSimulator that are treating ESTATE_MANAGER and ESTATE_OWNER as different entities. As per opensim-dev mailing list. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | 6 +++--- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5581727..36c9d5e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10887,7 +10887,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api bool isAccount = false; bool isGroup = false; - if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManager(m_host.OwnerID)) + if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManagerOrOwner(m_host.OwnerID)) return 0; UUID id = new UUID(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index 77a784d..df20126 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs @@ -449,7 +449,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSShoutError("LightShare functions are not enabled."); return 0; } - if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) + if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) { LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); return 0; @@ -477,7 +477,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSShoutError("LightShare functions are not enabled."); return; } - if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) + if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) { LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); return; @@ -500,7 +500,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSShoutError("LightShare functions are not enabled."); return 0; } - if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) + if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) { LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); return 0; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 2680ad0..fe94b79 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -369,7 +369,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_MANAGER")) { //Only Estate Managers may use the function - if (World.RegionInfo.EstateSettings.IsEstateManager(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) + if (World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) { return; } -- cgit v1.1 From 679da63da617d031e5e7ae3f2d2a29db1a23ace3 Mon Sep 17 00:00:00 2001 From: Talun Date: Sun, 22 Apr 2012 23:07:50 +0100 Subject: Mantis 5977 Corrections to llRegionSayTo Signed-off-by: BlueWall --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 36c9d5e..a2176ba 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -839,13 +839,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); + if (channel == ScriptBaseClass.DEBUG_CHANNEL) + { + return; + } + UUID TargetID; UUID.TryParse(target, out TargetID); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) - if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error)) - LSLError(error); + wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg); } public LSL_Integer llListen(int channelID, string name, string ID, string msg) -- cgit v1.1 From 60065f06b3fd6f680202405e117402b22d62f902 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 23 Apr 2012 22:23:47 +0100 Subject: refactor: Replace calls to InventorySelf() with existing m_itemID in LSL_Api There's no point look up an item ID that we already have. --- .../Shared/Api/Implementation/LSL_Api.cs | 136 +++++++-------------- 1 file changed, 42 insertions(+), 94 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 36c9d5e..6000293 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -85,7 +85,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected IScriptEngine m_ScriptEngine; protected SceneObjectPart m_host; protected uint m_localID; + + /// + /// The UUID of the item that hosts this script + /// protected UUID m_itemID; + protected bool throwErrorOnNotImplemented = true; protected AsyncCommandManager AsyncCommands = null; protected float m_ScriptDelayFactor = 1.0f; @@ -267,25 +272,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - protected UUID InventorySelf() - { - UUID invItemID = new UUID(); - - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) - { - invItemID = inv.Key; - break; - } - } - } - - return invItemID; - } - protected UUID InventoryKey(string name, int type) { m_host.AddScriptLPS(1); @@ -2697,17 +2683,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGiveMoney(string destination, int amount) { - UUID invItemID=InventorySelf(); - if (invItemID == UUID.Zero) - return 0; - m_host.AddScriptLPS(1); - TaskInventoryItem item = m_host.TaskInventory[invItemID]; + TaskInventoryItem item; lock (m_host.TaskInventory) { - item = m_host.TaskInventory[invItemID]; + item = m_host.TaskInventory[m_itemID]; } if (item.PermsGranter == UUID.Zero) @@ -2955,10 +2937,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api lock (m_host.TaskInventory) { - if (!m_host.TaskInventory.ContainsKey(InventorySelf())) + if (!m_host.TaskInventory.ContainsKey(m_itemID)) return; else - item = m_host.TaskInventory[InventorySelf()]; + item = m_host.TaskInventory[m_itemID]; } if (item.PermsGranter != UUID.Zero) @@ -2983,10 +2965,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api lock (m_host.TaskInventory) { - if (!m_host.TaskInventory.ContainsKey(InventorySelf())) + if (!m_host.TaskInventory.ContainsKey(m_itemID)) return; else - item = m_host.TaskInventory[InventorySelf()]; + item = m_host.TaskInventory[m_itemID]; } m_host.AddScriptLPS(1); @@ -3026,10 +3008,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api lock (m_host.TaskInventory) { - if (!m_host.TaskInventory.ContainsKey(InventorySelf())) + if (!m_host.TaskInventory.ContainsKey(m_itemID)) return; else - item = m_host.TaskInventory[InventorySelf()]; + item = m_host.TaskInventory[m_itemID]; } if (item.PermsGranter != m_host.OwnerID) @@ -3058,10 +3040,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api lock (m_host.TaskInventory) { - if (!m_host.TaskInventory.ContainsKey(InventorySelf())) + if (!m_host.TaskInventory.ContainsKey(m_itemID)) return; else - item = m_host.TaskInventory[InventorySelf()]; + item = m_host.TaskInventory[m_itemID]; } if (item.PermsGranter != m_host.OwnerID) @@ -3313,18 +3295,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - UUID invItemID = InventorySelf(); - if (invItemID == UUID.Zero) - return; - TaskInventoryItem item; lock (m_host.TaskInventory) { - if (!m_host.TaskInventory.ContainsKey(InventorySelf())) + if (!m_host.TaskInventory.ContainsKey(m_itemID)) return; else - item = m_host.TaskInventory[InventorySelf()]; + item = m_host.TaskInventory[m_itemID]; } if (item.PermsGranter == UUID.Zero) @@ -3350,18 +3328,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - UUID invItemID=InventorySelf(); - if (invItemID == UUID.Zero) - return; - TaskInventoryItem item; lock (m_host.TaskInventory) { - if (!m_host.TaskInventory.ContainsKey(InventorySelf())) + if (!m_host.TaskInventory.ContainsKey(m_itemID)) return; else - item = m_host.TaskInventory[InventorySelf()]; + item = m_host.TaskInventory[m_itemID]; } if (item.PermsGranter == UUID.Zero) @@ -3417,21 +3391,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRequestPermissions(string agent, int perm) { - UUID agentID = new UUID(); + UUID agentID; if (!UUID.TryParse(agent, out agentID)) return; - UUID invItemID = InventorySelf(); - - if (invItemID == UUID.Zero) - return; // Not in a prim? How?? - TaskInventoryItem item; lock (m_host.TaskInventory) { - item = m_host.TaskInventory[invItemID]; + item = m_host.TaskInventory[m_itemID]; } if (agentID == UUID.Zero || perm == 0) // Releasing permissions @@ -3466,8 +3435,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { lock (m_host.TaskInventory) { - m_host.TaskInventory[invItemID].PermsGranter = agentID; - m_host.TaskInventory[invItemID].PermsMask = perm; + m_host.TaskInventory[m_itemID].PermsGranter = agentID; + m_host.TaskInventory[m_itemID].PermsMask = perm; } m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( @@ -3490,8 +3459,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { lock (m_host.TaskInventory) { - m_host.TaskInventory[invItemID].PermsGranter = agentID; - m_host.TaskInventory[invItemID].PermsMask = perm; + m_host.TaskInventory[m_itemID].PermsGranter = agentID; + m_host.TaskInventory[m_itemID].PermsMask = perm; } m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( @@ -3515,8 +3484,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { lock (m_host.TaskInventory) { - m_host.TaskInventory[invItemID].PermsGranter = agentID; - m_host.TaskInventory[invItemID].PermsMask = 0; + m_host.TaskInventory[m_itemID].PermsGranter = agentID; + m_host.TaskInventory[m_itemID].PermsMask = 0; } presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; @@ -3524,7 +3493,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } presence.ControllingClient.SendScriptQuestion( - m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm); + m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_itemID, perm); return; } @@ -3541,20 +3510,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (taskID != m_host.UUID) return; - UUID invItemID = InventorySelf(); - - if (invItemID == UUID.Zero) - return; - - client.OnScriptAnswer-=handleScriptAnswer; - m_waitingForScriptAnswer=false; + client.OnScriptAnswer -= handleScriptAnswer; + m_waitingForScriptAnswer = false; if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) llReleaseControls(); lock (m_host.TaskInventory) { - m_host.TaskInventory[invItemID].PermsMask = answer; + m_host.TaskInventory[m_itemID].PermsMask = answer; } m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( @@ -3627,7 +3591,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llCreateLink(string target, int parent) { m_host.AddScriptLPS(1); - UUID invItemID = InventorySelf(); + UUID targetID; if (!UUID.TryParse(target, out targetID)) @@ -3636,7 +3600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api TaskInventoryItem item; lock (m_host.TaskInventory) { - item = m_host.TaskInventory[invItemID]; + item = m_host.TaskInventory[m_itemID]; } if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 @@ -3688,11 +3652,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llBreakLink(int linknum) { m_host.AddScriptLPS(1); - UUID invItemID = InventorySelf(); lock (m_host.TaskInventory) { - if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 + if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 && !m_automaticLinkPermission) { ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); @@ -9691,17 +9654,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llGetCameraPos() { m_host.AddScriptLPS(1); - UUID invItemID = InventorySelf(); - - if (invItemID == UUID.Zero) - return new LSL_Vector(); lock (m_host.TaskInventory) { - if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) + if (m_host.TaskInventory[m_itemID].PermsGranter == UUID.Zero) return new LSL_Vector(); - if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) + if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) { ShoutError("No permissions to track the camera"); return new LSL_Vector(); @@ -9720,16 +9679,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Rotation llGetCameraRot() { m_host.AddScriptLPS(1); - UUID invItemID = InventorySelf(); - if (invItemID == UUID.Zero) - return new LSL_Rotation(); lock (m_host.TaskInventory) { - if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) + if (m_host.TaskInventory[m_itemID].PermsGranter == UUID.Zero) return new LSL_Rotation(); - if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) + if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) { ShoutError("No permissions to track the camera"); return new LSL_Rotation(); @@ -9907,10 +9863,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - // our key in the object we are in - UUID invItemID = InventorySelf(); - if (invItemID == UUID.Zero) return; - // the object we are in UUID objectID = m_host.ParentUUID; if (objectID == UUID.Zero) return; @@ -9919,10 +9871,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api lock (m_host.TaskInventory) { // we need the permission first, to know which avatar we want to set the camera for - agentID = m_host.TaskInventory[invItemID].PermsGranter; + agentID = m_host.TaskInventory[m_itemID].PermsGranter; if (agentID == UUID.Zero) return; - if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; + if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; } ScenePresence presence = World.GetScenePresence(agentID); @@ -9963,10 +9915,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - // our key in the object we are in - UUID invItemID=InventorySelf(); - if (invItemID == UUID.Zero) return; - // the object we are in UUID objectID = m_host.ParentUUID; if (objectID == UUID.Zero) return; @@ -9975,9 +9923,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID agentID; lock (m_host.TaskInventory) { - agentID = m_host.TaskInventory[invItemID].PermsGranter; + agentID = m_host.TaskInventory[m_itemID].PermsGranter; if (agentID == UUID.Zero) return; - if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; + if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; } ScenePresence presence = World.GetScenePresence(agentID); -- cgit v1.1 From 1f8d1bcdcf7ae48ad0b3609e532ad87859f6300b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 23 Apr 2012 22:52:46 +0100 Subject: Replace common code to fetch self inventory item (as opposed to uuid) with GetSelfInventoryItem() However, at some point it would be far more convenient to receive the TaskInventoryItem in the constructor rather than just the item UUID, so we don't have to constantly refetch our self item. --- .../Shared/Api/Implementation/LSL_Api.cs | 231 +++++++-------------- 1 file changed, 76 insertions(+), 155 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6000293..a353b25 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -272,6 +272,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + /// + /// Get the inventory item that hosts ourselves. + /// + /// + /// FIXME: It would be far easier to pass in TaskInventoryItem rather than just m_itemID so that we don't need + /// to keep looking ourselves up. + /// + /// + protected TaskInventoryItem GetSelfInventoryItem() + { + lock (m_host.TaskInventory) + return m_host.TaskInventory[m_itemID]; + } + protected UUID InventoryKey(string name, int type) { m_host.AddScriptLPS(1); @@ -2685,12 +2699,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item; - - lock (m_host.TaskInventory) - { - item = m_host.TaskInventory[m_itemID]; - } + TaskInventoryItem item = GetSelfInventoryItem(); if (item.PermsGranter == UUID.Zero) return 0; @@ -2933,15 +2942,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llTakeControls(int controls, int accept, int pass_on) { - TaskInventoryItem item; - - lock (m_host.TaskInventory) - { - if (!m_host.TaskInventory.ContainsKey(m_itemID)) - return; - else - item = m_host.TaskInventory[m_itemID]; - } + TaskInventoryItem item = GetSelfInventoryItem(); if (item.PermsGranter != UUID.Zero) { @@ -2961,18 +2962,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llReleaseControls() { - TaskInventoryItem item; - - lock (m_host.TaskInventory) - { - if (!m_host.TaskInventory.ContainsKey(m_itemID)) - return; - else - item = m_host.TaskInventory[m_itemID]; - } - m_host.AddScriptLPS(1); + TaskInventoryItem item = GetSelfInventoryItem(); + if (item.PermsGranter != UUID.Zero) { ScenePresence presence = World.GetScenePresence(item.PermsGranter); @@ -3004,15 +2997,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) // return; - TaskInventoryItem item; - - lock (m_host.TaskInventory) - { - if (!m_host.TaskInventory.ContainsKey(m_itemID)) - return; - else - item = m_host.TaskInventory[m_itemID]; - } + TaskInventoryItem item = GetSelfInventoryItem(); if (item.PermsGranter != m_host.OwnerID) return; @@ -3036,15 +3021,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup.AttachmentPoint == 0) return; - TaskInventoryItem item; - - lock (m_host.TaskInventory) - { - if (!m_host.TaskInventory.ContainsKey(m_itemID)) - return; - else - item = m_host.TaskInventory[m_itemID]; - } + TaskInventoryItem item = GetSelfInventoryItem(); if (item.PermsGranter != m_host.OwnerID) return; @@ -3295,15 +3272,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item; - - lock (m_host.TaskInventory) - { - if (!m_host.TaskInventory.ContainsKey(m_itemID)) - return; - else - item = m_host.TaskInventory[m_itemID]; - } + TaskInventoryItem item = GetSelfInventoryItem(); if (item.PermsGranter == UUID.Zero) return; @@ -3328,15 +3297,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item; - - lock (m_host.TaskInventory) - { - if (!m_host.TaskInventory.ContainsKey(m_itemID)) - return; - else - item = m_host.TaskInventory[m_itemID]; - } + TaskInventoryItem item = GetSelfInventoryItem(); if (item.PermsGranter == UUID.Zero) return; @@ -3396,12 +3357,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(agent, out agentID)) return; - TaskInventoryItem item; - - lock (m_host.TaskInventory) - { - item = m_host.TaskInventory[m_itemID]; - } + TaskInventoryItem item = GetSelfInventoryItem(); if (agentID == UUID.Zero || perm == 0) // Releasing permissions { @@ -3531,39 +3487,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == 10 && item.ItemID == m_itemID) - { - return item.PermsGranter.ToString(); - } - } - } - - return UUID.Zero.ToString(); + return GetSelfInventoryItem().PermsGranter.ToString(); } public LSL_Integer llGetPermissions() { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == 10 && item.ItemID == m_itemID) - { - int perms = item.PermsMask; - if (m_automaticLinkPermission) - perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; - return perms; - } - } - } + int perms = GetSelfInventoryItem().PermsMask; - return 0; + if (m_automaticLinkPermission) + perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; + + return perms; } public LSL_Integer llGetLinkNumber() @@ -3597,11 +3533,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(target, out targetID)) return; - TaskInventoryItem item; - lock (m_host.TaskInventory) - { - item = m_host.TaskInventory[m_itemID]; - } + TaskInventoryItem item = GetSelfInventoryItem(); if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 && !m_automaticLinkPermission) @@ -3653,14 +3585,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) + if ((GetSelfInventoryItem().PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 + && !m_automaticLinkPermission) { - if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 - && !m_automaticLinkPermission) - { - ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); - return; - } + ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); + return; } if (linknum < ScriptBaseClass.LINK_THIS) @@ -4537,23 +4466,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llGetScriptName() { - string result = String.Empty; - m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == 10 && item.ItemID == m_itemID) - { - result = item.Name != null ? item.Name : String.Empty; - break; - } - } - } + TaskInventoryItem item = GetSelfInventoryItem(); - return result; + return item.Name != null ? item.Name : String.Empty; } public LSL_Integer llGetLinkNumberOfSides(int link) @@ -9655,16 +9572,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) - { - if (m_host.TaskInventory[m_itemID].PermsGranter == UUID.Zero) - return new LSL_Vector(); + TaskInventoryItem item = GetSelfInventoryItem(); - if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) - { - ShoutError("No permissions to track the camera"); - return new LSL_Vector(); - } + if (item.PermsGranter == UUID.Zero) + return new LSL_Vector(); + + if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) + { + ShoutError("No permissions to track the camera"); + return new LSL_Vector(); } ScenePresence presence = World.GetScenePresence(m_host.OwnerID); @@ -9680,16 +9596,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) - { - if (m_host.TaskInventory[m_itemID].PermsGranter == UUID.Zero) - return new LSL_Rotation(); + TaskInventoryItem item = GetSelfInventoryItem(); - if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) - { - ShoutError("No permissions to track the camera"); - return new LSL_Rotation(); - } + if (item.PermsGranter == UUID.Zero) + return new LSL_Rotation(); + + if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) + { + ShoutError("No permissions to track the camera"); + return new LSL_Rotation(); } ScenePresence presence = World.GetScenePresence(m_host.OwnerID); @@ -9865,17 +9780,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // the object we are in UUID objectID = m_host.ParentUUID; - if (objectID == UUID.Zero) return; + if (objectID == UUID.Zero) + return; - UUID agentID; - lock (m_host.TaskInventory) - { - // we need the permission first, to know which avatar we want to set the camera for - agentID = m_host.TaskInventory[m_itemID].PermsGranter; + TaskInventoryItem item = GetSelfInventoryItem(); - if (agentID == UUID.Zero) return; - if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; - } + // we need the permission first, to know which avatar we want to set the camera for + UUID agentID = item.PermsGranter; + + if (agentID == UUID.Zero) + return; + + if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) + return; ScenePresence presence = World.GetScenePresence(agentID); @@ -9917,21 +9834,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // the object we are in UUID objectID = m_host.ParentUUID; - if (objectID == UUID.Zero) return; + if (objectID == UUID.Zero) + return; + + TaskInventoryItem item = GetSelfInventoryItem(); // we need the permission first, to know which avatar we want to clear the camera for - UUID agentID; - lock (m_host.TaskInventory) - { - agentID = m_host.TaskInventory[m_itemID].PermsGranter; - if (agentID == UUID.Zero) return; - if ((m_host.TaskInventory[m_itemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; - } + UUID agentID = item.PermsGranter; + + if (agentID == UUID.Zero) + return; + + if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) + return; ScenePresence presence = World.GetScenePresence(agentID); // we are not interested in child-agents - if (presence.IsChildAgent) return; + if (presence.IsChildAgent) + return; presence.ControllingClient.SendClearFollowCamProperties(objectID); } -- cgit v1.1 From 40e37d8b78379db08de541c8c7a9fed1d22ec5ef Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 24 Apr 2012 00:03:57 +0100 Subject: Add osForceAttachToAvatar() and osForceDetachFromAvatar() These behave identically to llAttachToAvatar() and llDetachFromAvatar() except that they do not enforce the PERMISSION_ATTACH check Intended for use in completely controlled dedicated environments where these checks are more a UI hinderance than a help. Threat level high. --- .../Shared/Api/Implementation/ApiManager.cs | 41 ++++++------ .../Shared/Api/Implementation/LSL_Api.cs | 73 +++++++++++++--------- .../Shared/Api/Implementation/OSSL_Api.cs | 28 +++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 14 +++++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 13 +++- 5 files changed, 120 insertions(+), 49 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs index 47ed6ba..684138f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/ApiManager.cs @@ -29,42 +29,43 @@ using System; using System.Collections; using System.Collections.Generic; using System.Reflection; +using log4net; using OpenSim.Region.ScriptEngine.Interfaces; namespace OpenSim.Region.ScriptEngine.Shared.Api { public class ApiManager { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Dictionary m_Apis = new Dictionary(); public string[] GetApis() { - if (m_Apis.Count > 0) + if (m_Apis.Count <= 0) { - List l = new List(m_Apis.Keys); - return l.ToArray(); - } + Assembly a = Assembly.GetExecutingAssembly(); - Assembly a = Assembly.GetExecutingAssembly(); + Type[] types = a.GetExportedTypes(); - Type[] types = a.GetExportedTypes(); - - foreach (Type t in types) - { - string name = t.ToString(); - int idx = name.LastIndexOf('.'); - if (idx != -1) - name = name.Substring(idx+1); - - if (name.EndsWith("_Api")) + foreach (Type t in types) { - name = name.Substring(0, name.Length - 4); - m_Apis[name] = t; + string name = t.ToString(); + int idx = name.LastIndexOf('.'); + if (idx != -1) + name = name.Substring(idx+1); + + if (name.EndsWith("_Api")) + { + name = name.Substring(0, name.Length - 4); + m_Apis[name] = t; + } } } - List ret = new List(m_Apis.Keys); - return ret.ToArray(); +// m_log.DebugFormat("[API MANAGER]: Found {0} apis", m_Apis.Keys.Count); + + return new List(m_Apis.Keys).ToArray(); } public IScriptApi CreateApi(string api) @@ -76,4 +77,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ret; } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 9cb97f9..d4c872c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2994,7 +2994,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_UrlModule.ReleaseURL(url); } - public void llAttachToAvatar(int attachment) + /// + /// Attach the object containing this script to the avatar that owns it. + /// + /// The attachment point (e.g. ATTACH_CHEST) + /// true if the attach suceeded, false if it did not + public bool AttachToAvatar(int attachmentPoint) + { + SceneObjectGroup grp = m_host.ParentGroup; + ScenePresence presence = World.GetScenePresence(m_host.OwnerID); + + IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; + + if (attachmentsModule != null) + return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false); + else + return false; + } + + /// + /// Detach the object containing this script from the avatar it is attached to. + /// + /// + /// Nothing happens if the object is not attached. + /// + public void DetachFromAvatar() + { + Util.FireAndForget(DetachWrapper, m_host); + } + + private void DetachWrapper(object o) + { + SceneObjectPart host = (SceneObjectPart)o; + + SceneObjectGroup grp = host.ParentGroup; + UUID itemID = grp.FromItemID; + ScenePresence presence = World.GetScenePresence(host.OwnerID); + + IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; + if (attachmentsModule != null) + attachmentsModule.DetachSingleAttachmentToInv(presence, itemID); + } + + public void llAttachToAvatar(int attachmentPoint) { m_host.AddScriptLPS(1); @@ -3007,15 +3049,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) - { - SceneObjectGroup grp = m_host.ParentGroup; - - ScenePresence presence = World.GetScenePresence(m_host.OwnerID); - - IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; - if (attachmentsModule != null) - attachmentsModule.AttachObject(presence, grp, (uint)attachment, false); - } + AttachToAvatar(attachmentPoint); } public void llDetachFromAvatar() @@ -3031,24 +3065,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) - { - IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; - if (attachmentsModule != null) - Util.FireAndForget(DetachWrapper, m_host); - } - } - - private void DetachWrapper(object o) - { - SceneObjectPart host = (SceneObjectPart)o; - - SceneObjectGroup grp = host.ParentGroup; - UUID itemID = grp.FromItemID; - ScenePresence presence = World.GetScenePresence(host.OwnerID); - - IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; - if (attachmentsModule != null) - attachmentsModule.DetachSingleAttachmentToInv(presence, itemID); + DetachFromAvatar(); } public void llTakeCamera(string avatar) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index fe94b79..3f261ea 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -209,6 +209,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api throw new Exception("OSSL Runtime Error: " + msg); } + /// + /// Initialize the LSL interface. + /// + /// + /// FIXME: This is an abomination. We should be able to set this up earlier but currently we have no + /// guarantee the interface is present on Initialize(). There needs to be another post initialize call from + /// ScriptInstance. + /// private void InitLSL() { if (m_LSL_Api != null) @@ -3093,5 +3101,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high); } } + + public void osForceAttachToAvatar(int attachmentPoint) + { + CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar"); + + m_host.AddScriptLPS(1); + + InitLSL(); + ((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint); + } + + public void osForceDetachFromAvatar() + { + CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar"); + + m_host.AddScriptLPS(1); + + InitLSL(); + ((LSL_Api)m_LSL_Api).DetachFromAvatar(); + } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 545bbee..d0c852b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -98,6 +98,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osAvatarPlayAnimation(string avatar, string animation); void osAvatarStopAnimation(string avatar, string animation); + // Attachment commands + + /// + /// Attach the object containing this script to the avatar that owns it without checking for PERMISSION_ATTACH + /// + /// The attachment point. For example, ATTACH_CHEST + void osForceAttachToAvatar(int attachment); + + /// + /// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH + /// + /// Nothing happens if the object is not attached. + void osForceDetachFromAvatar(); + //texture draw functions string osMovePen(string drawList, int x, int y); string osDrawLine(string drawList, int startX, int startY, int endX, int endY); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index b94b9bf..36ac0e3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -289,8 +289,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osAvatarStopAnimation(avatar, animation); } + // Avatar functions - //Texture Draw functions + public void osForceAttachToAvatar(int attachmentPoint) + { + m_OSSL_Functions.osForceAttachToAvatar(attachmentPoint); + } + + public void osForceDetachFromAvatar() + { + m_OSSL_Functions.osForceDetachFromAvatar(); + } + + // Texture Draw functions public string osMovePen(string drawList, int x, int y) { -- cgit v1.1 From 6011bfa5e36d77ad58cf50ddd99b8c6289144f57 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 23 Apr 2012 19:19:08 +0300 Subject: OSSL: fixed the threat level check for osParseJSONNew --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3f261ea..7fc7337 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1617,7 +1617,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public Object osParseJSONNew(string JSON) { - CheckThreatLevel(ThreatLevel.None, "osParseJSON"); + CheckThreatLevel(ThreatLevel.None, "osParseJSONNew"); m_host.AddScriptLPS(1); -- cgit v1.1 From 88c9fdfa3adda4984aed39bf800832adef883ecc Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 25 Apr 2012 18:36:29 +0100 Subject: Adapt some TeleportWithMomentum calls --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8637df7..5a5f2e1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6115,7 +6115,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.OwnerID == land.LandData.OwnerID) { Vector3 pos = World.GetNearestAllowedPosition(presence, land); - presence.TeleportWithMomentum(pos); + presence.TeleportWithMomentum(pos, null); presence.ControllingClient.SendAlertMessage("You have been ejected from this land"); } } -- cgit v1.1 From 88553bb884c5c8849ec61362e65fe0950c1e3080 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 25 Apr 2012 19:09:22 +0100 Subject: Port Avination link order to make OpenSim behave like SL. Make Primstar scripts work. Fixes Mantis #5990 --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d4c872c..d641958 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -832,8 +832,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRegionSayTo(string target, int channel, string msg) { - string error = String.Empty; - if (msg.Length > 1023) msg = msg.Substring(0, 1023); @@ -3548,7 +3546,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llCreateLink(string target, int parent) { m_host.AddScriptLPS(1); - UUID targetID; if (!UUID.TryParse(target, out targetID)) @@ -3572,11 +3569,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (targetPart.ParentGroup.AttachmentPoint != 0) return; // Fail silently if attached + + if (targetPart.ParentGroup.RootPart.OwnerID != m_host.ParentGroup.RootPart.OwnerID) + return; + SceneObjectGroup parentPrim = null, childPrim = null; if (targetPart != null) { - if (parent != 0) { + if (parent != 0) + { parentPrim = m_host.ParentGroup; childPrim = targetPart.ParentGroup; } @@ -3588,7 +3590,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Required for linking childPrim.RootPart.ClearUpdateSchedule(); - parentPrim.LinkToGroup(childPrim); + parentPrim.LinkToGroup(childPrim, true); } parentPrim.TriggerScriptChangedEvent(Changed.LINK); -- cgit v1.1 From b8114d2b67c8ae8d7551a2ece2177f8b7e958112 Mon Sep 17 00:00:00 2001 From: Talun Date: Tue, 24 Apr 2012 21:54:13 +0100 Subject: Add a version of osNpcSay that takes a channel number Mantis 5747 osNpcSay(UUID npc, string message) left untouched New functions:- osNpcSay(UUID npc, int channel, string message) osNpcShout(UUID npc, int channel, string message) osNpcWhisper(UUID npc, int channel, string message) Signed-off-by: BlueWall --- .../Shared/Api/Implementation/OSSL_Api.cs | 41 +++++++++++++++++++++- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 3 ++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 16 +++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index fe94b79..890115d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2531,6 +2531,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void osNpcSay(LSL_Key npc, string message) { + osNpcSay(npc, 0, message); + } + + public void osNpcSay(LSL_Key npc, int channel, string message) + { CheckThreatLevel(ThreatLevel.High, "osNpcSay"); m_host.AddScriptLPS(1); @@ -2542,7 +2547,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!module.CheckPermissions(npcId, m_host.OwnerID)) return; - module.Say(npcId, World, message); + module.Say(npcId, World, message, channel); + } + } + + public void osNpcShout(LSL_Key npc, int channel, string message) + { + CheckThreatLevel(ThreatLevel.High, "osNpcShout"); + m_host.AddScriptLPS(1); + + INPCModule module = World.RequestModuleInterface(); + if (module != null) + { + UUID npcId = new UUID(npc.m_string); + + if (!module.CheckPermissions(npcId, m_host.OwnerID)) + return; + + module.Shout(npcId, World, message, channel); } } @@ -2627,6 +2649,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public void osNpcWhisper(LSL_Key npc, int channel, string message) + { + CheckThreatLevel(ThreatLevel.High, "osNpcWhisper"); + m_host.AddScriptLPS(1); + + INPCModule module = World.RequestModuleInterface(); + if (module != null) + { + UUID npcId = new UUID(npc.m_string); + + if (!module.CheckPermissions(npcId, m_host.OwnerID)) + return; + + module.Whisper(npcId, World, message, channel); + } + } + /// /// Save the current appearance of the script owner permanently to the named notecard. /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 545bbee..2d3e8e8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -203,11 +203,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcSetRot(LSL_Key npc, rotation rot); void osNpcStopMoveToTarget(LSL_Key npc); void osNpcSay(key npc, string message); + void osNpcSay(key npc, int channel, string message); + void osNpcShout(key npc, int channel, string message); void osNpcSit(key npc, key target, int options); void osNpcStand(LSL_Key npc); void osNpcRemove(key npc); void osNpcPlayAnimation(LSL_Key npc, string animation); void osNpcStopAnimation(LSL_Key npc, string animation); + void osNpcWhisper(key npc, int channel, string message); LSL_Key osOwnerSaveAppearance(string notecard); LSL_Key osAgentSaveAppearance(key agentId, string notecard); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index b94b9bf..e836959 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -569,6 +569,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcSay(npc, message); } + public void osNpcSay(key npc, int channel, string message) + { + m_OSSL_Functions.osNpcSay(npc, channel, message); + } + + + public void osNpcShout(key npc, int channel, string message) + { + m_OSSL_Functions.osNpcShout(npc, channel, message); + } + public void osNpcSit(LSL_Key npc, LSL_Key target, int options) { m_OSSL_Functions.osNpcSit(npc, target, options); @@ -594,6 +605,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcStopAnimation(npc, animation); } + public void osNpcWhisper(key npc, int channel, string message) + { + m_OSSL_Functions.osNpcWhisper(npc, channel, message); + } + public LSL_Key osOwnerSaveAppearance(string notecard) { return m_OSSL_Functions.osOwnerSaveAppearance(notecard); -- cgit v1.1 From 8a65f5a70dea70073790c15ba2ae7739771f74b5 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 23 Apr 2012 19:18:28 +0300 Subject: OSSL: Removed check for CanRunConsoleCommand() in osKickAvatar. OSSL permissions are now controlled in OpenSim.ini. --- .../Shared/Api/Implementation/OSSL_Api.cs | 25 +++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 893fda1..0d4ea19 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -351,7 +351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID ownerID = ti.OwnerID; - //OSSL only may be used if objet is in the same group as the parcel + //OSSL only may be used if object is in the same group as the parcel if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) { ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); @@ -729,11 +729,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); + // For safety, we add another permission check here, and don't rely only on the standard OSSL permissions if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) { MainConsole.Instance.RunCommand(command); return true; } + return false; } @@ -2825,21 +2827,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); m_host.AddScriptLPS(1); - if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) + World.ForEachRootScenePresence(delegate(ScenePresence sp) { - World.ForEachRootScenePresence(delegate(ScenePresence sp) + if (sp.Firstname == FirstName && sp.Lastname == SurName) { - if (sp.Firstname == FirstName && sp.Lastname == SurName) - { - // kick client... - if (alert != null) - sp.ControllingClient.Kick(alert); + // kick client... + if (alert != null) + sp.ControllingClient.Kick(alert); - // ...and close on our side - sp.Scene.IncomingCloseAgent(sp.UUID); - } - }); - } + // ...and close on our side + sp.Scene.IncomingCloseAgent(sp.UUID); + } + }); } public void osCauseDamage(string avatar, double damage) -- cgit v1.1 From b35a1d56818386fc70a4a71e3cd8f6dd6d0e2193 Mon Sep 17 00:00:00 2001 From: Stefan_Boom Date: Sat, 14 Apr 2012 22:05:16 +0200 Subject: Fixing wrong position of llSensor, SensePoint wasnt following the rotation of the root prim. --- .../Api/Implementation/Plugins/SensorRepeat.cs | 30 ++++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 1c272f8..57f741c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -308,7 +308,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins } SceneObjectPart SensePoint = ts.host; - Vector3 fromRegionPos = SensePoint.AbsolutePosition; + Vector3 fromRegionPos = SensePoint.GetWorldPosition(); // pre define some things to avoid repeated definitions in the loop body Vector3 toRegionPos; @@ -319,14 +319,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins float dy; float dz; - Quaternion q = SensePoint.RotationOffset; + Quaternion q = SensePoint.GetWorldRotation(); if (SensePoint.ParentGroup.IsAttachment) { - // In attachments, the sensor cone always orients with the + // In attachments, rotate the sensor cone with the // avatar rotation. This may include a nonzero elevation if // in mouselook. + // This will not include the rotation and position of the + // attachment point (e.g. your head when a sensor is in your + // hair attached to your scull. Your hair will turn with + // your head but the sensor will stay with your (global) + // avatar rotation and position. + // Position of a sensor in a child prim attached to an avatar + // will be still wrong. ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); - q = avatar.Rotation; + q = avatar.Rotation*q; } LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); @@ -439,16 +446,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins return sensedEntities; SceneObjectPart SensePoint = ts.host; - Vector3 fromRegionPos = SensePoint.AbsolutePosition; + Vector3 fromRegionPos = SensePoint.GetWorldPosition(); - Quaternion q = SensePoint.RotationOffset; + Quaternion q = SensePoint.GetWorldRotation(); if (SensePoint.ParentGroup.IsAttachment) { - // In attachments, the sensor cone always orients with the + // In attachments, rotate the sensor cone with the // avatar rotation. This may include a nonzero elevation if // in mouselook. + // This will not include the rotation and position of the + // attachment point (e.g. your head when a sensor is in your + // hair attached to your scull. Your hair will turn with + // your head but the sensor will stay with your (global) + // avatar rotation and position. + // Position of a sensor in a child prim attached to an avatar + // will be still wrong. ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); - q = avatar.Rotation; + q = avatar.Rotation*q; } LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); -- cgit v1.1 From e39e4f6bfb9d28317c2547094f5fe79969f4ede9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 27 Apr 2012 19:40:19 +0100 Subject: minor: style adjustments in SensorRepeat, mainly related to patch from stoehr --- .../ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 57f741c..3844753 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -222,7 +222,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins // Is the sensor type is AGENT and not SCRIPTED then include agents if ((ts.type & (AGENT | AGENT_BY_USERNAME | NPC)) != 0 && (ts.type & SCRIPTED) == 0) { - sensedEntities.AddRange(doAgentSensor(ts)); + sensedEntities.AddRange(doAgentSensor(ts)); } // If SCRIPTED or PASSIVE or ACTIVE check objects @@ -333,8 +333,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins // Position of a sensor in a child prim attached to an avatar // will be still wrong. ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); - q = avatar.Rotation*q; + q = avatar.Rotation * q; } + LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); @@ -462,7 +463,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins // Position of a sensor in a child prim attached to an avatar // will be still wrong. ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); - q = avatar.Rotation*q; + q = avatar.Rotation * q; } LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); -- cgit v1.1 From 9c2a73b61ef1e834c77f5d945ebae435b033ca38 Mon Sep 17 00:00:00 2001 From: TBG Renfold Date: Tue, 24 Apr 2012 19:38:37 +0100 Subject: llGenerateKey implementation. Creates a random UUID I.E: UUID.Random().ToString(); Signed-off-by: TBG Renfold --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 +++++++ OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 1 + OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 +++++ 3 files changed, 13 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d641958..62b5c0f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1734,6 +1734,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api rgb.y = texcolor.G; rgb.z = texcolor.B; return rgb; + } else { @@ -3192,6 +3193,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return m_host.UUID.ToString(); } + public LSL_Key llGenerateKey() + { + m_host.AddScriptLPS(1); + return UUID.Random().ToString(); + } + public void llSetBuoyancy(double buoyancy) { m_host.AddScriptLPS(1); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 69df392..7a797ac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -105,6 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Integer llFloor(double f); void llForceMouselook(int mouselook); LSL_Float llFrand(double mag); + LSL_Key llGenerateKey(); LSL_Vector llGetAccel(); LSL_Integer llGetAgentInfo(string id); LSL_String llGetAgentLanguage(string id); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 3c2f7bd..80fa530 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -369,6 +369,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llFrand(mag); } + public LSL_Key llGenerateKey() + { + return m_LSL_Functions.llGenerateKey(); + } + public LSL_Vector llGetAccel() { return m_LSL_Functions.llGetAccel(); -- cgit v1.1 From 100e4ca67ea5f9eacc575ac65ce3ac7cd81eeb3d Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Thu, 3 May 2012 19:00:09 +0200 Subject: Fixes Mantis #5999. llSetLinkPrimitiveParams with PRIM_BUMP_SHINY did cause a runtime error. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 62b5c0f..704dfc3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7336,7 +7336,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; face = (int)rules.GetLSLIntegerItem(idx++); int shiny = (int)rules.GetLSLIntegerItem(idx++); - Bumpiness bump = (Bumpiness)Convert.ToByte((int)rules.GetLSLIntegerItem(idx++)); + Bumpiness bump = (Bumpiness)(int)rules.GetLSLIntegerItem(idx++); SetShiny(part, face, shiny, bump); -- cgit v1.1 From b697d0e895dc7670e160188501da88a780455500 Mon Sep 17 00:00:00 2001 From: dahlia Date: Sun, 6 May 2012 23:54:50 -0700 Subject: add OS_NPC_RUNNING option to osNpcMoveToTarget() to allow running speed for moving NPCs --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 3 ++- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0d4ea19..3659687 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2474,7 +2474,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World, pos, (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0, - (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0); + (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0, + (options & ScriptBaseClass.OS_NPC_RUNNING) != 0); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index fd7c41e..2a28542 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -626,6 +626,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int OS_NPC_FLY = 0; public const int OS_NPC_NO_FLY = 1; public const int OS_NPC_LAND_AT_TARGET = 2; + public const int OS_NPC_RUNNING = 4; public const int OS_NPC_SIT_NOW = 0; -- cgit v1.1 From 4186fa10f0eba3628ef8222db2e4b0e2b69df5cd Mon Sep 17 00:00:00 2001 From: dahlia Date: Mon, 7 May 2012 00:08:56 -0700 Subject: remove default values from prior commit since mono cant deal with them --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3659687..ed9a4e0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2449,7 +2449,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); - module.MoveToTarget(npcId, World, pos, false, true); + module.MoveToTarget(npcId, World, pos, false, true, false); } } -- cgit v1.1 From a82dc263abe5ef2a7221609da14f75d7026f9fbe Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 7 May 2012 19:05:21 +0100 Subject: For osGetGridNick(), osGetGridName(), osGetGridLoginURI() and osGetGridCustom(), try to read from the [GridInfoService] section on standalone rather than [GridInfo] [GridInfoService] is the section that's actually in bin/config-include/StandaloneCommon.ini.example --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ed9a4e0..3b67966 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -128,6 +128,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public const string GridInfoServiceConfigSectionName = "GridInfoService"; + internal IScriptEngine m_ScriptEngine; internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there internal SceneObjectPart m_host; @@ -2032,8 +2034,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string nick = String.Empty; IConfigSource config = m_ScriptEngine.ConfigSource; - if (config.Configs["GridInfo"] != null) - nick = config.Configs["GridInfo"].GetString("gridnick", nick); + if (config.Configs[GridInfoServiceConfigSectionName] != null) + nick = config.Configs[GridInfoServiceConfigSectionName].GetString("gridnick", nick); if (String.IsNullOrEmpty(nick)) nick = GridUserInfo(InfoType.Nick); @@ -2049,8 +2051,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string name = String.Empty; IConfigSource config = m_ScriptEngine.ConfigSource; - if (config.Configs["GridInfo"] != null) - name = config.Configs["GridInfo"].GetString("gridname", name); + if (config.Configs[GridInfoServiceConfigSectionName] != null) + name = config.Configs[GridInfoServiceConfigSectionName].GetString("gridname", name); if (String.IsNullOrEmpty(name)) name = GridUserInfo(InfoType.Name); @@ -2066,8 +2068,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string loginURI = String.Empty; IConfigSource config = m_ScriptEngine.ConfigSource; - if (config.Configs["GridInfo"] != null) - loginURI = config.Configs["GridInfo"].GetString("login", loginURI); + if (config.Configs[GridInfoServiceConfigSectionName] != null) + loginURI = config.Configs[GridInfoServiceConfigSectionName].GetString("login", loginURI); if (String.IsNullOrEmpty(loginURI)) loginURI = GridUserInfo(InfoType.Login); @@ -2114,8 +2116,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string retval = String.Empty; IConfigSource config = m_ScriptEngine.ConfigSource; - if (config.Configs["GridInfo"] != null) - retval = config.Configs["GridInfo"].GetString(key, retval); + if (config.Configs[GridInfoServiceConfigSectionName] != null) + retval = config.Configs[GridInfoServiceConfigSectionName].GetString(key, retval); if (String.IsNullOrEmpty(retval)) retval = GridUserInfo(InfoType.Custom, key); -- cgit v1.1 From 01b78235db71994ba3e37bd6ea297bed7e4576b9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 8 May 2012 22:58:34 +0100 Subject: Instead of constantly looking up unchanging self item in script code, pass in self item on initialization. --- .../Shared/Api/Implementation/LSL_Api.cs | 244 +++++++++------------ .../Shared/Api/Implementation/LS_Api.cs | 4 +- .../Shared/Api/Implementation/MOD_Api.cs | 10 +- .../Shared/Api/Implementation/OSSL_Api.cs | 29 +-- 4 files changed, 118 insertions(+), 169 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 704dfc3..e8e4dab 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -87,9 +87,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected uint m_localID; /// - /// The UUID of the item that hosts this script + /// The item that hosts this script /// - protected UUID m_itemID; + protected TaskInventoryItem m_item; protected bool throwErrorOnNotImplemented = true; protected AsyncCommandManager AsyncCommands = null; @@ -108,12 +108,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected Dictionary m_userInfoCache = new Dictionary(); - public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) { m_ScriptEngine = ScriptEngine; m_host = host; m_localID = localID; - m_itemID = itemID; + m_item = item; m_ScriptDelayFactor = m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); @@ -163,7 +163,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void state(string newState) { - m_ScriptEngine.SetState(m_itemID, newState); + m_ScriptEngine.SetState(m_item.ItemID, newState); } /// @@ -173,7 +173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llResetScript() { m_host.AddScriptLPS(1); - m_ScriptEngine.ApiResetScript(m_itemID); + m_ScriptEngine.ApiResetScript(m_item.ItemID); } public void llResetOtherScript(string name) @@ -272,20 +272,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - /// - /// Get the inventory item that hosts ourselves. - /// - /// - /// FIXME: It would be far easier to pass in TaskInventoryItem rather than just m_itemID so that we don't need - /// to keep looking ourselves up. - /// - /// - protected TaskInventoryItem GetSelfInventoryItem() - { - lock (m_host.TaskInventory) - return m_host.TaskInventory[m_itemID]; - } - protected UUID InventoryKey(string name, int type) { m_host.AddScriptLPS(1); @@ -857,7 +843,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID.TryParse(ID, out keyID); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) - return wComm.Listen(m_localID, m_itemID, m_host.UUID, channelID, name, keyID, msg); + return wComm.Listen(m_localID, m_item.ItemID, m_host.UUID, channelID, name, keyID, msg); else return -1; } @@ -867,7 +853,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) - wComm.ListenControl(m_itemID, number, active); + wComm.ListenControl(m_item.ItemID, number, active); } public void llListenRemove(int number) @@ -875,7 +861,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) - wComm.ListenRemove(m_itemID, number); + wComm.ListenRemove(m_item.ItemID, number); } public void llSensor(string name, string id, int type, double range, double arc) @@ -884,7 +870,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID keyID = UUID.Zero; UUID.TryParse(id, out keyID); - AsyncCommands.SensorRepeatPlugin.SenseOnce(m_localID, m_itemID, name, keyID, type, range, arc, m_host); + AsyncCommands.SensorRepeatPlugin.SenseOnce(m_localID, m_item.ItemID, name, keyID, type, range, arc, m_host); } public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) @@ -893,13 +879,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID keyID = UUID.Zero; UUID.TryParse(id, out keyID); - AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host); + AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_localID, m_item.ItemID, name, keyID, type, range, arc, rate, m_host); } public void llSensorRemove() { m_host.AddScriptLPS(1); - AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_localID, m_itemID); + AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_localID, m_item.ItemID); } public string resolveName(UUID objecUUID) @@ -940,7 +926,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llDetectedName(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return String.Empty; return detectedParams.Name; @@ -949,7 +935,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llDetectedKey(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return String.Empty; return detectedParams.Key.ToString(); @@ -958,7 +944,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llDetectedOwner(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return String.Empty; return detectedParams.Owner.ToString(); @@ -967,7 +953,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llDetectedType(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return 0; return new LSL_Integer(detectedParams.Type); @@ -976,7 +962,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedPos(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return new LSL_Vector(); return detectedParams.Position; @@ -985,7 +971,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedVel(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return new LSL_Vector(); return detectedParams.Velocity; @@ -994,7 +980,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedGrab(int number) { m_host.AddScriptLPS(1); - DetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams parms = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (parms == null) return new LSL_Vector(0, 0, 0); @@ -1004,7 +990,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Rotation llDetectedRot(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return new LSL_Rotation(); return detectedParams.Rotation; @@ -1013,7 +999,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llDetectedGroup(int number) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return new LSL_Integer(0); if (m_host.GroupID == detectedParams.Group) @@ -1024,7 +1010,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llDetectedLinkNumber(int number) { m_host.AddScriptLPS(1); - DetectParams parms = m_ScriptEngine.GetDetectParams(m_itemID, number); + DetectParams parms = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (parms == null) return new LSL_Integer(0); @@ -1037,7 +1023,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedTouchBinormal(int index) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); if (detectedParams == null) return new LSL_Vector(); return detectedParams.TouchBinormal; @@ -1049,7 +1035,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llDetectedTouchFace(int index) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); if (detectedParams == null) return new LSL_Integer(-1); return new LSL_Integer(detectedParams.TouchFace); @@ -1061,7 +1047,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedTouchNormal(int index) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); if (detectedParams == null) return new LSL_Vector(); return detectedParams.TouchNormal; @@ -1073,7 +1059,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedTouchPos(int index) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); if (detectedParams == null) return new LSL_Vector(); return detectedParams.TouchPos; @@ -1085,7 +1071,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedTouchST(int index) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); if (detectedParams == null) return new LSL_Vector(-1.0, -1.0, 0.0); return detectedParams.TouchST; @@ -1097,7 +1083,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llDetectedTouchUV(int index) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, index); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index); if (detectedParams == null) return new LSL_Vector(-1.0, -1.0, 0.0); return detectedParams.TouchUV; @@ -2702,12 +2688,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter == UUID.Zero) return 0; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) { LSLError("No permissions to give money"); return 0; @@ -2890,7 +2874,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api sec = m_MinTimerInterval; m_host.AddScriptLPS(1); // Setting timer repeat - AsyncCommands.TimerPlugin.SetTimerEvent(m_localID, m_itemID, sec); + AsyncCommands.TimerPlugin.SetTimerEvent(m_localID, m_item.ItemID, sec); } public virtual void llSleep(double sec) @@ -2945,17 +2929,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llTakeControls(int controls, int accept, int pass_on) { - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter != UUID.Zero) + if (m_item.PermsGranter != UUID.Zero) { - ScenePresence presence = World.GetScenePresence(item.PermsGranter); + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); if (presence != null) { - if ((item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) { - presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_itemID); + presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_item.ItemID); } } } @@ -2967,20 +2949,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter != UUID.Zero) + if (m_item.PermsGranter != UUID.Zero) { - ScenePresence presence = World.GetScenePresence(item.PermsGranter); + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); if (presence != null) { - if ((item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) { // Unregister controls from Presence - presence.UnRegisterControlEventsToScript(m_localID, m_itemID); + presence.UnRegisterControlEventsToScript(m_localID, m_item.ItemID); // Remove Take Control permission. - item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS; + m_item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS; } } } @@ -3042,12 +3022,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) // return; - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter != m_host.OwnerID) + if (m_item.PermsGranter != m_host.OwnerID) return; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) AttachToAvatar(attachmentPoint); } @@ -3058,12 +3036,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup.AttachmentPoint == 0) return; - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter != m_host.OwnerID) + if (m_item.PermsGranter != m_host.OwnerID) return; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) DetachFromAvatar(); } @@ -3245,7 +3221,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); try { - m_ScriptEngine.SetMinEventDelay(m_itemID, delay); + m_ScriptEngine.SetMinEventDelay(m_item.ItemID, delay); } catch (NotImplementedException) { @@ -3298,14 +3274,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter == UUID.Zero) return; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) { - ScenePresence presence = World.GetScenePresence(item.PermsGranter); + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); if (presence != null) { @@ -3323,21 +3297,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter == UUID.Zero) return; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) { UUID animID = new UUID(); if (!UUID.TryParse(anim, out animID)) { - animID=InventoryKey(anim); + animID = InventoryKey(anim); } - ScenePresence presence = World.GetScenePresence(item.PermsGranter); + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); if (presence != null) { @@ -3373,7 +3345,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetStartParameter() { m_host.AddScriptLPS(1); - return m_ScriptEngine.GetStartParameter(m_itemID); + return m_ScriptEngine.GetStartParameter(m_item.ItemID); } public void llRequestPermissions(string agent, int perm) @@ -3383,16 +3355,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(agent, out agentID)) return; - TaskInventoryItem item = GetSelfInventoryItem(); - if (agentID == UUID.Zero || perm == 0) // Releasing permissions { llReleaseControls(); - item.PermsGranter = UUID.Zero; - item.PermsMask = 0; + m_item.PermsGranter = UUID.Zero; + m_item.PermsMask = 0; - m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( + m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( "run_time_permissions", new Object[] { new LSL_Integer(0) }, new DetectParams[0])); @@ -3400,7 +3370,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - if (item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) + if (m_item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) llReleaseControls(); m_host.AddScriptLPS(1); @@ -3417,11 +3387,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { lock (m_host.TaskInventory) { - m_host.TaskInventory[m_itemID].PermsGranter = agentID; - m_host.TaskInventory[m_itemID].PermsMask = perm; + m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; + m_host.TaskInventory[m_item.ItemID].PermsMask = perm; } - m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( + m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( "run_time_permissions", new Object[] { new LSL_Integer(perm) }, new DetectParams[0])); @@ -3441,11 +3411,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { lock (m_host.TaskInventory) { - m_host.TaskInventory[m_itemID].PermsGranter = agentID; - m_host.TaskInventory[m_itemID].PermsMask = perm; + m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; + m_host.TaskInventory[m_item.ItemID].PermsMask = perm; } - m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( + m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( "run_time_permissions", new Object[] { new LSL_Integer(perm) }, new DetectParams[0])); @@ -3466,8 +3436,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { lock (m_host.TaskInventory) { - m_host.TaskInventory[m_itemID].PermsGranter = agentID; - m_host.TaskInventory[m_itemID].PermsMask = 0; + m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; + m_host.TaskInventory[m_item.ItemID].PermsMask = 0; } presence.ControllingClient.OnScriptAnswer += handleScriptAnswer; @@ -3475,13 +3445,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } presence.ControllingClient.SendScriptQuestion( - m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_itemID, perm); + m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, m_item.ItemID, perm); return; } // Requested agent is not in range, refuse perms - m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( + m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( "run_time_permissions", new Object[] { new LSL_Integer(0) }, new DetectParams[0])); @@ -3500,10 +3470,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api lock (m_host.TaskInventory) { - m_host.TaskInventory[m_itemID].PermsMask = answer; + m_host.TaskInventory[m_item.ItemID].PermsMask = answer; } - m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( + m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( "run_time_permissions", new Object[] { new LSL_Integer(answer) }, new DetectParams[0])); @@ -3513,14 +3483,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - return GetSelfInventoryItem().PermsGranter.ToString(); + return m_item.PermsGranter.ToString(); } public LSL_Integer llGetPermissions() { m_host.AddScriptLPS(1); - int perms = GetSelfInventoryItem().PermsMask; + int perms = m_item.PermsMask; if (m_automaticLinkPermission) perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; @@ -3558,9 +3528,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(target, out targetID)) return; - TaskInventoryItem item = GetSelfInventoryItem(); - - if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 && !m_automaticLinkPermission) { ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); @@ -3568,7 +3536,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } IClientAPI client = null; - ScenePresence sp = World.GetScenePresence(item.PermsGranter); + ScenePresence sp = World.GetScenePresence(m_item.PermsGranter); if (sp != null) client = sp.ControllingClient; @@ -3615,7 +3583,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - if ((GetSelfInventoryItem().PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 && !m_automaticLinkPermission) { ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); @@ -3986,7 +3954,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (item.Name == name) { - if (item.ItemID == m_itemID) + if (item.ItemID == m_item.ItemID) throw new ScriptDeleteException(); else m_host.Inventory.RemoveInventoryItem(item.ItemID); @@ -4122,7 +4090,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID tid = AsyncCommands. DataserverPlugin.RegisterRequest(m_localID, - m_itemID, rq.ToString()); + m_item.ItemID, rq.ToString()); AsyncCommands. DataserverPlugin.DataserverReply(rq.ToString(), reply); @@ -4143,7 +4111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID tid = AsyncCommands. DataserverPlugin.RegisterRequest(m_localID, - m_itemID, item.AssetID.ToString()); + m_item.ItemID, item.AssetID.ToString()); Vector3 region = new Vector3( World.RegionInfo.RegionLocX * Constants.RegionSize, @@ -4498,9 +4466,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - return item.Name != null ? item.Name : String.Empty; + return m_item.Name != null ? m_item.Name : String.Empty; } public LSL_Integer llGetLinkNumberOfSides(int link) @@ -6598,14 +6564,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); if (xmlrpcMod.IsEnabled()) { - UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero); + UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_item.ItemID, UUID.Zero); IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface(); if (xmlRpcRouter != null) { string ExternalHostName = m_ScriptEngine.World.RegionInfo.ExternalHostName; xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, - m_itemID, String.Format("http://{0}:{1}/", ExternalHostName, + m_item.ItemID, String.Format("http://{0}:{1}/", ExternalHostName, xmlrpcMod.Port.ToString())); } object[] resobj = new object[] @@ -6617,7 +6583,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api new LSL_Integer(0), new LSL_String(String.Empty) }; - m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams("remote_data", resobj, + m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams("remote_data", resobj, new DetectParams[0])); } ScriptSleep(1000); @@ -6628,7 +6594,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); ScriptSleep(3000); - return (xmlrpcMod.SendRemoteData(m_localID, m_itemID, channel, dest, idata, sdata)).ToString(); + return (xmlrpcMod.SendRemoteData(m_localID, m_item.ItemID, channel, dest, idata, sdata)).ToString(); } public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) @@ -9049,13 +9015,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); if (m_UrlModule != null) - return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_itemID).ToString(); + return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID).ToString(); return UUID.Zero.ToString(); } public LSL_String llRequestSimulatorData(string simulator, int data) { - IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_itemID, "OSSL"); + IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "OSSL"); try { @@ -9117,7 +9083,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID rq = UUID.Random(); UUID tid = AsyncCommands. - DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); + DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, rq.ToString()); AsyncCommands. DataserverPlugin.DataserverReply(rq.ToString(), reply); @@ -9136,7 +9102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_UrlModule != null) - return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_itemID).ToString(); + return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID).ToString(); return UUID.Zero.ToString(); } @@ -9602,12 +9568,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter == UUID.Zero) return new LSL_Vector(); - if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) { ShoutError("No permissions to track the camera"); return new LSL_Vector(); @@ -9626,12 +9590,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryItem item = GetSelfInventoryItem(); - - if (item.PermsGranter == UUID.Zero) + if (m_item.PermsGranter == UUID.Zero) return new LSL_Rotation(); - if ((item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) { ShoutError("No permissions to track the camera"); return new LSL_Rotation(); @@ -9696,7 +9658,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt) { m_host.AddScriptLPS(1); - DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, 0); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, 0); if (detectedParams == null) return; // only works on the first detected avatar ScenePresence avatar = World.GetScenePresence(detectedParams.Key); @@ -9813,15 +9775,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (objectID == UUID.Zero) return; - TaskInventoryItem item = GetSelfInventoryItem(); - // we need the permission first, to know which avatar we want to set the camera for - UUID agentID = item.PermsGranter; + UUID agentID = m_item.PermsGranter; if (agentID == UUID.Zero) return; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; ScenePresence presence = World.GetScenePresence(agentID); @@ -9867,15 +9827,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (objectID == UUID.Zero) return; - TaskInventoryItem item = GetSelfInventoryItem(); - // we need the permission first, to know which avatar we want to clear the camera for - UUID agentID = item.PermsGranter; + UUID agentID = m_item.PermsGranter; if (agentID == UUID.Zero) return; - if ((item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return; ScenePresence presence = World.GetScenePresence(agentID); @@ -10025,7 +9983,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } UUID reqID = httpScriptMod. - StartHttpRequest(m_localID, m_itemID, url, param, httpHeaders, body); + StartHttpRequest(m_localID, m_item.ItemID, url, param, httpHeaders, body); if (reqID != UUID.Zero) return reqID.ToString(); @@ -10455,7 +10413,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // was: UUID tid = tid = AsyncCommands. - UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, assetID.ToString()); + UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, assetID.ToString()); if (NotecardCache.IsCached(assetID)) { @@ -10517,7 +10475,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // was: UUID tid = tid = AsyncCommands. - UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, assetID.ToString()); + UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, assetID.ToString()); if (NotecardCache.IsCached(assetID)) { @@ -10575,7 +10533,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void print(string str) { // yes, this is a real LSL function. See: http://wiki.secondlife.com/wiki/Print - IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_itemID, "OSSL"); + IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "OSSL"); if (ossl != null) { ossl.CheckThreatLevel(ThreatLevel.High, "print"); @@ -10603,7 +10561,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID rq = UUID.Random(); - AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); + AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, rq.ToString()); AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); @@ -10619,7 +10577,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID rq = UUID.Random(); - AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString()); + AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, rq.ToString()); AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index df20126..cd47d96 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs @@ -59,16 +59,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal IScriptEngine m_ScriptEngine; internal SceneObjectPart m_host; internal uint m_localID; - internal UUID m_itemID; internal bool m_LSFunctionsEnabled = false; internal IScriptModuleComms m_comms = null; - public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) { m_ScriptEngine = ScriptEngine; m_host = host; m_localID = localID; - m_itemID = itemID; if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) m_LSFunctionsEnabled = true; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 7c07e15..a578b50 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -58,16 +58,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal IScriptEngine m_ScriptEngine; internal SceneObjectPart m_host; internal uint m_localID; - internal UUID m_itemID; + internal TaskInventoryItem m_item; internal bool m_MODFunctionsEnabled = false; internal IScriptModuleComms m_comms = null; - public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) { m_ScriptEngine = ScriptEngine; m_host = host; m_localID = localID; - m_itemID = itemID; + m_item = item; if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false)) m_MODFunctionsEnabled = true; @@ -252,7 +252,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // non-null but don't trust it completely try { - object result = m_comms.InvokeOperation(m_host.UUID, m_itemID, fname, convertedParms); + object result = m_comms.InvokeOperation(m_host.UUID, m_item.ItemID, fname, convertedParms); if (result != null) return result; @@ -279,7 +279,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID req = UUID.Random(); - m_comms.RaiseEvent(m_itemID, req.ToString(), module, command, k); + m_comms.RaiseEvent(m_item.ItemID, req.ToString(), module, command, k); return req.ToString(); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3b67966..9b2022a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -134,19 +134,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there internal SceneObjectPart m_host; internal uint m_localID; - internal UUID m_itemID; + internal TaskInventoryItem m_item; internal bool m_OSFunctionsEnabled = false; internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; internal float m_ScriptDelayFactor = 1.0f; internal float m_ScriptDistanceFactor = 1.0f; internal Dictionary m_FunctionPerms = new Dictionary(); - public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) { m_ScriptEngine = ScriptEngine; m_host = host; m_localID = localID; - m_itemID = itemID; + m_item = item; if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) m_OSFunctionsEnabled = true; @@ -224,7 +224,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_LSL_Api != null) return; - m_LSL_Api = (ILSL_Api)m_ScriptEngine.GetApi(m_itemID, "LSL"); + m_LSL_Api = (ILSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "LSL"); } // @@ -343,22 +343,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - TaskInventoryItem ti = m_host.Inventory.GetInventoryItem(m_itemID); - if (ti == null) - { - OSSLError( - String.Format("{0} permission error. Can't find script in prim inventory.", - function)); - } - - UUID ownerID = ti.OwnerID; + UUID ownerID = m_item.OwnerID; //OSSL only may be used if object is in the same group as the parcel if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) { ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); - if (land.LandData.GroupID == ti.GroupID && land.LandData.GroupID != UUID.Zero) + if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) { return; } @@ -394,13 +386,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - if (!m_FunctionPerms[function].AllowedCreators.Contains(ti.CreatorID)) + if (!m_FunctionPerms[function].AllowedCreators.Contains(m_item.CreatorID)) OSSLError( String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", function)); - if (ti.CreatorID != ownerID) + + if (m_item.CreatorID != ownerID) { - if ((ti.CurrentPermissions & (uint)PermissionMask.Modify) != 0) + if ((m_item.CurrentPermissions & (uint)PermissionMask.Modify) != 0) OSSLError( String.Format("{0} permission denied. Script permissions error.", function)); @@ -1183,7 +1176,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osSetStateEvents"); m_host.AddScriptLPS(1); - m_host.SetScriptEvents(m_itemID, events); + m_host.SetScriptEvents(m_item.ItemID, events); } public void osSetRegionWaterHeight(double height) -- cgit v1.1 From 6406d5a5b9c1c4ef261254e7d4446603b496d1fd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 8 May 2012 23:20:27 +0100 Subject: refactor: Eliminate local id parameter from api initialize. This is always available from m_host.LocalId --- .../Shared/Api/Implementation/LSL_Api.cs | 40 ++++++++++------------ .../Shared/Api/Implementation/LS_Api.cs | 4 +-- .../Shared/Api/Implementation/MOD_Api.cs | 4 +-- .../Shared/Api/Implementation/OSSL_Api.cs | 4 +-- 4 files changed, 22 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e8e4dab..afd943b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -84,7 +84,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected IScriptEngine m_ScriptEngine; protected SceneObjectPart m_host; - protected uint m_localID; /// /// The item that hosts this script @@ -108,11 +107,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected Dictionary m_userInfoCache = new Dictionary(); - public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) { m_ScriptEngine = ScriptEngine; m_host = host; - m_localID = localID; m_item = item; m_ScriptDelayFactor = @@ -843,7 +841,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID.TryParse(ID, out keyID); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) - return wComm.Listen(m_localID, m_item.ItemID, m_host.UUID, channelID, name, keyID, msg); + return wComm.Listen(m_host.LocalId, m_item.ItemID, m_host.UUID, channelID, name, keyID, msg); else return -1; } @@ -870,7 +868,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID keyID = UUID.Zero; UUID.TryParse(id, out keyID); - AsyncCommands.SensorRepeatPlugin.SenseOnce(m_localID, m_item.ItemID, name, keyID, type, range, arc, m_host); + AsyncCommands.SensorRepeatPlugin.SenseOnce(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, m_host); } public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) @@ -879,13 +877,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID keyID = UUID.Zero; UUID.TryParse(id, out keyID); - AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_localID, m_item.ItemID, name, keyID, type, range, arc, rate, m_host); + AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, rate, m_host); } public void llSensorRemove() { m_host.AddScriptLPS(1); - AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_localID, m_item.ItemID); + AsyncCommands.SensorRepeatPlugin.UnSetSenseRepeaterEvents(m_host.LocalId, m_item.ItemID); } public string resolveName(UUID objecUUID) @@ -2874,7 +2872,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api sec = m_MinTimerInterval; m_host.AddScriptLPS(1); // Setting timer repeat - AsyncCommands.TimerPlugin.SetTimerEvent(m_localID, m_item.ItemID, sec); + AsyncCommands.TimerPlugin.SetTimerEvent(m_host.LocalId, m_item.ItemID, sec); } public virtual void llSleep(double sec) @@ -2937,7 +2935,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) { - presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_item.ItemID); + presence.RegisterControlEventsToScript(controls, accept, pass_on, m_host.LocalId, m_item.ItemID); } } } @@ -2958,7 +2956,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) { // Unregister controls from Presence - presence.UnRegisterControlEventsToScript(m_localID, m_item.ItemID); + presence.UnRegisterControlEventsToScript(m_host.LocalId, m_item.ItemID); // Remove Take Control permission. m_item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS; } @@ -4089,7 +4087,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID rq = UUID.Random(); UUID tid = AsyncCommands. - DataserverPlugin.RegisterRequest(m_localID, + DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString()); AsyncCommands. @@ -4110,7 +4108,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (item.Type == 3 && item.Name == name) { UUID tid = AsyncCommands. - DataserverPlugin.RegisterRequest(m_localID, + DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, item.AssetID.ToString()); Vector3 region = new Vector3( @@ -6564,7 +6562,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); if (xmlrpcMod.IsEnabled()) { - UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_item.ItemID, UUID.Zero); + UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero); IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface(); if (xmlRpcRouter != null) { @@ -6594,7 +6592,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); ScriptSleep(3000); - return (xmlrpcMod.SendRemoteData(m_localID, m_item.ItemID, channel, dest, idata, sdata)).ToString(); + return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); } public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) @@ -9083,7 +9081,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID rq = UUID.Random(); UUID tid = AsyncCommands. - DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, rq.ToString()); + DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString()); AsyncCommands. DataserverPlugin.DataserverReply(rq.ToString(), reply); @@ -9982,8 +9980,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - UUID reqID = httpScriptMod. - StartHttpRequest(m_localID, m_item.ItemID, url, param, httpHeaders, body); + UUID reqID + = httpScriptMod.StartHttpRequest(m_host.LocalId, m_item.ItemID, url, param, httpHeaders, body); if (reqID != UUID.Zero) return reqID.ToString(); @@ -10413,7 +10411,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // was: UUID tid = tid = AsyncCommands. - UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, assetID.ToString()); + UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); if (NotecardCache.IsCached(assetID)) { @@ -10475,7 +10473,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // was: UUID tid = tid = AsyncCommands. - UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, assetID.ToString()); + UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); if (NotecardCache.IsCached(assetID)) { @@ -10561,7 +10559,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID rq = UUID.Random(); - AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, rq.ToString()); + AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString()); AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id))); @@ -10577,7 +10575,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID rq = UUID.Random(); - AsyncCommands.DataserverPlugin.RegisterRequest(m_localID, m_item.ItemID, rq.ToString()); + AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, rq.ToString()); AsyncCommands.DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id)); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index cd47d96..795de80 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs @@ -58,15 +58,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { internal IScriptEngine m_ScriptEngine; internal SceneObjectPart m_host; - internal uint m_localID; internal bool m_LSFunctionsEnabled = false; internal IScriptModuleComms m_comms = null; - public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) { m_ScriptEngine = ScriptEngine; m_host = host; - m_localID = localID; if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) m_LSFunctionsEnabled = true; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index a578b50..4bd3dff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -57,16 +57,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { internal IScriptEngine m_ScriptEngine; internal SceneObjectPart m_host; - internal uint m_localID; internal TaskInventoryItem m_item; internal bool m_MODFunctionsEnabled = false; internal IScriptModuleComms m_comms = null; - public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) { m_ScriptEngine = ScriptEngine; m_host = host; - m_localID = localID; m_item = item; if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false)) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 9b2022a..ad1a358 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -133,7 +133,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal IScriptEngine m_ScriptEngine; internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there internal SceneObjectPart m_host; - internal uint m_localID; internal TaskInventoryItem m_item; internal bool m_OSFunctionsEnabled = false; internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; @@ -141,11 +140,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal float m_ScriptDistanceFactor = 1.0f; internal Dictionary m_FunctionPerms = new Dictionary(); - public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, TaskInventoryItem item) + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) { m_ScriptEngine = ScriptEngine; m_host = host; - m_localID = localID; m_item = item; if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) -- cgit v1.1 From 61e99bcdcba5480aa8a2a8b8e2f2b0a66c08e6b4 Mon Sep 17 00:00:00 2001 From: Talun Date: Tue, 8 May 2012 15:52:25 +0100 Subject: Mantis 6015 new LSL function llGetAgentList. Details in the lsl wiki --- .../Shared/Api/Implementation/LSL_Api.cs | 85 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 1 + .../Shared/Api/Runtime/LSL_Constants.cs | 5 ++ .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 ++ 4 files changed, 96 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index afd943b..5b5cab8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5529,6 +5529,91 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); return "en-us"; } + /// + /// http://wiki.secondlife.com/wiki/LlGetAgentList + /// The list of options is currently not used in SL + /// scope is one of:- + /// AGENT_LIST_REGION - all in the region + /// AGENT_LIST_PARCEL - all in the same parcel as the scripted object + /// AGENT_LIST_PARCEL_OWNER - all in any parcel owned by the owner of the + /// current parcel. + /// + public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options) + { + m_host.AddScriptLPS(1); + + // the constants are 1, 2 and 4 so bits are being set, but you + // get an error "INVALID_SCOPE" if it is anything but 1, 2 and 4 + bool regionWide = scope == ScriptBaseClass.AGENT_LIST_REGION; + bool parcelOwned = scope == ScriptBaseClass.AGENT_LIST_PARCEL_OWNER; + bool parcel = scope == ScriptBaseClass.AGENT_LIST_PARCEL; + + LSL_List result = new LSL_List(); + + if (!regionWide && !parcelOwned && !parcel) + { + result.Add("INVALID_SCOPE"); + return result; + } + + ILandObject land; + Vector3 pos; + UUID id = UUID.Zero; + if (parcel || parcelOwned) + { + pos = m_host.ParentGroup.RootPart.GetWorldPosition(); + land = World.LandChannel.GetLandObject(pos.X, pos.Y); + if (land == null) + { + id = UUID.Zero; + } + else + { + if (parcelOwned) + { + id = land.LandData.OwnerID; + } + else + { + id = land.LandData.GlobalID; + } + } + } + List presenceIds = new List(); + + World.ForEachRootScenePresence( + delegate (ScenePresence ssp) + { + // Gods are not listed in SL + if (!ssp.IsDeleted && ssp.GodLevel == 0.0 && !ssp.IsChildAgent) + { + if (!regionWide) + { + pos = ssp.AbsolutePosition; + land = World.LandChannel.GetLandObject(pos.X, pos.Y); + if (land != null) + { + if (parcelOwned && land.LandData.OwnerID == id || + parcel && land.LandData.GlobalID == id) + { + result.Add(ssp.UUID.ToString()); + } + } + } + else + { + result.Add(ssp.UUID.ToString()); + } + } + // Maximum of 100 results + if (result.Length > 99) + { + return; + } + } + ); + return result; + } public void llAdjustSoundVolume(double volume) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 7a797ac..7f5d1fe 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -109,6 +109,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Vector llGetAccel(); LSL_Integer llGetAgentInfo(string id); LSL_String llGetAgentLanguage(string id); + LSL_List llGetAgentList(LSL_Integer scope, LSL_List options); LSL_Vector llGetAgentSize(string id); LSL_Float llGetAlpha(int face); LSL_Float llGetAndResetTime(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 2a28542..b6c21e6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -501,6 +501,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int OBJECT_STREAMING_COST = 15; public const int OBJECT_PHYSICS_COST = 16; + // for llGetAgentList + public const int AGENT_LIST_PARCEL = 1; + public const int AGENT_LIST_PARCEL_OWNER = 2; + public const int AGENT_LIST_REGION = 4; + // Can not be public const? public static readonly vector ZERO_VECTOR = new vector(0.0, 0.0, 0.0); public static readonly rotation ZERO_ROTATION = new rotation(0.0, 0.0, 0.0, 1.0); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 80fa530..c0bf29c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -389,6 +389,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetAgentLanguage(id); } + public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options) + { + return m_LSL_Functions.llGetAgentList(scope, options); + } + public LSL_Vector llGetAgentSize(string id) { return m_LSL_Functions.llGetAgentSize(id); -- cgit v1.1 From 30a272ba318c2cacc27f6244dcf829c37a789a7c Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Sun, 13 May 2012 16:58:47 -0400 Subject: Modifications for SMTP in OpenSimulator. Email size limit was fixed (was out of step with documentation at 1024, so boosted to 4096). Added configuration item for maximum email size. Redundant sleep inside email module was fixed (LSL Api was already sleeping). Added sleep time configuration item for snooze between email sending for LSL Api. Added two new configuration items (email_max_size and email_pause_time) into the example OpenSim.ini, plus fixed a spelling error (llimits) and odd tabbing. Signed-off-by: BlueWall --- .../Shared/Api/Implementation/LSL_Api.cs | 28 ++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5b5cab8..5bff2e9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -106,6 +106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected IUrlModule m_UrlModule = null; protected Dictionary m_userInfoCache = new Dictionary(); + protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) { @@ -113,6 +114,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host = host; m_item = item; + LoadLimits(); // read script limits from config. + + m_TransferModule = + m_ScriptEngine.World.RequestModuleInterface(); + m_UrlModule = m_ScriptEngine.World.RequestModuleInterface(); + + AsyncCommands = new AsyncCommandManager(ScriptEngine); + } + + /* load configuration items that affect script, object and run-time behavior. */ + private void LoadLimits() + { m_ScriptDelayFactor = m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); m_ScriptDistanceFactor = @@ -125,12 +138,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); if (m_notecardLineReadCharsMax > 65535) m_notecardLineReadCharsMax = 65535; - - m_TransferModule = - m_ScriptEngine.World.RequestModuleInterface(); - m_UrlModule = m_ScriptEngine.World.RequestModuleInterface(); - - AsyncCommands = new AsyncCommandManager(ScriptEngine); + // load limits for particular subsystems. + IConfig SMTPConfig; + if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) { + // there's an smtp config, so load in the snooze time. + EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME); + } } public override Object InitializeLifetimeService() @@ -2877,6 +2890,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public virtual void llSleep(double sec) { +// m_log.Info("llSleep snoozing " + sec + "s."); m_host.AddScriptLPS(1); Thread.Sleep((int)(sec * 1000)); } @@ -3130,7 +3144,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } emailModule.SendEmail(m_host.UUID, address, subject, message); - ScriptSleep(20000); + llSleep(EMAIL_PAUSE_TIME); } public void llGetNextEmail(string address, string subject) -- cgit v1.1 From e7819ce909e7d0bd7494db9af8a8d5dc4212a6cb Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 15 May 2012 01:02:38 +0100 Subject: Port Avination's collision fixes to core. --- .../Shared/Api/Implementation/LSL_Api.cs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5bff2e9..d213c35 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2929,14 +2929,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); m_host.CollisionFilter.Clear(); - if (id != null) - { - m_host.CollisionFilter.Add(accept,id); - } - else - { - m_host.CollisionFilter.Add(accept,name); - } + UUID objectID; + + if (!UUID.TryParse(id, out objectID)) + objectID = UUID.Zero; + + if (objectID == UUID.Zero && name == "") + return; + + m_host.CollisionFilter.Add(accept,objectID.ToString() + name); } public void llTakeControls(int controls, int accept, int pass_on) @@ -4466,11 +4467,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (pass == 0) { - m_host.ParentGroup.PassCollision = false; + m_host.PassCollisions = false; } else { - m_host.ParentGroup.PassCollision = true; + m_host.PassCollisions = true; } } -- cgit v1.1 From 682d4075e3fe7c52d4c29d00ba9dc0456b7322f3 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 23 May 2012 15:07:03 -0400 Subject: Fix llGetSimulatorHostname to return configured hostname --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d213c35..4b28808 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8743,7 +8743,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llGetSimulatorHostname() { m_host.AddScriptLPS(1); - return System.Environment.MachineName; + IUrlModule UrlModule = World.RequestModuleInterface(); + return UrlModule.ExternalHostNameForLSL; } // -- cgit v1.1 From 120f8145fcfe2cdc4e39a92e5838a2a41eb51406 Mon Sep 17 00:00:00 2001 From: Talun Date: Wed, 23 May 2012 00:33:45 +0100 Subject: Mantis 6028 osAvatarStopAnimation not stopping animations via UUID Corrected to stop animations using the animation UUID similar to llStopAnimation. See http://opensimulator.org/wiki/OsAvatarStopAnimation --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ad1a358..5dbd9ec 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -957,16 +957,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence target = (ScenePresence)World.Entities[avatarID]; if (target != null) { - UUID animID = UUID.Zero; - lock (m_host.TaskInventory) + UUID animID = new UUID(); + if (!UUID.TryParse(animation, out animID)) { - foreach (KeyValuePair inv in m_host.TaskInventory) + animID = UUID.Zero; + lock (m_host.TaskInventory) { - if (inv.Value.Name == animation) + foreach (KeyValuePair inv in m_host.TaskInventory) { - if (inv.Value.Type == (int)AssetType.Animation) - animID = inv.Value.AssetID; - continue; + if (inv.Value.Name == animation) + { + if (inv.Value.Type == (int)AssetType.Animation) + animID = inv.Value.AssetID; + continue; + } } } } -- cgit v1.1 From ff53add54dbc666e585b928ba51b4babb7441611 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 May 2012 00:36:01 +0100 Subject: refactor: replace LSL_Api.InventoryKey(string) largely with SceneObjectPartInventory.GetInventoryItem(string) Also gets llStopAnimation() to call KeyOrName rather than duplicating logic. --- .../Shared/Api/Implementation/LSL_Api.cs | 52 +++++++--------------- 1 file changed, 15 insertions(+), 37 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4b28808..9908a39 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -104,9 +104,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected int m_scriptConsoleChannel = 0; protected bool m_scriptConsoleChannelEnabled = false; protected IUrlModule m_UrlModule = null; - protected Dictionary m_userInfoCache = - new Dictionary(); - protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. + protected Dictionary m_userInfoCache = new Dictionary(); + protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) { @@ -304,25 +303,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return UUID.Zero; } - protected UUID InventoryKey(string name) - { - m_host.AddScriptLPS(1); - - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == name) - { - return inv.Value.AssetID; - } - } - } - - return UUID.Zero; - } - - /// /// accepts a valid UUID, -or- a name of an inventory item. /// Returns a valid UUID or UUID.Zero if key invalid and item not found @@ -332,19 +312,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// protected UUID KeyOrName(string k) { - UUID key = UUID.Zero; + UUID key; // if we can parse the string as a key, use it. - if (UUID.TryParse(k, out key)) - { - return key; - } // else try to locate the name in inventory of object. found returns key, - // not found returns UUID.Zero which will translate to the default particle texture - else + // not found returns UUID.Zero + if (!UUID.TryParse(k, out key)) { - return InventoryKey(k); + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k); + + if (item != null) + key = item.AssetID; + else + key = UUID.Zero; } + + return key; } // convert a LSL_Rotation to a Quaternion @@ -3315,17 +3298,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) { - UUID animID = new UUID(); - - if (!UUID.TryParse(anim, out animID)) - { - animID = InventoryKey(anim); - } - ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); if (presence != null) { + UUID animID = KeyOrName(anim); + if (animID == UUID.Zero) presence.Animator.RemoveAnimation(anim); else -- cgit v1.1 From f2a5fad18f30d24cd8911de829ecb1a07b475e38 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 May 2012 00:54:00 +0100 Subject: Use SceneObjectPartInventory.GetInventoryItem() in OSSL.AvatarStopAnimation instead of searching the task inventory manually. --- .../Shared/Api/Implementation/OSSL_Api.cs | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 5dbd9ec..7ea8b7a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -952,27 +952,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID avatarID = (UUID)avatar; m_host.AddScriptLPS(1); + + // FIXME: What we really want to do here is factor out the similar code in llStopAnimation() to a common + // method (though see that doesn't do the is animation check, which is probably a bug) and have both + // these functions call that common code. However, this does mean navigating the brain-dead requirement + // of calling InitLSL() if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence) { ScenePresence target = (ScenePresence)World.Entities[avatarID]; if (target != null) { - UUID animID = new UUID(); + UUID animID; + if (!UUID.TryParse(animation, out animID)) { - animID = UUID.Zero; - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == animation) - { - if (inv.Value.Type == (int)AssetType.Animation) - animID = inv.Value.AssetID; - continue; - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(animation); + if (item != null && item.Type == (int)AssetType.Animation) + animID = item.AssetID; + else + animID = UUID.Zero; } if (animID == UUID.Zero) -- cgit v1.1 From d6476b627752c99a6aea5093d080d3633aa6dde8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 May 2012 01:03:53 +0100 Subject: Use GetInventoryItem() in LSL_Api.InventoryKey(string name, int type). Also removes small bug where calling this method would add 1 to LPS, evne though all callers already did this. --- .../Shared/Api/Implementation/LSL_Api.cs | 24 +++++++--------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 9908a39..6438bcc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -284,23 +284,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected UUID InventoryKey(string name, int type) { - m_host.AddScriptLPS(1); + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == name) - { - if (inv.Value.Type != type) - return UUID.Zero; - - return inv.Value.AssetID; - } - } - } - - return UUID.Zero; + if (item != null && item.Type == type) + return item.AssetID; + else + return UUID.Zero; } /// @@ -1707,14 +1696,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return rgb; } + if (face >= 0 && face < GetNumberOfSides(part)) { texcolor = tex.GetFace((uint)face).RGBA; rgb.x = texcolor.R; rgb.y = texcolor.G; rgb.z = texcolor.B; + return rgb; - } else { -- cgit v1.1 From 33b66009e43fa7c488b06c557dc46273288750d4 Mon Sep 17 00:00:00 2001 From: Blake.Bourque Date: Wed, 23 May 2012 07:38:03 -0400 Subject: One can now get hyoergrid region co-ordinates with llRequestSimulatorData --- .../Shared/Api/Implementation/LSL_Api.cs | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6438bcc..84493b1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9098,7 +9098,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api GridRegion info; - if (m_ScriptEngine.World.RegionInfo.RegionName == simulator) + if (m_ScriptEngine.World.RegionInfo.RegionName == simulator) //Det data for this simulator? + info = new GridRegion(m_ScriptEngine.World.RegionInfo); else info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator); @@ -9111,10 +9112,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(1000); return UUID.Zero.ToString(); } - reply = new LSL_Vector( - info.RegionLocX, - info.RegionLocY, - 0).ToString(); + if (m_ScriptEngine.World.RegionInfo.RegionName != simulator) + { + //Hypergrid Region co-ordinates + uint rx = 0, ry = 0; + Utils.LongToUInts(Convert.ToUInt64(info.RegionSecret), out rx, out ry); + + reply = new LSL_Vector( + rx, + ry, + 0).ToString(); + } + else + { + //Local-cooridnates + reply = new LSL_Vector( + info.RegionLocX, + info.RegionLocY, + 0).ToString(); + } break; case ScriptBaseClass.DATA_SIM_STATUS: if (info != null) -- cgit v1.1 From 0b72f773c7df849b335895d7c7a6cfe949f59f00 Mon Sep 17 00:00:00 2001 From: Talun Date: Tue, 22 May 2012 23:06:40 +0100 Subject: Mantis 6025 llRequestPermissions auto grant for NPCs. If the script requesting permissions is owned by either the NPC or the NPCs owner (if the NPC is created as owned) then grant any permissions automatically. --- .../Shared/Api/Implementation/LSL_Api.cs | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 84493b1..f3787a0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3406,9 +3406,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } ScenePresence presence = World.GetScenePresence(agentID); - if (presence != null) { + // If permissions are being requested from an NPC and were not implicitly granted above then + // auto grant all reuqested permissions if the script is owned by the NPC or the NPCs owner + INPCModule npcModule = World.RequestModuleInterface(); + if (npcModule != null && npcModule.IsNPC(agentID, World)) + { + if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID) + { + lock (m_host.TaskInventory) + { + m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; + m_host.TaskInventory[m_item.ItemID].PermsMask = perm; + } + + m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( + "run_time_permissions", new Object[] { + new LSL_Integer(perm) }, + new DetectParams[0])); + } + // it is an NPC, exit even if the permissions werent granted above, they are not going to answer + // the question! + return; + } + string ownerName = resolveName(m_host.ParentGroup.RootPart.OwnerID); if (ownerName == String.Empty) ownerName = "(hippos)"; -- cgit v1.1 From 7fd38788b4a654983c11efbcddb107feb4b3634a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 May 2012 02:14:32 +0100 Subject: minor: code formatting from 0b72f773 --- .../Shared/Api/Implementation/LSL_Api.cs | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f3787a0..deb68b8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3421,11 +3421,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.TaskInventory[m_item.ItemID].PermsMask = perm; } - m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( - "run_time_permissions", new Object[] { - new LSL_Integer(perm) }, - new DetectParams[0])); + m_ScriptEngine.PostScriptEvent( + m_item.ItemID, + new EventParams( + "run_time_permissions", new Object[] { new LSL_Integer(perm) }, new DetectParams[0])); } + // it is an NPC, exit even if the permissions werent granted above, they are not going to answer // the question! return; @@ -3454,10 +3455,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // Requested agent is not in range, refuse perms - m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( - "run_time_permissions", new Object[] { - new LSL_Integer(0) }, - new DetectParams[0])); + m_ScriptEngine.PostScriptEvent( + m_item.ItemID, + new EventParams("run_time_permissions", new Object[] { new LSL_Integer(0) }, new DetectParams[0])); } void handleScriptAnswer(IClientAPI client, UUID taskID, UUID itemID, int answer) @@ -3476,10 +3476,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.TaskInventory[m_item.ItemID].PermsMask = answer; } - m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( - "run_time_permissions", new Object[] { - new LSL_Integer(answer) }, - new DetectParams[0])); + m_ScriptEngine.PostScriptEvent( + m_item.ItemID, + new EventParams("run_time_permissions", new Object[] { new LSL_Integer(answer) }, new DetectParams[0])); } public LSL_String llGetPermissionsKey() -- cgit v1.1 From 01280e9b9447f41347f7e22302c9d94503398882 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Jun 2012 00:34:18 +0100 Subject: Remove unused ScenePresence list structure in llGetAgentList() --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index deb68b8..fb0fdc9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5583,7 +5583,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } - List presenceIds = new List(); World.ForEachRootScenePresence( delegate (ScenePresence ssp) -- cgit v1.1 From b02db11c6990986a65e6790b5520b15d1c47e51e Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jun 2012 20:38:42 +0200 Subject: Remove a null ref when an avatar's attachment gets the avatar velocity while the avatar is logging in or out. Also remove some unlocking calls without matching locking call. Merge artefact cleanup, again. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5905958..e0b24dc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2498,12 +2498,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - Vector3 vel; + Vector3 vel = Vector3.Zero; if (m_host.ParentGroup.IsAttachment) { ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar); - vel = avatar.Velocity; + if (avatar != null) + vel = avatar.Velocity; } else { @@ -10401,7 +10402,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ShoutError("No permissions to track the camera"); return new LSL_Vector(); } - m_host.TaskInventory.LockItemsForRead(false); // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); @@ -10425,7 +10425,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ShoutError("No permissions to track the camera"); return new LSL_Rotation(); } - m_host.TaskInventory.LockItemsForRead(false); // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); -- cgit v1.1 From 71ba85137f6b85db7c617bd6ee8ef2081b9fab61 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 11 Jun 2012 16:45:52 +0100 Subject: Commitig the Avination implementation of llTeleportAgent and llTeleportAgentGlobalCoords. These do NOT use PERMISSION_TELEPORT like their SL counterparts because that permission is not yet understood by TPVs based on v1.x. --- .../Shared/Api/Implementation/LSL_Api.cs | 94 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 2 + .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 10 +++ 3 files changed, 106 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fb0fdc9..89f2068 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4169,6 +4169,100 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(5000); } + public void llTeleportAgent(string agent, string destination, LSL_Vector pos, LSL_Vector lookAt) + { + m_host.AddScriptLPS(1); + UUID agentId = new UUID(); + + Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); + Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z); + + if (UUID.TryParse(agent, out agentId)) + { + ScenePresence presence = World.GetScenePresence(agentId); + if (presence != null && presence.PresenceType != PresenceType.Npc) + { + // agent must not be a god + if (presence.GodLevel >= 200) return; + + if (destination == String.Empty) + destination = World.RegionInfo.RegionName; + + // agent must be over the owners land + if (m_host.OwnerID == World.LandChannel.GetLandObject( + presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) + { + DoLLTeleport(presence, destination, targetPos, targetLookAt); + } + else // or must be wearing the prim + { + if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) + { + DoLLTeleport(presence, destination, targetPos, targetLookAt); + } + } + } + } + } + + public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector pos, LSL_Vector lookAt) + { + m_host.AddScriptLPS(1); + UUID agentId = new UUID(); + + ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y); + + Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); + Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z); + if (UUID.TryParse(agent, out agentId)) + { + ScenePresence presence = World.GetScenePresence(agentId); + if (presence != null && presence.PresenceType != PresenceType.Npc) + { + // agent must not be a god + if (presence.GodLevel >= 200) return; + + // agent must be over the owners land + if (m_host.OwnerID == World.LandChannel.GetLandObject( + presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) + { + World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); + } + else // or must be wearing the prim + { + if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) + { + World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); + } + } + } + } + } + + private void DoLLTeleport(ScenePresence sp, string destination, Vector3 targetPos, Vector3 targetLookAt) + { + UUID assetID = KeyOrName(destination); + + // The destinaion is not an asset ID and also doesn't name a landmark. + // Use it as a sim name + if (assetID == UUID.Zero) + { + World.RequestTeleportLocation(sp.ControllingClient, destination, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); + return; + } + + AssetBase lma = World.AssetService.Get(assetID.ToString()); + if (lma == null) + return; + + if (lma.Type != (sbyte)AssetType.Landmark) + return; + + AssetLandmark lm = new AssetLandmark(lma); + + World.RequestTeleportLocation(sp.ControllingClient, lm.RegionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); + } + public void llTextBox(string agent, string message, int chatChannel) { IDialogModule dm = World.RequestModuleInterface(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 7f5d1fe..d39b204 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -403,6 +403,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llTargetOmega(LSL_Vector axis, double spinrate, double gain); void llTargetRemove(int number); void llTeleportAgentHome(string agent); + void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt); + void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt); void llTextBox(string avatar, string message, int chat_channel); LSL_String llToLower(string source); LSL_String llToUpper(string source); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index c0bf29c..06f5617 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1833,6 +1833,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llTargetRemove(number); } + public void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt) + { + m_LSL_Functions.llTeleportAgent(agent, simname, pos, lookAt); + } + + public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt) + { + m_LSL_Functions.llTeleportAgentGlobalCoords(agent, global, pos, lookAt); + } + public void llTeleportAgentHome(string agent) { m_LSL_Functions.llTeleportAgentHome(agent); -- cgit v1.1 From 4e18e71089eb1ef84bad8f09dd4a9d18f09bec5e Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 13 Jun 2012 02:32:25 +0100 Subject: Committing the Avination implementation of llCastRay. This is a complete rewrite wich does it's thing independently of physics. Enjoy! --- .../Shared/Api/Implementation/LSL_Api.cs | 445 ++++++++++++++++----- 1 file changed, 345 insertions(+), 100 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 89f2068..a8679e2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10781,155 +10781,400 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return rq.ToString(); } + private struct Tri + { + public Vector3 p1; + public Vector3 p2; + public Vector3 p3; + } + + private bool InBoundingBox(ScenePresence avatar, Vector3 point) + { + float height = avatar.Appearance.AvatarHeight; + Vector3 b1 = avatar.AbsolutePosition + new Vector3(-0.22f, -0.22f, -height/2); + Vector3 b2 = avatar.AbsolutePosition + new Vector3(0.22f, 0.22f, height/2); + + if (point.X > b1.X && point.X < b2.X && + point.Y > b1.Y && point.Y < b2.Y && + point.Z > b1.Z && point.Z < b2.Z) + return true; + return false; + } + + private ContactResult[] AvatarIntersection(Vector3 rayStart, Vector3 rayEnd) + { + List contacts = new List(); + + Vector3 ab = rayEnd - rayStart; + + World.ForEachScenePresence(delegate(ScenePresence sp) + { + Vector3 ac = sp.AbsolutePosition - rayStart; + Vector3 bc = sp.AbsolutePosition - rayEnd; + + double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); + + if (d > 1.5) + return; + + double d2 = Vector3.Dot(Vector3.Negate(ab), ac); + + if (d2 > 0) + return; + + double dp = Math.Sqrt(Vector3.Mag(ac) * Vector3.Mag(ac) - d * d); + Vector3 p = rayStart + Vector3.Divide(Vector3.Multiply(ab, (float)dp), (float)Vector3.Mag(ab)); + + if (!InBoundingBox(sp, p)) + return; + + ContactResult result = new ContactResult (); + result.ConsumerID = sp.LocalId; + result.Depth = Vector3.Distance(rayStart, p); + result.Normal = Vector3.Zero; + result.Pos = p; + + contacts.Add(result); + }); + + return contacts.ToArray(); + } + + private ContactResult[] ObjectIntersection(Vector3 rayStart, Vector3 rayEnd, bool includePhysical, bool includeNonPhysical, bool includePhantom) + { + Ray ray = new Ray(rayStart, Vector3.Normalize(rayEnd - rayStart)); + List contacts = new List(); + + Vector3 ab = rayEnd - rayStart; + + World.ForEachSOG(delegate(SceneObjectGroup group) + { + if (m_host.ParentGroup == group) + return; + + if (group.IsAttachment) + return; + + if (group.RootPart.PhysActor == null) + { + if (!includePhantom) + return; + } + else + { + if (group.RootPart.PhysActor.IsPhysical) + { + if (!includePhysical) + return; + } + else + { + if (!includeNonPhysical) + return; + } + } + + // Find the radius ouside of which we don't even need to hit test + float minX; + float maxX; + float minY; + float maxY; + float minZ; + float maxZ; + + float radius = 0.0f; + + group.GetAxisAlignedBoundingBoxRaw(out minX, out maxX, out minY, out maxY, out minZ, out maxZ); + + if (Math.Abs(minX) > radius) + radius = Math.Abs(minX); + if (Math.Abs(minY) > radius) + radius = Math.Abs(minY); + if (Math.Abs(minZ) > radius) + radius = Math.Abs(minZ); + if (Math.Abs(maxX) > radius) + radius = Math.Abs(maxX); + if (Math.Abs(maxY) > radius) + radius = Math.Abs(maxY); + if (Math.Abs(maxZ) > radius) + radius = Math.Abs(maxZ); + + Vector3 ac = group.AbsolutePosition - rayStart; + Vector3 bc = group.AbsolutePosition - rayEnd; + + double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); + + // Too far off ray, don't bother + if (d > radius) + return; + + // Behind ray, drop + double d2 = Vector3.Dot(Vector3.Negate(ab), ac); + if (d2 > 0) + return; + + EntityIntersection intersection = group.TestIntersection(ray, true, false); + // Miss. + if (!intersection.HitTF) + return; + + ContactResult result = new ContactResult (); + result.ConsumerID = group.LocalId; + result.Depth = intersection.distance; + result.Normal = intersection.normal; + result.Pos = intersection.ipoint; + + contacts.Add(result); + }); + + return contacts.ToArray(); + } + + private ContactResult? GroundIntersection(Vector3 rayStart, Vector3 rayEnd) + { + double[,] heightfield = World.Heightmap.GetDoubles(); + List contacts = new List(); + + double min = 2048.0; + double max = 0.0; + + // Find the min and max of the heightfield + for (int x = 0 ; x < World.Heightmap.Width ; x++) + { + for (int y = 0 ; y < World.Heightmap.Height ; y++) + { + if (heightfield[x, y] > max) + max = heightfield[x, y]; + if (heightfield[x, y] < min) + min = heightfield[x, y]; + } + } + + + // A ray extends past rayEnd, but doesn't go back before + // rayStart. If the start is above the highest point of the ground + // and the ray goes up, we can't hit the ground. Ever. + if (rayStart.Z > max && rayEnd.Z >= rayStart.Z) + return null; + + // Same for going down + if (rayStart.Z < min && rayEnd.Z <= rayStart.Z) + return null; + + List trilist = new List(); + + // Create our triangle list + for (int x = 1 ; x < World.Heightmap.Width ; x++) + { + for (int y = 1 ; y < World.Heightmap.Height ; y++) + { + Tri t1 = new Tri(); + Tri t2 = new Tri(); + + Vector3 p1 = new Vector3(x-1, y-1, (float)heightfield[x-1, y-1]); + Vector3 p2 = new Vector3(x, y-1, (float)heightfield[x, y-1]); + Vector3 p3 = new Vector3(x, y, (float)heightfield[x, y]); + Vector3 p4 = new Vector3(x-1, y, (float)heightfield[x-1, y]); + + t1.p1 = p1; + t1.p2 = p2; + t1.p3 = p3; + + t2.p1 = p3; + t2.p2 = p4; + t2.p3 = p1; + + trilist.Add(t1); + trilist.Add(t2); + } + } + + // Ray direction + Vector3 rayDirection = rayEnd - rayStart; + + foreach (Tri t in trilist) + { + // Compute triangle plane normal and edges + Vector3 u = t.p2 - t.p1; + Vector3 v = t.p3 - t.p1; + Vector3 n = Vector3.Cross(u, v); + + if (n == Vector3.Zero) + continue; + + Vector3 w0 = rayStart - t.p1; + double a = -Vector3.Dot(n, w0); + double b = Vector3.Dot(n, rayDirection); + + // Not intersecting the plane, or in plane (same thing) + // Ignoring this MAY cause the ground to not be detected + // sometimes + if (Math.Abs(b) < 0.000001) + continue; + + double r = a / b; + + // ray points away from plane + if (r < 0.0) + continue; + + Vector3 ip = rayStart + Vector3.Multiply(rayDirection, (float)r); + + float uu = Vector3.Dot(u, u); + float uv = Vector3.Dot(u, v); + float vv = Vector3.Dot(v, v); + Vector3 w = ip - t.p1; + float wu = Vector3.Dot(w, u); + float wv = Vector3.Dot(w, v); + float d = uv * uv - uu * vv; + + float cs = (uv * wv - vv * wu) / d; + if (cs < 0 || cs > 1.0) + continue; + float ct = (uv * wu - uu * wv) / d; + if (ct < 0 || (cs + ct) > 1.0) + continue; + + // Add contact point + ContactResult result = new ContactResult (); + result.ConsumerID = 0; + result.Depth = Vector3.Distance(rayStart, ip); + result.Normal = n; + result.Pos = ip; + + contacts.Add(result); + } + + if (contacts.Count == 0) + return null; + + contacts.Sort(delegate(ContactResult a, ContactResult b) + { + return (int)(a.Depth - b.Depth); + }); + + return contacts[0]; + } + public LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options) { + LSL_List list = new LSL_List(); + m_host.AddScriptLPS(1); - Vector3 dir = new Vector3((float)(end-start).x, (float)(end-start).y, (float)(end-start).z); - Vector3 startvector = new Vector3((float)start.x, (float)start.y, (float)start.z); - Vector3 endvector = new Vector3((float)end.x, (float)end.y, (float)end.z); + Vector3 rayStart = new Vector3((float)start.x, (float)start.y, (float)start.z); + Vector3 rayEnd = new Vector3((float)end.x, (float)end.y, (float)end.z); + Vector3 dir = rayEnd - rayStart; - int count = 0; -// int detectPhantom = 0; + float dist = Vector3.Mag(dir); + + int count = 1; + bool detectPhantom = false; int dataFlags = 0; int rejectTypes = 0; for (int i = 0; i < options.Length; i += 2) { if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS) - { count = options.GetLSLIntegerItem(i + 1); - } -// else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM) -// { -// detectPhantom = options.GetLSLIntegerItem(i + 1); -// } + else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM) + detectPhantom = (options.GetLSLIntegerItem(i + 1) > 0); else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DATA_FLAGS) - { dataFlags = options.GetLSLIntegerItem(i + 1); - } else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES) - { rejectTypes = options.GetLSLIntegerItem(i + 1); - } } - LSL_List list = new LSL_List(); - List results = World.PhysicsScene.RaycastWorld(startvector, dir, dir.Length(), count); - - double distance = Util.GetDistanceTo(startvector, endvector); + if (count > 16) + count = 16; - if (distance == 0) - distance = 0.001; - - Vector3 posToCheck = startvector; - ITerrainChannel channel = World.RequestModuleInterface(); + List results = new List(); bool checkTerrain = !((rejectTypes & ScriptBaseClass.RC_REJECT_LAND) == ScriptBaseClass.RC_REJECT_LAND); bool checkAgents = !((rejectTypes & ScriptBaseClass.RC_REJECT_AGENTS) == ScriptBaseClass.RC_REJECT_AGENTS); bool checkNonPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) == ScriptBaseClass.RC_REJECT_NONPHYSICAL); bool checkPhysical = !((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) == ScriptBaseClass.RC_REJECT_PHYSICAL); - for (float i = 0; i <= distance; i += 0.1f) + + if (checkTerrain) { - posToCheck = startvector + (dir * (i / (float)distance)); + ContactResult? groundContact = GroundIntersection(rayStart, rayEnd); + if (groundContact != null) + results.Add((ContactResult)groundContact); + } - if (checkTerrain && channel[(int)(posToCheck.X + startvector.X), (int)(posToCheck.Y + startvector.Y)] < posToCheck.Z) - { - ContactResult result = new ContactResult(); - result.ConsumerID = 0; - result.Depth = 0; - result.Normal = Vector3.Zero; - result.Pos = posToCheck; - results.Add(result); - checkTerrain = false; - } + if (checkAgents) + { + ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd); + foreach (ContactResult r in agentHits) + results.Add(r); + } - if (checkAgents) - { - World.ForEachRootScenePresence(delegate(ScenePresence sp) - { - if (sp.AbsolutePosition.ApproxEquals(posToCheck, sp.PhysicsActor.Size.X)) - { - ContactResult result = new ContactResult (); - result.ConsumerID = sp.LocalId; - result.Depth = 0; - result.Normal = Vector3.Zero; - result.Pos = posToCheck; - results.Add(result); - } - }); - } + if (checkPhysical || checkNonPhysical || detectPhantom) + { + ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, checkPhysical, checkNonPhysical, detectPhantom); + foreach (ContactResult r in objectHits) + results.Add(r); } - int refcount = 0; + results.Sort(delegate(ContactResult a, ContactResult b) + { + return a.Depth.CompareTo(b.Depth); + }); + + int values = 0; + SceneObjectGroup thisgrp = m_host.ParentGroup; + foreach (ContactResult result in results) { - if ((rejectTypes & ScriptBaseClass.RC_REJECT_LAND) - == ScriptBaseClass.RC_REJECT_LAND && result.ConsumerID == 0) + if (result.Depth > dist) continue; - ISceneEntity entity = World.GetSceneObjectPart(result.ConsumerID); + // physics ray can return colisions with host prim + if (m_host.LocalId == result.ConsumerID) + continue; - if (entity == null && (rejectTypes & ScriptBaseClass.RC_REJECT_AGENTS) != ScriptBaseClass.RC_REJECT_AGENTS) - entity = World.GetScenePresence(result.ConsumerID); //Only check if we should be looking for agents + UUID itemID = UUID.Zero; + int linkNum = 0; - if (entity == null) + SceneObjectPart part = World.GetSceneObjectPart(result.ConsumerID); + // It's a prim! + if (part != null) { - list.Add(UUID.Zero); - - if ((dataFlags & ScriptBaseClass.RC_GET_LINK_NUM) == ScriptBaseClass.RC_GET_LINK_NUM) - list.Add(0); + // dont detect members of same object ??? + if (part.ParentGroup == thisgrp) + continue; - list.Add(result.Pos); - - if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL) - list.Add(result.Normal); + if ((dataFlags & ScriptBaseClass.RC_GET_ROOT_KEY) == ScriptBaseClass.RC_GET_ROOT_KEY) + itemID = part.ParentGroup.UUID; + else + itemID = part.UUID; - continue; //Can't find it, so add UUID.Zero + linkNum = part.LinkNum; } - - /*if (detectPhantom == 0 && intersection.obj is ISceneChildEntity && - ((ISceneChildEntity)intersection.obj).PhysActor == null) - continue;*/ //Can't do this ATM, physics engine knows only of non phantom objects - - if (entity is SceneObjectPart) + else { - PhysicsActor pa = ((SceneObjectPart)entity).PhysActor; - - if (pa != null && pa.IsPhysical) - { - if (!checkPhysical) - continue; - } - else - { - if (!checkNonPhysical) - continue; - } + ScenePresence sp = World.GetScenePresence(result.ConsumerID); + /// It it a boy? a girl? + if (sp != null) + itemID = sp.UUID; } - refcount++; - if ((dataFlags & ScriptBaseClass.RC_GET_ROOT_KEY) == ScriptBaseClass.RC_GET_ROOT_KEY && entity is SceneObjectPart) - list.Add(((SceneObjectPart)entity).ParentGroup.UUID); - else - list.Add(entity.UUID); + list.Add(new LSL_String(itemID.ToString())); + list.Add(new LSL_String(result.Pos.ToString())); if ((dataFlags & ScriptBaseClass.RC_GET_LINK_NUM) == ScriptBaseClass.RC_GET_LINK_NUM) - { - if (entity is SceneObjectPart) - list.Add(((SceneObjectPart)entity).LinkNum); - else - list.Add(0); - } - - list.Add(result.Pos); + list.Add(new LSL_Integer(linkNum)); if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL) - list.Add(result.Normal); + list.Add(new LSL_Vector(result.Normal.X, result.Normal.Y, result.Normal.Z)); + + values++; + if (values >= count) + break; } - list.Add(refcount); //The status code, either the # of contacts, RCERR_SIM_PERF_LOW, or RCERR_CAST_TIME_EXCEEDED + list.Add(new LSL_Integer(values)); return list; } -- cgit v1.1 From 1f34c8277d2584f0b43a43555f8b0abded4a1aa4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 13 Jun 2012 04:05:02 +0100 Subject: In the osGetGrid functions, if the [GridInfo] section does not exist then return "Configuration Error", as already happens if there is no GridInfoURI --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7ea8b7a..7fa25f5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1965,7 +1965,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { string retval = String.Empty; IConfigSource config = m_ScriptEngine.ConfigSource; - string url = config.Configs["GridInfo"].GetString("GridInfoURI", String.Empty); + string url = null; + + IConfig gridInfoConfig = config.Configs["GridInfo"]; + + if (gridInfoConfig != null) + url = gridInfoConfig.GetString("GridInfoURI", String.Empty); if (String.IsNullOrEmpty(url)) return "Configuration Error!"; -- cgit v1.1 From 988112d4460adb2c6621027145f4fe60b079c7e5 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 26 Jun 2012 15:14:25 -0400 Subject: Add stub for llCastRay --- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 06f5617..a0b3bc8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -954,6 +954,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llRequestDisplayName(id); } + public LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options) + { + return m_LSL_Functions.llCastRay(start, end, options); + } + public void llLinkParticleSystem(int linknum, LSL_List rules) { m_LSL_Functions.llLinkParticleSystem(linknum, rules); -- cgit v1.1 From a1a22a2f1034a1feb67b141abf4b138248cdb356 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 28 Jun 2012 22:02:20 +0100 Subject: Revert "Mantis 5977 Corrections to llRegionSayTo" This reverts commit 679da63da617d031e5e7ae3f2d2a29db1a23ace3. Conflicts: OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 41de257..ffa19d9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -921,22 +921,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRegionSayTo(string target, int channel, string msg) { + string error = String.Empty; + if (msg.Length > 1023) msg = msg.Substring(0, 1023); m_host.AddScriptLPS(1); - if (channel == ScriptBaseClass.DEBUG_CHANNEL) - { - return; - } - UUID TargetID; UUID.TryParse(target, out TargetID); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) - wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg); + if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error)) + LSLError(error); } public LSL_Integer llListen(int channelID, string name, string ID, string msg) -- cgit v1.1 From bfa6896678872a4e796ec4de22e83b6cead3ba17 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 28 Jun 2012 23:31:23 +0100 Subject: Change AttachmentsModule.DetachSingleAttachmentToInv() to accept a SOG directly instead of an item ID to then shuffle through attachments, saving CPU busywork. Almost all callers already had the sog to hand. Still checking that it's really an attachment, but now by inspecting SOG.AttachedAvatar --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a8679e2..12eb098 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2990,15 +2990,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private void DetachWrapper(object o) { - SceneObjectPart host = (SceneObjectPart)o; - - SceneObjectGroup grp = host.ParentGroup; - UUID itemID = grp.FromItemID; - ScenePresence presence = World.GetScenePresence(host.OwnerID); - - IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; - if (attachmentsModule != null) - attachmentsModule.DetachSingleAttachmentToInv(presence, itemID); + if (World.AttachmentsModule != null) + { + SceneObjectPart host = (SceneObjectPart)o; + ScenePresence presence = World.GetScenePresence(host.OwnerID); + World.AttachmentsModule.DetachSingleAttachmentToInv(presence, host.ParentGroup); + } } public void llAttachToAvatar(int attachmentPoint) -- cgit v1.1 From 58b13d51a7eddb442e38e6dc6790a9e7cf68bad7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 20:57:48 +0100 Subject: refactor: make llGiveInventory() use existing GetInventoryItem() method rather than iterate through TaskInventory itself. --- .../Shared/Api/Implementation/LSL_Api.cs | 35 +++++++--------------- 1 file changed, 11 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 12eb098..8a3efa7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3860,11 +3860,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llGiveInventory(string destination, string inventory) { m_host.AddScriptLPS(1); - bool found = false; + UUID destId = UUID.Zero; - UUID objId = UUID.Zero; - int assetType = 0; - string objName = String.Empty; if (!UUID.TryParse(destination, out destId)) { @@ -3872,28 +3869,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - // move the first object found with this inventory name - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == inventory) - { - found = true; - objId = inv.Key; - assetType = inv.Value.Type; - objName = inv.Value.Name; - break; - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory); - if (!found) + if (item == null) { llSay(0, String.Format("Could not find object '{0}'", inventory)); throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); } + UUID objId = item.ItemID; + // check if destination is an object if (World.GetSceneObjectPart(destId) != null) { @@ -3924,21 +3909,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; byte[] bucket = new byte[17]; - bucket[0] = (byte)assetType; + bucket[0] = (byte)item.Type; byte[] objBytes = agentItem.ID.GetBytes(); Array.Copy(objBytes, 0, bucket, 1, 16); GridInstantMessage msg = new GridInstantMessage(World, - m_host.UUID, m_host.Name+", an object owned by "+ - resolveName(m_host.OwnerID)+",", destId, + m_host.UUID, m_host.Name + ", an object owned by " + + resolveName(m_host.OwnerID) + ",", destId, (byte)InstantMessageDialog.TaskInventoryOffered, - false, objName+"\n"+m_host.Name+" is located at "+ + false, item.Name + "\n" + m_host.Name + " is located at " + World.RegionInfo.RegionName+" "+ m_host.AbsolutePosition.ToString(), agentItem.ID, true, m_host.AbsolutePosition, bucket); + if (m_TransferModule != null) m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); + ScriptSleep(3000); } } -- cgit v1.1 From ae64d089c669a9f953fc0992ca4de3a700395def Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:05:51 +0100 Subject: refactor: In llRemoveInventory() use existing GetInventoryItem() method rather than have it iterate through TaskInventory itself. --- .../Shared/Api/Implementation/LSL_Api.cs | 23 +++++++++------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8a3efa7..b52ebac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3934,20 +3934,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Name == name) - { - if (item.ItemID == m_item.ItemID) - throw new ScriptDeleteException(); - else - m_host.Inventory.RemoveInventoryItem(item.ItemID); - return; - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); + + if (item == null) + return; + + if (item.ItemID == m_item.ItemID) + throw new ScriptDeleteException(); + else + m_host.Inventory.RemoveInventoryItem(item.ItemID); } public void llSetText(string text, LSL_Vector color, double alpha) -- cgit v1.1 From 3717812ce090cae850449ed82463545c079df68d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:15:00 +0100 Subject: refactor: In llCollisionSound() use existing GetInventoryItem() method rather than have it iterate through TaskInventory itself. --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b52ebac..ff4b690 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4290,18 +4290,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID soundId = UUID.Zero; if (!UUID.TryParse(impact_sound, out soundId)) { - lock (m_host.TaskInventory) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == (int)AssetType.Sound && item.Name == impact_sound) - { - soundId = item.AssetID; - break; - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(impact_sound); + + if (item != null && item.Type == (int)AssetType.Sound) + soundId = item.AssetID; } + m_host.CollisionSound = soundId; m_host.CollisionSoundVolume = (float)impact_volume; } -- cgit v1.1 From 3769739ca75bd28a126034a74848012164db31b6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:19:16 +0100 Subject: In llRequestInventoryData() use GetInventoryItems() rather than cloning TaskInventory directory GetInventoryItems() returns a new list and so is equivalent, and creates this list under lock whereas Clone() is not thread-safe --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ff4b690..66d99a2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4084,9 +4084,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); - - foreach (TaskInventoryItem item in itemDictionary.Values) + foreach (TaskInventoryItem item in m_host.Inventory.GetInventoryItems()) { if (item.Type == 3 && item.Name == name) { @@ -4118,6 +4116,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return tid.ToString(); } } + ScriptSleep(1000); return String.Empty; } -- cgit v1.1 From 4b2b14dad12d5a8f64609e7eeb3da62a5ca2f8b1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:22:43 +0100 Subject: In llMessageLinked() use GetInventoryItems() rather than cloning TaskInventory directory GetInventoryItems() returns a new list and so is equivalent, and creates this list under lock whereas Clone() is not thread-safe --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 66d99a2..f57f752 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4116,7 +4116,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return tid.ToString(); } } - + ScriptSleep(1000); return String.Empty; } @@ -4333,9 +4333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID partItemID; foreach (SceneObjectPart part in parts) { - TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); - - foreach (TaskInventoryItem item in itemsDictionary.Values) + foreach (TaskInventoryItem item in part.Inventory.GetInventoryItems()) { if (item.Type == ScriptBaseClass.INVENTORY_SCRIPT) { -- cgit v1.1 From 0e3fce9b5c26ee21dee64f8667e7b47b71dbdb3a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:25:58 +0100 Subject: refactor: In llGetInventoryKey() use existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 24 ++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f57f752..b0602fc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4703,22 +4703,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); + + if (item == null) + return UUID.Zero.ToString(); + + if ((item.CurrentPermissions + & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) + == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == name) - { - if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) - { - return inv.Value.AssetID.ToString(); - } - else - { - return UUID.Zero.ToString(); - } - } - } + return item.AssetID.ToString(); } return UUID.Zero.ToString(); -- cgit v1.1 From dff7cae2ee78942d97f8481b16e0f682dfcce038 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:33:35 +0100 Subject: refactor: replace use of LSL_Api.GetTaskInventoryItem() with existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 33 ++++++++-------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b0602fc..813fffd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6296,20 +6296,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - protected UUID GetTaskInventoryItem(string name) - { - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == name) - return inv.Key; - } - } - - return UUID.Zero; - } - public void llGiveInventoryList(string destination, string category, LSL_List inventory) { m_host.AddScriptLPS(1); @@ -6322,16 +6308,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (Object item in inventory.Data) { + string rawItemString = item.ToString(); + UUID itemID; - if (UUID.TryParse(item.ToString(), out itemID)) + if (UUID.TryParse(rawItemString, out itemID)) { itemList.Add(itemID); } else { - itemID = GetTaskInventoryItem(item.ToString()); - if (itemID != UUID.Zero) - itemList.Add(itemID); + TaskInventoryItem taskItem = m_host.Inventory.GetInventoryItem(rawItemString); + + if (taskItem != null) + itemList.Add(taskItem.ItemID); } } @@ -6349,11 +6338,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Array.Copy(objBytes, 0, bucket, 1, 16); GridInstantMessage msg = new GridInstantMessage(World, - m_host.UUID, m_host.Name+", an object owned by "+ - resolveName(m_host.OwnerID)+",", destID, + m_host.UUID, m_host.Name + ", an object owned by " + + resolveName(m_host.OwnerID) + ",", destID, (byte)InstantMessageDialog.InventoryOffered, - false, category+"\n"+m_host.Name+" is located at "+ - World.RegionInfo.RegionName+" "+ + false, category + "\n" + m_host.Name + " is located at " + + World.RegionInfo.RegionName + " " + m_host.AbsolutePosition.ToString(), folderID, true, m_host.AbsolutePosition, bucket); -- cgit v1.1 From 857494f6bdef5aef8cfcbee84ca668c2371bfdf0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:36:44 +0100 Subject: refactor: In llRemoteLoadScriptPin() use existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 25 +++++----------------- 1 file changed, 5 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 813fffd..a1620e7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6644,9 +6644,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { m_host.AddScriptLPS(1); - bool found = false; + UUID destId = UUID.Zero; - UUID srcId = UUID.Zero; if (!UUID.TryParse(target, out destId)) { @@ -6661,31 +6660,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // copy the first script found with this inventory name - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == name) - { - // make sure the object is a script - if (10 == inv.Value.Type) - { - found = true; - srcId = inv.Key; - break; - } - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); - if (!found) + // make sure the object is a script + if (item == null || item.Type != 10) { llSay(0, "Could not find script " + name); return; } // the rest of the permission checks are done in RezScript, so check the pin there as well - World.RezScriptFromPrim(srcId, m_host, destId, pin, running, start_param); + World.RezScriptFromPrim(item.ItemID, m_host, destId, pin, running, start_param); // this will cause the delay even if the script pin or permissions were wrong - seems ok ScriptSleep(3000); -- cgit v1.1 From f9fa34408dd178eb202e0cc1336da67cc0a494f0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:42:04 +0100 Subject: refactor: in llGetInventoryPermMask use existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 42 ++++++++++------------ 1 file changed, 19 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a1620e7..a173d64 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6644,7 +6644,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { m_host.AddScriptLPS(1); - + UUID destId = UUID.Zero; if (!UUID.TryParse(target, out destId)) @@ -9032,31 +9032,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public LSL_Integer llGetInventoryPermMask(string item, int mask) + public LSL_Integer llGetInventoryPermMask(string itemName, int mask) { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == item) - { - switch (mask) - { - case 0: - return (int)inv.Value.BasePermissions; - case 1: - return (int)inv.Value.CurrentPermissions; - case 2: - return (int)inv.Value.GroupPermissions; - case 3: - return (int)inv.Value.EveryonePermissions; - case 4: - return (int)inv.Value.NextPermissions; - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName); + + if (item == null) + return -1; + + switch (mask) + { + case 0: + return (int)item.BasePermissions; + case 1: + return (int)item.CurrentPermissions; + case 2: + return (int)item.GroupPermissions; + case 3: + return (int)item.EveryonePermissions; + case 4: + return (int)item.NextPermissions; } return -1; -- cgit v1.1 From d933bdbd59da50e2c335b65870416ac8e5035d3a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:47:20 +0100 Subject: refactor: In llGetInventoryPermMask() use existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 45 ++++++++++------------ 1 file changed, 21 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a173d64..fce09bf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9058,38 +9058,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return -1; } - public void llSetInventoryPermMask(string item, int mask, int value) + public void llSetInventoryPermMask(string itemName, int mask, int value) { m_host.AddScriptLPS(1); + if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false)) { if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) { - lock (m_host.TaskInventory) + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName); + + if (item != null) { - foreach (KeyValuePair inv in m_host.TaskInventory) + switch (mask) { - if (inv.Value.Name == item) - { - switch (mask) - { - case 0: - inv.Value.BasePermissions = (uint)value; - break; - case 1: - inv.Value.CurrentPermissions = (uint)value; - break; - case 2: - inv.Value.GroupPermissions = (uint)value; - break; - case 3: - inv.Value.EveryonePermissions = (uint)value; - break; - case 4: - inv.Value.NextPermissions = (uint)value; - break; - } - } + case 0: + item.BasePermissions = (uint)value; + break; + case 1: + item.CurrentPermissions = (uint)value; + break; + case 2: + item.GroupPermissions = (uint)value; + break; + case 3: + item.EveryonePermissions = (uint)value; + break; + case 4: + item.NextPermissions = (uint)value; + break; } } } -- cgit v1.1 From f2b0377c28623ee915387fef37c88ab3b7694ba8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:49:21 +0100 Subject: refactor: In llGetInventoryCreator() use existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fce09bf..338ae88 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9093,24 +9093,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public LSL_String llGetInventoryCreator(string item) + public LSL_String llGetInventoryCreator(string itemName) { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName); + + if (item == null) { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == item) - { - return inv.Value.CreatorID.ToString(); - } - } - } + llSay(0, "No item name '" + item + "'"); - llSay(0, "No item name '" + item + "'"); + return String.Empty; + } - return String.Empty; + return item.CreatorID.ToString(); } public void llOwnerSay(string msg) -- cgit v1.1 From 9fac7fd932aa929e350fb4795f5036f7dd0cf78f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:50:52 +0100 Subject: refactor: In llGetInventoryType() use existing GetInventoryItem() --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 338ae88..a8a2a50 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9656,18 +9656,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == name) - { - return inv.Value.Type; - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); - return -1; + if (item == null) + return -1; + + return item.Type; } public void llSetPayPrice(int price, LSL_List quick_pay_buttons) -- cgit v1.1 From eacba4fc0b1e3a34f8bae140c402eacb68ecbb94 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:54:30 +0100 Subject: refactor: use existing GetInventoryItem() in GetScriptByName(), itself renamed from ScriptByName() --- .../Shared/Api/Implementation/LSL_Api.cs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a8a2a50..38f146f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -192,7 +192,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); - if ((item = ScriptByName(name)) != UUID.Zero) + if ((item = GetScriptByName(name)) != UUID.Zero) m_ScriptEngine.ResetScript(item); else ShoutError("llResetOtherScript: script "+name+" not found"); @@ -204,7 +204,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); - if ((item = ScriptByName(name)) != UUID.Zero) + if ((item = GetScriptByName(name)) != UUID.Zero) { return m_ScriptEngine.GetScriptState(item) ?1:0; } @@ -226,7 +226,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // These functions are supposed to be robust, // so get the state one step at a time. - if ((item = ScriptByName(name)) != UUID.Zero) + if ((item = GetScriptByName(name)) != UUID.Zero) { m_ScriptEngine.SetScriptState(item, run == 0 ? false : true); } @@ -10455,18 +10455,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_List(); } - internal UUID ScriptByName(string name) + internal UUID GetScriptByName(string name) { - lock (m_host.TaskInventory) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == 10 && item.Name == name) - return item.ItemID; - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); + + if (item == null || item.Type != 10) + return UUID.Zero; - return UUID.Zero; + return item.ItemID; } internal void ShoutError(string msg) -- cgit v1.1 From 1816ecb747708fea73eec08d3e51a8a2b8c7bd06 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:57:57 +0100 Subject: refactor: In llGetNumberOfNotecardLines() use existing GetInventoryItem() rather than inspecting a clone of the TaskInventory dictionary that was not cloned thread-safe --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 38f146f..2b8c4c1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10502,20 +10502,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); - UUID assetID = UUID.Zero; if (!UUID.TryParse(name, out assetID)) { - foreach (TaskInventoryItem item in itemsDictionary.Values) - { - if (item.Type == 7 && item.Name == name) - { - assetID = item.AssetID; - break; - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); + + if (item != null && item.Type == 7) + assetID = item.AssetID; } if (assetID == UUID.Zero) -- cgit v1.1 From 2f998fce1f51e9991852144c940281fedffbbbca Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 22:00:39 +0100 Subject: refactor: In llGetNotecardLine() use existing GetInventoryItem() rather than inspecting a clone of the TaskInventory dictionary that was not cloned thread-safe --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2b8c4c1..cf65abb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10558,20 +10558,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); - UUID assetID = UUID.Zero; if (!UUID.TryParse(name, out assetID)) { - foreach (TaskInventoryItem item in itemsDictionary.Values) - { - if (item.Type == 7 && item.Name == name) - { - assetID = item.AssetID; - break; - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); + + if (item != null && item.Type == 7) + assetID = item.AssetID; } if (assetID == UUID.Zero) -- cgit v1.1 From 7b327848d0a74296e0180bb8d27544e6c5570215 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 22:21:47 +0100 Subject: Use GetInventoryItem() in llRezAtRoot rather than iterating through a cloned dictionary --- .../Shared/Api/Implementation/LSL_Api.cs | 76 ++++++++++------------ 1 file changed, 36 insertions(+), 40 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index cf65abb..0a25454 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2738,67 +2738,63 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - Util.FireAndForget(delegate (object x) + Util.FireAndForget(x => { if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s)) return; + float dist = (float)llVecDist(llGetPos(), pos); if (dist > m_ScriptDistanceFactor * 10.0f) return; - //Clone is thread-safe - TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory); - foreach (KeyValuePair inv in partInventory) + if (item == null) { - if (inv.Value.Name == inventory) - { - // make sure we're an object. - if (inv.Value.InvType != (int)InventoryType.Object) - { - llSay(0, "Unable to create requested object. Object is missing from database."); - return; - } + llSay(0, "Could not find object " + inventory); + return; + } - Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); - Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); + if (item.InvType != (int)InventoryType.Object) + { + llSay(0, "Unable to create requested object. Object is missing from database."); + return; + } - // need the magnitude later - // float velmag = (float)Util.GetMagnitude(llvel); + Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); + Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); - SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param); + // need the magnitude later + // float velmag = (float)Util.GetMagnitude(llvel); - // If either of these are null, then there was an unknown error. - if (new_group == null) - continue; + SceneObjectGroup new_group = World.RezObject(m_host, item, llpos, Rot2Quaternion(rot), llvel, param); - // objects rezzed with this method are die_at_edge by default. - new_group.RootPart.SetDieAtEdge(true); + // If either of these are null, then there was an unknown error. + if (new_group == null) + return; - new_group.ResumeScripts(); + // objects rezzed with this method are die_at_edge by default. + new_group.RootPart.SetDieAtEdge(true); - m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( - "object_rez", new Object[] { - new LSL_String( - new_group.RootPart.UUID.ToString()) }, - new DetectParams[0])); + new_group.ResumeScripts(); - float groupmass = new_group.GetMass(); + m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( + "object_rez", new Object[] { + new LSL_String( + new_group.RootPart.UUID.ToString()) }, + new DetectParams[0])); - PhysicsActor pa = new_group.RootPart.PhysActor; + float groupmass = new_group.GetMass(); - if (pa != null && pa.IsPhysical && llvel != Vector3.Zero) - { - //Recoil. - llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); - } - // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) - return; - } - } + PhysicsActor pa = new_group.RootPart.PhysActor; - llSay(0, "Could not find object " + inventory); + if (pa != null && pa.IsPhysical && llvel != Vector3.Zero) + { + //Recoil. + llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); + } + // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) }); //ScriptSleep((int)((groupmass * velmag) / 10)); -- cgit v1.1 From 951b45b80fd504b4874b9ec3e0fbff49a25cb46f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jul 2012 00:05:06 +0100 Subject: Add OSSL function osForceAttachToAvatarFromInventory() This works like osForceAttachToAvatar() but allows an object to be directly specified from the script object's inventory rather than forcing it to be rezzed in the scene first. Still only attaches objects to the owner of the script. This allows one to bypass the complicated co-ordination of first rezzing objects in the scene before attaching them. Threat level high. --- .../Shared/Api/Implementation/OSSL_Api.cs | 54 +++++++++++++++++++++- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 7 +++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 ++ 3 files changed, 65 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7fa25f5..fa9364d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api [Serializable] public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public const string GridInfoServiceConfigSectionName = "GridInfoService"; @@ -3151,6 +3151,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint); } + public void osForceAttachToAvatarFromInventory(string itemName, int attachmentPoint) + { + CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatarFromInventory"); + + IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; + + if (attachmentsModule == null) + return; + + m_host.AddScriptLPS(1); + + InitLSL(); + + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName); + + if (item == null) + { + ((LSL_Api)m_LSL_Api).llSay(0, string.Format("Could not find object '{0}'", itemName)); + throw new Exception(String.Format("The inventory item '{0}' could not be found", itemName)); + } + + if (item.InvType != (int)InventoryType.Object) + { + // FIXME: Temporary null check for regression tests since they dont' have the infrastructure to set + // up the api reference. + if (m_LSL_Api != null) + ((LSL_Api)m_LSL_Api).llSay(0, string.Format("Unable to attach, item '{0}' is not an object.", itemName)); + + throw new Exception(String.Format("The inventory item '{0}' is not an object", itemName)); + + return; + } + + ScenePresence sp = World.GetScenePresence(m_host.OwnerID); + + if (sp == null) + return; + + InventoryItemBase newItem = World.MoveTaskInventoryItem(sp.UUID, UUID.Zero, m_host, item.ItemID); + + if (newItem == null) + { + m_log.ErrorFormat( + "[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}", + itemName, m_host.Name, attachmentPoint, World.Name); + + return; + } + + attachmentsModule.RezSingleAttachmentFromInventory(sp, newItem.ID, (uint)attachmentPoint); + } + public void osForceDetachFromAvatar() { CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index e92518d..a8335aa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -107,6 +107,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osForceAttachToAvatar(int attachment); /// + /// Attach the inventory item in the object containing this script to the avatar that owns it without checking for PERMISSION_ATTACH + /// + /// Tha name of the item. If this is not found then a warning is said to the owner + /// The attachment point. For example, ATTACH_CHEST + void osForceAttachToAvatarFromInventory(string itemName, int attachment); + + /// /// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH /// /// Nothing happens if the object is not attached. diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index d230662..500ed96 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -296,6 +296,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osForceAttachToAvatar(attachmentPoint); } + public void osForceAttachToAvatarFromInventory(string itemName, int attachmentPoint) + { + m_OSSL_Functions.osForceAttachToAvatarFromInventory(itemName, attachmentPoint); + } + public void osForceDetachFromAvatar() { m_OSSL_Functions.osForceDetachFromAvatar(); -- cgit v1.1 From 8674604ff5760335f08fa910381608757e89ad21 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jul 2012 21:10:59 +0100 Subject: regrade osFormatString, osMatchString and osReplaceString to VeryLow. I can't see that these present any real hazard to sim functioning. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index fa9364d..7385dd9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2125,7 +2125,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String osFormatString(string str, LSL_List strings) { - CheckThreatLevel(ThreatLevel.Low, "osFormatString"); + CheckThreatLevel(ThreatLevel.VeryLow, "osFormatString"); m_host.AddScriptLPS(1); return String.Format(str, strings.Data); @@ -2133,7 +2133,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List osMatchString(string src, string pattern, int start) { - CheckThreatLevel(ThreatLevel.High, "osMatchString"); + CheckThreatLevel(ThreatLevel.VeryLow, "osMatchString"); m_host.AddScriptLPS(1); LSL_List result = new LSL_List(); @@ -2175,7 +2175,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start) { - CheckThreatLevel(ThreatLevel.High, "osReplaceString"); + CheckThreatLevel(ThreatLevel.VeryLow, "osReplaceString"); m_host.AddScriptLPS(1); // Normalize indices (if negative). -- cgit v1.1 From 1b1f841c6aaf2453b3aca0eade84855ae658e655 Mon Sep 17 00:00:00 2001 From: Talun Date: Tue, 3 Jul 2012 11:10:09 +0100 Subject: Mantis 6063 osNpcTouch. Allow NPCS to touch obects. --- .../Shared/Api/Implementation/OSSL_Api.cs | 35 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 ++++ 3 files changed, 41 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7385dd9..61394af 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2677,6 +2677,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num) + { + CheckThreatLevel(ThreatLevel.High, "osNpcTouch"); + m_host.AddScriptLPS(1); + INPCModule module = World.RequestModuleInterface(); + int linkNum = link_num.value; + if (module != null || (linkNum < 0 && linkNum != ScriptBaseClass.LINK_THIS)) + { + UUID npcId; + if (!UUID.TryParse(npcLSL_Key, out npcId) || !module.CheckPermissions(npcId, m_host.OwnerID)) + return; + SceneObjectPart part = null; + UUID objectId; + if (UUID.TryParse(LSL_String.ToString(object_key), out objectId)) + part = World.GetSceneObjectPart(objectId); + if (part == null) + return; + if (linkNum != ScriptBaseClass.LINK_THIS) + { + if (linkNum == 0 || linkNum == ScriptBaseClass.LINK_ROOT) + { // 0 and 1 are treated as root, find the root if the current part isnt it + if (!part.IsRoot) + part = part.ParentGroup.RootPart; + } + else + { // Find the prim with the given link number if not found then fail silently + part = part.ParentGroup.GetLinkNumPart(linkNum); + if (part == null) + return; + } + } + module.Touch(npcId, part.UUID); + } + } + /// /// Save the current appearance of the script owner permanently to the named notecard. /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index a8335aa..d38709e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -231,6 +231,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcRemove(key npc); void osNpcPlayAnimation(LSL_Key npc, string animation); void osNpcStopAnimation(LSL_Key npc, string animation); + void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num); void osNpcWhisper(key npc, int channel, string message); LSL_Key osOwnerSaveAppearance(string notecard); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 500ed96..692bb0a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -626,6 +626,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcWhisper(npc, channel, message); } + public void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num) + { + m_OSSL_Functions.osNpcTouch(npcLSL_Key, object_key, link_num); + } + public LSL_Key osOwnerSaveAppearance(string notecard) { return m_OSSL_Functions.osOwnerSaveAppearance(notecard); -- cgit v1.1 From c8af20f966e005fb512869299d80be6b83cb70bf Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 9 Jul 2012 23:08:41 +0100 Subject: This script allows an object to be attached directly from prim inventory to another avatar in the scene. Very useful in serious game/environment scenarios where its only allowed for trusted creators. Threat level Severe --- .../Shared/Api/Implementation/OSSL_Api.cs | 25 +++++++++++++++++++--- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 18 ++++++++++++++-- .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ 3 files changed, 43 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 61394af..e90f577 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3190,13 +3190,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatarFromInventory"); + m_host.AddScriptLPS(1); + + ForceAttachToAvatarFromInventory(m_host.OwnerID, itemName, attachmentPoint); + } + + public void osForceAttachToOtherAvatarFromInventory(string rawAvatarId, string itemName, int attachmentPoint) + { + CheckThreatLevel(ThreatLevel.Severe, "osForceAttachToOtherAvatarFromInventory"); + + m_host.AddScriptLPS(1); + + UUID avatarId; + + if (!UUID.TryParse(rawAvatarId, out avatarId)) + return; + + ForceAttachToAvatarFromInventory(avatarId, itemName, attachmentPoint); + } + + public void ForceAttachToAvatarFromInventory(UUID avatarId, string itemName, int attachmentPoint) + { IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; if (attachmentsModule == null) return; - m_host.AddScriptLPS(1); - InitLSL(); TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName); @@ -3219,7 +3238,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - ScenePresence sp = World.GetScenePresence(m_host.OwnerID); + ScenePresence sp = World.GetScenePresence(avatarId); if (sp == null) return; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index d38709e..b5416c8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -101,19 +101,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces // Attachment commands /// - /// Attach the object containing this script to the avatar that owns it without checking for PERMISSION_ATTACH + /// Attach the object containing this script to the avatar that owns it without asking for PERMISSION_ATTACH /// /// The attachment point. For example, ATTACH_CHEST void osForceAttachToAvatar(int attachment); /// - /// Attach the inventory item in the object containing this script to the avatar that owns it without checking for PERMISSION_ATTACH + /// Attach an inventory item in the object containing this script to the avatar that owns it without asking for PERMISSION_ATTACH /// + /// + /// Nothing happens if the owner is not in the region. + /// /// Tha name of the item. If this is not found then a warning is said to the owner /// The attachment point. For example, ATTACH_CHEST void osForceAttachToAvatarFromInventory(string itemName, int attachment); /// + /// Attach an inventory item in the object containing this script to any avatar in the region without asking for PERMISSION_ATTACH + /// + /// + /// Nothing happens if the avatar is not in the region. + /// + /// The UUID of the avatar to which to attach. Nothing happens if this is not a UUID + /// The name of the item. If this is not found then a warning is said to the owner + /// The attachment point. For example, ATTACH_CHEST + void osForceAttachToOtherAvatarFromInventory(string rawAvatarId, string itemName, int attachmentPoint); + + /// /// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH /// /// Nothing happens if the object is not attached. diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 692bb0a..b40bdf0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -301,6 +301,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osForceAttachToAvatarFromInventory(itemName, attachmentPoint); } + public void osForceAttachToOtherAvatarFromInventory(string rawAvatarId, string itemName, int attachmentPoint) + { + m_OSSL_Functions.osForceAttachToOtherAvatarFromInventory(rawAvatarId, itemName, attachmentPoint); + } + public void osForceDetachFromAvatar() { m_OSSL_Functions.osForceDetachFromAvatar(); -- cgit v1.1 From fc2456320646df66b95a06d4cd292c3b2385a8ea Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 11 Jul 2012 21:43:35 +0100 Subject: Add regression TestDetachScriptedAttachmentToInventory() This currently only does a relatively crude check for a ScriptState node in the serialized xml --- .../Shared/Api/Implementation/AsyncCommandManager.cs | 15 +++++++++------ .../Shared/Api/Implementation/Plugins/Listener.cs | 8 ++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 993d10f..5b22860 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -233,17 +233,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_Timer[engine].UnSetTimerEvents(localID, itemID); // Remove from: HttpRequest - IHttpRequestModule iHttpReq = - engine.World.RequestModuleInterface(); - iHttpReq.StopHttpRequest(localID, itemID); + IHttpRequestModule iHttpReq = engine.World.RequestModuleInterface(); + if (iHttpReq != null) + iHttpReq.StopHttpRequest(localID, itemID); IWorldComm comms = engine.World.RequestModuleInterface(); if (comms != null) comms.DeleteListener(itemID); IXMLRPC xmlrpc = engine.World.RequestModuleInterface(); - xmlrpc.DeleteChannels(itemID); - xmlrpc.CancelSRDRequests(itemID); + if (xmlrpc != null) + { + xmlrpc.DeleteChannels(itemID); + xmlrpc.CancelSRDRequests(itemID); + } // Remove Sensors m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); @@ -305,7 +308,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { List data = new List(); - Object[] listeners=m_Listener[engine].GetSerializationData(itemID); + Object[] listeners = m_Listener[engine].GetSerializationData(itemID); if (listeners.Length > 0) { data.Add("listener"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs index 93e0261..efa86fc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs @@ -88,13 +88,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins public Object[] GetSerializationData(UUID itemID) { - return m_commsPlugin.GetSerializationData(itemID); + if (m_commsPlugin != null) + return m_commsPlugin.GetSerializationData(itemID); + else + return new Object[]{}; } public void CreateFromData(uint localID, UUID itemID, UUID hostID, Object[] data) { - m_commsPlugin.CreateFromData(localID, itemID, hostID, data); + if (m_commsPlugin != null) + m_commsPlugin.CreateFromData(localID, itemID, hostID, data); } } } \ No newline at end of file -- cgit v1.1 From 916e3bf886ee622e2f18d6eb74f90fee8c630471 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 11 Jul 2012 22:54:22 +0100 Subject: Where possible, use the system Encoding.ASCII and Encoding.UTF8 rather than constructing fresh copies. The encodings are thread-safe and already used in such a manner in other places. This isn't done where Byte Order Mark output is suppressed, since Encoding.UTF8 is constructed to output the BOM. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++------ OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0a25454..0ebcd8d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10536,9 +10536,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - System.Text.UTF8Encoding enc = - new System.Text.UTF8Encoding(); - string data = enc.GetString(a.Data); + string data = Encoding.UTF8.GetString(a.Data); //m_log.Debug(data); NotecardCache.Cache(id, data); AsyncCommands. @@ -10591,9 +10589,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - System.Text.UTF8Encoding enc = - new System.Text.UTF8Encoding(); - string data = enc.GetString(a.Data); + string data = Encoding.UTF8.GetString(a.Data); //m_log.Debug(data); NotecardCache.Cache(id, data); AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(), diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e90f577..cfa08c2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1811,8 +1811,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (a == null) return UUID.Zero; - System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); - string data = enc.GetString(a.Data); + string data = Encoding.UTF8.GetString(a.Data); NotecardCache.Cache(assetID, data); }; -- cgit v1.1 From 3b3d9967b18335c28ce2dfc269e47bac0ede075a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 12 Jul 2012 23:29:57 +0100 Subject: Remove IClientAPI.GetClientEP() in favour of existing identical IClientAPI.RemoteEndpoint. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index cfa08c2..3654106 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -874,13 +874,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (World.Entities.ContainsKey((UUID)agent) && World.Entities[avatarID] is ScenePresence) { ScenePresence target = (ScenePresence)World.Entities[avatarID]; - EndPoint ep = target.ControllingClient.GetClientEP(); - if (ep is IPEndPoint) - { - IPEndPoint ip = (IPEndPoint)ep; - return ip.Address.ToString(); - } + return target.ControllingClient.RemoteEndPoint.Address.ToString(); } + // fall through case, just return nothing return ""; } -- cgit v1.1 From 8d59385eeaa26feab8b19905ad6491065e4e4bf9 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 12 Jul 2012 12:25:08 +0100 Subject: Implementation of llSetRegionPos(). Does not implement failure on object entry/prim limit/access restrictions. Signed-off-by: SignpostMarv --- .../Shared/Api/Implementation/LSL_Api.cs | 43 ++++++++++++++++++++-- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 +++ 3 files changed, 45 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0ebcd8d..b209e23 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1917,11 +1917,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - SetPos(m_host, pos); + SetPos(m_host, pos, true); ScriptSleep(200); } + /// + /// Tries to move the entire object so that the root prim is within 0.1m of position. http://wiki.secondlife.com/wiki/LlSetRegionPos + /// Documentation indicates that the use of x/y coordinates up to 10 meters outside the bounds of a region will work but do not specify what happens if there is no adjacent region for the object to move into. + /// Uses the RegionSize constant here rather than hard-coding 266.0 to alert any developer modifying OpenSim to support variable-sized regions that this method will need tweaking. + /// + /// + /// 1 if successful, 0 otherwise. + public LSL_Integer llSetRegionPos(LSL_Vector pos) + { + m_host.AddScriptLPS(1); + if ( + llGetStatus((int)PrimFlags.Physics) == 1 || // return FALSE if physical. + m_host.ParentGroup.IsAttachment || // return FALSE if attachment + ( + pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region. + pos.x > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a east-adjacent region. + pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region. + pos.y > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a north-adjacent region. + pos.z > 4096 // return FALSE if altitude than 4096m + ) + ){ + return 0; + } + + SetPos(m_host.ParentGroup.RootPart, pos, false); + + return llVecDist(pos, llGetRootPosition()) <= 0.1 ? 1 : 0; + } + // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) // note linked setpos is capped "differently" private LSL_Vector SetPosAdjust(LSL_Vector start, LSL_Vector end) @@ -1953,7 +1982,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return real_vec; } - protected void SetPos(SceneObjectPart part, LSL_Vector targetPos) + /// + /// set object position, optionally capping the distance. + /// + /// + /// + /// if TRUE, will cap the distance to 10m. + protected void SetPos(SceneObjectPart part, LSL_Vector targetPos, bool adjust) { // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) LSL_Vector currentPos = GetPartLocalPos(part); @@ -1966,12 +2001,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0) targetPos.z = ground; SceneObjectGroup parent = part.ParentGroup; - LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); + LSL_Vector real_vec = !adjust ? targetPos : SetPosAdjust(currentPos, targetPos); parent.UpdateGroupPosition(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z)); } else { - LSL_Vector rel_vec = SetPosAdjust(currentPos, targetPos); + LSL_Vector rel_vec = !adjust ? targetPos : SetPosAdjust(currentPos, targetPos); part.OffsetPosition = new Vector3((float)rel_vec.x, (float)rel_vec.y, (float)rel_vec.z); SceneObjectGroup parent = part.ParentGroup; parent.HasGroupChanged = true; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index d39b204..3fb463b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -359,6 +359,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llSetPrimitiveParams(LSL_List rules); void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); void llSetPrimURL(string url); + LSL_Integer llSetRegionPos(LSL_Vector pos); void llSetRemoteScriptAccessPin(int pin); void llSetRot(LSL_Rotation rot); void llSetScale(LSL_Vector scale); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index a0b3bc8..c457880 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1618,6 +1618,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llSetPrimURL(url); } + public LSL_Integer llSetRegionPos(LSL_Vector pos) + { + return m_LSL_Functions.llSetRegionPos(pos); + } + public void llSetRemoteScriptAccessPin(int pin) { m_LSL_Functions.llSetRemoteScriptAccessPin(pin); -- cgit v1.1 From b6cd3b625ebffb45febf922a941fae337e3c1652 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 12 Jul 2012 15:57:22 +0100 Subject: adding workaround for silent failure if position is outside the bounds of a region, implementing parcel prim count check. Signed-off-by: SignpostMarv --- .../Shared/Api/Implementation/LSL_Api.cs | 54 ++++++++++++++++------ 1 file changed, 41 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b209e23..8163267 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1932,23 +1932,51 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llSetRegionPos(LSL_Vector pos) { m_host.AddScriptLPS(1); - if ( - llGetStatus((int)PrimFlags.Physics) == 1 || // return FALSE if physical. - m_host.ParentGroup.IsAttachment || // return FALSE if attachment - ( - pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region. - pos.x > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a east-adjacent region. - pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region. - pos.y > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a north-adjacent region. - pos.z > 4096 // return FALSE if altitude than 4096m - ) - ){ + + // BEGIN WORKAROUND + // IF YOU GET REGION CROSSINGS WORKING WITH THIS FUNCTION, REPLACE THE WORKAROUND. + // + // This workaround is to prevent silent failure of this function. + // According to the specification on the SL Wiki, providing a position outside of the + if (pos.x < 0 || pos.x > Constants.RegionSize || pos.y < 0 || pos.y > Constants.RegionSize) + { return 0; } + // END WORK AROUND + else{ + LSL_List parcelID = new LSL_List(ScriptBaseClass.PARCEL_DETAILS_ID); + Vector3 objectPos = m_host.ParentGroup.RootPart.AbsolutePosition; + bool sameParcel = + llGetParcelDetails(new LSL_Vector(pos.x, pos.y, pos.z), parcelID).Data[0] == + llGetParcelDetails(pos, parcelID).Data[0] + ; + if ( + llGetStatus((int)PrimFlags.Physics) == 1 || // return FALSE if physical. + m_host.ParentGroup.IsAttachment || // return FALSE if attachment + ( + pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region. + pos.x > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a east-adjacent region. + pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region. + pos.y > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a north-adjacent region. + pos.z > 4096 // return FALSE if altitude than 4096m + ) || + // BEGIN RELIANCE ON WORK AROUND + // this check will only work if pos is within the region bounds. + ( + !sameParcel && // if it's moving within the same parcel we do not need to check if the destination parcel will exceed capacity if the object is moved. + (llGetParcelPrimCount(pos, ScriptBaseClass.PARCEL_COUNT_TOTAL, 0) + m_host.ParentGroup.PrimCount) > llGetParcelMaxPrims(pos, 0) + ) + // END RELIANCE ON WORK-AROUND + ){ + return 0; + } + + SetPos(m_host.ParentGroup.RootPart, pos, false); - SetPos(m_host.ParentGroup.RootPart, pos, false); + return llVecDist(pos, llGetRootPosition()) <= 0.1 ? 1 : 0; + } - return llVecDist(pos, llGetRootPosition()) <= 0.1 ? 1 : 0; + return 0; } // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) -- cgit v1.1 From e3453dd9ca1d08664a38205f05340623118a9880 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 12 Jul 2012 17:22:43 +0100 Subject: added in some extra variables, it sometimes thinks it is on the same parcel :( Signed-off-by: SignpostMarv --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8163267..ca240f5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1946,10 +1946,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else{ LSL_List parcelID = new LSL_List(ScriptBaseClass.PARCEL_DETAILS_ID); Vector3 objectPos = m_host.ParentGroup.RootPart.AbsolutePosition; - bool sameParcel = - llGetParcelDetails(new LSL_Vector(pos.x, pos.y, pos.z), parcelID).Data[0] == - llGetParcelDetails(pos, parcelID).Data[0] - ; + string parcelA = llGetParcelDetails(new LSL_Vector(objectPos.X, objectPos.X, objectPos.X), parcelID).Data[0].ToString(); + string parcelB = llGetParcelDetails(pos, parcelID).Data[0].ToString(); + bool sameParcel = parcelA == parcelB; + int objectPrimCount = m_host.ParentGroup.PrimCount; + LSL_Integer destParcelPrimCount = llGetParcelPrimCount(pos, ScriptBaseClass.PARCEL_COUNT_TOTAL, 0); + LSL_Integer max = llGetParcelMaxPrims(pos, 0); if ( llGetStatus((int)PrimFlags.Physics) == 1 || // return FALSE if physical. m_host.ParentGroup.IsAttachment || // return FALSE if attachment @@ -1964,7 +1966,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // this check will only work if pos is within the region bounds. ( !sameParcel && // if it's moving within the same parcel we do not need to check if the destination parcel will exceed capacity if the object is moved. - (llGetParcelPrimCount(pos, ScriptBaseClass.PARCEL_COUNT_TOTAL, 0) + m_host.ParentGroup.PrimCount) > llGetParcelMaxPrims(pos, 0) + (destParcelPrimCount + objectPrimCount) > max ) // END RELIANCE ON WORK-AROUND ){ -- cgit v1.1 From 423101b425d84e98f88b9c438559fc3321297c51 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 14 Jul 2012 01:14:00 +0100 Subject: acting on feedback from justincc --- .../Shared/Api/Implementation/LSL_Api.cs | 81 +++++++++++----------- 1 file changed, 42 insertions(+), 39 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ca240f5..cfcbae3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -421,15 +421,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return LSL_Vector.Norm(v); } - public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) + private double vecDist(LSL_Vector a, LSL_Vector b) { - m_host.AddScriptLPS(1); double dx = a.x - b.x; double dy = a.y - b.y; double dz = a.z - b.z; return Math.Sqrt(dx * dx + dy * dy + dz * dz); } + public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) + { + m_host.AddScriptLPS(1); + return vecDist(a, b); + } + //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke /// @@ -1242,6 +1247,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + private bool isPhysical(){ + return ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) == (uint)PrimFlags.Physics); + } + public LSL_Integer llGetStatus(int status) { m_host.AddScriptLPS(1); @@ -1249,11 +1258,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api switch (status) { case ScriptBaseClass.STATUS_PHYSICS: - if ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) == (uint)PrimFlags.Physics) - { - return 1; - } - return 0; + return isPhysical() ? 1 : 0; case ScriptBaseClass.STATUS_PHANTOM: if ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) == (uint)PrimFlags.Phantom) @@ -1943,42 +1948,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 0; } // END WORK AROUND - else{ - LSL_List parcelID = new LSL_List(ScriptBaseClass.PARCEL_DETAILS_ID); - Vector3 objectPos = m_host.ParentGroup.RootPart.AbsolutePosition; - string parcelA = llGetParcelDetails(new LSL_Vector(objectPos.X, objectPos.X, objectPos.X), parcelID).Data[0].ToString(); - string parcelB = llGetParcelDetails(pos, parcelID).Data[0].ToString(); - bool sameParcel = parcelA == parcelB; - int objectPrimCount = m_host.ParentGroup.PrimCount; - LSL_Integer destParcelPrimCount = llGetParcelPrimCount(pos, ScriptBaseClass.PARCEL_COUNT_TOTAL, 0); - LSL_Integer max = llGetParcelMaxPrims(pos, 0); - if ( - llGetStatus((int)PrimFlags.Physics) == 1 || // return FALSE if physical. - m_host.ParentGroup.IsAttachment || // return FALSE if attachment - ( - pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region. - pos.x > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a east-adjacent region. - pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region. - pos.y > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a north-adjacent region. - pos.z > 4096 // return FALSE if altitude than 4096m - ) || - // BEGIN RELIANCE ON WORK AROUND - // this check will only work if pos is within the region bounds. - ( - !sameParcel && // if it's moving within the same parcel we do not need to check if the destination parcel will exceed capacity if the object is moved. - (destParcelPrimCount + objectPrimCount) > max - ) - // END RELIANCE ON WORK-AROUND - ){ - return 0; - } + else if ( // this is not part of the workaround if-block because it's not related to the workaround. + isPhysical() || + m_host.ParentGroup.IsAttachment || // return FALSE if attachment + ( + pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region. + pos.x > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a east-adjacent region. + pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region. + pos.y > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a north-adjacent region. + pos.z > 4096 // return FALSE if altitude than 4096m + ) + ) + { + return 0; + } + + // if we reach this point, then the object is not physical, it's not an attachment, and the destination is within the valid range. + // this could possibly be done in the above else-if block, but we're doing the check here to keep the code easier to read. - SetPos(m_host.ParentGroup.RootPart, pos, false); + Vector3 objectPos = m_host.ParentGroup.RootPart.AbsolutePosition; + LandData here = World.GetLandData((float)objectPos.X, (float)objectPos.Y); + LandData there = World.GetLandData((float)pos.x, (float)pos.y); - return llVecDist(pos, llGetRootPosition()) <= 0.1 ? 1 : 0; + // we're only checking prim limits if it's moving to a different parcel under the assumption that if the object got onto the parcel without exceeding the prim limits. + + bool sameParcel = here.GlobalID == there.GlobalID; + + if (!sameParcel && !World.Permissions.CanRezObject(m_host.ParentGroup.PrimCount, m_host.ParentGroup.OwnerID, new Vector3((float)pos.x, (float)pos.y, (float)pos.z))) + { + return 0; } - return 0; + SetPos(m_host.ParentGroup.RootPart, pos, false); + + return vecDist(pos, llGetRootPosition()) <= 0.1 ? 1 : 0; } // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) -- cgit v1.1 From 84b7ae25738c15737e70a680d1992cfbeb6cc806 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 14 Jul 2012 01:41:51 +0100 Subject: acting on feedback from justincc --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index cfcbae3..f88338d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -421,7 +421,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return LSL_Vector.Norm(v); } - private double vecDist(LSL_Vector a, LSL_Vector b) + private double VecDist(LSL_Vector a, LSL_Vector b) { double dx = a.x - b.x; double dy = a.y - b.y; @@ -432,7 +432,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) { m_host.AddScriptLPS(1); - return vecDist(a, b); + return VecDist(a, b); } //Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke @@ -1247,7 +1247,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - private bool isPhysical(){ + private bool IsPhysical() + { return ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) == (uint)PrimFlags.Physics); } @@ -1258,7 +1259,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api switch (status) { case ScriptBaseClass.STATUS_PHYSICS: - return isPhysical() ? 1 : 0; + return IsPhysical() ? 1 : 0; case ScriptBaseClass.STATUS_PHANTOM: if ((m_host.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) == (uint)PrimFlags.Phantom) @@ -1949,7 +1950,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // END WORK AROUND else if ( // this is not part of the workaround if-block because it's not related to the workaround. - isPhysical() || + IsPhysical() || m_host.ParentGroup.IsAttachment || // return FALSE if attachment ( pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region. @@ -1981,7 +1982,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetPos(m_host.ParentGroup.RootPart, pos, false); - return vecDist(pos, llGetRootPosition()) <= 0.1 ? 1 : 0; + return VecDist(pos, llGetRootPosition()) <= 0.1 ? 1 : 0; } // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos) -- cgit v1.1 From ee7478fa16b95352db22e0eba5c4cb90d47dabd5 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 16 Jul 2012 14:47:03 +0100 Subject: sending more user-friendly messages to the script error window rather than the thrown exceptions. Signed-off-by: Melanie --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3654106..4137397 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1664,9 +1664,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.Low, "osMessageObject"); m_host.AddScriptLPS(1); + UUID objUUID; + if (!UUID.TryParse(objectUUID, out objUUID)) // prior to patching, a thrown exception regarding invalid GUID format would be shouted instead. + { + OSSLShoutError("osMessageObject() cannot send messages to objects with invalid UUIDs"); + return; + } + object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) }; - SceneObjectPart sceneOP = World.GetSceneObjectPart(new UUID(objectUUID)); + SceneObjectPart sceneOP = World.GetSceneObjectPart(objUUID); + + if (sceneOP == null) // prior to patching, PostObjectEvent() would cause a throw exception to be shouted instead. + { + OSSLShoutError("osMessageObject() cannot send message to " + objUUID.ToString() + ", object was not found in scene."); + return; + } m_ScriptEngine.PostObjectEvent( sceneOP.LocalId, new EventParams( -- cgit v1.1