From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001
From: onefang
Date: Sun, 19 May 2019 21:24:15 +1000
Subject: Dump OpenSim 0.9.0.1 into it's own branch.
---
.../Api/Implementation/AsyncCommandManager.cs | 123 +-
.../Shared/Api/Implementation/CM_Api.cs | 129 +
.../Shared/Api/Implementation/LSL_Api.cs | 5966 ++++++++++++++------
.../Shared/Api/Implementation/LS_Api.cs | 18 +-
.../Shared/Api/Implementation/MOD_Api.cs | 84 +-
.../Shared/Api/Implementation/OSSL_Api.cs | 2065 +++++--
.../Api/Implementation/Plugins/SensorRepeat.cs | 62 +-
.../Shared/Api/Implementation/Plugins/Timer.cs | 34 +-
.../Api/Implementation/Properties/AssemblyInfo.cs | 10 +-
.../ScriptEngine/Shared/Api/Interface/ICM_Api.cs | 46 +
.../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 24 +-
.../ScriptEngine/Shared/Api/Interface/IMOD_Api.cs | 2 +-
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 50 +-
.../ScriptEngine/Shared/Api/Runtime/CM_Stub.cs | 71 +
.../ScriptEngine/Shared/Api/Runtime/Executor.cs | 2 +
.../Shared/Api/Runtime/LSL_Constants.cs | 79 +-
.../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 113 +-
.../ScriptEngine/Shared/Api/Runtime/LS_Stub.cs | 21 +
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 173 +-
...nSim.Region.ScriptEngine.Shared.Api.Runtime.mdp | 48 -
.../Shared/Api/Runtime/Properties/AssemblyInfo.cs | 8 +-
.../ScriptEngine/Shared/Api/Runtime/ScriptBase.cs | 2 +
22 files changed, 6572 insertions(+), 2558 deletions(-)
create mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
create mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
create mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
delete mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
(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 036cb5d..e01d2e4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -28,9 +28,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
-using System.Reflection;
using System.Threading;
-using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Monitoring;
@@ -39,6 +37,8 @@ using OpenSim.Region.ScriptEngine.Interfaces;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
using Timer=OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer;
+using System.Reflection;
+using log4net;
namespace OpenSim.Region.ScriptEngine.Shared.Api
{
@@ -51,7 +51,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
private static Thread cmdHandlerThread;
private static int cmdHandlerThreadCycleSleepms;
-
+ private static int numInstances;
///
/// Lock for reading/writing static components of AsyncCommandManager.
///
@@ -81,64 +81,64 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public Dataserver DataserverPlugin
{
- get
- {
+ get
+ {
lock (staticLock)
- return m_Dataserver[m_ScriptEngine];
+ return m_Dataserver[m_ScriptEngine];
}
}
public Timer TimerPlugin
{
- get
- {
+ get
+ {
lock (staticLock)
- return m_Timer[m_ScriptEngine];
+ return m_Timer[m_ScriptEngine];
}
}
public HttpRequest HttpRequestPlugin
{
- get
- {
+ get
+ {
lock (staticLock)
- return m_HttpRequest[m_ScriptEngine];
+ return m_HttpRequest[m_ScriptEngine];
}
}
public Listener ListenerPlugin
{
- get
- {
+ get
+ {
lock (staticLock)
- return m_Listener[m_ScriptEngine];
+ return m_Listener[m_ScriptEngine];
}
}
public SensorRepeat SensorRepeatPlugin
{
- get
- {
+ get
+ {
lock (staticLock)
- return m_SensorRepeat[m_ScriptEngine];
+ return m_SensorRepeat[m_ScriptEngine];
}
}
public XmlRequest XmlRequestPlugin
{
- get
- {
+ get
+ {
lock (staticLock)
- return m_XmlRequest[m_ScriptEngine];
+ return m_XmlRequest[m_ScriptEngine];
}
}
public IScriptEngine[] ScriptEngines
{
- get
- {
+ get
+ {
lock (staticLock)
- return m_ScriptEngines.ToArray();
+ return m_ScriptEngines.ToArray();
}
}
@@ -172,18 +172,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!m_XmlRequest.ContainsKey(m_ScriptEngine))
m_XmlRequest[m_ScriptEngine] = new XmlRequest(this);
- StartThread();
- }
- }
-
- private static void StartThread()
- {
- if (cmdHandlerThread == null)
- {
- // Start the thread that will be doing the work
- cmdHandlerThread
- = WorkManager.StartThread(
+ numInstances++;
+ if (cmdHandlerThread == null)
+ {
+ cmdHandlerThread = WorkManager.StartThread(
CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true);
+ }
}
}
@@ -194,25 +188,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
cmdHandlerThreadCycleSleepms = 100;
}
+/*
~AsyncCommandManager()
{
// Shut down thread
-// try
-// {
-// if (cmdHandlerThread != null)
-// {
-// if (cmdHandlerThread.IsAlive == true)
-// {
-// cmdHandlerThread.Abort();
-// //cmdHandlerThread.Join();
-// }
-// }
-// }
-// catch
-// {
-// }
- }
+ try
+ {
+ lock (staticLock)
+ {
+ numInstances--;
+ if(numInstances > 0)
+ return;
+ if (cmdHandlerThread != null)
+ {
+ if (cmdHandlerThread.IsAlive == true)
+ {
+ cmdHandlerThread.Abort();
+ //cmdHandlerThread.Join();
+ cmdHandlerThread = null;
+ }
+ }
+ }
+ }
+ catch
+ {
+ }
+ }
+*/
///
/// Main loop for the manager thread
///
@@ -223,11 +226,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
try
{
Thread.Sleep(cmdHandlerThreadCycleSleepms);
-
+ Watchdog.UpdateThread();
DoOneCmdHandlerPass();
-
Watchdog.UpdateThread();
}
+ catch ( System.Threading.ThreadAbortException) { }
catch (Exception e)
{
m_log.Error("[ASYNC COMMAND MANAGER]: Exception in command handler pass: ", e);
@@ -240,24 +243,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
lock (staticLock)
{
// Check HttpRequests
- m_HttpRequest[m_ScriptEngines[0]].CheckHttpRequests();
+ try { m_HttpRequest[m_ScriptEngines[0]].CheckHttpRequests(); } catch {}
// Check XMLRPCRequests
- m_XmlRequest[m_ScriptEngines[0]].CheckXMLRPCRequests();
+ try { m_XmlRequest[m_ScriptEngines[0]].CheckXMLRPCRequests(); } catch {}
foreach (IScriptEngine s in m_ScriptEngines)
{
// Check Listeners
- m_Listener[s].CheckListeners();
+ try { m_Listener[s].CheckListeners(); } catch {}
+
// Check timers
- m_Timer[s].CheckTimerEvents();
+ try { m_Timer[s].CheckTimerEvents(); } catch {}
// Check Sensors
- m_SensorRepeat[s].CheckSenseRepeaterEvents();
+ try { m_SensorRepeat[s].CheckSenseRepeaterEvents(); } catch {}
// Check dataserver
- m_Dataserver[s].ExpireRequests();
+ try { m_Dataserver[s].ExpireRequests(); } catch {}
}
}
}
@@ -269,6 +273,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public static void RemoveScript(IScriptEngine engine, uint localID, UUID itemID)
{
+ // Remove a specific script
// m_log.DebugFormat("[ASYNC COMMAND MANAGER]: Removing facilities for script {0}", itemID);
lock (staticLock)
@@ -282,7 +287,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Remove from: HttpRequest
IHttpRequestModule iHttpReq = engine.World.RequestModuleInterface();
if (iHttpReq != null)
- iHttpReq.StopHttpRequestsForScript(itemID);
+ iHttpReq.StopHttpRequest(localID, itemID);
IWorldComm comms = engine.World.RequestModuleInterface();
if (comms != null)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
new file mode 100644
index 0000000..3509968
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Threading;
+using System.Reflection;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.Remoting.Lifetime;
+using OpenMetaverse;
+using Nini.Config;
+using OpenSim;
+using OpenSim.Framework;
+using OpenSim.Region.CoreModules.World.LightShare;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+using OpenSim.Region.ScriptEngine.Shared;
+using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
+using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
+using OpenSim.Region.ScriptEngine.Interfaces;
+using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
+using OpenSim.Services.Interfaces;
+
+using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
+using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
+using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
+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;
+
+namespace OpenSim.Region.ScriptEngine.Shared.Api
+{
+ [Serializable]
+ public class CM_Api : MarshalByRefObject, ICM_Api, IScriptApi
+ {
+ internal IScriptEngine m_ScriptEngine;
+ internal SceneObjectPart m_host;
+ internal TaskInventoryItem m_item;
+ internal bool m_CMFunctionsEnabled = false;
+
+ public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item)
+ {
+ m_ScriptEngine = ScriptEngine;
+ m_host = host;
+ m_item = item;
+
+ if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false))
+ m_CMFunctionsEnabled = true;
+ }
+
+ public override Object InitializeLifetimeService()
+ {
+ ILease lease = (ILease)base.InitializeLifetimeService();
+
+ if (lease.CurrentState == LeaseState.Initial)
+ {
+ lease.InitialLeaseTime = TimeSpan.FromMinutes(0);
+// lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
+// lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
+ }
+ return lease;
+ }
+
+ public Scene World
+ {
+ get { return m_ScriptEngine.World; }
+ }
+
+ public string cmDetectedCountry(int number)
+ {
+ m_host.AddScriptLPS(1);
+ if(!m_CMFunctionsEnabled)
+ return String.Empty;
+ if(World.UserAccountService == null)
+ return String.Empty;
+ DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number);
+ if (detectedParams == null)
+ return String.Empty;
+ UUID key = detectedParams.Key;
+ if(key == UUID.Zero)
+ return String.Empty;
+ UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, key);
+ return account.UserCountry;
+ }
+
+ public string cmGetAgentCountry(LSL_Key key)
+ {
+ if(! m_CMFunctionsEnabled)
+ return "";
+ if(World.UserAccountService == null)
+ return String.Empty;
+ if (!World.Permissions.IsGod(m_host.OwnerID))
+ return String.Empty;
+
+ UUID uuid;
+
+ if (!UUID.TryParse(key, out uuid))
+ return String.Empty;
+
+ UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
+ return account.UserCountry;
+ }
+ }
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 1399880..bac1468 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -28,6 +28,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Collections.Specialized;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
@@ -35,10 +36,12 @@ using System.Runtime.Remoting.Lifetime;
using System.Text;
using System.Threading;
using System.Text.RegularExpressions;
+using System.Timers;
using Nini.Config;
using log4net;
using OpenMetaverse;
using OpenMetaverse.Assets;
+using OpenMetaverse.StructuredData; // LitJson is hidden on this
using OpenMetaverse.Packets;
using OpenMetaverse.Rendering;
using OpenSim;
@@ -49,6 +52,7 @@ using OpenSim.Region.CoreModules.World.Land;
using OpenSim.Region.CoreModules.World.Terrain;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
+using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Region.Framework.Scenes.Animation;
using OpenSim.Region.Framework.Scenes.Scripting;
using OpenSim.Region.PhysicsModules.SharedBase;
@@ -72,6 +76,7 @@ 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 System.Reflection;
+using Timer = System.Timers.Timer;
using System.Linq;
using PermissionMask = OpenSim.Framework.PermissionMask;
@@ -98,30 +103,87 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected SceneObjectPart m_host;
///
- /// Used for script sleeps when we are using co-operative script termination.
- ///
- /// null if co-operative script termination is not active
- ///
/// The item that hosts this script
///
protected TaskInventoryItem m_item;
protected bool throwErrorOnNotImplemented = false;
protected AsyncCommandManager AsyncCommands = null;
+ protected float m_ScriptDelayFactor = 1.0f;
protected float m_ScriptDistanceFactor = 1.0f;
protected float m_MinTimerInterval = 0.5f;
protected float m_recoilScaleFactor = 0.0f;
- protected DateTime m_timer = DateTime.Now;
+ protected double m_timer = Util.GetTimeStampMS();
protected bool m_waitingForScriptAnswer = false;
protected bool m_automaticLinkPermission = false;
protected IMessageTransferModule m_TransferModule = null;
protected int m_notecardLineReadCharsMax = 255;
protected int m_scriptConsoleChannel = 0;
protected bool m_scriptConsoleChannelEnabled = false;
+ protected bool m_debuggerSafe = false;
protected IUrlModule m_UrlModule = null;
+
protected Dictionary m_userInfoCache = new Dictionary();
protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
+ protected int m_sleepMsOnSetTexture = 200;
+ protected int m_sleepMsOnSetLinkTexture = 200;
+ protected int m_sleepMsOnScaleTexture = 200;
+ protected int m_sleepMsOnOffsetTexture = 200;
+ protected int m_sleepMsOnRotateTexture = 200;
+ protected int m_sleepMsOnSetPos = 200;
+ protected int m_sleepMsOnSetRot = 200;
+ protected int m_sleepMsOnSetLocalRot = 200;
+ protected int m_sleepMsOnPreloadSound = 1000;
+ protected int m_sleepMsOnMakeExplosion = 100;
+ protected int m_sleepMsOnMakeFountain = 100;
+ protected int m_sleepMsOnMakeSmoke = 100;
+ protected int m_sleepMsOnMakeFire = 100;
+ protected int m_sleepMsOnRezAtRoot = 100;
+ protected int m_sleepMsOnInstantMessage = 2000;
+ protected int m_sleepMsOnEmail = 20000;
+ protected int m_sleepMsOnCreateLink = 1000;
+ protected int m_sleepMsOnGiveInventory = 3000;
+ protected int m_sleepMsOnRequestAgentData = 100;
+ protected int m_sleepMsOnRequestInventoryData = 1000;
+ protected int m_sleepMsOnSetDamage = 5000;
+ protected int m_sleepMsOnTextBox = 1000;
+ protected int m_sleepMsOnAdjustSoundVolume = 100;
+ protected int m_sleepMsOnEjectFromLand = 5000;
+ protected int m_sleepMsOnAddToLandPassList = 100;
+ protected int m_sleepMsOnDialog = 1000;
+ protected int m_sleepMsOnRemoteLoadScript = 3000;
+ protected int m_sleepMsOnRemoteLoadScriptPin = 3000;
+ protected int m_sleepMsOnOpenRemoteDataChannel = 1000;
+ protected int m_sleepMsOnSendRemoteData = 3000;
+ protected int m_sleepMsOnRemoteDataReply = 3000;
+ protected int m_sleepMsOnCloseRemoteDataChannel = 1000;
+ protected int m_sleepMsOnSetPrimitiveParams = 200;
+ protected int m_sleepMsOnSetLinkPrimitiveParams = 200;
+ protected int m_sleepMsOnXorBase64Strings = 300;
+ protected int m_sleepMsOnSetParcelMusicURL = 2000;
+ protected int m_sleepMsOnGetPrimMediaParams = 1000;
+ protected int m_sleepMsOnGetLinkMedia = 1000;
+ protected int m_sleepMsOnSetPrimMediaParams = 1000;
+ protected int m_sleepMsOnSetLinkMedia = 1000;
+ protected int m_sleepMsOnClearPrimMedia = 1000;
+ protected int m_sleepMsOnClearLinkMedia = 1000;
+ protected int m_sleepMsOnRequestSimulatorData = 1000;
+ protected int m_sleepMsOnLoadURL = 10000;
+ protected int m_sleepMsOnParcelMediaCommandList = 2000;
+ protected int m_sleepMsOnParcelMediaQuery = 2000;
+ protected int m_sleepMsOnModPow = 1000;
+ protected int m_sleepMsOnSetPrimURL = 2000;
+ protected int m_sleepMsOnRefreshPrimURL = 20000;
+ protected int m_sleepMsOnMapDestination = 1000;
+ protected int m_sleepMsOnAddToLandBanList = 100;
+ protected int m_sleepMsOnRemoveFromLandPassList = 100;
+ protected int m_sleepMsOnRemoveFromLandBanList = 100;
+ protected int m_sleepMsOnResetLandBanList = 100;
+ protected int m_sleepMsOnResetLandPassList = 100;
+ protected int m_sleepMsOnGetParcelPrimOwners = 2000;
+ protected int m_sleepMsOnGetNumberOfNotecardLines = 100;
+ protected int m_sleepMsOnGetNotecardLine = 100;
protected string m_internalObjectHost = "lsl.opensim.local";
protected bool m_restrictEmail = false;
protected ISoundModule m_SoundModule = null;
@@ -172,7 +234,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected int m_maxHitsPerPrimInCastRay = 16;
protected int m_maxHitsPerObjectInCastRay = 16;
protected bool m_detectExitsInCastRay = false;
- protected bool m_filterPartsInCastRay = false;
protected bool m_doAttachmentsInCastRay = false;
protected int m_msThrottleInCastRay = 200;
protected int m_msPerRegionInCastRay = 40;
@@ -183,6 +244,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected bool m_useMeshCacheInCastRay = true;
protected static Dictionary m_cachedMeshes = new Dictionary();
+// protected Timer m_ShoutSayTimer;
+ protected int m_SayShoutCount = 0;
+ DateTime m_lastSayShoutCheck;
+
+ private Dictionary MovementAnimationsForLSL =
+ new Dictionary {
+ {"CROUCH", "Crouching"},
+ {"CROUCHWALK", "CrouchWalking"},
+ {"FALLDOWN", "Falling Down"},
+ {"FLY", "Flying"},
+ {"FLYSLOW", "FlyingSlow"},
+ {"HOVER", "Hovering"},
+ {"HOVER_UP", "Hovering Up"},
+ {"HOVER_DOWN", "Hovering Down"},
+ {"JUMP", "Jumping"},
+ {"LAND", "Landing"},
+ {"PREJUMP", "PreJumping"},
+ {"RUN", "Running"},
+ {"SIT","Sitting"},
+ {"SITGROUND","Sitting on Ground"},
+ {"STAND", "Standing"},
+ {"STANDUP", "Standing Up"},
+ {"STRIDE","Striding"},
+ {"SOFT_LAND", "Soft Landing"},
+ {"TURNLEFT", "Turning Left"},
+ {"TURNRIGHT", "Turning Right"},
+ {"WALK", "Walking"}
+ };
+
//An array of HTTP/1.1 headers that are not allowed to be used
//as custom headers by llHTTPRequest.
private string[] HttpStandardHeaders =
@@ -203,9 +293,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void Initialize(
IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
{
+ m_lastSayShoutCheck = DateTime.UtcNow;
+
m_ScriptEngine = scriptEngine;
m_host = host;
m_item = item;
+ m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);
LoadConfig();
@@ -228,6 +321,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (seConfig != null)
{
+ m_ScriptDelayFactor =
+ seConfig.GetFloat("ScriptDelayFactor", m_ScriptDelayFactor);
m_ScriptDistanceFactor =
seConfig.GetFloat("ScriptDistanceLimitFactor", m_ScriptDistanceFactor);
m_MinTimerInterval =
@@ -296,7 +391,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_maxHitsPerPrimInCastRay = lslConfig.GetInt("MaxHitsPerPrimInLlCastRay", m_maxHitsPerPrimInCastRay);
m_maxHitsPerObjectInCastRay = lslConfig.GetInt("MaxHitsPerObjectInLlCastRay", m_maxHitsPerObjectInCastRay);
m_detectExitsInCastRay = lslConfig.GetBoolean("DetectExitHitsInLlCastRay", m_detectExitsInCastRay);
- m_filterPartsInCastRay = lslConfig.GetBoolean("FilterPartsInLlCastRay", m_filterPartsInCastRay);
m_doAttachmentsInCastRay = lslConfig.GetBoolean("DoAttachmentsInLlCastRay", m_doAttachmentsInCastRay);
m_msThrottleInCastRay = lslConfig.GetInt("ThrottleTimeInMsInLlCastRay", m_msThrottleInCastRay);
m_msPerRegionInCastRay = lslConfig.GetInt("AvailableTimeInMsPerRegionInLlCastRay", m_msPerRegionInCastRay);
@@ -307,7 +401,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
IConfig smtpConfig = seConfigSource.Configs["SMTP"];
- if (smtpConfig != null)
+ if (smtpConfig != null)
{
// there's an smtp config, so load in the snooze time.
EMAIL_PAUSE_TIME = smtpConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
@@ -315,6 +409,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_internalObjectHost = smtpConfig.GetString("internal_object_host", m_internalObjectHost);
}
}
+ m_sleepMsOnEmail = EMAIL_PAUSE_TIME * 1000;
}
public override Object InitializeLifetimeService()
@@ -330,6 +425,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return lease;
}
+ protected SceneObjectPart MonitoringObject()
+ {
+ UUID m = m_host.ParentGroup.MonitoringObject;
+ if (m == UUID.Zero)
+ return null;
+
+ SceneObjectPart p = m_ScriptEngine.World.GetSceneObjectPart(m);
+ if (p == null)
+ m_host.ParentGroup.MonitoringObject = UUID.Zero;
+
+ return p;
+ }
+
+ protected virtual void ScriptSleep(int delay)
+ {
+ delay = (int)((float)delay * m_ScriptDelayFactor);
+ if (delay == 0)
+ return;
+
+ Sleep(delay);
+ }
+
protected virtual void Sleep(int delay)
{
if (m_item == null) // Some unit tests don't set this
@@ -351,6 +468,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
get { return m_ScriptEngine.World; }
}
+ [DebuggerNonUserCode]
public void state(string newState)
{
m_ScriptEngine.SetState(m_item.ItemID, newState);
@@ -360,6 +478,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// Reset the named script. The script must be present
/// in the same prim.
///
+ [DebuggerNonUserCode]
public void llResetScript()
{
m_host.AddScriptLPS(1);
@@ -376,12 +495,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
UUID item;
- m_host.AddScriptLPS(1);
-
- if ((item = GetScriptByName(name)) != UUID.Zero)
- m_ScriptEngine.ResetScript(item);
- else
+ if ((item = GetScriptByName(name)) == UUID.Zero)
+ {
+ m_host.AddScriptLPS(1);
Error("llResetOtherScript", "Can't find script '" + name + "'");
+ return;
+ }
+ if(item == m_item.ItemID)
+ llResetScript();
+ else
+ {
+ m_host.AddScriptLPS(1);
+ m_ScriptEngine.ResetScript(item);
+ }
}
public LSL_Integer llGetScriptState(string name)
@@ -414,7 +540,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((item = GetScriptByName(name)) != UUID.Zero)
{
- m_ScriptEngine.SetScriptState(item, run == 0 ? false : true);
+ m_ScriptEngine.SetScriptState(item, run == 0 ? false : true, item == m_item.ItemID);
}
else
{
@@ -422,6 +548,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
+ public List GetLinkAvatars(int linkType)
+ {
+ List ret = new List();
+ if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
+ return ret;
+
+ // List avs = m_host.ParentGroup.GetLinkedAvatars();
+ // this needs check
+ List avs = m_host.ParentGroup.GetSittingAvatars();
+ switch (linkType)
+ {
+ case ScriptBaseClass.LINK_SET:
+ return avs;
+
+ case ScriptBaseClass.LINK_ROOT:
+ return ret;
+
+ case ScriptBaseClass.LINK_ALL_OTHERS:
+ return avs;
+
+ case ScriptBaseClass.LINK_ALL_CHILDREN:
+ return avs;
+
+ case ScriptBaseClass.LINK_THIS:
+ return ret;
+
+ default:
+ if (linkType < 0)
+ return ret;
+
+ int partCount = m_host.ParentGroup.GetPartCount();
+
+ if (linkType <= partCount)
+ {
+ return ret;
+ }
+ else
+ {
+ linkType = linkType - partCount;
+ if (linkType > avs.Count)
+ {
+ return ret;
+ }
+ else
+ {
+ ret.Add(avs[linkType-1]);
+ return ret;
+ }
+ }
+ }
+ }
+
///
/// Get a given link entity from a linkset (linked objects and any sitting avatars).
///
@@ -501,7 +679,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public static List GetLinkParts(SceneObjectPart part, int linkType)
{
List ret = new List();
- ret.Add(part);
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return ret;
switch (linkType)
{
@@ -509,7 +688,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new List(part.ParentGroup.Parts);
case ScriptBaseClass.LINK_ROOT:
- ret = new List();
ret.Add(part.ParentGroup.RootPart);
return ret;
@@ -529,16 +707,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return ret;
case ScriptBaseClass.LINK_THIS:
+ ret.Add(part);
return ret;
default:
if (linkType < 0)
- return new List();
+ return ret;
SceneObjectPart target = part.ParentGroup.GetLinkNumPart(linkType);
if (target == null)
- return new List();
- ret = new List();
+ return ret;
ret.Add(target);
return ret;
}
@@ -648,8 +826,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llFrand(double mag)
{
m_host.AddScriptLPS(1);
-
- return Util.RandomClass.NextDouble() * mag;
+ lock (Util.RandomClass)
+ {
+ return Util.RandomClass.NextDouble() * mag;
+ }
}
public LSL_Integer llFloor(double f)
@@ -700,31 +880,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//Now we start getting into quaternions which means sin/cos, matrices and vectors. ckrinke
- ///
- /// Convert an LSL rotation to a Euler vector.
- ///
- ///
- /// Using algorithm based off http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/quat_2_euler_paper_ver2-1.pdf
- /// to avoid issues with singularity and rounding with Y rotation of +/- PI/2
- ///
- ///
- ///
- public LSL_Vector llRot2Euler(LSL_Rotation r)
+ // Utility function for llRot2Euler
+
+ public LSL_Vector llRot2Euler(LSL_Rotation q1)
{
m_host.AddScriptLPS(1);
+ LSL_Vector eul = new LSL_Vector();
- LSL_Vector v = new LSL_Vector(0.0, 0.0, 1.0) * r; // Z axis unit vector unaffected by Z rotation component of r.
- double m = LSL_Vector.Mag(v); // Just in case v isn't normalized, need magnitude for Asin() operation later.
- if (m == 0.0) return new LSL_Vector();
- double x = Math.Atan2(-v.y, v.z);
- double sin = v.x / m;
- if (sin < -0.999999 || sin > 0.999999) x = 0.0; // Force X rotation to 0 at the singularities.
- double y = Math.Asin(sin);
- // Rotate X axis unit vector by r and unwind the X and Y rotations leaving only the Z rotation
- v = new LSL_Vector(1.0, 0.0, 0.0) * ((r * new LSL_Rotation(Math.Sin(-x / 2.0), 0.0, 0.0, Math.Cos(-x / 2.0))) * new LSL_Rotation(0.0, Math.Sin(-y / 2.0), 0.0, Math.Cos(-y / 2.0)));
- double z = Math.Atan2(v.y, v.x);
-
- return new LSL_Vector(x, y, z);
+ double sqw = q1.s*q1.s;
+ double sqx = q1.x*q1.x;
+ double sqy = q1.z*q1.z;
+ double sqz = q1.y*q1.y;
+ double unit = sqx + sqy + sqz + sqw; // if normalised is one, otherwise is correction factor
+ double test = q1.x*q1.z + q1.y*q1.s;
+ if (test > 0.4999*unit) { // singularity at north pole
+ eul.z = 2 * Math.Atan2(q1.x,q1.s);
+ eul.y = Math.PI/2;
+ eul.x = 0;
+ return eul;
+ }
+ if (test < -0.4999*unit) { // singularity at south pole
+ eul.z = -2 * Math.Atan2(q1.x,q1.s);
+ eul.y = -Math.PI/2;
+ eul.x = 0;
+ return eul;
+ }
+ eul.z = Math.Atan2(2*q1.z*q1.s-2*q1.x*q1.y , sqx - sqy - sqz + sqw);
+ eul.y = Math.Asin(2*test/unit);
+ eul.x = Math.Atan2(2*q1.x*q1.s-2*q1.z*q1.y , -sqx + sqy - sqz + sqw);
+ return eul;
}
/* From wiki:
@@ -777,18 +961,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
double x,y,z,s;
-
- double c1 = Math.Cos(v.x * 0.5);
- double c2 = Math.Cos(v.y * 0.5);
- double c3 = Math.Cos(v.z * 0.5);
- double s1 = Math.Sin(v.x * 0.5);
- double s2 = Math.Sin(v.y * 0.5);
- double s3 = Math.Sin(v.z * 0.5);
-
- x = s1 * c2 * c3 + c1 * s2 * s3;
- y = c1 * s2 * c3 - s1 * c2 * s3;
- z = s1 * s2 * c3 + c1 * c2 * s3;
- s = c1 * c2 * c3 - s1 * s2 * s3;
+ v.x *= 0.5;
+ v.y *= 0.5;
+ v.z *= 0.5;
+ double c1 = Math.Cos(v.x);
+ double c2 = Math.Cos(v.y);
+ double c1c2 = c1 * c2;
+ double s1 = Math.Sin(v.x);
+ double s2 = Math.Sin(v.y);
+ double s1s2 = s1 * s2;
+ double c1s2 = c1 * s2;
+ double s1c2 = s1 * c2;
+ double c3 = Math.Cos(v.z);
+ double s3 = Math.Sin(v.z);
+
+ x = s1c2 * c3 + c1s2 * s3;
+ y = c1s2 * c3 - s1c2 * s3;
+ z = s1s2 * c3 + c1c2 * s3;
+ s = c1c2 * c3 - s1s2 * s3;
return new LSL_Rotation(x, y, z, s);
}
@@ -926,75 +1116,74 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
//A and B should both be normalized
m_host.AddScriptLPS(1);
- LSL_Rotation rotBetween;
- // Check for zero vectors. If either is zero, return zero rotation. Otherwise,
- // continue calculation.
- if (a == new LSL_Vector(0.0f, 0.0f, 0.0f) || b == new LSL_Vector(0.0f, 0.0f, 0.0f))
+ /* This method is more accurate than the SL one, and thus causes problems
+ for scripts that deal with the SL inaccuracy around 180-degrees -.- .._.
+
+ double dotProduct = LSL_Vector.Dot(a, b);
+ LSL_Vector crossProduct = LSL_Vector.Cross(a, b);
+ double magProduct = LSL_Vector.Mag(a) * LSL_Vector.Mag(b);
+ double angle = Math.Acos(dotProduct / magProduct);
+ LSL_Vector axis = LSL_Vector.Norm(crossProduct);
+ double s = Math.Sin(angle / 2);
+
+ double x = axis.x * s;
+ double y = axis.y * s;
+ double z = axis.z * s;
+ double w = Math.Cos(angle / 2);
+
+ if (Double.IsNaN(x) || Double.IsNaN(y) || Double.IsNaN(z) || Double.IsNaN(w))
+ return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
+
+ return new LSL_Rotation((float)x, (float)y, (float)z, (float)w);
+ */
+
+ // This method mimics the 180 errors found in SL
+ // See www.euclideanspace.com... angleBetween
+ LSL_Vector vec_a = a;
+ LSL_Vector vec_b = b;
+
+ // Eliminate zero length
+ LSL_Float vec_a_mag = LSL_Vector.Mag(vec_a);
+ LSL_Float vec_b_mag = LSL_Vector.Mag(vec_b);
+ if (vec_a_mag < 0.00001 ||
+ vec_b_mag < 0.00001)
{
- rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
+ return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
}
- else
+
+ // Normalize
+ vec_a = llVecNorm(vec_a);
+ vec_b = llVecNorm(vec_b);
+
+ // Calculate axis and rotation angle
+ LSL_Vector axis = vec_a % vec_b;
+ LSL_Float cos_theta = vec_a * vec_b;
+
+ // Check if parallel
+ if (cos_theta > 0.99999)
{
- a = LSL_Vector.Norm(a);
- b = LSL_Vector.Norm(b);
- double dotProduct = LSL_Vector.Dot(a, b);
- // There are two degenerate cases possible. These are for vectors 180 or
- // 0 degrees apart. These have to be detected and handled individually.
- //
- // Check for vectors 180 degrees apart.
- // A dot product of -1 would mean the angle between vectors is 180 degrees.
- if (dotProduct < -0.9999999f)
- {
- // First assume X axis is orthogonal to the vectors.
- LSL_Vector orthoVector = new LSL_Vector(1.0f, 0.0f, 0.0f);
- orthoVector = orthoVector - a * (a.x / LSL_Vector.Dot(a, a));
- // Check for near zero vector. A very small non-zero number here will create
- // a rotation in an undesired direction.
- if (LSL_Vector.Mag(orthoVector) > 0.0001)
- {
- rotBetween = new LSL_Rotation(orthoVector.x, orthoVector.y, orthoVector.z, 0.0f);
- }
- // If the magnitude of the vector was near zero, then assume the X axis is not
- // orthogonal and use the Z axis instead.
- else
- {
- // Set 180 z rotation.
- rotBetween = new LSL_Rotation(0.0f, 0.0f, 1.0f, 0.0f);
- }
- }
- // Check for parallel vectors.
- // A dot product of 1 would mean the angle between vectors is 0 degrees.
- else if (dotProduct > 0.9999999f)
- {
- // Set zero rotation.
- rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
- }
- else
- {
- // All special checks have been performed so get the axis of rotation.
- LSL_Vector crossProduct = LSL_Vector.Cross(a, b);
- // Quarternion s value is the length of the unit vector + dot product.
- double qs = 1.0 + dotProduct;
- rotBetween = new LSL_Rotation(crossProduct.x, crossProduct.y, crossProduct.z, qs);
- // Normalize the rotation.
- double mag = LSL_Rotation.Mag(rotBetween);
- // We shouldn't have to worry about a divide by zero here. The qs value will be
- // non-zero because we already know if we're here, then the dotProduct is not -1 so
- // qs will not be zero. Also, we've already handled the input vectors being zero so the
- // crossProduct vector should also not be zero.
- rotBetween.x = rotBetween.x / mag;
- rotBetween.y = rotBetween.y / mag;
- rotBetween.z = rotBetween.z / mag;
- rotBetween.s = rotBetween.s / mag;
- // Check for undefined values and set zero rotation if any found. This code might not actually be required
- // any longer since zero vectors are checked for at the top.
- if (Double.IsNaN(rotBetween.x) || Double.IsNaN(rotBetween.y) || Double.IsNaN(rotBetween.z) || Double.IsNaN(rotBetween.s))
- {
- rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
- }
- }
+ return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
+ }
+
+ // Check if anti-parallel
+ else if (cos_theta < -0.99999)
+ {
+ LSL_Vector orthog_axis = new LSL_Vector(1.0, 0.0, 0.0) - (vec_a.x / (vec_a * vec_a) * vec_a);
+ if (LSL_Vector.Mag(orthog_axis) < 0.000001) orthog_axis = new LSL_Vector(0.0, 0.0, 1.0);
+ return new LSL_Rotation((float)orthog_axis.x, (float)orthog_axis.y, (float)orthog_axis.z, 0.0);
+ }
+ else // other rotation
+ {
+ LSL_Float theta = (LSL_Float)Math.Acos(cos_theta) * 0.5f;
+ axis = llVecNorm(axis);
+ double x, y, z, s, t;
+ s = Math.Cos(theta);
+ t = Math.Sin(theta);
+ x = axis.x * t;
+ y = axis.y * t;
+ z = axis.z * t;
+ return new LSL_Rotation(x,y,z,s);
}
- return rotBetween;
}
public void llWhisper(int channelID, string text)
@@ -1012,10 +1201,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
wComm.DeliverMessage(ChatTypeEnum.Whisper, channelID, m_host.Name, m_host.UUID, text);
}
+ private void CheckSayShoutTime()
+ {
+ DateTime now = DateTime.UtcNow;
+ if ((now - m_lastSayShoutCheck).Ticks > 10000000) // 1sec
+ {
+ m_lastSayShoutCheck = now;
+ m_SayShoutCount = 0;
+ }
+ else
+ m_SayShoutCount++;
+ }
+
public void llSay(int channelID, string text)
{
m_host.AddScriptLPS(1);
+ if (channelID == 0)
+// m_SayShoutCount++;
+ CheckSayShoutTime();
+
+ if (m_SayShoutCount >= 11)
+ ScriptSleep(2000);
+
if (m_scriptConsoleChannelEnabled && (channelID == m_scriptConsoleChannel))
{
Console.WriteLine(text);
@@ -1038,6 +1246,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
+ if (channelID == 0)
+// m_SayShoutCount++;
+ CheckSayShoutTime();
+
+ if (m_SayShoutCount >= 11)
+ ScriptSleep(2000);
+
if (text.Length > 1023)
text = text.Substring(0, 1023);
@@ -1062,8 +1277,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
- World.SimChat(Utils.StringToBytes(text),
- ChatTypeEnum.Region, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false);
+ // debug channel is also sent to avatars
+ if (channelID == ScriptBaseClass.DEBUG_CHANNEL)
+ {
+ World.SimChat(Utils.StringToBytes(text),
+ ChatTypeEnum.Shout, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true);
+
+ }
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface();
if (wComm != null)
@@ -1078,16 +1298,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
if (channel == ScriptBaseClass.DEBUG_CHANNEL)
- {
return;
- }
UUID TargetID;
UUID.TryParse(target, out TargetID);
- World.SimChatToAgent(TargetID, Utils.StringToBytes(msg),
- channel, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true);
-
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface();
if (wComm != null)
wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg);
@@ -1346,10 +1561,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return detectedParams.TouchUV;
}
+ [DebuggerNonUserCode]
public virtual void llDie()
{
m_host.AddScriptLPS(1);
- throw new SelfDeleteException();
+ if (!m_host.ParentGroup.IsAttachment) throw new SelfDeleteException();
}
public LSL_Float llGround(LSL_Vector offset)
@@ -1420,6 +1636,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetStatus(int status, int value)
{
+ if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
+ return;
m_host.AddScriptLPS(1);
int statusrotationaxis = 0;
@@ -1431,18 +1649,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SceneObjectGroup group = m_host.ParentGroup;
bool allow = true;
+ int maxprims = World.m_linksetPhysCapacity;
+ bool checkShape = (maxprims > 0 && group.PrimCount > maxprims);
+
foreach (SceneObjectPart part in group.Parts)
{
+ if (part.PhysicsShapeType == (byte)PhysicsShapeType.None)
+ continue;
+
if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys)
{
allow = false;
break;
}
+ if (checkShape)
+ {
+ if (--maxprims < 0)
+ {
+ allow = false;
+ break;
+ }
+ }
}
if (!allow)
return;
+ if (m_host.ParentGroup.RootPart.PhysActor != null &&
+ m_host.ParentGroup.RootPart.PhysActor.IsPhysical)
+ return;
+
m_host.ScriptSetPhysicsStatus(true);
}
else
@@ -1586,6 +1822,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return 0;
}
+ public LSL_Integer llScaleByFactor(double scaling_factor)
+ {
+ m_host.AddScriptLPS(1);
+ SceneObjectGroup group = m_host.ParentGroup;
+
+ if(scaling_factor < 1e-6)
+ return ScriptBaseClass.FALSE;
+ if(scaling_factor > 1e6)
+ return ScriptBaseClass.FALSE;
+
+ if (group == null || group.IsDeleted || group.inTransit)
+ return ScriptBaseClass.FALSE;
+
+ if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical)
+ return ScriptBaseClass.FALSE;
+
+ if (group.RootPart.KeyframeMotion != null)
+ return ScriptBaseClass.FALSE;
+
+ if(group.GroupResize(scaling_factor))
+ return ScriptBaseClass.TRUE;
+ else
+ return ScriptBaseClass.FALSE;
+ }
+
+ public LSL_Float llGetMaxScaleFactor()
+ {
+ m_host.AddScriptLPS(1);
+ SceneObjectGroup group = m_host.ParentGroup;
+
+ if (group == null || group.IsDeleted || group.inTransit)
+ return 1.0f;
+
+ return (LSL_Float)group.GetMaxGroupResizeScale();
+ }
+
+ public LSL_Float llGetMinScaleFactor()
+ {
+ m_host.AddScriptLPS(1);
+ SceneObjectGroup group = m_host.ParentGroup;
+
+ if (group == null || group.IsDeleted || group.inTransit)
+ return 1.0f;
+
+ return (LSL_Float)group.GetMinGroupResizeScale();
+ }
+
public void llSetScale(LSL_Vector scale)
{
m_host.AddScriptLPS(1);
@@ -1641,6 +1924,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
+ SetColor(m_host, color, face);
+ }
+
+ protected void SetColor(SceneObjectPart part, LSL_Vector color, int face)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
+ Primitive.TextureEntry tex = part.Shape.Textures;
+ int nsides = GetNumberOfSides(part);
+ Color4 texcolor;
+
+ if (face >= 0 && face < nsides)
+ {
+ texcolor = tex.CreateFace((uint)face).RGBA;
+ texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
+ texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
+ texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
+ tex.FaceTextures[face].RGBA = texcolor;
+ part.UpdateTextureEntry(tex.GetBytes());
+ return;
+ }
+ else if (face == ScriptBaseClass.ALL_SIDES)
+ {
+ for (uint i = 0; i < nsides; i++)
+ {
+ if (tex.FaceTextures[i] != null)
+ {
+ texcolor = tex.FaceTextures[i].RGBA;
+ texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
+ texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
+ texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
+ tex.FaceTextures[i].RGBA = texcolor;
+ }
+ texcolor = tex.DefaultTexture.RGBA;
+ texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f);
+ texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f);
+ texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f);
+ tex.DefaultTexture.RGBA = texcolor;
+ }
+ part.UpdateTextureEntry(tex.GetBytes());
+ return;
+ }
+
if (face == ScriptBaseClass.ALL_SIDES)
face = SceneObjectPart.ALL_SIDES;
@@ -1714,15 +2041,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
+/*
+ public void llSetContentType(LSL_Key id, LSL_Integer content_type)
+ {
+ if (m_UrlModule != null)
+ {
+ string type = "text.plain";
+ if (content_type == (int)ScriptBaseClass.CONTENT_TYPE_HTML)
+ type = "text/html";
+
+ m_UrlModule.HttpContentType(new UUID(id),type);
+ }
+ }
+*/
public void SetTexGen(SceneObjectPart part, int face,int style)
{
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
Primitive.TextureEntry tex = part.Shape.Textures;
MappingType textype;
textype = MappingType.Default;
if (style == (int)ScriptBaseClass.PRIM_TEXGEN_PLANAR)
textype = MappingType.Planar;
- if (face >= 0 && face < GetNumberOfSides(part))
+ int nsides = GetNumberOfSides(part);
+
+ if (face >= 0 && face < nsides)
{
tex.CreateFace((uint) face);
tex.FaceTextures[face].TexMapType = textype;
@@ -1731,7 +2076,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
- for (uint i = 0; i < GetNumberOfSides(part); i++)
+ for (uint i = 0; i < nsides; i++)
{
if (tex.FaceTextures[i] != null)
{
@@ -1746,8 +2091,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void SetGlow(SceneObjectPart part, int face, float glow)
{
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
Primitive.TextureEntry tex = part.Shape.Textures;
- if (face >= 0 && face < GetNumberOfSides(part))
+ int nsides = GetNumberOfSides(part);
+
+ if (face >= 0 && face < nsides)
{
tex.CreateFace((uint) face);
tex.FaceTextures[face].Glow = glow;
@@ -1756,7 +2106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
- for (uint i = 0; i < GetNumberOfSides(part); i++)
+ for (uint i = 0; i < nsides; i++)
{
if (tex.FaceTextures[i] != null)
{
@@ -1771,6 +2121,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump)
{
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
Shininess sval = new Shininess();
@@ -1793,8 +2145,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
}
+ int nsides = GetNumberOfSides(part);
+
Primitive.TextureEntry tex = part.Shape.Textures;
- if (face >= 0 && face < GetNumberOfSides(part))
+ if (face >= 0 && face < nsides)
{
tex.CreateFace((uint) face);
tex.FaceTextures[face].Shiny = sval;
@@ -1804,7 +2158,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
- for (uint i = 0; i < GetNumberOfSides(part); i++)
+ for (uint i = 0; i < nsides; i++)
{
if (tex.FaceTextures[i] != null)
{
@@ -1821,8 +2175,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void SetFullBright(SceneObjectPart part, int face, bool bright)
{
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
+ int nsides = GetNumberOfSides(part);
Primitive.TextureEntry tex = part.Shape.Textures;
- if (face >= 0 && face < GetNumberOfSides(part))
+ if (face >= 0 && face < nsides)
{
tex.CreateFace((uint) face);
tex.FaceTextures[face].Fullbright = bright;
@@ -1831,7 +2189,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
- for (uint i = 0; i < GetNumberOfSides(part); i++)
+ for (uint i = 0; i < nsides; i++)
{
if (tex.FaceTextures[i] != null)
{
@@ -1854,15 +2212,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected LSL_Float GetAlpha(SceneObjectPart part, int face)
{
Primitive.TextureEntry tex = part.Shape.Textures;
+ int nsides = GetNumberOfSides(part);
if (face == ScriptBaseClass.ALL_SIDES)
{
int i;
double sum = 0.0;
- for (i = 0 ; i < GetNumberOfSides(part); i++)
+ for (i = 0 ; i < nsides; i++)
sum += (double)tex.GetFace((uint)i).RGBA.A;
return sum;
}
- if (face >= 0 && face < GetNumberOfSides(part))
+ if (face >= 0 && face < nsides)
{
return (double)tex.GetFace((uint)face).RGBA.A;
}
@@ -1881,16 +2240,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
List parts = GetLinkParts(linknumber);
-
- foreach (SceneObjectPart part in parts)
- SetAlpha(part, alpha, face);
+ if (parts.Count > 0)
+ {
+ try
+ {
+ foreach (SceneObjectPart part in parts)
+ SetAlpha(part, alpha, face);
+ }
+ finally { }
+ }
}
protected void SetAlpha(SceneObjectPart part, double alpha, int face)
{
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
Primitive.TextureEntry tex = part.Shape.Textures;
+ int nsides = GetNumberOfSides(part);
Color4 texcolor;
- if (face >= 0 && face < GetNumberOfSides(part))
+
+ if (face >= 0 && face < nsides)
{
texcolor = tex.CreateFace((uint)face).RGBA;
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
@@ -1900,7 +2270,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
- for (int i = 0; i < GetNumberOfSides(part); i++)
+ for (int i = 0; i < nsides; i++)
{
if (tex.FaceTextures[i] != null)
{
@@ -1940,7 +2310,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected void SetFlexi(SceneObjectPart part, bool flexi, int softness, float gravity, float friction,
float wind, float tension, LSL_Vector Force)
{
- if (part == null)
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
if (flexi)
@@ -1981,7 +2351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
protected void SetPointLight(SceneObjectPart part, bool light, LSL_Vector color, float intensity, float radius, float falloff)
{
- if (part == null)
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
if (light)
@@ -2014,11 +2384,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Primitive.TextureEntry tex = part.Shape.Textures;
Color4 texcolor;
LSL_Vector rgb = new LSL_Vector();
+ int nsides = GetNumberOfSides(part);
+
if (face == ScriptBaseClass.ALL_SIDES)
{
int i;
-
- for (i = 0 ; i < GetNumberOfSides(part); i++)
+ for (i = 0; i < nsides; i++)
{
texcolor = tex.GetFace((uint)i).RGBA;
rgb.x += texcolor.R;
@@ -2026,14 +2397,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
rgb.z += texcolor.B;
}
- rgb.x /= (float)GetNumberOfSides(part);
- rgb.y /= (float)GetNumberOfSides(part);
- rgb.z /= (float)GetNumberOfSides(part);
+ float invnsides = 1.0f / (float)nsides;
+
+ rgb.x *= invnsides;
+ rgb.y *= invnsides;
+ rgb.z *= invnsides;
return rgb;
}
-
- if (face >= 0 && face < GetNumberOfSides(part))
+ if (face >= 0 && face < nsides)
{
texcolor = tex.GetFace((uint)face).RGBA;
rgb.x = texcolor.R;
@@ -2052,6 +2424,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
SetTexture(m_host, texture, face);
+ ScriptSleep(m_sleepMsOnSetTexture);
}
public void llSetLinkTexture(int linknumber, string texture, int face)
@@ -2059,13 +2432,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
List parts = GetLinkParts(linknumber);
-
- foreach (SceneObjectPart part in parts)
- SetTexture(part, texture, face);
+ if (parts.Count > 0)
+ {
+ try
+ {
+ foreach (SceneObjectPart part in parts)
+ SetTexture(part, texture, face);
+ }
+ finally { }
+ }
+ ScriptSleep(m_sleepMsOnSetLinkTexture);
}
protected void SetTexture(SceneObjectPart part, string texture, int face)
{
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
UUID textureID = new UUID();
textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture);
@@ -2075,9 +2458,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
+
Primitive.TextureEntry tex = part.Shape.Textures;
+ int nsides = GetNumberOfSides(part);
- if (face >= 0 && face < GetNumberOfSides(part))
+ if (face >= 0 && face < nsides)
{
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
texface.TextureID = textureID;
@@ -2087,7 +2472,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else if (face == ScriptBaseClass.ALL_SIDES)
{
- for (uint i = 0; i < GetNumberOfSides(part); i++)
+ for (uint i = 0; i < nsides; i++)
{
if (tex.FaceTextures[i] != null)
{
@@ -2105,12 +2490,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
ScaleTexture(m_host, u, v, face);
+ ScriptSleep(m_sleepMsOnScaleTexture);
}
protected void ScaleTexture(SceneObjectPart part, double u, double v, int face)
{
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
Primitive.TextureEntry tex = part.Shape.Textures;
- if (face >= 0 && face < GetNumberOfSides(part))
+ int nsides = GetNumberOfSides(part);
+
+ if (face >= 0 && face < nsides)
{
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
texface.RepeatU = (float)u;
@@ -2121,7 +2512,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
if (face == ScriptBaseClass.ALL_SIDES)
{
- for (int i = 0; i < GetNumberOfSides(part); i++)
+ for (int i = 0; i < nsides; i++)
{
if (tex.FaceTextures[i] != null)
{
@@ -2140,12 +2531,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
OffsetTexture(m_host, u, v, face);
+ ScriptSleep(m_sleepMsOnOffsetTexture);
}
protected void OffsetTexture(SceneObjectPart part, double u, double v, int face)
{
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
Primitive.TextureEntry tex = part.Shape.Textures;
- if (face >= 0 && face < GetNumberOfSides(part))
+ int nsides = GetNumberOfSides(part);
+
+ if (face >= 0 && face < nsides)
{
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
texface.OffsetU = (float)u;
@@ -2156,7 +2553,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
if (face == ScriptBaseClass.ALL_SIDES)
{
- for (int i = 0; i < GetNumberOfSides(part); i++)
+ for (int i = 0; i < nsides; i++)
{
if (tex.FaceTextures[i] != null)
{
@@ -2175,12 +2572,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
RotateTexture(m_host, rotation, face);
+ ScriptSleep(m_sleepMsOnRotateTexture);
}
protected void RotateTexture(SceneObjectPart part, double rotation, int face)
{
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
Primitive.TextureEntry tex = part.Shape.Textures;
- if (face >= 0 && face < GetNumberOfSides(part))
+ int nsides = GetNumberOfSides(part);
+
+ if (face >= 0 && face < nsides)
{
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
texface.Rotation = (float)rotation;
@@ -2190,7 +2593,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
if (face == ScriptBaseClass.ALL_SIDES)
{
- for (int i = 0; i < GetNumberOfSides(part); i++)
+ for (int i = 0; i < nsides; i++)
{
if (tex.FaceTextures[i] != null)
{
@@ -2212,12 +2615,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected LSL_String GetTexture(SceneObjectPart part, int face)
{
Primitive.TextureEntry tex = part.Shape.Textures;
+ int nsides = GetNumberOfSides(part);
+
if (face == ScriptBaseClass.ALL_SIDES)
{
face = 0;
}
- if (face >= 0 && face < GetNumberOfSides(part))
+ if (face >= 0 && face < nsides)
{
Primitive.TextureEntryFace texface;
texface = tex.GetFace((uint)face);
@@ -2248,6 +2653,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
SetPos(m_host, pos, true);
+
+ ScriptSleep(m_sleepMsOnSetPos);
}
///
@@ -2278,7 +2685,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region.
pos.x > (World.RegionInfo.RegionSizeX + 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 > (World.RegionInfo.RegionSizeY + 10) // return FALSE if more than 10 meters into a north-adjacent region.
+ pos.y > (World.RegionInfo.RegionSizeY + 10) || // return FALSE if more than 10 meters into a north-adjacent region.
+ pos.z > Constants.RegionHeight // return FALSE if altitude than 4096m
)
)
{
@@ -2317,7 +2725,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return end;
}
- protected LSL_Vector GetSetPosTarget(SceneObjectPart part, LSL_Vector targetPos, LSL_Vector fromPos)
+ protected LSL_Vector GetSetPosTarget(SceneObjectPart part, LSL_Vector targetPos, LSL_Vector fromPos, bool adjust)
{
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return fromPos;
@@ -2333,9 +2741,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0)
targetPos.z = ground;
}
- LSL_Vector real_vec = SetPosAdjust(fromPos, targetPos);
+ if (adjust)
+ return SetPosAdjust(fromPos, targetPos);
- return real_vec;
+ return targetPos;
}
///
@@ -2346,27 +2755,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// 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)
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted || part.ParentGroup.inTransit)
+ return;
+
+
LSL_Vector currentPos = GetPartLocalPos(part);
+ LSL_Vector toPos = GetSetPosTarget(part, targetPos, currentPos, adjust);
- float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y);
- bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true);
if (part.ParentGroup.RootPart == part)
{
- if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0)
- targetPos.z = ground;
SceneObjectGroup parent = part.ParentGroup;
- parent.UpdateGroupPosition(!adjust ? targetPos :
- SetPosAdjust(currentPos, targetPos));
+ if (!parent.IsAttachment && !World.Permissions.CanObjectEntry(parent, false, (Vector3)toPos))
+ return;
+ parent.UpdateGroupPosition((Vector3)toPos);
}
else
{
- part.OffsetPosition = !adjust ? targetPos :
- SetPosAdjust(currentPos, targetPos);
- SceneObjectGroup parent = part.ParentGroup;
- parent.HasGroupChanged = true;
- parent.ScheduleGroupForTerseUpdate();
+ part.OffsetPosition = (Vector3)toPos;
+// SceneObjectGroup parent = part.ParentGroup;
+// parent.HasGroupChanged = true;
+// parent.ScheduleGroupForTerseUpdate();
+ part.ScheduleTerseUpdate();
}
}
@@ -2395,13 +2805,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else
{
if (part.ParentGroup.IsAttachment)
- {
pos = part.AttachedPos;
- }
else
- {
pos = part.AbsolutePosition;
- }
}
// m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos);
@@ -2414,7 +2820,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
// try to let this work as in SL...
- if (m_host.ParentID == 0)
+ if (m_host.ParentID == 0 || (m_host.ParentGroup != null && m_host == m_host.ParentGroup.RootPart))
{
// special case: If we are root, rotate complete SOG to new rotation
SetRot(m_host, rot);
@@ -2428,35 +2834,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetRot(m_host, rootPart.RotationOffset * (Quaternion)rot);
}
}
+
+ ScriptSleep(m_sleepMsOnSetRot);
}
public void llSetLocalRot(LSL_Rotation rot)
{
m_host.AddScriptLPS(1);
SetRot(m_host, rot);
+ ScriptSleep(m_sleepMsOnSetLocalRot);
}
protected void SetRot(SceneObjectPart part, Quaternion rot)
{
- part.UpdateRotation(rot);
- // Update rotation does not move the object in the physics scene if it's a linkset.
-
-//KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type
-// part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition;
-
- // So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line
- // is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt
- // It's perfectly okay when the object is not an active physical body though.
- // So, part.ParentGroup.ResetChildPrimPhysicsPositions(); does the thing that Kitto is warning against
- // but only if the object is not physial and active. This is important for rotating doors.
- // without the absoluteposition = absoluteposition happening, the doors do not move in the physics
- // scene
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
+ bool isroot = (part == part.ParentGroup.RootPart);
+ bool isphys;
+
PhysicsActor pa = part.PhysActor;
- if (pa != null && !pa.IsPhysical)
+ // keep using physactor ideia of isphysical
+ // it should be SOP ideia of that
+ // not much of a issue with ubOde
+ if (pa != null && pa.IsPhysical)
+ isphys = true;
+ else
+ isphys = false;
+
+ // SL doesn't let scripts rotate root of physical linksets
+ if (isroot && isphys)
+ return;
+
+ part.UpdateRotation(rot);
+
+ // Update rotation does not move the object in the physics engine if it's a non physical linkset
+ // so do a nasty update of parts positions if is a root part rotation
+ if (isroot && pa != null) // with if above implies non physical root part
{
part.ParentGroup.ResetChildPrimPhysicsPositions();
}
+ else // fix sitting avatars. This is only needed bc of how we link avas to child parts, not root part
+ {
+ // List sittingavas = part.ParentGroup.GetLinkedAvatars();
+ List sittingavas = part.ParentGroup.GetSittingAvatars();
+ if (sittingavas.Count > 0)
+ {
+ foreach (ScenePresence av in sittingavas)
+ {
+ if (isroot || part.LocalId == av.ParentID)
+ av.SendTerseUpdateToAllClients();
+ }
+ }
+ }
}
///
@@ -2473,6 +2904,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
Quaternion q = m_host.GetWorldRotation();
+
+ if (m_host.ParentGroup != null && m_host.ParentGroup.AttachmentPoint != 0)
+ {
+ ScenePresence avatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
+ if (avatar != null)
+ {
+ if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
+ q = avatar.CameraRotation * q; // Mouselook
+ else
+ q = avatar.Rotation * q; // Currently infrequently updated so may be inaccurate
+ }
+ }
+
return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
}
@@ -2500,14 +2944,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_Rotation(q);
}
- return new LSL_Rotation(part.GetWorldRotation());
+ q = part.GetWorldRotation();
+ if (part.ParentGroup.AttachmentPoint != 0)
+ {
+ ScenePresence avatar = World.GetScenePresence(part.ParentGroup.AttachedAvatar);
+ if (avatar != null)
+ {
+ if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
+ q = avatar.CameraRotation * q; // Mouselook
+ else
+ q = avatar.Rotation * q; // Currently infrequently updated so may be inaccurate
+ }
+ }
+
+ return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
}
public LSL_Rotation llGetLocalRot()
{
- m_host.AddScriptLPS(1);
+ return GetPartLocalRot(m_host);
+ }
- return new LSL_Rotation(m_host.RotationOffset);
+ private LSL_Rotation GetPartLocalRot(SceneObjectPart part)
+ {
+ m_host.AddScriptLPS(1);
+ Quaternion rot = part.RotationOffset;
+ return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
}
public void llSetForce(LSL_Vector force, int local)
@@ -2537,32 +2999,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return force;
}
- public void llSetVelocity(LSL_Vector velocity, int local)
+ public void llSetVelocity(LSL_Vector vel, int local)
{
m_host.AddScriptLPS(1);
-
- if (!m_host.ParentGroup.IsDeleted)
- {
- if (local != 0)
- velocity *= llGetRot();
-
- m_host.ParentGroup.RootPart.Velocity = velocity;
- }
+ m_host.SetVelocity(new Vector3((float)vel.x, (float)vel.y, (float)vel.z), local != 0);
}
- public void llSetAngularVelocity(LSL_Vector angularVelocity, int local)
+ public void llSetAngularVelocity(LSL_Vector avel, int local)
{
m_host.AddScriptLPS(1);
-
- if (!m_host.ParentGroup.IsDeleted)
- {
- if (local != 0)
- angularVelocity *= llGetRot();
-
- m_host.ParentGroup.RootPart.AngularVelocity = angularVelocity;
- }
+ m_host.SetAngularVelocity(new Vector3((float)avel.x, (float)avel.y, (float)avel.z), local != 0);
}
-
public LSL_Integer llTarget(LSL_Vector position, double range)
{
m_host.AddScriptLPS(1);
@@ -2613,16 +3060,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.ApplyImpulse(v, local != 0);
}
+
public void llApplyRotationalImpulse(LSL_Vector force, int local)
{
m_host.AddScriptLPS(1);
- m_host.ApplyAngularImpulse(force, local != 0);
+ m_host.ParentGroup.RootPart.ApplyAngularImpulse(force, local != 0);
}
public void llSetTorque(LSL_Vector torque, int local)
{
m_host.AddScriptLPS(1);
- m_host.SetAngularImpulse(torque, local != 0);
+ m_host.ParentGroup.RootPart.SetAngularImpulse(torque, local != 0);
}
public LSL_Vector llGetTorque()
@@ -2639,20 +3087,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
llSetTorque(torque, local);
}
+
public LSL_Vector llGetVel()
{
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.GetWorldVelocity();
+ if (avatar != null)
+ vel = avatar.GetWorldVelocity();
}
else
{
- vel = m_host.Velocity;
+ vel = m_host.ParentGroup.RootPart.Velocity;
}
return new LSL_Vector(vel);
@@ -2668,8 +3118,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetOmega()
{
m_host.AddScriptLPS(1);
-
- return new LSL_Vector(m_host.AngularVelocity);
+ Vector3 avel = m_host.AngularVelocity;
+ return new LSL_Vector(avel.X, avel.Y, avel.Z);
}
public LSL_Float llGetTimeOfDay()
@@ -2687,22 +3137,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llGetTime()
{
m_host.AddScriptLPS(1);
- TimeSpan ScriptTime = DateTime.Now - m_timer;
- return (double)(ScriptTime.TotalMilliseconds / 1000);
+ double ScriptTime = Util.GetTimeStampMS() - m_timer;
+ return (float)Math.Round((ScriptTime / 1000.0), 3);
}
public void llResetTime()
{
m_host.AddScriptLPS(1);
- m_timer = DateTime.Now;
+ m_timer = Util.GetTimeStampMS();
}
public LSL_Float llGetAndResetTime()
{
m_host.AddScriptLPS(1);
- TimeSpan ScriptTime = DateTime.Now - m_timer;
- m_timer = DateTime.Now;
- return (double)(ScriptTime.TotalMilliseconds / 1000);
+ double now = Util.GetTimeStampMS();
+ double ScriptTime = now - m_timer;
+ m_timer = now;
+ return (float)Math.Round((ScriptTime / 1000.0), 3);
}
public void llSound(string sound, double volume, int queue, int loop)
@@ -2722,8 +3173,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_SoundModule.SendSound(
m_host.UUID,
- ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound),
- volume, false, m_host.SoundQueueing ? (byte)SoundFlags.Queue : (byte)SoundFlags.None,
+ ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound),
+ volume, false, 0,
0, false, false);
}
}
@@ -2734,7 +3185,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_SoundModule != null)
{
m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
- volume, 20, false);
+ volume, 20, false,false);
}
}
@@ -2744,16 +3195,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_SoundModule != null)
{
m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
- volume, 20, true);
+ volume, 20, true, false);
}
}
public void llLoopSoundSlave(string sound, double volume)
{
m_host.AddScriptLPS(1);
- lock (m_host.ParentGroup.LoopSoundSlavePrims)
+ if (m_SoundModule != null)
{
- m_host.ParentGroup.LoopSoundSlavePrims.Add(m_host);
+ m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
+ volume, 20, false, true);
}
}
@@ -2795,6 +3247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
if (m_SoundModule != null)
m_SoundModule.PreloadSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound), 0);
+ ScriptSleep(m_sleepMsOnPreloadSound);
}
///
@@ -3027,7 +3480,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return src.ToLower();
}
- public void llGiveMoney(string destination, int amount)
+ public LSL_Integer llGiveMoney(string destination, int amount)
{
Util.FireAndForget(x =>
{
@@ -3058,69 +3511,86 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
+ string reason;
money.ObjectGiveMoney(
- m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
+
+ m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero, out reason);
}, null, "LSL_Api.llGiveMoney");
+
+ return 0;
}
public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
{
m_host.AddScriptLPS(1);
Deprecated("llMakeExplosion", "Use llParticleSystem instead");
+ ScriptSleep(m_sleepMsOnMakeExplosion);
}
public void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset)
{
m_host.AddScriptLPS(1);
Deprecated("llMakeFountain", "Use llParticleSystem instead");
+ ScriptSleep(m_sleepMsOnMakeFountain);
}
public void llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
{
m_host.AddScriptLPS(1);
Deprecated("llMakeSmoke", "Use llParticleSystem instead");
+ ScriptSleep(m_sleepMsOnMakeSmoke);
}
public void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
{
m_host.AddScriptLPS(1);
Deprecated("llMakeFire", "Use llParticleSystem instead");
+ ScriptSleep(m_sleepMsOnMakeFire);
}
public void llRezAtRoot(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
{
+ doObjectRez(inventory, pos, vel, rot, param, true);
+ }
+
+ public void doObjectRez(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param, bool atRoot)
+ {
m_host.AddScriptLPS(1);
+ if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
+ return;
- 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);
- float dist = (float)llVecDist(llGetPos(), pos);
+ if (dist > m_ScriptDistanceFactor * 10.0f)
+ return;
- TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory);
+ TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory);
- if (item == null)
- {
- Error("llRezAtRoot", "Can't find object '" + inventory + "'");
- return;
- }
+ if (item == null)
+ {
+ Error("llRez(AtRoot/Object)", "Can't find object '" + inventory + "'");
+ return;
+ }
- if (item.InvType != (int)InventoryType.Object)
- {
- Error("llRezAtRoot", "Can't create requested object; object is missing from database");
- return;
- }
+ if (item.InvType != (int)InventoryType.Object)
+ {
+ Error("llRez(AtRoot/Object)", "Can't create requested object; object is missing from database");
+ return;
+ }
- // need the magnitude later
- // float velmag = (float)Util.GetMagnitude(llvel);
+ Util.FireAndForget(x =>
+ {
- List new_groups = World.RezObject(m_host, item, pos, rot, vel, param);
+ Quaternion wrot = rot;
+ wrot.Normalize();
+ List new_groups = World.RezObject(m_host, item, pos, wrot, vel, param, atRoot);
// If either of these are null, then there was an unknown error.
if (new_groups == null)
return;
+ bool notAttachment = !m_host.ParentGroup.IsAttachment;
+
foreach (SceneObjectGroup group in new_groups)
{
// objects rezzed with this method are die_at_edge by default.
@@ -3134,58 +3604,79 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
group.RootPart.UUID.ToString()) },
new DetectParams[0]));
- float groupmass = group.GetMass();
+ if (notAttachment)
+ {
+ float groupmass = group.GetMass();
- PhysicsActor pa = group.RootPart.PhysActor;
+ PhysicsActor pa = group.RootPart.PhysActor;
- //Recoil.
- if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
- {
- Vector3 recoil = -vel * groupmass * m_recoilScaleFactor;
- if (recoil != Vector3.Zero)
+ //Recoil.
+ if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
{
- llApplyImpulse(recoil, 0);
+ Vector3 recoil = -vel * groupmass * m_recoilScaleFactor;
+ if (recoil != Vector3.Zero)
+ {
+ llApplyImpulse(recoil, 0);
+ }
}
}
- // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
- }
- }, null, "LSL_Api.llRezAtRoot");
+ }
+ }, null, "LSL_Api.doObjectRez");
+
+ //ScriptSleep((int)((groupmass * velmag) / 10));
+ ScriptSleep(m_sleepMsOnRezAtRoot);
}
public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
{
- llRezAtRoot(inventory, pos, vel, rot, param);
+ doObjectRez(inventory, pos, vel, rot, param, false);
}
public void llLookAt(LSL_Vector target, double strength, double damping)
{
m_host.AddScriptLPS(1);
- // Determine where we are looking from
+
+ // Get the normalized vector to the target
LSL_Vector from = llGetPos();
- // normalized direction to target
+ // normalized direction to target
LSL_Vector dir = llVecNorm(target - from);
+
// use vertical to help compute left axis
- LSL_Vector up = new LSL_Vector(0.0, 0.0, 1.0);
+// LSL_Vector up = new LSL_Vector(0.0, 0.0, 1.0);
// find normalized left axis parallel to horizon
- LSL_Vector left = llVecNorm(LSL_Vector.Cross(up, dir));
+// LSL_Vector left = llVecNorm(LSL_Vector.Cross(up, dir));
+
+ LSL_Vector left = new LSL_Vector(-dir.y, dir.x, 0.0f);
+ left = llVecNorm(left);
// make up orthogonal to left and dir
- up = LSL_Vector.Cross(dir, left);
+ LSL_Vector up = LSL_Vector.Cross(dir, left);
// compute rotation based on orthogonal axes
+ // and rotate so Z points to target with X below horizont
LSL_Rotation rot = new LSL_Rotation(0.0, 0.707107, 0.0, 0.707107) * llAxes2Rot(dir, left, up);
- // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
- // set the rotation of the object, copy that behavior
- PhysicsActor pa = m_host.PhysActor;
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog == null || sog.IsDeleted)
+ return;
- if (m_host.ParentGroup.IsAttachment || strength == 0 || pa == null || !pa.IsPhysical)
+ if (!sog.UsesPhysics || sog.IsAttachment)
{
- llSetRot(rot);
+ // Do nothing if either value is 0 (this has been checked in SL)
+ if (strength <= 0.0 || damping <= 0.0)
+ return;
+
+ llSetLocalRot(rot);
}
else
{
- m_host.StartLookAt(rot, (float)strength, (float)damping);
+ if (strength == 0)
+ {
+ llSetLocalRot(rot);
+ return;
+ }
+
+ sog.StartLookAt(rot, (float)strength, (float)damping);
}
}
@@ -3231,22 +3722,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
{
- if (m_host.IsRoot)
- {
+ // new SL always returns object mass
+// if (m_host.IsRoot)
+// {
return m_host.ParentGroup.GetMass();
- }
- else
- {
- return m_host.GetMass();
- }
+// }
+// else
+// {
+// return m_host.GetMass();
+// }
}
}
public LSL_Float llGetMassMKS()
{
- // this is what the wiki says it does!
- // http://wiki.secondlife.com/wiki/LlGetMassMKS
- return llGetMass() * 100.0;
+ return 100f * llGetMass();
}
public void llCollisionFilter(string name, string id, int accept)
@@ -3296,7 +3786,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
// Unregister controls from Presence
presence.UnRegisterControlEventsToScript(m_host.LocalId, m_item.ItemID);
- // Remove Take Control permission.
+ // Remove Take Control permission.
m_item.PermsMask &= ~ScriptBaseClass.PERMISSION_TAKE_CONTROLS;
}
}
@@ -3355,9 +3845,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
-// if (m_host.ParentGroup.RootPart.AttachmentPoint == 0)
-// return;
-
if (m_item.PermsGranter != m_host.OwnerID)
return;
@@ -3401,6 +3888,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llInstantMessage(string user, string message)
{
m_host.AddScriptLPS(1);
+ UUID result;
+ if (!UUID.TryParse(user, out result) || result == UUID.Zero)
+ {
+ Error("llInstantMessage","An invalid key was passed to llInstantMessage");
+ ScriptSleep(2000);
+ return;
+ }
// We may be able to use ClientView.SendInstantMessage here, but we need a client instance.
// InstantMessageModule.OnInstantMessage searches through a list of scenes for a client matching the toAgent,
@@ -3411,31 +3905,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// TODO: figure out values for client, fromSession, and imSessionID
// client.SendInstantMessage(m_host.UUID, fromSession, message, user, imSessionID, m_host.Name, AgentManager.InstantMessageDialog.MessageFromAgent, (uint)Util.UnixTimeSinceEpoch());
+ UUID friendTransactionID = UUID.Random();
+
+ //m_pendingFriendRequests.Add(friendTransactionID, fromAgentID);
GridInstantMessage msg = new GridInstantMessage();
msg.fromAgentID = new Guid(m_host.OwnerID.ToString()); // fromAgentID.Guid;
msg.toAgentID = new Guid(user); // toAgentID.Guid;
msg.imSessionID = new Guid(m_host.UUID.ToString()); // This is the item we're mucking with here
-// m_log.Debug("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message);
-// m_log.Debug("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString());
- msg.timestamp = (uint)Util.UnixTimeSinceEpoch();// timestamp;
- //if (client != null)
- //{
- msg.fromAgentName = m_host.Name;//client.FirstName + " " + client.LastName;// fromAgentName;
- //}
- //else
- //{
- // msg.fromAgentName = "(hippos)";// Added for posterity. This means that we can't figure out who sent it
- //}
- // Cap the message length at 1024.
+ msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
+ msg.fromAgentName = m_host.Name;//client.FirstName + " " + client.LastName;// fromAgentName;
+
if (message != null && message.Length > 1024)
msg.message = message.Substring(0, 1024);
else
msg.message = message;
- msg.dialog = (byte)19; // messgage from script ??? // dialog;
+ msg.dialog = (byte)19; // MessageFromObject
msg.fromGroup = false;// fromGroup;
msg.offline = (byte)0; //offline;
- msg.ParentEstateID = 0; //ParentEstateID;
+ msg.ParentEstateID = World.RegionInfo.EstateSettings.EstateID;
msg.Position = new Vector3(m_host.AbsolutePosition);
msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid;
@@ -3452,6 +3940,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
}
+
+ ScriptSleep(m_sleepMsOnInstantMessage);
}
public void llEmail(string address, string subject, string message)
@@ -3489,6 +3979,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
emailModule.SendEmail(m_host.UUID, address, subject, message);
+ ScriptSleep(m_sleepMsOnEmail);
}
public void llGetNextEmail(string address, string subject)
@@ -3551,25 +4042,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- if (m_host.PhysActor != null)
+ PIDHoverType hoverType = PIDHoverType.Ground;
+ if (water != 0)
{
- PIDHoverType hoverType = PIDHoverType.Ground;
- if (water != 0)
- {
- hoverType = PIDHoverType.GroundAndWater;
- }
-
- m_host.SetHoverHeight((float)height, hoverType, (float)tau);
+ hoverType = PIDHoverType.GroundAndWater;
}
+ m_host.SetHoverHeight((float)height, hoverType, (float)tau);
}
public void llStopHover()
{
m_host.AddScriptLPS(1);
- if (m_host.PhysActor != null)
- {
- m_host.SetHoverHeight(0f, PIDHoverType.Ground, 0f);
- }
+ m_host.SetHoverHeight(0f, PIDHoverType.Ground, 0f);
}
public void llMinEventDelay(double delay)
@@ -3598,15 +4082,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Per discussion with Melanie, for non-physical objects llLookAt appears to simply
// set the rotation of the object, copy that behavior
- PhysicsActor pa = m_host.PhysActor;
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog == null || sog.IsDeleted)
+ return;
- if (strength == 0 || pa == null || !pa.IsPhysical)
+ if (strength == 0 || !sog.UsesPhysics || sog.IsAttachment)
{
llSetLocalRot(target);
}
else
{
- m_host.RotLookAt(target, (float)strength, (float)damping);
+ sog.RotLookAt(target, (float)strength, (float)damping);
}
}
@@ -3735,7 +4221,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
ScriptBaseClass.PERMISSION_CONTROL_CAMERA |
ScriptBaseClass.PERMISSION_TRACK_CAMERA |
- ScriptBaseClass.PERMISSION_ATTACH;
+ ScriptBaseClass.PERMISSION_ATTACH |
+ ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS;
}
else
{
@@ -3752,15 +4239,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (World.GetExtraSetting("auto_grant_attach_perms") == "true")
implicitPerms = ScriptBaseClass.PERMISSION_ATTACH;
}
+ if (World.GetExtraSetting("auto_grant_all_perms") == "true")
+ {
+ implicitPerms = perm;
+ }
}
if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
{
- lock (m_host.TaskInventory)
- {
- m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
- m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
- }
+ m_host.TaskInventory.LockItemsForWrite(true);
+ m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
+ m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
+ m_host.TaskInventory.LockItemsForWrite(false);
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
"run_time_permissions", new Object[] {
@@ -3771,7 +4261,7 @@ 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
@@ -3804,11 +4294,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!m_waitingForScriptAnswer)
{
- lock (m_host.TaskInventory)
- {
- m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
- m_host.TaskInventory[m_item.ItemID].PermsMask = 0;
- }
+ m_host.TaskInventory.LockItemsForWrite(true);
+ m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
+ m_host.TaskInventory[m_item.ItemID].PermsMask = 0;
+ m_host.TaskInventory.LockItemsForWrite(false);
presence.ControllingClient.OnScriptAnswer += handleScriptAnswer;
m_waitingForScriptAnswer=true;
@@ -3837,14 +4326,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
llReleaseControls();
- lock (m_host.TaskInventory)
- {
- m_host.TaskInventory[m_item.ItemID].PermsMask = answer;
- }
+ m_host.TaskInventory.LockItemsForWrite(true);
+ m_host.TaskInventory[m_item.ItemID].PermsMask = answer;
+ m_host.TaskInventory.LockItemsForWrite(false);
- 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()
@@ -3883,15 +4372,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetLinkColor(int linknumber, LSL_Vector color, int face)
{
List parts = GetLinkParts(linknumber);
-
- foreach (SceneObjectPart part in parts)
- part.SetFaceColorAlpha(face, color, null);
+ if (parts.Count > 0)
+ {
+ try
+ {
+ foreach (SceneObjectPart part in parts)
+ part.SetFaceColorAlpha(face, color, null);
+ }
+ finally { }
+ }
}
public void llCreateLink(string target, int parent)
{
m_host.AddScriptLPS(1);
+ UUID targetID;
+
+ if (!UUID.TryParse(target, out targetID))
+ return;
+
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
{
@@ -3907,9 +4407,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID targetID;
if (!UUID.TryParse(target, out targetID))
- return;
+ return;
SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID);
+ if (targetPart == null)
+ return;
if (targetPart.ParentGroup.AttachmentPoint != 0)
return; // Fail silently if attached
@@ -3919,24 +4421,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SceneObjectGroup parentPrim = null, childPrim = null;
- if (targetPart != null)
+ if (parent != 0)
{
- if (parent != 0)
- {
- parentPrim = m_host.ParentGroup;
- childPrim = targetPart.ParentGroup;
- }
- else
- {
- parentPrim = targetPart.ParentGroup;
- childPrim = m_host.ParentGroup;
- }
-
- // Required for linking
- childPrim.RootPart.ClearUpdateSchedule();
- parentPrim.LinkToGroup(childPrim, true);
+ parentPrim = m_host.ParentGroup;
+ childPrim = targetPart.ParentGroup;
+ }
+ else
+ {
+ parentPrim = targetPart.ParentGroup;
+ childPrim = m_host.ParentGroup;
}
+ // Required for linking
+ childPrim.RootPart.ClearUpdateSchedule();
+ parentPrim.LinkToGroup(childPrim, true);
+
+
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
parentPrim.RootPart.CreateSelected = true;
parentPrim.HasGroupChanged = true;
@@ -3949,6 +4449,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (client != null)
parentPrim.SendPropertiesToClient(client);
+
+ ScriptSleep(m_sleepMsOnCreateLink);
}
public void llBreakLink(int linknum)
@@ -4005,10 +4507,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Restructuring Multiple Prims.
List parts = new List(parentPrim.Parts);
parts.Remove(parentPrim.RootPart);
- foreach (SceneObjectPart part in parts)
+ if (parts.Count > 0)
{
- parentPrim.DelinkFromGroup(part.LocalId, true);
- }
+ try
+ {
+ foreach (SceneObjectPart part in parts)
+ {
+ parentPrim.DelinkFromGroup(part.LocalId, true);
+ }
+ }
+ finally { }
+ }
+
parentPrim.HasGroupChanged = true;
parentPrim.ScheduleGroupForFullUpdate();
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
@@ -4017,12 +4527,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
SceneObjectPart newRoot = parts[0];
parts.Remove(newRoot);
- foreach (SceneObjectPart part in parts)
+
+ try
{
- // Required for linking
- part.ClearUpdateSchedule();
- newRoot.ParentGroup.LinkToGroup(part.ParentGroup);
+ foreach (SceneObjectPart part in parts)
+ {
+ part.ClearUpdateSchedule();
+ newRoot.ParentGroup.LinkToGroup(part.ParentGroup);
+ }
}
+ finally { }
+
newRoot.ParentGroup.HasGroupChanged = true;
newRoot.ParentGroup.ScheduleGroupForFullUpdate();
}
@@ -4043,13 +4558,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
+ TaskInventoryItem item = m_item;
+
+ if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
{
- Error("llBreakAllLinks", "PERMISSION_CHANGE_LINKS permission not set");
+ Error("llBreakAllLinks","Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
return;
}
-
BreakAllLinks();
}
@@ -4074,13 +4590,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetLinkKey(int linknum)
{
m_host.AddScriptLPS(1);
+ SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum);
+ if (part != null)
+ {
+ return part.UUID.ToString();
+ }
+ else
+ {
+ if (linknum > m_host.ParentGroup.PrimCount || (linknum == 1 && m_host.ParentGroup.PrimCount == 1))
+ {
+ linknum -= (m_host.ParentGroup.PrimCount) + 1;
- ISceneEntity entity = GetLinkEntity(m_host, linknum);
+ if (linknum < 0)
+ return UUID.Zero.ToString();
- if (entity != null)
- return entity.UUID.ToString();
- else
- return ScriptBaseClass.NULL_KEY;
+ List avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET);
+ if (avatars.Count > linknum)
+ {
+ return avatars[linknum].UUID.ToString();
+ }
+ }
+ return UUID.Zero.ToString();
+ }
}
///
@@ -4139,17 +4670,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
int count = 0;
- 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.Type == type || type == -1)
{
- if (inv.Value.Type == type || type == -1)
- {
- count = count + 1;
- }
+ count = count + 1;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
return count;
}
@@ -4158,16 +4688,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
ArrayList keys = new ArrayList();
- 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.Type == type || type == -1)
{
- if (inv.Value.Type == type || type == -1)
- {
- keys.Add(inv.Value.Name);
- }
+ keys.Add(inv.Value.Name);
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
if (keys.Count == 0)
{
@@ -4237,35 +4766,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
+
// destination is an avatar
string message;
InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId, out message);
if (agentItem == null)
{
- llSay(0, message);
+ llSay(0, message);
return;
}
- if (m_TransferModule != null)
- {
- byte[] bucket = new byte[1];
- bucket[0] = (byte)item.Type;
+ byte[] bucket = new byte[1];
+ bucket[0] = (byte)item.Type;
+ //byte[] objBytes = agentItem.ID.GetBytes();
+ //Array.Copy(objBytes, 0, bucket, 1, 16);
+
+ GridInstantMessage msg = new GridInstantMessage(World,
+ m_host.OwnerID, m_host.Name, destId,
+ (byte)InstantMessageDialog.TaskInventoryOffered,
+ false, item.Name+". "+m_host.Name+" is located at "+
+ World.RegionInfo.RegionName+" "+
+ m_host.AbsolutePosition.ToString(),
+ agentItem.ID, true, m_host.AbsolutePosition,
+ bucket, true);
- GridInstantMessage msg = new GridInstantMessage(World,
- m_host.OwnerID, m_host.Name, destId,
- (byte)InstantMessageDialog.TaskInventoryOffered,
- false, item.Name+". "+m_host.Name+" is located at "+
- World.RegionInfo.RegionName+" "+
- m_host.AbsolutePosition.ToString(),
- agentItem.ID, true, m_host.AbsolutePosition,
- bucket, true);
+ ScenePresence sp;
- m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
+ if (World.TryGetScenePresence(destId, out sp))
+ {
+ sp.ControllingClient.SendInstantMessage(msg);
+ }
+ else
+ {
+ if (m_TransferModule != null)
+ m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
}
+
+ //This delay should only occur when giving inventory to avatars.
+ ScriptSleep(m_sleepMsOnGiveInventory);
}
}
+ [DebuggerNonUserCode]
public void llRemoveInventory(string name)
{
m_host.AddScriptLPS(1);
@@ -4285,20 +4828,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
Vector3 av3 = Util.Clip(color, 0.0f, 1.0f);
- if (text.Length > 254)
- text = text.Remove(254);
-
byte[] data;
- do
- {
- data = Util.UTF8.GetBytes(text);
- if (data.Length > 254)
- text = text.Substring(0, text.Length - 1);
- } while (data.Length > 254);
-
+ data = Util.StringToBytes256(text);
+ text = Util.UTF8.GetString(data);
m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
- //m_host.ParentGroup.HasGroupChanged = true;
- //m_host.ParentGroup.ScheduleGroupForFullUpdate();
}
public LSL_Float llWater(LSL_Vector offset)
@@ -4320,14 +4853,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- UUID uuid = (UUID)id;
- PresenceInfo pinfo = null;
- UserAccount account;
-
- UserInfoCacheEntry ce;
-
- lock (m_userInfoCache)
+ UUID uuid;
+ if (UUID.TryParse(id, out uuid))
{
+ PresenceInfo pinfo = null;
+ UserAccount account;
+
+ UserInfoCacheEntry ce;
if (!m_userInfoCache.TryGetValue(uuid, out ce))
{
account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
@@ -4353,7 +4885,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ce.time = Util.EnvironmentTickCount();
ce.account = account;
ce.pinfo = pinfo;
-
m_userInfoCache[uuid] = ce;
}
else
@@ -4362,77 +4893,78 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return UUID.Zero.ToString();
account = ce.account;
+ pinfo = ce.pinfo;
+ }
- if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time)
- >= LlRequestAgentDataCacheTimeoutMs)
+ if (Util.EnvironmentTickCount() < ce.time ||
+ (Util.EnvironmentTickCount() - ce.time) >= LlRequestAgentDataCacheTimeoutMs)
+ {
+ PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
+ if (pinfos != null && pinfos.Length > 0)
{
- PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
- if (pinfos != null && pinfos.Length > 0)
+ foreach (PresenceInfo p in pinfos)
{
- foreach (PresenceInfo p in pinfos)
+ if (p.RegionID != UUID.Zero)
{
- if (p.RegionID != UUID.Zero)
- {
- pinfo = p;
- }
+ pinfo = p;
}
}
- else
- {
- pinfo = null;
- }
-
- ce.time = Util.EnvironmentTickCount();
- ce.pinfo = pinfo;
}
else
- {
- pinfo = ce.pinfo;
- }
+ pinfo = null;
+
+ ce.time = Util.EnvironmentTickCount();
+ ce.pinfo = pinfo;
}
- }
- string reply = String.Empty;
+ string reply = String.Empty;
- switch (data)
- {
- case ScriptBaseClass.DATA_ONLINE:
- if (pinfo != null && pinfo.RegionID != UUID.Zero)
- reply = "1";
- else
- reply = "0";
- break;
- case ScriptBaseClass.DATA_NAME: // (First Last)
- reply = account.FirstName + " " + account.LastName;
- break;
- case ScriptBaseClass.DATA_BORN: // (YYYY-MM-DD)
- DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0);
- born = born.AddSeconds(account.Created);
- reply = born.ToString("yyyy-MM-dd");
- break;
- case ScriptBaseClass.DATA_RATING: // (0,0,0,0,0,0)
- reply = "0,0,0,0,0,0";
- break;
- case 7: // DATA_USERLEVEL (integer). This is not available in LL and so has no constant.
- reply = account.UserLevel.ToString();
- break;
- case ScriptBaseClass.DATA_PAYINFO: // (0|1|2|3)
- reply = "0";
- break;
- default:
- return UUID.Zero.ToString(); // Raise no event
- }
+ switch (data)
+ {
+ case ScriptBaseClass.DATA_ONLINE: // DATA_ONLINE (0|1)
+ if (pinfo != null && pinfo.RegionID != UUID.Zero)
+ reply = "1";
+ else
+ reply = "0";
+ break;
+ case ScriptBaseClass.DATA_NAME: // DATA_NAME (First Last)
+ reply = account.FirstName + " " + account.LastName;
+ break;
+ case ScriptBaseClass.DATA_BORN: // DATA_BORN (YYYY-MM-DD)
+ DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0);
+ born = born.AddSeconds(account.Created);
+ reply = born.ToString("yyyy-MM-dd");
+ break;
+ case ScriptBaseClass.DATA_RATING: // DATA_RATING (0,0,0,0,0,0)
+ reply = "0,0,0,0,0,0";
+ break;
+ case 7: // DATA_USERLEVEL (integer). This is not available in LL and so has no constant.
+ reply = account.UserLevel.ToString();
+ break;
+ case ScriptBaseClass.DATA_PAYINFO: // DATA_PAYINFO (0|1|2|3)
+ reply = "0";
+ break;
+ default:
+ return UUID.Zero.ToString(); // Raise no event
+ }
- UUID rq = UUID.Random();
+ UUID rq = UUID.Random();
- UUID tid = AsyncCommands.
- DataserverPlugin.RegisterRequest(m_host.LocalId,
- m_item.ItemID, rq.ToString());
+ UUID tid = AsyncCommands.
+ DataserverPlugin.RegisterRequest(m_host.LocalId,
+ m_item.ItemID, rq.ToString());
- AsyncCommands.
- DataserverPlugin.DataserverReply(rq.ToString(), reply);
+ AsyncCommands.
+ DataserverPlugin.DataserverReply(rq.ToString(), reply);
- return tid.ToString();
+ ScriptSleep(m_sleepMsOnRequestAgentData);
+ return tid.ToString();
+ }
+ else
+ {
+ Error("llRequestAgentData","Invalid UUID passed to llRequestAgentData.");
+ }
+ return "";
}
public LSL_String llRequestInventoryData(string name)
@@ -4464,10 +4996,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
reply);
});
+ ScriptSleep(m_sleepMsOnRequestInventoryData);
return tid.ToString();
}
}
+ ScriptSleep(m_sleepMsOnRequestInventoryData);
return String.Empty;
}
@@ -4484,15 +5018,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (UUID.TryParse(agent, out agentId))
{
ScenePresence presence = World.GetScenePresence(agentId);
- if (presence != null)
+ if (presence != null && presence.PresenceType != PresenceType.Npc)
{
+ // agent must not be a god
+ if (presence.GodController.UserLevel >= 200) return;
+
// agent must be over the owners land
if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)
{
- World.TeleportClientHome(agentId, presence.ControllingClient);
+ if (!World.TeleportClientHome(agentId, presence.ControllingClient))
+ {
+ // They can't be teleported home for some reason
+ GridRegion regionInfo = World.GridService.GetRegionByUUID(UUID.Zero, new UUID("2b02daac-e298-42fa-9a75-f488d37896e6"));
+ if (regionInfo != null)
+ {
+ World.RequestTeleportLocation(
+ presence.ControllingClient, regionInfo.RegionHandle, new Vector3(128, 128, 23), Vector3.Zero,
+ (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
+ }
+ }
}
}
}
+
+ ScriptSleep(m_sleepMsOnSetDamage);
}
public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt)
@@ -4505,20 +5054,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
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).LandData.OwnerID)
+ if (m_item.PermsGranter == agentId)
+ {
+ if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0)
+ {
+ DoLLTeleport(presence, destination, targetPos, targetLookAt);
+ }
+ }
+
+ // agent must be wearing the object
+ if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID)
{
DoLLTeleport(presence, destination, targetPos, targetLookAt);
}
- else // or must be wearing the prim
+ else
{
- if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID)
+ // agent must not be a god
+ if (presence.IsViewerUIGod) return;
+
+ // agent must be over the owners land
+ ILandObject agentLand = World.LandChannel.GetLandObject(presence.AbsolutePosition);
+ ILandObject objectLand = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
+ if (m_host.OwnerID == objectLand.LandData.OwnerID && m_host.OwnerID == agentLand.LandData.OwnerID)
{
DoLLTeleport(presence, destination, targetPos, targetLookAt);
}
@@ -4536,23 +5096,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (UUID.TryParse(agent, out agentId))
{
+ // This function is owner only!
+ if (m_host.OwnerID != agentId)
+ return;
+
ScenePresence presence = World.GetScenePresence(agentId);
- if (presence != null && presence.PresenceType != PresenceType.Npc)
+
+ if (presence == null || presence.PresenceType == PresenceType.Npc)
+ return;
+
+ // Can't TP sitting avatars
+ if (presence.ParentID != 0) // Sitting
+ return;
+
+ if (m_item.PermsGranter == agentId)
{
- // agent must not be a god
- if (presence.GodLevel >= 200) return;
+ // If attached using llAttachToAvatarTemp, cowardly refuse
+ if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.ParentGroup.FromItemID == UUID.Zero)
+ return;
- // agent must be over the owners land
- if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)
- {
- World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
- }
- else // or must be wearing the prim
+ if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0)
{
- if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID)
- {
- World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
- }
+ World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
}
}
}
@@ -4601,13 +5166,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
Error("llTextBox", "Empty message");
}
- else if (message.Length > 512)
+ else if (Encoding.UTF8.GetByteCount(message) > 512)
{
- Error("llTextBox", "Message more than 512 characters");
+ Error("llTextBox", "Message longer than 512 bytes");
}
else
{
dm.SendTextBoxToUser(av, message, chatChannel, m_host.Name, m_host.UUID, m_host.OwnerID);
+ ScriptSleep(m_sleepMsOnTextBox);
}
}
@@ -4625,9 +5191,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
+ if(impact_sound == "")
+ {
+ m_host.CollisionSoundVolume = (float)impact_volume;
+ m_host.CollisionSound = m_host.invalidCollisionSoundUUID;
+ m_host.CollisionSoundType = -1; // disable all sounds
+ m_host.aggregateScriptEvents();
+ return;
+ }
+
// TODO: Parameter check logic required.
- m_host.CollisionSound = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound);
- m_host.CollisionSoundVolume = (float)impact_volume;
+ UUID soundId = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound);
+ if(soundId != UUID.Zero)
+ {
+ m_host.CollisionSound = soundId;
+ m_host.CollisionSoundVolume = (float)impact_volume;
+ m_host.CollisionSoundType = 1;
+ }
+ else
+ m_host.CollisionSoundType = -1;
+
+ m_host.aggregateScriptEvents();
}
public LSL_String llGetAnimation(string id)
@@ -4641,14 +5225,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_host.RegionHandle == presence.RegionHandle)
{
- Dictionary animationstateNames = DefaultAvatarAnimations.AnimStateNames;
-
if (presence != null)
{
- AnimationSet currentAnims = presence.Animator.Animations;
- string currentAnimationState = String.Empty;
- if (animationstateNames.TryGetValue(currentAnims.ImplicitDefaultAnimation.AnimID, out currentAnimationState))
- return currentAnimationState;
+// if (presence.SitGround)
+// return "Sitting on Ground";
+// if (presence.ParentID != 0 || presence.ParentUUID != UUID.Zero)
+// return "Sitting";
+
+ string movementAnimation = presence.Animator.CurrentMovementAnimation;
+ string lslMovementAnimation;
+
+ if (MovementAnimationsForLSL.TryGetValue(movementAnimation, out lslMovementAnimation))
+ return lslMovementAnimation;
}
}
@@ -4712,7 +5300,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
// Pushee is in GodMode this pushing object isn't owned by them
- if (avatar.GodLevel > 0 && m_host.OwnerID != targetID)
+ if (avatar.IsViewerUIGod && m_host.OwnerID != targetID)
return;
pusheeav = avatar;
@@ -4796,7 +5384,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
float distance = (PusheePos - m_host.AbsolutePosition).Length();
float distance_term = distance * distance * distance; // Script Energy
- float pusher_mass = m_host.GetMass();
+ // use total object mass and not part
+ float pusher_mass = m_host.ParentGroup.GetMass();
float PUSH_ATTENUATION_DISTANCE = 17f;
float PUSH_ATTENUATION_SCALE = 5f;
@@ -4831,7 +5420,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (local != 0)
{
- applied_linear_impulse *= m_host.GetWorldRotation();
+// applied_linear_impulse *= m_host.GetWorldRotation();
+ applied_linear_impulse *= pusheeav.GetWorldRotation();
}
pa.AddForce(applied_linear_impulse, true);
@@ -4891,20 +5481,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- return GetNumberOfSides(m_host);
+ return m_host.GetNumberOfSides();
}
protected int GetNumberOfSides(SceneObjectPart part)
{
- int sides = part.GetNumberOfSides();
-
- if (part.GetPrimType() == PrimType.SPHERE && part.Shape.ProfileHollow > 0)
- {
- // Make up for a bug where LSL shows 4 sides rather than 2
- sides += 2;
- }
-
- return sides;
+ return part.GetNumberOfSides();
}
@@ -4959,20 +5541,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- if (Math.Abs(rot.s) > 1) // normalization needed
- rot.Normalize();
+ rot.Normalize();
double s = Math.Sqrt(1 - rot.s * rot.s);
- if (s < 0.001)
- {
- return new LSL_Vector(1, 0, 0);
- }
- else
- {
- double invS = 1.0 / s;
- if (rot.s < 0) invS = -invS;
- return new LSL_Vector(rot.x * invS, rot.y * invS, rot.z * invS);
- }
+ if (s < 1e-8)
+ return new LSL_Vector(0, 0, 0);
+
+ double invS = 1.0 / s;
+ if (rot.s < 0)
+ invS = -invS;
+ return new LSL_Vector(rot.x * invS, rot.y * invS, rot.z * invS);
}
@@ -4981,11 +5559,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- if (Math.Abs(rot.s) > 1) // normalization needed
- rot.Normalize();
+ rot.Normalize();
double angle = 2 * Math.Acos(rot.s);
- if (angle > Math.PI)
+ if (angle > Math.PI)
angle = 2 * Math.PI - angle;
return angle;
@@ -5185,43 +5762,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- if (src == null)
- {
- return 0;
- }
- else
- {
- return src.Length;
- }
+ return src.Length;
}
public LSL_Integer llList2Integer(LSL_List src, int index)
{
m_host.AddScriptLPS(1);
if (index < 0)
- {
index = src.Length + index;
- }
+
if (index >= src.Length || index < 0)
- {
return 0;
- }
+
+ object item = src.Data[index];
// Vectors & Rotations always return zero in SL, but
// keys don't always return zero, it seems to be a bit complex.
- else if (src.Data[index] is LSL_Vector ||
- src.Data[index] is LSL_Rotation)
- {
+ if (item is LSL_Vector || item is LSL_Rotation)
return 0;
- }
+
try
{
-
- if (src.Data[index] is LSL_Integer)
- return (LSL_Integer)src.Data[index];
- else if (src.Data[index] is LSL_Float)
- return Convert.ToInt32(((LSL_Float)src.Data[index]).value);
- return new LSL_Integer(src.Data[index].ToString());
+ if (item is LSL_Integer)
+ return (LSL_Integer)item;
+ else if (item is LSL_Float)
+ return Convert.ToInt32(((LSL_Float)item).value);;
+ return new LSL_Integer(item.ToString());
}
catch (FormatException)
{
@@ -5233,38 +5799,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
if (index < 0)
- {
index = src.Length + index;
- }
+
if (index >= src.Length || index < 0)
- {
- return 0.0;
- }
+ return 0;
+
+ object item = src.Data[index];
// Vectors & Rotations always return zero in SL
- else if (src.Data[index] is LSL_Vector ||
- src.Data[index] is LSL_Rotation)
- {
+ if(item is LSL_Vector || item is LSL_Rotation)
return 0;
- }
+
// valid keys seem to get parsed as integers then converted to floats
- else
+ if (item is LSL_Key)
{
UUID uuidt;
- if (src.Data[index] is LSL_Key && UUID.TryParse(src.Data[index].ToString(), out uuidt))
- {
- return Convert.ToDouble(new LSL_Integer(src.Data[index].ToString()).value);
- }
+ string s = item.ToString();
+ if(UUID.TryParse(s, out uuidt))
+ return Convert.ToDouble(new LSL_Integer(s).value);
+// we can't do this because a string is also a LSL_Key for now :(
+// else
+// return 0;
}
+
try
{
- if (src.Data[index] is LSL_Integer)
- return Convert.ToDouble(((LSL_Integer)src.Data[index]).value);
- else if (src.Data[index] is LSL_Float)
- return Convert.ToDouble(((LSL_Float)src.Data[index]).value);
- else if (src.Data[index] is LSL_String)
- return Convert.ToDouble(((LSL_String)src.Data[index]).m_string);
- return Convert.ToDouble(src.Data[index]);
+ if (item is LSL_Integer)
+ return Convert.ToDouble(((LSL_Integer)item).value);
+ else if (item is LSL_Float)
+ return Convert.ToDouble(((LSL_Float)item).value);
+ else if (item is LSL_String)
+ {
+ string str = ((LSL_String)item).m_string;
+ Match m = Regex.Match(str, "^\\s*(-?\\+?[,0-9]+\\.?[0-9]*)");
+ if (m != Match.Empty)
+ {
+ str = m.Value;
+ double d = 0.0;
+ if (!Double.TryParse(str, out d))
+ return 0.0;
+ return d;
+ }
+ return 0.0;
+ }
+ return Convert.ToDouble(item);
}
catch (FormatException)
{
@@ -5276,13 +5854,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
if (index < 0)
- {
index = src.Length + index;
- }
+
if (index >= src.Length || index < 0)
- {
return String.Empty;
- }
+
return src.Data[index].ToString();
}
@@ -5290,14 +5866,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
if (index < 0)
- {
index = src.Length + index;
- }
if (index >= src.Length || index < 0)
- {
- return "";
- }
+ return String.Empty;
+
+ object item = src.Data[index];
// SL spits out an empty string for types other than key & string
// At the time of patching, LSL_Key is currently LSL_String,
@@ -5306,31 +5880,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// as it's own struct
// NOTE: 3rd case is needed because a NULL_KEY comes through as
// type 'obj' and wrongly returns ""
- else if (!(src.Data[index] is LSL_String ||
- src.Data[index] is LSL_Key ||
- src.Data[index].ToString() == "00000000-0000-0000-0000-000000000000"))
+ if (!(item is LSL_String ||
+ item is LSL_Key ||
+ item.ToString() == "00000000-0000-0000-0000-000000000000"))
{
- return "";
+ return String.Empty;
}
- return src.Data[index].ToString();
+ return item.ToString();
}
public LSL_Vector llList2Vector(LSL_List src, int index)
{
m_host.AddScriptLPS(1);
if (index < 0)
- {
index = src.Length + index;
- }
+
if (index >= src.Length || index < 0)
- {
return new LSL_Vector(0, 0, 0);
- }
- if (src.Data[index].GetType() == typeof(LSL_Vector))
- {
- return (LSL_Vector)src.Data[index];
- }
+
+ object item = src.Data[index];
+
+ if (item.GetType() == typeof(LSL_Vector))
+ return (LSL_Vector)item;
// SL spits always out ZERO_VECTOR for anything other than
// strings or vectors. Although keys always return ZERO_VECTOR,
@@ -5338,28 +5910,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// a string, a key as string and a string that by coincidence
// is a string, so we're going to leave that up to the
// LSL_Vector constructor.
- else if (!(src.Data[index] is LSL_String ||
- src.Data[index] is LSL_Vector))
- {
- return new LSL_Vector(0, 0, 0);
- }
- else
- {
- return new LSL_Vector(src.Data[index].ToString());
- }
+ if(item is LSL_Vector)
+ return (LSL_Vector) item;
+
+ if (item is LSL_String)
+ return new LSL_Vector(item.ToString());
+
+ return new LSL_Vector(0, 0, 0);
}
public LSL_Rotation llList2Rot(LSL_List src, int index)
{
m_host.AddScriptLPS(1);
if (index < 0)
- {
index = src.Length + index;
- }
+
if (index >= src.Length || index < 0)
- {
return new LSL_Rotation(0, 0, 0, 1);
- }
+
+ object item = src.Data[index];
// SL spits always out ZERO_ROTATION for anything other than
// strings or vectors. Although keys always return ZERO_ROTATION,
@@ -5367,19 +5936,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// a string, a key as string and a string that by coincidence
// is a string, so we're going to leave that up to the
// LSL_Rotation constructor.
- else if (!(src.Data[index] is LSL_String ||
- src.Data[index] is LSL_Rotation))
- {
- return new LSL_Rotation(0, 0, 0, 1);
- }
- else if (src.Data[index].GetType() == typeof(LSL_Rotation))
- {
- return (LSL_Rotation)src.Data[index];
- }
- else
- {
+
+ if (item.GetType() == typeof(LSL_Rotation))
+ return (LSL_Rotation)item;
+
+ if (item is LSL_String)
return new LSL_Rotation(src.Data[index].ToString());
- }
+
+ return new LSL_Rotation(0, 0, 0, 1);
}
public LSL_List llList2List(LSL_List src, int start, int end)
@@ -5567,7 +6131,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
- else {
+ else
+ {
object[] array = new object[src.Length];
Array.Copy(src.Data, 0, array, 0, src.Length);
result = new LSL_List(array);
@@ -5674,7 +6239,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetRegionAgentCount()
{
m_host.AddScriptLPS(1);
- return new LSL_Integer(World.GetRootAgentCount());
+
+ int count = 0;
+ World.ForEachRootScenePresence(delegate(ScenePresence sp) {
+ count++;
+ });
+
+ return new LSL_Integer(count);
}
public LSL_Vector llGetRegionCorner()
@@ -5742,10 +6313,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IUrlModule UrlModule = World.RequestModuleInterface();
return UrlModule.ExternalHostNameForLSL;
}
+ else if (name == "region_max_prims")
+ {
+ return World.RegionInfo.ObjectCapacity.ToString();
+ }
+ else if (name == "region_object_bonus")
+ {
+ return World.RegionInfo.RegionSettings.ObjectBonus.ToString();
+ }
else
{
return "";
}
+
}
///
@@ -5821,17 +6401,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
for (int i = 0; i < length; i++)
{
+ int needle = llGetListEntryType(test, 0).value;
+ int haystack = llGetListEntryType(src, i).value;
+
// Why this piece of insanity? This is because most script constants are C# value types (e.g. int)
// rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code
// and so the comparison fails even if the LSL_Integer conceptually has the same value.
// Therefore, here we test Equals on both the source and destination objects.
// However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)).
- if (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i]))
+ if ((needle == haystack) && (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i])))
{
int j;
for (j = 1; j < test.Length; j++)
- if (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j])))
+ {
+ needle = llGetListEntryType(test, j).value;
+ haystack = llGetListEntryType(src, i+j).value;
+
+ if ((needle != haystack) || (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j]))))
break;
+ }
if (j == test.Length)
{
@@ -5869,64 +6457,61 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- // edge will be used to pass the Region Coordinates offset
- // we want to check for a neighboring sim
- LSL_Vector edge = new LSL_Vector(0, 0, 0);
+ if(dir.x == 0 && dir.y == 0)
+ return 1; // SL wiki
+
+ float rsx = World.RegionInfo.RegionSizeX;
+ float rsy = World.RegionInfo.RegionSizeY;
+
+ // can understand what sl does if position is not in region, so do something :)
+ float px = (float)Util.Clamp(pos.x, 0.5, rsx - 0.5);
+ float py = (float)Util.Clamp(pos.y, 0.5, rsy - 0.5);
+
+ float ex, ey;
if (dir.x == 0)
{
- if (dir.y == 0)
- {
- // Direction vector is 0,0 so return
- // false since we're staying in the sim
- return 0;
- }
- else
- {
- // Y is the only valid direction
- edge.y = dir.y / Math.Abs(dir.y);
- }
+ ex = px;
+ ey = dir.y > 0 ? rsy + 1.0f : -1.0f;
+ }
+ else if(dir.y == 0)
+ {
+ ex = dir.x > 0 ? rsx + 1.0f : -1.0f;
+ ey = py;
}
else
{
- LSL_Float mag;
- if (dir.x > 0)
- {
- mag = (World.RegionInfo.RegionSizeX - pos.x) / dir.x;
- }
- else
- {
- mag = (pos.x/dir.x);
- }
-
- mag = Math.Abs(mag);
+ float dx = (float) dir.x;
+ float dy = (float) dir.y;
- edge.y = pos.y + (dir.y * mag);
+ float t1 = dx * dx + dy * dy;
+ t1 = (float)Math.Sqrt(t1);
+ dx /= t1;
+ dy /= t1;
- if (edge.y > World.RegionInfo.RegionSizeY || edge.y < 0)
- {
- // Y goes out of bounds first
- edge.y = dir.y / Math.Abs(dir.y);
- }
+ if(dx > 0)
+ t1 = (rsx + 1f - px)/dx;
else
- {
- // X goes out of bounds first or its a corner exit
- edge.y = 0;
- edge.x = dir.x / Math.Abs(dir.x);
- }
- }
+ t1 = -(px + 1f)/dx;
- List neighbors = World.GridService.GetNeighbours(World.RegionInfo.ScopeID, World.RegionInfo.RegionID);
+ float t2;
+ if(dy > 0)
+ t2 = (rsy + 1f - py)/dy;
+ else
+ t2 = -(py + 1f)/dy;
- uint neighborX = World.RegionInfo.RegionLocX + (uint)dir.x;
- uint neighborY = World.RegionInfo.RegionLocY + (uint)dir.y;
+ if(t1 > t2)
+ t1 = t2;
- foreach (GridRegion sri in neighbors)
- {
- if (sri.RegionCoordX == neighborX && sri.RegionCoordY == neighborY)
- return 0;
+ ex = px + t1 * dx;
+ ey = py + t1 * dy;
}
+ ex += World.RegionInfo.WorldLocX;
+ ey += World.RegionInfo.WorldLocY;
+
+ if(World.GridService.GetRegionByPosition(World.RegionInfo.ScopeID, (int)ex, (int)ey) != null)
+ return 0;
return 1;
}
@@ -5980,6 +6565,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
flags |= ScriptBaseClass.AGENT_AWAY;
}
+ UUID busy = new UUID("efcf670c-2d18-8128-973a-034ebc806b67");
+ UUID[] anims = agent.Animator.GetAnimationArray();
+ if (Array.Exists(anims, a => { return a == busy; }))
+ {
+ flags |= ScriptBaseClass.AGENT_BUSY;
+ }
+
// seems to get unset, even if in mouselook, when avatar is sitting on a prim???
if ((agent.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
{
@@ -6027,6 +6619,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
flags |= ScriptBaseClass.AGENT_SITTING;
}
+ if (agent.Appearance.VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MALE] > 0)
+ {
+ flags |= ScriptBaseClass.AGENT_MALE;
+ }
+
return flags;
}
@@ -6056,11 +6653,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// 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.
+ /// AGENT_LIST_EXCLUDENPC ignore NPCs (bit mask)
///
public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options)
{
m_host.AddScriptLPS(1);
+ // do our bit masks part
+ bool noNPC = (scope & ScriptBaseClass.AGENT_LIST_EXCLUDENPC) !=0;
+
+ // remove bit masks part
+ scope &= ~ ScriptBaseClass.AGENT_LIST_EXCLUDENPC;
+
// 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;
@@ -6101,8 +6705,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
World.ForEachRootScenePresence(
delegate (ScenePresence ssp)
{
+ if(noNPC && ssp.IsNPC)
+ return;
+
// Gods are not listed in SL
- if (!ssp.IsDeleted && ssp.GodLevel == 0.0 && !ssp.IsChildAgent)
+ if (!ssp.IsDeleted && !ssp.IsViewerUIGod && !ssp.IsChildAgent)
{
if (!regionWide)
{
@@ -6135,6 +6742,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
m_host.AdjustSoundGain(volume);
+ ScriptSleep(m_sleepMsOnAdjustSoundVolume);
}
public void llSetSoundRadius(double radius)
@@ -6180,11 +6788,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
List parts = GetLinkParts(linknumber);
- foreach (SceneObjectPart part in parts)
+ try
{
- SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate);
+ foreach (SceneObjectPart part in parts)
+ {
+ SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate);
+ }
}
- }
+ finally
+ {
+ }
+ }
private void SetTextureAnim(SceneObjectPart part, int mode, int face, int sizex, int sizey, double start, double length, double rate)
{
@@ -6236,10 +6850,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_host.OwnerID == land.LandData.OwnerID)
{
- World.TeleportClientHome(agentID, presence.ControllingClient);
+ Vector3 p = World.GetNearestAllowedPosition(presence, land);
+ presence.TeleportOnEject(p);
+ presence.ControllingClient.SendAlertMessage("You have been ejected from this land");
}
}
}
+ ScriptSleep(m_sleepMsOnEjectFromLand);
+ }
+
+ public LSL_List llParseString2List(string str, LSL_List separators, LSL_List in_spacers)
+ {
+ return ParseString2List(str, separators, in_spacers, false);
}
public LSL_Integer llOverMyLand(string id)
@@ -6294,26 +6916,59 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
{
- agentSize = GetAgentSize(avatar);
+// agentSize = new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight);
+ Vector3 s = avatar.Appearance.AvatarSize;
+ agentSize = new LSL_Vector(s.X, s.Y, s.Z);
}
-
return agentSize;
}
- public LSL_Integer llSameGroup(string agent)
+ public LSL_Integer llSameGroup(string id)
{
m_host.AddScriptLPS(1);
- UUID agentId = new UUID();
- if (!UUID.TryParse(agent, out agentId))
- return new LSL_Integer(0);
- ScenePresence presence = World.GetScenePresence(agentId);
- if (presence == null || presence.IsChildAgent) // Return flase for child agents
+ UUID uuid = new UUID();
+ if (!UUID.TryParse(id, out uuid))
return new LSL_Integer(0);
- IClientAPI client = presence.ControllingClient;
- if (m_host.GroupID == client.ActiveGroupId)
+
+ // Check if it's a group key
+ if (uuid == m_host.ParentGroup.RootPart.GroupID)
return new LSL_Integer(1);
- else
+
+ // Handle object case
+ SceneObjectPart part = World.GetSceneObjectPart(uuid);
+ if (part != null)
+ {
+
+ if(part.ParentGroup.IsAttachment)
+ {
+ uuid = part.ParentGroup.AttachedAvatar;
+ }
+ else
+ {
+ // This will handle both deed and non-deed and also the no
+ // group case
+ if (part.ParentGroup.RootPart.GroupID == m_host.ParentGroup.RootPart.GroupID)
+ return new LSL_Integer(1);
+
+ return new LSL_Integer(0);
+ }
+ }
+
+ // Handle the case where id names an avatar
+ ScenePresence presence = World.GetScenePresence(uuid);
+ if (presence != null)
+ {
+ if (presence.IsChildAgent)
+ return new LSL_Integer(0);
+
+ IClientAPI client = presence.ControllingClient;
+ if (m_host.ParentGroup.RootPart.GroupID == client.ActiveGroupId)
+ return new LSL_Integer(1);
+
return new LSL_Integer(0);
+ }
+
+ return new LSL_Integer(0);
}
public void llUnSit(string id)
@@ -6441,6 +7096,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return m_host.ParentGroup.AttachmentPoint;
}
+ public LSL_List llGetAttachedList(string id)
+ {
+ m_host.AddScriptLPS(1);
+
+ ScenePresence av = World.GetScenePresence((UUID)id);
+
+ if (av == null || av.IsDeleted)
+ return new LSL_List("NOT_FOUND");
+
+ if (av.IsChildAgent || av.IsInTransit)
+ return new LSL_List("NOT_ON_REGION");
+
+ LSL_List AttachmentsList = new LSL_List();
+ List Attachments;
+
+ Attachments = av.GetAttachments();
+
+ foreach (SceneObjectGroup Attachment in Attachments)
+ {
+ if(Attachment.HasPrivateAttachmentPoint)
+ continue;
+ AttachmentsList.Add(new LSL_Key(Attachment.UUID.ToString()));
+ }
+
+ return AttachmentsList;
+ }
+
public virtual LSL_Integer llGetFreeMemory()
{
m_host.AddScriptLPS(1);
@@ -7127,6 +7809,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot)
{
+ // LSL quaternions can normalize to 0, normal Quaternions can't.
+ if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
+ rot.s = 1; // ZERO_ROTATION = 0,0,0,1
+
part.SitTargetPosition = offset;
part.SitTargetOrientation = rot;
part.ParentGroup.HasGroupChanged = true;
@@ -7166,11 +7852,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
if(linknum == ScriptBaseClass.LINK_SET ||
- linknum == ScriptBaseClass.LINK_ALL_CHILDREN ||
- linknum == ScriptBaseClass.LINK_ALL_OTHERS) return UUID.Zero.ToString();
+ linknum == ScriptBaseClass.LINK_ALL_CHILDREN ||
+ linknum == ScriptBaseClass.LINK_ALL_OTHERS ||
+ linknum == 0)
+ return UUID.Zero.ToString();
List parts = GetLinkParts(linknum);
- if (parts.Count == 0) return UUID.Zero.ToString();
+ if (parts.Count == 0)
+ return UUID.Zero.ToString();
return parts[0].SitTargetAvatar.ToString();
}
@@ -7181,7 +7870,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID key;
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
- if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
+ if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManagePasses, false))
{
int expires = 0;
if (hours != 0)
@@ -7214,6 +7903,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
}
}
+ ScriptSleep(m_sleepMsOnAddToLandPassList);
}
public void llSetTouchText(string text)
@@ -7295,7 +7985,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llScriptDanger(LSL_Vector pos)
{
m_host.AddScriptLPS(1);
- bool result = World.ScriptDanger(m_host.LocalId, pos);
+ bool result = World.LSLScriptDanger(m_host, pos);
if (result)
{
return 1;
@@ -7304,7 +7994,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
return 0;
}
-
}
public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel)
@@ -7321,35 +8010,51 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Error("llDialog", "First parameter must be a key");
return;
}
- if (buttons.Length < 1)
+
+ int length = buttons.Length;
+ if (length < 1)
{
Error("llDialog", "At least 1 button must be shown");
return;
}
- if (buttons.Length > 12)
+ if (length > 12)
{
Error("llDialog", "No more than 12 buttons can be shown");
return;
}
- string[] buts = new string[buttons.Length];
- for (int i = 0; i < buttons.Length; i++)
+
+ if (message == string.Empty)
+ {
+ Error("llDialog", "Empty message");
+ }
+ else if (Encoding.UTF8.GetByteCount(message) > 512)
+ {
+ Error("llDialog", "Message longer than 512 bytes");
+ }
+
+ string[] buts = new string[length];
+ for (int i = 0; i < length; i++)
{
if (buttons.Data[i].ToString() == String.Empty)
{
Error("llDialog", "Button label cannot be blank");
return;
}
+/*
if (buttons.Data[i].ToString().Length > 24)
{
Error("llDialog", "Button label cannot be longer than 24 characters");
return;
}
+*/
buts[i] = buttons.Data[i].ToString();
}
dm.SendDialogToUser(
av, m_host.Name, m_host.UUID, m_host.OwnerID,
message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts);
+
+ ScriptSleep(m_sleepMsOnDialog);
}
public void llVolumeDetect(int detect)
@@ -7364,6 +8069,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
Deprecated("llRemoteLoadScript", "Use llRemoteLoadScriptPin instead");
+ ScriptSleep(m_sleepMsOnRemoteLoadScript);
}
public void llSetRemoteScriptAccessPin(int pin)
@@ -7400,8 +8106,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
- // the rest of the permission checks are done in RezScript, so check the pin there as well
- World.RezScriptFromPrim(item.ItemID, m_host, destId, pin, running, start_param);
+ SceneObjectPart dest = World.GetSceneObjectPart(destId);
+ if (dest != null)
+ {
+ if ((item.BasePermissions & (uint)PermissionMask.Transfer) != 0 || dest.ParentGroup.RootPart.OwnerID == m_host.ParentGroup.RootPart.OwnerID)
+ {
+ // the rest of the permission checks are done in RezScript, so check the pin there as well
+ World.RezScriptFromPrim(item.ItemID, m_host, destId, pin, running, start_param);
+
+ if ((item.BasePermissions & (uint)PermissionMask.Copy) == 0)
+ m_host.Inventory.RemoveInventoryItem(item.ItemID);
+ }
+ }
+ // this will cause the delay even if the script pin or permissions were wrong - seems ok
+ ScriptSleep(m_sleepMsOnRemoteLoadScriptPin);
}
public void llOpenRemoteDataChannel()
@@ -7432,12 +8150,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams("remote_data", resobj,
new DetectParams[0]));
}
+ ScriptSleep(m_sleepMsOnOpenRemoteDataChannel);
}
public LSL_String llSendRemoteData(string channel, string dest, int idata, string sdata)
{
m_host.AddScriptLPS(1);
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface();
+ ScriptSleep(m_sleepMsOnSendRemoteData);
if (xmlrpcMod == null)
return "";
return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString();
@@ -7449,6 +8169,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface();
if (xmlrpcMod != null)
xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
+ ScriptSleep(m_sleepMsOnRemoteDataReply);
}
public void llCloseRemoteDataChannel(string channel)
@@ -7464,24 +8185,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface();
if (xmlrpcMod != null)
xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
+ ScriptSleep(m_sleepMsOnCloseRemoteDataChannel);
}
public LSL_String llMD5String(string src, int nonce)
{
m_host.AddScriptLPS(1);
- return Util.Md5Hash(String.Format("{0}:{1}", src, nonce.ToString()));
+ return Util.Md5Hash(String.Format("{0}:{1}", src, nonce.ToString()), Encoding.UTF8);
}
public LSL_String llSHA1String(string src)
{
m_host.AddScriptLPS(1);
- return Util.SHA1Hash(src).ToLower();
+ return Util.SHA1Hash(src, Encoding.UTF8).ToLower();
}
protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve)
{
float tempFloat; // Use in float expressions below to avoid byte cast precision issues.
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return shapeBlock;
if (holeshape != (int)ScriptBaseClass.PRIM_HOLE_DEFAULT &&
holeshape != (int)ScriptBaseClass.PRIM_HOLE_CIRCLE &&
@@ -7586,6 +8310,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Prim type box, cylinder and prism.
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte profileshape, byte pathcurve)
{
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
float tempFloat; // Use in float expressions below to avoid byte cast precision issues.
ObjectShapePacket.ObjectDataBlock shapeBlock;
@@ -7639,6 +8366,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Prim type sphere.
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte profileshape, byte pathcurve)
{
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
@@ -7685,6 +8415,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Prim type torus, tube and ring.
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector holesize, LSL_Vector topshear, LSL_Vector profilecut, LSL_Vector taper_a, float revolutions, float radiusoffset, float skew, byte profileshape, byte pathcurve)
{
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
float tempFloat; // Use in float expressions below to avoid byte cast precision issues.
ObjectShapePacket.ObjectDataBlock shapeBlock;
@@ -7820,6 +8553,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Prim type sculpt.
protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type, byte pathcurve)
{
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
UUID sculptId;
@@ -7842,7 +8578,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag))
{
// default
- type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
+ type = type | (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
}
part.Shape.SetSculptProperties((byte)type, sculptId);
@@ -7855,6 +8591,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
SetLinkPrimParams(ScriptBaseClass.LINK_THIS, rules, "llSetPrimitiveParams");
+
+ ScriptSleep(m_sleepMsOnSetPrimitiveParams);
}
public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
@@ -7862,6 +8600,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
SetLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParams");
+
+ ScriptSleep(m_sleepMsOnSetLinkPrimitiveParams);
}
public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
@@ -7871,9 +8611,51 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast");
}
- protected void SetLinkPrimParams(int linknumber, LSL_List rules, string originFunc)
+ private void SetLinkPrimParams(int linknumber, LSL_List rules, string originFunc)
{
- SetEntityParams(GetLinkEntities(linknumber), rules, originFunc);
+ List
public LSL_Integer llDetectedTouchFace(int index)
{
- m_host.AddScriptLPS(1);
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
if (detectedParams == null)
return new LSL_Integer(-1);
@@ -1518,7 +1456,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_Vector llDetectedTouchNormal(int index)
{
- m_host.AddScriptLPS(1);
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
if (detectedParams == null)
return new LSL_Vector();
@@ -1530,7 +1467,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_Vector llDetectedTouchPos(int index)
{
- m_host.AddScriptLPS(1);
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
if (detectedParams == null)
return new LSL_Vector();
@@ -1542,7 +1478,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_Vector llDetectedTouchST(int index)
{
- m_host.AddScriptLPS(1);
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
if (detectedParams == null)
return new LSL_Vector(-1.0, -1.0, 0.0);
@@ -1554,7 +1489,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_Vector llDetectedTouchUV(int index)
{
- m_host.AddScriptLPS(1);
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, index);
if (detectedParams == null)
return new LSL_Vector(-1.0, -1.0, 0.0);
@@ -1564,13 +1498,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
[DebuggerNonUserCode]
public virtual void llDie()
{
- m_host.AddScriptLPS(1);
if (!m_host.ParentGroup.IsAttachment) throw new SelfDeleteException();
}
public LSL_Float llGround(LSL_Vector offset)
{
- m_host.AddScriptLPS(1);
Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset;
//Get the slope normal. This gives us the equation of the plane tangent to the slope.
@@ -1600,7 +1532,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llCloud(LSL_Vector offset)
{
- m_host.AddScriptLPS(1);
float cloudCover = 0f;
ICloudModule module = World.RequestModuleInterface();
if (module != null)
@@ -1617,7 +1548,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llWind(LSL_Vector offset)
{
- m_host.AddScriptLPS(1);
LSL_Vector wind = new LSL_Vector(0, 0, 0);
IWindModule module = World.RequestModuleInterface();
if (module != null)
@@ -1638,7 +1568,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
return;
- m_host.AddScriptLPS(1);
int statusrotationaxis = 0;
@@ -1755,7 +1684,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetStatus(int status)
{
- m_host.AddScriptLPS(1);
// m_log.Debug(m_host.ToString() + " status is " + m_host.GetEffectiveObjectFlags().ToString());
switch (status)
{
@@ -1824,7 +1752,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llScaleByFactor(double scaling_factor)
{
- m_host.AddScriptLPS(1);
SceneObjectGroup group = m_host.ParentGroup;
if(scaling_factor < 1e-6)
@@ -1849,7 +1776,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llGetMaxScaleFactor()
{
- m_host.AddScriptLPS(1);
SceneObjectGroup group = m_host.ParentGroup;
if (group == null || group.IsDeleted || group.inTransit)
@@ -1860,7 +1786,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llGetMinScaleFactor()
{
- m_host.AddScriptLPS(1);
SceneObjectGroup group = m_host.ParentGroup;
if (group == null || group.IsDeleted || group.inTransit)
@@ -1871,7 +1796,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetScale(LSL_Vector scale)
{
- m_host.AddScriptLPS(1);
SetScale(m_host, scale);
}
@@ -1907,13 +1831,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetScale()
{
- m_host.AddScriptLPS(1);
return new LSL_Vector(m_host.Scale.X, m_host.Scale.Y, m_host.Scale.Z);
}
public void llSetClickAction(int action)
{
- m_host.AddScriptLPS(1);
m_host.ClickAction = (byte)action;
m_host.ParentGroup.HasGroupChanged = true;
m_host.ScheduleFullUpdate();
@@ -1922,8 +1844,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetColor(LSL_Vector color, int face)
{
- m_host.AddScriptLPS(1);
-
SetColor(m_host, color, face);
}
@@ -1976,8 +1896,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetContentType(LSL_Key id, LSL_Integer type)
{
- m_host.AddScriptLPS(1);
-
if (m_UrlModule == null)
return;
@@ -2204,8 +2122,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llGetAlpha(int face)
{
- m_host.AddScriptLPS(1);
-
return GetAlpha(m_host, face);
}
@@ -2230,15 +2146,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetAlpha(double alpha, int face)
{
- m_host.AddScriptLPS(1);
-
SetAlpha(m_host, alpha, face);
}
public void llSetLinkAlpha(int linknumber, double alpha, int face)
{
- m_host.AddScriptLPS(1);
-
List parts = GetLinkParts(linknumber);
if (parts.Count > 0)
{
@@ -2375,7 +2287,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetColor(int face)
{
- m_host.AddScriptLPS(1);
return GetColor(m_host, face);
}
@@ -2422,15 +2333,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetTexture(string texture, int face)
{
- m_host.AddScriptLPS(1);
SetTexture(m_host, texture, face);
ScriptSleep(m_sleepMsOnSetTexture);
}
public void llSetLinkTexture(int linknumber, string texture, int face)
{
- m_host.AddScriptLPS(1);
-
List parts = GetLinkParts(linknumber);
if (parts.Count > 0)
{
@@ -2487,8 +2395,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llScaleTexture(double u, double v, int face)
{
- m_host.AddScriptLPS(1);
-
ScaleTexture(m_host, u, v, face);
ScriptSleep(m_sleepMsOnScaleTexture);
}
@@ -2529,7 +2435,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llOffsetTexture(double u, double v, int face)
{
- m_host.AddScriptLPS(1);
OffsetTexture(m_host, u, v, face);
ScriptSleep(m_sleepMsOnOffsetTexture);
}
@@ -2570,7 +2475,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llRotateTexture(double rotation, int face)
{
- m_host.AddScriptLPS(1);
RotateTexture(m_host, rotation, face);
ScriptSleep(m_sleepMsOnRotateTexture);
}
@@ -2608,7 +2512,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetTexture(int face)
{
- m_host.AddScriptLPS(1);
return GetTexture(m_host, face);
}
@@ -2650,8 +2553,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetPos(LSL_Vector pos)
{
- m_host.AddScriptLPS(1);
-
SetPos(m_host, pos, true);
ScriptSleep(m_sleepMsOnSetPos);
@@ -2666,8 +2567,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// 1 if successful, 0 otherwise.
public LSL_Integer llSetRegionPos(LSL_Vector pos)
{
- m_host.AddScriptLPS(1);
-
// BEGIN WORKAROUND
// IF YOU GET REGION CROSSINGS WORKING WITH THIS FUNCTION, REPLACE THE WORKAROUND.
//
@@ -2782,20 +2681,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetPos()
{
- m_host.AddScriptLPS(1);
return m_host.GetWorldPosition();
}
public LSL_Vector llGetLocalPos()
{
- m_host.AddScriptLPS(1);
return GetPartLocalPos(m_host);
}
protected LSL_Vector GetPartLocalPos(SceneObjectPart part)
{
- m_host.AddScriptLPS(1);
-
Vector3 pos;
if (!part.IsRoot)
@@ -2817,8 +2712,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetRot(LSL_Rotation rot)
{
- m_host.AddScriptLPS(1);
-
// try to let this work as in SL...
if (m_host.ParentID == 0 || (m_host.ParentGroup != null && m_host == m_host.ParentGroup.RootPart))
{
@@ -2840,7 +2733,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetLocalRot(LSL_Rotation rot)
{
- m_host.AddScriptLPS(1);
SetRot(m_host, rot);
ScriptSleep(m_sleepMsOnSetLocalRot);
}
@@ -2902,7 +2794,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return llGetRootRotation();
}
- m_host.AddScriptLPS(1);
Quaternion q = m_host.GetWorldRotation();
if (m_host.ParentGroup != null && m_host.ParentGroup.AttachmentPoint != 0)
@@ -2967,15 +2858,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
private LSL_Rotation GetPartLocalRot(SceneObjectPart part)
{
- m_host.AddScriptLPS(1);
Quaternion rot = part.RotationOffset;
return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
}
public void llSetForce(LSL_Vector force, int local)
{
- m_host.AddScriptLPS(1);
-
if (!m_host.ParentGroup.IsDeleted)
{
if (local != 0)
@@ -2989,8 +2877,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
LSL_Vector force = new LSL_Vector(0.0, 0.0, 0.0);
- m_host.AddScriptLPS(1);
-
if (!m_host.ParentGroup.IsDeleted)
{
force = m_host.ParentGroup.RootPart.GetForce();
@@ -3001,55 +2887,46 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetVelocity(LSL_Vector vel, int local)
{
- m_host.AddScriptLPS(1);
m_host.SetVelocity(new Vector3((float)vel.x, (float)vel.y, (float)vel.z), local != 0);
}
public void llSetAngularVelocity(LSL_Vector avel, int local)
{
- m_host.AddScriptLPS(1);
m_host.SetAngularVelocity(new Vector3((float)avel.x, (float)avel.y, (float)avel.z), local != 0);
}
public LSL_Integer llTarget(LSL_Vector position, double range)
{
- m_host.AddScriptLPS(1);
return m_host.ParentGroup.registerTargetWaypoint(position,
(float)range);
}
public void llTargetRemove(int number)
{
- m_host.AddScriptLPS(1);
m_host.ParentGroup.unregisterTargetWaypoint(number);
}
public LSL_Integer llRotTarget(LSL_Rotation rot, double error)
{
- m_host.AddScriptLPS(1);
return m_host.ParentGroup.registerRotTargetWaypoint(rot, (float)error);
}
public void llRotTargetRemove(int number)
{
- m_host.AddScriptLPS(1);
m_host.ParentGroup.unregisterRotTargetWaypoint(number);
}
public void llMoveToTarget(LSL_Vector target, double tau)
{
- m_host.AddScriptLPS(1);
m_host.MoveToTarget(target, (float)tau);
}
public void llStopMoveToTarget()
{
- m_host.AddScriptLPS(1);
m_host.StopMoveToTarget();
}
public void llApplyImpulse(LSL_Vector force, int local)
{
- m_host.AddScriptLPS(1);
//No energy force yet
Vector3 v = force;
if (v.Length() > 20000.0f)
@@ -3063,26 +2940,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llApplyRotationalImpulse(LSL_Vector force, int local)
{
- m_host.AddScriptLPS(1);
m_host.ParentGroup.RootPart.ApplyAngularImpulse(force, local != 0);
}
public void llSetTorque(LSL_Vector torque, int local)
{
- m_host.AddScriptLPS(1);
m_host.ParentGroup.RootPart.SetAngularImpulse(torque, local != 0);
}
public LSL_Vector llGetTorque()
{
- m_host.AddScriptLPS(1);
-
return new LSL_Vector(m_host.ParentGroup.GetTorque());
}
public void llSetForceAndTorque(LSL_Vector force, LSL_Vector torque, int local)
{
- m_host.AddScriptLPS(1);
llSetForce(force, local);
llSetTorque(torque, local);
}
@@ -3090,8 +2962,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetVel()
{
- m_host.AddScriptLPS(1);
-
Vector3 vel = Vector3.Zero;
if (m_host.ParentGroup.IsAttachment)
@@ -3110,46 +2980,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetAccel()
{
- m_host.AddScriptLPS(1);
-
return new LSL_Vector(m_host.Acceleration);
}
public LSL_Vector llGetOmega()
{
- m_host.AddScriptLPS(1);
Vector3 avel = m_host.AngularVelocity;
return new LSL_Vector(avel.X, avel.Y, avel.Z);
}
public LSL_Float llGetTimeOfDay()
{
- m_host.AddScriptLPS(1);
return (double)((DateTime.Now.TimeOfDay.TotalMilliseconds / 1000) % (3600 * 4));
}
public LSL_Float llGetWallclock()
{
- m_host.AddScriptLPS(1);
return DateTime.Now.TimeOfDay.TotalSeconds;
}
public LSL_Float llGetTime()
{
- m_host.AddScriptLPS(1);
double ScriptTime = Util.GetTimeStampMS() - m_timer;
return (float)Math.Round((ScriptTime / 1000.0), 3);
}
public void llResetTime()
{
- m_host.AddScriptLPS(1);
m_timer = Util.GetTimeStampMS();
}
public LSL_Float llGetAndResetTime()
{
- m_host.AddScriptLPS(1);
double now = Util.GetTimeStampMS();
double ScriptTime = now - m_timer;
m_timer = now;
@@ -3158,7 +3020,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSound(string sound, double volume, int queue, int loop)
{
- m_host.AddScriptLPS(1);
Deprecated("llSound", "Use llPlaySound instead");
}
@@ -3166,8 +3027,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// 20080530 Updated to remove code duplication
public void llPlaySound(string sound, double volume)
{
- m_host.AddScriptLPS(1);
-
// send the sound, once, to all clients in range
if (m_SoundModule != null)
{
@@ -3181,7 +3040,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llLoopSound(string sound, double volume)
{
- m_host.AddScriptLPS(1);
if (m_SoundModule != null)
{
m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
@@ -3191,7 +3049,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llLoopSoundMaster(string sound, double volume)
{
- m_host.AddScriptLPS(1);
if (m_SoundModule != null)
{
m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
@@ -3201,7 +3058,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llLoopSoundSlave(string sound, double volume)
{
- m_host.AddScriptLPS(1);
if (m_SoundModule != null)
{
m_SoundModule.LoopSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound),
@@ -3211,8 +3067,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llPlaySoundSlave(string sound, double volume)
{
- m_host.AddScriptLPS(1);
-
// send the sound, once, to all clients in range
if (m_SoundModule != null)
{
@@ -3224,7 +3078,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llTriggerSound(string sound, double volume)
{
- m_host.AddScriptLPS(1);
// send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory.
if (m_SoundModule != null)
{
@@ -3236,15 +3089,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llStopSound()
{
- m_host.AddScriptLPS(1);
-
if (m_SoundModule != null)
m_SoundModule.StopSound(m_host.UUID);
}
public void llPreloadSound(string sound)
{
- m_host.AddScriptLPS(1);
if (m_SoundModule != null)
m_SoundModule.PreloadSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound), 0);
ScriptSleep(m_sleepMsOnPreloadSound);
@@ -3258,8 +3108,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_String llGetSubString(string src, int start, int end)
{
- m_host.AddScriptLPS(1);
-
// Normalize indices (if negative).
// After normlaization they may still be
// negative, but that is now relative to
@@ -3352,8 +3200,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_String llDeleteSubString(string src, int start, int end)
{
- m_host.AddScriptLPS(1);
-
// Normalize indices (if negative).
// After normlaization they may still be
// negative, but that is now relative to
@@ -3433,8 +3279,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_String llInsertString(string dest, int index, string src)
{
- m_host.AddScriptLPS(1);
-
// Normalize indices (if negative).
// After normlaization they may still be
// negative, but that is now relative to
@@ -3470,13 +3314,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llToUpper(string src)
{
- m_host.AddScriptLPS(1);
return src.ToUpper();
}
public LSL_String llToLower(string src)
{
- m_host.AddScriptLPS(1);
return src.ToLower();
}
@@ -3484,8 +3326,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
Util.FireAndForget(x =>
{
- m_host.AddScriptLPS(1);
-
if (m_item.PermsGranter == UUID.Zero)
return;
@@ -3522,28 +3362,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
{
- m_host.AddScriptLPS(1);
Deprecated("llMakeExplosion", "Use llParticleSystem instead");
ScriptSleep(m_sleepMsOnMakeExplosion);
}
public void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset)
{
- m_host.AddScriptLPS(1);
Deprecated("llMakeFountain", "Use llParticleSystem instead");
ScriptSleep(m_sleepMsOnMakeFountain);
}
public void llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
{
- m_host.AddScriptLPS(1);
Deprecated("llMakeSmoke", "Use llParticleSystem instead");
ScriptSleep(m_sleepMsOnMakeSmoke);
}
public void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
{
- m_host.AddScriptLPS(1);
Deprecated("llMakeFire", "Use llParticleSystem instead");
ScriptSleep(m_sleepMsOnMakeFire);
}
@@ -3555,7 +3391,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void doObjectRez(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param, bool atRoot)
{
- m_host.AddScriptLPS(1);
if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
return;
@@ -3634,8 +3469,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llLookAt(LSL_Vector target, double strength, double damping)
{
- m_host.AddScriptLPS(1);
-
// Get the normalized vector to the target
LSL_Vector from = llGetPos();
@@ -3682,7 +3515,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llStopLookAt()
{
- m_host.AddScriptLPS(1);
m_host.StopLookAt();
}
@@ -3690,7 +3522,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (sec != 0.0 && sec < m_MinTimerInterval)
sec = m_MinTimerInterval;
- m_host.AddScriptLPS(1);
// Setting timer repeat
AsyncCommands.TimerPlugin.SetTimerEvent(m_host.LocalId, m_item.ItemID, sec);
}
@@ -3698,15 +3529,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public virtual void llSleep(double sec)
{
// m_log.Info("llSleep snoozing " + sec + "s.");
- m_host.AddScriptLPS(1);
-
Sleep((int)(sec * 1000));
}
public LSL_Float llGetMass()
{
- m_host.AddScriptLPS(1);
-
if (m_host.ParentGroup.IsAttachment)
{
ScenePresence attachedAvatar = World.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
@@ -3741,7 +3568,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llCollisionFilter(string name, string id, int accept)
{
- m_host.AddScriptLPS(1);
m_host.CollisionFilter.Clear();
UUID objectID;
@@ -3768,14 +3594,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
-
- m_host.AddScriptLPS(1);
}
public void llReleaseControls()
{
- m_host.AddScriptLPS(1);
-
if (m_item.PermsGranter != UUID.Zero)
{
ScenePresence presence = World.GetScenePresence(m_item.PermsGranter);
@@ -3795,7 +3617,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llReleaseURL(string url)
{
- m_host.AddScriptLPS(1);
if (m_UrlModule != null)
m_UrlModule.ReleaseURL(url);
}
@@ -3843,8 +3664,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llAttachToAvatar(int attachmentPoint)
{
- m_host.AddScriptLPS(1);
-
if (m_item.PermsGranter != m_host.OwnerID)
return;
@@ -3854,8 +3673,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llDetachFromAvatar()
{
- m_host.AddScriptLPS(1);
-
if (m_host.ParentGroup.AttachmentPoint == 0)
return;
@@ -3868,26 +3685,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llTakeCamera(string avatar)
{
- m_host.AddScriptLPS(1);
Deprecated("llTakeCamera", "Use llSetCameraParams instead");
}
public void llReleaseCamera(string avatar)
{
- m_host.AddScriptLPS(1);
Deprecated("llReleaseCamera", "Use llClearCameraParams instead");
}
public LSL_String llGetOwner()
{
- m_host.AddScriptLPS(1);
-
return m_host.OwnerID.ToString();
}
public void llInstantMessage(string user, string message)
{
- m_host.AddScriptLPS(1);
UUID result;
if (!UUID.TryParse(user, out result) || result == UUID.Zero)
{
@@ -3946,7 +3758,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llEmail(string address, string subject, string message)
{
- m_host.AddScriptLPS(1);
IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface();
if (emailModule == null)
{
@@ -3984,7 +3795,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llGetNextEmail(string address, string subject)
{
- m_host.AddScriptLPS(1);
IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface();
if (emailModule == null)
{
@@ -4012,20 +3822,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetKey()
{
- m_host.AddScriptLPS(1);
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);
-
if (!m_host.ParentGroup.IsDeleted)
{
m_host.ParentGroup.RootPart.SetBuoyancy((float)buoyancy);
@@ -4040,8 +3846,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// Number of seconds over which to reach target
public void llSetHoverHeight(double height, int water, double tau)
{
- m_host.AddScriptLPS(1);
-
PIDHoverType hoverType = PIDHoverType.Ground;
if (water != 0)
{
@@ -4052,13 +3856,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llStopHover()
{
- m_host.AddScriptLPS(1);
m_host.SetHoverHeight(0f, PIDHoverType.Ground, 0f);
}
public void llMinEventDelay(double delay)
{
- m_host.AddScriptLPS(1);
try
{
m_ScriptEngine.SetMinEventDelay(m_item.ItemID, delay);
@@ -4072,14 +3874,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSoundPreload(string sound)
{
- m_host.AddScriptLPS(1);
Deprecated("llSoundPreload", "Use llPreloadSound instead");
}
public void llRotLookAt(LSL_Rotation target, double strength, double damping)
{
- m_host.AddScriptLPS(1);
-
// Per discussion with Melanie, for non-physical objects llLookAt appears to simply
// set the rotation of the object, copy that behavior
SceneObjectGroup sog = m_host.ParentGroup;
@@ -4098,7 +3897,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llStringLength(string str)
{
- m_host.AddScriptLPS(1);
if (str.Length > 0)
{
return str.Length;
@@ -4111,8 +3909,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llStartAnimation(string anim)
{
- m_host.AddScriptLPS(1);
-
if (m_item.PermsGranter == UUID.Zero)
return;
@@ -4134,8 +3930,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llStopAnimation(string anim)
{
- m_host.AddScriptLPS(1);
-
if (m_item.PermsGranter == UUID.Zero)
return;
@@ -4157,17 +3951,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llPointAt(LSL_Vector pos)
{
- m_host.AddScriptLPS(1);
}
public void llStopPointAt()
{
- m_host.AddScriptLPS(1);
}
public void llTargetOmega(LSL_Vector axis, double spinrate, double gain)
{
- m_host.AddScriptLPS(1);
TargetOmega(m_host, axis, spinrate, gain);
}
@@ -4181,7 +3972,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetStartParameter()
{
- m_host.AddScriptLPS(1);
return m_ScriptEngine.GetStartParameter(m_item.ItemID);
}
@@ -4210,8 +4000,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
llReleaseControls();
- m_host.AddScriptLPS(1);
-
int implicitPerms = 0;
if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.AttachedAvatar)
@@ -4338,15 +4126,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetPermissionsKey()
{
- m_host.AddScriptLPS(1);
-
return m_item.PermsGranter.ToString();
}
public LSL_Integer llGetPermissions()
{
- m_host.AddScriptLPS(1);
-
int perms = m_item.PermsMask;
if (m_automaticLinkPermission)
@@ -4357,8 +4141,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetLinkNumber()
{
- m_host.AddScriptLPS(1);
-
if (m_host.ParentGroup.PrimCount > 1)
{
return m_host.LinkNum;
@@ -4385,8 +4167,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))
@@ -4449,14 +4229,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (client != null)
parentPrim.SendPropertiesToClient(client);
-
- ScriptSleep(m_sleepMsOnCreateLink);
}
public void llBreakLink(int linknum)
{
- m_host.AddScriptLPS(1);
-
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
{
@@ -4556,8 +4332,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llBreakAllLinks()
{
- m_host.AddScriptLPS(1);
-
TaskInventoryItem item = m_item;
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
@@ -4589,7 +4363,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetLinkKey(int linknum)
{
- m_host.AddScriptLPS(1);
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum);
if (part != null)
{
@@ -4655,8 +4428,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_String llGetLinkName(int linknum)
{
- m_host.AddScriptLPS(1);
-
ISceneEntity entity = GetLinkEntity(m_host, linknum);
if (entity != null)
@@ -4667,7 +4438,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetInventoryNumber(int type)
{
- m_host.AddScriptLPS(1);
int count = 0;
m_host.TaskInventory.LockItemsForRead(true);
@@ -4685,7 +4455,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetInventoryName(int type, int number)
{
- m_host.AddScriptLPS(1);
ArrayList keys = new ArrayList();
m_host.TaskInventory.LockItemsForRead(true);
@@ -4712,15 +4481,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llGetEnergy()
{
- m_host.AddScriptLPS(1);
// TODO: figure out real energy value
return 1.0f;
}
public void llGiveInventory(string destination, string inventory)
{
- m_host.AddScriptLPS(1);
-
UUID destId = UUID.Zero;
if (!UUID.TryParse(destination, out destId))
@@ -4811,8 +4577,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
[DebuggerNonUserCode]
public void llRemoveInventory(string name)
{
- m_host.AddScriptLPS(1);
-
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
if (item == null)
@@ -4826,7 +4590,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetText(string text, LSL_Vector color, double alpha)
{
- m_host.AddScriptLPS(1);
Vector3 av3 = Util.Clip(color, 0.0f, 1.0f);
byte[] data;
data = Util.StringToBytes256(text);
@@ -4836,13 +4599,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llWater(LSL_Vector offset)
{
- m_host.AddScriptLPS(1);
return World.RegionInfo.RegionSettings.WaterHeight;
}
public void llPassTouches(int pass)
{
- m_host.AddScriptLPS(1);
if (pass != 0)
m_host.PassTouches = true;
else
@@ -4851,8 +4612,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llRequestAgentData(string id, int data)
{
- m_host.AddScriptLPS(1);
-
UUID uuid;
if (UUID.TryParse(id, out uuid))
{
@@ -4957,7 +4716,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AsyncCommands.
DataserverPlugin.DataserverReply(rq.ToString(), reply);
- ScriptSleep(m_sleepMsOnRequestAgentData);
return tid.ToString();
}
else
@@ -4969,8 +4727,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llRequestInventoryData(string name)
{
- m_host.AddScriptLPS(1);
-
foreach (TaskInventoryItem item in m_host.Inventory.GetInventoryItems())
{
if (item.Type == 3 && item.Name == name)
@@ -5007,13 +4763,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetDamage(double damage)
{
- m_host.AddScriptLPS(1);
m_host.ParentGroup.Damage = (float)damage;
}
public void llTeleportAgentHome(string agent)
{
- m_host.AddScriptLPS(1);
UUID agentId = new UUID();
if (UUID.TryParse(agent, out agentId))
{
@@ -5046,7 +4800,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt)
{
- m_host.AddScriptLPS(1);
UUID agentId = new UUID();
if (UUID.TryParse(agent, out agentId))
@@ -5089,7 +4842,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector targetPos, LSL_Vector targetLookAt)
{
- m_host.AddScriptLPS(1);
UUID agentId = new UUID();
ulong regionHandle = Util.RegionWorldLocToHandle((uint)global_coords.x, (uint)global_coords.y);
@@ -5154,7 +4906,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (dm == null)
return;
- m_host.AddScriptLPS(1);
UUID av = new UUID();
if (!UUID.TryParse(agent,out av))
{
@@ -5179,7 +4930,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llModifyLand(int action, int brush)
{
- m_host.AddScriptLPS(1);
ITerrainModule tm = m_ScriptEngine.World.RequestModuleInterface();
if (tm != null)
{
@@ -5189,8 +4939,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llCollisionSound(string impact_sound, double impact_volume)
{
- m_host.AddScriptLPS(1);
-
if(impact_sound == "")
{
m_host.CollisionSoundVolume = (float)impact_volume;
@@ -5217,7 +4965,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetAnimation(string id)
{
// This should only return a value if the avatar is in the same region
- m_host.AddScriptLPS(1);
UUID avatar = (UUID)id;
ScenePresence presence = World.GetScenePresence(avatar);
if (presence == null)
@@ -5245,8 +4992,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llMessageLinked(int linknumber, int num, string msg, string id)
{
- m_host.AddScriptLPS(1);
-
List parts = GetLinkParts(linknumber);
UUID partItemID;
@@ -5276,7 +5021,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local)
{
- m_host.AddScriptLPS(1);
bool pushrestricted = World.RegionInfo.RegionSettings.RestrictPushing;
bool pushAllowed = false;
@@ -5443,7 +5187,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llPassCollisions(int pass)
{
- m_host.AddScriptLPS(1);
if (pass == 0)
{
m_host.PassCollisions = false;
@@ -5456,15 +5199,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetScriptName()
{
- m_host.AddScriptLPS(1);
-
return m_item.Name != null ? m_item.Name : String.Empty;
}
public LSL_Integer llGetLinkNumberOfSides(int link)
{
- m_host.AddScriptLPS(1);
-
SceneObjectPart linkedPart;
if (link == ScriptBaseClass.LINK_ROOT)
@@ -5479,8 +5218,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetNumberOfSides()
{
- m_host.AddScriptLPS(1);
-
return m_host.GetNumberOfSides();
}
@@ -5518,8 +5255,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// q = cos(a/2) + i (x * sin(a/2)) + j (y * sin(a/2)) + k (z * sin(a/2))
public LSL_Rotation llAxisAngle2Rot(LSL_Vector axis, double angle)
{
- m_host.AddScriptLPS(1);
-
double x, y, z, s, t;
s = Math.Cos(angle * 0.5);
@@ -5539,8 +5274,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_Vector llRot2Axis(LSL_Rotation rot)
{
- m_host.AddScriptLPS(1);
-
rot.Normalize();
double s = Math.Sqrt(1 - rot.s * rot.s);
@@ -5557,8 +5290,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Returns the angle of a quaternion (see llRot2Axis for the axis)
public LSL_Float llRot2Angle(LSL_Rotation rot)
{
- m_host.AddScriptLPS(1);
-
rot.Normalize();
double angle = 2 * Math.Acos(rot.s);
@@ -5570,21 +5301,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llAcos(double val)
{
- m_host.AddScriptLPS(1);
return (double)Math.Acos(val);
}
public LSL_Float llAsin(double val)
{
- m_host.AddScriptLPS(1);
return (double)Math.Asin(val);
}
// jcochran 5/jan/2012
public LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b)
{
- m_host.AddScriptLPS(1);
-
double aa = (a.x * a.x + a.y * a.y + a.z * a.z + a.s * a.s);
double bb = (b.x * b.x + b.y * b.y + b.z * b.z + b.s * b.s);
double aa_bb = aa * bb;
@@ -5597,8 +5324,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetInventoryKey(string name)
{
- m_host.AddScriptLPS(1);
-
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
if (item == null)
@@ -5616,8 +5341,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llAllowInventoryDrop(int add)
{
- m_host.AddScriptLPS(1);
-
if (add != 0)
m_host.ParentGroup.RootPart.AllowedDrop = true;
else
@@ -5629,8 +5352,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetSunDirection()
{
- m_host.AddScriptLPS(1);
-
LSL_Vector SunDoubleVector3;
Vector3 SunFloatVector3;
@@ -5646,7 +5367,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetTextureOffset(int face)
{
- m_host.AddScriptLPS(1);
return GetTextureOffset(m_host, face);
}
@@ -5673,7 +5393,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetTextureScale(int side)
{
- m_host.AddScriptLPS(1);
Primitive.TextureEntry tex = m_host.Shape.Textures;
LSL_Vector scale;
if (side == -1)
@@ -5688,7 +5407,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llGetTextureRot(int face)
{
- m_host.AddScriptLPS(1);
return GetTextureRot(m_host, face);
}
@@ -5711,13 +5429,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llSubStringIndex(string source, string pattern)
{
- m_host.AddScriptLPS(1);
return source.IndexOf(pattern);
}
public LSL_String llGetOwnerKey(string id)
{
- m_host.AddScriptLPS(1);
UUID key = new UUID();
if (UUID.TryParse(id, out key))
{
@@ -5742,15 +5458,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetCenterOfMass()
{
- m_host.AddScriptLPS(1);
-
return new LSL_Vector(m_host.GetCenterOfMass());
}
public LSL_List llListSort(LSL_List src, int stride, int ascending)
{
- m_host.AddScriptLPS(1);
-
if (stride <= 0)
{
stride = 1;
@@ -5760,14 +5472,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetListLength(LSL_List src)
{
- m_host.AddScriptLPS(1);
-
return src.Length;
}
public LSL_Integer llList2Integer(LSL_List src, int index)
{
- m_host.AddScriptLPS(1);
if (index < 0)
index = src.Length + index;
@@ -5797,7 +5506,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llList2Float(LSL_List src, int index)
{
- m_host.AddScriptLPS(1);
if (index < 0)
index = src.Length + index;
@@ -5852,7 +5560,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llList2String(LSL_List src, int index)
{
- m_host.AddScriptLPS(1);
if (index < 0)
index = src.Length + index;
@@ -5864,7 +5571,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Key llList2Key(LSL_List src, int index)
{
- m_host.AddScriptLPS(1);
if (index < 0)
index = src.Length + index;
@@ -5892,7 +5598,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llList2Vector(LSL_List src, int index)
{
- m_host.AddScriptLPS(1);
if (index < 0)
index = src.Length + index;
@@ -5921,7 +5626,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Rotation llList2Rot(LSL_List src, int index)
{
- m_host.AddScriptLPS(1);
if (index < 0)
index = src.Length + index;
@@ -5948,7 +5652,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llList2List(LSL_List src, int start, int end)
{
- m_host.AddScriptLPS(1);
return src.GetSublist(start, end);
}
@@ -5959,7 +5662,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetListEntryType(LSL_List src, int index)
{
- m_host.AddScriptLPS(1);
if (index < 0)
{
index = src.Length + index;
@@ -6003,8 +5705,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_String llList2CSV(LSL_List src)
{
- m_host.AddScriptLPS(1);
-
return string.Join(", ",
(new List(src.Data)).ConvertAll(o =>
{
@@ -6028,8 +5728,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
int start = 0;
int length = 0;
- m_host.AddScriptLPS(1);
-
for (int i = 0; i < src.Length; i++)
{
switch (src[i])
@@ -6085,8 +5783,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
int chunkk;
int[] chunks;
- m_host.AddScriptLPS(1);
-
if (stride <= 0)
{
stride = 1;
@@ -6157,8 +5853,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
int[] ei = new int[2];
bool twopass = false;
- m_host.AddScriptLPS(1);
-
// First step is always to deal with negative indices
if (start < 0)
@@ -6238,8 +5932,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetRegionAgentCount()
{
- m_host.AddScriptLPS(1);
-
int count = 0;
World.ForEachRootScenePresence(delegate(ScenePresence sp) {
count++;
@@ -6250,13 +5942,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetRegionCorner()
{
- m_host.AddScriptLPS(1);
return new LSL_Vector(World.RegionInfo.WorldLocX, World.RegionInfo.WorldLocY, 0);
}
public LSL_String llGetEnv(LSL_String name)
{
- m_host.AddScriptLPS(1);
if (name == "agent_limit")
{
return World.RegionInfo.RegionSettings.AgentLimit.ToString();
@@ -6340,8 +6030,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_List pref;
LSL_List suff;
- m_host.AddScriptLPS(1);
-
if (index < 0)
{
index = index+dest.Length;
@@ -6394,8 +6082,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
int index = -1;
int length = src.Length - test.Length + 1;
- m_host.AddScriptLPS(1);
-
// If either list is empty, do not match
if (src.Length != 0 && test.Length != 0)
{
@@ -6435,19 +6121,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetObjectName()
{
- m_host.AddScriptLPS(1);
return m_host.Name !=null ? m_host.Name : String.Empty;
}
public void llSetObjectName(string name)
{
- m_host.AddScriptLPS(1);
m_host.Name = name != null ? name : String.Empty;
}
public LSL_String llGetDate()
{
- m_host.AddScriptLPS(1);
DateTime date = DateTime.Now.ToUniversalTime();
string result = date.ToString("yyyy-MM-dd");
return result;
@@ -6455,8 +6138,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llEdgeOfWorld(LSL_Vector pos, LSL_Vector dir)
{
- m_host.AddScriptLPS(1);
-
if(dir.x == 0 && dir.y == 0)
return 1; // SL wiki
@@ -6522,8 +6203,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_Integer llGetAgentInfo(string id)
{
- m_host.AddScriptLPS(1);
-
UUID key = new UUID();
if (!UUID.TryParse(id, out key))
{
@@ -6630,7 +6309,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetAgentLanguage(string id)
{
// This should only return a value if the avatar is in the same region, but eh. idc.
- m_host.AddScriptLPS(1);
if (World.AgentPreferencesService == null)
{
Error("llGetAgentLanguage", "No AgentPreferencesService present");
@@ -6657,8 +6335,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_List llGetAgentList(LSL_Integer scope, LSL_List options)
{
- m_host.AddScriptLPS(1);
-
// do our bit masks part
bool noNPC = (scope & ScriptBaseClass.AGENT_LIST_EXCLUDENPC) !=0;
@@ -6740,20 +6416,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llAdjustSoundVolume(double volume)
{
- m_host.AddScriptLPS(1);
m_host.AdjustSoundGain(volume);
ScriptSleep(m_sleepMsOnAdjustSoundVolume);
}
public void llSetSoundRadius(double radius)
{
- m_host.AddScriptLPS(1);
m_host.SoundRadius = radius;
}
public LSL_String llKey2Name(string id)
{
- m_host.AddScriptLPS(1);
UUID key = new UUID();
if (UUID.TryParse(id,out key))
{
@@ -6777,15 +6450,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate)
{
- m_host.AddScriptLPS(1);
-
SetTextureAnim(m_host, mode, face, sizex, sizey, start, length, rate);
}
public void llSetLinkTextureAnim(int linknumber, int mode, int face, int sizex, int sizey, double start, double length, double rate)
{
- m_host.AddScriptLPS(1);
-
List parts = GetLinkParts(linknumber);
try
@@ -6825,7 +6494,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east,
LSL_Vector bottom_south_west)
{
- m_host.AddScriptLPS(1);
if (m_SoundModule != null)
{
m_SoundModule.TriggerSoundLimited(m_host.UUID,
@@ -6836,7 +6504,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llEjectFromLand(string pest)
{
- m_host.AddScriptLPS(1);
UUID agentID = new UUID();
if (UUID.TryParse(pest, out agentID))
{
@@ -6866,7 +6533,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llOverMyLand(string id)
{
- m_host.AddScriptLPS(1);
UUID key = new UUID();
if (UUID.TryParse(id, out key))
{
@@ -6893,7 +6559,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetLandOwnerAt(LSL_Vector pos)
{
- m_host.AddScriptLPS(1);
ILandObject land = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y);
if (land == null)
return UUID.Zero.ToString();
@@ -6907,7 +6572,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_Vector llGetAgentSize(string id)
{
- m_host.AddScriptLPS(1);
ScenePresence avatar = World.GetScenePresence((UUID)id);
LSL_Vector agentSize;
if (avatar == null || avatar.IsChildAgent) // Fail if not in the same region
@@ -6925,7 +6589,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llSameGroup(string id)
{
- m_host.AddScriptLPS(1);
UUID uuid = new UUID();
if (!UUID.TryParse(id, out uuid))
return new LSL_Integer(0);
@@ -6973,8 +6636,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llUnSit(string id)
{
- m_host.AddScriptLPS(1);
-
UUID key = new UUID();
if (UUID.TryParse(id, out key))
{
@@ -7014,8 +6675,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGroundSlope(LSL_Vector offset)
{
- m_host.AddScriptLPS(1);
-
//Get the slope normal. This gives us the equation of the plane tangent to the slope.
LSL_Vector vsn = llGroundNormal(offset);
@@ -7035,7 +6694,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGroundNormal(LSL_Vector offset)
{
- m_host.AddScriptLPS(1);
Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset;
// Clamp to valid position
if (pos.X < 0)
@@ -7085,21 +6743,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGroundContour(LSL_Vector offset)
{
- m_host.AddScriptLPS(1);
LSL_Vector x = llGroundSlope(offset);
return new LSL_Vector(-x.y, x.x, 0.0);
}
public LSL_Integer llGetAttached()
{
- m_host.AddScriptLPS(1);
return m_host.ParentGroup.AttachmentPoint;
}
public LSL_List llGetAttachedList(string id)
{
- m_host.AddScriptLPS(1);
-
ScenePresence av = World.GetScenePresence((UUID)id);
if (av == null || av.IsDeleted)
@@ -7125,14 +6779,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public virtual LSL_Integer llGetFreeMemory()
{
- m_host.AddScriptLPS(1);
// Make scripts designed for Mono happy
return 65536;
}
public LSL_Integer llGetFreeURLs()
{
- m_host.AddScriptLPS(1);
if (m_UrlModule != null)
return new LSL_Integer(m_UrlModule.GetFreeUrls());
return new LSL_Integer(0);
@@ -7141,13 +6793,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetRegionName()
{
- m_host.AddScriptLPS(1);
return World.RegionInfo.RegionName;
}
public LSL_Float llGetRegionTimeDilation()
{
- m_host.AddScriptLPS(1);
return (double)World.TimeDilation;
}
@@ -7156,7 +6806,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_Float llGetRegionFPS()
{
- m_host.AddScriptLPS(1);
return World.StatsReporter.LastReportedSimFPS;
}
@@ -7234,8 +6883,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llLinkParticleSystem(int linknumber, LSL_List rules)
{
- m_host.AddScriptLPS(1);
-
List parts = GetLinkParts(linknumber);
foreach (SceneObjectPart part in parts)
@@ -7246,7 +6893,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llParticleSystem(LSL_List rules)
{
- m_host.AddScriptLPS(1);
SetParticleSystem(m_host, rules, "llParticleSystem");
}
@@ -7663,7 +7309,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llGroundRepel(double height, int water, double tau)
{
- m_host.AddScriptLPS(1);
if (m_host.PhysActor != null)
{
float ground = (float)llGround(new LSL_Types.Vector3(0, 0, 0));
@@ -7688,8 +7333,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llGiveInventoryList(string destination, string category, LSL_List inventory)
{
- m_host.AddScriptLPS(1);
-
UUID destID;
if (!UUID.TryParse(destination, out destID))
return;
@@ -7743,8 +7386,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetVehicleType(int type)
{
- m_host.AddScriptLPS(1);
-
if (!m_host.ParentGroup.IsDeleted)
{
m_host.ParentGroup.RootPart.SetVehicleType(type);
@@ -7755,8 +7396,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//CFK 9/28: so these are not complete yet.
public void llSetVehicleFloatParam(int param, LSL_Float value)
{
- m_host.AddScriptLPS(1);
-
if (!m_host.ParentGroup.IsDeleted)
{
m_host.ParentGroup.RootPart.SetVehicleFloatParam(param, (float)value);
@@ -7767,8 +7406,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//CFK 9/28: so these are not complete yet.
public void llSetVehicleVectorParam(int param, LSL_Vector vec)
{
- m_host.AddScriptLPS(1);
-
if (!m_host.ParentGroup.IsDeleted)
{
m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, vec);
@@ -7779,8 +7416,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//CFK 9/28: so these are not complete yet.
public void llSetVehicleRotationParam(int param, LSL_Rotation rot)
{
- m_host.AddScriptLPS(1);
-
if (!m_host.ParentGroup.IsDeleted)
{
m_host.ParentGroup.RootPart.SetVehicleRotationParam(param, rot);
@@ -7789,8 +7424,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetVehicleFlags(int flags)
{
- m_host.AddScriptLPS(1);
-
if (!m_host.ParentGroup.IsDeleted)
{
m_host.ParentGroup.RootPart.SetVehicleFlags(flags, false);
@@ -7799,8 +7432,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llRemoveVehicleFlags(int flags)
{
- m_host.AddScriptLPS(1);
-
if (!m_host.ParentGroup.IsDeleted)
{
m_host.ParentGroup.RootPart.SetVehicleFlags(flags, true);
@@ -7820,13 +7451,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
{
- m_host.AddScriptLPS(1);
SitTarget(m_host, offset, rot);
}
public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
{
- m_host.AddScriptLPS(1);
if (link == ScriptBaseClass.LINK_ROOT)
SitTarget(m_host.ParentGroup.RootPart, offset, rot);
else if (link == ScriptBaseClass.LINK_THIS)
@@ -7843,14 +7472,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llAvatarOnSitTarget()
{
- m_host.AddScriptLPS(1);
return m_host.SitTargetAvatar.ToString();
}
// http://wiki.secondlife.com/wiki/LlAvatarOnLinkSitTarget
public LSL_String llAvatarOnLinkSitTarget(int linknum)
{
- m_host.AddScriptLPS(1);
if(linknum == ScriptBaseClass.LINK_SET ||
linknum == ScriptBaseClass.LINK_ALL_CHILDREN ||
linknum == ScriptBaseClass.LINK_ALL_OTHERS ||
@@ -7866,7 +7493,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llAddToLandPassList(string avatar, double hours)
{
- m_host.AddScriptLPS(1);
UUID key;
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
@@ -7903,24 +7529,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
}
}
- ScriptSleep(m_sleepMsOnAddToLandPassList);
}
public void llSetTouchText(string text)
{
- m_host.AddScriptLPS(1);
m_host.TouchName = text;
}
public void llSetSitText(string text)
{
- m_host.AddScriptLPS(1);
m_host.SitName = text;
}
public void llSetCameraEyeOffset(LSL_Vector offset)
{
- m_host.AddScriptLPS(1);
m_host.SetCameraEyeOffset(offset);
if (m_host.ParentGroup.RootPart.GetCameraEyeOffset() == Vector3.Zero)
@@ -7929,7 +7551,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetCameraAtOffset(LSL_Vector offset)
{
- m_host.AddScriptLPS(1);
m_host.SetCameraAtOffset(offset);
if (m_host.ParentGroup.RootPart.GetCameraAtOffset() == Vector3.Zero)
@@ -7938,8 +7559,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at)
{
- m_host.AddScriptLPS(1);
-
if (link == ScriptBaseClass.LINK_SET ||
link == ScriptBaseClass.LINK_ALL_CHILDREN ||
link == ScriptBaseClass.LINK_ALL_OTHERS) return;
@@ -7968,7 +7587,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llDumpList2String(LSL_List src, string seperator)
{
- m_host.AddScriptLPS(1);
if (src.Length == 0)
{
return String.Empty;
@@ -7984,7 +7602,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llScriptDanger(LSL_Vector pos)
{
- m_host.AddScriptLPS(1);
bool result = World.LSLScriptDanger(m_host, pos);
if (result)
{
@@ -8003,7 +7620,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (dm == null)
return;
- m_host.AddScriptLPS(1);
UUID av = new UUID();
if (!UUID.TryParse(avatar,out av))
{
@@ -8059,29 +7675,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llVolumeDetect(int detect)
{
- m_host.AddScriptLPS(1);
-
if (!m_host.ParentGroup.IsDeleted)
m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0);
}
public void llRemoteLoadScript(string target, string name, int running, int start_param)
{
- m_host.AddScriptLPS(1);
Deprecated("llRemoteLoadScript", "Use llRemoteLoadScriptPin instead");
ScriptSleep(m_sleepMsOnRemoteLoadScript);
}
public void llSetRemoteScriptAccessPin(int pin)
{
- m_host.AddScriptLPS(1);
m_host.ScriptAccessPin = pin;
}
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))
@@ -8124,7 +7734,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llOpenRemoteDataChannel()
{
- m_host.AddScriptLPS(1);
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface();
if (xmlrpcMod != null && xmlrpcMod.IsEnabled())
{
@@ -8155,7 +7764,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llSendRemoteData(string channel, string dest, int idata, string sdata)
{
- m_host.AddScriptLPS(1);
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface();
ScriptSleep(m_sleepMsOnSendRemoteData);
if (xmlrpcMod == null)
@@ -8165,7 +7773,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llRemoteDataReply(string channel, string message_id, string sdata, int idata)
{
- m_host.AddScriptLPS(1);
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface();
if (xmlrpcMod != null)
xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
@@ -8174,8 +7781,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llCloseRemoteDataChannel(string channel)
{
- m_host.AddScriptLPS(1);
-
IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface();
if (xmlRpcRouter != null)
{
@@ -8190,13 +7795,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llMD5String(string src, int nonce)
{
- m_host.AddScriptLPS(1);
return Util.Md5Hash(String.Format("{0}:{1}", src, nonce.ToString()), Encoding.UTF8);
}
public LSL_String llSHA1String(string src)
{
- m_host.AddScriptLPS(1);
return Util.SHA1Hash(src, Encoding.UTF8).ToLower();
}
@@ -8588,8 +8191,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetPrimitiveParams(LSL_List rules)
{
- m_host.AddScriptLPS(1);
-
SetLinkPrimParams(ScriptBaseClass.LINK_THIS, rules, "llSetPrimitiveParams");
ScriptSleep(m_sleepMsOnSetPrimitiveParams);
@@ -8597,8 +8198,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
{
- m_host.AddScriptLPS(1);
-
SetLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParams");
ScriptSleep(m_sleepMsOnSetLinkPrimitiveParams);
@@ -8606,8 +8205,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
{
- m_host.AddScriptLPS(1);
-
SetLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast");
}
@@ -10359,7 +9956,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llStringToBase64(string str)
{
- m_host.AddScriptLPS(1);
try
{
byte[] encData_byte;
@@ -10376,7 +9972,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llBase64ToString(string str)
{
- m_host.AddScriptLPS(1);
try
{
byte[] b = Convert.FromBase64String(str);
@@ -10396,8 +9991,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
ScriptSleep(300);
- m_host.AddScriptLPS(1);
-
if (str1 == String.Empty)
return String.Empty;
if (str2 == String.Empty)
@@ -10493,26 +10086,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llRemoteDataSetRegion()
{
- m_host.AddScriptLPS(1);
Deprecated("llRemoteDataSetRegion", "Use llOpenRemoteDataChannel instead");
}
public LSL_Float llLog10(double val)
{
- m_host.AddScriptLPS(1);
return (double)Math.Log10(val);
}
public LSL_Float llLog(double val)
{
- m_host.AddScriptLPS(1);
return (double)Math.Log(val);
}
public LSL_List llGetAnimationList(string id)
{
- m_host.AddScriptLPS(1);
-
LSL_List l = new LSL_List();
ScenePresence av = World.GetScenePresence((UUID)id);
if (av == null || av.IsChildAgent) // only if in the region
@@ -10526,8 +10114,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetParcelMusicURL(string url)
{
- m_host.AddScriptLPS(1);
-
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
if (land.LandData.OwnerID != m_host.OwnerID)
@@ -10540,8 +10126,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetParcelMusicURL()
{
- m_host.AddScriptLPS(1);
-
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
if (land.LandData.OwnerID != m_host.OwnerID)
@@ -10552,8 +10136,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetRootPosition()
{
- m_host.AddScriptLPS(1);
-
return new LSL_Vector(m_host.ParentGroup.AbsolutePosition);
}
@@ -10568,7 +10150,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_Rotation llGetRootRotation()
{
- m_host.AddScriptLPS(1);
Quaternion q;
if (m_host.ParentGroup.AttachmentPoint != 0)
{
@@ -10594,26 +10175,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetObjectDesc(string desc)
{
- m_host.AddScriptLPS(1);
m_host.Description = desc!=null?desc:String.Empty;
}
public LSL_String llGetCreator()
{
- m_host.AddScriptLPS(1);
return m_host.CreatorID.ToString();
}
public LSL_String llGetTimestamp()
{
- m_host.AddScriptLPS(1);
return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
}
public LSL_Integer llGetNumberOfPrims()
{
- m_host.AddScriptLPS(1);
-
return m_host.ParentGroup.PrimCount + m_host.ParentGroup.GetSittingAvatarsCount();
}
@@ -10630,7 +10206,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_List llGetBoundingBox(string obj)
{
- m_host.AddScriptLPS(1);
UUID objID = UUID.Zero;
LSL_List result = new LSL_List();
@@ -10796,8 +10371,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llGetPrimitiveParams(LSL_List rules)
{
- m_host.AddScriptLPS(1);
-
LSL_List result = new LSL_List();
LSL_List remaining = GetPrimParams(m_host, rules, ref result);
@@ -10817,8 +10390,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules)
{
- m_host.AddScriptLPS(1);
-
// acording to SL wiki this must indicate a single link number or link_root or link_this.
// keep other options as before
@@ -11468,14 +11039,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llGetPrimMediaParams(int face, LSL_List rules)
{
- m_host.AddScriptLPS(1);
ScriptSleep(m_sleepMsOnGetPrimMediaParams);
return GetPrimMediaParams(m_host, face, rules);
}
public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
{
- m_host.AddScriptLPS(1);
ScriptSleep(m_sleepMsOnGetLinkMedia);
if (link == ScriptBaseClass.LINK_ROOT)
return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
@@ -11595,14 +11164,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules)
{
- m_host.AddScriptLPS(1);
ScriptSleep(m_sleepMsOnSetPrimMediaParams);
return SetPrimMediaParams(m_host, face, rules);
}
public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
{
- m_host.AddScriptLPS(1);
ScriptSleep(m_sleepMsOnSetLinkMedia);
if (link == ScriptBaseClass.LINK_ROOT)
return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
@@ -11721,14 +11288,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llClearPrimMedia(LSL_Integer face)
{
- m_host.AddScriptLPS(1);
ScriptSleep(m_sleepMsOnClearPrimMedia);
return ClearPrimMedia(m_host, face);
}
public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
{
- m_host.AddScriptLPS(1);
ScriptSleep(m_sleepMsOnClearLinkMedia);
if (link == ScriptBaseClass.LINK_ROOT)
return ClearPrimMedia(m_host.ParentGroup.RootPart, face);
@@ -11894,8 +11459,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
char[] imdt = new char[8];
- m_host.AddScriptLPS(1);
-
// Manually unroll the loop
imdt[7] = '=';
@@ -11956,8 +11519,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
int number = 0;
int digit;
- m_host.AddScriptLPS(1);
-
// Require a well-fromed base64 string
if (str.Length > 8)
@@ -12013,14 +11574,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llGetGMTclock()
{
- m_host.AddScriptLPS(1);
return DateTime.UtcNow.TimeOfDay.TotalSeconds;
}
public LSL_String llGetHTTPHeader(LSL_Key request_id, string header)
{
- m_host.AddScriptLPS(1);
-
if (m_UrlModule != null)
return m_UrlModule.GetHttpHeader(new UUID(request_id), header);
return String.Empty;
@@ -12029,7 +11587,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetSimulatorHostname()
{
- m_host.AddScriptLPS(1);
IUrlModule UrlModule = World.RequestModuleInterface();
return UrlModule.ExternalHostNameForLSL;
}
@@ -12103,8 +11660,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
int i, j;
string d;
- m_host.AddScriptLPS(1);
-
/*
* Convert separator and spacer lists to C# strings.
* Also filter out null strings so we don't hang.
@@ -12200,8 +11755,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetObjectPermMask(int mask)
{
- m_host.AddScriptLPS(1);
-
int permmask = 0;
if (mask == ScriptBaseClass.MASK_BASE)//0
@@ -12234,8 +11787,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetObjectPermMask(int mask, int value)
{
- m_host.AddScriptLPS(1);
-
if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false))
{
if (World.Permissions.IsAdministrator(m_host.OwnerID))
@@ -12270,8 +11821,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetInventoryPermMask(string itemName, int mask)
{
- m_host.AddScriptLPS(1);
-
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName);
if (item == null)
@@ -12296,8 +11845,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetInventoryPermMask(string itemName, int mask, int value)
{
- m_host.AddScriptLPS(1);
-
if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false))
{
if (World.Permissions.IsAdministrator(m_host.OwnerID))
@@ -12331,8 +11878,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetInventoryCreator(string itemName)
{
- m_host.AddScriptLPS(1);
-
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName);
if (item == null)
@@ -12347,8 +11892,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llOwnerSay(string msg)
{
- m_host.AddScriptLPS(1);
-
World.SimChatBroadcast(Utils.StringToBytes(msg), ChatTypeEnum.Owner, 0,
m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
// IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface();
@@ -12357,7 +11900,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llRequestSecureURL()
{
- m_host.AddScriptLPS(1);
if (m_UrlModule != null)
return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, null).ToString();
return UUID.Zero.ToString();
@@ -12369,8 +11911,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
try
{
- m_host.AddScriptLPS(1);
-
string reply = String.Empty;
GridRegion info;
@@ -12474,8 +12014,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llRequestURL()
{
- m_host.AddScriptLPS(1);
-
if (m_UrlModule != null)
return m_UrlModule.RequestURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, null).ToString();
return UUID.Zero.ToString();
@@ -12483,13 +12021,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llForceMouselook(int mouselook)
{
- m_host.AddScriptLPS(1);
m_host.SetForceMouselook(mouselook != 0);
}
public LSL_Float llGetObjectMass(string id)
{
- m_host.AddScriptLPS(1);
UUID key = new UUID();
if (UUID.TryParse(id, out key))
{
@@ -12533,8 +12069,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
LSL_List pref;
- m_host.AddScriptLPS(1);
-
// Note that although we have normalized, both
// indices could still be negative.
if (start < 0)
@@ -12604,8 +12138,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llLoadURL(string avatar_id, string message, string url)
{
- m_host.AddScriptLPS(1);
-
IDialogModule dm = World.RequestModuleInterface();
if (null != dm)
dm.SendUrlToUser(
@@ -12619,8 +12151,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// TODO: Not implemented yet (missing in libomv?):
// PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later)
- m_host.AddScriptLPS(1);
-
// according to the docs, this command only works if script owner and land owner are the same
// lets add estate owners and gods, too, and use the generic permission check.
ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
@@ -12857,7 +12387,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llParcelMediaQuery(LSL_List aList)
{
- m_host.AddScriptLPS(1);
LSL_List list = new LSL_List();
//TO DO: make the implementation for the missing commands
//PARCEL_MEDIA_COMMAND_LOOP_SET float loop Use this to get or set the parcel's media loop duration. (1.19.1 RC0 or later)
@@ -12898,7 +12427,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llModPow(int a, int b, int c)
{
- m_host.AddScriptLPS(1);
Int64 tmp = 0;
Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp);
ScriptSleep(m_sleepMsOnModPow);
@@ -12907,8 +12435,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetInventoryType(string name)
{
- m_host.AddScriptLPS(1);
-
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
if (item == null)
@@ -12919,8 +12445,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetPayPrice(int price, LSL_List quick_pay_buttons)
{
- m_host.AddScriptLPS(1);
-
if (quick_pay_buttons.Data.Length < 4)
{
int x;
@@ -12941,8 +12465,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetCameraPos()
{
- m_host.AddScriptLPS(1);
-
if (m_item.PermsGranter == UUID.Zero)
return Vector3.Zero;
@@ -12965,8 +12487,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Rotation llGetCameraRot()
{
- m_host.AddScriptLPS(1);
-
if (m_item.PermsGranter == UUID.Zero)
return Quaternion.Identity;
@@ -12988,21 +12508,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetPrimURL(string url)
{
- m_host.AddScriptLPS(1);
Deprecated("llSetPrimURL", "Use llSetPrimMediaParams instead");
ScriptSleep(m_sleepMsOnSetPrimURL);
}
public void llRefreshPrimURL()
{
- m_host.AddScriptLPS(1);
Deprecated("llRefreshPrimURL");
ScriptSleep(m_sleepMsOnRefreshPrimURL);
}
public LSL_String llEscapeURL(string url)
{
- m_host.AddScriptLPS(1);
try
{
return Uri.EscapeDataString(url);
@@ -13015,7 +12532,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llUnescapeURL(string url)
{
- m_host.AddScriptLPS(1);
try
{
return Uri.UnescapeDataString(url);
@@ -13028,7 +12544,6 @@ 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_item.ItemID, 0);
if (detectedParams == null)
{
@@ -13054,7 +12569,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llAddToLandBanList(string avatar, double hours)
{
- m_host.AddScriptLPS(1);
UUID key;
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false))
@@ -13095,7 +12609,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llRemoveFromLandPassList(string avatar)
{
- m_host.AddScriptLPS(1);
UUID key;
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManagePasses, false))
@@ -13122,7 +12635,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llRemoveFromLandBanList(string avatar)
{
- m_host.AddScriptLPS(1);
UUID key;
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false))
@@ -13149,8 +12661,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetCameraParams(LSL_List rules)
{
- m_host.AddScriptLPS(1);
-
// the object we are in
UUID objectID = m_host.ParentUUID;
if (objectID == UUID.Zero)
@@ -13276,8 +12786,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llClearCameraParams()
{
- m_host.AddScriptLPS(1);
-
// the object we are in
UUID objectID = m_host.ParentUUID;
if (objectID == UUID.Zero)
@@ -13303,7 +12811,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llListStatistics(int operation, LSL_List src)
{
- m_host.AddScriptLPS(1);
switch (operation)
{
case ScriptBaseClass.LIST_STAT_RANGE:
@@ -13335,19 +12842,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetUnixTime()
{
- m_host.AddScriptLPS(1);
return Util.UnixTimeSinceEpoch();
}
public LSL_Integer llGetParcelFlags(LSL_Vector pos)
{
- m_host.AddScriptLPS(1);
return (int)World.LandChannel.GetLandObject((float)pos.x, (float)pos.y).LandData.Flags;
}
public LSL_Integer llGetRegionFlags()
{
- m_host.AddScriptLPS(1);
IEstateModule estate = World.RequestModuleInterface();
if (estate == null)
return 67108864;
@@ -13356,8 +12860,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llXorBase64StringsCorrect(string str1, string str2)
{
- m_host.AddScriptLPS(1);
-
if (str1 == String.Empty)
return String.Empty;
if (str2 == String.Empty)
@@ -13425,7 +12927,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// parameter flags support are implemented in ScriptsHttpRequests.cs
// in StartHttpRequest
- m_host.AddScriptLPS(1);
IHttpRequestModule httpScriptMod =
m_ScriptEngine.World.RequestModuleInterface();
List param = new List();
@@ -13616,15 +13117,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Partial implementation: support for parameter flags needed
// see http://wiki.secondlife.com/wiki/llHTTPResponse
- m_host.AddScriptLPS(1);
-
if (m_UrlModule != null)
m_UrlModule.HttpResponse(new UUID(id), status,body);
}
public void llResetLandBanList()
{
- m_host.AddScriptLPS(1);
LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData;
if (land.OwnerID == m_host.OwnerID)
{
@@ -13641,7 +13139,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llResetLandPassList()
{
- m_host.AddScriptLPS(1);
LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData;
if (land.OwnerID == m_host.OwnerID)
{
@@ -13658,8 +13155,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide)
{
- m_host.AddScriptLPS(1);
-
ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y);
if (lo == null)
@@ -13700,7 +13195,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llGetParcelPrimOwners(LSL_Vector pos)
{
- m_host.AddScriptLPS(1);
LandObject land = (LandObject)World.LandChannel.GetLandObject((float)pos.x, (float)pos.y);
LSL_List ret = new LSL_List();
if (land != null)
@@ -13717,7 +13211,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetObjectPrimCount(string object_id)
{
- m_host.AddScriptLPS(1);
SceneObjectPart part = World.GetSceneObjectPart(new UUID(object_id));
if (part == null)
{
@@ -13731,8 +13224,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide)
{
- m_host.AddScriptLPS(1);
-
ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y);
if (lo == null)
@@ -13746,7 +13237,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param)
{
- m_host.AddScriptLPS(1);
LandData land = World.GetLandData(pos);
if (land == null)
{
@@ -13785,7 +13275,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llStringTrim(string src, int type)
{
- m_host.AddScriptLPS(1);
if (type == (int)ScriptBaseClass.STRING_TRIM_HEAD) { return src.TrimStart(); }
if (type == (int)ScriptBaseClass.STRING_TRIM_TAIL) { return src.TrimEnd(); }
if (type == (int)ScriptBaseClass.STRING_TRIM) { return src.Trim(); }
@@ -13794,8 +13283,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llGetObjectDetails(string id, LSL_List args)
{
- m_host.AddScriptLPS(1);
-
LSL_List ret = new LSL_List();
UUID key = new UUID();
@@ -14276,8 +13763,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetNumberOfNotecardLines(string name)
{
- m_host.AddScriptLPS(1);
-
UUID assetID = UUID.Zero;
if (!UUID.TryParse(name, out assetID))
@@ -14327,8 +13812,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetNotecardLine(string name, int line)
{
- m_host.AddScriptLPS(1);
-
UUID assetID = UUID.Zero;
if (!UUID.TryParse(name, out assetID))
@@ -14801,8 +14284,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_List list = new LSL_List();
- m_host.AddScriptLPS(1);
-
Vector3 rayStart = start;
Vector3 rayEnd = end;
Vector3 dir = rayEnd - rayStart;
@@ -15022,7 +14503,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_List llCastRayV3(LSL_Vector start, LSL_Vector end, LSL_List options)
{
- m_host.AddScriptLPS(1);
LSL_List result = new LSL_List();
// Prepare throttle data
@@ -15874,7 +15354,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llManageEstateAccess(int action, string avatar)
{
- m_host.AddScriptLPS(1);
EstateSettings estate = World.RegionInfo.EstateSettings;
bool isAccount = false;
bool isGroup = false;
@@ -15943,35 +15422,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetMemoryLimit()
{
- m_host.AddScriptLPS(1);
// The value returned for Mono scripts in SL
return 65536;
}
public LSL_Integer llSetMemoryLimit(LSL_Integer limit)
{
- m_host.AddScriptLPS(1);
// Treat as an LSO script
return ScriptBaseClass.FALSE;
}
public LSL_Integer llGetSPMaxMemory()
{
- m_host.AddScriptLPS(1);
// The value returned for Mono scripts in SL
return 65536;
}
public virtual LSL_Integer llGetUsedMemory()
{
- m_host.AddScriptLPS(1);
// The value returned for Mono scripts in SL
return 65536;
}
public void llScriptProfiler(LSL_Integer flags)
{
- m_host.AddScriptLPS(1);
// This does nothing for LSO scripts in SL
}
@@ -15983,23 +15457,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetSoundQueueing(int queue)
{
- m_host.AddScriptLPS(1);
-
if (m_SoundModule != null)
m_SoundModule.SetSoundQueueing(m_host.UUID, queue == ScriptBaseClass.TRUE.value);
}
public void llCollisionSprite(string impact_sprite)
{
- m_host.AddScriptLPS(1);
// Viewer 2.0 broke this and it's likely LL has no intention
// of fixing it. Therefore, letting this be a NOP seems appropriate.
}
public void llGodLikeRezObject(string inventory, LSL_Vector pos)
{
- m_host.AddScriptLPS(1);
-
if (!World.Permissions.IsGod(m_host.OwnerID))
NotImplemented("llGodLikeRezObject");
@@ -16080,8 +15549,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
- m_host.AddScriptLPS(1);
-
if (item.PermsGranter == UUID.Zero)
{
replydata = "MISSING_PERMISSION_DEBIT";
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index 238fefb..e50b7fd 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -120,7 +120,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return new LSL_List();
}
- m_host.AddScriptLPS(1);
RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
LSL_List values = new LSL_List();
@@ -729,7 +728,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
int success = 0;
- m_host.AddScriptLPS(1);
if (LightShareModule.EnableWindlight)
{
@@ -807,7 +805,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
int success = 0;
- m_host.AddScriptLPS(1);
if (LightShareModule.EnableWindlight)
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 5c03191..2c025c1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -264,7 +264,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// for safe funtions always active
public void CheckThreatLevel()
{
- m_host.AddScriptLPS(1);
if (!m_OSFunctionsEnabled)
OSSLError(String.Format("{0} permission denied. All OS functions are disabled.")); // throws
}
@@ -272,7 +271,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Returns if the function is allowed. Throws a script exception if not allowed.
public void CheckThreatLevel(ThreatLevel level, string function)
{
- m_host.AddScriptLPS(1);
if (!m_OSFunctionsEnabled)
OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws
@@ -1811,7 +1809,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// the user does not have permission to see it. This as opposed to
// throwing an exception.
- m_host.AddScriptLPS(1);
string ret = String.Empty;
// if (String.IsNullOrEmpty(CheckThreatLevelTest(ThreatLevel.High, "osGetPhysicsEngineType")))
{
--
cgit v1.1
From c568d4c16b75615dd10b253cad5cd2fd710e2fb9 Mon Sep 17 00:00:00 2001
From: onefang
Date: Sun, 19 May 2019 22:54:18 +1000
Subject: One last big source of script slowness removed.
No need to artificially slow stuff down. lol
---
.../Shared/Api/Implementation/LSL_Api.cs | 158 +--------------------
.../Shared/Api/Implementation/OSSL_Api.cs | 37 +----
2 files changed, 14 insertions(+), 181 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 3a3703c..ecaa672 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -109,7 +109,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected bool throwErrorOnNotImplemented = false;
protected AsyncCommandManager AsyncCommands = null;
- protected float m_ScriptDelayFactor = 1.0f;
protected float m_ScriptDistanceFactor = 1.0f;
protected float m_MinTimerInterval = 0.5f;
protected float m_recoilScaleFactor = 0.0f;
@@ -126,64 +125,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected Dictionary m_userInfoCache = new Dictionary();
protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
- protected int m_sleepMsOnSetTexture = 200;
- protected int m_sleepMsOnSetLinkTexture = 200;
- protected int m_sleepMsOnScaleTexture = 200;
- protected int m_sleepMsOnOffsetTexture = 200;
- protected int m_sleepMsOnRotateTexture = 200;
- protected int m_sleepMsOnSetPos = 200;
- protected int m_sleepMsOnSetRot = 200;
- protected int m_sleepMsOnSetLocalRot = 200;
- protected int m_sleepMsOnPreloadSound = 1000;
- protected int m_sleepMsOnMakeExplosion = 100;
- protected int m_sleepMsOnMakeFountain = 100;
- protected int m_sleepMsOnMakeSmoke = 100;
- protected int m_sleepMsOnMakeFire = 100;
- protected int m_sleepMsOnRezAtRoot = 100;
- protected int m_sleepMsOnInstantMessage = 2000;
- protected int m_sleepMsOnEmail = 20000;
- protected int m_sleepMsOnCreateLink = 1000;
- protected int m_sleepMsOnGiveInventory = 3000;
- protected int m_sleepMsOnRequestAgentData = 100;
- protected int m_sleepMsOnRequestInventoryData = 1000;
- protected int m_sleepMsOnSetDamage = 5000;
- protected int m_sleepMsOnTextBox = 1000;
- protected int m_sleepMsOnAdjustSoundVolume = 100;
- protected int m_sleepMsOnEjectFromLand = 5000;
- protected int m_sleepMsOnAddToLandPassList = 100;
- protected int m_sleepMsOnDialog = 1000;
- protected int m_sleepMsOnRemoteLoadScript = 3000;
- protected int m_sleepMsOnRemoteLoadScriptPin = 3000;
- protected int m_sleepMsOnOpenRemoteDataChannel = 1000;
- protected int m_sleepMsOnSendRemoteData = 3000;
- protected int m_sleepMsOnRemoteDataReply = 3000;
- protected int m_sleepMsOnCloseRemoteDataChannel = 1000;
- protected int m_sleepMsOnSetPrimitiveParams = 200;
- protected int m_sleepMsOnSetLinkPrimitiveParams = 200;
- protected int m_sleepMsOnXorBase64Strings = 300;
- protected int m_sleepMsOnSetParcelMusicURL = 2000;
- protected int m_sleepMsOnGetPrimMediaParams = 1000;
- protected int m_sleepMsOnGetLinkMedia = 1000;
- protected int m_sleepMsOnSetPrimMediaParams = 1000;
- protected int m_sleepMsOnSetLinkMedia = 1000;
- protected int m_sleepMsOnClearPrimMedia = 1000;
- protected int m_sleepMsOnClearLinkMedia = 1000;
- protected int m_sleepMsOnRequestSimulatorData = 1000;
- protected int m_sleepMsOnLoadURL = 10000;
- protected int m_sleepMsOnParcelMediaCommandList = 2000;
- protected int m_sleepMsOnParcelMediaQuery = 2000;
- protected int m_sleepMsOnModPow = 1000;
- protected int m_sleepMsOnSetPrimURL = 2000;
- protected int m_sleepMsOnRefreshPrimURL = 20000;
- protected int m_sleepMsOnMapDestination = 1000;
- protected int m_sleepMsOnAddToLandBanList = 100;
- protected int m_sleepMsOnRemoveFromLandPassList = 100;
- protected int m_sleepMsOnRemoveFromLandBanList = 100;
- protected int m_sleepMsOnResetLandBanList = 100;
- protected int m_sleepMsOnResetLandPassList = 100;
- protected int m_sleepMsOnGetParcelPrimOwners = 2000;
- protected int m_sleepMsOnGetNumberOfNotecardLines = 100;
- protected int m_sleepMsOnGetNotecardLine = 100;
protected string m_internalObjectHost = "lsl.opensim.local";
protected bool m_restrictEmail = false;
protected ISoundModule m_SoundModule = null;
@@ -321,10 +262,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (seConfig != null)
{
- m_ScriptDelayFactor =
- seConfig.GetFloat("ScriptDelayFactor", m_ScriptDelayFactor);
- m_ScriptDistanceFactor =
- seConfig.GetFloat("ScriptDistanceLimitFactor", m_ScriptDistanceFactor);
m_MinTimerInterval =
seConfig.GetFloat("MinTimerInterval", m_MinTimerInterval);
m_automaticLinkPermission =
@@ -409,7 +346,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_internalObjectHost = smtpConfig.GetString("internal_object_host", m_internalObjectHost);
}
}
- m_sleepMsOnEmail = EMAIL_PAUSE_TIME * 1000;
+//// m_sleepMsOnEmail = EMAIL_PAUSE_TIME * 1000;
}
public override Object InitializeLifetimeService()
@@ -438,14 +375,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return p;
}
- protected virtual void ScriptSleep(int delay)
- {
- delay = (int)((float)delay * m_ScriptDelayFactor);
- if (delay == 0)
- return;
-
- Sleep(delay);
- }
protected virtual void Sleep(int delay)
{
if (m_item == null) // Some unit tests don't set this
@@ -1183,8 +1112,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// m_SayShoutCount++;
CheckSayShoutTime();
- if (m_SayShoutCount >= 11)
- ScriptSleep(2000);
+//// if (m_SayShoutCount >= 11)
+//// ScriptSleep(2000);
if (m_scriptConsoleChannelEnabled && (channelID == m_scriptConsoleChannel))
{
@@ -1210,8 +1139,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// m_SayShoutCount++;
CheckSayShoutTime();
- if (m_SayShoutCount >= 11)
- ScriptSleep(2000);
+//// if (m_SayShoutCount >= 11)
+//// ScriptSleep(2000);
if (text.Length > 1023)
text = text.Substring(0, 1023);
@@ -2334,7 +2263,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetTexture(string texture, int face)
{
SetTexture(m_host, texture, face);
- ScriptSleep(m_sleepMsOnSetTexture);
}
public void llSetLinkTexture(int linknumber, string texture, int face)
@@ -2349,7 +2277,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
finally { }
}
- ScriptSleep(m_sleepMsOnSetLinkTexture);
}
protected void SetTexture(SceneObjectPart part, string texture, int face)
@@ -2396,7 +2323,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llScaleTexture(double u, double v, int face)
{
ScaleTexture(m_host, u, v, face);
- ScriptSleep(m_sleepMsOnScaleTexture);
}
protected void ScaleTexture(SceneObjectPart part, double u, double v, int face)
@@ -2436,7 +2362,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llOffsetTexture(double u, double v, int face)
{
OffsetTexture(m_host, u, v, face);
- ScriptSleep(m_sleepMsOnOffsetTexture);
}
protected void OffsetTexture(SceneObjectPart part, double u, double v, int face)
@@ -2476,7 +2401,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llRotateTexture(double rotation, int face)
{
RotateTexture(m_host, rotation, face);
- ScriptSleep(m_sleepMsOnRotateTexture);
}
protected void RotateTexture(SceneObjectPart part, double rotation, int face)
@@ -2554,8 +2478,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetPos(LSL_Vector pos)
{
SetPos(m_host, pos, true);
-
- ScriptSleep(m_sleepMsOnSetPos);
}
///
@@ -2727,14 +2649,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetRot(m_host, rootPart.RotationOffset * (Quaternion)rot);
}
}
-
- ScriptSleep(m_sleepMsOnSetRot);
}
public void llSetLocalRot(LSL_Rotation rot)
{
SetRot(m_host, rot);
- ScriptSleep(m_sleepMsOnSetLocalRot);
}
protected void SetRot(SceneObjectPart part, Quaternion rot)
@@ -3097,7 +3016,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (m_SoundModule != null)
m_SoundModule.PreloadSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound), 0);
- ScriptSleep(m_sleepMsOnPreloadSound);
}
///
@@ -3363,25 +3281,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
{
Deprecated("llMakeExplosion", "Use llParticleSystem instead");
- ScriptSleep(m_sleepMsOnMakeExplosion);
}
public void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset)
{
Deprecated("llMakeFountain", "Use llParticleSystem instead");
- ScriptSleep(m_sleepMsOnMakeFountain);
}
public void llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
{
Deprecated("llMakeSmoke", "Use llParticleSystem instead");
- ScriptSleep(m_sleepMsOnMakeSmoke);
}
public void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
{
Deprecated("llMakeFire", "Use llParticleSystem instead");
- ScriptSleep(m_sleepMsOnMakeFire);
}
public void llRezAtRoot(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
@@ -3458,8 +3372,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}, null, "LSL_Api.doObjectRez");
- //ScriptSleep((int)((groupmass * velmag) / 10));
- ScriptSleep(m_sleepMsOnRezAtRoot);
}
public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
@@ -3704,7 +3616,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(user, out result) || result == UUID.Zero)
{
Error("llInstantMessage","An invalid key was passed to llInstantMessage");
- ScriptSleep(2000);
+//// ScriptSleep(2000);
return;
}
@@ -3752,8 +3664,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
}
-
- ScriptSleep(m_sleepMsOnInstantMessage);
}
public void llEmail(string address, string subject, string message)
@@ -3790,7 +3700,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
emailModule.SendEmail(m_host.UUID, address, subject, message);
- ScriptSleep(m_sleepMsOnEmail);
+//// ScriptSleep(m_sleepMsOnEmail);
}
public void llGetNextEmail(string address, string subject)
@@ -4568,9 +4478,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_TransferModule != null)
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
}
-
- //This delay should only occur when giving inventory to avatars.
- ScriptSleep(m_sleepMsOnGiveInventory);
}
}
@@ -4752,12 +4659,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
reply);
});
- ScriptSleep(m_sleepMsOnRequestInventoryData);
return tid.ToString();
}
}
- ScriptSleep(m_sleepMsOnRequestInventoryData);
return String.Empty;
}
@@ -4794,8 +4699,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
-
- ScriptSleep(m_sleepMsOnSetDamage);
}
public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt)
@@ -4924,7 +4827,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else
{
dm.SendTextBoxToUser(av, message, chatChannel, m_host.Name, m_host.UUID, m_host.OwnerID);
- ScriptSleep(m_sleepMsOnTextBox);
}
}
@@ -6417,7 +6319,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llAdjustSoundVolume(double volume)
{
m_host.AdjustSoundGain(volume);
- ScriptSleep(m_sleepMsOnAdjustSoundVolume);
}
public void llSetSoundRadius(double radius)
@@ -6523,7 +6424,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
- ScriptSleep(m_sleepMsOnEjectFromLand);
}
public LSL_List llParseString2List(string str, LSL_List separators, LSL_List in_spacers)
@@ -7669,8 +7569,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
dm.SendDialogToUser(
av, m_host.Name, m_host.UUID, m_host.OwnerID,
message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts);
-
- ScriptSleep(m_sleepMsOnDialog);
}
public void llVolumeDetect(int detect)
@@ -7682,7 +7580,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llRemoteLoadScript(string target, string name, int running, int start_param)
{
Deprecated("llRemoteLoadScript", "Use llRemoteLoadScriptPin instead");
- ScriptSleep(m_sleepMsOnRemoteLoadScript);
}
public void llSetRemoteScriptAccessPin(int pin)
@@ -7728,8 +7625,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.Inventory.RemoveInventoryItem(item.ItemID);
}
}
- // this will cause the delay even if the script pin or permissions were wrong - seems ok
- ScriptSleep(m_sleepMsOnRemoteLoadScriptPin);
}
public void llOpenRemoteDataChannel()
@@ -7759,13 +7654,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams("remote_data", resobj,
new DetectParams[0]));
}
- ScriptSleep(m_sleepMsOnOpenRemoteDataChannel);
}
public LSL_String llSendRemoteData(string channel, string dest, int idata, string sdata)
{
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface();
- ScriptSleep(m_sleepMsOnSendRemoteData);
if (xmlrpcMod == null)
return "";
return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString();
@@ -7776,7 +7669,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface();
if (xmlrpcMod != null)
xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
- ScriptSleep(m_sleepMsOnRemoteDataReply);
}
public void llCloseRemoteDataChannel(string channel)
@@ -7790,7 +7682,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface();
if (xmlrpcMod != null)
xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
- ScriptSleep(m_sleepMsOnCloseRemoteDataChannel);
}
public LSL_String llMD5String(string src, int nonce)
@@ -8192,15 +8083,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetPrimitiveParams(LSL_List rules)
{
SetLinkPrimParams(ScriptBaseClass.LINK_THIS, rules, "llSetPrimitiveParams");
-
- ScriptSleep(m_sleepMsOnSetPrimitiveParams);
}
public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
{
SetLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParams");
-
- ScriptSleep(m_sleepMsOnSetLinkPrimitiveParams);
}
public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
@@ -9990,7 +9877,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- ScriptSleep(300);
if (str1 == String.Empty)
return String.Empty;
if (str2 == String.Empty)
@@ -10120,8 +10006,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
land.SetMusicUrl(url);
-
- ScriptSleep(m_sleepMsOnSetParcelMusicURL);
}
public LSL_String llGetParcelMusicURL()
@@ -11039,13 +10923,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llGetPrimMediaParams(int face, LSL_List rules)
{
- ScriptSleep(m_sleepMsOnGetPrimMediaParams);
return GetPrimMediaParams(m_host, face, rules);
}
public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
{
- ScriptSleep(m_sleepMsOnGetLinkMedia);
if (link == ScriptBaseClass.LINK_ROOT)
return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
else if (link == ScriptBaseClass.LINK_THIS)
@@ -11164,13 +11046,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules)
{
- ScriptSleep(m_sleepMsOnSetPrimMediaParams);
return SetPrimMediaParams(m_host, face, rules);
}
public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
{
- ScriptSleep(m_sleepMsOnSetLinkMedia);
if (link == ScriptBaseClass.LINK_ROOT)
return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
else if (link == ScriptBaseClass.LINK_THIS)
@@ -11288,13 +11168,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llClearPrimMedia(LSL_Integer face)
{
- ScriptSleep(m_sleepMsOnClearPrimMedia);
return ClearPrimMedia(m_host, face);
}
public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
{
- ScriptSleep(m_sleepMsOnClearLinkMedia);
if (link == ScriptBaseClass.LINK_ROOT)
return ClearPrimMedia(m_host.ParentGroup.RootPart, face);
else if (link == ScriptBaseClass.LINK_THIS)
@@ -11925,7 +11803,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.DATA_SIM_POS:
if (info == null)
{
- ScriptSleep(m_sleepMsOnRequestSimulatorData);
return UUID.Zero.ToString();
}
@@ -11972,7 +11849,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.DATA_SIM_RATING:
if (info == null)
{
- ScriptSleep(m_sleepMsOnRequestSimulatorData);
return UUID.Zero.ToString();
}
int access = info.Maturity;
@@ -11991,7 +11867,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
reply = "OpenSim";
break;
default:
- ScriptSleep(m_sleepMsOnRequestSimulatorData);
return UUID.Zero.ToString(); // Raise no event
}
UUID rq = UUID.Random();
@@ -12002,7 +11877,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AsyncCommands.
DataserverPlugin.DataserverReply(rq.ToString(), reply);
- ScriptSleep(m_sleepMsOnRequestSimulatorData);
return tid.ToString();
}
catch(Exception)
@@ -12142,8 +12016,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (null != dm)
dm.SendUrlToUser(
new UUID(avatar_id), m_host.Name, m_host.UUID, m_host.OwnerID, false, message, url);
-
- ScriptSleep(m_sleepMsOnLoadURL);
}
public void llParcelMediaCommandList(LSL_List commandList)
@@ -12382,7 +12254,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
(ParcelMediaCommandEnum)commandToSend, time);
}
}
- ScriptSleep(m_sleepMsOnParcelMediaCommandList);
}
public LSL_List llParcelMediaQuery(LSL_List aList)
@@ -12421,7 +12292,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
- ScriptSleep(m_sleepMsOnParcelMediaQuery);
return list;
}
@@ -12429,7 +12299,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
Int64 tmp = 0;
Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp);
- ScriptSleep(m_sleepMsOnModPow);
return Convert.ToInt32(tmp);
}
@@ -12509,13 +12378,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetPrimURL(string url)
{
Deprecated("llSetPrimURL", "Use llSetPrimMediaParams instead");
- ScriptSleep(m_sleepMsOnSetPrimURL);
}
public void llRefreshPrimURL()
{
Deprecated("llRefreshPrimURL");
- ScriptSleep(m_sleepMsOnRefreshPrimURL);
}
public LSL_String llEscapeURL(string url)
@@ -12564,7 +12431,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name,
simname, pos, lookAt);
}
- ScriptSleep(m_sleepMsOnMapDestination);
}
public void llAddToLandBanList(string avatar, double hours)
@@ -12604,7 +12470,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
}
}
- ScriptSleep(m_sleepMsOnAddToLandBanList);
}
public void llRemoveFromLandPassList(string avatar)
@@ -12630,7 +12495,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
- ScriptSleep(m_sleepMsOnRemoveFromLandPassList);
}
public void llRemoveFromLandBanList(string avatar)
@@ -12656,7 +12520,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
- ScriptSleep(m_sleepMsOnRemoveFromLandBanList);
}
public void llSetCameraParams(LSL_List rules)
@@ -13134,7 +12997,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
- ScriptSleep(m_sleepMsOnResetLandBanList);
}
public void llResetLandPassList()
@@ -13150,7 +13012,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
- ScriptSleep(m_sleepMsOnResetLandPassList);
}
public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide)
@@ -13205,7 +13066,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_Integer(detectedParams.Value));
}
}
- ScriptSleep(m_sleepMsOnGetParcelPrimOwners);
return ret;
}
@@ -13790,7 +13650,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(assetID).ToString());
- ScriptSleep(m_sleepMsOnGetNumberOfNotecardLines);
return tid.ToString();
}
@@ -13806,7 +13665,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(id).ToString());
});
- ScriptSleep(m_sleepMsOnGetNumberOfNotecardLines);
return tid.ToString();
}
@@ -13840,7 +13698,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AsyncCommands.DataserverPlugin.DataserverReply(
reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
- ScriptSleep(m_sleepMsOnGetNotecardLine);
return tid.ToString();
}
@@ -13859,7 +13716,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
});
- ScriptSleep(m_sleepMsOnGetNotecardLine);
return tid.ToString();
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 2c025c1..d897098 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -139,8 +139,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
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 bool m_debuggerSafe = false;
internal Dictionary m_FunctionPerms = new Dictionary();
protected IUrlModule m_UrlModule = null;
@@ -161,11 +159,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// m_log.Warn("[OSSL] OSSL FUNCTIONS ENABLED");
}
- m_ScriptDelayFactor =
- m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
- m_ScriptDistanceFactor =
- m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f);
-
string risk = m_ScriptEngine.Config.GetString("OSFunctionThreatLevel", "VeryLow");
switch (risk)
{
@@ -473,13 +466,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
OSSLShoutError(string.Format("Use of function {0} is deprecated. Use {1} instead.", function, replacement));
}
- protected void ScriptSleep(int delay)
- {
- delay = (int)((float)delay * m_ScriptDelayFactor);
- if (delay == 0)
- return;
- System.Threading.Thread.Sleep(delay);
- }
+//// protected void ScriptSleep(int delay)
+//// {
+//// delay = (int)((float)delay * m_ScriptDelayFactor);
+//// if (delay == 0)
+//// return;
+//// System.Threading.Thread.Sleep(delay);
+//// }
public LSL_Integer osSetTerrainHeight(int x, int y, double val)
{
@@ -881,17 +874,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Vector3 pos = presence.AbsolutePosition;
if(!checkAllowAgentTPbyLandOwner(agentId, pos))
- {
- ScriptSleep(500);
return;
- }
if(regionName == World.RegionInfo.RegionName)
{
// should be faster than going to threadpool
World.RequestTeleportLocation(presence.ControllingClient, regionName, position,
lookat, (uint)TPFlags.ViaLocation);
- ScriptSleep(500);
}
else
{
@@ -902,7 +891,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
presence.ControllingClient, regionName, position,
lookat, (uint)TPFlags.ViaLocation),
null, "OSSL_Api.TeleportAgentByRegionCoords");
- ScriptSleep(5000);
}
}
}
@@ -930,18 +918,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Vector3 pos = presence.AbsolutePosition;
if(!checkAllowAgentTPbyLandOwner(agentId, pos))
- {
- ScriptSleep(500);
return;
- }
Util.FireAndForget(
o => World.RequestTeleportLocation(
presence.ControllingClient, regionHandle,
position, lookat, (uint)TPFlags.ViaLocation),
null, "OSSL_Api.TeleportAgentByRegionName");
-
- ScriptSleep(5000);
}
}
@@ -956,14 +939,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Vector3 pos = presence.AbsolutePosition;
if(!checkAllowAgentTPbyLandOwner(agentId, pos))
- {
- ScriptSleep(500);
return;
- }
World.RequestTeleportLocation(presence.ControllingClient, World.RegionInfo.RegionName, position,
lookat, (uint)TPFlags.ViaLocation);
- ScriptSleep(500);
}
}
@@ -3389,8 +3368,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (region != null)
key = region.TerrainImage;
- ScriptSleep(1000);
-
return key.ToString();
}
--
cgit v1.1
From 5aba03bbf48ccf01e10d7fd44a5a2fb83558d9af Mon Sep 17 00:00:00 2001
From: onefang
Date: Sun, 19 May 2019 22:54:49 +1000
Subject: Remove some script distance limits.
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 +-----
1 file changed, 1 insertion(+), 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 ecaa672..229ad1d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2506,8 +2506,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region.
pos.x > (World.RegionInfo.RegionSizeX + 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 > (World.RegionInfo.RegionSizeY + 10) || // return FALSE if more than 10 meters into a north-adjacent region.
- pos.z > Constants.RegionHeight // return FALSE if altitude than 4096m
+ pos.y > (World.RegionInfo.RegionSizeY + 10) // return FALSE if more than 10 meters into a north-adjacent region.
)
)
{
@@ -3310,9 +3309,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
float dist = (float)llVecDist(llGetPos(), pos);
- if (dist > m_ScriptDistanceFactor * 10.0f)
- return;
-
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory);
if (item == null)
--
cgit v1.1
From bdd2d59d6d97e555ad572d1ec5649697233903ab Mon Sep 17 00:00:00 2001
From: onefang
Date: Sat, 20 Jul 2019 20:24:25 +1000
Subject: Allow menu items longer than 24 characters once more.
I've never seen any problems with allowing this, my NPC tool does that.
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 ++-----
1 file changed, 2 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 229ad1d..8141c17 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7549,16 +7549,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (buttons.Data[i].ToString() == String.Empty)
{
- Error("llDialog", "Button label cannot be blank");
+ Error("llDialog", "Button label cannot be blank.");
return;
}
-/*
if (buttons.Data[i].ToString().Length > 24)
{
- Error("llDialog", "Button label cannot be longer than 24 characters");
- return;
+ Error("llDialog", "Button label should not be longer than 24 characters.");
}
-*/
buts[i] = buttons.Data[i].ToString();
}
--
cgit v1.1
From 5b752dd4b7fd2600157ec90da5051623afe1dc4d Mon Sep 17 00:00:00 2001
From: onefang
Date: Sun, 21 Jul 2019 21:25:11 +1000
Subject: TPs from scripts avoid all that silly raycasting nonsense, just go
where we ask.
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++++----
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 8 ++++----
2 files changed, 8 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 8141c17..84e4546 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4689,7 +4689,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
World.RequestTeleportLocation(
presence.ControllingClient, regionInfo.RegionHandle, new Vector3(128, 128, 23), Vector3.Zero,
- (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
+ (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome | Constants.TeleportFlags.ViaScript));
}
}
}
@@ -4768,7 +4768,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0)
{
- World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
+ World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)(Constants.TeleportFlags.ViaLocation | Constants.TeleportFlags.ViaScript));
}
}
}
@@ -4782,7 +4782,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Use it as a sim name
if (assetID == UUID.Zero)
{
- World.RequestTeleportLocation(sp.ControllingClient, destination, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
+ World.RequestTeleportLocation(sp.ControllingClient, destination, targetPos, targetLookAt, (uint)(Constants.TeleportFlags.ViaLocation | Constants.TeleportFlags.ViaScript));
return;
}
@@ -4795,7 +4795,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AssetLandmark lm = new AssetLandmark(lma);
- World.RequestTeleportLocation(sp.ControllingClient, lm.RegionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
+ World.RequestTeleportLocation(sp.ControllingClient, lm.RegionHandle, targetPos, targetLookAt, (uint)(Constants.TeleportFlags.ViaLocation | Constants.TeleportFlags.ViaScript));
}
public void llTextBox(string agent, string message, int chatChannel)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index d897098..2be5200 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -880,7 +880,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
// should be faster than going to threadpool
World.RequestTeleportLocation(presence.ControllingClient, regionName, position,
- lookat, (uint)TPFlags.ViaLocation);
+ lookat, (uint)(TPFlags.ViaLocation | TPFlags.ViaScript));
}
else
{
@@ -889,7 +889,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Util.FireAndForget(
o => World.RequestTeleportLocation(
presence.ControllingClient, regionName, position,
- lookat, (uint)TPFlags.ViaLocation),
+ lookat, (uint)(TPFlags.ViaLocation | TPFlags.ViaScript)),
null, "OSSL_Api.TeleportAgentByRegionCoords");
}
}
@@ -923,7 +923,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Util.FireAndForget(
o => World.RequestTeleportLocation(
presence.ControllingClient, regionHandle,
- position, lookat, (uint)TPFlags.ViaLocation),
+ position, lookat, (uint)(TPFlags.ViaLocation | TPFlags.ViaScript)),
null, "OSSL_Api.TeleportAgentByRegionName");
}
}
@@ -942,7 +942,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
World.RequestTeleportLocation(presence.ControllingClient, World.RegionInfo.RegionName, position,
- lookat, (uint)TPFlags.ViaLocation);
+ lookat, (uint)(TPFlags.ViaLocation | TPFlags.ViaScript));
}
}
--
cgit v1.1
From d1a1338d1a63c2992868d1b66ea5e5741e8a3971 Mon Sep 17 00:00:00 2001
From: onefang
Date: Wed, 24 Jul 2019 01:07:48 +1000
Subject: Revert list content type check.
https://sledjhamr.org/mantisbt/view.php?id=19
---
.../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 ++++++++++------
1 file changed, 10 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 84e4546..ce2bfaf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5985,23 +5985,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
for (int i = 0; i < length; i++)
{
- int needle = llGetListEntryType(test, 0).value;
- int haystack = llGetListEntryType(src, i).value;
+//// int needle = llGetListEntryType(test, 0).value;
+//// int haystack = llGetListEntryType(src, i).value;
// Why this piece of insanity? This is because most script constants are C# value types (e.g. int)
// rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code
// and so the comparison fails even if the LSL_Integer conceptually has the same value.
// Therefore, here we test Equals on both the source and destination objects.
// However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)).
- if ((needle == haystack) && (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i])))
+
+ // The commented out bit of insanity was to check the LSL types are the same as well, which we don't really want.
+ if (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i]))
+//// if ((needle == haystack) && (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i])))
{
int j;
for (j = 1; j < test.Length; j++)
+ if (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j])))
{
- needle = llGetListEntryType(test, j).value;
- haystack = llGetListEntryType(src, i+j).value;
+//// needle = llGetListEntryType(test, j).value;
+//// haystack = llGetListEntryType(src, i+j).value;
- if ((needle != haystack) || (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j]))))
+//// if ((needle != haystack) || (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j]))))
break;
}
--
cgit v1.1
From 77737c81234c98d72bffaa6ddca374504f971b12 Mon Sep 17 00:00:00 2001
From: onefang
Date: Thu, 25 Jul 2019 20:19:51 +1000
Subject: Gatekeeper -> GatekeeperURI
Coz it says all over the source code -
// Legacy. Remove soon!
And has since later OpenSim 0.7s.
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++--
1 file changed, 2 insertions(+), 2 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 2be5200..64da67e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2493,8 +2493,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return gatekeeperURI;
// Legacy. Remove soon!
- if (config.Configs["GridService"] != null)
- gatekeeperURI = config.Configs["GridService"].GetString("Gatekeeper", gatekeeperURI);
+//// if (config.Configs["GridService"] != null)
+//// gatekeeperURI = config.Configs["GridService"].GetString("Gatekeeper", gatekeeperURI);
return gatekeeperURI;
}
--
cgit v1.1
From 5ab0f0190d93759368d2f6e4553a8da2644bc638 Mon Sep 17 00:00:00 2001
From: onefang
Date: Thu, 22 Aug 2019 10:54:20 +1000
Subject: OhSillyThreatLevels should throw an exception when not allowed.
---
.../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 10 +++-------
1 file changed, 3 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 64da67e..544dce4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -212,9 +212,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
internal void OSSLError(string msg)
{
if (m_debuggerSafe)
- {
OSSLShoutError(msg);
- }
else
{
throw new ScriptException("OSSL Runtime Error: " + msg);
@@ -258,20 +256,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void CheckThreatLevel()
{
if (!m_OSFunctionsEnabled)
- OSSLError(String.Format("{0} permission denied. All OS functions are disabled.")); // throws
+ throw new ScriptException(String.Format("{0} permission denied. All OS functions are disabled."));
}
// Returns if the function is allowed. Throws a script exception if not allowed.
public void CheckThreatLevel(ThreatLevel level, string function)
{
if (!m_OSFunctionsEnabled)
- OSSLError(String.Format("{0} permission denied. All OS functions are disabled.", function)); // throws
+ throw new ScriptException(String.Format("{0} permission denied. All OS functions are disabled.", function));
string reasonWhyNot = CheckThreatLevelTest(level, function);
if (!String.IsNullOrEmpty(reasonWhyNot))
- {
- OSSLError(reasonWhyNot);
- }
+ throw new ScriptException(reasonWhyNot);
}
// Check to see if function is allowed. Returns an empty string if function permitted
--
cgit v1.1
From 4e1a8967847b93442ec3e4e0d254c5d6c1edffb7 Mon Sep 17 00:00:00 2001
From: onefang
Date: Sun, 25 Aug 2019 07:56:14 +1000
Subject: Gods can do anything they want, including bypassing OhSilly threat
levels.
---
.../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 11 +++++++++++
1 file changed, 11 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 544dce4..a8c1a8f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -274,6 +274,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// or a string explaining why this function can't be used.
private string CheckThreatLevelTest(ThreatLevel level, string function)
{
+ // Grid gods can do anything they damn well please.
+ if (World.Permissions.IsGridGod(m_item.OwnerID))
+ return String.Empty;
+ else
+ {
+ // So can active gods.
+ ScenePresence sp = World.GetScenePresence(m_item.OwnerID);
+ if (sp != null && !sp.IsDeleted && sp.IsGod)
+ return String.Empty;
+ }
+
if (!m_FunctionPerms.ContainsKey(function))
{
FunctionPerms perms = new FunctionPerms();
--
cgit v1.1