From 8428b25939d39711e732eeb3928e8a8e64aad8a9 Mon Sep 17 00:00:00 2001
From: KittoFlora
Date: Mon, 26 Oct 2009 00:10:23 +0100
Subject: Add llRotLookat pt1.
---
.../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 11f255f..1dc20ff 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2694,11 +2694,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Orient the object to the angle calculated
llSetRot(rot);
}
+
+ public void llRotLookAt(LSL_Rotation target, double strength, double damping)
+ {
+ m_host.AddScriptLPS(1);
+// NotImplemented("llRotLookAt");
+ m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping);
+
+ }
+
public void llStopLookAt()
{
m_host.AddScriptLPS(1);
- NotImplemented("llStopLookAt");
+// NotImplemented("llStopLookAt");
+ m_host.StopLookAt();
}
public void llSetTimerEvent(double sec)
@@ -3042,12 +3052,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
}
- public void llRotLookAt(LSL_Rotation target, double strength, double damping)
- {
- m_host.AddScriptLPS(1);
- NotImplemented("llRotLookAt");
- }
-
public LSL_Integer llStringLength(string str)
{
m_host.AddScriptLPS(1);
--
cgit v1.1
From 889ce36afa67c521f3e50e4833a894ffd39af490 Mon Sep 17 00:00:00 2001
From: CasperW
Date: Mon, 23 Nov 2009 16:02:05 +0100
Subject: Added some [DebuggerNonUserCode] modifiers to functions that throw
EventAbortException() to ease debugging on Visual Studio
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++++
OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs | 2 ++
OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs | 2 ++
OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 5 ++++-
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 3 +++
5 files changed, 15 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 50b2fb5..b549b5c 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.Diagnostics; //for [DebuggerNonUserCode]
using System.Runtime.Remoting.Lifetime;
using System.Text;
using System.Threading;
@@ -151,6 +152,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
get { return m_ScriptEngine.World; }
}
+ [DebuggerNonUserCode]
public void state(string newState)
{
m_ScriptEngine.SetState(m_itemID, newState);
@@ -160,6 +162,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);
@@ -3755,6 +3758,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(3000);
}
+ [DebuggerNonUserCode]
public void llRemoveInventory(string name)
{
m_host.AddScriptLPS(1);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
index 7f67599..15e0408 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics; //for [DebuggerNonUserCode]
using System.Reflection;
using System.Runtime.Remoting.Lifetime;
using OpenSim.Region.ScriptEngine.Shared;
@@ -131,6 +132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return (eventFlags);
}
+ [DebuggerNonUserCode]
public void ExecuteEvent(string state, string FunctionName, object[] args)
{
// IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
index 121159c..a44abb0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
@@ -33,6 +33,7 @@ using System.Threading;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
+using System.Diagnostics; //for [DebuggerNonUserCode]
using OpenSim.Region.ScriptEngine.Interfaces;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api.Runtime;
@@ -90,6 +91,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return (int)m_Executor.GetStateEventFlags(state);
}
+ [DebuggerNonUserCode]
public void ExecuteEvent(string state, string FunctionName, object[] args)
{
m_Executor.ExecuteEvent(state, FunctionName, args);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 41b5d49..ed3fdbe 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -27,6 +27,7 @@
using System;
using System.IO;
+using System.Diagnostics; //for [DebuggerNonUserCode]
using System.Runtime.Remoting;
using System.Runtime.Remoting.Lifetime;
using System.Threading;
@@ -544,6 +545,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
return true;
}
+ [DebuggerNonUserCode] //Prevents the debugger from farting in this function
public void SetState(string state)
{
if (state == State)
@@ -555,7 +557,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
new DetectParams[0]));
PostEvent(new EventParams("state_entry", new Object[0],
new DetectParams[0]));
-
+
throw new EventAbortException();
}
@@ -824,6 +826,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
new Object[0], new DetectParams[0]));
}
+ [DebuggerNonUserCode] //Stops the VS debugger from farting in this function
public void ApiResetScript()
{
// bool running = Running;
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index a60c0ba..8b94f28 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -30,6 +30,7 @@ using System.IO;
using System.Threading;
using System.Collections;
using System.Collections.Generic;
+using System.Diagnostics; //for [DebuggerNonUserCode]
using System.Security;
using System.Security.Policy;
using System.Reflection;
@@ -1119,6 +1120,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false;
}
+ [DebuggerNonUserCode]
public void ApiResetScript(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
@@ -1170,6 +1172,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return UUID.Zero;
}
+ [DebuggerNonUserCode]
public void SetState(UUID itemID, string newState)
{
IScriptInstance instance = GetInstance(itemID);
--
cgit v1.1
From 247c66b3fe792692468ede6a516d85c6c9852d23 Mon Sep 17 00:00:00 2001
From: CasperW
Date: Mon, 23 Nov 2009 20:25:53 +0100
Subject: Swap the locking of m_EventQueue and m_Script to ease locks on script
inventory operations
---
.../ScriptEngine/Shared/Instance/ScriptInstance.cs | 234 +++++++++++----------
1 file changed, 119 insertions(+), 115 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index ed3fdbe..063d50f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -640,154 +640,158 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
///
public object EventProcessor()
{
+
+ EventParams data = null;
+
+ lock (m_EventQueue)
+ {
lock (m_Script)
{
- EventParams data = null;
-
- lock (m_EventQueue)
+ data = (EventParams) m_EventQueue.Dequeue();
+ if (data == null) // Shouldn't happen
{
- data = (EventParams) m_EventQueue.Dequeue();
- if (data == null) // Shouldn't happen
+ if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
{
- if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
- {
- m_CurrentResult = m_Engine.QueueEventHandler(this);
- }
- else
- {
- m_CurrentResult = null;
- }
- return 0;
+ m_CurrentResult = m_Engine.QueueEventHandler(this);
}
-
- if (data.EventName == "timer")
- m_TimerQueued = false;
- if (data.EventName == "control")
+ else
{
- if (m_ControlEventsInQueue > 0)
- m_ControlEventsInQueue--;
+ m_CurrentResult = null;
}
- if (data.EventName == "collision")
- m_CollisionInQueue = false;
+ return 0;
}
-
- //m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this);
- m_DetectParams = data.DetectParams;
-
- if (data.EventName == "state") // Hardcoded state change
+ if (data.EventName == "timer")
+ m_TimerQueued = false;
+ if (data.EventName == "control")
{
- // m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
- // m_PrimName, m_ScriptName, data.Params[0].ToString());
- m_State=data.Params[0].ToString();
- AsyncCommandManager.RemoveScript(m_Engine,
- m_LocalID, m_ItemID);
+ if (m_ControlEventsInQueue > 0)
+ m_ControlEventsInQueue--;
+ }
+ if (data.EventName == "collision")
+ m_CollisionInQueue = false;
+ }
+ }
+ lock(m_Script)
+ {
+
+ //m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this);
- SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
- m_LocalID);
- if (part != null)
- {
- part.SetScriptEvents(m_ItemID,
- (int)m_Script.GetStateEventFlags(State));
- }
+ m_DetectParams = data.DetectParams;
+
+ if (data.EventName == "state") // Hardcoded state change
+ {
+// m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
+// m_PrimName, m_ScriptName, data.Params[0].ToString());
+ m_State=data.Params[0].ToString();
+ AsyncCommandManager.RemoveScript(m_Engine,
+ m_LocalID, m_ItemID);
+
+ SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
+ m_LocalID);
+ if (part != null)
+ {
+ part.SetScriptEvents(m_ItemID,
+ (int)m_Script.GetStateEventFlags(State));
}
- else
+ }
+ else
+ {
+ if (m_Engine.World.PipeEventsForScript(m_LocalID) ||
+ data.EventName == "control") // Don't freeze avies!
{
- if (m_Engine.World.PipeEventsForScript(m_LocalID) ||
- data.EventName == "control") // Don't freeze avies!
- {
- SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
- m_LocalID);
- // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
- // m_PrimName, m_ScriptName, data.EventName, m_State);
+ SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
+ m_LocalID);
+ // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
+ // m_PrimName, m_ScriptName, data.EventName, m_State);
- try
- {
- m_CurrentEvent = data.EventName;
- m_EventStart = DateTime.Now;
- m_InEvent = true;
+ try
+ {
+ m_CurrentEvent = data.EventName;
+ m_EventStart = DateTime.Now;
+ m_InEvent = true;
- m_Script.ExecuteEvent(State, data.EventName, data.Params);
+ m_Script.ExecuteEvent(State, data.EventName, data.Params);
- m_InEvent = false;
- m_CurrentEvent = String.Empty;
+ m_InEvent = false;
+ m_CurrentEvent = String.Empty;
- if (m_SaveState)
- {
- // This will be the very first event we deliver
- // (state_entry) in default state
- //
+ if (m_SaveState)
+ {
+ // This will be the very first event we deliver
+ // (state_entry) in default state
+ //
- SaveState(m_Assembly);
+ SaveState(m_Assembly);
- m_SaveState = false;
- }
+ m_SaveState = false;
}
- catch (Exception e)
- {
- // m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message);
- m_InEvent = false;
- m_CurrentEvent = String.Empty;
+ }
+ catch (Exception e)
+ {
+ // m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message);
+ m_InEvent = false;
+ m_CurrentEvent = String.Empty;
- if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException))
- {
- try
- {
- // DISPLAY ERROR INWORLD
- string text = FormatException(e);
-
- if (text.Length > 1000)
- text = text.Substring(0, 1000);
- m_Engine.World.SimChat(Utils.StringToBytes(text),
- ChatTypeEnum.DebugChannel, 2147483647,
- part.AbsolutePosition,
- part.Name, part.UUID, false);
- }
- catch (Exception)
- {
- }
- // catch (Exception e2) // LEGIT: User Scripting
- // {
- // m_log.Error("[SCRIPT]: "+
- // "Error displaying error in-world: " +
- // e2.ToString());
- // m_log.Error("[SCRIPT]: " +
- // "Errormessage: Error compiling script:\r\n" +
- // e.ToString());
- // }
- }
- else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
+ if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException))
+ {
+ try
{
- m_InSelfDelete = true;
- if (part != null && part.ParentGroup != null)
- m_Engine.World.DeleteSceneObject(part.ParentGroup, false);
+ // DISPLAY ERROR INWORLD
+ string text = FormatException(e);
+
+ if (text.Length > 1000)
+ text = text.Substring(0, 1000);
+ m_Engine.World.SimChat(Utils.StringToBytes(text),
+ ChatTypeEnum.DebugChannel, 2147483647,
+ part.AbsolutePosition,
+ part.Name, part.UUID, false);
}
- else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
+ catch (Exception)
{
- m_InSelfDelete = true;
- if (part != null && part.ParentGroup != null)
- part.Inventory.RemoveInventoryItem(m_ItemID);
}
+ // catch (Exception e2) // LEGIT: User Scripting
+ // {
+ // m_log.Error("[SCRIPT]: "+
+ // "Error displaying error in-world: " +
+ // e2.ToString());
+ // m_log.Error("[SCRIPT]: " +
+ // "Errormessage: Error compiling script:\r\n" +
+ // e.ToString());
+ // }
+ }
+ else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
+ {
+ m_InSelfDelete = true;
+ if (part != null && part.ParentGroup != null)
+ m_Engine.World.DeleteSceneObject(part.ParentGroup, false);
+ }
+ else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
+ {
+ m_InSelfDelete = true;
+ if (part != null && part.ParentGroup != null)
+ part.Inventory.RemoveInventoryItem(m_ItemID);
}
}
}
+ }
- lock (m_EventQueue)
+ lock (m_EventQueue)
+ {
+ if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
{
- if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
- {
- m_CurrentResult = m_Engine.QueueEventHandler(this);
- }
- else
- {
- m_CurrentResult = null;
- }
+ m_CurrentResult = m_Engine.QueueEventHandler(this);
+ }
+ else
+ {
+ m_CurrentResult = null;
}
+ }
- m_DetectParams = null;
+ m_DetectParams = null;
- return 0;
- }
+ return 0;
+ }
}
public int EventTime()
--
cgit v1.1
From d1147136946daf14724183b3191119be44ff8b16 Mon Sep 17 00:00:00 2001
From: CasperW
Date: Tue, 24 Nov 2009 18:02:12 +0100
Subject: Drop all locking of part.TaskInventory in favour of a
ReaderWriterLockSlim lock handler. This gives us: - Faster prim inventory
actions. Multiple threads can read at once. - Fixes the known prim inventory
thread locks - In the event of a thread lock occurring, it will usually self
heal after sixty seconds with an error message in the console
---
.../Shared/Api/Implementation/LSL_Api.cs | 532 ++++++++++++---------
.../Shared/Api/Implementation/OSSL_Api.cs | 36 +-
.../ScriptEngine/Shared/Instance/ScriptInstance.cs | 22 +-
3 files changed, 334 insertions(+), 256 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b549b5c..a94cd46 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -275,40 +275,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected UUID InventorySelf()
{
UUID invItemID = new UUID();
-
- lock (m_host.TaskInventory)
+ bool unlock = false;
+ if (!m_host.TaskInventory.IsReadLockedByMe())
+ {
+ m_host.TaskInventory.LockItemsForRead(true);
+ unlock = true;
+ }
+ foreach (KeyValuePair inv in m_host.TaskInventory)
{
- foreach (KeyValuePair inv in m_host.TaskInventory)
+ if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
{
- if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
- {
- invItemID = inv.Key;
- break;
- }
+ invItemID = inv.Key;
+ break;
}
}
-
+ if (unlock)
+ {
+ m_host.TaskInventory.LockItemsForRead(false);
+ }
return invItemID;
}
protected UUID InventoryKey(string name, int type)
{
m_host.AddScriptLPS(1);
-
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+
+ foreach (KeyValuePair inv in m_host.TaskInventory)
{
- foreach (KeyValuePair inv in m_host.TaskInventory)
+ if (inv.Value.Name == name)
{
- if (inv.Value.Name == name)
+ m_host.TaskInventory.LockItemsForRead(false);
+
+ if (inv.Value.Type != type)
{
- if (inv.Value.Type != type)
- return UUID.Zero;
-
- return inv.Value.AssetID;
+ return UUID.Zero;
}
+
+ return inv.Value.AssetID;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero;
}
@@ -316,17 +324,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
+
+ m_host.TaskInventory.LockItemsForRead(true);
+
+ foreach (KeyValuePair inv in m_host.TaskInventory)
{
- foreach (KeyValuePair inv in m_host.TaskInventory)
+ if (inv.Value.Name == name)
{
- if (inv.Value.Name == name)
- {
- return inv.Value.AssetID;
- }
+ m_host.TaskInventory.LockItemsForRead(false);
+ return inv.Value.AssetID;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
+
+
return UUID.Zero;
}
@@ -2537,12 +2549,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
+ m_host.TaskInventory.LockItemsForRead(true);
TaskInventoryItem item = m_host.TaskInventory[invItemID];
-
- lock (m_host.TaskInventory)
- {
- item = m_host.TaskInventory[invItemID];
- }
+ m_host.TaskInventory.LockItemsForRead(false);
if (item.PermsGranter == UUID.Zero)
return 0;
@@ -2617,6 +2626,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (dist > m_ScriptDistanceFactor * 10.0f)
return;
+ //Clone is thread-safe
TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
foreach (KeyValuePair inv in partInventory)
@@ -2750,13 +2760,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
TaskInventoryItem item;
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
{
- if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
- return;
- else
- item = m_host.TaskInventory[InventorySelf()];
+ m_host.TaskInventory.LockItemsForRead(false);
+ return;
+ }
+ else
+ {
+ item = m_host.TaskInventory[InventorySelf()];
}
+ m_host.TaskInventory.LockItemsForRead(false);
if (item.PermsGranter != UUID.Zero)
{
@@ -2778,13 +2792,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
TaskInventoryItem item;
+ m_host.TaskInventory.LockItemsForRead(true);
lock (m_host.TaskInventory)
{
+
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
+ {
+ m_host.TaskInventory.LockItemsForRead(false);
return;
+ }
else
+ {
item = m_host.TaskInventory[InventorySelf()];
+ }
}
+ m_host.TaskInventory.LockItemsForRead(false);
m_host.AddScriptLPS(1);
@@ -2821,14 +2843,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
TaskInventoryItem item;
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+
+ if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
{
- if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
- return;
- else
- item = m_host.TaskInventory[InventorySelf()];
+ m_host.TaskInventory.LockItemsForRead(false);
+ return;
+ }
+ else
+ {
+ item = m_host.TaskInventory[InventorySelf()];
}
+ m_host.TaskInventory.LockItemsForRead(false);
+
if (item.PermsGranter != m_host.OwnerID)
return;
@@ -2853,13 +2881,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
TaskInventoryItem item;
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+
+ if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
{
- if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
- return;
- else
- item = m_host.TaskInventory[InventorySelf()];
+ m_host.TaskInventory.LockItemsForRead(false);
+ return;
+ }
+ else
+ {
+ item = m_host.TaskInventory[InventorySelf()];
}
+ m_host.TaskInventory.LockItemsForRead(false);
+
if (item.PermsGranter != m_host.OwnerID)
return;
@@ -3083,14 +3117,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
TaskInventoryItem item;
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
{
- if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
- return;
- else
- item = m_host.TaskInventory[InventorySelf()];
+ m_host.TaskInventory.LockItemsForRead(false);
+ return;
}
-
+ else
+ {
+ item = m_host.TaskInventory[InventorySelf()];
+ }
+ m_host.TaskInventory.LockItemsForRead(false);
if (item.PermsGranter == UUID.Zero)
return;
@@ -3120,13 +3157,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
TaskInventoryItem item;
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
{
- if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
- return;
- else
- item = m_host.TaskInventory[InventorySelf()];
+ m_host.TaskInventory.LockItemsForRead(false);
+ return;
}
+ else
+ {
+ item = m_host.TaskInventory[InventorySelf()];
+ }
+ m_host.TaskInventory.LockItemsForRead(false);
+
if (item.PermsGranter == UUID.Zero)
return;
@@ -3199,10 +3241,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
TaskInventoryItem item;
- lock (m_host.TaskInventory)
+
+ m_host.TaskInventory.LockItemsForRead(true);
+ if (!m_host.TaskInventory.ContainsKey(invItemID))
+ {
+ m_host.TaskInventory.LockItemsForRead(false);
+ return;
+ }
+ else
{
item = m_host.TaskInventory[invItemID];
}
+ m_host.TaskInventory.LockItemsForRead(false);
if (agentID == UUID.Zero || perm == 0) // Releasing permissions
{
@@ -3234,11 +3284,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
{
- lock (m_host.TaskInventory)
- {
- m_host.TaskInventory[invItemID].PermsGranter = agentID;
- m_host.TaskInventory[invItemID].PermsMask = perm;
- }
+ m_host.TaskInventory.LockItemsForWrite(true);
+ m_host.TaskInventory[invItemID].PermsGranter = agentID;
+ m_host.TaskInventory[invItemID].PermsMask = perm;
+ m_host.TaskInventory.LockItemsForWrite(false);
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
"run_time_permissions", new Object[] {
@@ -3258,11 +3307,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
{
- lock (m_host.TaskInventory)
- {
- m_host.TaskInventory[invItemID].PermsGranter = agentID;
- m_host.TaskInventory[invItemID].PermsMask = perm;
- }
+ m_host.TaskInventory.LockItemsForWrite(true);
+ m_host.TaskInventory[invItemID].PermsGranter = agentID;
+ m_host.TaskInventory[invItemID].PermsMask = perm;
+ m_host.TaskInventory.LockItemsForWrite(false);
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
"run_time_permissions", new Object[] {
@@ -3283,11 +3331,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!m_waitingForScriptAnswer)
{
- lock (m_host.TaskInventory)
- {
- m_host.TaskInventory[invItemID].PermsGranter = agentID;
- m_host.TaskInventory[invItemID].PermsMask = 0;
- }
+ m_host.TaskInventory.LockItemsForWrite(true);
+ m_host.TaskInventory[invItemID].PermsGranter = agentID;
+ m_host.TaskInventory[invItemID].PermsMask = 0;
+ m_host.TaskInventory.LockItemsForWrite(false);
presence.ControllingClient.OnScriptAnswer += handleScriptAnswer;
m_waitingForScriptAnswer=true;
@@ -3322,10 +3369,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
llReleaseControls();
- lock (m_host.TaskInventory)
- {
- m_host.TaskInventory[invItemID].PermsMask = answer;
- }
+
+ m_host.TaskInventory.LockItemsForWrite(true);
+ m_host.TaskInventory[invItemID].PermsMask = answer;
+ m_host.TaskInventory.LockItemsForWrite(false);
+
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
"run_time_permissions", new Object[] {
@@ -3337,16 +3385,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+
+ foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
- foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
+ if (item.Type == 10 && item.ItemID == m_itemID)
{
- if (item.Type == 10 && item.ItemID == m_itemID)
- {
- return item.PermsGranter.ToString();
- }
+ m_host.TaskInventory.LockItemsForRead(false);
+ return item.PermsGranter.ToString();
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero.ToString();
}
@@ -3355,19 +3404,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+
+ foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
- foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
+ if (item.Type == 10 && item.ItemID == m_itemID)
{
- if (item.Type == 10 && item.ItemID == m_itemID)
- {
- int perms = item.PermsMask;
- if (m_automaticLinkPermission)
- perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
- return perms;
- }
+ int perms = item.PermsMask;
+ if (m_automaticLinkPermission)
+ perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
+ m_host.TaskInventory.LockItemsForRead(false);
+ return perms;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
return 0;
}
@@ -3400,11 +3450,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID invItemID = InventorySelf();
TaskInventoryItem item;
- lock (m_host.TaskInventory)
- {
- item = m_host.TaskInventory[invItemID];
- }
-
+ m_host.TaskInventory.LockItemsForRead(true);
+ item = m_host.TaskInventory[invItemID];
+ m_host.TaskInventory.LockItemsForRead(false);
+
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
{
@@ -3457,16 +3506,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
UUID invItemID = InventorySelf();
- lock (m_host.TaskInventory)
- {
+ m_host.TaskInventory.LockItemsForRead(true);
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
{
ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
+ m_host.TaskInventory.LockItemsForRead(false);
return;
}
- }
-
+ m_host.TaskInventory.LockItemsForRead(false);
+
if (linknum < ScriptBaseClass.LINK_THIS)
return;
@@ -3635,17 +3684,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;
}
@@ -3654,16 +3702,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)
{
@@ -3700,20 +3747,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
// move the first object found with this inventory name
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ foreach (KeyValuePair inv in m_host.TaskInventory)
{
- foreach (KeyValuePair inv in m_host.TaskInventory)
+ if (inv.Value.Name == inventory)
{
- if (inv.Value.Name == inventory)
- {
- found = true;
- objId = inv.Key;
- assetType = inv.Value.Type;
- objName = inv.Value.Name;
- break;
- }
+ found = true;
+ objId = inv.Key;
+ assetType = inv.Value.Type;
+ objName = inv.Value.Name;
+ break;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
if (!found)
{
@@ -3763,20 +3809,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
- foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
+ if (item.Name == name)
{
- if (item.Name == name)
- {
- if (item.ItemID == m_itemID)
- throw new ScriptDeleteException();
- else
- m_host.Inventory.RemoveInventoryItem(item.ItemID);
- return;
- }
+ if (item.ItemID == m_itemID)
+ throw new ScriptDeleteException();
+ else
+ m_host.Inventory.RemoveInventoryItem(item.ItemID);
+
+ m_host.TaskInventory.LockItemsForRead(false);
+ return;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
}
public void llSetText(string text, LSL_Vector color, double alpha)
@@ -3865,6 +3912,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
+ //Clone is thread safe
TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
foreach (TaskInventoryItem item in itemDictionary.Values)
@@ -3955,17 +4003,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID soundId = UUID.Zero;
if (!UUID.TryParse(impact_sound, out soundId))
{
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
- foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
+ if (item.Type == (int)AssetType.Sound && item.Name == impact_sound)
{
- if (item.Type == (int)AssetType.Sound && item.Name == impact_sound)
- {
- soundId = item.AssetID;
- break;
- }
+ soundId = item.AssetID;
+ break;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
}
m_host.CollisionSound = soundId;
m_host.CollisionSoundVolume = (float)impact_volume;
@@ -4011,6 +4058,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID partItemID;
foreach (SceneObjectPart part in parts)
{
+ //Clone is thread safe
TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
foreach (TaskInventoryItem item in itemsDictionary.Values)
@@ -4218,17 +4266,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
- foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
+ if (item.Type == 10 && item.ItemID == m_itemID)
{
- if (item.Type == 10 && item.ItemID == m_itemID)
- {
- result = item.Name!=null?item.Name:String.Empty;
- break;
- }
+ result = item.Name!=null?item.Name:String.Empty;
+ break;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
return result;
}
@@ -4486,23 +4533,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ foreach (KeyValuePair inv in m_host.TaskInventory)
{
- foreach (KeyValuePair inv in m_host.TaskInventory)
+ if (inv.Value.Name == name)
{
- if (inv.Value.Name == name)
+ if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
{
- if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
- {
- return inv.Value.AssetID.ToString();
- }
- else
- {
- return UUID.Zero.ToString();
- }
+ m_host.TaskInventory.LockItemsForRead(false);
+ return inv.Value.AssetID.ToString();
+ }
+ else
+ {
+ m_host.TaskInventory.LockItemsForRead(false);
+ return UUID.Zero.ToString();
}
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero.ToString();
}
@@ -5997,14 +6045,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected UUID GetTaskInventoryItem(string name)
{
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ foreach (KeyValuePair inv in m_host.TaskInventory)
{
- foreach (KeyValuePair inv in m_host.TaskInventory)
+ if (inv.Value.Name == name)
{
- if (inv.Value.Name == name)
- return inv.Key;
+ m_host.TaskInventory.LockItemsForRead(false);
+ return inv.Key;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero;
}
@@ -6315,22 +6365,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
// copy the first script found with this inventory name
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ foreach (KeyValuePair inv in m_host.TaskInventory)
{
- foreach (KeyValuePair inv in m_host.TaskInventory)
+ if (inv.Value.Name == name)
{
- if (inv.Value.Name == name)
+ // make sure the object is a script
+ if (10 == inv.Value.Type)
{
- // make sure the object is a script
- if (10 == inv.Value.Type)
- {
- found = true;
- srcId = inv.Key;
- break;
- }
+ found = true;
+ srcId = inv.Key;
+ break;
}
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
if (!found)
{
@@ -8133,28 +8182,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ foreach (KeyValuePair inv in m_host.TaskInventory)
{
- foreach (KeyValuePair inv in m_host.TaskInventory)
+ if (inv.Value.Name == item)
{
- if (inv.Value.Name == item)
+ m_host.TaskInventory.LockItemsForRead(false);
+ switch (mask)
{
- switch (mask)
- {
- case 0:
- return (int)inv.Value.BasePermissions;
- case 1:
- return (int)inv.Value.CurrentPermissions;
- case 2:
- return (int)inv.Value.GroupPermissions;
- case 3:
- return (int)inv.Value.EveryonePermissions;
- case 4:
- return (int)inv.Value.NextPermissions;
- }
+ case 0:
+ return (int)inv.Value.BasePermissions;
+ case 1:
+ return (int)inv.Value.CurrentPermissions;
+ case 2:
+ return (int)inv.Value.GroupPermissions;
+ case 3:
+ return (int)inv.Value.EveryonePermissions;
+ case 4:
+ return (int)inv.Value.NextPermissions;
}
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
return -1;
}
@@ -8169,16 +8218,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ foreach (KeyValuePair inv in m_host.TaskInventory)
{
- foreach (KeyValuePair inv in m_host.TaskInventory)
+ if (inv.Value.Name == item)
{
- if (inv.Value.Name == item)
- {
- return inv.Value.CreatorID.ToString();
- }
+ m_host.TaskInventory.LockItemsForRead(false);
+ return inv.Value.CreatorID.ToString();
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
llSay(0, "No item name '" + item + "'");
@@ -8702,16 +8751,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ foreach (KeyValuePair inv in m_host.TaskInventory)
{
- foreach (KeyValuePair inv in m_host.TaskInventory)
+ if (inv.Value.Name == name)
{
- if (inv.Value.Name == name)
- {
- return inv.Value.Type;
- }
+ m_host.TaskInventory.LockItemsForRead(false);
+ return inv.Value.Type;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
return -1;
}
@@ -8742,17 +8791,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (invItemID == UUID.Zero)
return new LSL_Vector();
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
{
- if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
- return new LSL_Vector();
+ m_host.TaskInventory.LockItemsForRead(false);
+ return new LSL_Vector();
+ }
- if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
- {
- ShoutError("No permissions to track the camera");
- return new LSL_Vector();
- }
+ if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
+ {
+ ShoutError("No permissions to track the camera");
+ m_host.TaskInventory.LockItemsForRead(false);
+ return new LSL_Vector();
}
+ m_host.TaskInventory.LockItemsForRead(false);
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
if (presence != null)
@@ -8770,17 +8822,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (invItemID == UUID.Zero)
return new LSL_Rotation();
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
{
- if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
- return new LSL_Rotation();
-
- if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
- {
- ShoutError("No permissions to track the camera");
- return new LSL_Rotation();
- }
+ m_host.TaskInventory.LockItemsForRead(false);
+ return new LSL_Rotation();
}
+ if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
+ {
+ ShoutError("No permissions to track the camera");
+ m_host.TaskInventory.LockItemsForRead(false);
+ return new LSL_Rotation();
+ }
+ m_host.TaskInventory.LockItemsForRead(false);
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
if (presence != null)
@@ -8930,14 +8984,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (objectID == UUID.Zero) return;
UUID agentID;
- lock (m_host.TaskInventory)
- {
- // we need the permission first, to know which avatar we want to set the camera for
- agentID = m_host.TaskInventory[invItemID].PermsGranter;
+ m_host.TaskInventory.LockItemsForRead(true);
+ // we need the permission first, to know which avatar we want to set the camera for
+ agentID = m_host.TaskInventory[invItemID].PermsGranter;
- if (agentID == UUID.Zero) return;
- if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
+ if (agentID == UUID.Zero)
+ {
+ m_host.TaskInventory.LockItemsForRead(false);
+ return;
+ }
+ if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
+ {
+ m_host.TaskInventory.LockItemsForRead(false);
+ return;
}
+ m_host.TaskInventory.LockItemsForRead(false);
ScenePresence presence = World.GetScenePresence(agentID);
@@ -8987,12 +9048,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// we need the permission first, to know which avatar we want to clear the camera for
UUID agentID;
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ agentID = m_host.TaskInventory[invItemID].PermsGranter;
+ if (agentID == UUID.Zero)
{
- agentID = m_host.TaskInventory[invItemID].PermsGranter;
- if (agentID == UUID.Zero) return;
- if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
+ m_host.TaskInventory.LockItemsForRead(false);
+ return;
}
+ if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
+ {
+ m_host.TaskInventory.LockItemsForRead(false);
+ return;
+ }
+ m_host.TaskInventory.LockItemsForRead(false);
ScenePresence presence = World.GetScenePresence(agentID);
@@ -9449,15 +9517,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
internal UUID ScriptByName(string name)
{
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+
+ foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
- foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
+ if (item.Type == 10 && item.Name == name)
{
- if (item.Type == 10 && item.Name == name)
- return item.ItemID;
+ m_host.TaskInventory.LockItemsForRead(false);
+ return item.ItemID;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
+
return UUID.Zero;
}
@@ -9498,6 +9570,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
+ //Clone is thread safe
TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
UUID assetID = UUID.Zero;
@@ -9560,6 +9633,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
+ //Clone is thread safe
TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
UUID assetID = UUID.Zero;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 7fdbac8..83322eb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -728,18 +728,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (target != null)
{
UUID animID=UUID.Zero;
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ foreach (KeyValuePair inv in m_host.TaskInventory)
{
- foreach (KeyValuePair inv in m_host.TaskInventory)
+ if (inv.Value.Name == animation)
{
- if (inv.Value.Name == animation)
- {
- if (inv.Value.Type == (int)AssetType.Animation)
- animID = inv.Value.AssetID;
- continue;
- }
+ if (inv.Value.Type == (int)AssetType.Animation)
+ animID = inv.Value.AssetID;
+ continue;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
if (animID == UUID.Zero)
target.Animator.AddAnimation(animation, m_host.UUID);
else
@@ -761,18 +760,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (target != null)
{
UUID animID=UUID.Zero;
- lock (m_host.TaskInventory)
+ m_host.TaskInventory.LockItemsForRead(true);
+ foreach (KeyValuePair inv in m_host.TaskInventory)
{
- foreach (KeyValuePair inv in m_host.TaskInventory)
+ if (inv.Value.Name == animation)
{
- if (inv.Value.Name == animation)
- {
- if (inv.Value.Type == (int)AssetType.Animation)
- animID = inv.Value.AssetID;
- continue;
- }
+ if (inv.Value.Type == (int)AssetType.Animation)
+ animID = inv.Value.AssetID;
+ continue;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
if (animID == UUID.Zero)
target.Animator.RemoveAnimation(animation);
@@ -1541,6 +1539,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(name, out assetID))
{
+ m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
if (item.Type == 7 && item.Name == name)
@@ -1548,6 +1547,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
assetID = item.AssetID;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
}
if (assetID == UUID.Zero)
@@ -1594,6 +1594,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(name, out assetID))
{
+ m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
if (item.Type == 7 && item.Name == name)
@@ -1601,6 +1602,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
assetID = item.AssetID;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
}
if (assetID == UUID.Zero)
@@ -1651,6 +1653,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(name, out assetID))
{
+ m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
if (item.Type == 7 && item.Name == name)
@@ -1658,6 +1661,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
assetID = item.AssetID;
}
}
+ m_host.TaskInventory.LockItemsForRead(false);
}
if (assetID == UUID.Zero)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 063d50f..0f4a9ad 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -238,13 +238,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (part != null)
{
- lock (part.TaskInventory)
+ part.TaskInventory.LockItemsForRead(true);
+ if (part.TaskInventory.ContainsKey(m_ItemID))
{
- if (part.TaskInventory.ContainsKey(m_ItemID))
- {
- m_thisScriptTask = part.TaskInventory[m_ItemID];
- }
+ m_thisScriptTask = part.TaskInventory[m_ItemID];
}
+ part.TaskInventory.LockItemsForRead(false);
}
ApiManager am = new ApiManager();
@@ -429,14 +428,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
int permsMask;
UUID permsGranter;
- lock (part.TaskInventory)
+ part.TaskInventory.LockItemsForRead(true);
+ if (!part.TaskInventory.ContainsKey(m_ItemID))
{
- if (!part.TaskInventory.ContainsKey(m_ItemID))
- return;
-
- permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
- permsMask = part.TaskInventory[m_ItemID].PermsMask;
+ part.TaskInventory.LockItemsForRead(false);
+ return;
}
+ permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
+ permsMask = part.TaskInventory[m_ItemID].PermsMask;
+ part.TaskInventory.LockItemsForRead(false);
if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
{
--
cgit v1.1
From c81f37cf82c3a9d2aae92d5f44734fc5098c5b75 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Wed, 25 Nov 2009 17:01:41 +0000
Subject: Change osTeleportAgent parameters from long to int. That numerical
range is not even supported by the underlying type, so there is no need to
ask for a type the script can not even supply.
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++--
OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 +-
OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 83322eb..10165d3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -636,13 +636,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
// Teleport functions
- public void osTeleportAgent(string agent, uint regionX, uint regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
+ public void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
{
// High because there is no security check. High griefer potential
//
CheckThreatLevel(ThreatLevel.High, "osTeleportAgent");
- ulong regionHandle = Util.UIntsToLong((regionX * (uint)Constants.RegionSize), (regionY * (uint)Constants.RegionSize));
+ ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize));
m_host.AddScriptLPS(1);
UUID agentId = new UUID();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 2a403bf..470946a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
// Teleport commands
void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
- void osTeleportAgent(string agent, uint regionX, uint regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
+ void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
// Animation commands
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 4928e90..6b88834 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -201,9 +201,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat);
}
- public void osTeleportAgent(string agent, long regionX, long regionY, vector position, vector lookat)
+ public void osTeleportAgent(string agent, int regionX, int regionY, vector position, vector lookat)
{
- m_OSSL_Functions.osTeleportAgent(agent, (uint) regionX, (uint) regionY, position, lookat);
+ m_OSSL_Functions.osTeleportAgent(agent, regionX, regionY, position, lookat);
}
public void osTeleportAgent(string agent, vector position, vector lookat)
--
cgit v1.1
From de927adf2709f50d0fe85a1c59e7677d862d0d72 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Wed, 25 Nov 2009 20:01:21 +0000
Subject: Add the dummy "Size" property to the list type
---
OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 3f38bb6..1fc31c5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -429,6 +429,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
}
}
+ public int Size
+ {
+ get { return 0; }
+ }
+
public object[] Data
{
get {
--
cgit v1.1
From 22c325aa5ae06b897e5eb10404c0aa3727f8237b Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 26 Nov 2009 12:08:20 +0000
Subject: Remove GetAssemblyName and friends from the SE interface. It's now
handled internally
---
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 95 +++++++++++++++++++++++---
1 file changed, 86 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 8b94f28..4dc6cb8 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1248,20 +1248,97 @@ namespace OpenSim.Region.ScriptEngine.XEngine
}
}
- public string GetAssemblyName(UUID itemID)
- {
- IScriptInstance instance = GetInstance(itemID);
- if (instance == null)
- return "";
- return instance.GetAssemblyName();
- }
-
public string GetXMLState(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return "";
- return instance.GetXMLState();
+ string xml = instance.GetXMLState();
+
+ XmlDocument sdoc = new XmlDocument();
+ sdoc.LoadXml(xml);
+ XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState");
+ XmlNode rootNode = rootL[0];
+
+ // Create
+ XmlDocument doc = new XmlDocument();
+ XmlElement stateData = doc.CreateElement("", "State", "");
+ XmlAttribute stateID = doc.CreateAttribute("", "UUID", "");
+ stateID.Value = itemID.ToString();
+ stateData.Attributes.Append(stateID);
+ XmlAttribute assetID = doc.CreateAttribute("", "Asset", "");
+ assetID.Value = instance.AssetID.ToString();
+ stateData.Attributes.Append(assetID);
+ doc.AppendChild(stateData);
+
+ // Add ...
+ XmlNode xmlstate = doc.ImportNode(rootNode, true);
+ stateData.AppendChild(xmlstate);
+
+ string assemName = instance.GetAssemblyName();
+
+ string fn = Path.GetFileName(assemName);
+
+ string assem = String.Empty;
+
+ if (File.Exists(assemName + ".text"))
+ {
+ FileInfo tfi = new FileInfo(assemName + ".text");
+
+ if (tfi != null)
+ {
+ Byte[] tdata = new Byte[tfi.Length];
+
+ try
+ {
+ FileStream tfs = File.Open(assemName + ".text",
+ FileMode.Open, FileAccess.Read);
+ tfs.Read(tdata, 0, tdata.Length);
+ tfs.Close();
+
+ assem = new System.Text.ASCIIEncoding().GetString(tdata);
+ }
+ catch (Exception e)
+ {
+ m_log.DebugFormat("[XEngine]: Unable to open script textfile {0}, reason: {1}", assemName+".text", e.Message);
+ }
+ }
+ }
+ else
+ {
+ FileInfo fi = new FileInfo(assemName);
+
+ if (fi != null)
+ {
+ Byte[] data = new Byte[fi.Length];
+
+ try
+ {
+ FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read);
+ fs.Read(data, 0, data.Length);
+ fs.Close();
+
+ assem = System.Convert.ToBase64String(data);
+ }
+ catch (Exception e)
+ {
+ m_log.DebugFormat("[XEngine]: Unable to open script assembly {0}, reason: {1}", assemName, e.Message);
+ }
+
+ }
+ }
+
+ XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
+ XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", "");
+
+ assemblyName.Value = fn;
+ assemblyData.Attributes.Append(assemblyName);
+
+ assemblyData.InnerText = assem;
+
+ stateData.AppendChild(assemblyData);
+
+ return doc.InnerXml;
}
public bool CanBeDeleted(UUID itemID)
--
cgit v1.1
From 9888f95068373f1bfdb289e85560a7d873d22696 Mon Sep 17 00:00:00 2001
From: CasperW
Date: Fri, 27 Nov 2009 18:29:03 +0100
Subject: Convert multiple lock()s which directly hinder script performance in
linksets to ReaderWriterLockSlim.
---
.../Shared/Api/Implementation/LSL_Api.cs | 11 +-
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 415 ++++++++++++---------
2 files changed, 254 insertions(+), 172 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ec771e3..267928b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2950,8 +2950,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return m_host.OwnerID.ToString();
}
+ [DebuggerNonUserCode]
public void llInstantMessage(string user, string message)
{
+ UUID result;
+ if (!UUID.TryParse(user, out result))
+ {
+ throw new Exception(String.Format("An invalid key of '{0} was passed to llInstantMessage", user));
+ return;
+ }
+
+
m_host.AddScriptLPS(1);
// We may be able to use ClientView.SendInstantMessage here, but we need a client instance.
@@ -2966,7 +2975,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID friendTransactionID = UUID.Random();
//m_pendingFriendRequests.Add(friendTransactionID, fromAgentID);
-
+
GridInstantMessage msg = new GridInstantMessage();
msg.fromAgentID = new Guid(m_host.UUID.ToString()); // fromAgentID.Guid;
msg.toAgentID = new Guid(user); // toAgentID.Guid;
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index d997ea3..49c69ab 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -101,6 +101,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private Dictionary m_Scripts =
new Dictionary();
+ private OpenMetaverse.ReaderWriterLockSlim m_scriptsLock = new OpenMetaverse.ReaderWriterLockSlim();
+
// Maps the asset ID to the assembly
private Dictionary m_Assemblies =
@@ -122,6 +124,65 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private ScriptCompileQueue m_CompileQueue = new ScriptCompileQueue();
IWorkItemResult m_CurrentCompile = null;
+ private void lockScriptsForRead(bool locked)
+ {
+ if (locked)
+ {
+ if (m_scriptsLock.RecursiveReadCount > 0)
+ {
+ m_log.Error("[XEngine.m_Scripts] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
+ m_scriptsLock.ExitReadLock();
+ }
+ if (m_scriptsLock.RecursiveWriteCount > 0)
+ {
+ m_log.Error("[XEngine.m_Scripts] Recursive write lock requested. This should not happen and means something needs to be fixed.");
+ m_scriptsLock.ExitWriteLock();
+ }
+
+ while (!m_scriptsLock.TryEnterReadLock(60000))
+ {
+ m_log.Error("[XEngine.m_Scripts] Thread lock detected while trying to aquire READ lock of m_scripts in XEngine. I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
+ if (m_scriptsLock.IsWriteLockHeld)
+ {
+ m_scriptsLock = new OpenMetaverse.ReaderWriterLockSlim();
+ }
+ }
+ }
+ else
+ {
+ m_scriptsLock.ExitReadLock();
+ }
+ }
+ private void lockScriptsForWrite(bool locked)
+ {
+ if (locked)
+ {
+ if (m_scriptsLock.RecursiveReadCount > 0)
+ {
+ m_log.Error("[XEngine.m_Scripts] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
+ m_scriptsLock.ExitReadLock();
+ }
+ if (m_scriptsLock.RecursiveWriteCount > 0)
+ {
+ m_log.Error("[XEngine.m_Scripts] Recursive write lock requested. This should not happen and means something needs to be fixed.");
+ m_scriptsLock.ExitWriteLock();
+ }
+
+ while (!m_scriptsLock.TryEnterWriteLock(60000))
+ {
+ m_log.Error("[XEngine.m_Scripts] Thread lock detected while trying to aquire WRITE lock of m_scripts in XEngine. I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
+ if (m_scriptsLock.IsWriteLockHeld)
+ {
+ m_scriptsLock = new OpenMetaverse.ReaderWriterLockSlim();
+ }
+ }
+ }
+ else
+ {
+ m_scriptsLock.ExitWriteLock();
+ }
+ }
+
public string ScriptEngineName
{
get { return "XEngine"; }
@@ -261,43 +322,45 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public void RemoveRegion(Scene scene)
{
- lock (m_Scripts)
+ lockScriptsForRead(true);
+ foreach (IScriptInstance instance in m_Scripts.Values)
{
- foreach (IScriptInstance instance in m_Scripts.Values)
+ // Force a final state save
+ //
+ if (m_Assemblies.ContainsKey(instance.AssetID))
{
- // Force a final state save
- //
- if (m_Assemblies.ContainsKey(instance.AssetID))
- {
- string assembly = m_Assemblies[instance.AssetID];
- instance.SaveState(assembly);
- }
+ string assembly = m_Assemblies[instance.AssetID];
+ instance.SaveState(assembly);
+ }
- // Clear the event queue and abort the instance thread
- //
- instance.ClearQueue();
- instance.Stop(0);
+ // Clear the event queue and abort the instance thread
+ //
+ instance.ClearQueue();
+ instance.Stop(0);
- // Release events, timer, etc
- //
- instance.DestroyScriptInstance();
+ // Release events, timer, etc
+ //
+ instance.DestroyScriptInstance();
- // Unload scripts and app domains
- // Must be done explicitly because they have infinite
- // lifetime
- //
- m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
- if (m_DomainScripts[instance.AppDomain].Count == 0)
- {
- m_DomainScripts.Remove(instance.AppDomain);
- UnloadAppDomain(instance.AppDomain);
- }
+ // Unload scripts and app domains
+ // Must be done explicitly because they have infinite
+ // lifetime
+ //
+ m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
+ if (m_DomainScripts[instance.AppDomain].Count == 0)
+ {
+ m_DomainScripts.Remove(instance.AppDomain);
+ UnloadAppDomain(instance.AppDomain);
}
- m_Scripts.Clear();
- m_PrimObjects.Clear();
- m_Assemblies.Clear();
- m_DomainScripts.Clear();
}
+ lockScriptsForRead(false);
+ lockScriptsForWrite(true);
+ m_Scripts.Clear();
+ lockScriptsForWrite(false);
+ m_PrimObjects.Clear();
+ m_Assemblies.Clear();
+ m_DomainScripts.Clear();
+
lock (m_ScriptEngines)
{
m_ScriptEngines.Remove(this);
@@ -356,22 +419,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
List instances = new List();
- lock (m_Scripts)
- {
- foreach (IScriptInstance instance in m_Scripts.Values)
+ lockScriptsForRead(true);
+ foreach (IScriptInstance instance in m_Scripts.Values)
instances.Add(instance);
- }
+ lockScriptsForRead(false);
foreach (IScriptInstance i in instances)
{
string assembly = String.Empty;
- lock (m_Scripts)
- {
+
if (!m_Assemblies.ContainsKey(i.AssetID))
continue;
assembly = m_Assemblies[i.AssetID];
- }
+
i.SaveState(assembly);
}
@@ -673,172 +734,183 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false;
}
- lock (m_Scripts)
+
+
+ ScriptInstance instance = null;
+ // Create the object record
+ lockScriptsForRead(true);
+ if ((!m_Scripts.ContainsKey(itemID)) ||
+ (m_Scripts[itemID].AssetID != assetID))
{
- ScriptInstance instance = null;
- // Create the object record
+ lockScriptsForRead(false);
- if ((!m_Scripts.ContainsKey(itemID)) ||
- (m_Scripts[itemID].AssetID != assetID))
- {
- UUID appDomain = assetID;
+ UUID appDomain = assetID;
- if (part.ParentGroup.IsAttachment)
- appDomain = part.ParentGroup.RootPart.UUID;
+ if (part.ParentGroup.IsAttachment)
+ appDomain = part.ParentGroup.RootPart.UUID;
- if (!m_AppDomains.ContainsKey(appDomain))
+ if (!m_AppDomains.ContainsKey(appDomain))
+ {
+ try
{
- try
- {
- AppDomainSetup appSetup = new AppDomainSetup();
-// appSetup.ApplicationBase = Path.Combine(
-// "ScriptEngines",
-// m_Scene.RegionInfo.RegionID.ToString());
-
- Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
- Evidence evidence = new Evidence(baseEvidence);
-
- AppDomain sandbox;
- if (m_AppDomainLoading)
- sandbox = AppDomain.CreateDomain(
- m_Scene.RegionInfo.RegionID.ToString(),
- evidence, appSetup);
- else
- sandbox = AppDomain.CurrentDomain;
-
- //PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
- //AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
- //PermissionSet sandboxPermissionSet = sandboxPolicy.GetNamedPermissionSet("Internet");
- //PolicyStatement sandboxPolicyStatement = new PolicyStatement(sandboxPermissionSet);
- //CodeGroup sandboxCodeGroup = new UnionCodeGroup(sandboxMembershipCondition, sandboxPolicyStatement);
- //sandboxPolicy.RootCodeGroup = sandboxCodeGroup;
- //sandbox.SetAppDomainPolicy(sandboxPolicy);
-
- m_AppDomains[appDomain] = sandbox;
-
- m_AppDomains[appDomain].AssemblyResolve +=
- new ResolveEventHandler(
- AssemblyResolver.OnAssemblyResolve);
- m_DomainScripts[appDomain] = new List();
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[XEngine] Exception creating app domain:\n {0}", e.ToString());
- m_ScriptErrorMessage += "Exception creating app domain:\n";
- m_ScriptFailCount++;
- lock (m_AddingAssemblies)
- {
- m_AddingAssemblies[assembly]--;
- }
- return false;
- }
+ AppDomainSetup appSetup = new AppDomainSetup();
+ // appSetup.ApplicationBase = Path.Combine(
+ // "ScriptEngines",
+ // m_Scene.RegionInfo.RegionID.ToString());
+
+ Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
+ Evidence evidence = new Evidence(baseEvidence);
+
+ AppDomain sandbox;
+ if (m_AppDomainLoading)
+ sandbox = AppDomain.CreateDomain(
+ m_Scene.RegionInfo.RegionID.ToString(),
+ evidence, appSetup);
+ else
+ sandbox = AppDomain.CurrentDomain;
+
+ //PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
+ //AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
+ //PermissionSet sandboxPermissionSet = sandboxPolicy.GetNamedPermissionSet("Internet");
+ //PolicyStatement sandboxPolicyStatement = new PolicyStatement(sandboxPermissionSet);
+ //CodeGroup sandboxCodeGroup = new UnionCodeGroup(sandboxMembershipCondition, sandboxPolicyStatement);
+ //sandboxPolicy.RootCodeGroup = sandboxCodeGroup;
+ //sandbox.SetAppDomainPolicy(sandboxPolicy);
+
+ m_AppDomains[appDomain] = sandbox;
+
+ m_AppDomains[appDomain].AssemblyResolve +=
+ new ResolveEventHandler(
+ AssemblyResolver.OnAssemblyResolve);
+ m_DomainScripts[appDomain] = new List();
}
- m_DomainScripts[appDomain].Add(itemID);
-
- instance = new ScriptInstance(this, part,
- itemID, assetID, assembly,
- m_AppDomains[appDomain],
- part.ParentGroup.RootPart.Name,
- item.Name, startParam, postOnRez,
- stateSource, m_MaxScriptQueue);
-
- m_log.DebugFormat("[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}",
- part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, part.ParentGroup.RootPart.AbsolutePosition.ToString());
-
- if (presence != null)
+ catch (Exception e)
{
- ShowScriptSaveResponse(item.OwnerID,
- assetID, "Compile successful", true);
+ m_log.ErrorFormat("[XEngine] Exception creating app domain:\n {0}", e.ToString());
+ m_ScriptErrorMessage += "Exception creating app domain:\n";
+ m_ScriptFailCount++;
+ lock (m_AddingAssemblies)
+ {
+ m_AddingAssemblies[assembly]--;
+ }
+ return false;
}
+ }
+ m_DomainScripts[appDomain].Add(itemID);
- instance.AppDomain = appDomain;
- instance.LineMap = linemap;
+ instance = new ScriptInstance(this, part,
+ itemID, assetID, assembly,
+ m_AppDomains[appDomain],
+ part.ParentGroup.RootPart.Name,
+ item.Name, startParam, postOnRez,
+ stateSource, m_MaxScriptQueue);
- m_Scripts[itemID] = instance;
- }
+ m_log.DebugFormat("[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}",
+ part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, part.ParentGroup.RootPart.AbsolutePosition.ToString());
- lock (m_PrimObjects)
+ if (presence != null)
{
- if (!m_PrimObjects.ContainsKey(localID))
- m_PrimObjects[localID] = new List();
+ ShowScriptSaveResponse(item.OwnerID,
+ assetID, "Compile successful", true);
+ }
- if (!m_PrimObjects[localID].Contains(itemID))
- m_PrimObjects[localID].Add(itemID);
+ instance.AppDomain = appDomain;
+ instance.LineMap = linemap;
+ lockScriptsForWrite(true);
+ m_Scripts[itemID] = instance;
+ lockScriptsForWrite(false);
+ }
+ else
+ {
+ lockScriptsForRead(false);
+ }
+ lock (m_PrimObjects)
+ {
+ if (!m_PrimObjects.ContainsKey(localID))
+ m_PrimObjects[localID] = new List();
- }
+ if (!m_PrimObjects[localID].Contains(itemID))
+ m_PrimObjects[localID].Add(itemID);
- if (!m_Assemblies.ContainsKey(assetID))
- m_Assemblies[assetID] = assembly;
+ }
- lock (m_AddingAssemblies)
- {
- m_AddingAssemblies[assembly]--;
- }
+ if (!m_Assemblies.ContainsKey(assetID))
+ m_Assemblies[assetID] = assembly;
- if (instance!=null)
- instance.Init();
+ lock (m_AddingAssemblies)
+ {
+ m_AddingAssemblies[assembly]--;
}
+
+ if (instance!=null)
+ instance.Init();
+
return true;
}
public void OnRemoveScript(uint localID, UUID itemID)
{
- lock (m_Scripts)
+ lockScriptsForRead(true);
+ // Do we even have it?
+ if (!m_Scripts.ContainsKey(itemID))
{
- // Do we even have it?
- if (!m_Scripts.ContainsKey(itemID))
- return;
+ lockScriptsForRead(false);
+ return;
+ }
+
- IScriptInstance instance=m_Scripts[itemID];
- m_Scripts.Remove(itemID);
+ IScriptInstance instance=m_Scripts[itemID];
+ lockScriptsForRead(false);
+ lockScriptsForWrite(true);
+ m_Scripts.Remove(itemID);
+ lockScriptsForWrite(false);
+ instance.ClearQueue();
+ instance.Stop(0);
- instance.ClearQueue();
- instance.Stop(0);
+ SceneObjectPart part =
+ m_Scene.GetSceneObjectPart(localID);
- SceneObjectPart part =
- m_Scene.GetSceneObjectPart(localID);
-
- if (part != null)
- part.RemoveScriptEvents(itemID);
+ if (part != null)
+ part.RemoveScriptEvents(itemID);
// bool objectRemoved = false;
- lock (m_PrimObjects)
+ lock (m_PrimObjects)
+ {
+ // Remove the script from it's prim
+ if (m_PrimObjects.ContainsKey(localID))
{
- // Remove the script from it's prim
- if (m_PrimObjects.ContainsKey(localID))
- {
- // Remove inventory item record
- if (m_PrimObjects[localID].Contains(itemID))
- m_PrimObjects[localID].Remove(itemID);
+ // Remove inventory item record
+ if (m_PrimObjects[localID].Contains(itemID))
+ m_PrimObjects[localID].Remove(itemID);
- // If there are no more scripts, remove prim
- if (m_PrimObjects[localID].Count == 0)
- {
- m_PrimObjects.Remove(localID);
+ // If there are no more scripts, remove prim
+ if (m_PrimObjects[localID].Count == 0)
+ {
+ m_PrimObjects.Remove(localID);
// objectRemoved = true;
- }
}
}
+ }
- instance.RemoveState();
- instance.DestroyScriptInstance();
+ instance.RemoveState();
+ instance.DestroyScriptInstance();
- m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
- if (m_DomainScripts[instance.AppDomain].Count == 0)
- {
- m_DomainScripts.Remove(instance.AppDomain);
- UnloadAppDomain(instance.AppDomain);
- }
+ m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
+ if (m_DomainScripts[instance.AppDomain].Count == 0)
+ {
+ m_DomainScripts.Remove(instance.AppDomain);
+ UnloadAppDomain(instance.AppDomain);
+ }
- instance = null;
+ instance = null;
- ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
- if (handlerObjectRemoved != null)
- handlerObjectRemoved(part.UUID);
+ ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
+ if (handlerObjectRemoved != null)
+ handlerObjectRemoved(part.UUID);
- CleanAssemblies();
- }
+ CleanAssemblies();
+
ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
if (handlerScriptRemoved != null)
@@ -1091,12 +1163,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private IScriptInstance GetInstance(UUID itemID)
{
IScriptInstance instance;
- lock (m_Scripts)
+ lockScriptsForRead(true);
+ if (!m_Scripts.ContainsKey(itemID))
{
- if (!m_Scripts.ContainsKey(itemID))
- return null;
- instance = m_Scripts[itemID];
+ lockScriptsForRead(false);
+ return null;
}
+ instance = m_Scripts[itemID];
+ lockScriptsForRead(false);
return instance;
}
@@ -1200,11 +1274,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{
List instances = new List();
- lock (m_Scripts)
- {
- foreach (IScriptInstance instance in m_Scripts.Values)
+ lockScriptsForRead(true);
+ foreach (IScriptInstance instance in m_Scripts.Values)
instances.Add(instance);
- }
+ lockScriptsForRead(false);
foreach (IScriptInstance i in instances)
{
--
cgit v1.1
From ceccfe02d0e25c234560b6ef25306b8db4cd9875 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sun, 6 Dec 2009 00:02:24 +0000
Subject: Eliminate multiple updates on link/unlink
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++++++++
1 file changed, 8 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 267928b..e694f15 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3588,6 +3588,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
parentPrim.DelinkFromGroup(part.LocalId, true);
}
+ parentPrim.HasGroupChanged = true;
+ parentPrim.ScheduleGroupForFullUpdate();
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
if (parts.Count > 0)
@@ -3599,6 +3601,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
part.UpdateFlag = 0;
newRoot.ParentGroup.LinkToGroup(part.ParentGroup);
}
+ newRoot.ParentGroup.HasGroupChanged = true;
+ newRoot.ParentGroup.ScheduleGroupForFullUpdate();
}
}
else
@@ -3607,6 +3611,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
parentPrim.DelinkFromGroup(childPrim.LocalId, true);
+ parentPrim.HasGroupChanged = true;
+ parentPrim.ScheduleGroupForFullUpdate();
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
}
}
@@ -3626,6 +3632,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
parentPrim.DelinkFromGroup(part.LocalId, true);
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
}
+ parentPrim.HasGroupChanged = true;
+ parentPrim.ScheduleGroupForFullUpdate();
}
public LSL_String llGetLinkKey(int linknum)
--
cgit v1.1
From 172e2f4e7609c278d02ad83ca207fd79624db587 Mon Sep 17 00:00:00 2001
From: CasperW
Date: Sun, 6 Dec 2009 17:23:07 +0100
Subject: Fix to existing ReaderWriterLockSlim implementations
---
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 49c69ab..184af19 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -150,7 +150,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
}
else
{
- m_scriptsLock.ExitReadLock();
+ if (m_scriptsLock.RecursiveReadCount > 0)
+ {
+ m_scriptsLock.ExitReadLock();
+ }
}
}
private void lockScriptsForWrite(bool locked)
@@ -179,7 +182,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
}
else
{
- m_scriptsLock.ExitWriteLock();
+ if (m_scriptsLock.RecursiveWriteCount > 0)
+ {
+ m_scriptsLock.ExitWriteLock();
+ }
}
}
--
cgit v1.1
From e3f229225c5a1506090bfcffcce6d423a566f1fe Mon Sep 17 00:00:00 2001
From: unknown
Date: Wed, 9 Dec 2009 01:34:26 +0100
Subject: Enable scripting interface for windlight
---
.../Shared/Api/Implementation/OSSL_Api.cs | 333 +++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 7 +-
.../Shared/Api/Runtime/LSL_Constants.cs | 38 +++
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 +
4 files changed, 387 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 7f739b1..33c67d5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -42,6 +42,7 @@ using OpenSim.Region.CoreModules.Avatar.NPC;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Hypergrid;
+using OpenSim.Region.CoreModules.World.Meta7Windlight;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
@@ -1974,5 +1975,337 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return ret;
}
+ ///
+ /// Get the current Windlight scene
+ ///
+ /// List of windlight parameters
+ public LSL_List osGetWindlightScene(LSL_List rules)
+ {
+ CheckThreatLevel(ThreatLevel.Low, "osGetWindlightScene");
+ m_host.AddScriptLPS(1);
+ RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
+
+ LSL_List values = new LSL_List();
+ int idx = 0;
+ while (idx < rules.Length)
+ {
+ uint rule = (uint)rules.GetLSLIntegerItem(idx);
+ LSL_List toadd = new LSL_List();
+
+ switch (rule)
+ {
+ case (int)ScriptBaseClass.WL_AMBIENT:
+ toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W));
+ break;
+ case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
+ toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f));
+ break;
+ case (int)ScriptBaseClass.WL_BLUE_DENSITY:
+ toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W));
+ break;
+ case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
+ toadd.Add(new LSL_Float(wl.blurMultiplier));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COLOR:
+ toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
+ toadd.Add(new LSL_Float(wl.cloudCoverage));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
+ toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCALE:
+ toadd.Add(new LSL_Float(wl.cloudScale));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
+ toadd.Add(new LSL_Float(wl.cloudScrollX));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
+ toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
+ toadd.Add(new LSL_Float(wl.cloudScrollY));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
+ toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
+ toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z));
+ break;
+ case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
+ toadd.Add(new LSL_Float(wl.densityMultiplier));
+ break;
+ case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
+ toadd.Add(new LSL_Float(wl.distanceMultiplier));
+ break;
+ case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
+ toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0));
+ break;
+ case (int)ScriptBaseClass.WL_EAST_ANGLE:
+ toadd.Add(new LSL_Float(wl.eastAngle));
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
+ toadd.Add(new LSL_Float(wl.fresnelOffset));
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
+ toadd.Add(new LSL_Float(wl.fresnelScale));
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_DENSITY:
+ toadd.Add(new LSL_Float(wl.hazeDensity));
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_HORIZON:
+ toadd.Add(new LSL_Float(wl.hazeHorizon));
+ break;
+ case (int)ScriptBaseClass.WL_HORIZON:
+ toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W));
+ break;
+ case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
+ toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f));
+ break;
+ case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
+ toadd.Add(new LSL_Integer(wl.maxAltitude));
+ break;
+ case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
+ toadd.Add(new LSL_Key(wl.normalMapTexture.ToString()));
+ break;
+ case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
+ toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z));
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
+ toadd.Add(new LSL_Float(wl.refractScaleAbove));
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
+ toadd.Add(new LSL_Float(wl.refractScaleBelow));
+ break;
+ case (int)ScriptBaseClass.WL_SCENE_GAMMA:
+ toadd.Add(new LSL_Float(wl.sceneGamma));
+ break;
+ case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
+ toadd.Add(new LSL_Float(wl.starBrightness));
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
+ toadd.Add(new LSL_Float(wl.sunGlowFocus));
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
+ toadd.Add(new LSL_Float(wl.sunGlowSize));
+ break;
+ case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
+ toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W));
+ break;
+ case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
+ toadd.Add(new LSL_Float(wl.underwaterFogModifier));
+ break;
+ case (int)ScriptBaseClass.WL_WATER_COLOR:
+ toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z));
+ break;
+ case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
+ toadd.Add(new LSL_Float(wl.waterFogDensityExponent));
+ break;
+ }
+
+ if (toadd.Length > 0)
+ {
+ values.Add(rule);
+ values.Add(toadd.Data[0]);
+ }
+ idx++;
+ }
+
+
+ return values;
+
+ }
+
+ ///
+ /// Set the current Windlight scene
+ ///
+ ///
+ /// success: true or false
+ public int osSetWindlightScene(LSL_List rules)
+ {
+ CheckThreatLevel(ThreatLevel.High, "osSetWindlightScene");
+ int success = 0;
+ m_host.AddScriptLPS(1);
+ if (Meta7WindlightModule.EnableWindlight)
+ {
+ RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
+
+ LSL_List values = new LSL_List();
+ int idx = 0;
+ success = 1;
+ while (idx < rules.Length)
+ {
+ uint rule = (uint)rules.GetLSLIntegerItem(idx);
+ LSL_Types.Quaternion iQ;
+ LSL_Types.Vector3 iV;
+ switch (rule)
+ {
+ case (int)ScriptBaseClass.WL_AMBIENT:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
+ break;
+ case (int)ScriptBaseClass.WL_BLUE_DENSITY:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
+ idx++;
+ wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COLOR:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
+ idx++;
+ wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCALE:
+ idx++;
+ wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
+ idx++;
+ wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
+ idx++;
+ wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
+ idx++;
+ wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
+ idx++;
+ wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
+ idx++;
+ wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
+ idx++;
+ wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
+ idx++;
+ wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
+ break;
+ case (int)ScriptBaseClass.WL_EAST_ANGLE:
+ idx++;
+ wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
+ idx++;
+ wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
+ idx++;
+ wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_DENSITY:
+ idx++;
+ wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_HORIZON:
+ idx++;
+ wl.hazeHorizon= (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_HORIZON:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
+ break;
+ case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
+ idx++;
+ wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
+ break;
+ case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
+ idx++;
+ wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
+ break;
+ case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.reflectionWaveletScale= new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
+ idx++;
+ wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
+ idx++;
+ wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SCENE_GAMMA:
+ idx++;
+ wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
+ idx++;
+ wl.starBrightness= (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
+ idx++;
+ wl.sunGlowFocus= (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
+ idx++;
+ wl.sunGlowSize= (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
+ idx++;
+ wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_WATER_COLOR:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
+ idx++;
+ wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
+ break;
+ default:
+ success = 0;
+ break;
+ }
+ idx++;
+ }
+ m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
+
+ }
+ return success;
+ }
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 0b0dc00..dd2869b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
// Avatar Info Commands
string osGetAgentIP(string agent);
LSL_List osGetAgents();
-
+
// Teleport commands
void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
@@ -163,5 +163,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
key osGetMapTexture();
key osGetRegionMapTexture(string regionName);
LSL_List osGetRegionStats();
+
+ // Windlight Functions
+ LSL_List osGetWindlightScene(LSL_List rules);
+ int osSetWindlightScene(LSL_List rules);
+
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index acff8fb..4956c28 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -539,5 +539,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int STATS_ACTIVE_SCRIPTS = 19;
public const int STATS_SCRIPT_LPS = 20;
+ // Constants for osWindlight*
+ public const int WL_WATER_COLOR = 0;
+ public const int WL_WATER_FOG_DENSITY_EXPONENT = 1;
+ public const int WL_UNDERWATER_FOG_MODIFIER = 2;
+ public const int WL_REFLECTION_WAVELET_SCALE = 3;
+ public const int WL_FRESNEL_SCALE = 4;
+ public const int WL_FRESNEL_OFFSET = 5;
+ public const int WL_REFRACT_SCALE_ABOVE = 6;
+ public const int WL_REFRACT_SCALE_BELOW = 7;
+ public const int WL_BLUR_MULTIPLIER = 8;
+ public const int WL_BIG_WAVE_DIRECTION = 9;
+ public const int WL_LITTLE_WAVE_DIRECTION = 10;
+ public const int WL_NORMAL_MAP_TEXTURE = 11;
+ public const int WL_HORIZON = 12;
+ public const int WL_HAZE_HORIZON = 13;
+ public const int WL_BLUE_DENSITY = 14;
+ public const int WL_HAZE_DENSITY = 15;
+ public const int WL_DENSITY_MULTIPLIER = 16;
+ public const int WL_DISTANCE_MULTIPLIER = 17;
+ public const int WL_MAX_ALTITUDE = 18;
+ public const int WL_SUN_MOON_COLOR = 19;
+ public const int WL_AMBIENT = 20;
+ public const int WL_EAST_ANGLE = 21;
+ public const int WL_SUN_GLOW_FOCUS = 22;
+ public const int WL_SUN_GLOW_SIZE = 23;
+ public const int WL_SCENE_GAMMA = 24;
+ public const int WL_STAR_BRIGHTNESS = 25;
+ public const int WL_CLOUD_COLOR = 26;
+ public const int WL_CLOUD_XY_DENSITY = 27;
+ public const int WL_CLOUD_COVERAGE = 28;
+ public const int WL_CLOUD_SCALE = 29;
+ public const int WL_CLOUD_DETAIL_XY_DENSITY = 30;
+ public const int WL_CLOUD_SCROLL_X = 31;
+ public const int WL_CLOUD_SCROLL_Y = 32;
+ public const int WL_CLOUD_SCROLL_Y_LOCK = 33;
+ public const int WL_CLOUD_SCROLL_X_LOCK = 34;
+ public const int WL_DRAW_CLASSIC_CLOUDS = 35;
+
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 519463e..1480b8b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -637,5 +637,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_OSSL_Functions.osGetRegionStats();
}
+
+ public LSL_List osGetWindlightScene(LSL_List rules)
+ {
+ return m_OSSL_Functions.osGetWindlightScene(rules);
+ }
+
+ public int osSetWindlightScene(LSL_List rules)
+ {
+ return m_OSSL_Functions.osSetWindlightScene(rules);
+ }
}
}
--
cgit v1.1
From a6a6bf007a2fb0e33daefc0ea7c4ad968a85d08e Mon Sep 17 00:00:00 2001
From: CasperW
Date: Wed, 9 Dec 2009 22:57:35 +0100
Subject: Move osFunctions into a new Careminster script interface
---
.../Shared/Api/Implementation/CM_Api.cs | 430 +++++++++++++++++++++
.../Shared/Api/Implementation/OSSL_Api.cs | 334 ----------------
.../ScriptEngine/Shared/Api/Interface/ICM_Api.cs | 20 +
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 5 -
.../Shared/Api/Runtime/CM_Constants.cs | 76 ++++
.../ScriptEngine/Shared/Api/Runtime/CM_Stub.cs | 71 ++++
.../Shared/Api/Runtime/LSL_Constants.cs | 38 --
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 -
8 files changed, 597 insertions(+), 387 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_Constants.cs
create mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
(limited to 'OpenSim/Region/ScriptEngine')
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..4cc2f0a
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -0,0 +1,430 @@
+using System;
+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.Meta7Windlight;
+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 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 uint m_localID;
+ internal UUID m_itemID;
+ internal bool m_CMFunctionsEnabled = false;
+ internal IScriptModuleComms m_comms = null;
+
+ public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
+ {
+ m_ScriptEngine = ScriptEngine;
+ m_host = host;
+ m_localID = localID;
+ m_itemID = itemID;
+
+ if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false))
+ m_CMFunctionsEnabled = true;
+
+ m_comms = m_ScriptEngine.World.RequestModuleInterface();
+ if (m_comms == null)
+ m_CMFunctionsEnabled = false;
+ }
+
+ 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; }
+ }
+
+ //
+ //Dumps an error message on the debug console.
+ //
+
+ internal void CMShoutError(string message)
+ {
+ if (message.Length > 1023)
+ message = message.Substring(0, 1023);
+
+ World.SimChat(Utils.StringToBytes(message),
+ ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true);
+
+ IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface();
+ wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
+ }
+
+ ///
+ /// Get the current Windlight scene
+ ///
+ /// List of windlight parameters
+ public LSL_List cmGetWindlightScene(LSL_List rules)
+ {
+ if (!m_CMFunctionsEnabled)
+ {
+ CMShoutError("Careminster functions are not enabled.");
+ return new LSL_List();
+ }
+ m_host.AddScriptLPS(1);
+ RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
+
+ LSL_List values = new LSL_List();
+ int idx = 0;
+ while (idx < rules.Length)
+ {
+ uint rule = (uint)rules.GetLSLIntegerItem(idx);
+ LSL_List toadd = new LSL_List();
+
+ switch (rule)
+ {
+ case (int)ScriptBaseClass.WL_AMBIENT:
+ toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W));
+ break;
+ case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
+ toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f));
+ break;
+ case (int)ScriptBaseClass.WL_BLUE_DENSITY:
+ toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W));
+ break;
+ case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
+ toadd.Add(new LSL_Float(wl.blurMultiplier));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COLOR:
+ toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
+ toadd.Add(new LSL_Float(wl.cloudCoverage));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
+ toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCALE:
+ toadd.Add(new LSL_Float(wl.cloudScale));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
+ toadd.Add(new LSL_Float(wl.cloudScrollX));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
+ toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
+ toadd.Add(new LSL_Float(wl.cloudScrollY));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
+ toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
+ toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z));
+ break;
+ case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
+ toadd.Add(new LSL_Float(wl.densityMultiplier));
+ break;
+ case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
+ toadd.Add(new LSL_Float(wl.distanceMultiplier));
+ break;
+ case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
+ toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0));
+ break;
+ case (int)ScriptBaseClass.WL_EAST_ANGLE:
+ toadd.Add(new LSL_Float(wl.eastAngle));
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
+ toadd.Add(new LSL_Float(wl.fresnelOffset));
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
+ toadd.Add(new LSL_Float(wl.fresnelScale));
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_DENSITY:
+ toadd.Add(new LSL_Float(wl.hazeDensity));
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_HORIZON:
+ toadd.Add(new LSL_Float(wl.hazeHorizon));
+ break;
+ case (int)ScriptBaseClass.WL_HORIZON:
+ toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W));
+ break;
+ case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
+ toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f));
+ break;
+ case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
+ toadd.Add(new LSL_Integer(wl.maxAltitude));
+ break;
+ case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
+ toadd.Add(new LSL_Key(wl.normalMapTexture.ToString()));
+ break;
+ case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
+ toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z));
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
+ toadd.Add(new LSL_Float(wl.refractScaleAbove));
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
+ toadd.Add(new LSL_Float(wl.refractScaleBelow));
+ break;
+ case (int)ScriptBaseClass.WL_SCENE_GAMMA:
+ toadd.Add(new LSL_Float(wl.sceneGamma));
+ break;
+ case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
+ toadd.Add(new LSL_Float(wl.starBrightness));
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
+ toadd.Add(new LSL_Float(wl.sunGlowFocus));
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
+ toadd.Add(new LSL_Float(wl.sunGlowSize));
+ break;
+ case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
+ toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W));
+ break;
+ case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
+ toadd.Add(new LSL_Float(wl.underwaterFogModifier));
+ break;
+ case (int)ScriptBaseClass.WL_WATER_COLOR:
+ toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z));
+ break;
+ case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
+ toadd.Add(new LSL_Float(wl.waterFogDensityExponent));
+ break;
+ }
+
+ if (toadd.Length > 0)
+ {
+ values.Add(rule);
+ values.Add(toadd.Data[0]);
+ }
+ idx++;
+ }
+
+
+ return values;
+
+ }
+
+ ///
+ /// Set the current Windlight scene
+ ///
+ ///
+ /// success: true or false
+ public int cmSetWindlightScene(LSL_List rules)
+ {
+ if (!m_CMFunctionsEnabled)
+ {
+ CMShoutError("Careminster functions are not enabled.");
+ return 0;
+ }
+ int success = 0;
+ m_host.AddScriptLPS(1);
+ if (Meta7WindlightModule.EnableWindlight)
+ {
+ RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
+
+ LSL_List values = new LSL_List();
+ int idx = 0;
+ success = 1;
+ while (idx < rules.Length)
+ {
+ uint rule = (uint)rules.GetLSLIntegerItem(idx);
+ LSL_Types.Quaternion iQ;
+ LSL_Types.Vector3 iV;
+ switch (rule)
+ {
+ case (int)ScriptBaseClass.WL_AMBIENT:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
+ break;
+ case (int)ScriptBaseClass.WL_BLUE_DENSITY:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
+ idx++;
+ wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COLOR:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
+ idx++;
+ wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCALE:
+ idx++;
+ wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
+ idx++;
+ wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
+ idx++;
+ wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
+ idx++;
+ wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
+ idx++;
+ wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
+ idx++;
+ wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
+ idx++;
+ wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
+ idx++;
+ wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
+ break;
+ case (int)ScriptBaseClass.WL_EAST_ANGLE:
+ idx++;
+ wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
+ idx++;
+ wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
+ idx++;
+ wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_DENSITY:
+ idx++;
+ wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_HORIZON:
+ idx++;
+ wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_HORIZON:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
+ break;
+ case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
+ idx++;
+ wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
+ break;
+ case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
+ idx++;
+ wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
+ break;
+ case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
+ idx++;
+ wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
+ idx++;
+ wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SCENE_GAMMA:
+ idx++;
+ wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
+ idx++;
+ wl.starBrightness = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
+ idx++;
+ wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
+ idx++;
+ wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
+ idx++;
+ wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_WATER_COLOR:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
+ idx++;
+ wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
+ break;
+ default:
+ success = 0;
+ break;
+ }
+ idx++;
+ }
+ m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
+
+ }
+ return success;
+ }
+
+ }
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 33c67d5..836f276 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -42,7 +42,6 @@ using OpenSim.Region.CoreModules.Avatar.NPC;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Hypergrid;
-using OpenSim.Region.CoreModules.World.Meta7Windlight;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
@@ -1974,338 +1973,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
return ret;
}
-
- ///
- /// Get the current Windlight scene
- ///
- /// List of windlight parameters
- public LSL_List osGetWindlightScene(LSL_List rules)
- {
- CheckThreatLevel(ThreatLevel.Low, "osGetWindlightScene");
- m_host.AddScriptLPS(1);
- RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
-
- LSL_List values = new LSL_List();
- int idx = 0;
- while (idx < rules.Length)
- {
- uint rule = (uint)rules.GetLSLIntegerItem(idx);
- LSL_List toadd = new LSL_List();
-
- switch (rule)
- {
- case (int)ScriptBaseClass.WL_AMBIENT:
- toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W));
- break;
- case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
- toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f));
- break;
- case (int)ScriptBaseClass.WL_BLUE_DENSITY:
- toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W));
- break;
- case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
- toadd.Add(new LSL_Float(wl.blurMultiplier));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_COLOR:
- toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
- toadd.Add(new LSL_Float(wl.cloudCoverage));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
- toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCALE:
- toadd.Add(new LSL_Float(wl.cloudScale));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
- toadd.Add(new LSL_Float(wl.cloudScrollX));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
- toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
- toadd.Add(new LSL_Float(wl.cloudScrollY));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
- toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
- toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z));
- break;
- case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
- toadd.Add(new LSL_Float(wl.densityMultiplier));
- break;
- case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
- toadd.Add(new LSL_Float(wl.distanceMultiplier));
- break;
- case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
- toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0));
- break;
- case (int)ScriptBaseClass.WL_EAST_ANGLE:
- toadd.Add(new LSL_Float(wl.eastAngle));
- break;
- case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
- toadd.Add(new LSL_Float(wl.fresnelOffset));
- break;
- case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
- toadd.Add(new LSL_Float(wl.fresnelScale));
- break;
- case (int)ScriptBaseClass.WL_HAZE_DENSITY:
- toadd.Add(new LSL_Float(wl.hazeDensity));
- break;
- case (int)ScriptBaseClass.WL_HAZE_HORIZON:
- toadd.Add(new LSL_Float(wl.hazeHorizon));
- break;
- case (int)ScriptBaseClass.WL_HORIZON:
- toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W));
- break;
- case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
- toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f));
- break;
- case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
- toadd.Add(new LSL_Integer(wl.maxAltitude));
- break;
- case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
- toadd.Add(new LSL_Key(wl.normalMapTexture.ToString()));
- break;
- case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
- toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z));
- break;
- case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
- toadd.Add(new LSL_Float(wl.refractScaleAbove));
- break;
- case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
- toadd.Add(new LSL_Float(wl.refractScaleBelow));
- break;
- case (int)ScriptBaseClass.WL_SCENE_GAMMA:
- toadd.Add(new LSL_Float(wl.sceneGamma));
- break;
- case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
- toadd.Add(new LSL_Float(wl.starBrightness));
- break;
- case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
- toadd.Add(new LSL_Float(wl.sunGlowFocus));
- break;
- case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
- toadd.Add(new LSL_Float(wl.sunGlowSize));
- break;
- case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
- toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W));
- break;
- case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
- toadd.Add(new LSL_Float(wl.underwaterFogModifier));
- break;
- case (int)ScriptBaseClass.WL_WATER_COLOR:
- toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z));
- break;
- case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
- toadd.Add(new LSL_Float(wl.waterFogDensityExponent));
- break;
- }
-
- if (toadd.Length > 0)
- {
- values.Add(rule);
- values.Add(toadd.Data[0]);
- }
- idx++;
- }
-
-
- return values;
-
- }
-
- ///
- /// Set the current Windlight scene
- ///
- ///
- /// success: true or false
- public int osSetWindlightScene(LSL_List rules)
- {
- CheckThreatLevel(ThreatLevel.High, "osSetWindlightScene");
- int success = 0;
- m_host.AddScriptLPS(1);
- if (Meta7WindlightModule.EnableWindlight)
- {
- RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
-
- LSL_List values = new LSL_List();
- int idx = 0;
- success = 1;
- while (idx < rules.Length)
- {
- uint rule = (uint)rules.GetLSLIntegerItem(idx);
- LSL_Types.Quaternion iQ;
- LSL_Types.Vector3 iV;
- switch (rule)
- {
- case (int)ScriptBaseClass.WL_AMBIENT:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
- break;
- case (int)ScriptBaseClass.WL_BLUE_DENSITY:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
- idx++;
- wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_COLOR:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
- idx++;
- wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCALE:
- idx++;
- wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
- idx++;
- wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
- idx++;
- wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
- idx++;
- wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
- idx++;
- wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
- break;
- case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
- break;
- case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
- idx++;
- wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
- idx++;
- wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
- idx++;
- wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
- break;
- case (int)ScriptBaseClass.WL_EAST_ANGLE:
- idx++;
- wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
- idx++;
- wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
- idx++;
- wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_HAZE_DENSITY:
- idx++;
- wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_HAZE_HORIZON:
- idx++;
- wl.hazeHorizon= (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_HORIZON:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
- break;
- case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
- idx++;
- wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
- break;
- case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
- idx++;
- wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
- break;
- case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.reflectionWaveletScale= new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
- break;
- case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
- idx++;
- wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
- idx++;
- wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_SCENE_GAMMA:
- idx++;
- wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
- idx++;
- wl.starBrightness= (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
- idx++;
- wl.sunGlowFocus= (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
- idx++;
- wl.sunGlowSize= (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
- idx++;
- wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_WATER_COLOR:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
- break;
- case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
- idx++;
- wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
- break;
- default:
- success = 0;
- break;
- }
- idx++;
- }
- m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
-
- }
- return success;
- }
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
new file mode 100644
index 0000000..9dd0b73
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
@@ -0,0 +1,20 @@
+using System.Collections;
+using OpenSim.Region.ScriptEngine.Interfaces;
+
+using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
+using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
+using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
+using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
+using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
+using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
+using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
+
+namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
+{
+ public interface ICM_Api
+ {
+ // Windlight Functions
+ LSL_List cmGetWindlightScene(LSL_List rules);
+ int cmSetWindlightScene(LSL_List rules);
+ }
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index dd2869b..c3bf7d2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -163,10 +163,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
key osGetMapTexture();
key osGetRegionMapTexture(string regionName);
LSL_List osGetRegionStats();
-
- // Windlight Functions
- LSL_List osGetWindlightScene(LSL_List rules);
- int osSetWindlightScene(LSL_List rules);
-
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs
new file mode 100644
index 0000000..7b67fa3
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs
@@ -0,0 +1,76 @@
+/*
+ * 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 vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
+using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
+using LSLInteger = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
+
+namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
+{
+ public partial class ScriptBaseClass
+ {
+ // Constants for cmWindlight*
+ public const int WL_WATER_COLOR = 0;
+ public const int WL_WATER_FOG_DENSITY_EXPONENT = 1;
+ public const int WL_UNDERWATER_FOG_MODIFIER = 2;
+ public const int WL_REFLECTION_WAVELET_SCALE = 3;
+ public const int WL_FRESNEL_SCALE = 4;
+ public const int WL_FRESNEL_OFFSET = 5;
+ public const int WL_REFRACT_SCALE_ABOVE = 6;
+ public const int WL_REFRACT_SCALE_BELOW = 7;
+ public const int WL_BLUR_MULTIPLIER = 8;
+ public const int WL_BIG_WAVE_DIRECTION = 9;
+ public const int WL_LITTLE_WAVE_DIRECTION = 10;
+ public const int WL_NORMAL_MAP_TEXTURE = 11;
+ public const int WL_HORIZON = 12;
+ public const int WL_HAZE_HORIZON = 13;
+ public const int WL_BLUE_DENSITY = 14;
+ public const int WL_HAZE_DENSITY = 15;
+ public const int WL_DENSITY_MULTIPLIER = 16;
+ public const int WL_DISTANCE_MULTIPLIER = 17;
+ public const int WL_MAX_ALTITUDE = 18;
+ public const int WL_SUN_MOON_COLOR = 19;
+ public const int WL_AMBIENT = 20;
+ public const int WL_EAST_ANGLE = 21;
+ public const int WL_SUN_GLOW_FOCUS = 22;
+ public const int WL_SUN_GLOW_SIZE = 23;
+ public const int WL_SCENE_GAMMA = 24;
+ public const int WL_STAR_BRIGHTNESS = 25;
+ public const int WL_CLOUD_COLOR = 26;
+ public const int WL_CLOUD_XY_DENSITY = 27;
+ public const int WL_CLOUD_COVERAGE = 28;
+ public const int WL_CLOUD_SCALE = 29;
+ public const int WL_CLOUD_DETAIL_XY_DENSITY = 30;
+ public const int WL_CLOUD_SCROLL_X = 31;
+ public const int WL_CLOUD_SCROLL_Y = 32;
+ public const int WL_CLOUD_SCROLL_Y_LOCK = 33;
+ public const int WL_CLOUD_SCROLL_X_LOCK = 34;
+ public const int WL_DRAW_CLASSIC_CLOUDS = 35;
+
+ }
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
new file mode 100644
index 0000000..e85d41e
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
@@ -0,0 +1,71 @@
+/*
+ * 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.Runtime.Remoting.Lifetime;
+using System.Threading;
+using System.Reflection;
+using System.Collections;
+using System.Collections.Generic;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.ScriptEngine.Interfaces;
+using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
+using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
+using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
+using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
+using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
+using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
+using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
+using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
+using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
+
+namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
+{
+ public partial class ScriptBaseClass : MarshalByRefObject
+ {
+ public ICM_Api m_CM_Functions;
+
+ public void ApiTypeCM(IScriptApi api)
+ {
+ if (!(api is ICM_Api))
+ return;
+
+ m_CM_Functions = (ICM_Api)api;
+ }
+
+ public LSL_List cmGetWindlightScene(LSL_List rules)
+ {
+ return m_CM_Functions.cmGetWindlightScene(rules);
+ }
+
+ public int cmSetWindlightScene(LSL_List rules)
+ {
+ return m_CM_Functions.cmSetWindlightScene(rules);
+ }
+ }
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 4956c28..acff8fb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -539,43 +539,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int STATS_ACTIVE_SCRIPTS = 19;
public const int STATS_SCRIPT_LPS = 20;
- // Constants for osWindlight*
- public const int WL_WATER_COLOR = 0;
- public const int WL_WATER_FOG_DENSITY_EXPONENT = 1;
- public const int WL_UNDERWATER_FOG_MODIFIER = 2;
- public const int WL_REFLECTION_WAVELET_SCALE = 3;
- public const int WL_FRESNEL_SCALE = 4;
- public const int WL_FRESNEL_OFFSET = 5;
- public const int WL_REFRACT_SCALE_ABOVE = 6;
- public const int WL_REFRACT_SCALE_BELOW = 7;
- public const int WL_BLUR_MULTIPLIER = 8;
- public const int WL_BIG_WAVE_DIRECTION = 9;
- public const int WL_LITTLE_WAVE_DIRECTION = 10;
- public const int WL_NORMAL_MAP_TEXTURE = 11;
- public const int WL_HORIZON = 12;
- public const int WL_HAZE_HORIZON = 13;
- public const int WL_BLUE_DENSITY = 14;
- public const int WL_HAZE_DENSITY = 15;
- public const int WL_DENSITY_MULTIPLIER = 16;
- public const int WL_DISTANCE_MULTIPLIER = 17;
- public const int WL_MAX_ALTITUDE = 18;
- public const int WL_SUN_MOON_COLOR = 19;
- public const int WL_AMBIENT = 20;
- public const int WL_EAST_ANGLE = 21;
- public const int WL_SUN_GLOW_FOCUS = 22;
- public const int WL_SUN_GLOW_SIZE = 23;
- public const int WL_SCENE_GAMMA = 24;
- public const int WL_STAR_BRIGHTNESS = 25;
- public const int WL_CLOUD_COLOR = 26;
- public const int WL_CLOUD_XY_DENSITY = 27;
- public const int WL_CLOUD_COVERAGE = 28;
- public const int WL_CLOUD_SCALE = 29;
- public const int WL_CLOUD_DETAIL_XY_DENSITY = 30;
- public const int WL_CLOUD_SCROLL_X = 31;
- public const int WL_CLOUD_SCROLL_Y = 32;
- public const int WL_CLOUD_SCROLL_Y_LOCK = 33;
- public const int WL_CLOUD_SCROLL_X_LOCK = 34;
- public const int WL_DRAW_CLASSIC_CLOUDS = 35;
-
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 1480b8b..519463e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -637,15 +637,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_OSSL_Functions.osGetRegionStats();
}
-
- public LSL_List osGetWindlightScene(LSL_List rules)
- {
- return m_OSSL_Functions.osGetWindlightScene(rules);
- }
-
- public int osSetWindlightScene(LSL_List rules)
- {
- return m_OSSL_Functions.osSetWindlightScene(rules);
- }
}
}
--
cgit v1.1
From 6dbe25360ec3dc3c998378da8b422751d3e032a9 Mon Sep 17 00:00:00 2001
From: CasperW
Date: Thu, 17 Dec 2009 18:40:34 +0100
Subject: Add cmSetWindlightSceneTargeted. Add restrictions on windlight script
use.
---
.../Shared/Api/Implementation/CM_Api.cs | 401 ++++++++++++---------
.../ScriptEngine/Shared/Api/Interface/ICM_Api.cs | 3 +-
.../ScriptEngine/Shared/Api/Runtime/CM_Stub.cs | 5 +
3 files changed, 229 insertions(+), 180 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
index 4cc2f0a..d4250c1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -229,8 +229,181 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return values;
- }
+ }
+
+ private RegionMeta7WindlightData getWindlightProfileFromRules(LSL_List rules)
+ {
+ RegionMeta7WindlightData wl = (RegionMeta7WindlightData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
+ LSL_List values = new LSL_List();
+ int idx = 0;
+ while (idx < rules.Length)
+ {
+ uint rule = (uint)rules.GetLSLIntegerItem(idx);
+ LSL_Types.Quaternion iQ;
+ LSL_Types.Vector3 iV;
+ switch (rule)
+ {
+ case (int)ScriptBaseClass.WL_AMBIENT:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
+ break;
+ case (int)ScriptBaseClass.WL_BLUE_DENSITY:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
+ idx++;
+ wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COLOR:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
+ idx++;
+ wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCALE:
+ idx++;
+ wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
+ idx++;
+ wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
+ idx++;
+ wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
+ idx++;
+ wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
+ idx++;
+ wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
+ idx++;
+ wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
+ idx++;
+ wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
+ idx++;
+ wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
+ break;
+ case (int)ScriptBaseClass.WL_EAST_ANGLE:
+ idx++;
+ wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
+ idx++;
+ wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
+ idx++;
+ wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_DENSITY:
+ idx++;
+ wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_HORIZON:
+ idx++;
+ wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_HORIZON:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
+ break;
+ case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
+ idx++;
+ wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
+ break;
+ case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
+ idx++;
+ wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
+ break;
+ case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
+ idx++;
+ wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
+ idx++;
+ wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SCENE_GAMMA:
+ idx++;
+ wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
+ idx++;
+ wl.starBrightness = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
+ idx++;
+ wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
+ idx++;
+ wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
+ idx++;
+ wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_WATER_COLOR:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
+ idx++;
+ wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
+ break;
+ }
+ idx++;
+ }
+ return wl;
+ }
///
/// Set the current Windlight scene
///
@@ -242,188 +415,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CMShoutError("Careminster functions are not enabled.");
return 0;
+ }
+ if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+ {
+ CMShoutError("cmSetWindlightScene can only be used by estate managers or owners.");
+ return 0;
}
int success = 0;
- m_host.AddScriptLPS(1);
- if (Meta7WindlightModule.EnableWindlight)
- {
- RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
-
- LSL_List values = new LSL_List();
- int idx = 0;
- success = 1;
- while (idx < rules.Length)
- {
- uint rule = (uint)rules.GetLSLIntegerItem(idx);
- LSL_Types.Quaternion iQ;
- LSL_Types.Vector3 iV;
- switch (rule)
- {
- case (int)ScriptBaseClass.WL_AMBIENT:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
- break;
- case (int)ScriptBaseClass.WL_BLUE_DENSITY:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
- idx++;
- wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_COLOR:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
- idx++;
- wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCALE:
- idx++;
- wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
- idx++;
- wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
- idx++;
- wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
- idx++;
- wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
- idx++;
- wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
- break;
- case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
- break;
- case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
- idx++;
- wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
- idx++;
- wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
- idx++;
- wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
- break;
- case (int)ScriptBaseClass.WL_EAST_ANGLE:
- idx++;
- wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
- idx++;
- wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
- idx++;
- wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_HAZE_DENSITY:
- idx++;
- wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_HAZE_HORIZON:
- idx++;
- wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_HORIZON:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
- break;
- case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
- idx++;
- wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
- break;
- case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
- idx++;
- wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
- break;
- case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
- break;
- case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
- idx++;
- wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
- idx++;
- wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_SCENE_GAMMA:
- idx++;
- wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
- idx++;
- wl.starBrightness = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
- idx++;
- wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
- idx++;
- wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
- idx++;
- wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_WATER_COLOR:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
- break;
- case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
- idx++;
- wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
- break;
- default:
- success = 0;
- break;
- }
- idx++;
- }
- m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
-
+ m_host.AddScriptLPS(1);
+ if (Meta7WindlightModule.EnableWindlight)
+ {
+ RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules);
+ m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
+ success = 1;
+ }
+ else
+ {
+ CMShoutError("Windlight module is disabled");
+ return 0;
}
return success;
+ }
+ ///
+ /// Set the current Windlight scene to a target avatar
+ ///
+ ///
+ /// success: true or false
+ public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
+ {
+ if (!m_CMFunctionsEnabled)
+ {
+ CMShoutError("Careminster functions are not enabled.");
+ return 0;
+ }
+ if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+ {
+ CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners.");
+ return 0;
+ }
+ int success = 0;
+ m_host.AddScriptLPS(1);
+ if (Meta7WindlightModule.EnableWindlight)
+ {
+ RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules);
+ World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
+ success = 1;
+ }
+ else
+ {
+ CMShoutError("Windlight module is disabled");
+ return 0;
+ }
+ return success;
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
index 9dd0b73..ef990a1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
@@ -15,6 +15,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
{
// Windlight Functions
LSL_List cmGetWindlightScene(LSL_List rules);
- int cmSetWindlightScene(LSL_List rules);
+ int cmSetWindlightScene(LSL_List rules);
+ int cmSetWindlightSceneTargeted(LSL_List rules, key target);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
index e85d41e..5bc3a88 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
@@ -66,6 +66,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public int cmSetWindlightScene(LSL_List rules)
{
return m_CM_Functions.cmSetWindlightScene(rules);
+ }
+
+ public int cmSetWindlightSceneTargeted(LSL_List rules, key target)
+ {
+ return m_CM_Functions.cmSetWindlightSceneTargeted(rules, target);
}
}
}
--
cgit v1.1
From b53b87166940ca0fca4ae2190649e18102c886ec Mon Sep 17 00:00:00 2001
From: root
Date: Tue, 22 Dec 2009 06:25:32 +0100
Subject: Add a data path for error messages
---
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 2a9a2db..31684ae 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1552,5 +1552,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return true;
}
+
+ public ArrayList GetScriptErrors(UUID itemID)
+ {
+ return new ArrayList();
+ }
}
}
--
cgit v1.1
From b575bf25245102fd43d025081b249cb730b865ac Mon Sep 17 00:00:00 2001
From: CasperW
Date: Wed, 23 Dec 2009 14:14:20 +0100
Subject: Added some null reference and deleted group checks to certain
functions to fix region crash scenarios.
---
.../Shared/Api/Implementation/LSL_Api.cs | 114 +++++++++++++++------
1 file changed, 85 insertions(+), 29 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 2da498a..84c2722 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -221,7 +221,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public List GetLinkParts(int linkType)
{
- List ret = new List();
+ List ret = new List();
+ if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
+ return ret;
ret.Add(m_host);
switch (linkType)
@@ -1136,7 +1138,9 @@ 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;
@@ -1290,7 +1294,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetScale(SceneObjectPart part, LSL_Vector scale)
- {
+ {
// TODO: this needs to trigger a persistance save as well
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
@@ -1349,7 +1353,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
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;
Color4 texcolor;
if (face >= 0 && face < GetNumberOfSides(part))
@@ -1386,7 +1393,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
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;
@@ -1416,7 +1426,10 @@ 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))
{
@@ -1441,7 +1454,9 @@ 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();
@@ -1491,7 +1506,10 @@ 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;
+
Primitive.TextureEntry tex = part.Shape.Textures;
if (face >= 0 && face < GetNumberOfSides(part))
{
@@ -1558,7 +1576,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
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;
Color4 texcolor;
if (face >= 0 && face < GetNumberOfSides(part))
@@ -1603,8 +1624,8 @@ 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)
@@ -1638,8 +1659,8 @@ 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)
@@ -1724,7 +1745,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetTexture(SceneObjectPart part, string texture, int face)
- {
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
UUID textureID=new UUID();
if (!UUID.TryParse(texture, out textureID))
@@ -1769,7 +1793,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
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))
{
@@ -1805,7 +1832,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
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))
{
@@ -1841,7 +1871,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
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))
{
@@ -1911,7 +1944,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
- {
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
// Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
LSL_Vector currentPos = llGetLocalPos();
@@ -2005,7 +2041,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetRot(SceneObjectPart part, Quaternion rot)
- {
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
part.UpdateRotation(rot);
// Update rotation does not move the object in the physics scene if it's a linkset.
@@ -6500,8 +6539,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist)
- {
- ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
+ {
+ 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 &&
@@ -6570,7 +6611,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge)
- {
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
@@ -6618,7 +6662,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge)
- {
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
@@ -6659,7 +6706,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
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 fudge)
- {
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
@@ -6779,7 +6829,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type)
- {
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
UUID sculptId;
@@ -6813,14 +6866,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
public void llSetPrimitiveParams(LSL_List rules)
- {
+ {
m_host.AddScriptLPS(1);
SetPrimParams(m_host, rules);
}
public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
- {
- m_host.AddScriptLPS(1);
+ {
+ m_host.AddScriptLPS(1);
List parts = GetLinkParts(linknumber);
@@ -6829,7 +6882,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetPrimParams(SceneObjectPart part, LSL_List rules)
- {
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ return;
+
int idx = 0;
while (idx < rules.Length)
--
cgit v1.1
From a9f4d7a29c0f5b3ee10b46b9a27c5d10c7e71eb3 Mon Sep 17 00:00:00 2001
From: CasperW
Date: Wed, 23 Dec 2009 17:34:08 +0100
Subject: Add a debugger tag to stop Visual Studio from breaking
---
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 1 +
1 file changed, 1 insertion(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 8376846..c831c69 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1264,6 +1264,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return UUID.Zero;
}
+ [DebuggerNonUserCode]
public void SetState(UUID itemID, string newState)
{
IScriptInstance instance = GetInstance(itemID);
--
cgit v1.1
From 7f699fca9a34cd0f3525534bdbc04c8b8ee975fe Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 24 Dec 2009 18:18:14 +0100
Subject: Add the body to the LSL List Size property
---
OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 38 +++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 1fc31c5..faf9c40 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -422,7 +422,8 @@ namespace OpenSim.Region.ScriptEngine.Shared
public int Length
{
- get {
+ get
+ {
if (m_data == null)
m_data=new Object[0];
return m_data.Length;
@@ -431,7 +432,40 @@ namespace OpenSim.Region.ScriptEngine.Shared
public int Size
{
- get { return 0; }
+ get
+ {
+ if (m_data == null)
+ m_data=new Object[0];
+
+ int size = 0;
+
+ foreach (Object o in m_data)
+ {
+ if (o is LSL_Types.LSLInteger)
+ size += 4;
+ else if (o is LSL_Types.LSLFloat)
+ size += 8;
+ else if (o is LSL_Types.LSLString)
+ size += ((LSL_Types.LSLString)o).m_string.Length;
+ else if (o is LSL_Types.key)
+ size += ((LSL_Types.key)o).value.Length;
+ else if (o is LSL_Types.Vector3)
+ size += 32;
+ else if (o is LSL_Types.Quaternion)
+ size += 64;
+ else if (o is int)
+ size += 4;
+ else if (o is string)
+ size += ((string)o).Length;
+ else if (o is float)
+ size += 8;
+ else if (o is double)
+ size += 16;
+ else
+ throw new Exception("Unknown type in List.Size: " + o.GetType().ToString());
+ }
+ return size;
+ }
}
public object[] Data
--
cgit v1.1
From 06f639b8f345e075259d8b2ebfa96b9ed2174766 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Wed, 30 Dec 2009 00:27:01 +0100
Subject: Fix a timer list locking issue causing XMREngine deadlocks
---
.../Shared/Api/Implementation/Plugins/Timer.cs | 32 ++++++++++++----------
1 file changed, 17 insertions(+), 15 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
index eeb59d9..2fd33fe 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs
@@ -109,25 +109,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
if (Timers.Count == 0)
return;
+ Dictionary.ValueCollection tvals;
lock (TimerListLock)
{
// Go through all timers
- Dictionary.ValueCollection tvals = Timers.Values;
- foreach (TimerClass ts in tvals)
+ tvals = Timers.Values;
+ }
+
+ foreach (TimerClass ts in tvals)
+ {
+ // Time has passed?
+ if (ts.next < DateTime.Now.Ticks)
{
- // Time has passed?
- if (ts.next < DateTime.Now.Ticks)
- {
- //m_log.Debug("Time has passed: Now: " + DateTime.Now.Ticks + ", Passed: " + ts.next);
- // Add it to queue
- m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID,
- new EventParams("timer", new Object[0],
- new DetectParams[0]));
- // set next interval
-
- //ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
- ts.next = DateTime.Now.Ticks + ts.interval;
- }
+ //m_log.Debug("Time has passed: Now: " + DateTime.Now.Ticks + ", Passed: " + ts.next);
+ // Add it to queue
+ m_CmdManager.m_ScriptEngine.PostScriptEvent(ts.itemID,
+ new EventParams("timer", new Object[0],
+ new DetectParams[0]));
+ // set next interval
+
+ //ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
+ ts.next = DateTime.Now.Ticks + ts.interval;
}
}
}
--
cgit v1.1
From 8f0d6d6b5c2a66681cc80f33d10b0635a1257b25 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Wed, 30 Dec 2009 00:36:16 +0000
Subject: Fix an omission in LSL that causes a viewer crash
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c9d6742..3a229c2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6363,6 +6363,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSLError("First parameter to llDialog needs to be a key");
return;
}
+ if (buttons.Length < 1)
+ {
+ LSLError("No less than 1 button can be shown");
+ return;
+ }
if (buttons.Length > 12)
{
LSLError("No more than 12 buttons can be shown");
--
cgit v1.1
From 71fdc24f5c3d5805e185aac949e38f3c8058e03e Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sat, 2 Jan 2010 21:21:31 +0100
Subject: Add virtual method StateChange to ScriptBaseClass
---
OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
index a44abb0..b138da3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs
@@ -128,6 +128,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_InitialValues = GetVars();
}
+ public virtual void StateChange(string newState)
+ {
+ }
+
public void Close()
{
// m_sponser.Close();
--
cgit v1.1
From 71adb37fa87f0ad8fa42c8156529bf72814fde58 Mon Sep 17 00:00:00 2001
From: Kitto Flora
Date: Thu, 7 Jan 2010 23:58:19 -0500
Subject: Fix llRotBetween
---
.../Shared/Api/Implementation/LSL_Api.cs | 56 +++++++++++++++++++++-
1 file changed, 54 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 76c79da..1469e7e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -722,6 +722,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
//A and B should both be normalized
m_host.AddScriptLPS(1);
+ /* 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);
@@ -738,8 +741,57 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
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)
+ {
+ return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
+ }
+
+ // 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)
+ {
+ 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);
+ }
+ }
+
public void llWhisper(int channelID, string text)
{
m_host.AddScriptLPS(1);
--
cgit v1.1
From 496a8a4f7ca5422daa30913595b6b1a03fa8a59a Mon Sep 17 00:00:00 2001
From: CasperW
Date: Wed, 20 Jan 2010 22:14:43 +0100
Subject: Fixed an issue with PayPrice sometimes being shared between multiple
objects
---
.../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 085d61f..a5aecd8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -8946,12 +8946,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSLError("List must have at least 4 elements");
return;
}
- m_host.ParentGroup.RootPart.PayPrice[0]=price;
-
- m_host.ParentGroup.RootPart.PayPrice[1]=(LSL_Integer)quick_pay_buttons.Data[0];
- m_host.ParentGroup.RootPart.PayPrice[2]=(LSL_Integer)quick_pay_buttons.Data[1];
- m_host.ParentGroup.RootPart.PayPrice[3]=(LSL_Integer)quick_pay_buttons.Data[2];
- m_host.ParentGroup.RootPart.PayPrice[4]=(LSL_Integer)quick_pay_buttons.Data[3];
+ int[] nPrice = new int[5];
+ nPrice[0]=price;
+ nPrice[1] = (LSL_Integer)quick_pay_buttons.Data[0];
+ nPrice[2] = (LSL_Integer)quick_pay_buttons.Data[1];
+ nPrice[3] = (LSL_Integer)quick_pay_buttons.Data[2];
+ nPrice[4] = (LSL_Integer)quick_pay_buttons.Data[3];
+ m_host.ParentGroup.RootPart.PayPrice = nPrice;
m_host.ParentGroup.HasGroupChanged = true;
}
--
cgit v1.1
From 1abb70cc73c997c08a416fecf689b83453f853d0 Mon Sep 17 00:00:00 2001
From: Kitto Flora
Date: Thu, 21 Jan 2010 19:31:02 -0500
Subject: Add glue for llSetVehicleFlags(), llRemoveVehicleFlags(). ChODE: Add
associated methods.
---
.../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a5aecd8..33218aa 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6315,13 +6315,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetVehicleFlags(int flags)
{
m_host.AddScriptLPS(1);
- NotImplemented("llSetVehicleFlags");
+ if (m_host.ParentGroup != null)
+ {
+ if (!m_host.ParentGroup.IsDeleted)
+ {
+ m_host.ParentGroup.RootPart.SetVehicleFlags(flags);
+ }
+ }
}
public void llRemoveVehicleFlags(int flags)
{
m_host.AddScriptLPS(1);
- NotImplemented("llRemoveVehicleFlags");
+ if (m_host.ParentGroup != null)
+ {
+ if (!m_host.ParentGroup.IsDeleted)
+ {
+ m_host.ParentGroup.RootPart.RemoveVehicleFlags(flags);
+ }
+ }
}
public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
--
cgit v1.1
From e9c9a74e0ade505ee8d8d8e7790141f758a65f61 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 26 Jan 2010 15:12:41 +0000
Subject: Some merge fixups
---
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 73850e1..35d57d8 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -885,12 +885,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
instance.ClearQueue();
instance.Stop(0);
- SceneObjectPart part =
- m_Scene.GetSceneObjectPart(localID);
-
- if (part != null)
- part.RemoveScriptEvents(itemID);
-
// bool objectRemoved = false;
lock (m_PrimObjects)
@@ -923,18 +917,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
instance = null;
-<<<<<<< HEAD:OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
if (handlerObjectRemoved != null)
+ {
+ SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
handlerObjectRemoved(part.UUID);
-=======
- ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
- if (handlerObjectRemoved != null)
- {
- SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
- handlerObjectRemoved(part.UUID);
- }
->>>>>>> master:OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+ }
CleanAssemblies();
--
cgit v1.1
From 044979066cf66e4dcd2c8f4be90337555dc0b34d Mon Sep 17 00:00:00 2001
From: CasperW
Date: Fri, 5 Feb 2010 00:53:32 +0100
Subject: Fix two inconsistencies with LightShare
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs | 6 +++++-
OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs | 3 ++-
2 files changed, 7 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
index d4250c1..99973b4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -244,6 +244,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Types.Vector3 iV;
switch (rule)
{
+ case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
+ idx++;
+ wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
+ break;
case (int)ScriptBaseClass.WL_AMBIENT:
idx++;
iQ = rules.GetQuaternionItem(idx);
@@ -300,7 +304,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
idx++;
iV = rules.GetVector3Item(idx);
- wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
break;
case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
idx++;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs
index 7b67fa3..522c020 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs
@@ -70,7 +70,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int WL_CLOUD_SCROLL_Y = 32;
public const int WL_CLOUD_SCROLL_Y_LOCK = 33;
public const int WL_CLOUD_SCROLL_X_LOCK = 34;
- public const int WL_DRAW_CLASSIC_CLOUDS = 35;
+ public const int WL_DRAW_CLASSIC_CLOUDS = 35;
+ public const int WL_SUN_MOON_POSITION = 36;
}
}
--
cgit v1.1
From 94c417c90c9e4d91ea0c09fc5a3ac2541e09655d Mon Sep 17 00:00:00 2001
From: CasperW
Date: Mon, 15 Feb 2010 06:10:04 +0100
Subject: Implement missing llGetPrimitiveParams parameters
---
.../Shared/Api/Implementation/LSL_Api.cs | 170 +++++++++++++++++----
1 file changed, 138 insertions(+), 32 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index e4ccce8..9db8ca0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7674,25 +7674,96 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
break;
- case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
- // TODO--------------
- if (remain < 1)
- return res;
-
- face=(int)rules.GetLSLIntegerItem(idx++);
-
- res.Add(new LSL_Integer(0));
- res.Add(new LSL_Integer(0));
+ case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
+ if (remain < 1)
+ return res;
+ face = (int)rules.GetLSLIntegerItem(idx++);
+
+ tex = part.Shape.Textures;
+ int shiny;
+ if (face == ScriptBaseClass.ALL_SIDES)
+ {
+ for (face = 0; face < GetNumberOfSides(part); face++)
+ {
+ Shininess shinyness = tex.GetFace((uint)face).Shiny;
+ if (shinyness == Shininess.High)
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_HIGH;
+ }
+ else if (shinyness == Shininess.Medium)
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM;
+ }
+ else if (shinyness == Shininess.Low)
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_LOW;
+ }
+ else
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_NONE;
+ }
+ res.Add(new LSL_Integer(shiny));
+ res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump));
+ }
+ }
+ else
+ {
+ Shininess shinyness = tex.GetFace((uint)face).Shiny;
+ if (shinyness == Shininess.High)
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_HIGH;
+ }
+ else if (shinyness == Shininess.Medium)
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM;
+ }
+ else if (shinyness == Shininess.Low)
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_LOW;
+ }
+ else
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_NONE;
+ }
+ res.Add(new LSL_Integer(shiny));
+ res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump));
+ }
break;
- case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
- // TODO--------------
- if (remain < 1)
- return res;
-
- face=(int)rules.GetLSLIntegerItem(idx++);
-
- res.Add(new LSL_Integer(0));
+ case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
+ if (remain < 1)
+ return res;
+ face = (int)rules.GetLSLIntegerItem(idx++);
+
+ tex = part.Shape.Textures;
+ int fullbright;
+ if (face == ScriptBaseClass.ALL_SIDES)
+ {
+ for (face = 0; face < GetNumberOfSides(part); face++)
+ {
+ if (tex.GetFace((uint)face).Fullbright == true)
+ {
+ fullbright = ScriptBaseClass.TRUE;
+ }
+ else
+ {
+ fullbright = ScriptBaseClass.FALSE;
+ }
+ res.Add(new LSL_Integer(fullbright));
+ }
+ }
+ else
+ {
+ if (tex.GetFace((uint)face).Fullbright == true)
+ {
+ fullbright = ScriptBaseClass.TRUE;
+ }
+ else
+ {
+ fullbright = ScriptBaseClass.FALSE;
+ }
+ res.Add(new LSL_Integer(fullbright));
+ }
break;
case (int)ScriptBaseClass.PRIM_FLEXIBLE:
@@ -7713,14 +7784,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case (int)ScriptBaseClass.PRIM_TEXGEN:
- // TODO--------------
- // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR)
- if (remain < 1)
- return res;
-
- face=(int)rules.GetLSLIntegerItem(idx++);
-
- res.Add(new LSL_Integer(0));
+ // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR)
+ if (remain < 1)
+ return res;
+ face = (int)rules.GetLSLIntegerItem(idx++);
+
+ tex = part.Shape.Textures;
+ if (face == ScriptBaseClass.ALL_SIDES)
+ {
+ for (face = 0; face < GetNumberOfSides(part); face++)
+ {
+ if (tex.GetFace((uint)face).TexMapType == MappingType.Planar)
+ {
+ res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_PLANAR));
+ }
+ else
+ {
+ res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT));
+ }
+ }
+ }
+ else
+ {
+ if (tex.GetFace((uint)face).TexMapType == MappingType.Planar)
+ {
+ res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_PLANAR));
+ }
+ else
+ {
+ res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT));
+ }
+ }
break;
case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
@@ -7738,14 +7832,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
res.Add(new LSL_Float(shape.LightFalloff)); // falloff
break;
- case (int)ScriptBaseClass.PRIM_GLOW:
- // TODO--------------
- if (remain < 1)
+ case (int)ScriptBaseClass.PRIM_GLOW:
+ if (remain < 1)
return res;
-
- face=(int)rules.GetLSLIntegerItem(idx++);
-
- res.Add(new LSL_Float(0));
+ face = (int)rules.GetLSLIntegerItem(idx++);
+
+ tex = part.Shape.Textures;
+ float primglow;
+ if (face == ScriptBaseClass.ALL_SIDES)
+ {
+ for (face = 0; face < GetNumberOfSides(part); face++)
+ {
+ primglow = tex.GetFace((uint)face).Glow;
+ res.Add(new LSL_Float(primglow));
+ }
+ }
+ else
+ {
+ primglow = tex.GetFace((uint)face).Glow;
+ res.Add(new LSL_Float(primglow));
+ }
break;
}
}
--
cgit v1.1
From af2d20c5fa0403c6cae1008eda3179acc4694d7f Mon Sep 17 00:00:00 2001
From: CasperW
Date: Mon, 15 Feb 2010 22:22:36 +0100
Subject: Fix an inconsistency in llSetPayPrice between SL and OS behaviour
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 9db8ca0..824073b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -8968,9 +8968,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
if (quick_pay_buttons.Data.Length < 4)
- {
- LSLError("List must have at least 4 elements");
- return;
+ {
+ int x;
+ for (x=quick_pay_buttons.Data.Length; x<= 4; x++)
+ {
+ quick_pay_buttons.Add(ScriptBaseClass.PAY_HIDE);
+ }
}
int[] nPrice = new int[5];
nPrice[0]=price;
--
cgit v1.1
From e99341d7df66f73286b8a440991358cbca1a8399 Mon Sep 17 00:00:00 2001
From: CasperW
Date: Thu, 25 Feb 2010 12:07:56 +0100
Subject: llDie() should not work on attachments (results in an incosistent
attachment state)
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 824073b..7a6739b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1118,7 +1118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public virtual void llDie()
{
m_host.AddScriptLPS(1);
- throw new SelfDeleteException();
+ if (!m_host.IsAttachment) throw new SelfDeleteException();
}
public LSL_Float llGround(LSL_Vector offset)
--
cgit v1.1
From 84b0a23e193b220d61b5a67e90df32138441c1e8 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 4 Mar 2010 10:38:03 +0000
Subject: Remove a superfluous array creation
---
OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 1 -
1 file changed, 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index e87b1f4..1ea52c5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -416,7 +416,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
public list(params object[] args)
{
- m_data = new object[args.Length];
m_data = args;
}
--
cgit v1.1
From 62dd83f473fefb3ff2a7b64728a40337ae0e395e Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 4 Mar 2010 10:38:03 +0000
Subject: Remove a superfluous array creation
---
OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 1 -
1 file changed, 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index e87b1f4..1ea52c5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -416,7 +416,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
public list(params object[] args)
{
- m_data = new object[args.Length];
m_data = args;
}
--
cgit v1.1
From 83929c69e35d156d99be46a6ee50b0d3fe5c9f25 Mon Sep 17 00:00:00 2001
From: unknown
Date: Sat, 6 Mar 2010 00:56:55 -0600
Subject: - implementing server 1.38 functions
Signed-off-by: Melanie
---
.../Shared/Api/Implementation/LSL_Api.cs | 99 +++++++++++++++++++---
.../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 4 +
.../Shared/Api/Runtime/LSL_Constants.cs | 1 +
.../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 20 +++++
4 files changed, 114 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index aa876ec..a373046 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5406,12 +5406,31 @@ 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);
+
+ foreach (var part in parts)
+ {
+ SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate);
+ }
+ }
+
+ private void SetTextureAnim(SceneObjectPart part, int mode, int face, int sizex, int sizey, double start, double length, double rate)
+ {
+
Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation();
pTexAnim.Flags = (Primitive.TextureAnimMode)mode;
//ALL_SIDES
if (face == ScriptBaseClass.ALL_SIDES)
- face = 255;
+ face = 255;
pTexAnim.Face = (uint)face;
pTexAnim.Length = (float)length;
@@ -5420,9 +5439,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
pTexAnim.SizeY = (uint)sizey;
pTexAnim.Start = (float)start;
- m_host.AddTextureAnimation(pTexAnim);
- m_host.SendFullUpdateToAllClients();
- m_host.ParentGroup.HasGroupChanged = true;
+ part.AddTextureAnimation(pTexAnim);
+ part.SendFullUpdateToAllClients();
+ part.ParentGroup.HasGroupChanged = true;
}
public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east,
@@ -5819,13 +5838,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return ps;
}
+ public void llLinkParticleSystem(int linknumber, LSL_List rules)
+ {
+ m_host.AddScriptLPS(1);
+
+ List parts = GetLinkParts(linknumber);
+
+ foreach (var part in parts)
+ {
+ SetParticleSystem(part, rules);
+ }
+ }
+
public void llParticleSystem(LSL_List rules)
{
m_host.AddScriptLPS(1);
+ SetParticleSystem(m_host, rules);
+ }
+
+ private void SetParticleSystem(SceneObjectPart part, LSL_List rules) {
+
+
if (rules.Length == 0)
{
- m_host.RemoveParticleSystem();
- m_host.ParentGroup.HasGroupChanged = true;
+ part.RemoveParticleSystem();
+ part.ParentGroup.HasGroupChanged = true;
}
else
{
@@ -5936,7 +5973,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
{
- prules.Target = m_host.UUID;
+ prules.Target = part.UUID;
}
break;
@@ -5962,10 +5999,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
prules.CRC = 1;
- m_host.AddNewParticleSystem(prules);
- m_host.ParentGroup.HasGroupChanged = true;
+ part.AddNewParticleSystem(prules);
+ part.ParentGroup.HasGroupChanged = true;
}
- m_host.SendFullUpdateToAllClients();
+ part.SendFullUpdateToAllClients();
}
public void llGroundRepel(double height, int water, double tau)
@@ -6759,6 +6796,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetPrimParams(part, rules);
}
+ public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
+ {
+ llSetLinkPrimitiveParams(linknumber, rules);
+ }
+
protected void SetPrimParams(SceneObjectPart part, LSL_List rules)
{
int idx = 0;
@@ -7115,6 +7157,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
int style = rules.GetLSLIntegerItem(idx++);
SetTexGen(part, face, style);
break;
+ case (int)ScriptBaseClass.PRIM_TEXT:
+ if (remain < 3)
+ return;
+ string primText = rules.GetLSLStringItem(idx++);
+ LSL_Vector primTextColor = rules.GetVector3Item(idx++);
+ LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
+ Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f),
+ Util.Clip((float)primTextColor.y, 0.0f, 1.0f),
+ Util.Clip((float)primTextColor.z, 0.0f, 1.0f));
+ part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
+
+ break;
}
}
}
@@ -7358,6 +7412,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return GetLinkPrimitiveParams(m_host, rules);
}
+ public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules)
+ {
+ m_host.AddScriptLPS(1);
+
+ List parts = GetLinkParts(linknumber);
+
+ LSL_List res = new LSL_List();
+
+ foreach (var part in parts)
+ {
+ LSL_List partRes = GetLinkPrimitiveParams(part, rules);
+ res += partRes;
+ }
+
+ return res;
+ }
+
public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules)
{
LSL_List res = new LSL_List();
@@ -7635,6 +7706,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
res.Add(new LSL_Float(0));
break;
+ case (int)ScriptBaseClass.PRIM_TEXT:
+ Color4 textColor = part.GetTextColor();
+ res.Add(part.Text);
+ res.Add(new LSL_Vector(textColor.R,
+ textColor.G,
+ textColor.B));
+ res.Add(new LSL_Float(textColor.A));
+ break;
}
}
return res;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index a74e8da..7ab04a3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -135,6 +135,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Key llGetLinkKey(int linknum);
LSL_String llGetLinkName(int linknum);
LSL_Integer llGetLinkNumber();
+ LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules);
LSL_Integer llGetListEntryType(LSL_List src, int index);
LSL_Integer llGetListLength(LSL_List src);
LSL_Vector llGetLocalPos();
@@ -206,6 +207,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llInstantMessage(string user, string message);
LSL_String llIntegerToBase64(int number);
LSL_String llKey2Name(string id);
+ void llLinkParticleSystem(int linknum, LSL_List rules);
LSL_String llList2CSV(LSL_List src);
LSL_Float llList2Float(LSL_List src, int index);
LSL_Integer llList2Integer(LSL_List src, int index);
@@ -322,6 +324,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llSetLinkColor(int linknumber, LSL_Vector color, int face);
void llSetLinkPrimitiveParams(int linknumber, LSL_List rules);
void llSetLinkTexture(int linknumber, string texture, int face);
+ void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate);
void llSetLocalRot(LSL_Rotation rot);
void llSetObjectDesc(string desc);
void llSetObjectName(string name);
@@ -330,6 +333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llSetPayPrice(int price, LSL_List quick_pay_buttons);
void llSetPos(LSL_Vector pos);
void llSetPrimitiveParams(LSL_List rules);
+ void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules);
void llSetPrimURL(string url);
void llSetRemoteScriptAccessPin(int pin);
void llSetRot(LSL_Rotation rot);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 7cf82b2..ee35fa4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -313,6 +313,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake
public const int PRIM_POINT_LIGHT = 23; // Huh?
public const int PRIM_GLOW = 25;
+ public const int PRIM_TEXT = 26;
public const int PRIM_TEXGEN_DEFAULT = 0;
public const int PRIM_TEXGEN_PLANAR = 1;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index a28e97b..3339995 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -674,6 +674,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llGetPrimitiveParams(rules);
}
+ public LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules)
+ {
+ return m_LSL_Functions.llGetLinkPrimitiveParams(linknum, rules);
+ }
+
public LSL_Integer llGetRegionAgentCount()
{
return m_LSL_Functions.llGetRegionAgentCount();
@@ -889,6 +894,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llKey2Name(id);
}
+ public void llLinkParticleSystem(int linknum, LSL_List rules)
+ {
+ m_LSL_Functions.llLinkParticleSystem(linknum, rules);
+ }
+
public LSL_String llList2CSV(LSL_List src)
{
return m_LSL_Functions.llList2CSV(src);
@@ -1468,6 +1478,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llSetLinkTexture(linknumber, texture, face);
}
+ public void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate)
+ {
+ m_LSL_Functions.llSetLinkTextureAnim(linknum, mode, face, sizex, sizey, start, length, rate);
+ }
+
public void llSetLocalRot(LSL_Rotation rot)
{
m_LSL_Functions.llSetLocalRot(rot);
@@ -1508,6 +1523,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llSetPrimitiveParams(rules);
}
+ public void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules)
+ {
+ m_LSL_Functions.llSetLinkPrimitiveParamsFast(linknum, rules);
+ }
+
public void llSetPrimURL(string url)
{
m_LSL_Functions.llSetPrimURL(url);
--
cgit v1.1
From c8c608acc8509ebc1651b4c2dd9094cbe64dcfb8 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sun, 7 Mar 2010 16:05:24 +0000
Subject: Small consistency change
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 3154f9e..180fba9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6065,7 +6065,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
for (int i = 0; i < rules.Length; i += 2)
{
- switch (Convert.ToInt32(rules.Data[i]))
+ switch (rules.GetLSLIntegerItem(i))
{
case (int)ScriptBaseClass.PSYS_PART_FLAGS:
prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1);
--
cgit v1.1
From 49baf090cd1164b11b07fb372dff1d7b8b48c264 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sun, 7 Mar 2010 16:05:24 +0000
Subject: Small consistency change
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 4661488..aa2c8b3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6067,7 +6067,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
for (int i = 0; i < rules.Length; i += 2)
{
- switch (Convert.ToInt32(rules.Data[i]))
+ switch (rules.GetLSLIntegerItem(i))
{
case (int)ScriptBaseClass.PSYS_PART_FLAGS:
prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1);
@@ -10191,4 +10191,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
-}
\ No newline at end of file
+}
--
cgit v1.1
From 80e4068b3e85625234270cd7f3735cfd1b4e83dc Mon Sep 17 00:00:00 2001
From: CasperW
Date: Sat, 13 Mar 2010 15:13:19 +0100
Subject: Fix the delay in llGiveInventory so that it only takes effect when
giving inventory to an avatar (this now replicates SL behaviour)
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 180fba9..0117fa0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4014,14 +4014,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
bucket);
if (m_TransferModule != null)
- m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
+ m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
+
+ //This delay should only occur when giving inventory to avatars.
+ ScriptSleep(3000);
}
else
{
// destination is an object
World.MoveTaskInventoryItem(destId, m_host, objId);
}
- ScriptSleep(3000);
+
}
[DebuggerNonUserCode]
--
cgit v1.1
From 819806261026cccd68dee649f11938ae5bf10029 Mon Sep 17 00:00:00 2001
From: Kitto Flora
Date: Sun, 14 Mar 2010 16:22:13 -0400
Subject: RotLookAt repaired; debug msg cleanup.
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 180fba9..83f7db0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2899,10 +2899,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// the angles of rotation in radians into rotation value
LSL_Types.Quaternion rot = llEuler2Rot(angle);
+ /*
Quaternion rotation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
m_host.startLookAt(rotation, (float)damping, (float)strength);
+ This would only work if your physics system contains an APID controller */
// Orient the object to the angle calculated
- //llSetRot(rot);
+ llSetRot(rot);
}
public void llRotLookAt(LSL_Rotation target, double strength, double damping)
--
cgit v1.1
From 37815f34029d7fe4404b6733764892a9a2fe9086 Mon Sep 17 00:00:00 2001
From: Thomas Grimshaw
Date: Tue, 16 Mar 2010 18:13:00 +0100
Subject: Debugger tags for VS2010
---
.../Shared/Api/Implementation/LSL_Api.cs | 387 +++++++++++----------
.../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 2 +
2 files changed, 196 insertions(+), 193 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 8e5c203..485a3b5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -221,8 +221,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public List GetLinkParts(int linkType)
{
- List ret = new List();
- if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
+ List ret = new List();
+ if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
return ret;
ret.Add(m_host);
@@ -1115,6 +1115,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return detectedParams.TouchUV;
}
+ [DebuggerNonUserCode]
public virtual void llDie()
{
m_host.AddScriptLPS(1);
@@ -1190,8 +1191,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)
+ {
+ if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
return;
m_host.AddScriptLPS(1);
@@ -1367,7 +1368,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetScale(SceneObjectPart part, LSL_Vector scale)
- {
+ {
// TODO: this needs to trigger a persistance save as well
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
@@ -1426,8 +1427,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetColor(SceneObjectPart part, LSL_Vector color, int face)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
Primitive.TextureEntry tex = part.Shape.Textures;
@@ -1471,8 +1472,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
public void SetTexGen(SceneObjectPart part, int face,int style)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
Primitive.TextureEntry tex = part.Shape.Textures;
@@ -1504,8 +1505,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
public void SetGlow(SceneObjectPart part, int face, float glow)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
Primitive.TextureEntry tex = part.Shape.Textures;
@@ -1532,8 +1533,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)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
Shininess sval = new Shininess();
@@ -1584,8 +1585,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
public void SetFullBright(SceneObjectPart part, int face, bool bright)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
Primitive.TextureEntry tex = part.Shape.Textures;
@@ -1654,8 +1655,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetAlpha(SceneObjectPart part, double alpha, int face)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
Primitive.TextureEntry tex = part.Shape.Textures;
@@ -1702,8 +1703,8 @@ 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 || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
if (flexi)
@@ -1737,8 +1738,8 @@ 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 || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
if (light)
@@ -1823,8 +1824,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetTexture(SceneObjectPart part, string texture, int face)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
UUID textureID=new UUID();
@@ -1871,8 +1872,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void ScaleTexture(SceneObjectPart part, double u, double v, int face)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
Primitive.TextureEntry tex = part.Shape.Textures;
@@ -1910,8 +1911,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void OffsetTexture(SceneObjectPart part, double u, double v, int face)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
Primitive.TextureEntry tex = part.Shape.Textures;
@@ -1949,8 +1950,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void RotateTexture(SceneObjectPart part, double rotation, int face)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
Primitive.TextureEntry tex = part.Shape.Textures;
@@ -2022,8 +2023,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
// Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
@@ -2119,8 +2120,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetRot(SceneObjectPart part, Quaternion rot)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
part.UpdateRotation(rot);
@@ -4016,7 +4017,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
bucket);
if (m_TransferModule != null)
- m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
+ m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
//This delay should only occur when giving inventory to avatars.
ScriptSleep(3000);
@@ -6662,9 +6663,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist)
- {
- ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return shapeBlock;
if (holeshape != (int)ScriptBaseClass.PRIM_HOLE_DEFAULT &&
@@ -6735,8 +6736,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
ObjectShapePacket.ObjectDataBlock shapeBlock;
@@ -6787,8 +6788,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
ObjectShapePacket.ObjectDataBlock shapeBlock;
@@ -6832,8 +6833,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
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 fudge)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
ObjectShapePacket.ObjectDataBlock shapeBlock;
@@ -6956,8 +6957,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetPrimitiveShapeParams(SceneObjectPart part, string map, int type)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
@@ -6993,13 +6994,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
public void llSetPrimitiveParams(LSL_List rules)
- {
+ {
m_host.AddScriptLPS(1);
SetPrimParams(m_host, rules);
}
public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
- {
+ {
m_host.AddScriptLPS(1);
List parts = GetLinkParts(linknumber);
@@ -7014,8 +7015,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
protected void SetPrimParams(SceneObjectPart part, LSL_List rules)
- {
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ {
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
return;
int idx = 0;
@@ -7848,96 +7849,96 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
break;
- case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
- if (remain < 1)
- return res;
- face = (int)rules.GetLSLIntegerItem(idx++);
-
- tex = part.Shape.Textures;
- int shiny;
- if (face == ScriptBaseClass.ALL_SIDES)
- {
- for (face = 0; face < GetNumberOfSides(part); face++)
- {
- Shininess shinyness = tex.GetFace((uint)face).Shiny;
- if (shinyness == Shininess.High)
- {
- shiny = ScriptBaseClass.PRIM_SHINY_HIGH;
- }
- else if (shinyness == Shininess.Medium)
- {
- shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM;
- }
- else if (shinyness == Shininess.Low)
- {
- shiny = ScriptBaseClass.PRIM_SHINY_LOW;
- }
- else
- {
- shiny = ScriptBaseClass.PRIM_SHINY_NONE;
- }
- res.Add(new LSL_Integer(shiny));
- res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump));
- }
- }
- else
- {
- Shininess shinyness = tex.GetFace((uint)face).Shiny;
- if (shinyness == Shininess.High)
- {
- shiny = ScriptBaseClass.PRIM_SHINY_HIGH;
- }
- else if (shinyness == Shininess.Medium)
- {
- shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM;
- }
- else if (shinyness == Shininess.Low)
- {
- shiny = ScriptBaseClass.PRIM_SHINY_LOW;
- }
- else
- {
- shiny = ScriptBaseClass.PRIM_SHINY_NONE;
- }
- res.Add(new LSL_Integer(shiny));
- res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump));
- }
+ case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
+ if (remain < 1)
+ return res;
+ face = (int)rules.GetLSLIntegerItem(idx++);
+
+ tex = part.Shape.Textures;
+ int shiny;
+ if (face == ScriptBaseClass.ALL_SIDES)
+ {
+ for (face = 0; face < GetNumberOfSides(part); face++)
+ {
+ Shininess shinyness = tex.GetFace((uint)face).Shiny;
+ if (shinyness == Shininess.High)
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_HIGH;
+ }
+ else if (shinyness == Shininess.Medium)
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM;
+ }
+ else if (shinyness == Shininess.Low)
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_LOW;
+ }
+ else
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_NONE;
+ }
+ res.Add(new LSL_Integer(shiny));
+ res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump));
+ }
+ }
+ else
+ {
+ Shininess shinyness = tex.GetFace((uint)face).Shiny;
+ if (shinyness == Shininess.High)
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_HIGH;
+ }
+ else if (shinyness == Shininess.Medium)
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_MEDIUM;
+ }
+ else if (shinyness == Shininess.Low)
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_LOW;
+ }
+ else
+ {
+ shiny = ScriptBaseClass.PRIM_SHINY_NONE;
+ }
+ res.Add(new LSL_Integer(shiny));
+ res.Add(new LSL_Integer((int)tex.GetFace((uint)face).Bump));
+ }
break;
- case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
- if (remain < 1)
- return res;
- face = (int)rules.GetLSLIntegerItem(idx++);
-
- tex = part.Shape.Textures;
- int fullbright;
- if (face == ScriptBaseClass.ALL_SIDES)
- {
- for (face = 0; face < GetNumberOfSides(part); face++)
- {
- if (tex.GetFace((uint)face).Fullbright == true)
- {
- fullbright = ScriptBaseClass.TRUE;
- }
- else
- {
- fullbright = ScriptBaseClass.FALSE;
- }
- res.Add(new LSL_Integer(fullbright));
- }
- }
- else
- {
- if (tex.GetFace((uint)face).Fullbright == true)
- {
- fullbright = ScriptBaseClass.TRUE;
- }
- else
- {
- fullbright = ScriptBaseClass.FALSE;
- }
- res.Add(new LSL_Integer(fullbright));
- }
+ case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
+ if (remain < 1)
+ return res;
+ face = (int)rules.GetLSLIntegerItem(idx++);
+
+ tex = part.Shape.Textures;
+ int fullbright;
+ if (face == ScriptBaseClass.ALL_SIDES)
+ {
+ for (face = 0; face < GetNumberOfSides(part); face++)
+ {
+ if (tex.GetFace((uint)face).Fullbright == true)
+ {
+ fullbright = ScriptBaseClass.TRUE;
+ }
+ else
+ {
+ fullbright = ScriptBaseClass.FALSE;
+ }
+ res.Add(new LSL_Integer(fullbright));
+ }
+ }
+ else
+ {
+ if (tex.GetFace((uint)face).Fullbright == true)
+ {
+ fullbright = ScriptBaseClass.TRUE;
+ }
+ else
+ {
+ fullbright = ScriptBaseClass.FALSE;
+ }
+ res.Add(new LSL_Integer(fullbright));
+ }
break;
case (int)ScriptBaseClass.PRIM_FLEXIBLE:
@@ -7958,37 +7959,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case (int)ScriptBaseClass.PRIM_TEXGEN:
- // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR)
- if (remain < 1)
- return res;
- face = (int)rules.GetLSLIntegerItem(idx++);
-
- tex = part.Shape.Textures;
- if (face == ScriptBaseClass.ALL_SIDES)
- {
- for (face = 0; face < GetNumberOfSides(part); face++)
- {
- if (tex.GetFace((uint)face).TexMapType == MappingType.Planar)
- {
- res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_PLANAR));
- }
- else
- {
- res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT));
- }
- }
- }
- else
- {
- if (tex.GetFace((uint)face).TexMapType == MappingType.Planar)
- {
- res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_PLANAR));
- }
- else
- {
- res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT));
- }
- }
+ // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR)
+ if (remain < 1)
+ return res;
+ face = (int)rules.GetLSLIntegerItem(idx++);
+
+ tex = part.Shape.Textures;
+ if (face == ScriptBaseClass.ALL_SIDES)
+ {
+ for (face = 0; face < GetNumberOfSides(part); face++)
+ {
+ if (tex.GetFace((uint)face).TexMapType == MappingType.Planar)
+ {
+ res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_PLANAR));
+ }
+ else
+ {
+ res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT));
+ }
+ }
+ }
+ else
+ {
+ if (tex.GetFace((uint)face).TexMapType == MappingType.Planar)
+ {
+ res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_PLANAR));
+ }
+ else
+ {
+ res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TEXGEN_DEFAULT));
+ }
+ }
break;
case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
@@ -8006,26 +8007,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
res.Add(new LSL_Float(shape.LightFalloff)); // falloff
break;
- case (int)ScriptBaseClass.PRIM_GLOW:
- if (remain < 1)
+ case (int)ScriptBaseClass.PRIM_GLOW:
+ if (remain < 1)
return res;
- face = (int)rules.GetLSLIntegerItem(idx++);
-
- tex = part.Shape.Textures;
- float primglow;
- if (face == ScriptBaseClass.ALL_SIDES)
- {
- for (face = 0; face < GetNumberOfSides(part); face++)
- {
- primglow = tex.GetFace((uint)face).Glow;
- res.Add(new LSL_Float(primglow));
- }
- }
- else
- {
- primglow = tex.GetFace((uint)face).Glow;
- res.Add(new LSL_Float(primglow));
- }
+ face = (int)rules.GetLSLIntegerItem(idx++);
+
+ tex = part.Shape.Textures;
+ float primglow;
+ if (face == ScriptBaseClass.ALL_SIDES)
+ {
+ for (face = 0; face < GetNumberOfSides(part); face++)
+ {
+ primglow = tex.GetFace((uint)face).Glow;
+ res.Add(new LSL_Float(primglow));
+ }
+ }
+ else
+ {
+ primglow = tex.GetFace((uint)face).Glow;
+ res.Add(new LSL_Float(primglow));
+ }
break;
case (int)ScriptBaseClass.PRIM_TEXT:
Color4 textColor = part.GetTextColor();
@@ -9187,7 +9188,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
if (quick_pay_buttons.Data.Length < 4)
- {
+ {
int x;
for (x=quick_pay_buttons.Data.Length; x<= 4; x++)
{
@@ -9195,12 +9196,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
int[] nPrice = new int[5];
- nPrice[0]=price;
- nPrice[1] = (LSL_Integer)quick_pay_buttons.Data[0];
- nPrice[2] = (LSL_Integer)quick_pay_buttons.Data[1];
- nPrice[3] = (LSL_Integer)quick_pay_buttons.Data[2];
+ nPrice[0]=price;
+ nPrice[1] = (LSL_Integer)quick_pay_buttons.Data[0];
+ nPrice[2] = (LSL_Integer)quick_pay_buttons.Data[1];
+ nPrice[3] = (LSL_Integer)quick_pay_buttons.Data[2];
nPrice[4] = (LSL_Integer)quick_pay_buttons.Data[3];
- m_host.ParentGroup.RootPart.PayPrice = nPrice;
+ m_host.ParentGroup.RootPart.PayPrice = nPrice;
m_host.ParentGroup.HasGroupChanged = true;
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 3339995..e86d08c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -26,6 +26,7 @@
*/
using System;
+using System.Diagnostics; //for [DebuggerNonUserCode]
using System.Runtime.Remoting.Lifetime;
using System.Threading;
using System.Reflection;
@@ -309,6 +310,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel);
}
+ [DebuggerNonUserCode]
public void llDie()
{
m_LSL_Functions.llDie();
--
cgit v1.1
From e442c2a3f9dc1823c00ddc1c81802fdabd7883dc Mon Sep 17 00:00:00 2001
From: Thomas Grimshaw
Date: Wed, 17 Mar 2010 17:42:33 +0100
Subject: Prevent llTeleportAgentHome from affecting gods
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 +++
1 file changed, 3 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 485a3b5..10ebf67 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4193,6 +4193,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence presence = World.GetScenePresence(agentId);
if (presence != null)
{
+ // agent must not be a god
+ if (presence.GodLevel >= 200) return;
+
// agent must be over the owners land
if (m_host.OwnerID == World.LandChannel.GetLandObject(
presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
--
cgit v1.1
From 7d917e7c5c599549d2a87451fe3d6ca2bf6e62a4 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 30 Mar 2010 23:29:03 +0100
Subject: Rename Meta7Windlight to LightShare
---
.../Shared/Api/Implementation/CM_Api.cs | 116 ++++++++++-----------
1 file changed, 58 insertions(+), 58 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
index 99973b4..4e8a3c4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -7,7 +7,7 @@ using OpenMetaverse;
using Nini.Config;
using OpenSim;
using OpenSim.Framework;
-using OpenSim.Region.CoreModules.World.Meta7Windlight;
+using OpenSim.Region.CoreModules.World.LightShare;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.ScriptEngine.Shared;
@@ -97,7 +97,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_List();
}
m_host.AddScriptLPS(1);
- RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
+ RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
LSL_List values = new LSL_List();
int idx = 0;
@@ -229,11 +229,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return values;
- }
-
- private RegionMeta7WindlightData getWindlightProfileFromRules(LSL_List rules)
- {
- RegionMeta7WindlightData wl = (RegionMeta7WindlightData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
+ }
+
+ private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
+ {
+ RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
LSL_List values = new LSL_List();
int idx = 0;
@@ -244,9 +244,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Types.Vector3 iV;
switch (rule)
{
- case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
- idx++;
- wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
+ case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
+ idx++;
+ wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_AMBIENT:
idx++;
@@ -419,58 +419,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CMShoutError("Careminster functions are not enabled.");
return 0;
- }
- if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
- {
- CMShoutError("cmSetWindlightScene can only be used by estate managers or owners.");
- return 0;
+ }
+ if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+ {
+ CMShoutError("cmSetWindlightScene can only be used by estate managers or owners.");
+ return 0;
}
int success = 0;
- m_host.AddScriptLPS(1);
- if (Meta7WindlightModule.EnableWindlight)
- {
- RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules);
- m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
- success = 1;
- }
- else
- {
- CMShoutError("Windlight module is disabled");
- return 0;
+ m_host.AddScriptLPS(1);
+ if (LightShareModule.EnableWindlight)
+ {
+ RegionLightShareData wl = getWindlightProfileFromRules(rules);
+ m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
+ success = 1;
+ }
+ else
+ {
+ CMShoutError("Windlight module is disabled");
+ return 0;
+ }
+ return success;
+ }
+ ///
+ /// Set the current Windlight scene to a target avatar
+ ///
+ ///
+ /// success: true or false
+ public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
+ {
+ if (!m_CMFunctionsEnabled)
+ {
+ CMShoutError("Careminster functions are not enabled.");
+ return 0;
+ }
+ if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+ {
+ CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners.");
+ return 0;
+ }
+ int success = 0;
+ m_host.AddScriptLPS(1);
+ if (LightShareModule.EnableWindlight)
+ {
+ RegionLightShareData wl = getWindlightProfileFromRules(rules);
+ World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
+ success = 1;
+ }
+ else
+ {
+ CMShoutError("Windlight module is disabled");
+ return 0;
}
return success;
- }
- ///
- /// Set the current Windlight scene to a target avatar
- ///
- ///
- /// success: true or false
- public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
- {
- if (!m_CMFunctionsEnabled)
- {
- CMShoutError("Careminster functions are not enabled.");
- return 0;
- }
- if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
- {
- CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners.");
- return 0;
- }
- int success = 0;
- m_host.AddScriptLPS(1);
- if (Meta7WindlightModule.EnableWindlight)
- {
- RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules);
- World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
- success = 1;
- }
- else
- {
- CMShoutError("Windlight module is disabled");
- return 0;
- }
- return success;
}
}
--
cgit v1.1
From f34cc6b46949033803c79235b9d82da9bf9634dd Mon Sep 17 00:00:00 2001
From: Thomas Grimshaw
Date: Mon, 5 Apr 2010 22:08:34 +0200
Subject: Add a much cheaper agent count retrieval method. This is obsoleted
by 0.7 so it can be reverted then.
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 10ebf67..a76f386 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5266,7 +5266,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetRegionAgentCount()
{
m_host.AddScriptLPS(1);
- return new LSL_Integer(World.GetAvatars().Count);
+ return new LSL_Integer(World.GetRootAgentCount());
}
public LSL_Vector llGetRegionCorner()
--
cgit v1.1
From 335c1b44206531bc6c0996157884d6873a580527 Mon Sep 17 00:00:00 2001
From: Thomas Grimshaw
Date: Wed, 7 Apr 2010 07:48:26 +0200
Subject: Implement PSYS_SRC_INNERANGLE and PSYS_SRC_OUTERANGLE
---
.../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 ++++++++++
1 file changed, 10 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a76f386..5be8929 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6195,6 +6195,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.OuterAngle = (float)tempf;
break;
+
+ case (int)ScriptBaseClass.PSYS_SRC_INNERANGLE:
+ tempf = (float)rules.GetLSLFloatItem(i + 1);
+ prules.InnerAngle = (float)tempf;
+ break;
+
+ case (int)ScriptBaseClass.PSYS_SRC_OUTERANGLE:
+ tempf = (float)rules.GetLSLFloatItem(i + 1);
+ prules.OuterAngle = (float)tempf;
+ break;
}
}
--
cgit v1.1
From 20e3de1f0a1434d51cf833b6418e983101438568 Mon Sep 17 00:00:00 2001
From: Thomas Grimshaw
Date: Wed, 7 Apr 2010 08:28:57 +0200
Subject: Add CHANGED_REGION_START (alias for CHANGED_REGION_RESTART as per LL
Jira SVC-3773)
---
OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 1 +
1 file changed, 1 insertion(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index ee35fa4..b3e4740 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -274,6 +274,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int CHANGED_ALLOWED_DROP = 64;
public const int CHANGED_OWNER = 128;
public const int CHANGED_REGION_RESTART = 256;
+ public const int CHANGED_REGION_START = 256; //LL Changed the constant from CHANGED_REGION_RESTART
public const int CHANGED_REGION = 512;
public const int CHANGED_TELEPORT = 1024;
public const int CHANGED_ANIMATION = 16384;
--
cgit v1.1
From db5ea850f66308038b16c4adcabd9e0d529ec947 Mon Sep 17 00:00:00 2001
From: Thomas Grimshaw
Date: Wed, 7 Apr 2010 09:49:11 +0200
Subject: Fix llLookAt so that it doesn't "roll" the object and more closely
imitates the behaviour in SL. ( http://bugs.meta7.com/view.php?id=28 )
---
.../Shared/Api/Implementation/LSL_Api.cs | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 5be8929..75dd615 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2881,6 +2881,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llLookAt(LSL_Vector target, double strength, double damping)
{
+ /*
m_host.AddScriptLPS(1);
// Determine where we are looking from
LSL_Vector from = llGetPos();
@@ -2900,12 +2901,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// the angles of rotation in radians into rotation value
LSL_Types.Quaternion rot = llEuler2Rot(angle);
- /*
- Quaternion rotation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
- m_host.startLookAt(rotation, (float)damping, (float)strength);
- This would only work if your physics system contains an APID controller */
+
+ // This would only work if your physics system contains an APID controller:
+ // Quaternion rotation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
+ // m_host.startLookAt(rotation, (float)damping, (float)strength);
+
// Orient the object to the angle calculated
llSetRot(rot);
+ */
+
+ //The above code, while nice, doesn't replicate the behaviour of SL and tends to "roll" the object.
+ //There's probably a smarter way of doing this, my rotation math-fu is weak.
+ // http://bugs.meta7.com/view.php?id=28
+ // - Tom
+
+ LSL_Rotation newrot = llGetRot() * llRotBetween(new LSL_Vector(1.0d, 0.0d, 0.0d) * llGetRot(), new LSL_Vector(0.0d, 0.0d, -1.0d));
+ llSetRot(newrot * llRotBetween(new LSL_Vector(0.0d,0.0d,1.0d) * newrot, target - llGetPos()));
+
}
public void llRotLookAt(LSL_Rotation target, double strength, double damping)
--
cgit v1.1
From d834a2c3da1aa97887e087e5a265e73a914c5f7b Mon Sep 17 00:00:00 2001
From: Thomas Grimshaw
Date: Wed, 7 Apr 2010 23:53:08 +0200
Subject: Implement cmGetAvatarList(). This returns a strided list of all
avatars in the region, including their UUID, position and name. The radar is
often the most taxing scripts on a sim, this function can help radars reduce
their impact by 66% by eliminating the need for sensors.
---
.../Shared/Api/Implementation/CM_Api.cs | 130 ++++++++++++---------
.../ScriptEngine/Shared/Api/Interface/ICM_Api.cs | 3 +-
.../ScriptEngine/Shared/Api/Runtime/CM_Stub.cs | 14 ++-
3 files changed, 87 insertions(+), 60 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
index 99973b4..9f829da 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -86,6 +86,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
///
+ /// Like osGetAgents but returns enough info for a radar
+ ///
+ /// Strided list of the UUID, position and name of each avatar in the region
+ public LSL_List cmGetAvatarList()
+ {
+ LSL_List result = new LSL_List();
+ foreach (ScenePresence avatar in World.GetAvatars())
+ {
+ if (avatar.UUID != m_host.OwnerID)
+ {
+ if (avatar.IsChildAgent == false)
+ {
+ result.Add(avatar.UUID);
+ result.Add(avatar.PhysicsActor.Position);
+ result.Add(avatar.Name);
+ }
+ }
+ }
+ return result;
+ }
+
+ ///
/// Get the current Windlight scene
///
/// List of windlight parameters
@@ -229,10 +251,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return values;
- }
-
+ }
+
private RegionMeta7WindlightData getWindlightProfileFromRules(LSL_List rules)
- {
+ {
RegionMeta7WindlightData wl = (RegionMeta7WindlightData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
LSL_List values = new LSL_List();
@@ -244,9 +266,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Types.Vector3 iV;
switch (rule)
{
- case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
- idx++;
- wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
+ case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
+ idx++;
+ wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_AMBIENT:
idx++;
@@ -419,58 +441,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CMShoutError("Careminster functions are not enabled.");
return 0;
- }
- if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
- {
- CMShoutError("cmSetWindlightScene can only be used by estate managers or owners.");
- return 0;
+ }
+ if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+ {
+ CMShoutError("cmSetWindlightScene can only be used by estate managers or owners.");
+ return 0;
+ }
+ int success = 0;
+ m_host.AddScriptLPS(1);
+ if (Meta7WindlightModule.EnableWindlight)
+ {
+ RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules);
+ m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
+ success = 1;
+ }
+ else
+ {
+ CMShoutError("Windlight module is disabled");
+ return 0;
+ }
+ return success;
+ }
+ ///
+ /// Set the current Windlight scene to a target avatar
+ ///
+ ///
+ /// success: true or false
+ public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
+ {
+ if (!m_CMFunctionsEnabled)
+ {
+ CMShoutError("Careminster functions are not enabled.");
+ return 0;
+ }
+ if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+ {
+ CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners.");
+ return 0;
}
int success = 0;
- m_host.AddScriptLPS(1);
- if (Meta7WindlightModule.EnableWindlight)
- {
- RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules);
- m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
- success = 1;
- }
- else
- {
- CMShoutError("Windlight module is disabled");
- return 0;
+ m_host.AddScriptLPS(1);
+ if (Meta7WindlightModule.EnableWindlight)
+ {
+ RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules);
+ World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
+ success = 1;
+ }
+ else
+ {
+ CMShoutError("Windlight module is disabled");
+ return 0;
}
return success;
- }
- ///
- /// Set the current Windlight scene to a target avatar
- ///
- ///
- /// success: true or false
- public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
- {
- if (!m_CMFunctionsEnabled)
- {
- CMShoutError("Careminster functions are not enabled.");
- return 0;
- }
- if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
- {
- CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners.");
- return 0;
- }
- int success = 0;
- m_host.AddScriptLPS(1);
- if (Meta7WindlightModule.EnableWindlight)
- {
- RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules);
- World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
- success = 1;
- }
- else
- {
- CMShoutError("Windlight module is disabled");
- return 0;
- }
- return success;
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
index ef990a1..6239726 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
@@ -15,7 +15,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
{
// Windlight Functions
LSL_List cmGetWindlightScene(LSL_List rules);
- int cmSetWindlightScene(LSL_List rules);
+ int cmSetWindlightScene(LSL_List rules);
int cmSetWindlightSceneTargeted(LSL_List rules, key target);
+ LSL_List cmGetAvatarList();
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
index 5bc3a88..aaffbe4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
@@ -66,11 +66,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public int cmSetWindlightScene(LSL_List rules)
{
return m_CM_Functions.cmSetWindlightScene(rules);
- }
-
- public int cmSetWindlightSceneTargeted(LSL_List rules, key target)
- {
- return m_CM_Functions.cmSetWindlightSceneTargeted(rules, target);
+ }
+
+ public int cmSetWindlightSceneTargeted(LSL_List rules, key target)
+ {
+ return m_CM_Functions.cmSetWindlightSceneTargeted(rules, target);
+ }
+ public LSL_List cmGetAvatarList()
+ {
+ return m_CM_Functions.cmGetAvatarList();
}
}
}
--
cgit v1.1
From 0fa57cac3fc05988bf182920c82fbeee0be075cf Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Mon, 3 May 2010 00:54:24 +0200
Subject: Fix sensor cone for sensing avatars
---
.../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 4d7ead6..5e2e205 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -204,7 +204,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
// Is the sensor type is AGENT and not SCRIPTED then include agents
if ((ts.type & AGENT) != 0 && (ts.type & SCRIPTED) == 0)
{
- sensedEntities.AddRange(doAgentSensor(ts));
+ sensedEntities.AddRange(doAgentSensor(ts));
}
// If SCRIPTED or PASSIVE or ACTIVE check objects
@@ -309,6 +309,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
// in mouselook.
ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar);
+ fromRegionPos = avatar.AbsolutePosition;
q = avatar.Rotation;
}
LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
@@ -422,6 +423,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
SceneObjectPart SensePoint = ts.host;
Vector3 fromRegionPos = SensePoint.AbsolutePosition;
Quaternion q = SensePoint.RotationOffset;
+ if (SensePoint.ParentGroup.RootPart.IsAttachment)
+ {
+ // In attachments, the sensor cone always orients with the
+ // avatar rotation. This may include a nonzero elevation if
+ // in mouselook.
+
+ ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar);
+ fromRegionPos = avatar.AbsolutePosition;
+ q = avatar.Rotation;
+ }
LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);
--
cgit v1.1
From c86259c6710c8ce5c97a7a64bbb96dac35440aec Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Tue, 4 May 2010 00:44:05 +0200
Subject: Fix scripted give and interactive give to offline avatars. Both
folder and single items are now supported. Magic Boxes, yeah!
---
.../Shared/Api/Implementation/LSL_Api.cs | 31 ++++++++++++++++------
1 file changed, 23 insertions(+), 8 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 228e9b8..d216eff 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4005,9 +4005,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
}
- // check if destination is an avatar
- if (World.GetScenePresence(destId) != null)
+ // check if destination is an object
+ if (World.GetSceneObjectPart(destId) != null)
{
+ // destination is an object
+ World.MoveTaskInventoryItem(destId, m_host, objId);
+ }
+ else
+ {
+ ScenePresence presence = World.GetScenePresence(destId);
+
+ if (presence == null)
+ {
+ UserAccount account =
+ World.UserAccountService.GetUserAccount(
+ World.RegionInfo.ScopeID,
+ destId);
+
+ if (account == null)
+ {
+ llSay(0, "Can't find destination "+destId.ToString());
+ return;
+ }
+ }
+
// destination is an avatar
InventoryItemBase agentItem =
World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
@@ -4037,12 +4058,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//This delay should only occur when giving inventory to avatars.
ScriptSleep(3000);
}
- else
- {
- // destination is an object
- World.MoveTaskInventoryItem(destId, m_host, objId);
- }
-
}
[DebuggerNonUserCode]
--
cgit v1.1
From dbce360566dd20d2b0f2ad649ba7a1dca9a27d36 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Tue, 4 May 2010 02:43:22 +0200
Subject: Fix full circle sensors
---
.../ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 5e2e205..d354fde 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -483,6 +483,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
sensedEntities.Add(new SensedEntity(dis, presence.UUID));
}
}
+ else
+ {
+ // If full circle is asked for, just add it
+ sensedEntities.Add(new SensedEntity(dis, presence.UUID));
+ }
}
});
--
cgit v1.1
From e0f9b1a69994be3e5771ebdcb0f2c253f67150db Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Wed, 5 May 2010 21:12:02 +0200
Subject: Removed a test for a "can't happen" case. ParentGroup is never null
anymore.
---
.../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d216eff..6ab3c62 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2033,14 +2033,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y);
bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true);
- if (part.ParentGroup == null)
- {
- if ((targetPos.z < ground) && disable_underground_movement)
- targetPos.z = ground;
- LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
- part.UpdateOffSet(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z));
- }
- else if (part.ParentGroup.RootPart == part)
+ if (part.ParentGroup.RootPart == part)
{
if ((targetPos.z < ground) && disable_underground_movement)
targetPos.z = ground;
@@ -2050,7 +2043,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
{
- //it's late... i think this is right ?
if (llVecDist(new LSL_Vector(0,0,0), targetPos) <= 10.0f)
{
part.OffsetPosition = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z);
--
cgit v1.1
From ba36c62caad0fb88f89863c9e0afdefc4f2897cc Mon Sep 17 00:00:00 2001
From: Tom Grimshaw
Date: Wed, 19 May 2010 00:20:51 -0700
Subject: Fix a null reference issue in cmGetAvatarList()
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
index 07cba60..3e62c1a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -121,7 +121,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_List result = new LSL_List();
World.ForEachScenePresence(delegate (ScenePresence avatar)
{
- if (avatar.UUID != m_host.OwnerID)
+ if (avatar != null && avatar.UUID != m_host.OwnerID)
{
if (avatar.IsChildAgent == false)
{
--
cgit v1.1
From e3dac1292ef000daadda3e264354d8df0fc77c22 Mon Sep 17 00:00:00 2001
From: Tom Grimshaw
Date: Sat, 29 May 2010 02:10:34 -0700
Subject: Implement suspended updates - When an operation is occurring on lots
of prims in a single group, don't schedule any updates until the operation
has completed. This makes things like llSetAlpha(LINK_SET,0.0,ALL_SIDES); a
*lot* faster, more efficient and less buggy, and also makes unlinking a lot
better. Linking is still treacherous.. this needs to be analysed.
---
.../Shared/Api/Implementation/LSL_Api.cs | 132 +++++++++++++++++----
1 file changed, 107 insertions(+), 25 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 68f6e7b..bb02fa3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1649,9 +1649,19 @@ 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
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = true;
+ foreach (SceneObjectPart part in parts)
+ SetAlpha(part, alpha, face);
+ }
+ finally
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = false;
+ }
+ }
}
protected void SetAlpha(SceneObjectPart part, double alpha, int face)
@@ -1816,10 +1826,19 @@ 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
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = true;
+ foreach (SceneObjectPart part in parts)
+ SetTexture(part, texture, face);
+ }
+ finally
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = false;
+ }
+ }
ScriptSleep(200);
}
@@ -3661,9 +3680,19 @@ 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.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
+ if (parts.Count > 0)
+ {
+ try
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = true;
+ foreach (SceneObjectPart part in parts)
+ part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
+ }
+ finally
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = false;
+ }
+ }
}
public void llCreateLink(string target, int parent)
@@ -3776,10 +3805,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Restructuring Multiple Prims.
List parts = new List(parentPrim.Children.Values);
parts.Remove(parentPrim.RootPart);
- foreach (SceneObjectPart part in parts)
+ if (parts.Count > 0)
{
- parentPrim.DelinkFromGroup(part.LocalId, true);
+ try
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = true;
+ foreach (SceneObjectPart part in parts)
+ {
+ parentPrim.DelinkFromGroup(part.LocalId, true);
+ }
+ }
+ finally
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = false;
+ }
}
+
parentPrim.HasGroupChanged = true;
parentPrim.ScheduleGroupForFullUpdate();
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
@@ -3788,11 +3829,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
SceneObjectPart newRoot = parts[0];
parts.Remove(newRoot);
- foreach (SceneObjectPart part in parts)
+
+ try
{
- part.UpdateFlag = 0;
- newRoot.ParentGroup.LinkToGroup(part.ParentGroup);
+ parts[0].ParentGroup.areUpdatesSuspended = true;
+ foreach (SceneObjectPart part in parts)
+ {
+ part.UpdateFlag = 0;
+ newRoot.ParentGroup.LinkToGroup(part.ParentGroup);
+ }
}
+ finally
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = false;
+ }
+
+
newRoot.ParentGroup.HasGroupChanged = true;
newRoot.ParentGroup.ScheduleGroupForFullUpdate();
}
@@ -3818,11 +3870,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
List parts = new List(parentPrim.Children.Values);
parts.Remove(parentPrim.RootPart);
-
- foreach (SceneObjectPart part in parts)
+ if (parts.Count > 0)
{
- parentPrim.DelinkFromGroup(part.LocalId, true);
- parentPrim.TriggerScriptChangedEvent(Changed.LINK);
+ try
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = true;
+ foreach (SceneObjectPart part in parts)
+ {
+ parentPrim.DelinkFromGroup(part.LocalId, true);
+ parentPrim.TriggerScriptChangedEvent(Changed.LINK);
+ }
+ }
+ finally
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = false;
+ }
}
parentPrim.HasGroupChanged = true;
parentPrim.ScheduleGroupForFullUpdate();
@@ -5664,10 +5726,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
List parts = GetLinkParts(linknumber);
-
- foreach (var part in parts)
+ if (parts.Count > 0)
{
- SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate);
+ try
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = true;
+ foreach (var part in parts)
+ {
+ SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate);
+ }
+ }
+ finally
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = false;
+ }
}
}
@@ -7068,9 +7140,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
List parts = GetLinkParts(linknumber);
-
- foreach (SceneObjectPart part in parts)
- SetPrimParams(part, rules);
+ if (parts.Count>0)
+ {
+ try
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = true;
+ foreach (SceneObjectPart part in parts)
+ SetPrimParams(part, rules);
+ }
+ finally
+ {
+ parts[0].ParentGroup.areUpdatesSuspended = false;
+ }
+ }
}
public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
--
cgit v1.1
From 59a536743354ffaa12b23378f559d2d59d7d5304 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sun, 30 May 2010 13:46:05 +0200
Subject: Changes OSSL Api permissions for the case of UUID list. In 0.6.9, the
UUIDs would be the IDs of the prim owners in whose prims these functions
would run. This changes it so the UUID is the SCRIPT CREATOR instead.
Further, osfunctions limited by uuid will not run if the creator and owner
differ and the owner has mod rights on the script. There is still a danger in
passing moodifiable scripts to others, as they can insert a harmful function,
then remove the mod rights to make it runnable. As before, care needs to be
taken, but where it was modable prims that were the risk before, modable
scripts are the weak spot now. In cases where prim owner == script creator ==
script owner, nothing will change.
---
.../Shared/Api/Implementation/OSSL_Api.cs | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 942e4ef..8cfa833 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -278,10 +278,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (!m_FunctionPerms[function].Contains(UUID.Zero))
{
- if (!m_FunctionPerms[function].Contains(m_host.OwnerID))
+ TaskInventoryItem ti = m_host.Inventory.GetInventoryItem(m_itemID);
+ if (ti == null)
+ {
+ OSSLError(
+ String.Format("{0} permission error. Can't find script in prim inventory.",
+ function));
+ }
+ if (!m_FunctionPerms[function].Contains(ti.CreatorID))
OSSLError(
- String.Format("{0} permission denied. Prim owner is not in the list of users allowed to execute this function.",
+ String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function.",
function));
+ if (ti.CreatorID != ti.OwnerID)
+ {
+ if ((ti.CurrentPermissions & (uint)PermissionMask.Modify) != 0)
+ OSSLError(
+ String.Format("{0} permission denied. Script permissions error.",
+ function));
+
+ }
}
}
}
@@ -2141,4 +2156,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
-}
\ No newline at end of file
+}
--
cgit v1.1
From 890f3cc54cc57883a110b372530bf2a7d5b37fff Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sun, 30 May 2010 15:46:54 +0200
Subject: Changes osFunction permissions again. Allow_ with a list of UUIDs now
again refers to prim OWNERS. A new option set, Creators_, is added to allow
selection by script creator. For existing installs, this means no functional
change. The warning from my prior commit doesn't apply anymore.
---
.../Shared/Api/Implementation/OSSL_Api.cs | 67 ++++++++++++++++------
1 file changed, 51 insertions(+), 16 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 8cfa833..2e0456e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -105,6 +105,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// modification of user data, or allows the compromise of
// sensitive data by design.
+ class FunctionPerms
+ {
+ public List AllowedCreators;
+ public List AllowedOwners;
+
+ public FunctionPerms()
+ {
+ AllowedCreators = new List();
+ AllowedOwners = new List();
+ }
+ }
+
[Serializable]
public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi
{
@@ -117,7 +129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow;
internal float m_ScriptDelayFactor = 1.0f;
internal float m_ScriptDistanceFactor = 1.0f;
- internal Dictionary > m_FunctionPerms = new Dictionary >();
+ internal Dictionary m_FunctionPerms = new Dictionary();
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
{
@@ -217,31 +229,46 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!m_FunctionPerms.ContainsKey(function))
{
- string perm = m_ScriptEngine.Config.GetString("Allow_" + function, "");
- if (perm == "")
+ FunctionPerms perms = new FunctionPerms();
+ m_FunctionPerms[function] = perms;
+
+ string ownerPerm = m_ScriptEngine.Config.GetString("Allow_" + function, "");
+ string creatorPerm = m_ScriptEngine.Config.GetString("Creators_" + function, "");
+ if (ownerPerm == "" && creatorPerm == "")
{
- m_FunctionPerms[function] = null; // a null value is default
+ // Default behavior
+ perms.AllowedOwners = null;
+ perms.AllowedCreators = null;
}
else
{
bool allowed;
- if (bool.TryParse(perm, out allowed))
+ if (bool.TryParse(ownerPerm, out allowed))
{
// Boolean given
if (allowed)
{
- m_FunctionPerms[function] = new List();
- m_FunctionPerms[function].Add(UUID.Zero);
+ // Allow globally
+ perms.AllowedOwners.Add(UUID.Zero);
}
- else
- m_FunctionPerms[function] = new List(); // Empty list = none
}
else
{
- m_FunctionPerms[function] = new List();
+ string[] ids = ownerPerm.Split(new char[] {','});
+ foreach (string id in ids)
+ {
+ string current = id.Trim();
+ UUID uuid;
+
+ if (UUID.TryParse(current, out uuid))
+ {
+ if (uuid != UUID.Zero)
+ perms.AllowedOwners.Add(uuid);
+ }
+ }
- string[] ids = perm.Split(new char[] {','});
+ ids = creatorPerm.Split(new char[] {','});
foreach (string id in ids)
{
string current = id.Trim();
@@ -250,7 +277,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (UUID.TryParse(current, out uuid))
{
if (uuid != UUID.Zero)
- m_FunctionPerms[function].Add(uuid);
+ perms.AllowedCreators.Add(uuid);
}
}
}
@@ -266,8 +293,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//
// To allow use by anyone, the list contains UUID.Zero
//
- if (m_FunctionPerms[function] == null) // No list = true
+ if (m_FunctionPerms[function].AllowedOwners == null)
{
+ // Allow / disallow by threat level
if (level > m_MaxThreatLevel)
OSSLError(
String.Format(
@@ -276,8 +304,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
{
- if (!m_FunctionPerms[function].Contains(UUID.Zero))
+ if (!m_FunctionPerms[function].AllowedOwners.Contains(UUID.Zero))
{
+ // Not anyone. Do detailed checks
+ if (m_FunctionPerms[function].AllowedOwners.Contains(m_host.OwnerID))
+ {
+ // prim owner is in the list of allowed owners
+ return;
+ }
+
TaskInventoryItem ti = m_host.Inventory.GetInventoryItem(m_itemID);
if (ti == null)
{
@@ -285,9 +320,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
String.Format("{0} permission error. Can't find script in prim inventory.",
function));
}
- if (!m_FunctionPerms[function].Contains(ti.CreatorID))
+ if (!m_FunctionPerms[function].AllowedCreators.Contains(ti.CreatorID))
OSSLError(
- String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function.",
+ String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.",
function));
if (ti.CreatorID != ti.OwnerID)
{
--
cgit v1.1
From 6c1665bf46f691f83e93561cfbcdcd4d3f3bd954 Mon Sep 17 00:00:00 2001
From: Tom Grimshaw
Date: Mon, 31 May 2010 08:38:41 -0700
Subject: Fix casting in llParcelMediaCommandList so that it actually, you
know, works
---
.../Shared/Api/Implementation/LSL_Api.cs | 32 +++++++++++-----------
1 file changed, 16 insertions(+), 16 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index bb02fa3..d0f245b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9046,17 +9046,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
int width = 0;
int height = 0;
- ParcelMediaCommandEnum? commandToSend = null;
+ uint commandToSend = 0;
float time = 0.0f; // default is from start
ScenePresence presence = null;
for (int i = 0; i < commandList.Data.Length; i++)
{
- ParcelMediaCommandEnum command = (ParcelMediaCommandEnum)commandList.Data[i];
+ uint command = (uint)(commandList.GetLSLIntegerItem(i));
switch (command)
{
- case ParcelMediaCommandEnum.Agent:
+ case (uint)ParcelMediaCommandEnum.Agent:
// we send only to one agent
if ((i + 1) < commandList.Length)
{
@@ -9073,25 +9073,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
break;
- case ParcelMediaCommandEnum.Loop:
+ case (uint)ParcelMediaCommandEnum.Loop:
loop = 1;
commandToSend = command;
update = true; //need to send the media update packet to set looping
break;
- case ParcelMediaCommandEnum.Play:
+ case (uint)ParcelMediaCommandEnum.Play:
loop = 0;
commandToSend = command;
update = true; //need to send the media update packet to make sure it doesn't loop
break;
- case ParcelMediaCommandEnum.Pause:
- case ParcelMediaCommandEnum.Stop:
- case ParcelMediaCommandEnum.Unload:
+ case (uint)ParcelMediaCommandEnum.Pause:
+ case (uint)ParcelMediaCommandEnum.Stop:
+ case (uint)ParcelMediaCommandEnum.Unload:
commandToSend = command;
break;
- case ParcelMediaCommandEnum.Url:
+ case (uint)ParcelMediaCommandEnum.Url:
if ((i + 1) < commandList.Length)
{
if (commandList.Data[i + 1] is LSL_String)
@@ -9104,7 +9104,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
break;
- case ParcelMediaCommandEnum.Texture:
+ case (uint)ParcelMediaCommandEnum.Texture:
if ((i + 1) < commandList.Length)
{
if (commandList.Data[i + 1] is LSL_String)
@@ -9117,7 +9117,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
break;
- case ParcelMediaCommandEnum.Time:
+ case (uint)ParcelMediaCommandEnum.Time:
if ((i + 1) < commandList.Length)
{
if (commandList.Data[i + 1] is LSL_Float)
@@ -9129,7 +9129,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
break;
- case ParcelMediaCommandEnum.AutoAlign:
+ case (uint)ParcelMediaCommandEnum.AutoAlign:
if ((i + 1) < commandList.Length)
{
if (commandList.Data[i + 1] is LSL_Integer)
@@ -9143,7 +9143,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
break;
- case ParcelMediaCommandEnum.Type:
+ case (uint)ParcelMediaCommandEnum.Type:
if ((i + 1) < commandList.Length)
{
if (commandList.Data[i + 1] is LSL_String)
@@ -9156,7 +9156,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
break;
- case ParcelMediaCommandEnum.Desc:
+ case (uint)ParcelMediaCommandEnum.Desc:
if ((i + 1) < commandList.Length)
{
if (commandList.Data[i + 1] is LSL_String)
@@ -9169,7 +9169,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
break;
- case ParcelMediaCommandEnum.Size:
+ case (uint)ParcelMediaCommandEnum.Size:
if ((i + 2) < commandList.Length)
{
if (commandList.Data[i + 1] is LSL_Integer)
@@ -9239,7 +9239,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
- if (commandToSend != null)
+ if (commandToSend != 0)
{
// the commandList contained a start/stop/... command, too
if (presence == null)
--
cgit v1.1
From d4b4cbf5a5fead727b5e2e48f69d2016eb942cff Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Mon, 31 May 2010 19:00:02 +0200
Subject: Fix create selection getting overwritten by multiple updates for the
same prim.
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index bb02fa3..228ab6d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3742,7 +3742,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
- parentPrim.RootPart.AddFlag(PrimFlags.CreateSelected);
+ parentPrim.RootPart.CreateSelected = true;
parentPrim.HasGroupChanged = true;
parentPrim.ScheduleGroupForFullUpdate();
--
cgit v1.1
From 90c814a7cace3bac3df451a8b184c32f462c4da2 Mon Sep 17 00:00:00 2001
From: Tom Grimshaw
Date: Tue, 1 Jun 2010 13:29:12 -0700
Subject: Fix nullref in cmGetAvatarList() (ported from 0.69)
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
index 3e62c1a..4fb5c95 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -125,9 +125,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (avatar.IsChildAgent == false)
{
- result.Add(avatar.UUID);
- result.Add(avatar.PhysicsActor.Position);
- result.Add(avatar.Name);
+ if (avatar.PhysicsActor != null && avatar.PhysicsActor.Position != null)
+ {
+ result.Add(avatar.UUID);
+ result.Add(avatar.PhysicsActor.Position);
+ result.Add(avatar.Name);
+ }
}
}
});
--
cgit v1.1
From d8962ef4151043babe8d5c33c332bf49b020b119 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Wed, 2 Jun 2010 01:01:56 +0200
Subject: Add two new osFunctions: list osGetPrimititveParams(key prim, list
rules); osSetPrimitiveParams(key prim, list rules);
---
.../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 18 ++++++++++++++++++
.../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 16 ++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 3 +++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 4 ++++
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 9 +++++++++
5 files changed, 50 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 8cc5e25..481a3e6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -10261,6 +10261,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(100);
return tid.ToString();
}
+
+ public void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules)
+ {
+ SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim));
+ if (obj == null)
+ return;
+
+ SetPrimParams(obj, rules);
+ }
+
+ public LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules)
+ {
+ SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim));
+ if (obj == null)
+ return new LSL_List();
+
+ return GetLinkPrimitiveParams(obj, rules);
+ }
}
public class NotecardCache
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 2e0456e..f2a2f32 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2190,5 +2190,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
}
+
+ public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
+ {
+ CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams");
+ m_host.AddScriptLPS(1);
+
+ return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules);
+ }
+
+ public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules)
+ {
+ CheckThreatLevel(ThreatLevel.High, "osGetPrimitiveParams");
+ m_host.AddScriptLPS(1);
+
+ m_LSL_Api.SetPrimitiveParamsEx(prim, rules);
+ }
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 7ab04a3..cba46a3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -395,5 +395,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Vector llWind(LSL_Vector offset);
LSL_String llXorBase64Strings(string str1, string str2);
LSL_String llXorBase64StringsCorrect(string str1, string str2);
+
+ void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
+ LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 9dbd369..1ab7f10 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -35,6 +35,7 @@ using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
+using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
{
@@ -173,5 +174,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osSetSpeed(string UUID, float SpeedModifier);
void osCauseHealing(string avatar, double healing);
void osCauseDamage(string avatar, double damage);
+ LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules);
+ void osSetPrimitiveParams(LSL_Key prim, LSL_List rules);
+
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index fd9309a..7af5d43 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -41,6 +41,7 @@ using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
+using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
@@ -678,5 +679,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
m_OSSL_Functions.osCauseHealing(avatar, healing);
}
+ public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
+ {
+ return m_OSSL_Functions.osGetPrimitiveParams(prim, rules);
+ }
+ public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules)
+ {
+ m_OSSL_Functions.osSetPrimitiveParams(prim, rules);
+ }
}
}
--
cgit v1.1
From 70aa965c2678f91e45986f50a89588339a904f04 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Wed, 2 Jun 2010 01:04:17 +0200
Subject: Add a forgotten security check. Make the new functions only work on
prims owned by the host prim owner.
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 481a3e6..3c2ef34 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -10268,6 +10268,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (obj == null)
return;
+ if (obj.OwnerID != m_host.OwnerID)
+ return;
+
SetPrimParams(obj, rules);
}
@@ -10277,6 +10280,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (obj == null)
return new LSL_List();
+ if (obj.OwnerID != m_host.OwnerID)
+ return new LSL_List();
+
return GetLinkPrimitiveParams(obj, rules);
}
}
--
cgit v1.1
From e962c44749ca63dec9df7de1c74b03d9b59c3f20 Mon Sep 17 00:00:00 2001
From: Tom Grimshaw
Date: Fri, 4 Jun 2010 19:36:31 -0700
Subject: Fix support for PRIM_SCULPT_FLAG_INVERT and PRIM_SCULPT_FLAG_MIRROR
in the llSetPrimitiveParams series of functions. This makes it possible to
mirror a sculpt by script.
---
.../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 3c2ef34..0a4544c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7112,13 +7112,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
shapeBlock.PathScaleX = 100;
shapeBlock.PathScaleY = 150;
- if (type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER &&
- type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE &&
- type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE &&
- type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS)
+ if ((type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER) == 0 &&
+ (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE) == 0 &&
+ (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE) == 0 &&
+ (type & (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS) == 0)
{
// default
- type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
+ type = type | (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
}
// retain pathcurve
--
cgit v1.1
From b3cf5ccf6d7fcfa2cb4a1405962b8fba73ae0119 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 11 Jun 2010 17:04:54 +0200
Subject: Clone cmGetAvatarList into osGetAvatarList for more generic use.
---
.../Shared/Api/Implementation/OSSL_Api.cs | 27 ++++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 +
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 ++++
3 files changed, 33 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index f2a2f32..0e86c86 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2206,5 +2206,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_LSL_Api.SetPrimitiveParamsEx(prim, rules);
}
+
+ ///
+ /// Like osGetAgents but returns enough info for a radar
+ ///
+ /// Strided list of the UUID, position and name of each avatar in the region
+ public LSL_List osGetAvatarList()
+ {
+ CheckThreatLevel(ThreatLevel.None, "osGetAvatarList");
+
+ LSL_List result = new LSL_List();
+ World.ForEachScenePresence(delegate (ScenePresence avatar)
+ {
+ if (avatar != null && avatar.UUID != m_host.OwnerID)
+ {
+ if (avatar.IsChildAgent == false)
+ {
+ if (avatar.PhysicsActor != null && avatar.PhysicsActor.Position != null)
+ {
+ result.Add(avatar.UUID);
+ result.Add(avatar.PhysicsActor.Position);
+ result.Add(avatar.Name);
+ }
+ }
+ }
+ });
+ return result;
+ }
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 1ab7f10..c8f3623 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -176,6 +176,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osCauseDamage(string avatar, double damage);
LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules);
void osSetPrimitiveParams(LSL_Key prim, LSL_List rules);
+ LSL_List osGetAvatarList();
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 7af5d43..6cc5f51 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -687,5 +687,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
m_OSSL_Functions.osSetPrimitiveParams(prim, rules);
}
+
+ public LSL_List osGetAvatarList()
+ {
+ return m_OSSL_Functions.osGetAvatarList();
+ }
}
}
--
cgit v1.1
From 8d5cec5e0d8edb9fafce4df3235c05dbc46b9240 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 11 Jun 2010 17:08:18 +0200
Subject: Remove cmGetAvatarList()
---
.../Shared/Api/Implementation/CM_Api.cs | 25 ----------------------
.../ScriptEngine/Shared/Api/Interface/ICM_Api.cs | 1 -
.../ScriptEngine/Shared/Api/Runtime/CM_Stub.cs | 4 ----
3 files changed, 30 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
index 4fb5c95..880ca1b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -113,31 +113,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
///
- /// Like osGetAgents but returns enough info for a radar
- ///
- /// Strided list of the UUID, position and name of each avatar in the region
- public LSL_List cmGetAvatarList()
- {
- LSL_List result = new LSL_List();
- World.ForEachScenePresence(delegate (ScenePresence avatar)
- {
- if (avatar != null && avatar.UUID != m_host.OwnerID)
- {
- if (avatar.IsChildAgent == false)
- {
- if (avatar.PhysicsActor != null && avatar.PhysicsActor.Position != null)
- {
- result.Add(avatar.UUID);
- result.Add(avatar.PhysicsActor.Position);
- result.Add(avatar.Name);
- }
- }
- }
- });
- return result;
- }
-
- ///
/// Get the current Windlight scene
///
/// List of windlight parameters
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
index fba27f9..f13b6e5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
@@ -44,6 +44,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_List cmGetWindlightScene(LSL_List rules);
int cmSetWindlightScene(LSL_List rules);
int cmSetWindlightSceneTargeted(LSL_List rules, key target);
- LSL_List cmGetAvatarList();
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
index aaffbe4..c0edaae 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
@@ -72,9 +72,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_CM_Functions.cmSetWindlightSceneTargeted(rules, target);
}
- public LSL_List cmGetAvatarList()
- {
- return m_CM_Functions.cmGetAvatarList();
- }
}
}
--
cgit v1.1
From 97d83c87ec27f355844016281ce1be156fe7cd3f Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 11 Jun 2010 17:23:06 +0200
Subject: Rename cm* function set to ls* (for LightShare)
---
.../Shared/Api/Implementation/CM_Api.cs | 18 +++++++++---------
.../ScriptEngine/Shared/Api/Interface/ICM_Api.cs | 6 +++---
.../ScriptEngine/Shared/Api/Runtime/CM_Stub.cs | 21 ++++++++++++++++++---
3 files changed, 30 insertions(+), 15 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
index 880ca1b..9a99f5e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_localID = localID;
m_itemID = itemID;
- if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false))
+ if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
m_CMFunctionsEnabled = true;
m_comms = m_ScriptEngine.World.RequestModuleInterface();
@@ -116,11 +116,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// Get the current Windlight scene
///
/// List of windlight parameters
- public LSL_List cmGetWindlightScene(LSL_List rules)
+ public LSL_List lsGetWindlightScene(LSL_List rules)
{
if (!m_CMFunctionsEnabled)
{
- CMShoutError("Careminster functions are not enabled.");
+ CMShoutError("LightShare functions are not enabled.");
return new LSL_List();
}
m_host.AddScriptLPS(1);
@@ -440,16 +440,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
///
/// success: true or false
- public int cmSetWindlightScene(LSL_List rules)
+ public int lsSetWindlightScene(LSL_List rules)
{
if (!m_CMFunctionsEnabled)
{
- CMShoutError("Careminster functions are not enabled.");
+ CMShoutError("LightShare functions are not enabled.");
return 0;
}
if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
{
- CMShoutError("cmSetWindlightScene can only be used by estate managers or owners.");
+ CMShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return 0;
}
int success = 0;
@@ -472,16 +472,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
///
/// success: true or false
- public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
+ public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
{
if (!m_CMFunctionsEnabled)
{
- CMShoutError("Careminster functions are not enabled.");
+ CMShoutError("LightShare functions are not enabled.");
return 0;
}
if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
{
- CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners.");
+ CMShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
return 0;
}
int success = 0;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
index f13b6e5..f47ae7d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
@@ -41,8 +41,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
public interface ICM_Api
{
// Windlight Functions
- LSL_List cmGetWindlightScene(LSL_List rules);
- int cmSetWindlightScene(LSL_List rules);
- int cmSetWindlightSceneTargeted(LSL_List rules, key target);
+ LSL_List lsGetWindlightScene(LSL_List rules);
+ int lsSetWindlightScene(LSL_List rules);
+ int lsSetWindlightSceneTargeted(LSL_List rules, key target);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
index c0edaae..92c3d98 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
@@ -58,19 +58,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_CM_Functions = (ICM_Api)api;
}
+ public LSL_List lsGetWindlightScene(LSL_List rules)
+ {
+ return m_CM_Functions.lsGetWindlightScene(rules);
+ }
+
+ public int lsSetWindlightScene(LSL_List rules)
+ {
+ return m_CM_Functions.lsSetWindlightScene(rules);
+ }
+
+ public int lsSetWindlightSceneTargeted(LSL_List rules, key target)
+ {
+ return m_CM_Functions.lsSetWindlightSceneTargeted(rules, target);
+ }
+
public LSL_List cmGetWindlightScene(LSL_List rules)
{
- return m_CM_Functions.cmGetWindlightScene(rules);
+ return m_CM_Functions.lsGetWindlightScene(rules);
}
public int cmSetWindlightScene(LSL_List rules)
{
- return m_CM_Functions.cmSetWindlightScene(rules);
+ return m_CM_Functions.lsSetWindlightScene(rules);
}
public int cmSetWindlightSceneTargeted(LSL_List rules, key target)
{
- return m_CM_Functions.cmSetWindlightSceneTargeted(rules, target);
+ return m_CM_Functions.lsSetWindlightSceneTargeted(rules, target);
}
}
}
--
cgit v1.1
From 10ef80cf153a9fd3d841a47a5033bb3c1344c39d Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 11 Jun 2010 17:42:16 +0200
Subject: Rename CM files to LS
---
.../Shared/Api/Implementation/CM_Api.cs | 504 ---------------------
.../Shared/Api/Implementation/LS_Api.cs | 504 +++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/ICM_Api.cs | 48 --
.../ScriptEngine/Shared/Api/Interface/ILS_Api.cs | 48 ++
.../ScriptEngine/Shared/Api/Runtime/CM_Stub.cs | 91 ----
.../ScriptEngine/Shared/Api/Runtime/LS_Stub.cs | 91 ++++
6 files changed, 643 insertions(+), 643 deletions(-)
delete mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
create mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
delete mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
create mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs
delete mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
create mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
deleted file mode 100644
index 9a99f5e..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * 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.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 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 uint m_localID;
- internal UUID m_itemID;
- internal bool m_CMFunctionsEnabled = false;
- internal IScriptModuleComms m_comms = null;
-
- public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
- {
- m_ScriptEngine = ScriptEngine;
- m_host = host;
- m_localID = localID;
- m_itemID = itemID;
-
- if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
- m_CMFunctionsEnabled = true;
-
- m_comms = m_ScriptEngine.World.RequestModuleInterface();
- if (m_comms == null)
- m_CMFunctionsEnabled = false;
- }
-
- 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; }
- }
-
- //
- //Dumps an error message on the debug console.
- //
-
- internal void CMShoutError(string message)
- {
- if (message.Length > 1023)
- message = message.Substring(0, 1023);
-
- World.SimChat(Utils.StringToBytes(message),
- ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true);
-
- IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface();
- wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
- }
-
- ///
- /// Get the current Windlight scene
- ///
- /// List of windlight parameters
- public LSL_List lsGetWindlightScene(LSL_List rules)
- {
- if (!m_CMFunctionsEnabled)
- {
- CMShoutError("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();
- int idx = 0;
- while (idx < rules.Length)
- {
- uint rule = (uint)rules.GetLSLIntegerItem(idx);
- LSL_List toadd = new LSL_List();
-
- switch (rule)
- {
- case (int)ScriptBaseClass.WL_AMBIENT:
- toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W));
- break;
- case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
- toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f));
- break;
- case (int)ScriptBaseClass.WL_BLUE_DENSITY:
- toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W));
- break;
- case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
- toadd.Add(new LSL_Float(wl.blurMultiplier));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_COLOR:
- toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
- toadd.Add(new LSL_Float(wl.cloudCoverage));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
- toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCALE:
- toadd.Add(new LSL_Float(wl.cloudScale));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
- toadd.Add(new LSL_Float(wl.cloudScrollX));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
- toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
- toadd.Add(new LSL_Float(wl.cloudScrollY));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
- toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0));
- break;
- case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
- toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z));
- break;
- case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
- toadd.Add(new LSL_Float(wl.densityMultiplier));
- break;
- case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
- toadd.Add(new LSL_Float(wl.distanceMultiplier));
- break;
- case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
- toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0));
- break;
- case (int)ScriptBaseClass.WL_EAST_ANGLE:
- toadd.Add(new LSL_Float(wl.eastAngle));
- break;
- case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
- toadd.Add(new LSL_Float(wl.fresnelOffset));
- break;
- case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
- toadd.Add(new LSL_Float(wl.fresnelScale));
- break;
- case (int)ScriptBaseClass.WL_HAZE_DENSITY:
- toadd.Add(new LSL_Float(wl.hazeDensity));
- break;
- case (int)ScriptBaseClass.WL_HAZE_HORIZON:
- toadd.Add(new LSL_Float(wl.hazeHorizon));
- break;
- case (int)ScriptBaseClass.WL_HORIZON:
- toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W));
- break;
- case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
- toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f));
- break;
- case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
- toadd.Add(new LSL_Integer(wl.maxAltitude));
- break;
- case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
- toadd.Add(new LSL_Key(wl.normalMapTexture.ToString()));
- break;
- case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
- toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z));
- break;
- case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
- toadd.Add(new LSL_Float(wl.refractScaleAbove));
- break;
- case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
- toadd.Add(new LSL_Float(wl.refractScaleBelow));
- break;
- case (int)ScriptBaseClass.WL_SCENE_GAMMA:
- toadd.Add(new LSL_Float(wl.sceneGamma));
- break;
- case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
- toadd.Add(new LSL_Float(wl.starBrightness));
- break;
- case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
- toadd.Add(new LSL_Float(wl.sunGlowFocus));
- break;
- case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
- toadd.Add(new LSL_Float(wl.sunGlowSize));
- break;
- case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
- toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W));
- break;
- case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
- toadd.Add(new LSL_Float(wl.underwaterFogModifier));
- break;
- case (int)ScriptBaseClass.WL_WATER_COLOR:
- toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z));
- break;
- case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
- toadd.Add(new LSL_Float(wl.waterFogDensityExponent));
- break;
- }
-
- if (toadd.Length > 0)
- {
- values.Add(rule);
- values.Add(toadd.Data[0]);
- }
- idx++;
- }
-
-
- return values;
-
- }
-
- private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
- {
- RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
-
- LSL_List values = new LSL_List();
- int idx = 0;
- while (idx < rules.Length)
- {
- uint rule = (uint)rules.GetLSLIntegerItem(idx);
- LSL_Types.Quaternion iQ;
- LSL_Types.Vector3 iV;
- switch (rule)
- {
- case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
- idx++;
- wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_AMBIENT:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
- break;
- case (int)ScriptBaseClass.WL_BLUE_DENSITY:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
- idx++;
- wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_COLOR:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
- idx++;
- wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCALE:
- idx++;
- wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
- idx++;
- wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
- idx++;
- wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
- idx++;
- wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
- idx++;
- wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
- break;
- case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
- break;
- case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
- idx++;
- wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
- idx++;
- wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
- idx++;
- wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
- break;
- case (int)ScriptBaseClass.WL_EAST_ANGLE:
- idx++;
- wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
- idx++;
- wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
- idx++;
- wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_HAZE_DENSITY:
- idx++;
- wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_HAZE_HORIZON:
- idx++;
- wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_HORIZON:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
- break;
- case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
- idx++;
- wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
- break;
- case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
- idx++;
- wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
- break;
- case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
- break;
- case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
- idx++;
- wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
- idx++;
- wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_SCENE_GAMMA:
- idx++;
- wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
- idx++;
- wl.starBrightness = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
- idx++;
- wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
- idx++;
- wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
- idx++;
- iQ = rules.GetQuaternionItem(idx);
- wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
- break;
- case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
- idx++;
- wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
- break;
- case (int)ScriptBaseClass.WL_WATER_COLOR:
- idx++;
- iV = rules.GetVector3Item(idx);
- wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
- break;
- case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
- idx++;
- wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
- break;
- }
- idx++;
- }
- return wl;
- }
- ///
- /// Set the current Windlight scene
- ///
- ///
- /// success: true or false
- public int lsSetWindlightScene(LSL_List rules)
- {
- if (!m_CMFunctionsEnabled)
- {
- CMShoutError("LightShare functions are not enabled.");
- return 0;
- }
- if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
- {
- CMShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
- return 0;
- }
- int success = 0;
- m_host.AddScriptLPS(1);
- if (LightShareModule.EnableWindlight)
- {
- RegionLightShareData wl = getWindlightProfileFromRules(rules);
- m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
- success = 1;
- }
- else
- {
- CMShoutError("Windlight module is disabled");
- return 0;
- }
- return success;
- }
- ///
- /// Set the current Windlight scene to a target avatar
- ///
- ///
- /// success: true or false
- public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
- {
- if (!m_CMFunctionsEnabled)
- {
- CMShoutError("LightShare functions are not enabled.");
- return 0;
- }
- if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
- {
- CMShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
- return 0;
- }
- int success = 0;
- m_host.AddScriptLPS(1);
- if (LightShareModule.EnableWindlight)
- {
- RegionLightShareData wl = getWindlightProfileFromRules(rules);
- World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
- success = 1;
- }
- else
- {
- CMShoutError("Windlight module is disabled");
- return 0;
- }
- return success;
- }
-
- }
-}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
new file mode 100644
index 0000000..fe71ed5
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -0,0 +1,504 @@
+/*
+ * 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.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 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 LS_Api : MarshalByRefObject, ILS_Api, IScriptApi
+ {
+ internal IScriptEngine m_ScriptEngine;
+ internal SceneObjectPart m_host;
+ internal uint m_localID;
+ internal UUID m_itemID;
+ internal bool m_LSFunctionsEnabled = false;
+ internal IScriptModuleComms m_comms = null;
+
+ public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
+ {
+ m_ScriptEngine = ScriptEngine;
+ m_host = host;
+ m_localID = localID;
+ m_itemID = itemID;
+
+ if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
+ m_LSFunctionsEnabled = true;
+
+ m_comms = m_ScriptEngine.World.RequestModuleInterface();
+ if (m_comms == null)
+ m_LSFunctionsEnabled = false;
+ }
+
+ 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; }
+ }
+
+ //
+ //Dumps an error message on the debug console.
+ //
+
+ internal void LSShoutError(string message)
+ {
+ if (message.Length > 1023)
+ message = message.Substring(0, 1023);
+
+ World.SimChat(Utils.StringToBytes(message),
+ ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true);
+
+ IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface();
+ wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
+ }
+
+ ///
+ /// Get the current Windlight scene
+ ///
+ /// List of windlight parameters
+ public LSL_List lsGetWindlightScene(LSL_List rules)
+ {
+ if (!m_LSFunctionsEnabled)
+ {
+ 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();
+ int idx = 0;
+ while (idx < rules.Length)
+ {
+ uint rule = (uint)rules.GetLSLIntegerItem(idx);
+ LSL_List toadd = new LSL_List();
+
+ switch (rule)
+ {
+ case (int)ScriptBaseClass.WL_AMBIENT:
+ toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W));
+ break;
+ case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
+ toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f));
+ break;
+ case (int)ScriptBaseClass.WL_BLUE_DENSITY:
+ toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W));
+ break;
+ case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
+ toadd.Add(new LSL_Float(wl.blurMultiplier));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COLOR:
+ toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
+ toadd.Add(new LSL_Float(wl.cloudCoverage));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
+ toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCALE:
+ toadd.Add(new LSL_Float(wl.cloudScale));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
+ toadd.Add(new LSL_Float(wl.cloudScrollX));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
+ toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
+ toadd.Add(new LSL_Float(wl.cloudScrollY));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
+ toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0));
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
+ toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z));
+ break;
+ case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
+ toadd.Add(new LSL_Float(wl.densityMultiplier));
+ break;
+ case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
+ toadd.Add(new LSL_Float(wl.distanceMultiplier));
+ break;
+ case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
+ toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0));
+ break;
+ case (int)ScriptBaseClass.WL_EAST_ANGLE:
+ toadd.Add(new LSL_Float(wl.eastAngle));
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
+ toadd.Add(new LSL_Float(wl.fresnelOffset));
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
+ toadd.Add(new LSL_Float(wl.fresnelScale));
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_DENSITY:
+ toadd.Add(new LSL_Float(wl.hazeDensity));
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_HORIZON:
+ toadd.Add(new LSL_Float(wl.hazeHorizon));
+ break;
+ case (int)ScriptBaseClass.WL_HORIZON:
+ toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W));
+ break;
+ case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
+ toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f));
+ break;
+ case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
+ toadd.Add(new LSL_Integer(wl.maxAltitude));
+ break;
+ case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
+ toadd.Add(new LSL_Key(wl.normalMapTexture.ToString()));
+ break;
+ case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
+ toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z));
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
+ toadd.Add(new LSL_Float(wl.refractScaleAbove));
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
+ toadd.Add(new LSL_Float(wl.refractScaleBelow));
+ break;
+ case (int)ScriptBaseClass.WL_SCENE_GAMMA:
+ toadd.Add(new LSL_Float(wl.sceneGamma));
+ break;
+ case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
+ toadd.Add(new LSL_Float(wl.starBrightness));
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
+ toadd.Add(new LSL_Float(wl.sunGlowFocus));
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
+ toadd.Add(new LSL_Float(wl.sunGlowSize));
+ break;
+ case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
+ toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W));
+ break;
+ case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
+ toadd.Add(new LSL_Float(wl.underwaterFogModifier));
+ break;
+ case (int)ScriptBaseClass.WL_WATER_COLOR:
+ toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z));
+ break;
+ case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
+ toadd.Add(new LSL_Float(wl.waterFogDensityExponent));
+ break;
+ }
+
+ if (toadd.Length > 0)
+ {
+ values.Add(rule);
+ values.Add(toadd.Data[0]);
+ }
+ idx++;
+ }
+
+
+ return values;
+
+ }
+
+ private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
+ {
+ RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
+
+ LSL_List values = new LSL_List();
+ int idx = 0;
+ while (idx < rules.Length)
+ {
+ uint rule = (uint)rules.GetLSLIntegerItem(idx);
+ LSL_Types.Quaternion iQ;
+ LSL_Types.Vector3 iV;
+ switch (rule)
+ {
+ case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
+ idx++;
+ wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_AMBIENT:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
+ break;
+ case (int)ScriptBaseClass.WL_BLUE_DENSITY:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
+ idx++;
+ wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COLOR:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
+ idx++;
+ wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCALE:
+ idx++;
+ wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
+ idx++;
+ wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
+ idx++;
+ wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
+ idx++;
+ wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
+ idx++;
+ wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
+ break;
+ case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
+ idx++;
+ wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
+ idx++;
+ wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
+ idx++;
+ wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
+ break;
+ case (int)ScriptBaseClass.WL_EAST_ANGLE:
+ idx++;
+ wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
+ idx++;
+ wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
+ idx++;
+ wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_DENSITY:
+ idx++;
+ wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_HAZE_HORIZON:
+ idx++;
+ wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_HORIZON:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
+ break;
+ case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
+ idx++;
+ wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
+ break;
+ case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
+ idx++;
+ wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
+ break;
+ case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
+ idx++;
+ wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
+ idx++;
+ wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SCENE_GAMMA:
+ idx++;
+ wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
+ idx++;
+ wl.starBrightness = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
+ idx++;
+ wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
+ idx++;
+ wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
+ idx++;
+ iQ = rules.GetQuaternionItem(idx);
+ wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
+ break;
+ case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
+ idx++;
+ wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
+ break;
+ case (int)ScriptBaseClass.WL_WATER_COLOR:
+ idx++;
+ iV = rules.GetVector3Item(idx);
+ wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
+ break;
+ case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
+ idx++;
+ wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
+ break;
+ }
+ idx++;
+ }
+ return wl;
+ }
+ ///
+ /// Set the current Windlight scene
+ ///
+ ///
+ /// success: true or false
+ public int lsSetWindlightScene(LSL_List rules)
+ {
+ if (!m_LSFunctionsEnabled)
+ {
+ LSShoutError("LightShare functions are not enabled.");
+ return 0;
+ }
+ if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+ {
+ LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
+ return 0;
+ }
+ int success = 0;
+ m_host.AddScriptLPS(1);
+ if (LightShareModule.EnableWindlight)
+ {
+ RegionLightShareData wl = getWindlightProfileFromRules(rules);
+ m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
+ success = 1;
+ }
+ else
+ {
+ LSShoutError("Windlight module is disabled");
+ return 0;
+ }
+ return success;
+ }
+ ///
+ /// Set the current Windlight scene to a target avatar
+ ///
+ ///
+ /// success: true or false
+ public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
+ {
+ if (!m_LSFunctionsEnabled)
+ {
+ LSShoutError("LightShare functions are not enabled.");
+ return 0;
+ }
+ if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
+ {
+ LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
+ return 0;
+ }
+ int success = 0;
+ m_host.AddScriptLPS(1);
+ if (LightShareModule.EnableWindlight)
+ {
+ RegionLightShareData wl = getWindlightProfileFromRules(rules);
+ World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
+ success = 1;
+ }
+ else
+ {
+ LSShoutError("Windlight module is disabled");
+ return 0;
+ }
+ return success;
+ }
+
+ }
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
deleted file mode 100644
index f47ae7d..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.Collections;
-using OpenSim.Region.ScriptEngine.Interfaces;
-
-using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
-using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
-using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
-using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
-using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
-using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
-using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
-
-namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
-{
- public interface ICM_Api
- {
- // Windlight Functions
- LSL_List lsGetWindlightScene(LSL_List rules);
- int lsSetWindlightScene(LSL_List rules);
- int lsSetWindlightSceneTargeted(LSL_List rules, key target);
- }
-}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs
new file mode 100644
index 0000000..9aa437b
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs
@@ -0,0 +1,48 @@
+/*
+ * 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.Collections;
+using OpenSim.Region.ScriptEngine.Interfaces;
+
+using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
+using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
+using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
+using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
+using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
+using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
+using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
+
+namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
+{
+ public interface ILS_Api
+ {
+ // Windlight Functions
+ LSL_List lsGetWindlightScene(LSL_List rules);
+ int lsSetWindlightScene(LSL_List rules);
+ int lsSetWindlightSceneTargeted(LSL_List rules, key target);
+ }
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
deleted file mode 100644
index 92c3d98..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.Runtime.Remoting.Lifetime;
-using System.Threading;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using OpenSim.Framework;
-using OpenSim.Region.Framework.Interfaces;
-using OpenSim.Region.ScriptEngine.Interfaces;
-using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
-using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
-using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
-using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
-using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
-using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
-using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
-using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
-using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
-
-namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
-{
- public partial class ScriptBaseClass : MarshalByRefObject
- {
- public ICM_Api m_CM_Functions;
-
- public void ApiTypeCM(IScriptApi api)
- {
- if (!(api is ICM_Api))
- return;
-
- m_CM_Functions = (ICM_Api)api;
- }
-
- public LSL_List lsGetWindlightScene(LSL_List rules)
- {
- return m_CM_Functions.lsGetWindlightScene(rules);
- }
-
- public int lsSetWindlightScene(LSL_List rules)
- {
- return m_CM_Functions.lsSetWindlightScene(rules);
- }
-
- public int lsSetWindlightSceneTargeted(LSL_List rules, key target)
- {
- return m_CM_Functions.lsSetWindlightSceneTargeted(rules, target);
- }
-
- public LSL_List cmGetWindlightScene(LSL_List rules)
- {
- return m_CM_Functions.lsGetWindlightScene(rules);
- }
-
- public int cmSetWindlightScene(LSL_List rules)
- {
- return m_CM_Functions.lsSetWindlightScene(rules);
- }
-
- public int cmSetWindlightSceneTargeted(LSL_List rules, key target)
- {
- return m_CM_Functions.lsSetWindlightSceneTargeted(rules, target);
- }
- }
-}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs
new file mode 100644
index 0000000..8280ca5
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs
@@ -0,0 +1,91 @@
+/*
+ * 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.Runtime.Remoting.Lifetime;
+using System.Threading;
+using System.Reflection;
+using System.Collections;
+using System.Collections.Generic;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.ScriptEngine.Interfaces;
+using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
+using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
+using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
+using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
+using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
+using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
+using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
+using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
+using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
+
+namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
+{
+ public partial class ScriptBaseClass : MarshalByRefObject
+ {
+ public ILS_Api m_LS_Functions;
+
+ public void ApiTypeLS(IScriptApi api)
+ {
+ if (!(api is ILS_Api))
+ return;
+
+ m_LS_Functions = (ILS_Api)api;
+ }
+
+ public LSL_List lsGetWindlightScene(LSL_List rules)
+ {
+ return m_LS_Functions.lsGetWindlightScene(rules);
+ }
+
+ public int lsSetWindlightScene(LSL_List rules)
+ {
+ return m_LS_Functions.lsSetWindlightScene(rules);
+ }
+
+ public int lsSetWindlightSceneTargeted(LSL_List rules, key target)
+ {
+ return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target);
+ }
+
+ public LSL_List cmGetWindlightScene(LSL_List rules)
+ {
+ return m_LS_Functions.lsGetWindlightScene(rules);
+ }
+
+ public int cmSetWindlightScene(LSL_List rules)
+ {
+ return m_LS_Functions.lsSetWindlightScene(rules);
+ }
+
+ public int cmSetWindlightSceneTargeted(LSL_List rules, key target)
+ {
+ return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target);
+ }
+ }
+}
--
cgit v1.1
From ef93ac44528f5e3294e1674e33f100b19dee61f0 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 11 Jun 2010 17:48:33 +0200
Subject: Remove the cm* function namespace
---
OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs | 15 ---------------
.../OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp | 2 +-
2 files changed, 1 insertion(+), 16 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs
index 8280ca5..f8dbe03 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs
@@ -72,20 +72,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target);
}
-
- public LSL_List cmGetWindlightScene(LSL_List rules)
- {
- return m_LS_Functions.lsGetWindlightScene(rules);
- }
-
- public int cmSetWindlightScene(LSL_List rules)
- {
- return m_LS_Functions.lsSetWindlightScene(rules);
- }
-
- public int cmSetWindlightSceneTargeted(LSL_List rules, key target)
- {
- return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target);
- }
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
index 23138ef..f02d2d9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
@@ -18,10 +18,10 @@
-
+
--
cgit v1.1
From be71a2e5bc321d82b373cd070681b5a6ffddc492 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 11 Jun 2010 17:52:19 +0200
Subject: Revert "Remove the cm* function namespace"
This reverts commit ef93ac44528f5e3294e1674e33f100b19dee61f0.
---
OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs | 15 +++++++++++++++
.../OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs
index f8dbe03..8280ca5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs
@@ -72,5 +72,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target);
}
+
+ public LSL_List cmGetWindlightScene(LSL_List rules)
+ {
+ return m_LS_Functions.lsGetWindlightScene(rules);
+ }
+
+ public int cmSetWindlightScene(LSL_List rules)
+ {
+ return m_LS_Functions.lsSetWindlightScene(rules);
+ }
+
+ public int cmSetWindlightSceneTargeted(LSL_List rules, key target)
+ {
+ return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target);
+ }
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
index f02d2d9..23138ef 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
@@ -18,10 +18,10 @@
+
-
--
cgit v1.1
From e337c9130f8e25f81d9d9c9d98da8dee89f38aeb Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sat, 12 Jun 2010 07:34:22 +0200
Subject: Make local teleports send CHANGED_TELEPORT
---
.../Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
index 23138ef..f02d2d9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
@@ -18,10 +18,10 @@
-
+
--
cgit v1.1
From 704da8c8238835c63e8ca560fc7778603e9f6795 Mon Sep 17 00:00:00 2001
From: Tom Grimshaw
Date: Mon, 14 Jun 2010 04:03:54 -0700
Subject: osGetAvatarList: Use AbsolutePosition instead of the position of the
physics actor, or the avatar disappears when they sit down.
---
.../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 0e86c86..db43902 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2222,12 +2222,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (avatar.IsChildAgent == false)
{
- if (avatar.PhysicsActor != null && avatar.PhysicsActor.Position != null)
- {
- result.Add(avatar.UUID);
- result.Add(avatar.PhysicsActor.Position);
- result.Add(avatar.Name);
- }
+ result.Add(avatar.UUID);
+ result.Add(avatar.AbsolutePosition);
+ result.Add(avatar.Name);
}
}
});
--
cgit v1.1
From 117fd629d68ef8ab373b70fd5e9e6a643e8eaa65 Mon Sep 17 00:00:00 2001
From: Tom Grimshaw
Date: Wed, 16 Jun 2010 08:32:47 -0700
Subject: Allow llMapDestination to be used in any event if the host is an
attachment. This fixes Mantis 0000098.
---
.../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 9f3e354..c332fd8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9470,8 +9470,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, 0);
- if (detectedParams == null) return; // only works on the first detected avatar
-
+ if (detectedParams == null)
+ {
+ if (m_host.IsAttachment == true)
+ {
+ detectedParams = new DetectParams();
+ detectedParams.Key = m_host.OwnerID;
+ }
+ else
+ {
+ return;
+ }
+ }
+
ScenePresence avatar = World.GetScenePresence(detectedParams.Key);
if (avatar != null)
{
@@ -9479,6 +9490,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
new Vector3((float)pos.x, (float)pos.y, (float)pos.z),
new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z));
}
+
ScriptSleep(1000);
}
--
cgit v1.1
From b9c40320f108a84d7841cdc9e98009cf650f930e Mon Sep 17 00:00:00 2001
From: Tom Grimshaw
Date: Wed, 16 Jun 2010 09:20:20 -0700
Subject: Fix llAttachToAvatar. This addresses mantis 128 .
---
.../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c332fd8..877c3cb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3065,9 +3065,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- if (m_host.ParentGroup.RootPart.AttachmentPoint == 0)
- return;
-
TaskInventoryItem item;
m_host.TaskInventory.LockItemsForRead(true);
@@ -3093,11 +3090,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
+ /*
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
if (attachmentsModule != null)
+ {
attachmentsModule.AttachObject(
- presence.ControllingClient, grp.LocalId,
+ presence.ControllingClient, grp.LocalId,
(uint)attachment, Quaternion.Identity, Vector3.Zero, false);
+ }
+ */
+ grp.AttachToAgent(m_host.OwnerID, (uint)attachment, Vector3.Zero, false);
}
}
--
cgit v1.1
From d1c8b083b8d44417d67fb401646eaa7215ff0851 Mon Sep 17 00:00:00 2001
From: Tom Grimshaw
Date: Thu, 17 Jun 2010 04:15:07 -0700
Subject: Fix llRot2Euler with a mathematically sound implementation. The only
difference between this an SL is that SL resolves a figure of negative PI
into PI, and does the equivalent in the reverse (llEuler2Rot, -1.0 becomes
1.0);
---
.../Shared/Api/Implementation/LSL_Api.cs | 46 +++++++++++++---------
1 file changed, 27 insertions(+), 19 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 877c3cb..fe8c70e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -502,25 +502,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return remainder;
}
- // Old implementation of llRot2Euler, now normalized
-
- public LSL_Vector llRot2Euler(LSL_Rotation r)
- {
- m_host.AddScriptLPS(1);
- //This implementation is from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions. ckrinke
- LSL_Rotation t = new LSL_Rotation(r.x * r.x, r.y * r.y, r.z * r.z, r.s * r.s);
- double m = (t.x + t.y + t.z + t.s);
- if (m == 0) return new LSL_Vector();
- double n = 2 * (r.y * r.s + r.x * r.z);
- double p = m * m - n * n;
- if (p > 0)
- return new LSL_Vector(NormalizeAngle(Math.Atan2(2.0 * (r.x * r.s - r.y * r.z), (-t.x - t.y + t.z + t.s))),
- NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))),
- NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s))));
- else if (n > 0)
- return new LSL_Vector(0.0, Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
- else
- return new LSL_Vector(0.0, -Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
+ public LSL_Vector llRot2Euler(LSL_Rotation q1)
+ {
+ m_host.AddScriptLPS(1);
+ LSL_Vector eul = new LSL_Vector();
+
+ 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:
--
cgit v1.1
From 49d7d8534ccd037f4690c5ac6aecd66a460960df Mon Sep 17 00:00:00 2001
From: Tom Grimshaw
Date: Sat, 19 Jun 2010 10:06:09 -0700
Subject: Allow moving an avatar as part of a linkset using
llSetLinkPrimitiveParams. This unlocks an awful lot of poseball-free content,
and is a step towards resolving mantis #59.
---
.../Shared/Api/Implementation/LSL_Api.cs | 97 ++++++++++++++++++++++
1 file changed, 97 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index fe8c70e..61c5add 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -219,6 +219,57 @@ 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();
+
+ 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;
+ }
+ }
+ }
+ }
+
public List GetLinkParts(int linkType)
{
List ret = new List();
@@ -7152,6 +7203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
List parts = GetLinkParts(linknumber);
+ List avatars = GetLinkAvatars(linknumber);
if (parts.Count>0)
{
try
@@ -7165,6 +7217,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
parts[0].ParentGroup.areUpdatesSuspended = false;
}
}
+ if (avatars.Count > 0)
+ {
+ foreach (ScenePresence avatar in avatars)
+ SetPrimParams(avatar, rules);
+ }
}
public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
@@ -7172,6 +7229,46 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
llSetLinkPrimitiveParams(linknumber, rules);
}
+ protected void SetPrimParams(ScenePresence av, LSL_List rules)
+ {
+ //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset.
+ //We only support PRIM_POSITION and PRIM_ROTATION
+
+ int idx = 0;
+
+ while (idx < rules.Length)
+ {
+ int code = rules.GetLSLIntegerItem(idx++);
+
+ int remain = rules.Length - idx;
+
+
+
+ switch (code)
+ {
+ case (int)ScriptBaseClass.PRIM_POSITION:
+ if (remain < 1)
+ return;
+ LSL_Vector v;
+ v = rules.GetVector3Item(idx++);
+ av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
+ av.SendFullUpdateToAllClients();
+
+ break;
+
+ case (int)ScriptBaseClass.PRIM_ROTATION:
+ if (remain < 1)
+ return;
+ LSL_Rotation r;
+ r = rules.GetQuaternionItem(idx++);
+ av.OffsetRotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
+ av.SendFullUpdateToAllClients();
+ break;
+ }
+ }
+
+ }
+
protected void SetPrimParams(SceneObjectPart part, LSL_List rules)
{
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
--
cgit v1.1
From 76b59b8df776121708b7ff93312c25c341b19ea6 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sun, 20 Jun 2010 06:23:08 +0200
Subject: Make dataserver() return a 0 when agent id offline, instead of a
timeout
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 61c5add..5c6d382 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4232,22 +4232,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID uuid = (UUID)id;
UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
+ if (account == null)
+ return UUID.Zero.ToString();
+
PresenceInfo pinfo = null;
PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
if (pinfos != null && pinfos.Length > 0)
pinfo = pinfos[0];
- if (pinfo == null)
- return UUID.Zero.ToString();
-
string reply = String.Empty;
switch (data)
{
case 1: // DATA_ONLINE (0|1)
- // TODO: implement fetching of this information
- if (pinfo != null)
+ if (pinfo != null && pinfo.RegionID != UUID.Zero)
reply = "1";
else
reply = "0";
--
cgit v1.1
From 797767da57be98da24bd91b61eb5b35fc242bb3c Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sun, 20 Jun 2010 07:16:19 +0200
Subject: Insert a space after the comma on the ToString methos of lsl vectors
and rotations to match SL.
---
OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 1ea52c5..212dbe3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -83,19 +83,19 @@ namespace OpenSim.Region.ScriptEngine.Shared
public override string ToString()
{
- string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", x, y, z);
+ string s=String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", x, y, z);
return s;
}
public static explicit operator LSLString(Vector3 vec)
{
- string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z);
+ string s=String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z);
return new LSLString(s);
}
public static explicit operator string(Vector3 vec)
{
- string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z);
+ string s=String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z);
return s;
}
@@ -337,19 +337,19 @@ namespace OpenSim.Region.ScriptEngine.Shared
public override string ToString()
{
- string st=String.Format(Culture.FormatProvider, "<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", x, y, z, s);
+ string st=String.Format(Culture.FormatProvider, "<{0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000}>", x, y, z, s);
return st;
}
public static explicit operator string(Quaternion r)
{
- string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s);
+ string s=String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000}>", r.x, r.y, r.z, r.s);
return s;
}
public static explicit operator LSLString(Quaternion r)
{
- string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s);
+ string s=String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000}>", r.x, r.y, r.z, r.s);
return new LSLString(s);
}
--
cgit v1.1
From cbca58401ab67035c8c9aa20a0cf4bccd8cc8bef Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Thu, 24 Jun 2010 20:46:24 +0200
Subject: Add the object owner UUID into the binary bucket of object to user IM
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7d7320d..0abc828 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3272,7 +3272,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
msg.ParentEstateID = 0; //ParentEstateID;
msg.Position = Vector3.Zero;// new Vector3(m_host.AbsolutePosition);
msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid;
- msg.binaryBucket = new byte[0];// binaryBucket;
+ msg.binaryBucket = Util.StringToBytes256(m_host.OwnerID.ToString());
if (m_TransferModule != null)
{
--
cgit v1.1
From f186882c0fbe9675a000417e27354e323315de1a Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Thu, 24 Jun 2010 20:51:04 +0200
Subject: Also make prims send the proper position. I hate it when people
comment out things just because they're "not yet used". Grrrr.
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0abc828..fb191e6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3266,12 +3266,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
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.Position = Vector3.Zero;// new Vector3(m_host.AbsolutePosition);
- msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid;
+ msg.ParentEstateID = World.RegionInfo.EstateSettings.EstateID;
+ msg.Position = new Vector3(m_host.AbsolutePosition);
+ msg.RegionID = World.RegionInfo.RegionID.Guid;
msg.binaryBucket = Util.StringToBytes256(m_host.OwnerID.ToString());
if (m_TransferModule != null)
--
cgit v1.1
From 9f00f141fe679b13e93240589f7d8b7f519e012b Mon Sep 17 00:00:00 2001
From: Tom Grimshaw
Date: Sat, 26 Jun 2010 18:54:55 -0700
Subject: Restore "AllowCareminsterFunctions" as an alias to the new
"AllowLightshareFunctions".
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | 3 +++
1 file changed, 3 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index fe71ed5..1fa8c30 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -73,6 +73,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
m_LSFunctionsEnabled = true;
+ if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false))
+ m_LSFunctionsEnabled = true;
+
m_comms = m_ScriptEngine.World.RequestModuleInterface();
if (m_comms == null)
m_LSFunctionsEnabled = false;
--
cgit v1.1
From 3940a4dbc7ffb4eab319ea9c2f1f787ddeee65e8 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Thu, 1 Jul 2010 16:11:10 +0200
Subject: Avoid a spurious error message when taking a friend's no copy item
---
.../Shared/Api/Implementation/LSL_Api.cs | 40 ++++++++++++++++------
1 file changed, 30 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index fb191e6..d49bbb2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9829,19 +9829,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llXorBase64StringsCorrect(string str1, string str2)
{
m_host.AddScriptLPS(1);
- string ret = String.Empty;
- string src1 = llBase64ToString(str1);
- string src2 = llBase64ToString(str2);
- int c = 0;
- for (int i = 0; i < src1.Length; i++)
+
+ if (str1 == String.Empty)
+ return String.Empty;
+ if (str2 == String.Empty)
+ return str1;
+
+ byte[] data1 = Convert.FromBase64String(str1);
+ byte[] data2 = Convert.FromBase64String(str2);
+
+ byte[] d2 = new Byte[data1.Length];
+ int pos = 0;
+
+ if (data1.Length <= data2.Length)
{
- ret += (char) (src1[i] ^ src2[c]);
+ Array.Copy(data2, 0, d2, 0, data1.Length);
+ }
+ else
+ {
+ while (pos < data1.Length)
+ {
+ int len = data1.Length - pos;
+ if (len > data2.Length)
+ len = data2.Length;
- c++;
- if (c >= src2.Length)
- c = 0;
+ Array.Copy(data2, 0, d2, pos, len);
+ pos += len;
+ }
}
- return llStringToBase64(ret);
+
+ for (pos = 0 ; pos < data1.Length ; pos++ )
+ data1[pos] ^= d2[pos];
+
+ return Convert.ToBase64String(data1);
}
public LSL_String llHTTPRequest(string url, LSL_List parameters, string body)
--
cgit v1.1
From 3d5d44279b99e58cb4f2db3532df522ad3b5cccf Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Thu, 1 Jul 2010 17:06:29 +0200
Subject: ANother stab at LSL compatibility
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d49bbb2..e226682 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9394,7 +9394,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (aList.Data[i] != null)
{
- switch ((ParcelMediaCommandEnum) aList.Data[i])
+ switch ((ParcelMediaCommandEnum) Convert.ToInt32(aList.Data[i].ToString()))
{
case ParcelMediaCommandEnum.Url:
list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaURL));
--
cgit v1.1
From 60c15d7c283a7ded6d7e7b6c40b77b2a6b7218f2 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 2 Jul 2010 03:05:40 +0200
Subject: Fix a dumb little sign error that makes a LSL wiki example fail
---
OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 212dbe3..5927973 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -663,13 +663,13 @@ namespace OpenSim.Region.ScriptEngine.Shared
Object[] ret;
if (start < 0)
- start=m_data.Length-start;
+ start=m_data.Length+start;
if (start < 0)
start=0;
if (end < 0)
- end=m_data.Length-end;
+ end=m_data.Length+end;
if (end < 0)
end=0;
--
cgit v1.1
From a7c4cb95aade11c302c9d1113f720467233b8600 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 2 Jul 2010 04:26:55 +0200
Subject: Fox another scripting nasty. Stuff no system.string objects into
lists
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index e226682..11d7c2b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5247,7 +5247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ',':
if (parens == 0)
{
- result.Add(src.Substring(start,length).Trim());
+ result.Add(new LSL_String(src.Substring(start,length).Trim()));
start += length+1;
length = 0;
}
--
cgit v1.1
From edcfaf60c99b7cde324621c2ffcfbb16e4eb4c5e Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sat, 3 Jul 2010 20:27:00 +0200
Subject: Fix IMs the right way. This sets it up so that timestamps are
actually in PST (to match viewer time), does correct storage and retrieval of
IMs, corrects the session ID and makes sure IMs don't get marked "saved" if
they're live. Removes the group IM save option, which our group IM module
never had in the first place, as saving group chatter makes no sense at all.
---
.../Shared/Api/Implementation/LSL_Api.cs | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 11d7c2b..f153504 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3252,7 +3252,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
msg.imSessionID = new Guid(friendTransactionID.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;
+ DateTime dt = DateTime.UtcNow;
+
+ // Ticks from UtcNow, but make it look like local. Evil, huh?
+ dt = DateTime.SpecifyKind(dt, DateTimeKind.Local);
+
+ try
+ {
+ // Convert that to the PST timezone
+ TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles");
+ dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo);
+ }
+ catch
+ {
+ // No logging here, as it could be VERY spammy
+ }
+
+ // And make it look local again to fool the unix time util
+ dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc);
+
+ msg.timestamp = (uint)Util.ToUnixTime(dt);
+
//if (client != null)
//{
msg.fromAgentName = m_host.Name;//client.FirstName + " " + client.LastName;// fromAgentName;
--
cgit v1.1
From 90c5555d6d542a0c8605759c0036af1c83601ddf Mon Sep 17 00:00:00 2001
From: Mike Rieker
Date: Tue, 6 Jul 2010 02:22:47 +0000
Subject: rewrote hanging llParseStringKeepNulls()
---
.../Shared/Api/Implementation/LSL_Api.cs | 315 ++++++++++-----------
1 file changed, 145 insertions(+), 170 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index fb191e6..1459778 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -562,23 +562,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
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;
- }
+ 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);
+ 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;
}
@@ -804,53 +804,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// 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)
- {
- return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
- }
-
- // 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)
- {
- 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);
- }
- }
-
+ 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)
+ {
+ return new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
+ }
+
+ // 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)
+ {
+ 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);
+ }
+ }
+
public void llWhisper(int channelID, string text)
{
m_host.AddScriptLPS(1);
@@ -8627,130 +8627,105 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers)
{
- int beginning = 0;
- int srclen = src.Length;
- int seplen = separators.Length;
- object[] separray = separators.Data;
- int spclen = spacers.Length;
- object[] spcarray = spacers.Data;
- int mlen = seplen+spclen;
+ int srclen = src.Length;
+ int seplen = separators.Length;
+ object[] separray = separators.Data;
+ int spclen = spacers.Length;
+ object[] spcarray = spacers.Data;
- int[] offset = new int[mlen+1];
- bool[] active = new bool[mlen];
+ int outlen = 0;
+ LSL_String[] outarray = new LSL_String[srclen*2+1];
- int best;
- int j;
-
- // Initial capacity reduces resize cost
-
- LSL_List tokens = new LSL_List();
+ int i, j, lastUsed;
m_host.AddScriptLPS(1);
- // All entries are initially valid
-
- for (int i = 0; i < mlen; i++)
- active[i] = true;
-
- offset[mlen] = srclen;
-
- while (beginning < srclen)
- {
-
- best = mlen; // as bad as it gets
+ /*
+ * Point to beginning of current non-delimeter string.
+ */
+ lastUsed = 0;
- // Scan for separators
+ /*
+ * Scan through source string from beginning to end.
+ */
+ for (i = 0; i < srclen;) {
- for (j = 0; j < seplen; j++)
- {
- if (active[j])
- {
- // scan all of the markers
- if ((offset[j] = src.IndexOf(separray[j].ToString(), beginning)) == -1)
- {
- // not present at all
- active[j] = false;
- }
- else
- {
- // present and correct
- if (offset[j] < offset[best])
- {
- // closest so far
- best = j;
- if (offset[best] == beginning)
- break;
- }
- }
+ /*
+ * See if rest of string (starting at i) matches any separator.
+ */
+ string rest = src.Substring(i);
+ for (j = 0; j < seplen; j ++) {
+ string sep = separray[j].ToString();
+ if ((sep.Length > 0) && rest.StartsWith(sep)) {
+
+ /*
+ * Separator matched, output string from end of last delimeter to beginning of this one.
+ */
+ outarray[outlen++] = new LSL_String(src.Substring(lastUsed,i-lastUsed));
+
+ /*
+ * Remove separator from input string.
+ */
+ i += sep.Length;
+
+ /*
+ * Next non-delimeter starts where this separator left off.
+ */
+ lastUsed = i;
+ goto nextsrc;
}
}
- // Scan for spacers
-
- if (offset[best] != beginning)
- {
- for (j = seplen; (j < mlen) && (offset[best] > beginning); j++)
- {
- if (active[j])
- {
- // scan all of the markers
- if ((offset[j] = src.IndexOf(spcarray[j-seplen].ToString(), beginning)) == -1)
- {
- // not present at all
- active[j] = false;
- }
- else
- {
- // present and correct
- if (offset[j] < offset[best])
- {
- // closest so far
- best = j;
- }
- }
- }
+ /*
+ * See if rest of string (starting at i) matches any spacer.
+ */
+ for (j = 0; j < spclen; j ++) {
+ string spc = spcarray[j].ToString();
+ if ((spc.Length > 0) && rest.StartsWith(spc)) {
+
+ /*
+ * Spacer matched, output string from end of last delimeter to beginning of this one.
+ * Then output the spacer itself.
+ */
+ outarray[outlen++] = new LSL_String(src.Substring(lastUsed,i-lastUsed));
+ outarray[outlen++] = new LSL_String(spc);
+
+ /*
+ * Remove spacer from input string.
+ */
+ i += spc.Length;
+
+ /*
+ * Next non-delimeter starts where this spacer left off.
+ */
+ lastUsed = i;
+ goto nextsrc;
}
}
- // This is the normal exit from the scanning loop
-
- if (best == mlen)
- {
- // no markers were found on this pass
- // so we're pretty much done
- tokens.Add(new LSL_String(src.Substring(beginning, srclen - beginning)));
- break;
- }
-
- // Otherwise we just add the newly delimited token
- // and recalculate where the search should continue.
-
- tokens.Add(new LSL_String(src.Substring(beginning,offset[best]-beginning)));
-
- if (best < seplen)
- {
- beginning = offset[best] + (separray[best].ToString()).Length;
- }
- else
- {
- beginning = offset[best] + (spcarray[best - seplen].ToString()).Length;
- tokens.Add(new LSL_String(spcarray[best - seplen].ToString()));
- }
+ /*
+ * Didn't match any separator or spacer, skip over it and it
+ * becomes part of the non-delimeter string starting with
+ * lastUsed.
+ */
+ i ++;
+ nextsrc:;
}
- // This an awkward an not very intuitive boundary case. If the
- // last substring is a tokenizer, then there is an implied trailing
- // null list entry. Hopefully the single comparison will not be too
- // arduous. Alternatively the 'break' could be replced with a return
- // but that's shabby programming.
+ /*
+ * Output last non-delimeter (including a possible null string if
+ * delimeter ran to end of source string).
+ */
+ outarray[outlen++] = new LSL_String(src.Substring(lastUsed));
- if (beginning == srclen)
- {
- if (srclen != 0)
- tokens.Add(new LSL_String(""));
+ /*
+ * Make up an exact-sized output array suitable for an LSL_List object.
+ */
+ object[] outlist = new object[outlen];
+ for (i = 0; i < outlen; i ++) {
+ outlist[i] = outarray[i];
}
-
- return tokens;
+ return new LSL_List(outlist);
}
public LSL_Integer llGetObjectPermMask(int mask)
--
cgit v1.1
From faaef1b498a09d9f12a77c46391f2379af8ec7ac Mon Sep 17 00:00:00 2001
From: Mike Rieker
Date: Tue, 6 Jul 2010 23:59:06 +0000
Subject: minimizes temp garbage for llParseStringKeepNulls() and uses common
routine for llParseStringKeepNulls()/llParseString2List()
---
.../Shared/Api/Implementation/LSL_Api.cs | 201 +++++++--------------
1 file changed, 67 insertions(+), 134 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b9b3318..b335ae6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5877,74 +5877,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_List llParseString2List(string str, LSL_List separators, LSL_List in_spacers)
{
- m_host.AddScriptLPS(1);
- LSL_List ret = new LSL_List();
- LSL_List spacers = new LSL_List();
- if (in_spacers.Length > 0 && separators.Length > 0)
- {
- for (int i = 0; i < in_spacers.Length; i++)
- {
- object s = in_spacers.Data[i];
- for (int j = 0; j < separators.Length; j++)
- {
- if (separators.Data[j].ToString() == s.ToString())
- {
- s = null;
- break;
- }
- }
- if (s != null)
- {
- spacers.Add(s);
- }
- }
- }
- object[] delimiters = new object[separators.Length + spacers.Length];
- separators.Data.CopyTo(delimiters, 0);
- spacers.Data.CopyTo(delimiters, separators.Length);
- bool dfound = false;
- do
- {
- dfound = false;
- int cindex = -1;
- string cdeli = "";
- for (int i = 0; i < delimiters.Length; i++)
- {
- int index = str.IndexOf(delimiters[i].ToString());
- bool found = index != -1;
- if (found && String.Empty != delimiters[i].ToString())
- {
- if ((cindex > index) || (cindex == -1))
- {
- cindex = index;
- cdeli = delimiters[i].ToString();
- }
- dfound = dfound || found;
- }
- }
- if (cindex != -1)
- {
- if (cindex > 0)
- {
- ret.Add(new LSL_String(str.Substring(0, cindex)));
- }
- // Cannot use spacers.Contains() because spacers may be either type String or LSLString
- for (int j = 0; j < spacers.Length; j++)
- {
- if (spacers.Data[j].ToString() == cdeli)
- {
- ret.Add(new LSL_String(cdeli));
- break;
- }
- }
- str = str.Substring(cindex + cdeli.Length);
- }
- } while (dfound);
- if (str != "")
- {
- ret.Add(new LSL_String(str));
- }
- return ret;
+ return ParseString2List(str, separators, in_spacers, false);
}
public LSL_Integer llOverMyLand(string id)
@@ -8616,8 +8549,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// The function returns an ordered list
// representing the tokens found in the supplied
// sources string. If two successive tokenizers
- // are encountered, then a NULL entry is added
- // to the list.
+ // are encountered, then a null-string entry is
+ // added to the list.
//
// It is a precondition that the source and
// toekizer lisst are non-null. If they are null,
@@ -8625,7 +8558,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// while their lengths are being determined.
//
// A small amount of working memoryis required
- // of approximately 8*#tokenizers.
+ // of approximately 8*#tokenizers + 8*srcstrlen.
//
// There are many ways in which this function
// can be implemented, this implementation is
@@ -8641,109 +8574,109 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// and eliminates redundant tokenizers as soon
// as is possible.
//
- // The implementation tries to avoid any copying
- // of arrays or other objects.
+ // The implementation tries to minimize temporary
+ // garbage generation.
//
public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers)
{
+ return ParseString2List(src, separators, spacers, true);
+ }
+
+ private LSL_List ParseString2List(string src, LSL_List separators, LSL_List spacers, bool keepNulls)
+ {
int srclen = src.Length;
int seplen = separators.Length;
object[] separray = separators.Data;
int spclen = spacers.Length;
object[] spcarray = spacers.Data;
+ int dellen = 0;
+ string[] delarray = new string[seplen+spclen];
int outlen = 0;
- LSL_String[] outarray = new LSL_String[srclen*2+1];
+ string[] outarray = new string[srclen*2+1];
- int i, j, lastUsed;
+ int i, j;
+ string d;
m_host.AddScriptLPS(1);
/*
- * Point to beginning of current non-delimeter string.
+ * Convert separator and spacer lists to C# strings.
+ * Also filter out null strings so we don't hang.
*/
- lastUsed = 0;
+ for (i = 0; i < seplen; i ++) {
+ d = separray[i].ToString();
+ if (d.Length > 0) {
+ delarray[dellen++] = d;
+ }
+ }
+ seplen = dellen;
+
+ for (i = 0; i < spclen; i ++) {
+ d = spcarray[i].ToString();
+ if (d.Length > 0) {
+ delarray[dellen++] = d;
+ }
+ }
/*
* Scan through source string from beginning to end.
*/
- for (i = 0; i < srclen;) {
+ for (i = 0;;) {
/*
- * See if rest of string (starting at i) matches any separator.
+ * Find earliest delimeter in src starting at i (if any).
*/
- string rest = src.Substring(i);
- for (j = 0; j < seplen; j ++) {
- string sep = separray[j].ToString();
- if ((sep.Length > 0) && rest.StartsWith(sep)) {
-
- /*
- * Separator matched, output string from end of last delimeter to beginning of this one.
- */
- outarray[outlen++] = new LSL_String(src.Substring(lastUsed,i-lastUsed));
-
- /*
- * Remove separator from input string.
- */
- i += sep.Length;
-
- /*
- * Next non-delimeter starts where this separator left off.
- */
- lastUsed = i;
- goto nextsrc;
+ int earliestDel = -1;
+ int earliestSrc = srclen;
+ string earliestStr = null;
+ for (j = 0; j < dellen; j ++) {
+ d = delarray[j];
+ if (d != null) {
+ int index = src.IndexOf(d, i);
+ if (index < 0) {
+ delarray[j] = null; // delim nowhere in src, don't check it anymore
+ } else if (index < earliestSrc) {
+ earliestSrc = index; // where delimeter starts in source string
+ earliestDel = j; // where delimeter is in delarray[]
+ earliestStr = d; // the delimeter string from delarray[]
+ if (index == i) break; // can't do any better than found at beg of string
+ }
}
}
/*
- * See if rest of string (starting at i) matches any spacer.
+ * Output source string starting at i through start of earliest delimeter.
*/
- for (j = 0; j < spclen; j ++) {
- string spc = spcarray[j].ToString();
- if ((spc.Length > 0) && rest.StartsWith(spc)) {
-
- /*
- * Spacer matched, output string from end of last delimeter to beginning of this one.
- * Then output the spacer itself.
- */
- outarray[outlen++] = new LSL_String(src.Substring(lastUsed,i-lastUsed));
- outarray[outlen++] = new LSL_String(spc);
-
- /*
- * Remove spacer from input string.
- */
- i += spc.Length;
-
- /*
- * Next non-delimeter starts where this spacer left off.
- */
- lastUsed = i;
- goto nextsrc;
- }
+ if (keepNulls || (earliestSrc > i)) {
+ outarray[outlen++] = src.Substring(i, earliestSrc - i);
}
/*
- * Didn't match any separator or spacer, skip over it and it
- * becomes part of the non-delimeter string starting with
- * lastUsed.
+ * If no delimeter found at or after i, we're done scanning.
*/
- i ++;
- nextsrc:;
- }
+ if (earliestDel < 0) break;
- /*
- * Output last non-delimeter (including a possible null string if
- * delimeter ran to end of source string).
- */
- outarray[outlen++] = new LSL_String(src.Substring(lastUsed));
+ /*
+ * If delimeter was a spacer, output the spacer.
+ */
+ if (earliestDel >= seplen) {
+ outarray[outlen++] = earliestStr;
+ }
+
+ /*
+ * Look at rest of src string following delimeter.
+ */
+ i = earliestSrc + earliestStr.Length;
+ }
/*
* Make up an exact-sized output array suitable for an LSL_List object.
*/
object[] outlist = new object[outlen];
for (i = 0; i < outlen; i ++) {
- outlist[i] = outarray[i];
+ outlist[i] = new LSL_String(outarray[i]);
}
return new LSL_List(outlist);
}
--
cgit v1.1
From 8c26c8bbc6d4ee34b5b9255d3807fb4def88367f Mon Sep 17 00:00:00 2001
From: sacha
Date: Tue, 13 Jul 2010 21:10:26 +0000
Subject: adding the 'wearble' case for llGetLocalPos. Still not working cause
the offsets are not updated (always <0,0,0>)
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 5492266..27034ed 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi
{
- //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected IScriptEngine m_ScriptEngine;
protected SceneObjectPart m_host;
protected uint m_localID;
@@ -2136,6 +2136,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetLocalPos()
{
m_host.AddScriptLPS(1);
+ if (m_host.IsAttachment == true) {
+//m_log.DebugFormat("[localpos]: {0}) {1} {2}",m_host.OffsetPosition.X,m_host.OffsetPosition.Y,m_host.OffsetPosition.Z);
+ return new LSL_Vector(m_host.OffsetPosition.X,
+ m_host.OffsetPosition.Y,
+ m_host.OffsetPosition.Z);
+ }
+
if (m_host.ParentID != 0)
{
return new LSL_Vector(m_host.OffsetPosition.X,
--
cgit v1.1
From 7270cd0ade15ac7175e8394e085e48955ccb280c Mon Sep 17 00:00:00 2001
From: Tom Grimshaw
Date: Tue, 13 Jul 2010 14:57:50 -0700
Subject: Second part of the fix for llGetLocalPos; get attachment offset in
the root prim of an attachment. This function now behaves in line with SL.
---
.../Shared/Api/Implementation/LSL_Api.cs | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 27034ed..976a9ff 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2136,12 +2136,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetLocalPos()
{
m_host.AddScriptLPS(1);
- if (m_host.IsAttachment == true) {
-//m_log.DebugFormat("[localpos]: {0}) {1} {2}",m_host.OffsetPosition.X,m_host.OffsetPosition.Y,m_host.OffsetPosition.Z);
- return new LSL_Vector(m_host.OffsetPosition.X,
- m_host.OffsetPosition.Y,
- m_host.OffsetPosition.Z);
- }
+ if (m_host.IsAttachment == true) {
+ if (m_host.IsRoot == true)
+ {
+ return new LSL_Vector(m_host.AbsolutePosition.X,
+ m_host.AbsolutePosition.Y,
+ m_host.AbsolutePosition.Z);
+
+ }
+ else
+ {
+ return new LSL_Vector(m_host.OffsetPosition.X,
+ m_host.OffsetPosition.Y,
+ m_host.OffsetPosition.Z);
+ }
+ }
if (m_host.ParentID != 0)
{
--
cgit v1.1
From bebbe407ee166a0aa22f0ec8d14ada780924f9af Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Wed, 14 Jul 2010 19:58:23 +0200
Subject: Major attachments cleanup. Remove unused AttachObject ClientView
method Clean up use of AttachObject throughout, reduce number of overloads
and number of parameters
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 ---------
1 file changed, 9 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 976a9ff..defe633 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3160,15 +3160,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
- /*
- IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
- if (attachmentsModule != null)
- {
- attachmentsModule.AttachObject(
- presence.ControllingClient, grp.LocalId,
- (uint)attachment, Quaternion.Identity, Vector3.Zero, false);
- }
- */
grp.AttachToAgent(m_host.OwnerID, (uint)attachment, Vector3.Zero, false);
}
}
--
cgit v1.1
From 9bf6179d24cc7fd63643627914272adc78385f1e Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sat, 17 Jul 2010 02:26:09 +0200
Subject: Fix scripted give of items
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index defe633..b196642 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4177,7 +4177,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
byte[] bucket = new byte[17];
bucket[0] = (byte)assetType;
- byte[] objBytes = objId.GetBytes();
+ byte[] objBytes = agentItem.ID.GetBytes();
Array.Copy(objBytes, 0, bucket, 1, 16);
Console.WriteLine("Giving inventory");
--
cgit v1.1
From d52fb4d2e944db4a31ddafaefcdda3690f1c6bb7 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sat, 17 Jul 2010 16:35:14 +0200
Subject: Shorten LLEmail delay to 15s. With the external spam protection, we
can afford to do that
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b196642..a947b3d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3314,7 +3314,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
emailModule.SendEmail(m_host.UUID, address, subject, message);
- ScriptSleep(20000);
+ ScriptSleep(15000);
}
public void llGetNextEmail(string address, string subject)
--
cgit v1.1
From c263fc54ac04ab494a62b6157623d936d966940c Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sun, 18 Jul 2010 21:05:50 +0200
Subject: Add a state change method to the Async commands handler to allow
timers and http requests to survive state changes
---
.../Shared/Api/Implementation/AsyncCommandManager.cs | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index ee32755..61e4934 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -248,6 +248,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
+ public static void StateChange(IScriptEngine engine, uint localID, UUID itemID)
+ {
+ // Remove a specific script
+
+ // Remove dataserver events
+ m_Dataserver[engine].RemoveEvents(localID, itemID);
+
+ IWorldComm comms = engine.World.RequestModuleInterface();
+ if (comms != null)
+ comms.DeleteListener(itemID);
+
+ IXMLRPC xmlrpc = engine.World.RequestModuleInterface();
+ xmlrpc.DeleteChannels(itemID);
+ xmlrpc.CancelSRDRequests(itemID);
+
+ // Remove Sensors
+ m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
+
+ }
+
public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID)
{
List