From d1147136946daf14724183b3191119be44ff8b16 Mon Sep 17 00:00:00 2001 From: CasperW Date: Tue, 24 Nov 2009 18:02:12 +0100 Subject: Drop all locking of part.TaskInventory in favour of a ReaderWriterLockSlim lock handler. This gives us: - Faster prim inventory actions. Multiple threads can read at once. - Fixes the known prim inventory thread locks - In the event of a thread lock occurring, it will usually self heal after sixty seconds with an error message in the console --- .../Shared/Api/Implementation/OSSL_Api.cs | 36 ++++++++++++---------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7fdbac8..83322eb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -728,18 +728,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (target != null) { UUID animID=UUID.Zero; - lock (m_host.TaskInventory) + m_host.TaskInventory.LockItemsForRead(true); + foreach (KeyValuePair inv in m_host.TaskInventory) { - foreach (KeyValuePair inv in m_host.TaskInventory) + if (inv.Value.Name == animation) { - if (inv.Value.Name == animation) - { - if (inv.Value.Type == (int)AssetType.Animation) - animID = inv.Value.AssetID; - continue; - } + if (inv.Value.Type == (int)AssetType.Animation) + animID = inv.Value.AssetID; + continue; } } + m_host.TaskInventory.LockItemsForRead(false); if (animID == UUID.Zero) target.Animator.AddAnimation(animation, m_host.UUID); else @@ -761,18 +760,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (target != null) { UUID animID=UUID.Zero; - lock (m_host.TaskInventory) + m_host.TaskInventory.LockItemsForRead(true); + foreach (KeyValuePair inv in m_host.TaskInventory) { - foreach (KeyValuePair inv in m_host.TaskInventory) + if (inv.Value.Name == animation) { - if (inv.Value.Name == animation) - { - if (inv.Value.Type == (int)AssetType.Animation) - animID = inv.Value.AssetID; - continue; - } + if (inv.Value.Type == (int)AssetType.Animation) + animID = inv.Value.AssetID; + continue; } } + m_host.TaskInventory.LockItemsForRead(false); if (animID == UUID.Zero) target.Animator.RemoveAnimation(animation); @@ -1541,6 +1539,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(name, out assetID)) { + m_host.TaskInventory.LockItemsForRead(true); foreach (TaskInventoryItem item in m_host.TaskInventory.Values) { if (item.Type == 7 && item.Name == name) @@ -1548,6 +1547,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api assetID = item.AssetID; } } + m_host.TaskInventory.LockItemsForRead(false); } if (assetID == UUID.Zero) @@ -1594,6 +1594,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(name, out assetID)) { + m_host.TaskInventory.LockItemsForRead(true); foreach (TaskInventoryItem item in m_host.TaskInventory.Values) { if (item.Type == 7 && item.Name == name) @@ -1601,6 +1602,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api assetID = item.AssetID; } } + m_host.TaskInventory.LockItemsForRead(false); } if (assetID == UUID.Zero) @@ -1651,6 +1653,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(name, out assetID)) { + m_host.TaskInventory.LockItemsForRead(true); foreach (TaskInventoryItem item in m_host.TaskInventory.Values) { if (item.Type == 7 && item.Name == name) @@ -1658,6 +1661,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api assetID = item.AssetID; } } + m_host.TaskInventory.LockItemsForRead(false); } if (assetID == UUID.Zero) -- cgit v1.1 From c81f37cf82c3a9d2aae92d5f44734fc5098c5b75 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 25 Nov 2009 17:01:41 +0000 Subject: Change osTeleportAgent parameters from long to int. That numerical range is not even supported by the underlying type, so there is no need to ask for a type the script can not even supply. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 83322eb..10165d3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -636,13 +636,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // Teleport functions - public void osTeleportAgent(string agent, uint regionX, uint regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + public void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { // High because there is no security check. High griefer potential // CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); - ulong regionHandle = Util.UIntsToLong((regionX * (uint)Constants.RegionSize), (regionY * (uint)Constants.RegionSize)); + ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); m_host.AddScriptLPS(1); UUID agentId = new UUID(); -- cgit v1.1 From e3f229225c5a1506090bfcffcce6d423a566f1fe Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Dec 2009 01:34:26 +0100 Subject: Enable scripting interface for windlight --- .../Shared/Api/Implementation/OSSL_Api.cs | 333 +++++++++++++++++++++ 1 file changed, 333 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7f739b1..33c67d5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -42,6 +42,7 @@ using OpenSim.Region.CoreModules.Avatar.NPC; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Hypergrid; +using OpenSim.Region.CoreModules.World.Meta7Windlight; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; using OpenSim.Region.ScriptEngine.Shared.ScriptBase; @@ -1974,5 +1975,337 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ret; } + /// + /// Get the current Windlight scene + /// + /// List of windlight parameters + public LSL_List osGetWindlightScene(LSL_List rules) + { + CheckThreatLevel(ThreatLevel.Low, "osGetWindlightScene"); + m_host.AddScriptLPS(1); + RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; + + LSL_List values = new LSL_List(); + int idx = 0; + while (idx < rules.Length) + { + uint rule = (uint)rules.GetLSLIntegerItem(idx); + LSL_List toadd = new LSL_List(); + + switch (rule) + { + case (int)ScriptBaseClass.WL_AMBIENT: + toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W)); + break; + case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: + toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f)); + break; + case (int)ScriptBaseClass.WL_BLUE_DENSITY: + toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W)); + break; + case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: + toadd.Add(new LSL_Float(wl.blurMultiplier)); + break; + case (int)ScriptBaseClass.WL_CLOUD_COLOR: + toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W)); + break; + case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: + toadd.Add(new LSL_Float(wl.cloudCoverage)); + break; + case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: + toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z)); + break; + case (int)ScriptBaseClass.WL_CLOUD_SCALE: + toadd.Add(new LSL_Float(wl.cloudScale)); + break; + case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: + toadd.Add(new LSL_Float(wl.cloudScrollX)); + break; + case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: + toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0)); + break; + case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: + toadd.Add(new LSL_Float(wl.cloudScrollY)); + break; + case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: + toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0)); + break; + case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: + toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z)); + break; + case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: + toadd.Add(new LSL_Float(wl.densityMultiplier)); + break; + case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: + toadd.Add(new LSL_Float(wl.distanceMultiplier)); + break; + case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: + toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0)); + break; + case (int)ScriptBaseClass.WL_EAST_ANGLE: + toadd.Add(new LSL_Float(wl.eastAngle)); + break; + case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: + toadd.Add(new LSL_Float(wl.fresnelOffset)); + break; + case (int)ScriptBaseClass.WL_FRESNEL_SCALE: + toadd.Add(new LSL_Float(wl.fresnelScale)); + break; + case (int)ScriptBaseClass.WL_HAZE_DENSITY: + toadd.Add(new LSL_Float(wl.hazeDensity)); + break; + case (int)ScriptBaseClass.WL_HAZE_HORIZON: + toadd.Add(new LSL_Float(wl.hazeHorizon)); + break; + case (int)ScriptBaseClass.WL_HORIZON: + toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W)); + break; + case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: + toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f)); + break; + case (int)ScriptBaseClass.WL_MAX_ALTITUDE: + toadd.Add(new LSL_Integer(wl.maxAltitude)); + break; + case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: + toadd.Add(new LSL_Key(wl.normalMapTexture.ToString())); + break; + case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: + toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z)); + break; + case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: + toadd.Add(new LSL_Float(wl.refractScaleAbove)); + break; + case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: + toadd.Add(new LSL_Float(wl.refractScaleBelow)); + break; + case (int)ScriptBaseClass.WL_SCENE_GAMMA: + toadd.Add(new LSL_Float(wl.sceneGamma)); + break; + case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: + toadd.Add(new LSL_Float(wl.starBrightness)); + break; + case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: + toadd.Add(new LSL_Float(wl.sunGlowFocus)); + break; + case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: + toadd.Add(new LSL_Float(wl.sunGlowSize)); + break; + case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: + toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W)); + break; + case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: + toadd.Add(new LSL_Float(wl.underwaterFogModifier)); + break; + case (int)ScriptBaseClass.WL_WATER_COLOR: + toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z)); + break; + case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: + toadd.Add(new LSL_Float(wl.waterFogDensityExponent)); + break; + } + + if (toadd.Length > 0) + { + values.Add(rule); + values.Add(toadd.Data[0]); + } + idx++; + } + + + return values; + + } + + /// + /// Set the current Windlight scene + /// + /// + /// success: true or false + public int osSetWindlightScene(LSL_List rules) + { + CheckThreatLevel(ThreatLevel.High, "osSetWindlightScene"); + int success = 0; + m_host.AddScriptLPS(1); + if (Meta7WindlightModule.EnableWindlight) + { + RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; + + LSL_List values = new LSL_List(); + int idx = 0; + success = 1; + while (idx < rules.Length) + { + uint rule = (uint)rules.GetLSLIntegerItem(idx); + LSL_Types.Quaternion iQ; + LSL_Types.Vector3 iV; + switch (rule) + { + case (int)ScriptBaseClass.WL_AMBIENT: + idx++; + iQ = rules.GetQuaternionItem(idx); + wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); + break; + case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: + idx++; + iV = rules.GetVector3Item(idx); + wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y); + break; + case (int)ScriptBaseClass.WL_BLUE_DENSITY: + idx++; + iQ = rules.GetQuaternionItem(idx); + wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); + break; + case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: + idx++; + wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_CLOUD_COLOR: + idx++; + iQ = rules.GetQuaternionItem(idx); + wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); + break; + case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: + idx++; + wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: + idx++; + iV = rules.GetVector3Item(idx); + wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); + break; + case (int)ScriptBaseClass.WL_CLOUD_SCALE: + idx++; + wl.cloudScale = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: + idx++; + wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: + idx++; + wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; + break; + case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: + idx++; + wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: + idx++; + wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; + break; + case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: + idx++; + iV = rules.GetVector3Item(idx); + wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); + break; + case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: + idx++; + wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: + idx++; + wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: + idx++; + wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; + break; + case (int)ScriptBaseClass.WL_EAST_ANGLE: + idx++; + wl.eastAngle = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: + idx++; + wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_FRESNEL_SCALE: + idx++; + wl.fresnelScale = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_HAZE_DENSITY: + idx++; + wl.hazeDensity = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_HAZE_HORIZON: + idx++; + wl.hazeHorizon= (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_HORIZON: + idx++; + iQ = rules.GetQuaternionItem(idx); + wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); + break; + case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: + idx++; + iV = rules.GetVector3Item(idx); + wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y); + break; + case (int)ScriptBaseClass.WL_MAX_ALTITUDE: + idx++; + wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value; + break; + case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: + idx++; + wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string); + break; + case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: + idx++; + iV = rules.GetVector3Item(idx); + wl.reflectionWaveletScale= new Vector3((float)iV.x, (float)iV.y, (float)iV.z); + break; + case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: + idx++; + wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: + idx++; + wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_SCENE_GAMMA: + idx++; + wl.sceneGamma = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: + idx++; + wl.starBrightness= (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: + idx++; + wl.sunGlowFocus= (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: + idx++; + wl.sunGlowSize= (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: + idx++; + iQ = rules.GetQuaternionItem(idx); + wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); + break; + case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: + idx++; + wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx); + break; + case (int)ScriptBaseClass.WL_WATER_COLOR: + idx++; + iV = rules.GetVector3Item(idx); + wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); + break; + case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: + idx++; + wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx); + break; + default: + success = 0; + break; + } + idx++; + } + m_host.ParentGroup.Scene.StoreWindlightProfile(wl); + + } + return success; + } } } -- cgit v1.1 From a6a6bf007a2fb0e33daefc0ea7c4ad968a85d08e Mon Sep 17 00:00:00 2001 From: CasperW Date: Wed, 9 Dec 2009 22:57:35 +0100 Subject: Move osFunctions into a new Careminster script interface --- .../Shared/Api/Implementation/OSSL_Api.cs | 334 --------------------- 1 file changed, 334 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 33c67d5..836f276 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -42,7 +42,6 @@ using OpenSim.Region.CoreModules.Avatar.NPC; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Hypergrid; -using OpenSim.Region.CoreModules.World.Meta7Windlight; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; using OpenSim.Region.ScriptEngine.Shared.ScriptBase; @@ -1974,338 +1973,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } return ret; } - - /// - /// Get the current Windlight scene - /// - /// List of windlight parameters - public LSL_List osGetWindlightScene(LSL_List rules) - { - CheckThreatLevel(ThreatLevel.Low, "osGetWindlightScene"); - m_host.AddScriptLPS(1); - RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; - - LSL_List values = new LSL_List(); - int idx = 0; - while (idx < rules.Length) - { - uint rule = (uint)rules.GetLSLIntegerItem(idx); - LSL_List toadd = new LSL_List(); - - switch (rule) - { - case (int)ScriptBaseClass.WL_AMBIENT: - toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W)); - break; - case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: - toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f)); - break; - case (int)ScriptBaseClass.WL_BLUE_DENSITY: - toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W)); - break; - case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: - toadd.Add(new LSL_Float(wl.blurMultiplier)); - break; - case (int)ScriptBaseClass.WL_CLOUD_COLOR: - toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W)); - break; - case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: - toadd.Add(new LSL_Float(wl.cloudCoverage)); - break; - case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: - toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z)); - break; - case (int)ScriptBaseClass.WL_CLOUD_SCALE: - toadd.Add(new LSL_Float(wl.cloudScale)); - break; - case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: - toadd.Add(new LSL_Float(wl.cloudScrollX)); - break; - case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: - toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0)); - break; - case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: - toadd.Add(new LSL_Float(wl.cloudScrollY)); - break; - case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: - toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0)); - break; - case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: - toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z)); - break; - case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: - toadd.Add(new LSL_Float(wl.densityMultiplier)); - break; - case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: - toadd.Add(new LSL_Float(wl.distanceMultiplier)); - break; - case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: - toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0)); - break; - case (int)ScriptBaseClass.WL_EAST_ANGLE: - toadd.Add(new LSL_Float(wl.eastAngle)); - break; - case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: - toadd.Add(new LSL_Float(wl.fresnelOffset)); - break; - case (int)ScriptBaseClass.WL_FRESNEL_SCALE: - toadd.Add(new LSL_Float(wl.fresnelScale)); - break; - case (int)ScriptBaseClass.WL_HAZE_DENSITY: - toadd.Add(new LSL_Float(wl.hazeDensity)); - break; - case (int)ScriptBaseClass.WL_HAZE_HORIZON: - toadd.Add(new LSL_Float(wl.hazeHorizon)); - break; - case (int)ScriptBaseClass.WL_HORIZON: - toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W)); - break; - case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: - toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f)); - break; - case (int)ScriptBaseClass.WL_MAX_ALTITUDE: - toadd.Add(new LSL_Integer(wl.maxAltitude)); - break; - case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: - toadd.Add(new LSL_Key(wl.normalMapTexture.ToString())); - break; - case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: - toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z)); - break; - case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: - toadd.Add(new LSL_Float(wl.refractScaleAbove)); - break; - case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: - toadd.Add(new LSL_Float(wl.refractScaleBelow)); - break; - case (int)ScriptBaseClass.WL_SCENE_GAMMA: - toadd.Add(new LSL_Float(wl.sceneGamma)); - break; - case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: - toadd.Add(new LSL_Float(wl.starBrightness)); - break; - case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: - toadd.Add(new LSL_Float(wl.sunGlowFocus)); - break; - case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: - toadd.Add(new LSL_Float(wl.sunGlowSize)); - break; - case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: - toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W)); - break; - case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: - toadd.Add(new LSL_Float(wl.underwaterFogModifier)); - break; - case (int)ScriptBaseClass.WL_WATER_COLOR: - toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z)); - break; - case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: - toadd.Add(new LSL_Float(wl.waterFogDensityExponent)); - break; - } - - if (toadd.Length > 0) - { - values.Add(rule); - values.Add(toadd.Data[0]); - } - idx++; - } - - - return values; - - } - - /// - /// Set the current Windlight scene - /// - /// - /// success: true or false - public int osSetWindlightScene(LSL_List rules) - { - CheckThreatLevel(ThreatLevel.High, "osSetWindlightScene"); - int success = 0; - m_host.AddScriptLPS(1); - if (Meta7WindlightModule.EnableWindlight) - { - RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; - - LSL_List values = new LSL_List(); - int idx = 0; - success = 1; - while (idx < rules.Length) - { - uint rule = (uint)rules.GetLSLIntegerItem(idx); - LSL_Types.Quaternion iQ; - LSL_Types.Vector3 iV; - switch (rule) - { - case (int)ScriptBaseClass.WL_AMBIENT: - idx++; - iQ = rules.GetQuaternionItem(idx); - wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); - break; - case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: - idx++; - iV = rules.GetVector3Item(idx); - wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y); - break; - case (int)ScriptBaseClass.WL_BLUE_DENSITY: - idx++; - iQ = rules.GetQuaternionItem(idx); - wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); - break; - case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: - idx++; - wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_CLOUD_COLOR: - idx++; - iQ = rules.GetQuaternionItem(idx); - wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); - break; - case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: - idx++; - wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: - idx++; - iV = rules.GetVector3Item(idx); - wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); - break; - case (int)ScriptBaseClass.WL_CLOUD_SCALE: - idx++; - wl.cloudScale = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: - idx++; - wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: - idx++; - wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; - break; - case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: - idx++; - wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: - idx++; - wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; - break; - case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: - idx++; - iV = rules.GetVector3Item(idx); - wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); - break; - case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: - idx++; - wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: - idx++; - wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: - idx++; - wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; - break; - case (int)ScriptBaseClass.WL_EAST_ANGLE: - idx++; - wl.eastAngle = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: - idx++; - wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_FRESNEL_SCALE: - idx++; - wl.fresnelScale = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_HAZE_DENSITY: - idx++; - wl.hazeDensity = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_HAZE_HORIZON: - idx++; - wl.hazeHorizon= (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_HORIZON: - idx++; - iQ = rules.GetQuaternionItem(idx); - wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); - break; - case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: - idx++; - iV = rules.GetVector3Item(idx); - wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y); - break; - case (int)ScriptBaseClass.WL_MAX_ALTITUDE: - idx++; - wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value; - break; - case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: - idx++; - wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string); - break; - case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: - idx++; - iV = rules.GetVector3Item(idx); - wl.reflectionWaveletScale= new Vector3((float)iV.x, (float)iV.y, (float)iV.z); - break; - case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: - idx++; - wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: - idx++; - wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_SCENE_GAMMA: - idx++; - wl.sceneGamma = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: - idx++; - wl.starBrightness= (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: - idx++; - wl.sunGlowFocus= (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: - idx++; - wl.sunGlowSize= (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: - idx++; - iQ = rules.GetQuaternionItem(idx); - wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); - break; - case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: - idx++; - wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx); - break; - case (int)ScriptBaseClass.WL_WATER_COLOR: - idx++; - iV = rules.GetVector3Item(idx); - wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); - break; - case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: - idx++; - wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx); - break; - default: - success = 0; - break; - } - idx++; - } - m_host.ParentGroup.Scene.StoreWindlightProfile(wl); - - } - return success; - } } } -- cgit v1.1 From 59a536743354ffaa12b23378f559d2d59d7d5304 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 30 May 2010 13:46:05 +0200 Subject: Changes OSSL Api permissions for the case of UUID list. In 0.6.9, the UUIDs would be the IDs of the prim owners in whose prims these functions would run. This changes it so the UUID is the SCRIPT CREATOR instead. Further, osfunctions limited by uuid will not run if the creator and owner differ and the owner has mod rights on the script. There is still a danger in passing moodifiable scripts to others, as they can insert a harmful function, then remove the mod rights to make it runnable. As before, care needs to be taken, but where it was modable prims that were the risk before, modable scripts are the weak spot now. In cases where prim owner == script creator == script owner, nothing will change. --- .../Shared/Api/Implementation/OSSL_Api.cs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 942e4ef..8cfa833 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -278,10 +278,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (!m_FunctionPerms[function].Contains(UUID.Zero)) { - if (!m_FunctionPerms[function].Contains(m_host.OwnerID)) + 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)); + } + if (!m_FunctionPerms[function].Contains(ti.CreatorID)) OSSLError( - String.Format("{0} permission denied. Prim owner is not in the list of users allowed to execute this function.", + String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function.", function)); + if (ti.CreatorID != ti.OwnerID) + { + if ((ti.CurrentPermissions & (uint)PermissionMask.Modify) != 0) + OSSLError( + String.Format("{0} permission denied. Script permissions error.", + function)); + + } } } } @@ -2141,4 +2156,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } -} \ No newline at end of file +} -- cgit v1.1 From 890f3cc54cc57883a110b372530bf2a7d5b37fff Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 30 May 2010 15:46:54 +0200 Subject: Changes osFunction permissions again. Allow_ with a list of UUIDs now again refers to prim OWNERS. A new option set, Creators_, is added to allow selection by script creator. For existing installs, this means no functional change. The warning from my prior commit doesn't apply anymore. --- .../Shared/Api/Implementation/OSSL_Api.cs | 67 ++++++++++++++++------ 1 file changed, 51 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8cfa833..2e0456e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -105,6 +105,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // modification of user data, or allows the compromise of // sensitive data by design. + class FunctionPerms + { + public List AllowedCreators; + public List AllowedOwners; + + public FunctionPerms() + { + AllowedCreators = new List(); + AllowedOwners = new List(); + } + } + [Serializable] public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi { @@ -117,7 +129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; internal float m_ScriptDelayFactor = 1.0f; internal float m_ScriptDistanceFactor = 1.0f; - internal Dictionary > m_FunctionPerms = new Dictionary >(); + internal Dictionary m_FunctionPerms = new Dictionary(); public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) { @@ -217,31 +229,46 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!m_FunctionPerms.ContainsKey(function)) { - string perm = m_ScriptEngine.Config.GetString("Allow_" + function, ""); - if (perm == "") + FunctionPerms perms = new FunctionPerms(); + m_FunctionPerms[function] = perms; + + string ownerPerm = m_ScriptEngine.Config.GetString("Allow_" + function, ""); + string creatorPerm = m_ScriptEngine.Config.GetString("Creators_" + function, ""); + if (ownerPerm == "" && creatorPerm == "") { - m_FunctionPerms[function] = null; // a null value is default + // Default behavior + perms.AllowedOwners = null; + perms.AllowedCreators = null; } else { bool allowed; - if (bool.TryParse(perm, out allowed)) + if (bool.TryParse(ownerPerm, out allowed)) { // Boolean given if (allowed) { - m_FunctionPerms[function] = new List(); - m_FunctionPerms[function].Add(UUID.Zero); + // Allow globally + perms.AllowedOwners.Add(UUID.Zero); } - else - m_FunctionPerms[function] = new List(); // Empty list = none } else { - m_FunctionPerms[function] = new List(); + string[] ids = ownerPerm.Split(new char[] {','}); + foreach (string id in ids) + { + string current = id.Trim(); + UUID uuid; + + if (UUID.TryParse(current, out uuid)) + { + if (uuid != UUID.Zero) + perms.AllowedOwners.Add(uuid); + } + } - string[] ids = perm.Split(new char[] {','}); + ids = creatorPerm.Split(new char[] {','}); foreach (string id in ids) { string current = id.Trim(); @@ -250,7 +277,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (UUID.TryParse(current, out uuid)) { if (uuid != UUID.Zero) - m_FunctionPerms[function].Add(uuid); + perms.AllowedCreators.Add(uuid); } } } @@ -266,8 +293,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // // To allow use by anyone, the list contains UUID.Zero // - if (m_FunctionPerms[function] == null) // No list = true + if (m_FunctionPerms[function].AllowedOwners == null) { + // Allow / disallow by threat level if (level > m_MaxThreatLevel) OSSLError( String.Format( @@ -276,8 +304,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - if (!m_FunctionPerms[function].Contains(UUID.Zero)) + if (!m_FunctionPerms[function].AllowedOwners.Contains(UUID.Zero)) { + // Not anyone. Do detailed checks + if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID)) + { + // prim owner is in the list of allowed owners + return; + } + TaskInventoryItem ti = m_host.Inventory.GetInventoryItem(m_itemID); if (ti == null) { @@ -285,9 +320,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api String.Format("{0} permission error. Can't find script in prim inventory.", function)); } - if (!m_FunctionPerms[function].Contains(ti.CreatorID)) + if (!m_FunctionPerms[function].AllowedCreators.Contains(ti.CreatorID)) OSSLError( - String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function.", + 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 != ti.OwnerID) { -- cgit v1.1 From d8962ef4151043babe8d5c33c332bf49b020b119 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 2 Jun 2010 01:01:56 +0200 Subject: Add two new osFunctions: list osGetPrimititveParams(key prim, list rules); osSetPrimitiveParams(key prim, list rules); --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 2e0456e..f2a2f32 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2190,5 +2190,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } + + public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) + { + CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); + m_host.AddScriptLPS(1); + + return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules); + } + + public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) + { + CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams"); + m_host.AddScriptLPS(1); + + m_LSL_Api.SetPrimitiveParamsEx(prim, rules); + } } } -- cgit v1.1 From b3cf5ccf6d7fcfa2cb4a1405962b8fba73ae0119 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 11 Jun 2010 17:04:54 +0200 Subject: Clone cmGetAvatarList into osGetAvatarList for more generic use. --- .../Shared/Api/Implementation/OSSL_Api.cs | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index f2a2f32..0e86c86 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2206,5 +2206,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_LSL_Api.SetPrimitiveParamsEx(prim, rules); } + + /// + /// Like osGetAgents but returns enough info for a radar + /// + /// Strided list of the UUID, position and name of each avatar in the region + public LSL_List osGetAvatarList() + { + CheckThreatLevel(ThreatLevel.None, "osGetAvatarList"); + + LSL_List result = new LSL_List(); + World.ForEachScenePresence(delegate (ScenePresence avatar) + { + if (avatar != null && avatar.UUID != m_host.OwnerID) + { + if (avatar.IsChildAgent == false) + { + if (avatar.PhysicsActor != null && avatar.PhysicsActor.Position != null) + { + result.Add(avatar.UUID); + result.Add(avatar.PhysicsActor.Position); + result.Add(avatar.Name); + } + } + } + }); + return result; + } } } -- cgit v1.1 From 704da8c8238835c63e8ca560fc7778603e9f6795 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Mon, 14 Jun 2010 04:03:54 -0700 Subject: osGetAvatarList: Use AbsolutePosition instead of the position of the physics actor, or the avatar disappears when they sit down. --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0e86c86..db43902 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2222,12 +2222,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (avatar.IsChildAgent == false) { - if (avatar.PhysicsActor != null && avatar.PhysicsActor.Position != null) - { - result.Add(avatar.UUID); - result.Add(avatar.PhysicsActor.Position); - result.Add(avatar.Name); - } + result.Add(avatar.UUID); + result.Add(avatar.AbsolutePosition); + result.Add(avatar.Name); } } }); -- cgit v1.1 From 663e25fd3a67654ea60f91850302f2f17496ba59 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 4 Aug 2010 19:46:41 -0700 Subject: Pacify osGetAvatarList to provide LSL types instead of omv types --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index db43902..80b021f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2222,9 +2222,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (avatar.IsChildAgent == false) { - result.Add(avatar.UUID); - result.Add(avatar.AbsolutePosition); - result.Add(avatar.Name); + result.Add(new LSL_Key(avatar.UUID.ToString())); + result.Add(new LSL_Vector(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z)); + result.Add(new LSL_String(avatar.Name)); } } }); -- cgit v1.1 From eb5c508f8b396ea65d5d80c763aaea70a46c4653 Mon Sep 17 00:00:00 2001 From: meta7 Date: Mon, 9 Aug 2010 23:35:40 -0700 Subject: Add a DebuggerSafe option to the ini to help with debugging in visual studio. This essentially silences exceptions in the script engine. Disabled by default, naturally. --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 80b021f..73e87b5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -129,6 +129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; internal float m_ScriptDelayFactor = 1.0f; internal float m_ScriptDistanceFactor = 1.0f; + internal bool m_debuggerSafe = false; internal Dictionary m_FunctionPerms = new Dictionary(); public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) @@ -137,6 +138,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host = host; m_localID = localID; m_itemID = itemID; + m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) m_OSFunctionsEnabled = true; @@ -195,7 +197,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal void OSSLError(string msg) { - throw new Exception("OSSL Runtime Error: " + msg); + if (m_debuggerSafe) + { + OSSLShoutError(msg); + } + else + { + throw new Exception("OSSL Runtime Error: " + msg); + } } private void InitLSL() -- cgit v1.1 From 6b374fa54767a22c1d236470c8a19ee59b44d937 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 13 Dec 2010 20:19:52 +0100 Subject: Revamp the viewer -> banlist packet processing so fix a number of bugs. Remove the too coarse CanEditParcel method in favor of a CanEditParcelProperties method that takes a GroupPowers argument to specify what action is to be taken. Also, make the method to set parcel data much more granular. Permissions in a deeded setting should now work. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ecd2d6f..712648d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1342,7 +1342,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - if (! World.Permissions.CanEditParcel(m_host.OwnerID, startLandObject)) + if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions)) { OSSLShoutError("You do not have permission to modify the parcel"); return; -- cgit v1.1 From 03f6734f4367b08e2b181ed68bc80b885e76148f Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 7 Sep 2011 09:42:18 -0700 Subject: First set of merge fixes --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 9ec8a42..0c1da47 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2166,8 +2166,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID x = module.CreateNPC(firstname, lastname, new Vector3((float) position.x, (float) position.y, (float) position.z), - World, - appearance); + World,appearance); return new LSL_Key(x.ToString()); } -- cgit v1.1 From f1846045a6663c0530524d7c91d1ed17bf449c07 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 6 Jan 2012 21:34:43 +0100 Subject: Add osNpcCreateOwned to create an owned NPC. Those can be sensed only by the owner, can be destroyed only by the owner and only the owner can save their appearance. Added "NPC" as a flag to llSensor to sense NPCs and exclude them from "AGENT" results. --- .../Shared/Api/Implementation/OSSL_Api.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8cc6554..120ae2c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2076,10 +2076,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return retVal; } + public LSL_Key osNpcCreateOwned(string firstname, string lastname, LSL_Vector position, string notecard) + { + CheckThreatLevel(ThreatLevel.High, "osNpcCreateOwned"); + return NpcCreate(firstname, lastname, position, notecard, true); + } + public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) { - CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); + CheckThreatLevel(ThreatLevel.High, "osNpcCreated"); + return NpcCreate(firstname, lastname, position, notecard, false); + } + private LSL_Key NpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, bool owned) + { INPCModule module = World.RequestModuleInterface(); if (module != null) { @@ -2108,9 +2118,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (appearance == null) return new LSL_Key(UUID.Zero.ToString()); + UUID ownerID = UUID.Zero; + if (owned) + ownerID = m_host.OwnerID; UUID x = module.CreateNPC(firstname, lastname, new Vector3((float) position.x, (float) position.y, (float) position.z), + ownerID, World,appearance); return new LSL_Key(x.ToString()); @@ -2140,6 +2154,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) return new LSL_Key(UUID.Zero.ToString()); + UUID ownerID = npcModule.GetOwner(npcId); + if (ownerID != UUID.Zero && ownerID != m_host.OwnerID) + return new LSL_Key(UUID.Zero.ToString()); + return SaveAppearanceToNotecard(npcId, notecard); } @@ -2319,7 +2337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { - module.DeleteNPC(new UUID(npc.m_string), World); + module.DeleteNPC(new UUID(npc.m_string), m_host.OwnerID, World); } } -- cgit v1.1 From a47aa46962965717ff038e2e74d31e1bf5de2276 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 6 Jan 2012 22:59:08 +0000 Subject: Add osNpcPlayAnimation and osNpcStopAnimation which respect ownership as well --- .../Shared/Api/Implementation/OSSL_Api.cs | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 120ae2c..fe5f198 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -897,6 +897,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarPlayAnimation"); + AvatarPlayAnimation(avatar, animation); + } + + private void AvatarPlayAnimation(string avatar, string animation) + { UUID avatarID = (UUID)avatar; m_host.AddScriptLPS(1); @@ -929,6 +934,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarStopAnimation"); + AvatarStopAnimation(avatar, animation); + } + + private void AvatarStopAnimation(string avatar, string animation) + { UUID avatarID = (UUID)avatar; m_host.AddScriptLPS(1); @@ -2341,6 +2351,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public void osNpcPlayAnimation(LSL_Key npc, string animation) + { + CheckThreatLevel(ThreatLevel.High, "osPlayAnimation"); + + INPCModule module = World.RequestModuleInterface(); + if (module != null) + { + UUID npcID = new UUID(npc.m_string); + if (module.IsNPC(npcID)) + { + UUID ownerID = module.GetOwner(npcID); + if (ownerID == UUID.Zero || ownerID == m_host.OwnerID) + AvatarPlayAnimation(npcID.ToString(), animation); + } + } + } + + public void osNpcStopAnimation(LSL_Key npc, string animation) + { + CheckThreatLevel(ThreatLevel.High, "osNpcStopAnimation"); + + INPCModule module = World.RequestModuleInterface(); + if (module != null) + { + UUID npcID = new UUID(npc.m_string); + if (module.IsNPC(npcID)) + { + UUID ownerID = module.GetOwner(npcID); + if (ownerID == UUID.Zero || ownerID == m_host.OwnerID) + AvatarStopAnimation(npcID.ToString(), animation); + } + } + } + /// /// Save the current appearance of the script owner permanently to the named notecard. /// -- cgit v1.1 From 70157a4ec53bc75ca6acf781600d4901c32ace8b Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 6 Jan 2012 22:33:51 +0100 Subject: Fix some syntax issues --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index fe5f198..6530f14 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2359,7 +2359,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (module != null) { UUID npcID = new UUID(npc.m_string); - if (module.IsNPC(npcID)) + if (module.IsNPC(npcID, m_host.ParentGroup.Scene)) { UUID ownerID = module.GetOwner(npcID); if (ownerID == UUID.Zero || ownerID == m_host.OwnerID) @@ -2376,7 +2376,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (module != null) { UUID npcID = new UUID(npc.m_string); - if (module.IsNPC(npcID)) + if (module.IsNPC(npcID, m_host.ParentGroup.Scene)) { UUID ownerID = module.GetOwner(npcID); if (ownerID == UUID.Zero || ownerID == m_host.OwnerID) -- cgit v1.1 From 38ae4792494f6de71fbd3876f0c2449e7c49e4cc Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 7 Jan 2012 02:49:52 +0100 Subject: Make sure to prefix NPC names with "NPC:" so they can't be mistaken for users --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 6530f14..86bfbf0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2100,6 +2100,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private LSL_Key NpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, bool owned) { + if (firstname != String.Empty || lastname != String.Empty) + { + if (firstname != "Shown outfit:") + firstname = "NPC: " + firstname; + } + INPCModule module = World.RequestModuleInterface(); if (module != null) { -- cgit v1.1 From 69c0f252a4ddeb137446e7db3fc1e0f7ffed7554 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 7 Jan 2012 12:05:42 +0100 Subject: Force the group tag of NPCs to "- NPC -" unless the name is completely blank. --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 86bfbf0..28367b8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2100,10 +2100,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private LSL_Key NpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, bool owned) { + string groupTitle = String.Empty; + if (firstname != String.Empty || lastname != String.Empty) { if (firstname != "Shown outfit:") - firstname = "NPC: " + firstname; + groupTitle = "- NPC -"; } INPCModule module = World.RequestModuleInterface(); @@ -2143,6 +2145,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ownerID, World,appearance); + ScenePresence sp; + if (World.TryGetScenePresence(x, out sp)) + { + sp.Grouptitle = groupTitle; + sp.SendAvatarDataToAllAgents(); + } return new LSL_Key(x.ToString()); } -- cgit v1.1 From 94fa6cb071bbb3e883c11a47f970b6d3101b69f7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 7 Jan 2012 12:29:59 +0100 Subject: Fix threat level setting on osNpcPlayAnimation --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 28367b8..40dd4ed 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2367,7 +2367,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void osNpcPlayAnimation(LSL_Key npc, string animation) { - CheckThreatLevel(ThreatLevel.High, "osPlayAnimation"); + CheckThreatLevel(ThreatLevel.High, "osNpcPlayAnimation"); INPCModule module = World.RequestModuleInterface(); if (module != null) -- cgit v1.1 From aa2cde2493d5cd01686ab29e25be8f110112a860 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 12 Jan 2012 23:04:38 +0100 Subject: Disable unowned NPCs --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 62cd75f..e3a750d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2106,6 +2106,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private LSL_Key NpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, bool owned) { + if (!owned) + OSSL_Error("Unowned NPCs are unsupported"); + string groupTitle = String.Empty; if (firstname != String.Empty || lastname != String.Empty) -- cgit v1.1 From c7757d10386c2a4e8a9015597bd227bb98b47079 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 12 Jan 2012 23:07:38 +0100 Subject: Fix typo --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e3a750d..44b0b88 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2107,7 +2107,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private LSL_Key NpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, bool owned) { if (!owned) - OSSL_Error("Unowned NPCs are unsupported"); + OSSLError("Unowned NPCs are unsupported"); string groupTitle = String.Empty; -- cgit v1.1 From 068b8e1f9b3f754426e76e17cb926fc1cd5d9dad Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jan 2012 14:49:32 +0100 Subject: Disable using an agent ID to clone NPCs. The griefing potential is too great --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 78c3fa0..c343e93 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2116,13 +2116,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { AvatarAppearance appearance = null; - UUID id; - if (UUID.TryParse(notecard, out id)) - { - ScenePresence clonePresence = World.GetScenePresence(id); - if (clonePresence != null) - appearance = clonePresence.Appearance; - } +// UUID id; +// if (UUID.TryParse(notecard, out id)) +// { +// ScenePresence clonePresence = World.GetScenePresence(id); +// if (clonePresence != null) +// appearance = clonePresence.Appearance; +// } if (appearance == null) { -- cgit v1.1 From 747c25e92083c6a71b4163a9336c91cffa67bfb2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 17 Jan 2012 11:18:56 +0100 Subject: Spin off NPC deletion into a thread to avoid it being done on a script microthread. A stab at fixing exceptions. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ca340c6..37792ef 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2406,7 +2406,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!module.CheckPermissions(npcId, m_host.OwnerID)) return; - module.DeleteNPC(npcId, World); + Util.FireAndForget(delegate(object x) { + module.DeleteNPC(npcId, World); + }); } } -- cgit v1.1 From 090164ff7a8edab3cad12728b67c35d9f50ddaab Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 28 Jan 2012 03:12:56 +0100 Subject: Completely disable NPC being sensed as agents, the abuse potential is too great --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1cb052d..29d658f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2242,7 +2242,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); m_host.AddScriptLPS(1); - return NpcCreate(firstname, lastname, position, notecard, false, true); + return NpcCreate(firstname, lastname, position, notecard, false, false); } public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) @@ -2252,8 +2252,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return NpcCreate( firstname, lastname, position, notecard, - (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0, - (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) == 0); + (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0); +// (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) == 0); } private LSL_Key NpcCreate( @@ -2945,4 +2945,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } } -} \ No newline at end of file +} -- cgit v1.1 From fbe324cc5e4c6ea3a1ef9696186bea8cfb4d5636 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 28 Jan 2012 03:15:17 +0100 Subject: Fix build break --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 29d658f..aa8349f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2252,7 +2252,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return NpcCreate( firstname, lastname, position, notecard, - (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0); + (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0, + false); // (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) == 0); } -- cgit v1.1 From 6fbc48ee9ca2141add3f7f6a316138895a5c7c4c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 28 Jan 2012 03:32:25 +0100 Subject: Make all NPCs owned by default --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index aa8349f..1f1d45e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2242,7 +2242,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); m_host.AddScriptLPS(1); - return NpcCreate(firstname, lastname, position, notecard, false, false); + return NpcCreate(firstname, lastname, position, notecard, true, false); } public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options) -- cgit v1.1 From a829f208280bcad82d5e1f5a66c53e4d586491e5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 6 Feb 2012 22:26:25 +0100 Subject: Experimental. Expand Fire & Forget for NPC delete --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1f1d45e..614872e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2584,15 +2584,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); m_host.AddScriptLPS(1); - INPCModule module = World.RequestModuleInterface(); - if (module != null) - { - UUID npcId = new UUID(npc.m_string); + Util.FireAndForget(delegate(object x) { + INPCModule module = World.RequestModuleInterface(); + if (module != null) + { + UUID npcId = new UUID(npc.m_string); - if (!module.CheckPermissions(npcId, m_host.OwnerID)) - return; + if (!module.CheckPermissions(npcId, m_host.OwnerID)) + return; - Util.FireAndForget(delegate(object x) { module.DeleteNPC(npcId, World); }); } -- cgit v1.1 From 9c6ba8d18f4b3c4b457240f251612691cb271d90 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 8 Feb 2012 13:04:23 +0100 Subject: Push more NPC stuff into threads --- .../Shared/Api/Implementation/OSSL_Api.cs | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 614872e..c83df4e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2584,18 +2584,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); m_host.AddScriptLPS(1); + ManualResetEvent ev = new ManualResetEvent(false); + Util.FireAndForget(delegate(object x) { - INPCModule module = World.RequestModuleInterface(); - if (module != null) + try { - UUID npcId = new UUID(npc.m_string); + INPCModule module = World.RequestModuleInterface(); + if (module != null) + { + UUID npcId = new UUID(npc.m_string); - if (!module.CheckPermissions(npcId, m_host.OwnerID)) - return; + if (!module.CheckPermissions(npcId, m_host.OwnerID)) + return; - module.DeleteNPC(npcId, World); - }); - } + module.DeleteNPC(npcId, World); + } + } + finally + { + ev.Set(); + } + }); + ev.WaitOne(); } public void osNpcPlayAnimation(LSL_Key npc, string animation) -- cgit v1.1 From a7b61add99bb7907ae054010232fd303f6ae739e Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 5 Mar 2012 22:22:28 +0100 Subject: Allow NPC to be removed by the owner of the parcel they're over. Don't allow NPC creation unless the prim owner has rez rights. --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 2424130..a9b8e04 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2265,6 +2265,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string groupTitle = String.Empty; + if (!World.Permissions.CanRezObject(1, m_host.OwnerID, new Vector3((float)position.x, (float)position.y, (float)position.z))) + return new LSL_Key(UUID.Zero.ToString()); + if (firstname != String.Empty || lastname != String.Empty) { if (firstname != "Shown outfit:") @@ -2594,8 +2597,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID npcId = new UUID(npc.m_string); - if (!module.CheckPermissions(npcId, m_host.OwnerID)) - return; + ILandObject l = World.LandChannel.GetLandObject(m_host.GroupPosition.X, m_host.GroupPosition.Y); + if (l == null || m_host.OwnerID != l.LandData.OwnerID) + { + if (!module.CheckPermissions(npcId, m_host.OwnerID)) + return; + } module.DeleteNPC(npcId, World); } -- cgit v1.1 From 1eb1c1bd4bc972e2df301b9dafb40fbb2f37b40c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Aug 2012 18:19:51 +0100 Subject: renaming to be similar to equivalent Set command Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a81c39c..7b71a24 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2261,7 +2261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - retVal += ((LSL_Api)m_LSL_Api).GetLinkPrimitiveParams(part, rules); + retVal += ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules); } return retVal; } @@ -3013,7 +3013,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); InitLSL(); - return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules); + return m_LSL_Api.GetPrimitiveParamsEx(prim, rules); } public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) -- cgit v1.1 From 86d4e45f4d5ce7de4a2043dfe753f620925e28c4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Aug 2012 21:03:47 +0100 Subject: since we will be making the Get return type the remaining ruleset as with the Set return type, we need to move the original return type to a ref param Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7b71a24..efd1f39 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2261,7 +2261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - retVal += ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules); + ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules, ref retVal); } return retVal; } -- cgit v1.1 From 3d8f393fbe0072d93fc8303741420bb36c844d44 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:25:37 +0100 Subject: refactoring to local variable for cleaner code --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index efd1f39..43cfea2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2257,11 +2257,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams"); m_host.AddScriptLPS(1); InitLSL(); + // One needs to cast m_LSL_Api because we're using functions not + // on the ILSL_Api interface. + LSL_Api LSL_Api = (LSL_Api)m_LSL_Api; LSL_List retVal = new LSL_List(); - List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); + List parts = LSL_Api.GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules, ref retVal); + LSL_Api.GetPrimParams(part, rules, ref retVal); } return retVal; } -- cgit v1.1 From 7e21ddeeff8cbe7a715c0b2e4fc6bbd47e1160d8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 28 Sep 2012 00:15:14 +0200 Subject: Fix a possible NRE --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 2f02f1f..80111f9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2341,9 +2341,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (appearanceSerialized != null) { - OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); - appearance = new AvatarAppearance(); - appearance.Unpack(appearanceOsd); + try + { + OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); + appearance = new AvatarAppearance(); + appearance.Unpack(appearanceOsd); + } + catch + { + return UUID.Zero.ToString(); + } } } -- cgit v1.1 From 818254916cb562422b3a3301b9f35fafd64ee3fe Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 16 Jan 2013 15:47:55 +0000 Subject: JustinCC's core re-merge --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 4a46398..49857cf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -143,9 +143,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected IUrlModule m_UrlModule = null; - public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) + public void Initialize( + IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, EventWaitHandle coopSleepHandle) { - m_ScriptEngine = ScriptEngine; + m_ScriptEngine = scriptEngine; m_host = host; m_item = item; m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); -- cgit v1.1 From 09a3e134e4fd9300899131f13b5be1494a767970 Mon Sep 17 00:00:00 2001 From: teravus Date: Mon, 21 Jan 2013 17:30:38 -0500 Subject: * Fix notecard loading - If the notecard name is formatted like a UUID but isn't an actual asset UUID, then try to load it like an asset id first, then try to load it as a task inventoryitem name. If the passed UUID is a string, try to load it like a task inventory item name. --- .../Shared/Api/Implementation/OSSL_Api.cs | 46 ++++++++++++++++------ 1 file changed, 35 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 51c8c7e..7c2f8ed 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1821,17 +1821,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID assetID = UUID.Zero; - if (!UUID.TryParse(notecardNameOrUuid, out assetID)) + bool notecardNameIsUUID = UUID.TryParse(notecardNameOrUuid, out assetID); + + if (!notecardNameIsUUID) { - m_host.TaskInventory.LockItemsForRead(true); - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == 7 && item.Name == notecardNameOrUuid) - { - assetID = item.AssetID; - } - } - m_host.TaskInventory.LockItemsForRead(false); + assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid); } if (assetID == UUID.Zero) @@ -1842,7 +1836,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api AssetBase a = World.AssetService.Get(assetID.ToString()); if (a == null) - return UUID.Zero; + { + // Whoops, it's still possible here that the notecard name was properly + // formatted like a UUID but isn't an asset UUID so lets look it up by name after all + assetID = SearchTaskInventoryForAssetId(notecardNameOrUuid); + if (assetID == UUID.Zero) + return UUID.Zero; + + if (!NotecardCache.IsCached(assetID)) + { + a = World.AssetService.Get(assetID.ToString()); + + if (a == null) + { + return UUID.Zero; + } + } + } string data = Encoding.UTF8.GetString(a.Data); NotecardCache.Cache(assetID, data); @@ -1850,6 +1860,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return assetID; } + protected UUID SearchTaskInventoryForAssetId(string name) + { + UUID assetId = UUID.Zero; + m_host.TaskInventory.LockItemsForRead(true); + foreach (TaskInventoryItem item in m_host.TaskInventory.Values) + { + if (item.Type == 7 && item.Name == name) + { + assetId = item.AssetID; + } + } + m_host.TaskInventory.LockItemsForRead(false); + return assetId; + } /// /// Directly get an entire notecard at once. -- cgit v1.1 From d7c742a5f9ee87336a9c962c772a07afa38498c5 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 25 Feb 2013 23:01:03 +0100 Subject: Remove osParseJSONNew because it's "object" return type is not useful for LSL --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7c2f8ed..8aac33f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1619,7 +1619,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public Object osParseJSONNew(string JSON) + private Object osParseJSONNew(string JSON) { CheckThreatLevel(ThreatLevel.None, "osParseJSONNew"); -- cgit v1.1 From c341664c1b8ccf3bd7b81795b900b971a15ff318 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 24 Mar 2013 18:56:28 +0100 Subject: Phase 1 of implementing a transfer permission. Overwrite libOMV's PermissionMask with our own and add export permissions as well as a new definition for "All" as meaning "all conventional permissions" rather than "all possible permissions" --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 234ba34..f4e4f44 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -62,6 +62,7 @@ using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; +using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.ScriptEngine.Shared.Api { @@ -1796,8 +1797,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api taskItem.InvType = (int)InventoryType.Notecard; taskItem.OwnerID = m_host.OwnerID; taskItem.CreatorID = m_host.OwnerID; - taskItem.BasePermissions = (uint)PermissionMask.All; - taskItem.CurrentPermissions = (uint)PermissionMask.All; + taskItem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; + taskItem.CurrentPermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; taskItem.EveryonePermissions = 0; taskItem.NextPermissions = (uint)PermissionMask.All; taskItem.GroupID = m_host.GroupID; -- cgit v1.1 From d97896d39a50cdcbf1d96a9a9382b4dde7b76b53 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 26 Apr 2014 20:32:27 +0200 Subject: Differentiate between requests only the owner should be able to do and those that managers can do when setting parcel data --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index f4e4f44..9c148d1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1434,7 +1434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions)) + if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false)) { OSSLShoutError("You do not have permission to modify the parcel"); return; -- cgit v1.1 From f95bb533719bd80cfecb5f82e735230a0317bbc6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 21 Sep 2014 23:02:02 +0100 Subject: remove LockItemsForRead(false) without previus call with true --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7081416..d2a5980 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -991,7 +991,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else animID = UUID.Zero; } - m_host.TaskInventory.LockItemsForRead(false); + if (animID == UUID.Zero) target.Animator.RemoveAnimation(animation); -- cgit v1.1 From 07dead7dcb8b0f2a27a50748e4a460d9669903fc Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 29 Mar 2015 14:25:12 -0700 Subject: varregion: any conversions of use of Constants.RegionSize converted into Util.cs routines to convert region coords to and from world coords or handles. --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index d2a5980..01d90e7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -459,7 +459,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) + if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0) OSSLError("osSetTerrainHeight: Coordinate out of bounds"); if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0))) @@ -489,7 +489,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private LSL_Float GetTerrainHeight(int x, int y) { m_host.AddScriptLPS(1); - if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) + if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0) OSSLError("osGetTerrainHeight: Coordinate out of bounds"); return World.Heightmap[x, y]; @@ -823,7 +823,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private void TeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) { - ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); + ulong regionHandle = Util.RegionLocToHandle((uint)regionX, (uint)regionY); m_host.AddScriptLPS(1); UUID agentId = new UUID(); @@ -3024,7 +3024,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - return new LSL_Vector((float)Constants.RegionSize, (float)Constants.RegionSize, Constants.RegionHeight); + return new LSL_Vector((float)World.RegionInfo.RegionSizeX, + (float)World.RegionInfo.RegionSizeY, + (float)World.RegionInfo.RegionSizeZ ); } } -- cgit v1.1