Merge branch 'master' of ssh://3dhosting.de/var/git/careminster

Conflicts:
	OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
This commit is contained in:
Melanie Thielker
2014-06-21 00:39:55 +02:00
663 changed files with 89998 additions and 46619 deletions

View File

@@ -37,6 +37,8 @@ using OpenSim.Region.ScriptEngine.Interfaces;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
using Timer=OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer;
using System.Reflection;
using log4net;
namespace OpenSim.Region.ScriptEngine.Shared.Api
{
@@ -45,15 +47,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// </summary>
public class AsyncCommandManager
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static Thread cmdHandlerThread;
private static int cmdHandlerThreadCycleSleepms;
private static List<IScene> m_Scenes = new List<IScene>();
/// <summary>
/// Lock for reading/writing static components of AsyncCommandManager.
/// </summary>
/// <remarks>
/// This lock exists so that multiple threads from different engines and/or different copies of the same engine
/// are prevented from running non-thread safe code (e.g. read/write of lists) concurrently.
/// </remarks>
private static object staticLock = new object();
private static List<IScriptEngine> m_ScriptEngines =
new List<IScriptEngine>();
public IScriptEngine m_ScriptEngine;
private IScene m_Scene;
private static Dictionary<IScriptEngine, Dataserver> m_Dataserver =
new Dictionary<IScriptEngine, Dataserver>();
@@ -70,67 +81,99 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public Dataserver DataserverPlugin
{
get { return m_Dataserver[m_ScriptEngine]; }
get
{
lock (staticLock)
return m_Dataserver[m_ScriptEngine];
}
}
public Timer TimerPlugin
{
get { return m_Timer[m_ScriptEngine]; }
get
{
lock (staticLock)
return m_Timer[m_ScriptEngine];
}
}
public HttpRequest HttpRequestPlugin
{
get { return m_HttpRequest[m_ScriptEngine]; }
get
{
lock (staticLock)
return m_HttpRequest[m_ScriptEngine];
}
}
public Listener ListenerPlugin
{
get { return m_Listener[m_ScriptEngine]; }
get
{
lock (staticLock)
return m_Listener[m_ScriptEngine];
}
}
public SensorRepeat SensorRepeatPlugin
{
get { return m_SensorRepeat[m_ScriptEngine]; }
get
{
lock (staticLock)
return m_SensorRepeat[m_ScriptEngine];
}
}
public XmlRequest XmlRequestPlugin
{
get { return m_XmlRequest[m_ScriptEngine]; }
get
{
lock (staticLock)
return m_XmlRequest[m_ScriptEngine];
}
}
public IScriptEngine[] ScriptEngines
{
get { return m_ScriptEngines.ToArray(); }
get
{
lock (staticLock)
return m_ScriptEngines.ToArray();
}
}
public AsyncCommandManager(IScriptEngine _ScriptEngine)
{
m_ScriptEngine = _ScriptEngine;
m_Scene = m_ScriptEngine.World;
if (m_Scenes.Count == 0)
ReadConfig();
// If there is more than one scene in the simulator or multiple script engines are used on the same region
// then more than one thread could arrive at this block of code simultaneously. However, it cannot be
// executed concurrently both because concurrent list operations are not thread-safe and because of other
// race conditions such as the later check of cmdHandlerThread == null.
lock (staticLock)
{
if (m_ScriptEngines.Count == 0)
ReadConfig();
if (!m_Scenes.Contains(m_Scene))
m_Scenes.Add(m_Scene);
if (!m_ScriptEngines.Contains(m_ScriptEngine))
m_ScriptEngines.Add(m_ScriptEngine);
if (!m_ScriptEngines.Contains(m_ScriptEngine))
m_ScriptEngines.Add(m_ScriptEngine);
// Create instances of all plugins
if (!m_Dataserver.ContainsKey(m_ScriptEngine))
m_Dataserver[m_ScriptEngine] = new Dataserver(this);
if (!m_Timer.ContainsKey(m_ScriptEngine))
m_Timer[m_ScriptEngine] = new Timer(this);
if (!m_HttpRequest.ContainsKey(m_ScriptEngine))
m_HttpRequest[m_ScriptEngine] = new HttpRequest(this);
if (!m_Listener.ContainsKey(m_ScriptEngine))
m_Listener[m_ScriptEngine] = new Listener(this);
if (!m_SensorRepeat.ContainsKey(m_ScriptEngine))
m_SensorRepeat[m_ScriptEngine] = new SensorRepeat(this);
if (!m_XmlRequest.ContainsKey(m_ScriptEngine))
m_XmlRequest[m_ScriptEngine] = new XmlRequest(this);
// Create instances of all plugins
if (!m_Dataserver.ContainsKey(m_ScriptEngine))
m_Dataserver[m_ScriptEngine] = new Dataserver(this);
if (!m_Timer.ContainsKey(m_ScriptEngine))
m_Timer[m_ScriptEngine] = new Timer(this);
if (!m_HttpRequest.ContainsKey(m_ScriptEngine))
m_HttpRequest[m_ScriptEngine] = new HttpRequest(this);
if (!m_Listener.ContainsKey(m_ScriptEngine))
m_Listener[m_ScriptEngine] = new Listener(this);
if (!m_SensorRepeat.ContainsKey(m_ScriptEngine))
m_SensorRepeat[m_ScriptEngine] = new SensorRepeat(this);
if (!m_XmlRequest.ContainsKey(m_ScriptEngine))
m_XmlRequest[m_ScriptEngine] = new XmlRequest(this);
StartThread();
StartThread();
}
}
private static void StartThread()
@@ -179,42 +222,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
try
{
while (true)
{
Thread.Sleep(cmdHandlerThreadCycleSleepms);
Thread.Sleep(cmdHandlerThreadCycleSleepms);
DoOneCmdHandlerPass();
DoOneCmdHandlerPass();
Watchdog.UpdateThread();
}
Watchdog.UpdateThread();
}
catch
catch (Exception e)
{
m_log.Error("[ASYNC COMMAND MANAGER]: Exception in command handler pass: ", e);
}
}
}
private static void DoOneCmdHandlerPass()
{
// Check HttpRequests
m_HttpRequest[m_ScriptEngines[0]].CheckHttpRequests();
// Check XMLRPCRequests
m_XmlRequest[m_ScriptEngines[0]].CheckXMLRPCRequests();
foreach (IScriptEngine s in m_ScriptEngines)
lock (staticLock)
{
// Check Listeners
m_Listener[s].CheckListeners();
// Check HttpRequests
m_HttpRequest[m_ScriptEngines[0]].CheckHttpRequests();
// Check timers
m_Timer[s].CheckTimerEvents();
// Check XMLRPCRequests
m_XmlRequest[m_ScriptEngines[0]].CheckXMLRPCRequests();
// Check Sensors
m_SensorRepeat[s].CheckSenseRepeaterEvents();
foreach (IScriptEngine s in m_ScriptEngines)
{
// Check Listeners
m_Listener[s].CheckListeners();
// Check dataserver
m_Dataserver[s].ExpireRequests();
// Check timers
m_Timer[s].CheckTimerEvents();
// Check Sensors
m_SensorRepeat[s].CheckSenseRepeaterEvents();
// Check dataserver
m_Dataserver[s].ExpireRequests();
}
}
}
@@ -226,31 +270,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public static void RemoveScript(IScriptEngine engine, uint localID, UUID itemID)
{
// Remove a specific script
// m_log.DebugFormat("[ASYNC COMMAND MANAGER]: Removing facilities for script {0}", itemID);
// Remove dataserver events
m_Dataserver[engine].RemoveEvents(localID, itemID);
// Remove from: Timers
m_Timer[engine].UnSetTimerEvents(localID, itemID);
// Remove from: HttpRequest
IHttpRequestModule iHttpReq = engine.World.RequestModuleInterface<IHttpRequestModule>();
if (iHttpReq != null)
iHttpReq.StopHttpRequest(localID, itemID);
IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>();
if (comms != null)
comms.DeleteListener(itemID);
IXMLRPC xmlrpc = engine.World.RequestModuleInterface<IXMLRPC>();
if (xmlrpc != null)
lock (staticLock)
{
xmlrpc.DeleteChannels(itemID);
xmlrpc.CancelSRDRequests(itemID);
}
// Remove dataserver events
m_Dataserver[engine].RemoveEvents(localID, itemID);
// Remove Sensors
m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
// Remove from: Timers
m_Timer[engine].UnSetTimerEvents(localID, itemID);
// Remove from: HttpRequest
IHttpRequestModule iHttpReq = engine.World.RequestModuleInterface<IHttpRequestModule>();
if (iHttpReq != null)
iHttpReq.StopHttpRequest(localID, itemID);
IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>();
if (comms != null)
comms.DeleteListener(itemID);
IXMLRPC xmlrpc = engine.World.RequestModuleInterface<IXMLRPC>();
if (xmlrpc != null)
{
xmlrpc.DeleteChannels(itemID);
xmlrpc.CancelSRDRequests(itemID);
}
// Remove Sensors
m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
}
}
/// <summary>
@@ -260,10 +308,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <returns></returns>
public static SensorRepeat GetSensorRepeatPlugin(IScriptEngine engine)
{
if (m_SensorRepeat.ContainsKey(engine))
return m_SensorRepeat[engine];
else
return null;
lock (staticLock)
{
if (m_SensorRepeat.ContainsKey(engine))
return m_SensorRepeat[engine];
else
return null;
}
}
/// <summary>
@@ -273,10 +324,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <returns></returns>
public static Dataserver GetDataserverPlugin(IScriptEngine engine)
{
if (m_Dataserver.ContainsKey(engine))
return m_Dataserver[engine];
else
return null;
lock (staticLock)
{
if (m_Dataserver.ContainsKey(engine))
return m_Dataserver[engine];
else
return null;
}
}
/// <summary>
@@ -286,10 +340,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <returns></returns>
public static Timer GetTimerPlugin(IScriptEngine engine)
{
if (m_Timer.ContainsKey(engine))
return m_Timer[engine];
else
return null;
lock (staticLock)
{
if (m_Timer.ContainsKey(engine))
return m_Timer[engine];
else
return null;
}
}
/// <summary>
@@ -299,10 +356,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <returns></returns>
public static Listener GetListenerPlugin(IScriptEngine engine)
{
if (m_Listener.ContainsKey(engine))
return m_Listener[engine];
else
return null;
lock (staticLock)
{
if (m_Listener.ContainsKey(engine))
return m_Listener[engine];
else
return null;
}
}
public static void StateChange(IScriptEngine engine, uint localID, UUID itemID)
@@ -332,28 +392,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
List<Object> data = new List<Object>();
Object[] listeners = m_Listener[engine].GetSerializationData(itemID);
if (listeners.Length > 0)
lock (staticLock)
{
data.Add("listener");
data.Add(listeners.Length);
data.AddRange(listeners);
}
Object[] listeners = m_Listener[engine].GetSerializationData(itemID);
if (listeners.Length > 0)
{
data.Add("listener");
data.Add(listeners.Length);
data.AddRange(listeners);
}
Object[] timers=m_Timer[engine].GetSerializationData(itemID);
if (timers.Length > 0)
{
data.Add("timer");
data.Add(timers.Length);
data.AddRange(timers);
}
Object[] timers=m_Timer[engine].GetSerializationData(itemID);
if (timers.Length > 0)
{
data.Add("timer");
data.Add(timers.Length);
data.AddRange(timers);
}
Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID);
if (sensors.Length > 0)
{
data.Add("sensor");
data.Add(sensors.Length);
data.AddRange(sensors);
Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID);
if (sensors.Length > 0)
{
data.Add("sensor");
data.Add(sensors.Length);
data.AddRange(sensors);
}
}
return data.ToArray();
@@ -378,41 +441,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
idx+=len;
lock (staticLock)
{
switch (type)
{
case "listener":
m_Listener[engine].CreateFromData(localID, itemID,
hostID, item);
break;
case "timer":
m_Timer[engine].CreateFromData(localID, itemID,
hostID, item);
break;
case "sensor":
m_SensorRepeat[engine].CreateFromData(localID,
itemID, hostID, item);
break;
case "listener":
m_Listener[engine].CreateFromData(localID, itemID,
hostID, item);
break;
case "timer":
m_Timer[engine].CreateFromData(localID, itemID,
hostID, item);
break;
case "sensor":
m_SensorRepeat[engine].CreateFromData(localID,
itemID, hostID, item);
break;
}
}
}
}
}
#region Check llRemoteData channels
#endregion
#region Check llListeners
#endregion
/// <summary>
/// If set to true then threads and stuff should try to make a graceful exit
/// </summary>
public bool PleaseShutdown
{
get { return _PleaseShutdown; }
set { _PleaseShutdown = value; }
}
private bool _PleaseShutdown = false;
}
}

View File

@@ -1664,6 +1664,75 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.SetFaceColorAlpha(face, color, null);
}
/*
public void llSetContentType(LSL_Key id, LSL_Integer type)
{
m_host.AddScriptLPS(1);
if (m_UrlModule == null)
return;
// Make sure the content type is text/plain to start with
m_UrlModule.HttpContentType(new UUID(id), "text/plain");
// Is the object owner online and in the region
ScenePresence agent = World.GetScenePresence(m_host.ParentGroup.OwnerID);
if (agent == null || agent.IsChildAgent)
return; // Fail if the owner is not in the same region
// Is it the embeded browser?
string userAgent = m_UrlModule.GetHttpHeader(new UUID(id), "user-agent");
if (userAgent.IndexOf("SecondLife") < 0)
return; // Not the embedded browser. Is this check good enough?
// Use the IP address of the client and check against the request
// seperate logins from the same IP will allow all of them to get non-text/plain as long
// as the owner is in the region. Same as SL!
string logonFromIPAddress = agent.ControllingClient.RemoteEndPoint.Address.ToString();
string requestFromIPAddress = m_UrlModule.GetHttpHeader(new UUID(id), "remote_addr");
//m_log.Debug("IP from header='" + requestFromIPAddress + "' IP from endpoint='" + logonFromIPAddress + "'");
if (requestFromIPAddress == null || requestFromIPAddress.Trim() == "")
return;
if (logonFromIPAddress == null || logonFromIPAddress.Trim() == "")
return;
// If the request isnt from the same IP address then the request cannot be from the owner
if (!requestFromIPAddress.Trim().Equals(logonFromIPAddress.Trim()))
return;
switch (type)
{
case ScriptBaseClass.CONTENT_TYPE_HTML:
m_UrlModule.HttpContentType(new UUID(id), "text/html");
break;
case ScriptBaseClass.CONTENT_TYPE_XML:
m_UrlModule.HttpContentType(new UUID(id), "application/xml");
break;
case ScriptBaseClass.CONTENT_TYPE_XHTML:
m_UrlModule.HttpContentType(new UUID(id), "application/xhtml+xml");
break;
case ScriptBaseClass.CONTENT_TYPE_ATOM:
m_UrlModule.HttpContentType(new UUID(id), "application/atom+xml");
break;
case ScriptBaseClass.CONTENT_TYPE_JSON:
m_UrlModule.HttpContentType(new UUID(id), "application/json");
break;
case ScriptBaseClass.CONTENT_TYPE_LLSD:
m_UrlModule.HttpContentType(new UUID(id), "application/llsd+xml");
break;
case ScriptBaseClass.CONTENT_TYPE_FORM:
m_UrlModule.HttpContentType(new UUID(id), "application/x-www-form-urlencoded");
break;
case ScriptBaseClass.CONTENT_TYPE_RSS:
m_UrlModule.HttpContentType(new UUID(id), "application/rss+xml");
break;
default:
m_UrlModule.HttpContentType(new UUID(id), "text/plain");
break;
}
}
*/
public void SetTexGen(SceneObjectPart part, int face,int style)
{
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
@@ -2772,9 +2841,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// send the sound, once, to all clients in range
if (m_SoundModule != null)
{
m_SoundModule.SendSound(m_host.UUID,
ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound), volume, false, 0,
0, false, false);
m_SoundModule.SendSound(
m_host.UUID,
ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound),
volume, false, m_host.SoundQueueing ? (byte)SoundFlags.Queue : (byte)SoundFlags.None,
0, false, false);
}
}
@@ -3176,46 +3247,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// need the magnitude later
// float velmag = (float)Util.GetMagnitude(llvel);
SceneObjectGroup new_group = World.RezObject(m_host, item, pos, rot, vel, param);
List<SceneObjectGroup> new_groups = World.RezObject(m_host, item, pos, rot, vel, param);
// If either of these are null, then there was an unknown error.
if (new_group == null)
if (new_groups == null)
return;
// objects rezzed with this method are die_at_edge by default.
new_group.RootPart.SetDieAtEdge(true);
new_group.ResumeScripts();
m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams(
"object_rez", new Object[] {
new LSL_String(
new_group.RootPart.UUID.ToString()) },
new DetectParams[0]));
// do recoil
SceneObjectGroup hostgrp = m_host.ParentGroup;
if (hostgrp == null)
return;
if (hostgrp.IsAttachment) // don't recoil avatars
return;
PhysicsActor pa = new_group.RootPart.PhysActor;
//Recoil.
if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
foreach (SceneObjectGroup group in new_groups)
{
float groupmass = new_group.GetMass();
Vector3 recoil = -vel * groupmass * m_recoilScaleFactor;
if (recoil != Vector3.Zero)
{
llApplyImpulse(recoil, 0);
}
}
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
return;
// objects rezzed with this method are die_at_edge by default.
group.RootPart.SetDieAtEdge(true);
group.ResumeScripts();
m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams(
"object_rez", new Object[] {
new LSL_String(
group.RootPart.UUID.ToString()) },
new DetectParams[0]));
float groupmass = group.GetMass();
PhysicsActor pa = group.RootPart.PhysActor;
//Recoil.
if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
{
Vector3 recoil = -vel * groupmass * m_recoilScaleFactor;
if (recoil != Vector3.Zero)
{
llApplyImpulse(recoil, 0);
}
}
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
}
return;
});
//ScriptSleep((int)((groupmass * velmag) / 10));
@@ -4746,6 +4812,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID av = new UUID();
if (!UUID.TryParse(agent,out av))
{
LSLError("First parameter to llTextBox needs to be a key");
return;
}
@@ -5108,6 +5175,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
s = Math.Cos(angle * 0.5);
t = Math.Sin(angle * 0.5); // temp value to avoid 2 more sin() calcs
axis = LSL_Vector.Norm(axis);
x = axis.x * t;
y = axis.y * t;
z = axis.z * t;
@@ -5115,41 +5183,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_Rotation(x,y,z,s);
}
// Xantor 29/apr/2008
// converts a Quaternion to X,Y,Z axis rotations
/// <summary>
/// Returns the axis of rotation for a quaternion
/// </summary>
/// <returns></returns>
/// <param name='rot'></param>
public LSL_Vector llRot2Axis(LSL_Rotation rot)
{
m_host.AddScriptLPS(1);
double x,y,z;
if (rot.s > 1) // normalization needed
{
double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y +
rot.z * rot.z + rot.s * rot.s);
if (Math.Abs(rot.s) > 1) // normalization needed
rot.Normalize();
rot.x /= length;
rot.y /= length;
rot.z /= length;
rot.s /= length;
}
// double angle = 2 * Math.Acos(rot.s);
double s = Math.Sqrt(1 - rot.s * rot.s);
if (s < 0.001)
{
x = 1;
y = z = 0;
return new LSL_Vector(1, 0, 0);
}
else
{
x = rot.x / s; // normalise axis
y = rot.y / s;
z = rot.z / s;
double invS = 1.0 / s;
if (rot.s < 0) invS = -invS;
return new LSL_Vector(rot.x * invS, rot.y * invS, rot.z * invS);
}
return new LSL_Vector(x,y,z);
}
@@ -5158,18 +5214,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
if (rot.s > 1) // normalization needed
{
double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y +
rot.z * rot.z + rot.s * rot.s);
rot.x /= length;
rot.y /= length;
rot.z /= length;
rot.s /= length;
}
if (Math.Abs(rot.s) > 1) // normalization needed
rot.Normalize();
double angle = 2 * Math.Acos(rot.s);
if (angle > Math.PI)
angle = 2 * Math.PI - angle;
return angle;
}
@@ -6687,7 +6737,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
PSYS_SRC_TARGET_KEY = 20,
PSYS_SRC_OMEGA = 21,
PSYS_SRC_ANGLE_BEGIN = 22,
PSYS_SRC_ANGLE_END = 23
PSYS_SRC_ANGLE_END = 23,
PSYS_PART_BLEND_FUNC_SOURCE = 24,
PSYS_PART_BLEND_FUNC_DEST = 25,
PSYS_PART_START_GLOW = 26,
PSYS_PART_END_GLOW = 27
}
internal Primitive.ParticleSystem.ParticleDataFlags ConvertUINTtoFlags(uint flags)
@@ -6713,6 +6767,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ps.BurstRate = 0.1f;
ps.PartMaxAge = 10.0f;
ps.BurstPartCount = 1;
ps.BlendFuncSource = ScriptBaseClass.PSYS_PART_BF_SOURCE_ALPHA;
ps.BlendFuncDest = ScriptBaseClass.PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA;
ps.PartStartGlow = 0.0f;
ps.PartEndGlow = 0.0f;
return ps;
}
@@ -6747,6 +6806,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Vector tempv = new LSL_Vector();
float tempf = 0;
int tmpi = 0;
for (int i = 0; i < rules.Length; i += 2)
{
@@ -6805,7 +6865,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case (int)ScriptBaseClass.PSYS_SRC_PATTERN:
int tmpi = (int)rules.GetLSLIntegerItem(i + 1);
tmpi = (int)rules.GetLSLIntegerItem(i + 1);
prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
break;
@@ -6825,6 +6885,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
break;
case (int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_SOURCE:
tmpi = (int)rules.GetLSLIntegerItem(i + 1);
prules.BlendFuncSource = (byte)tmpi;
break;
case (int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_DEST:
tmpi = (int)rules.GetLSLIntegerItem(i + 1);
prules.BlendFuncDest = (byte)tmpi;
break;
case (int)ScriptBaseClass.PSYS_PART_START_GLOW:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartStartGlow = (float)tempf;
break;
case (int)ScriptBaseClass.PSYS_PART_END_GLOW:
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartEndGlow = (float)tempf;
break;
case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetLSLStringItem(i + 1));
break;
@@ -8255,7 +8335,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return null;
string ph = rules.Data[idx++].ToString();
parentgrp.ScriptSetPhantomStatus(ph.Equals("1"));
part.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1"));
break;
@@ -8308,7 +8388,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return null;
string temp = rules.Data[idx++].ToString();
parentgrp.ScriptSetTemporaryStatus(temp.Equals("1"));
part.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1"));
break;
@@ -8846,8 +8926,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
int idx=0;
while (idx < rules.Length)
{
int code=(int)rules.GetLSLIntegerItem(idx++);
int remain=rules.Length-idx;
int code = (int)rules.GetLSLIntegerItem(idx++);
int remain = rules.Length - idx;
switch (code)
{
@@ -8920,7 +9000,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case ScriptBaseClass.PRIM_TYPE_SCULPT:
res.Add(Shape.SculptTexture.ToString());
res.Add(new LSL_String(Shape.SculptTexture.ToString()));
res.Add(new LSL_Integer(Shape.SculptType));
break;
@@ -9262,7 +9342,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
));
break;
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
if(remain < 3)
// TODO: Should be issuing a runtime script warning in this case.
if (remain < 2)
return null;
return rules.GetSublist(idx, -1);
@@ -12673,6 +12755,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetSoundQueueing(int queue)
{
m_host.AddScriptLPS(1);
if (m_SoundModule != null)
m_SoundModule.SetSoundQueueing(m_host.UUID, queue == ScriptBaseClass.TRUE.value);
}
public void llCollisionSprite(string impact_sprite)

View File

@@ -434,6 +434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
return wl;
}
/// <summary>
/// Set the current Windlight scene
/// </summary>
@@ -446,13 +447,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return 0;
}
if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
{
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return 0;
ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
if (sp == null || sp.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);
@@ -465,8 +474,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("Windlight module is disabled");
return 0;
}
return success;
}
public void lsClearWindlightScene()
{
if (!m_LSFunctionsEnabled)
@@ -474,17 +485,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return;
}
if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
{
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return;
ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
if (sp == null || sp.GodLevel < 200)
{
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
return;
}
}
m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false;
if (m_host.ParentGroup.Scene.SimulationDataService != null)
m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID);
m_host.ParentGroup.Scene.EventManager.TriggerOnSaveNewWindlightProfile();
}
/// <summary>
/// Set the current Windlight scene to a target avatar
/// </summary>
@@ -497,13 +516,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("LightShare functions are not enabled.");
return 0;
}
if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
{
LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
return 0;
ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
if (sp == null || sp.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);
@@ -515,8 +542,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSShoutError("Windlight module is disabled");
return 0;
}
return success;
}
}
}
}
}

View File

@@ -319,7 +319,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
object[] convertedParms = new object[parms.Length];
for (int i = 0; i < parms.Length; i++)
convertedParms[i] = ConvertFromLSL(parms[i],signature[i], fname);
convertedParms[i] = ConvertFromLSL(parms[i], signature[i], fname);
// now call the function, the contract with the function is that it will always return
// non-null but don't trust it completely
@@ -448,7 +448,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
MODError(String.Format("{1}: parameter type mismatch; expecting {0}",type.Name, fname));
MODError(String.Format("{0}: parameter type mismatch; expecting {1}, type(parm)={2}", fname, type.Name, lslparm.GetType()));
return null;
}

View File

@@ -3005,6 +3005,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return ret;
}
public LSL_Vector osGetRegionSize()
{
CheckThreatLevel(ThreatLevel.None, "osGetRegionSize");
m_host.AddScriptLPS(1);
bool isMegaregion;
IRegionCombinerModule rcMod = World.RequestModuleInterface<IRegionCombinerModule>();
if (rcMod != null)
isMegaregion = rcMod.IsRootForMegaregion(World.RegionInfo.RegionID);
else
isMegaregion = false;
if (isMegaregion)
{
Vector2 size = rcMod.GetSizeOfMegaregion(World.RegionInfo.RegionID);
return new LSL_Vector(size.X, size.Y, Constants.RegionHeight);
}
else
{
return new LSL_Vector((float)Constants.RegionSize, (float)Constants.RegionSize, Constants.RegionHeight);
}
}
public int osGetSimulatorMemory()
{
CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory");
@@ -3043,7 +3066,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
sp.ControllingClient.Kick(alert);
// ...and close on our side
sp.Scene.IncomingCloseAgent(sp.UUID, false);
sp.Scene.CloseAgent(sp.UUID, false);
}
});
}

View File

@@ -353,6 +353,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
// Position of a sensor in a child prim attached to an avatar
// will be still wrong.
ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar);
// Don't proceed if the avatar for this attachment has since been removed from the scene.
if (avatar == null)
return sensedEntities;
fromRegionPos = avatar.AbsolutePosition;
q = avatar.Rotation;
}
@@ -363,7 +368,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
Vector3 ZeroVector = new Vector3(0, 0, 0);
bool nameSearch = (ts.name != null && ts.name != "");
bool nameSearch = !string.IsNullOrEmpty(ts.name);
foreach (EntityBase ent in Entities)
{
@@ -483,6 +488,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
// Position of a sensor in a child prim attached to an avatar
// will be still wrong.
ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar);
// Don't proceed if the avatar for this attachment has since been removed from the scene.
if (avatar == null)
return sensedEntities;
fromRegionPos = avatar.AbsolutePosition;
@@ -601,7 +608,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
return sensedEntities;
senseEntity(sp);
}
else if (ts.name != null && ts.name != "")
else if (!string.IsNullOrEmpty(ts.name))
{
ScenePresence sp;
// Try lookup by name will return if/when found

View File

@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.7.6.*")]
[assembly: AssemblyVersion("0.8.0.*")]