Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1320993a4 | ||
|
|
319069d193 | ||
|
|
82268d715e | ||
|
|
efcbae372b | ||
|
|
8f32e16497 | ||
|
|
c42e2c6906 | ||
|
|
6bd57f2455 | ||
|
|
af5a3f2d73 | ||
|
|
0ba01ce699 | ||
|
|
70e1dd54fa | ||
|
|
c42bff5388 | ||
|
|
10b3c6b5aa | ||
|
|
8ecf6ed08e | ||
|
|
09450448b0 | ||
|
|
e2823bfefe | ||
|
|
795009cae2 | ||
|
|
cc8fbf76e6 | ||
|
|
af27180131 | ||
|
|
c182157d4d | ||
|
|
1cda887d9b | ||
|
|
0ba0ac4669 | ||
|
|
ce8b30d868 | ||
|
|
d4c4cb3e67 | ||
|
|
ac4300664e | ||
|
|
069e2d6443 | ||
|
|
30eded2bda | ||
|
|
2563553f80 | ||
|
|
9ddddde42e | ||
|
|
99a5ea9f90 | ||
|
|
880b2361f5 | ||
|
|
f47f3dd8b9 | ||
|
|
8ee078c86b | ||
|
|
17d54a7c37 | ||
|
|
6f928f52dd | ||
|
|
7199ac09ee | ||
|
|
59263fe78e | ||
|
|
3c631fea9e | ||
|
|
ebfcb9d4e4 | ||
|
|
03142980ee | ||
|
|
ae355720ab | ||
|
|
d87d9af1a5 | ||
|
|
b00935015a | ||
|
|
0022f48d42 | ||
|
|
ce448adf91 | ||
|
|
c4fd1c6297 | ||
|
|
bbe5018b95 | ||
|
|
eeeb787f36 | ||
|
|
70e46ba815 | ||
|
|
f69731b955 | ||
|
|
e5e6fe8c41 | ||
|
|
226d655f23 | ||
|
|
afcf5a7591 | ||
|
|
39d2cafb5c | ||
|
|
2b6f12a1d3 | ||
|
|
acd9d62af2 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -95,3 +95,5 @@ OpenSim/Region/ScriptEngine/test-results/
|
||||
OpenSim/Tests/Common/test-results/
|
||||
OpenSim/Tests/test-results/
|
||||
test-results/
|
||||
doc/html
|
||||
doc/doxygen.error.log
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
<delete dir="${distbindir}/Prebuild"/>
|
||||
<delete dir="${distbindir}/%temp%"/>
|
||||
<delete dir="${distbindir}/.nant"/>
|
||||
<delete dir="${distbindir}/ThirdParty"/>
|
||||
<delete>
|
||||
<fileset basedir="${distbindir}">
|
||||
<include name="compile.bat"/>
|
||||
|
||||
@@ -113,11 +113,14 @@ namespace OpenSim.Data.Null
|
||||
// Find region data
|
||||
List<RegionData> ret = new List<RegionData>();
|
||||
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
lock (m_regionData)
|
||||
{
|
||||
// m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
{
|
||||
// m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
|
||||
if (queryMatch(r.RegionName.ToLower()))
|
||||
ret.Add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret.Count > 0)
|
||||
@@ -133,10 +136,13 @@ namespace OpenSim.Data.Null
|
||||
|
||||
List<RegionData> ret = new List<RegionData>();
|
||||
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
lock (m_regionData)
|
||||
{
|
||||
if (r.posX == posX && r.posY == posY)
|
||||
ret.Add(r);
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
{
|
||||
if (r.posX == posX && r.posY == posY)
|
||||
ret.Add(r);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret.Count > 0)
|
||||
@@ -150,8 +156,11 @@ namespace OpenSim.Data.Null
|
||||
if (m_useStaticInstance && Instance != this)
|
||||
return Instance.Get(regionID, scopeID);
|
||||
|
||||
if (m_regionData.ContainsKey(regionID))
|
||||
return m_regionData[regionID];
|
||||
lock (m_regionData)
|
||||
{
|
||||
if (m_regionData.ContainsKey(regionID))
|
||||
return m_regionData[regionID];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -163,10 +172,13 @@ namespace OpenSim.Data.Null
|
||||
|
||||
List<RegionData> ret = new List<RegionData>();
|
||||
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
lock (m_regionData)
|
||||
{
|
||||
if (r.posX >= startX && r.posX <= endX && r.posY >= startY && r.posY <= endY)
|
||||
ret.Add(r);
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
{
|
||||
if (r.posX >= startX && r.posX <= endX && r.posY >= startY && r.posY <= endY)
|
||||
ret.Add(r);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -180,7 +192,10 @@ namespace OpenSim.Data.Null
|
||||
// m_log.DebugFormat(
|
||||
// "[NULL REGION DATA]: Storing region {0} {1}, scope {2}", data.RegionName, data.RegionID, data.ScopeID);
|
||||
|
||||
m_regionData[data.RegionID] = data;
|
||||
lock (m_regionData)
|
||||
{
|
||||
m_regionData[data.RegionID] = data;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -190,10 +205,13 @@ namespace OpenSim.Data.Null
|
||||
if (m_useStaticInstance && Instance != this)
|
||||
return Instance.SetDataItem(regionID, item, value);
|
||||
|
||||
if (!m_regionData.ContainsKey(regionID))
|
||||
return false;
|
||||
lock (m_regionData)
|
||||
{
|
||||
if (!m_regionData.ContainsKey(regionID))
|
||||
return false;
|
||||
|
||||
m_regionData[regionID].Data[item] = value;
|
||||
m_regionData[regionID].Data[item] = value;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -205,10 +223,13 @@ namespace OpenSim.Data.Null
|
||||
|
||||
// m_log.DebugFormat("[NULL REGION DATA]: Deleting region {0}", regionID);
|
||||
|
||||
if (!m_regionData.ContainsKey(regionID))
|
||||
return false;
|
||||
lock (m_regionData)
|
||||
{
|
||||
if (!m_regionData.ContainsKey(regionID))
|
||||
return false;
|
||||
|
||||
m_regionData.Remove(regionID);
|
||||
m_regionData.Remove(regionID);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -238,10 +259,13 @@ namespace OpenSim.Data.Null
|
||||
|
||||
List<RegionData> ret = new List<RegionData>();
|
||||
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
lock (m_regionData)
|
||||
{
|
||||
if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0)
|
||||
ret.Add(r);
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
{
|
||||
if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0)
|
||||
ret.Add(r);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -110,10 +110,11 @@ namespace OpenSim.Framework.Console
|
||||
// Remove initial help keyword
|
||||
helpParts.RemoveAt(0);
|
||||
|
||||
help.Add(""); // Will become a newline.
|
||||
|
||||
// General help
|
||||
if (helpParts.Count == 0)
|
||||
{
|
||||
help.Add(""); // Will become a newline.
|
||||
help.Add(GeneralHelpText);
|
||||
help.Add(ItemHelpText);
|
||||
help.AddRange(CollectModulesHelp(tree));
|
||||
@@ -127,6 +128,8 @@ namespace OpenSim.Framework.Console
|
||||
help.AddRange(CollectHelp(helpParts));
|
||||
}
|
||||
|
||||
help.Add(""); // Will become a newline.
|
||||
|
||||
return help;
|
||||
}
|
||||
|
||||
@@ -194,14 +197,11 @@ namespace OpenSim.Framework.Console
|
||||
|
||||
string descriptiveHelp = commandInfo.descriptive_help;
|
||||
|
||||
// If we do have some descriptive help then insert a spacing line before and after for readability.
|
||||
// If we do have some descriptive help then insert a spacing line before for readability.
|
||||
if (descriptiveHelp != string.Empty)
|
||||
help.Add(string.Empty);
|
||||
|
||||
help.Add(commandInfo.descriptive_help);
|
||||
|
||||
if (descriptiveHelp != string.Empty)
|
||||
help.Add(string.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace OpenSim.Framework.Console
|
||||
public List<ConsoleDisplayTableRow> Rows { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of spaces to indent the table.
|
||||
/// Number of spaces to indent the whole table.
|
||||
/// </summary>
|
||||
public int Indent { get; set; }
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace OpenSim.Framework.Console
|
||||
Columns.Add(new ConsoleDisplayTableColumn(name, width));
|
||||
}
|
||||
|
||||
public void AddRow(params string[] cells)
|
||||
public void AddRow(params object[] cells)
|
||||
{
|
||||
Rows.Add(new ConsoleDisplayTableRow(cells));
|
||||
}
|
||||
@@ -113,7 +113,8 @@ namespace OpenSim.Framework.Console
|
||||
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
formatSb.Append(' ', TableSpacing);
|
||||
if (i != 0)
|
||||
formatSb.Append(' ', TableSpacing);
|
||||
|
||||
// Can only do left formatting for now
|
||||
formatSb.AppendFormat("{{{0},-{1}}}", i, Columns[i].Width);
|
||||
@@ -139,16 +140,16 @@ namespace OpenSim.Framework.Console
|
||||
|
||||
public struct ConsoleDisplayTableRow
|
||||
{
|
||||
public List<string> Cells { get; private set; }
|
||||
public List<object> Cells { get; private set; }
|
||||
|
||||
public ConsoleDisplayTableRow(List<string> cells) : this()
|
||||
public ConsoleDisplayTableRow(List<object> cells) : this()
|
||||
{
|
||||
Cells = cells;
|
||||
}
|
||||
|
||||
public ConsoleDisplayTableRow(params string[] cells) : this()
|
||||
public ConsoleDisplayTableRow(params object[] cells) : this()
|
||||
{
|
||||
Cells = new List<string>(cells);
|
||||
Cells = new List<object>(cells);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1623,6 +1623,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
// Long Poll Service Manager with 3 worker threads a 25 second timeout for no events
|
||||
m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000);
|
||||
m_PollServiceManager.Start();
|
||||
HTTPDRunning = true;
|
||||
|
||||
//HttpListenerContext context;
|
||||
@@ -1673,6 +1674,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
HTTPDRunning = false;
|
||||
try
|
||||
{
|
||||
m_PollServiceManager.Stop();
|
||||
|
||||
m_httpListener2.ExceptionThrown -= httpServerException;
|
||||
//m_httpListener2.DisconnectHandler = null;
|
||||
|
||||
|
||||
@@ -45,19 +45,26 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
private uint m_WorkerThreadCount = 0;
|
||||
private Thread[] m_workerThreads;
|
||||
private PollServiceWorkerThread[] m_PollServiceWorkerThreads;
|
||||
private bool m_running = true;
|
||||
private volatile bool m_running = true;
|
||||
private int m_pollTimeout;
|
||||
|
||||
public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
|
||||
{
|
||||
m_server = pSrv;
|
||||
m_WorkerThreadCount = pWorkerThreadCount;
|
||||
m_pollTimeout = pTimeout;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
m_running = true;
|
||||
m_workerThreads = new Thread[m_WorkerThreadCount];
|
||||
m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];
|
||||
|
||||
//startup worker threads
|
||||
for (uint i = 0; i < m_WorkerThreadCount; i++)
|
||||
{
|
||||
m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, pTimeout);
|
||||
m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, m_pollTimeout);
|
||||
m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;
|
||||
|
||||
m_workerThreads[i]
|
||||
@@ -136,8 +143,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
}
|
||||
|
||||
~PollServiceRequestManager()
|
||||
public void Stop()
|
||||
{
|
||||
m_running = false;
|
||||
|
||||
foreach (object o in m_requests)
|
||||
{
|
||||
PollServiceHttpRequest req = (PollServiceHttpRequest) o;
|
||||
@@ -151,8 +160,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
t.Abort();
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace OpenSim
|
||||
public class VersionInfo
|
||||
{
|
||||
private const string VERSION_NUMBER = "0.7.5";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.RC2;
|
||||
|
||||
public enum Flavour
|
||||
{
|
||||
|
||||
@@ -299,6 +299,18 @@ namespace OpenSim.Framework
|
||||
x;
|
||||
}
|
||||
|
||||
// Clamp the maximum magnitude of a vector
|
||||
public static Vector3 ClampV(Vector3 x, float max)
|
||||
{
|
||||
Vector3 ret = x;
|
||||
float lenSq = x.LengthSquared();
|
||||
if (lenSq > (max * max))
|
||||
{
|
||||
x = x / x.Length() * max;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
// Inclusive, within range test (true if equal to the endpoints)
|
||||
public static bool InRange<T>(T x, T min, T max)
|
||||
where T : IComparable<T>
|
||||
@@ -1646,8 +1658,13 @@ namespace OpenSim.Framework
|
||||
if (m_ThreadPool != null)
|
||||
throw new InvalidOperationException("SmartThreadPool is already initialized");
|
||||
|
||||
m_ThreadPool = new SmartThreadPool(2000, maxThreads, 2);
|
||||
m_ThreadPool.Name = "Util";
|
||||
STPStartInfo startInfo = new STPStartInfo();
|
||||
startInfo.ThreadPoolName = "Util";
|
||||
startInfo.IdleTimeout = 2000;
|
||||
startInfo.MaxWorkerThreads = maxThreads;
|
||||
startInfo.MinWorkerThreads = 2;
|
||||
|
||||
m_ThreadPool = new SmartThreadPool(startInfo);
|
||||
}
|
||||
|
||||
public static int FireAndForgetCount()
|
||||
|
||||
@@ -236,18 +236,6 @@ namespace OpenSim
|
||||
+ "If an avatar name is given then only packets from that avatar are logged",
|
||||
Debug);
|
||||
|
||||
m_console.Commands.AddCommand("Debug", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug);
|
||||
|
||||
m_console.Commands.AddCommand("Debug", false, "debug scene",
|
||||
"debug scene active|collisions|physics|scripting|teleport true|false",
|
||||
"Turn on scene debugging.",
|
||||
"If active is false then main scene update and maintenance loops are suspended.\n"
|
||||
+ "If collisions is false then collisions with other objects are turned off.\n"
|
||||
+ "If physics is false then all physics objects are non-physical.\n"
|
||||
+ "If scripting is false then no scripting operations happen.\n"
|
||||
+ "If teleport is true then some extra teleport debug information is logged.",
|
||||
Debug);
|
||||
|
||||
m_console.Commands.AddCommand("General", false, "change region",
|
||||
"change region <region name>",
|
||||
"Change current console region", ChangeSelectedRegion);
|
||||
@@ -744,31 +732,6 @@ namespace OpenSim
|
||||
|
||||
break;
|
||||
|
||||
case "scene":
|
||||
if (args.Length == 4)
|
||||
{
|
||||
if (SceneManager.CurrentScene == null)
|
||||
{
|
||||
MainConsole.Instance.Output("Please use 'change region <regioname>' first");
|
||||
}
|
||||
else
|
||||
{
|
||||
string key = args[2];
|
||||
string value = args[3];
|
||||
SceneManager.CurrentScene.SetSceneCoreDebug(
|
||||
new Dictionary<string, string>() { { key, value } });
|
||||
|
||||
MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.Output(
|
||||
"Usage: debug scene active|scripting|collisions|physics|teleport true|false");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
MainConsole.Instance.Output("Unknown debug command");
|
||||
break;
|
||||
|
||||
@@ -96,8 +96,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
// private static readonly string m_fetchInventoryPath = "0006/";
|
||||
private static readonly string m_copyFromNotecardPath = "0007/";
|
||||
// private static readonly string m_remoteParcelRequestPath = "0009/";// This is in the LandManagementModule.
|
||||
|
||||
|
||||
private static readonly string m_UpdateAgentInformationPath = "0500/";
|
||||
|
||||
// These are callbacks which will be setup by the scene so that we can update scene data when we
|
||||
// receive capability calls
|
||||
public NewInventoryItem AddNewInventoryItem = null;
|
||||
@@ -204,6 +204,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
|
||||
m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
|
||||
IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler("POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation);
|
||||
m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler);
|
||||
|
||||
m_HostCapsObj.RegisterHandler(
|
||||
"CopyInventoryFromNotecard",
|
||||
@@ -855,6 +857,22 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
response["int_response_code"] = 200;
|
||||
return LLSDHelpers.SerialiseLLSDReply(response);
|
||||
}
|
||||
|
||||
public string UpdateAgentInformation(string request, string path,
|
||||
string param, IOSHttpRequest httpRequest,
|
||||
IOSHttpResponse httpResponse)
|
||||
{
|
||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
OSDMap resp = new OSDMap();
|
||||
|
||||
OSDMap accessPrefs = new OSDMap();
|
||||
accessPrefs["max"] = "A";
|
||||
|
||||
resp["access_prefs"] = accessPrefs;
|
||||
|
||||
string response = OSDParser.SerializeLLSDXmlString(resp);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
public class AssetUploader
|
||||
|
||||
@@ -6427,6 +6427,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
#endregion
|
||||
|
||||
AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit;
|
||||
|
||||
if (handlerAgentRequestSit != null)
|
||||
handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
|
||||
agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
|
||||
|
||||
@@ -654,15 +654,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
// Killing it here will cause the client to deselect it
|
||||
// It then reappears on the avatar, deselected
|
||||
// through the full update below
|
||||
//
|
||||
if (so.IsSelected)
|
||||
{
|
||||
m_scene.SendKillObject(new List<uint> { so.RootPart.LocalId });
|
||||
}
|
||||
else if (so.HasPrivateAttachmentPoint)
|
||||
if (so.HasPrivateAttachmentPoint)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Killing private HUD {0} for avatars other than {1} at attachment point {2}",
|
||||
@@ -677,7 +669,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
});
|
||||
}
|
||||
|
||||
so.IsSelected = false; // fudge....
|
||||
// Fudge below is an extremely unhelpful comment. It's probably here so that the scheduled full update
|
||||
// will succeed, as that will not update if an attachment is selected.
|
||||
so.IsSelected = false; // fudge....
|
||||
|
||||
so.ScheduleGroupForFullUpdate();
|
||||
}
|
||||
|
||||
|
||||
@@ -212,11 +212,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
protected override GridRegion GetFinalDestination(GridRegion region)
|
||||
{
|
||||
int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, region.RegionID);
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags);
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionName, flags);
|
||||
|
||||
if ((flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0)
|
||||
{
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID);
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region is hyperlink");
|
||||
GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID);
|
||||
if (real_destination != null)
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: GetFinalDestination serveruri -> {0}", real_destination.ServerURI);
|
||||
|
||||
@@ -753,13 +753,18 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
Scene.RegionInfo.RegionSettings.Save();
|
||||
TriggerRegionInfoChange();
|
||||
|
||||
Scene.SetSceneCoreDebug(
|
||||
new Dictionary<string, string>() {
|
||||
{ "scripting", (!disableScripts).ToString() },
|
||||
{ "collisions", (!disableCollisions).ToString() },
|
||||
{ "physics", (!disablePhysics).ToString() }
|
||||
}
|
||||
);
|
||||
ISceneCommandsModule scm = Scene.RequestModuleInterface<ISceneCommandsModule>();
|
||||
|
||||
if (scm != null)
|
||||
{
|
||||
scm.SetSceneDebugOptions(
|
||||
new Dictionary<string, string>() {
|
||||
{ "scripting", (!disableScripts).ToString() },
|
||||
{ "collisions", (!disableCollisions).ToString() },
|
||||
{ "physics", (!disablePhysics).ToString() }
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey)
|
||||
|
||||
@@ -133,6 +133,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy;
|
||||
m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy;
|
||||
m_scene.EventManager.OnNewClient += EventManagerOnNewClient;
|
||||
m_scene.EventManager.OnMakeChildAgent += EventMakeChildAgent;
|
||||
m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement;
|
||||
m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage;
|
||||
m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
|
||||
@@ -218,6 +219,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
}
|
||||
}
|
||||
|
||||
public void EventMakeChildAgent(ScenePresence avatar)
|
||||
{
|
||||
avatar.currentParcelUUID = UUID.Zero;
|
||||
}
|
||||
|
||||
void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
|
||||
{
|
||||
//If we are forcing a position for them to go
|
||||
@@ -1395,15 +1401,65 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
|
||||
{
|
||||
ILandObject selectedParcel = null;
|
||||
lock (m_landList)
|
||||
if (localID != -1)
|
||||
{
|
||||
m_landList.TryGetValue(localID, out selectedParcel);
|
||||
ILandObject selectedParcel = null;
|
||||
lock (m_landList)
|
||||
{
|
||||
m_landList.TryGetValue(localID, out selectedParcel);
|
||||
}
|
||||
|
||||
if (selectedParcel == null) return;
|
||||
|
||||
selectedParcel.ReturnLandObjects(returnType, agentIDs, taskIDs, remoteClient);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (returnType != 1)
|
||||
{
|
||||
m_log.WarnFormat("[LAND MANAGEMENT MODULE] ReturnObjectsInParcel: unknown return type {0}", returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedParcel == null) return;
|
||||
// We get here when the user returns objects from the list of Top Colliders or Top Scripts.
|
||||
// In that case we receive specific object UUID's, but no parcel ID.
|
||||
|
||||
selectedParcel.ReturnLandObjects(returnType, agentIDs, taskIDs, remoteClient);
|
||||
Dictionary<UUID, HashSet<SceneObjectGroup>> returns = new Dictionary<UUID, HashSet<SceneObjectGroup>>();
|
||||
|
||||
foreach (UUID groupID in taskIDs)
|
||||
{
|
||||
SceneObjectGroup obj = m_scene.GetSceneObjectGroup(groupID);
|
||||
if (obj != null)
|
||||
{
|
||||
if (!returns.ContainsKey(obj.OwnerID))
|
||||
returns[obj.OwnerID] = new HashSet<SceneObjectGroup>();
|
||||
returns[obj.OwnerID].Add(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[LAND MANAGEMENT MODULE] ReturnObjectsInParcel: unknown object {0}", groupID);
|
||||
}
|
||||
}
|
||||
|
||||
int num = 0;
|
||||
foreach (HashSet<SceneObjectGroup> objs in returns.Values)
|
||||
num += objs.Count;
|
||||
m_log.DebugFormat("[LAND MANAGEMENT MODULE] Returning {0} specific object(s)", num);
|
||||
|
||||
foreach (HashSet<SceneObjectGroup> objs in returns.Values)
|
||||
{
|
||||
List<SceneObjectGroup> objs2 = new List<SceneObjectGroup>(objs);
|
||||
if (m_scene.Permissions.CanReturnObjects(null, remoteClient.AgentId, objs2))
|
||||
{
|
||||
m_scene.returnObjects(objs2.ToArray(), remoteClient.AgentId);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[LAND MANAGEMENT MODULE] ReturnObjectsInParcel: not permitted to return {0} object(s) belonging to user {1}",
|
||||
objs2.Count, objs2[0].OwnerID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void EventManagerOnNoLandDataFromStorage()
|
||||
|
||||
@@ -592,11 +592,11 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
|
||||
cdl.AddRow(
|
||||
"LightColor",
|
||||
string.Format("<{0},{1},{2},{3}>", s.LightColorR, s.LightColorB, s.LightColorG, s.LightColorA));
|
||||
cdl.AddRow("FlexiDrag", s.LightCutoff);
|
||||
cdl.AddRow("FlexiDrag", s.LightEntry);
|
||||
cdl.AddRow("FlexiDrag", s.LightFalloff);
|
||||
cdl.AddRow("FlexiDrag", s.LightIntensity);
|
||||
cdl.AddRow("FlexiDrag", s.LightRadius);
|
||||
cdl.AddRow("LightCutoff", s.LightCutoff);
|
||||
cdl.AddRow("LightEntry", s.LightEntry);
|
||||
cdl.AddRow("LightFalloff", s.LightFalloff);
|
||||
cdl.AddRow("LightIntensity", s.LightIntensity);
|
||||
cdl.AddRow("LightRadius", s.LightRadius);
|
||||
cdl.AddRow("Media", string.Format("{0} entries", s.Media != null ? s.Media.Count.ToString() : "n/a"));
|
||||
cdl.AddRow("PathBegin", s.PathBegin);
|
||||
cdl.AddRow("PathEnd", s.PathEnd);
|
||||
|
||||
@@ -480,7 +480,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
||||
else
|
||||
{
|
||||
m_plugineffects[pluginName] = effect;
|
||||
m_log.Warn("E ... " + pluginName + " (Replaced)");
|
||||
m_log.Info("E ... " + pluginName + " (Replaced)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
43
OpenSim/Region/Framework/Interfaces/ISceneCommandsModule.cs
Normal file
43
OpenSim/Region/Framework/Interfaces/ISceneCommandsModule.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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 OpenSim 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.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
public interface ISceneCommandsModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets the scene debug options.
|
||||
/// </summary>
|
||||
void SetSceneDebugOptions(Dictionary<string, string> options);
|
||||
}
|
||||
}
|
||||
@@ -87,13 +87,24 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Remove(UUID animID)
|
||||
/// <summary>
|
||||
/// Remove the specified animation
|
||||
/// </summary>
|
||||
/// <param name='animID'></param>
|
||||
/// <param name='allowNoDefault'>
|
||||
/// If true, then the default animation can be entirely removed.
|
||||
/// If false, then removing the default animation will reset it to the simulator default (currently STAND).
|
||||
/// </param>
|
||||
public bool Remove(UUID animID, bool allowNoDefault)
|
||||
{
|
||||
lock (m_animations)
|
||||
{
|
||||
if (m_defaultAnimation.AnimID == animID)
|
||||
{
|
||||
m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero);
|
||||
if (allowNoDefault)
|
||||
m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero);
|
||||
else
|
||||
ResetDefaultAnimation();
|
||||
}
|
||||
else if (HasAnimation(animID))
|
||||
{
|
||||
|
||||
@@ -86,7 +86,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
if (m_scenePresence.IsChildAgent)
|
||||
return;
|
||||
|
||||
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name);
|
||||
if (m_scenePresence.Scene.DebugAnimations)
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}",
|
||||
GetAnimName(animID), animID, m_scenePresence.Name);
|
||||
|
||||
if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
|
||||
SendAnimPack();
|
||||
@@ -109,14 +112,25 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
AddAnimation(animID, objectID);
|
||||
}
|
||||
|
||||
public void RemoveAnimation(UUID animID)
|
||||
/// <summary>
|
||||
/// Remove the specified animation
|
||||
/// </summary>
|
||||
/// <param name='animID'></param>
|
||||
/// <param name='allowNoDefault'>
|
||||
/// If true, then the default animation can be entirely removed.
|
||||
/// If false, then removing the default animation will reset it to the simulator default (currently STAND).
|
||||
/// </param>
|
||||
public void RemoveAnimation(UUID animID, bool allowNoDefault)
|
||||
{
|
||||
if (m_scenePresence.IsChildAgent)
|
||||
return;
|
||||
|
||||
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Removing animation {0} for {1}", animID, m_scenePresence.Name);
|
||||
if (m_scenePresence.Scene.DebugAnimations)
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE ANIMATOR]: Removing animation {0} {1} for {2}",
|
||||
GetAnimName(animID), animID, m_scenePresence.Name);
|
||||
|
||||
if (m_animations.Remove(animID))
|
||||
if (m_animations.Remove(animID, allowNoDefault))
|
||||
SendAnimPack();
|
||||
}
|
||||
|
||||
@@ -132,14 +146,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
if (animID == UUID.Zero)
|
||||
return;
|
||||
|
||||
RemoveAnimation(animID);
|
||||
RemoveAnimation(animID, true);
|
||||
}
|
||||
|
||||
public void ResetAnimations()
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}",
|
||||
// m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName);
|
||||
if (m_scenePresence.Scene.DebugAnimations)
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}",
|
||||
m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName);
|
||||
|
||||
m_animations.Clear();
|
||||
}
|
||||
@@ -550,5 +565,21 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
|
||||
SendAnimPack(animIDs, sequenceNums, objectIDs);
|
||||
}
|
||||
|
||||
public string GetAnimName(UUID animId)
|
||||
{
|
||||
string animName;
|
||||
|
||||
if (!DefaultAvatarAnimations.AnimsNames.TryGetValue(animId, out animName))
|
||||
{
|
||||
AssetMetadata amd = m_scenePresence.Scene.AssetService.GetMetadata(animId.ToString());
|
||||
if (amd != null)
|
||||
animName = amd.Name;
|
||||
else
|
||||
animName = "Unknown";
|
||||
}
|
||||
|
||||
return animName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,15 +67,85 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public bool EmergencyMonitoring = false;
|
||||
|
||||
/// <summary>
|
||||
/// Show debug information about animations.
|
||||
/// </summary>
|
||||
public bool DebugAnimations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Show debug information about teleports.
|
||||
/// </summary>
|
||||
public bool DebugTeleporting { get; private set; }
|
||||
public bool DebugTeleporting { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Show debug information about the scene loop.
|
||||
/// </summary>
|
||||
public bool DebugUpdates { get; private set; }
|
||||
public bool DebugUpdates { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true then the scene is saved to persistent storage periodically, every m_update_backup frames and
|
||||
/// if objects meet required conditions (m_dontPersistBefore and m_dontPersistAfter).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Even if false, the scene will still be saved on clean shutdown.
|
||||
/// FIXME: Currently, setting this to false will mean that objects are not periodically returned from parcels.
|
||||
/// This needs to be fixed.
|
||||
/// </remarks>
|
||||
public bool PeriodicBackup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If false then the scene is never saved to persistence storage even if PeriodicBackup == true and even
|
||||
/// if the scene is being shut down for the final time.
|
||||
/// </summary>
|
||||
public bool UseBackup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If false then physical objects are disabled, though collisions will continue as normal.
|
||||
/// </summary>
|
||||
public bool PhysicsEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If false then scripts are not enabled on the smiulator
|
||||
/// </summary>
|
||||
public bool ScriptsEnabled
|
||||
{
|
||||
get { return m_scripts_enabled; }
|
||||
set
|
||||
{
|
||||
if (m_scripts_enabled != value)
|
||||
{
|
||||
if (!value)
|
||||
{
|
||||
m_log.Info("Stopping all Scripts in Scene");
|
||||
|
||||
EntityBase[] entities = Entities.GetEntities();
|
||||
foreach (EntityBase ent in entities)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
((SceneObjectGroup)ent).RemoveScriptInstances(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("Starting all Scripts in Scene");
|
||||
|
||||
EntityBase[] entities = Entities.GetEntities();
|
||||
foreach (EntityBase ent in entities)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
SceneObjectGroup sog = (SceneObjectGroup)ent;
|
||||
sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
|
||||
sog.ResumeScripts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_scripts_enabled = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
private bool m_scripts_enabled;
|
||||
|
||||
public SynchronizeSceneHandler SynchronizeScene;
|
||||
|
||||
@@ -282,8 +352,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
|
||||
private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
|
||||
|
||||
private bool m_physics_enabled = true;
|
||||
private bool m_scripts_enabled = true;
|
||||
private string m_defaultScriptEngine;
|
||||
|
||||
/// <summary>
|
||||
@@ -341,7 +409,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
private Timer m_mapGenerationTimer = new Timer();
|
||||
private bool m_generateMaptiles;
|
||||
private bool m_useBackup = true;
|
||||
|
||||
#endregion Fields
|
||||
|
||||
@@ -594,11 +661,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
get { return m_authenticateHandler; }
|
||||
}
|
||||
|
||||
public bool UseBackup
|
||||
{
|
||||
get { return m_useBackup; }
|
||||
}
|
||||
|
||||
// an instance to the physics plugin's Scene object.
|
||||
public PhysicsScene PhysicsScene
|
||||
{
|
||||
@@ -751,9 +813,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
DumpAssetsToFile = dumpAssetsToFile;
|
||||
|
||||
// XXX: Don't set the public property since we don't want to activate here. This needs to be handled
|
||||
// better in the future.
|
||||
m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts;
|
||||
|
||||
m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics;
|
||||
PhysicsEnabled = !RegionInfo.RegionSettings.DisablePhysics;
|
||||
|
||||
m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")";
|
||||
|
||||
@@ -768,8 +832,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
|
||||
|
||||
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance);
|
||||
m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup);
|
||||
if (!m_useBackup)
|
||||
UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup);
|
||||
if (!UseBackup)
|
||||
m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
|
||||
|
||||
//Animation states
|
||||
@@ -937,6 +1001,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
PhysicalPrims = true;
|
||||
CollidablePrims = true;
|
||||
PhysicsEnabled = true;
|
||||
|
||||
PeriodicBackup = true;
|
||||
UseBackup = true;
|
||||
|
||||
BordersLocked = true;
|
||||
Border northBorder = new Border();
|
||||
@@ -1179,83 +1247,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSceneCoreDebug(Dictionary<string, string> options)
|
||||
{
|
||||
if (options.ContainsKey("active"))
|
||||
{
|
||||
bool active;
|
||||
|
||||
if (bool.TryParse(options["active"], out active))
|
||||
Active = active;
|
||||
}
|
||||
|
||||
if (options.ContainsKey("scripting"))
|
||||
{
|
||||
bool enableScripts = true;
|
||||
if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts)
|
||||
{
|
||||
if (!enableScripts)
|
||||
{
|
||||
m_log.Info("Stopping all Scripts in Scene");
|
||||
|
||||
EntityBase[] entities = Entities.GetEntities();
|
||||
foreach (EntityBase ent in entities)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
((SceneObjectGroup)ent).RemoveScriptInstances(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("Starting all Scripts in Scene");
|
||||
|
||||
EntityBase[] entities = Entities.GetEntities();
|
||||
foreach (EntityBase ent in entities)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
SceneObjectGroup sog = (SceneObjectGroup)ent;
|
||||
sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
|
||||
sog.ResumeScripts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_scripts_enabled = enableScripts;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.ContainsKey("physics"))
|
||||
{
|
||||
bool enablePhysics;
|
||||
if (bool.TryParse(options["physics"], out enablePhysics))
|
||||
m_physics_enabled = enablePhysics;
|
||||
}
|
||||
|
||||
// if (options.ContainsKey("collisions"))
|
||||
// {
|
||||
// // TODO: Implement. If false, should stop objects colliding, though possibly should still allow
|
||||
// // the avatar themselves to collide with the ground.
|
||||
// }
|
||||
|
||||
if (options.ContainsKey("teleport"))
|
||||
{
|
||||
bool enableTeleportDebugging;
|
||||
if (bool.TryParse(options["teleport"], out enableTeleportDebugging))
|
||||
DebugTeleporting = enableTeleportDebugging;
|
||||
}
|
||||
|
||||
if (options.ContainsKey("updates"))
|
||||
{
|
||||
bool enableUpdateDebugging;
|
||||
if (bool.TryParse(options["updates"], out enableUpdateDebugging))
|
||||
{
|
||||
DebugUpdates = enableUpdateDebugging;
|
||||
GcNotify.Enabled = DebugUpdates;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int GetInaccurateNeighborCount()
|
||||
{
|
||||
return m_neighbours.Count;
|
||||
@@ -1514,7 +1505,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
if ((Frame % m_update_physics == 0) && m_physics_enabled)
|
||||
if (PhysicsEnabled && Frame % m_update_physics == 0)
|
||||
m_sceneGraph.UpdatePreparePhysics();
|
||||
physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
|
||||
|
||||
@@ -1529,7 +1520,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
if (Frame % m_update_physics == 0)
|
||||
{
|
||||
if (m_physics_enabled)
|
||||
if (PhysicsEnabled)
|
||||
physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
|
||||
|
||||
if (SynchronizeScene != null)
|
||||
@@ -1570,7 +1561,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
eventMS = Util.EnvironmentTickCountSubtract(tmpMS);
|
||||
}
|
||||
|
||||
if (Frame % m_update_backup == 0)
|
||||
if (PeriodicBackup && Frame % m_update_backup == 0)
|
||||
{
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
UpdateStorageBackup();
|
||||
|
||||
@@ -647,6 +647,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </remarks>
|
||||
public UUID FromFolderID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IDs of all avatars sat on this scene object.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// We need this so that we can maintain a linkset wide ordering of avatars sat on different parts.
|
||||
/// This must be locked before it is read or written.
|
||||
/// SceneObjectPart sitting avatar add/remove code also locks on this object to avoid race conditions.
|
||||
/// No avatar should appear more than once in this list.
|
||||
/// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart.
|
||||
/// </remarks>
|
||||
protected internal List<UUID> m_sittingAvatars = new List<UUID>();
|
||||
|
||||
#endregion
|
||||
|
||||
// ~SceneObjectGroup()
|
||||
@@ -3563,6 +3575,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a copy of the list of sitting avatars on all prims of this object.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is sorted by the order in which avatars sat down. If an avatar stands up then all avatars that sat
|
||||
/// down after it move one place down the list.
|
||||
/// </remarks>
|
||||
/// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns>
|
||||
public List<UUID> GetSittingAvatars()
|
||||
{
|
||||
lock (m_sittingAvatars)
|
||||
return new List<UUID>(m_sittingAvatars);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of sitting avatars.
|
||||
/// </summary>
|
||||
@@ -3570,11 +3596,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <returns></returns>
|
||||
public int GetSittingAvatarsCount()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
Array.ForEach<SceneObjectPart>(m_parts.GetArray(), p => count += p.GetSittingAvatarsCount());
|
||||
|
||||
return count;
|
||||
lock (m_sittingAvatars)
|
||||
return m_sittingAvatars.Count;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@@ -3583,7 +3606,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
#region ISceneObject
|
||||
|
||||
|
||||
public virtual ISceneObject CloneForNewScene()
|
||||
{
|
||||
SceneObjectGroup sog = Copy(false);
|
||||
|
||||
@@ -1256,7 +1256,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public UUID SitTargetAvatar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IDs of all avatars start on this object part.
|
||||
/// IDs of all avatars sat on this part.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// We need to track this so that we can stop sat upon prims from being attached.
|
||||
@@ -4050,9 +4050,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
rigidBody,
|
||||
m_localId);
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
|
||||
m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom. e={1}", m_uuid, e);
|
||||
pa = null;
|
||||
}
|
||||
|
||||
@@ -4504,18 +4504,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name='avatarId'></param>
|
||||
protected internal bool AddSittingAvatar(UUID avatarId)
|
||||
{
|
||||
if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
|
||||
SitTargetAvatar = avatarId;
|
||||
|
||||
HashSet<UUID> sittingAvatars = m_sittingAvatars;
|
||||
|
||||
if (sittingAvatars == null)
|
||||
sittingAvatars = new HashSet<UUID>();
|
||||
|
||||
lock (sittingAvatars)
|
||||
lock (ParentGroup.m_sittingAvatars)
|
||||
{
|
||||
m_sittingAvatars = sittingAvatars;
|
||||
return m_sittingAvatars.Add(avatarId);
|
||||
if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
|
||||
SitTargetAvatar = avatarId;
|
||||
|
||||
if (m_sittingAvatars == null)
|
||||
m_sittingAvatars = new HashSet<UUID>();
|
||||
|
||||
if (m_sittingAvatars.Add(avatarId))
|
||||
{
|
||||
ParentGroup.m_sittingAvatars.Add(avatarId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4529,27 +4533,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name='avatarId'></param>
|
||||
protected internal bool RemoveSittingAvatar(UUID avatarId)
|
||||
{
|
||||
if (SitTargetAvatar == avatarId)
|
||||
SitTargetAvatar = UUID.Zero;
|
||||
|
||||
HashSet<UUID> sittingAvatars = m_sittingAvatars;
|
||||
|
||||
// This can occur under a race condition where another thread
|
||||
if (sittingAvatars == null)
|
||||
return false;
|
||||
|
||||
lock (sittingAvatars)
|
||||
lock (ParentGroup.m_sittingAvatars)
|
||||
{
|
||||
if (sittingAvatars.Remove(avatarId))
|
||||
if (SitTargetAvatar == avatarId)
|
||||
SitTargetAvatar = UUID.Zero;
|
||||
|
||||
if (m_sittingAvatars == null)
|
||||
return false;
|
||||
|
||||
if (m_sittingAvatars.Remove(avatarId))
|
||||
{
|
||||
if (sittingAvatars.Count == 0)
|
||||
if (m_sittingAvatars.Count == 0)
|
||||
m_sittingAvatars = null;
|
||||
|
||||
ParentGroup.m_sittingAvatars.Remove(avatarId);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -4559,16 +4562,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns>
|
||||
public HashSet<UUID> GetSittingAvatars()
|
||||
{
|
||||
HashSet<UUID> sittingAvatars = m_sittingAvatars;
|
||||
|
||||
if (sittingAvatars == null)
|
||||
lock (ParentGroup.m_sittingAvatars)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
lock (sittingAvatars)
|
||||
return new HashSet<UUID>(sittingAvatars);
|
||||
if (m_sittingAvatars == null)
|
||||
return null;
|
||||
else
|
||||
return new HashSet<UUID>(m_sittingAvatars);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4579,13 +4578,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <returns></returns>
|
||||
public int GetSittingAvatarsCount()
|
||||
{
|
||||
HashSet<UUID> sittingAvatars = m_sittingAvatars;
|
||||
|
||||
if (sittingAvatars == null)
|
||||
return 0;
|
||||
|
||||
lock (sittingAvatars)
|
||||
return sittingAvatars.Count;
|
||||
lock (ParentGroup.m_sittingAvatars)
|
||||
{
|
||||
if (m_sittingAvatars == null)
|
||||
return 0;
|
||||
else
|
||||
return m_sittingAvatars.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1954,6 +1954,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (ParentID != 0)
|
||||
{
|
||||
if (ParentPart.UUID == targetID)
|
||||
return; // already sitting here, ignore
|
||||
|
||||
StandUp();
|
||||
}
|
||||
|
||||
@@ -2256,7 +2259,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void HandleStopAnim(IClientAPI remoteClient, UUID animID)
|
||||
{
|
||||
Animator.RemoveAnimation(animID);
|
||||
Animator.RemoveAnimation(animID, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
using OpenSim.Region.ClientStack.LindenUDP;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Animation;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Avatar.Animations
|
||||
{
|
||||
/// <summary>
|
||||
/// A module that just holds commands for inspecting avatar animations.
|
||||
/// </summary>
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AnimationsCommandModule")]
|
||||
public class AnimationsCommandModule : ISharedRegionModule
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private List<Scene> m_scenes = new List<Scene>();
|
||||
|
||||
public string Name { get { return "Animations Command Module"; } }
|
||||
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: INITIALIZED MODULE");
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: POST INITIALIZED MODULE");
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: CLOSED MODULE");
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
// m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
|
||||
|
||||
lock (m_scenes)
|
||||
m_scenes.Remove(scene);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
// m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
|
||||
|
||||
lock (m_scenes)
|
||||
m_scenes.Add(scene);
|
||||
|
||||
scene.AddCommand(
|
||||
"Users", this, "show animations",
|
||||
"show animations [<first-name> <last-name>]",
|
||||
"Show animation information for avatars in this simulator.",
|
||||
"If no name is supplied then information for all avatars is shown.\n"
|
||||
+ "Please note that for inventory animations, the animation name is the name under which the animation was originally uploaded\n"
|
||||
+ ", which is not necessarily the current inventory name.",
|
||||
HandleShowAnimationsCommand);
|
||||
}
|
||||
|
||||
protected void HandleShowAnimationsCommand(string module, string[] cmd)
|
||||
{
|
||||
if (cmd.Length != 2 && cmd.Length < 4)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("Usage: show animations [<first-name> <last-name>]");
|
||||
return;
|
||||
}
|
||||
|
||||
bool targetNameSupplied = false;
|
||||
string optionalTargetFirstName = null;
|
||||
string optionalTargetLastName = null;
|
||||
|
||||
if (cmd.Length >= 4)
|
||||
{
|
||||
targetNameSupplied = true;
|
||||
optionalTargetFirstName = cmd[2];
|
||||
optionalTargetLastName = cmd[3];
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
lock (m_scenes)
|
||||
{
|
||||
foreach (Scene scene in m_scenes)
|
||||
{
|
||||
if (targetNameSupplied)
|
||||
{
|
||||
ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName);
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
GetAttachmentsReport(sp, sb);
|
||||
}
|
||||
else
|
||||
{
|
||||
scene.ForEachRootScenePresence(sp => GetAttachmentsReport(sp, sb));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MainConsole.Instance.Output(sb.ToString());
|
||||
}
|
||||
|
||||
private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb)
|
||||
{
|
||||
sb.AppendFormat("Animations for {0}\n", sp.Name);
|
||||
|
||||
ConsoleDisplayList cdl = new ConsoleDisplayList() { Indent = 2 };
|
||||
ScenePresenceAnimator spa = sp.Animator;
|
||||
AnimationSet anims = sp.Animator.Animations;
|
||||
|
||||
string cma = spa.CurrentMovementAnimation;
|
||||
cdl.AddRow(
|
||||
"Current movement anim",
|
||||
string.Format("{0}, {1}", DefaultAvatarAnimations.GetDefaultAnimation(cma), cma));
|
||||
|
||||
UUID defaultAnimId = anims.DefaultAnimation.AnimID;
|
||||
cdl.AddRow(
|
||||
"Default anim",
|
||||
string.Format("{0}, {1}", defaultAnimId, sp.Animator.GetAnimName(defaultAnimId)));
|
||||
|
||||
UUID implicitDefaultAnimId = anims.ImplicitDefaultAnimation.AnimID;
|
||||
cdl.AddRow(
|
||||
"Implicit default anim",
|
||||
string.Format("{0}, {1}",
|
||||
implicitDefaultAnimId, sp.Animator.GetAnimName(implicitDefaultAnimId)));
|
||||
|
||||
cdl.AddToStringBuilder(sb);
|
||||
|
||||
ConsoleDisplayTable cdt = new ConsoleDisplayTable() { Indent = 2 };
|
||||
cdt.AddColumn("Animation ID", 36);
|
||||
cdt.AddColumn("Name", 20);
|
||||
cdt.AddColumn("Seq", 3);
|
||||
cdt.AddColumn("Object ID", 36);
|
||||
|
||||
UUID[] animIds;
|
||||
int[] sequenceNumbers;
|
||||
UUID[] objectIds;
|
||||
|
||||
sp.Animator.Animations.GetArrays(out animIds, out sequenceNumbers, out objectIds);
|
||||
|
||||
for (int i = 0; i < animIds.Length; i++)
|
||||
{
|
||||
UUID animId = animIds[i];
|
||||
string animName = sp.Animator.GetAnimName(animId);
|
||||
int seq = sequenceNumbers[i];
|
||||
UUID objectId = objectIds[i];
|
||||
|
||||
cdt.AddRow(animId, animName, seq, objectId);
|
||||
}
|
||||
|
||||
cdt.AddToStringBuilder(sb);
|
||||
sb.Append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,6 +97,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
|
||||
"Users", this, "attachments show",
|
||||
"attachments show [<first-name> <last-name>]",
|
||||
"Show attachment information for avatars in this simulator.",
|
||||
"If no name is supplied then information for all avatars is shown.",
|
||||
HandleShowAttachmentsCommand);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
{
|
||||
scene.RegisterModuleInterface<IGroupsModule>(this);
|
||||
scene.AddCommand(
|
||||
"debug",
|
||||
"Debug",
|
||||
this,
|
||||
"debug groups verbose",
|
||||
"debug groups verbose <true|false>",
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
|
||||
/// (such as land transfers). There is no money code here! Use FORGE as an example for money code.
|
||||
/// Demo Economy/Money Module. This is a purposely crippled module!
|
||||
/// // To land transfer you need to add:
|
||||
/// -helperuri <ADDRESS TO THIS SERVER>
|
||||
/// -helperuri http://serveraddress:port/
|
||||
/// to the command line parameters you use to start up your client
|
||||
/// This commonly looks like -helperuri http://127.0.0.1:9000/
|
||||
///
|
||||
@@ -116,10 +116,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Startup
|
||||
/// Called on startup so the module can be configured.
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="config">Configuration source.</param>
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
m_gConfig = config;
|
||||
@@ -674,9 +673,12 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When the client closes the connection we remove their accounting info from memory to free up resources.
|
||||
/// When the client closes the connection we remove their accounting
|
||||
/// info from memory to free up resources.
|
||||
/// </summary>
|
||||
/// <param name="AgentID"></param>
|
||||
/// <param name="AgentID">UUID of agent</param>
|
||||
/// <param name="scene">Scene the agent was connected to.</param>
|
||||
/// <see cref="OpenSim.Region.Framework.Scenes.EventManager.ClientClosed"/>
|
||||
public void ClientClosed(UUID AgentID, Scene scene)
|
||||
{
|
||||
|
||||
|
||||
@@ -74,6 +74,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
||||
[SetUp]
|
||||
public void Init()
|
||||
{
|
||||
base.SetUp();
|
||||
|
||||
IConfigSource config = new IniConfigSource();
|
||||
config.AddConfig("NPC");
|
||||
config.Configs["NPC"].Set("Enabled", "true");
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
/*
|
||||
* 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Mono.Addins;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.OptionalModules.Avatar.Attachments
|
||||
{
|
||||
/// <summary>
|
||||
/// A module that just holds commands for inspecting avatar appearance.
|
||||
/// </summary>
|
||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SceneCommandsModule")]
|
||||
public class SceneCommandsModule : ISceneCommandsModule, INonSharedRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
public string Name { get { return "Scene Commands Module"; } }
|
||||
|
||||
public Type ReplaceableInterface { get { return null; } }
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE COMMANDS MODULE]: INITIALIZED MODULE");
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE COMMANDS MODULE]: POST INITIALIZED MODULE");
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE COMMANDS MODULE]: CLOSED MODULE");
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
|
||||
|
||||
m_scene = scene;
|
||||
|
||||
m_scene.RegisterModuleInterface<ISceneCommandsModule>(this);
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE COMMANDS MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
// m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
|
||||
|
||||
scene.AddCommand(
|
||||
"Debug", this, "debug scene get",
|
||||
"debug scene get",
|
||||
"List current scene options.",
|
||||
"If active is false then main scene update and maintenance loops are suspended.\n"
|
||||
+ "If animations is true then extra animations debug information is logged.\n"
|
||||
+ "If collisions is false then collisions with other objects are turned off.\n"
|
||||
+ "If pbackup is false then periodic scene backup is turned off.\n"
|
||||
+ "If physics is false then all physics objects are non-physical.\n"
|
||||
+ "If scripting is false then no scripting operations happen.\n"
|
||||
+ "If teleport is true then some extra teleport debug information is logged.\n"
|
||||
+ "If updates is true then any frame which exceeds double the maximum desired frame time is logged.",
|
||||
HandleDebugSceneGetCommand);
|
||||
|
||||
scene.AddCommand(
|
||||
"Debug", this, "debug scene set",
|
||||
"debug scene set active|collisions|pbackup|physics|scripting|teleport|updates true|false",
|
||||
"Turn on scene debugging options.",
|
||||
"If active is false then main scene update and maintenance loops are suspended.\n"
|
||||
+ "If animations is true then extra animations debug information is logged.\n"
|
||||
+ "If collisions is false then collisions with other objects are turned off.\n"
|
||||
+ "If pbackup is false then periodic scene backup is turned off.\n"
|
||||
+ "If physics is false then all physics objects are non-physical.\n"
|
||||
+ "If scripting is false then no scripting operations happen.\n"
|
||||
+ "If teleport is true then some extra teleport debug information is logged.\n"
|
||||
+ "If updates is true then any frame which exceeds double the maximum desired frame time is logged.",
|
||||
HandleDebugSceneSetCommand);
|
||||
}
|
||||
|
||||
private void HandleDebugSceneGetCommand(string module, string[] args)
|
||||
{
|
||||
if (args.Length == 3)
|
||||
{
|
||||
if (MainConsole.Instance.ConsoleScene != m_scene && MainConsole.Instance.ConsoleScene != null)
|
||||
return;
|
||||
|
||||
OutputSceneDebugOptions();
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: debug scene get");
|
||||
}
|
||||
}
|
||||
|
||||
private void OutputSceneDebugOptions()
|
||||
{
|
||||
ConsoleDisplayList cdl = new ConsoleDisplayList();
|
||||
cdl.AddRow("active", m_scene.Active);
|
||||
cdl.AddRow("animations", m_scene.DebugAnimations);
|
||||
cdl.AddRow("pbackup", m_scene.PeriodicBackup);
|
||||
cdl.AddRow("physics", m_scene.PhysicsEnabled);
|
||||
cdl.AddRow("scripting", m_scene.ScriptsEnabled);
|
||||
cdl.AddRow("teleport", m_scene.DebugTeleporting);
|
||||
cdl.AddRow("updates", m_scene.DebugUpdates);
|
||||
|
||||
MainConsole.Instance.OutputFormat("Scene {0} options:", m_scene.Name);
|
||||
MainConsole.Instance.Output(cdl.ToString());
|
||||
}
|
||||
|
||||
private void HandleDebugSceneSetCommand(string module, string[] args)
|
||||
{
|
||||
if (args.Length == 5)
|
||||
{
|
||||
if (MainConsole.Instance.ConsoleScene != m_scene && MainConsole.Instance.ConsoleScene != null)
|
||||
return;
|
||||
|
||||
string key = args[3];
|
||||
string value = args[4];
|
||||
SetSceneDebugOptions(new Dictionary<string, string>() { { key, value } });
|
||||
|
||||
MainConsole.Instance.OutputFormat("Set {0} debug scene {1} = {2}", m_scene.Name, key, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.Output(
|
||||
"Usage: debug scene set active|collisions|pbackup|physics|scripting|teleport|updates true|false");
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSceneDebugOptions(Dictionary<string, string> options)
|
||||
{
|
||||
if (options.ContainsKey("active"))
|
||||
{
|
||||
bool active;
|
||||
|
||||
if (bool.TryParse(options["active"], out active))
|
||||
m_scene.Active = active;
|
||||
}
|
||||
|
||||
if (options.ContainsKey("animations"))
|
||||
{
|
||||
bool active;
|
||||
|
||||
if (bool.TryParse(options["animations"], out active))
|
||||
m_scene.DebugAnimations = active;
|
||||
}
|
||||
|
||||
if (options.ContainsKey("pbackup"))
|
||||
{
|
||||
bool active;
|
||||
|
||||
if (bool.TryParse(options["pbackup"], out active))
|
||||
m_scene.PeriodicBackup = active;
|
||||
}
|
||||
|
||||
if (options.ContainsKey("scripting"))
|
||||
{
|
||||
bool enableScripts = true;
|
||||
if (bool.TryParse(options["scripting"], out enableScripts))
|
||||
m_scene.ScriptsEnabled = enableScripts;
|
||||
}
|
||||
|
||||
if (options.ContainsKey("physics"))
|
||||
{
|
||||
bool enablePhysics;
|
||||
if (bool.TryParse(options["physics"], out enablePhysics))
|
||||
m_scene.PhysicsEnabled = enablePhysics;
|
||||
}
|
||||
|
||||
// if (options.ContainsKey("collisions"))
|
||||
// {
|
||||
// // TODO: Implement. If false, should stop objects colliding, though possibly should still allow
|
||||
// // the avatar themselves to collide with the ground.
|
||||
// }
|
||||
|
||||
if (options.ContainsKey("teleport"))
|
||||
{
|
||||
bool enableTeleportDebugging;
|
||||
if (bool.TryParse(options["teleport"], out enableTeleportDebugging))
|
||||
m_scene.DebugTeleporting = enableTeleportDebugging;
|
||||
}
|
||||
|
||||
if (options.ContainsKey("updates"))
|
||||
{
|
||||
bool enableUpdateDebugging;
|
||||
if (bool.TryParse(options["updates"], out enableUpdateDebugging))
|
||||
{
|
||||
m_scene.DebugUpdates = enableUpdateDebugging;
|
||||
GcNotify.Enabled = enableUpdateDebugging;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1668,10 +1668,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
part.Shape.FlexiForceX = (float)Force.x;
|
||||
part.Shape.FlexiForceY = (float)Force.y;
|
||||
part.Shape.FlexiForceZ = (float)Force.z;
|
||||
part.Shape.PathCurve = 0x80;
|
||||
part.ParentGroup.HasGroupChanged = true;
|
||||
part.ScheduleFullUpdate();
|
||||
part.Shape.PathCurve = (byte)Extrusion.Flexible;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Other values not set, they do not seem to be sent to the viewer
|
||||
// Setting PathCurve appears to be what actually toggles the check box and turns Flexi on and off
|
||||
part.Shape.PathCurve = (byte)Extrusion.Straight;
|
||||
part.Shape.FlexiEntry = false;
|
||||
}
|
||||
part.ParentGroup.HasGroupChanged = true;
|
||||
part.ScheduleFullUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -3007,7 +3014,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
/// <summary>
|
||||
/// Attach the object containing this script to the avatar that owns it.
|
||||
/// </summary>
|
||||
/// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param>
|
||||
/// <param name='attachmentPoint'>
|
||||
/// The attachment point (e.g. <see cref="OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass.ATTACH_CHEST">ATTACH_CHEST</see>)
|
||||
/// </param>
|
||||
/// <returns>true if the attach suceeded, false if it did not</returns>
|
||||
public bool AttachToAvatar(int attachmentPoint)
|
||||
{
|
||||
@@ -3339,7 +3348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (animID == UUID.Zero)
|
||||
presence.Animator.RemoveAnimation(anim);
|
||||
else
|
||||
presence.Animator.RemoveAnimation(animID);
|
||||
presence.Animator.RemoveAnimation(animID, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3410,21 +3419,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
else
|
||||
{
|
||||
bool sitting = false;
|
||||
if (m_host.SitTargetAvatar == agentID)
|
||||
{
|
||||
sitting = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (SceneObjectPart p in m_host.ParentGroup.Parts)
|
||||
{
|
||||
if (p.SitTargetAvatar == agentID)
|
||||
sitting = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (sitting)
|
||||
if (m_host.ParentGroup.GetSittingAvatars().Contains(agentID))
|
||||
{
|
||||
// When agent is sitting, certain permissions are implicit if requested from sitting agent
|
||||
implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
|
||||
@@ -3463,7 +3458,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
|
||||
if (npcModule != null && npcModule.IsNPC(agentID, World))
|
||||
{
|
||||
if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID)
|
||||
if (npcModule.CheckPermissions(agentID, m_host.OwnerID))
|
||||
{
|
||||
lock (m_host.TaskInventory)
|
||||
{
|
||||
@@ -3736,33 +3731,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public LSL_String llGetLinkKey(int linknum)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
List<UUID> keytable = new List<UUID>();
|
||||
// parse for sitting avatare-uuids
|
||||
World.ForEachRootScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
if (presence.ParentID != 0 && m_host.ParentGroup.ContainsPart(presence.ParentID))
|
||||
keytable.Add(presence.UUID);
|
||||
});
|
||||
|
||||
int totalprims = m_host.ParentGroup.PrimCount + keytable.Count;
|
||||
if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims)
|
||||
if (linknum < 0)
|
||||
{
|
||||
return keytable[totalprims - linknum].ToString();
|
||||
if (linknum == ScriptBaseClass.LINK_THIS)
|
||||
return m_host.UUID.ToString();
|
||||
else
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
}
|
||||
|
||||
if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && keytable.Count == 1)
|
||||
{
|
||||
return m_host.UUID.ToString();
|
||||
}
|
||||
int actualPrimCount = m_host.ParentGroup.PrimCount;
|
||||
List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars();
|
||||
int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count;
|
||||
|
||||
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum);
|
||||
if (part != null)
|
||||
// Special case for a single prim. In this case the linknum is zero. However, this will not match a single
|
||||
// prim that has any avatars sat upon it (in which case the root prim is link 1).
|
||||
if (linknum == 0)
|
||||
{
|
||||
return part.UUID.ToString();
|
||||
if (actualPrimCount == 1 && sittingAvatarIds.Count == 0)
|
||||
return m_host.UUID.ToString();
|
||||
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
}
|
||||
// Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but
|
||||
// here we must match 1 (ScriptBaseClass.LINK_ROOT).
|
||||
else if (linknum == 1 && actualPrimCount == 1)
|
||||
{
|
||||
if (sittingAvatarIds.Count > 0)
|
||||
return m_host.ParentGroup.RootPart.UUID.ToString();
|
||||
else
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
}
|
||||
else if (linknum <= adjustedPrimCount)
|
||||
{
|
||||
if (linknum <= actualPrimCount)
|
||||
return m_host.ParentGroup.GetLinkNumPart(linknum).UUID.ToString();
|
||||
else
|
||||
return sittingAvatarIds[linknum - actualPrimCount - 1].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return UUID.Zero.ToString();
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3808,62 +3817,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public LSL_String llGetLinkName(int linknum)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
// simplest case, this prims link number
|
||||
if (linknum == m_host.LinkNum || linknum == ScriptBaseClass.LINK_THIS)
|
||||
return m_host.Name;
|
||||
|
||||
// parse for sitting avatare-names
|
||||
List<String> nametable = new List<String>();
|
||||
World.ForEachRootScenePresence(delegate(ScenePresence presence)
|
||||
if (linknum < 0)
|
||||
{
|
||||
SceneObjectPart sitPart = presence.ParentPart;
|
||||
if (sitPart != null && m_host.ParentGroup.ContainsPart(sitPart.LocalId))
|
||||
nametable.Add(presence.ControllingClient.Name);
|
||||
});
|
||||
|
||||
int totalprims = m_host.ParentGroup.PrimCount + nametable.Count;
|
||||
if (totalprims > m_host.ParentGroup.PrimCount)
|
||||
{
|
||||
// sitting Avatar-Name with negativ linknum / SinglePrim
|
||||
if (linknum < 0 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
|
||||
return nametable[0];
|
||||
// Prim-Name / SinglePrim Sitting Avatar
|
||||
if (linknum == 1 && m_host.ParentGroup.PrimCount == 1 && nametable.Count == 1)
|
||||
return m_host.Name;
|
||||
// LinkNumber > of Real PrimSet = AvatarName
|
||||
if (linknum > m_host.ParentGroup.PrimCount && linknum <= totalprims)
|
||||
return nametable[totalprims - linknum];
|
||||
}
|
||||
|
||||
// Single prim
|
||||
if (m_host.LinkNum == 0)
|
||||
{
|
||||
if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT)
|
||||
if (linknum == ScriptBaseClass.LINK_THIS)
|
||||
return m_host.Name;
|
||||
else
|
||||
return UUID.Zero.ToString();
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
}
|
||||
|
||||
// Link set
|
||||
SceneObjectPart part = null;
|
||||
if (m_host.LinkNum == 1) // this is the Root prim
|
||||
int actualPrimCount = m_host.ParentGroup.PrimCount;
|
||||
List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars();
|
||||
int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count;
|
||||
|
||||
// Special case for a single prim. In this case the linknum is zero. However, this will not match a single
|
||||
// prim that has any avatars sat upon it (in which case the root prim is link 1).
|
||||
if (linknum == 0)
|
||||
{
|
||||
if (linknum < 0)
|
||||
part = m_host.ParentGroup.GetLinkNumPart(2);
|
||||
else
|
||||
part = m_host.ParentGroup.GetLinkNumPart(linknum);
|
||||
if (actualPrimCount == 1 && sittingAvatarIds.Count == 0)
|
||||
return m_host.Name;
|
||||
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
}
|
||||
else // this is a child prim
|
||||
// Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but
|
||||
// here we must match 1 (ScriptBaseClass.LINK_ROOT).
|
||||
else if (linknum == 1 && actualPrimCount == 1)
|
||||
{
|
||||
if (linknum < 2)
|
||||
part = m_host.ParentGroup.GetLinkNumPart(1);
|
||||
if (sittingAvatarIds.Count > 0)
|
||||
return m_host.ParentGroup.RootPart.Name;
|
||||
else
|
||||
part = m_host.ParentGroup.GetLinkNumPart(linknum);
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
}
|
||||
else if (linknum <= adjustedPrimCount)
|
||||
{
|
||||
if (linknum <= actualPrimCount)
|
||||
{
|
||||
return m_host.ParentGroup.GetLinkNumPart(linknum).Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]);
|
||||
if (sp != null)
|
||||
return sp.Name;
|
||||
else
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
}
|
||||
}
|
||||
if (part != null)
|
||||
return part.Name;
|
||||
else
|
||||
return UUID.Zero.ToString();
|
||||
{
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
public LSL_Integer llGetInventoryNumber(int type)
|
||||
@@ -5418,9 +5421,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Insert the list identified by <src> into the
|
||||
/// list designated by <dest> such that the first
|
||||
/// new element has the index specified by <index>
|
||||
/// Insert the list identified by <paramref name="src"/> into the
|
||||
/// list designated by <paramref name="dest"/> such that the first
|
||||
/// new element has the index specified by <paramref name="index"/>
|
||||
/// </summary>
|
||||
|
||||
public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index)
|
||||
@@ -5774,13 +5777,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (parcelOwned && land.LandData.OwnerID == id ||
|
||||
parcel && land.LandData.GlobalID == id)
|
||||
{
|
||||
result.Add(ssp.UUID.ToString());
|
||||
result.Add(new LSL_Key(ssp.UUID.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(ssp.UUID.ToString());
|
||||
result.Add(new LSL_Key(ssp.UUID.ToString()));
|
||||
}
|
||||
}
|
||||
// Maximum of 100 results
|
||||
@@ -6198,6 +6201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
ps.BurstSpeedMax = 1.0f;
|
||||
ps.BurstRate = 0.1f;
|
||||
ps.PartMaxAge = 10.0f;
|
||||
ps.BurstPartCount = 1;
|
||||
return ps;
|
||||
}
|
||||
|
||||
@@ -6219,9 +6223,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
SetParticleSystem(m_host, rules);
|
||||
}
|
||||
|
||||
private void SetParticleSystem(SceneObjectPart part, LSL_List rules) {
|
||||
|
||||
|
||||
private void SetParticleSystem(SceneObjectPart part, LSL_List rules)
|
||||
{
|
||||
if (rules.Length == 0)
|
||||
{
|
||||
part.RemoveParticleSystem();
|
||||
@@ -7881,14 +7884,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public LSL_Integer llGetNumberOfPrims()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
int avatarCount = 0;
|
||||
World.ForEachRootScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
if (presence.ParentID != 0 && m_host.ParentGroup.ContainsPart(presence.ParentID))
|
||||
avatarCount++;
|
||||
});
|
||||
|
||||
return m_host.ParentGroup.PrimCount + avatarCount;
|
||||
return m_host.ParentGroup.PrimCount + m_host.ParentGroup.GetSittingAvatarsCount();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -10577,6 +10574,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
case ScriptBaseClass.OBJECT_PHYSICS_COST:
|
||||
ret.Add(new LSL_Float(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
|
||||
ret.Add(new LSL_Float(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_ROOT:
|
||||
SceneObjectPart p = av.ParentPart;
|
||||
if (p != null)
|
||||
{
|
||||
ret.Add(new LSL_String(p.ParentGroup.RootPart.UUID.ToString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.Add(new LSL_String(id));
|
||||
}
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_ATTACHED_POINT:
|
||||
ret.Add(new LSL_Integer(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding
|
||||
ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_PHYSICS:
|
||||
ret.Add(new LSL_Integer(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_PHANTOM:
|
||||
ret.Add(new LSL_Integer(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
|
||||
ret.Add(new LSL_Integer(0));
|
||||
break;
|
||||
default:
|
||||
// Invalid or unhandled constant.
|
||||
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
||||
@@ -10672,6 +10698,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
// The value returned in SL for normal prims looks like the prim count
|
||||
ret.Add(new LSL_Float(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding
|
||||
ret.Add(new LSL_Float(0));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_ROOT:
|
||||
ret.Add(new LSL_String(obj.ParentGroup.RootPart.UUID.ToString()));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_ATTACHED_POINT:
|
||||
ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_PATHFINDING_TYPE:
|
||||
byte pcode = obj.Shape.PCode;
|
||||
if (obj.ParentGroup.AttachmentPoint != 0
|
||||
|| pcode == (byte)PCode.Grass
|
||||
|| pcode == (byte)PCode.Tree
|
||||
|| pcode == (byte)PCode.NewTree)
|
||||
{
|
||||
ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET));
|
||||
}
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_PHYSICS:
|
||||
if (obj.ParentGroup.AttachmentPoint != 0)
|
||||
{
|
||||
ret.Add(new LSL_Integer(0)); // Always false if attached
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0));
|
||||
}
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_PHANTOM:
|
||||
if (obj.ParentGroup.AttachmentPoint != 0)
|
||||
{
|
||||
ret.Add(new LSL_Integer(0)); // Always false if attached
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0));
|
||||
}
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
|
||||
ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0));
|
||||
break;
|
||||
default:
|
||||
// Invalid or unhandled constant.
|
||||
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
|
||||
@@ -11520,7 +11592,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
/// Get a notecard line.
|
||||
/// </summary>
|
||||
/// <param name="assetID"></param>
|
||||
/// <param name="line">Lines start at index 0</param>
|
||||
/// <param name="lineNumber">Lines start at index 0</param>
|
||||
/// <returns></returns>
|
||||
public static string GetLine(UUID assetID, int lineNumber)
|
||||
{
|
||||
@@ -11549,9 +11621,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
/// Get a notecard line.
|
||||
/// </summary>
|
||||
/// <param name="assetID"></param>
|
||||
/// <param name="line">Lines start at index 0</param>
|
||||
/// <param name="maxLength">Maximum length of the returned line. Longer lines will be truncated</para>
|
||||
/// <returns></returns>
|
||||
/// <param name="lineNumber">Lines start at index 0</param>
|
||||
/// <param name="maxLength">
|
||||
/// Maximum length of the returned line.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// If the line length is longer than <paramref name="maxLength"/>,
|
||||
/// the return string will be truncated.
|
||||
/// </returns>
|
||||
public static string GetLine(UUID assetID, int lineNumber, int maxLength)
|
||||
{
|
||||
string line = GetLine(assetID, lineNumber);
|
||||
|
||||
@@ -974,7 +974,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (animID == UUID.Zero)
|
||||
target.Animator.RemoveAnimation(animation);
|
||||
else
|
||||
target.Animator.RemoveAnimation(animID);
|
||||
target.Animator.RemoveAnimation(animID, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Used by one-off and repeated sensors
|
||||
/// </summary>
|
||||
public class SensorInfo
|
||||
{
|
||||
public uint localID;
|
||||
public UUID itemID;
|
||||
public double interval;
|
||||
public DateTime next;
|
||||
|
||||
public string name;
|
||||
public UUID keyID;
|
||||
public int type;
|
||||
public double range;
|
||||
public double arc;
|
||||
public SceneObjectPart host;
|
||||
|
||||
public SensorInfo Clone()
|
||||
{
|
||||
return (SensorInfo)this.MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
/// <summary>
|
||||
@@ -78,24 +101,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
private double maximumRange = 96.0;
|
||||
private int maximumToReturn = 16;
|
||||
|
||||
//
|
||||
// SenseRepeater and Sensors
|
||||
//
|
||||
private class SenseRepeatClass
|
||||
{
|
||||
public uint localID;
|
||||
public UUID itemID;
|
||||
public double interval;
|
||||
public DateTime next;
|
||||
|
||||
public string name;
|
||||
public UUID keyID;
|
||||
public int type;
|
||||
public double range;
|
||||
public double arc;
|
||||
public SceneObjectPart host;
|
||||
}
|
||||
|
||||
//
|
||||
// Sensed entity
|
||||
//
|
||||
@@ -128,7 +133,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
///
|
||||
/// Always lock SenseRepeatListLock when updating this list.
|
||||
/// </remarks>
|
||||
private List<SenseRepeatClass> SenseRepeaters = new List<SenseRepeatClass>();
|
||||
private List<SensorInfo> SenseRepeaters = new List<SensorInfo>();
|
||||
private object SenseRepeatListLock = new object();
|
||||
|
||||
public void SetSenseRepeatEvent(uint m_localID, UUID m_itemID,
|
||||
@@ -142,7 +147,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
return;
|
||||
|
||||
// Add to timer
|
||||
SenseRepeatClass ts = new SenseRepeatClass();
|
||||
SensorInfo ts = new SensorInfo();
|
||||
ts.localID = m_localID;
|
||||
ts.itemID = m_itemID;
|
||||
ts.interval = sec;
|
||||
@@ -161,11 +166,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
AddSenseRepeater(ts);
|
||||
}
|
||||
|
||||
private void AddSenseRepeater(SenseRepeatClass senseRepeater)
|
||||
private void AddSenseRepeater(SensorInfo senseRepeater)
|
||||
{
|
||||
lock (SenseRepeatListLock)
|
||||
{
|
||||
List<SenseRepeatClass> newSenseRepeaters = new List<SenseRepeatClass>(SenseRepeaters);
|
||||
List<SensorInfo> newSenseRepeaters = new List<SensorInfo>(SenseRepeaters);
|
||||
newSenseRepeaters.Add(senseRepeater);
|
||||
SenseRepeaters = newSenseRepeaters;
|
||||
}
|
||||
@@ -176,8 +181,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
// Remove from timer
|
||||
lock (SenseRepeatListLock)
|
||||
{
|
||||
List<SenseRepeatClass> newSenseRepeaters = new List<SenseRepeatClass>();
|
||||
foreach (SenseRepeatClass ts in SenseRepeaters)
|
||||
List<SensorInfo> newSenseRepeaters = new List<SensorInfo>();
|
||||
foreach (SensorInfo ts in SenseRepeaters)
|
||||
{
|
||||
if (ts.localID != m_localID || ts.itemID != m_itemID)
|
||||
{
|
||||
@@ -192,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
public void CheckSenseRepeaterEvents()
|
||||
{
|
||||
// Go through all timers
|
||||
foreach (SenseRepeatClass ts in SenseRepeaters)
|
||||
foreach (SensorInfo ts in SenseRepeaters)
|
||||
{
|
||||
// Time has passed?
|
||||
if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
|
||||
@@ -209,7 +214,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
double range, double arc, SceneObjectPart host)
|
||||
{
|
||||
// Add to timer
|
||||
SenseRepeatClass ts = new SenseRepeatClass();
|
||||
SensorInfo ts = new SensorInfo();
|
||||
ts.localID = m_localID;
|
||||
ts.itemID = m_itemID;
|
||||
ts.interval = 0;
|
||||
@@ -225,7 +230,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
SensorSweep(ts);
|
||||
}
|
||||
|
||||
private void SensorSweep(SenseRepeatClass ts)
|
||||
private void SensorSweep(SensorInfo ts)
|
||||
{
|
||||
if (ts.host == null)
|
||||
{
|
||||
@@ -301,7 +306,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
}
|
||||
}
|
||||
|
||||
private List<SensedEntity> doObjectSensor(SenseRepeatClass ts)
|
||||
private List<SensedEntity> doObjectSensor(SensorInfo ts)
|
||||
{
|
||||
List<EntityBase> Entities;
|
||||
List<SensedEntity> sensedEntities = new List<SensedEntity>();
|
||||
@@ -450,7 +455,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
return sensedEntities;
|
||||
}
|
||||
|
||||
private List<SensedEntity> doAgentSensor(SenseRepeatClass ts)
|
||||
private List<SensedEntity> doAgentSensor(SensorInfo ts)
|
||||
{
|
||||
List<SensedEntity> sensedEntities = new List<SensedEntity>();
|
||||
|
||||
@@ -626,7 +631,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
{
|
||||
List<Object> data = new List<Object>();
|
||||
|
||||
foreach (SenseRepeatClass ts in SenseRepeaters)
|
||||
foreach (SensorInfo ts in SenseRepeaters)
|
||||
{
|
||||
if (ts.itemID == itemID)
|
||||
{
|
||||
@@ -656,7 +661,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
|
||||
while (idx < data.Length)
|
||||
{
|
||||
SenseRepeatClass ts = new SenseRepeatClass();
|
||||
SensorInfo ts = new SensorInfo();
|
||||
|
||||
ts.localID = localID;
|
||||
ts.itemID = itemID;
|
||||
@@ -677,5 +682,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
idx += 6;
|
||||
}
|
||||
}
|
||||
|
||||
public List<SensorInfo> GetSensorInfo()
|
||||
{
|
||||
List<SensorInfo> retList = new List<SensorInfo>();
|
||||
|
||||
lock (SenseRepeatListLock)
|
||||
{
|
||||
foreach (SensorInfo i in SenseRepeaters)
|
||||
retList.Add(i.Clone());
|
||||
}
|
||||
|
||||
return retList;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
{
|
||||
public class Timer
|
||||
{
|
||||
public class TimerInfo
|
||||
{
|
||||
public uint localID;
|
||||
public UUID itemID;
|
||||
//public double interval;
|
||||
public long interval;
|
||||
//public DateTime next;
|
||||
public long next;
|
||||
|
||||
public TimerInfo Clone()
|
||||
{
|
||||
return (TimerInfo)this.MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
public int TimersCount
|
||||
@@ -59,17 +74,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
return localID.ToString() + itemID.ToString();
|
||||
}
|
||||
|
||||
private class TimerClass
|
||||
{
|
||||
public uint localID;
|
||||
public UUID itemID;
|
||||
//public double interval;
|
||||
public long interval;
|
||||
//public DateTime next;
|
||||
public long next;
|
||||
}
|
||||
|
||||
private Dictionary<string,TimerClass> Timers = new Dictionary<string,TimerClass>();
|
||||
private Dictionary<string,TimerInfo> Timers = new Dictionary<string,TimerInfo>();
|
||||
private object TimerListLock = new object();
|
||||
|
||||
public void SetTimerEvent(uint m_localID, UUID m_itemID, double sec)
|
||||
@@ -81,7 +86,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
}
|
||||
|
||||
// Add to timer
|
||||
TimerClass ts = new TimerClass();
|
||||
TimerInfo ts = new TimerInfo();
|
||||
ts.localID = m_localID;
|
||||
ts.itemID = m_itemID;
|
||||
ts.interval = Convert.ToInt64(sec * 10000000); // How many 100 nanoseconds (ticks) should we wait
|
||||
@@ -121,8 +126,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
lock (TimerListLock)
|
||||
{
|
||||
// Go through all timers
|
||||
Dictionary<string, TimerClass>.ValueCollection tvals = Timers.Values;
|
||||
foreach (TimerClass ts in tvals)
|
||||
Dictionary<string, TimerInfo>.ValueCollection tvals = Timers.Values;
|
||||
foreach (TimerInfo ts in tvals)
|
||||
{
|
||||
// Time has passed?
|
||||
if (ts.next < DateTime.Now.Ticks)
|
||||
@@ -147,8 +152,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
|
||||
lock (TimerListLock)
|
||||
{
|
||||
Dictionary<string, TimerClass>.ValueCollection tvals = Timers.Values;
|
||||
foreach (TimerClass ts in tvals)
|
||||
Dictionary<string, TimerInfo>.ValueCollection tvals = Timers.Values;
|
||||
foreach (TimerInfo ts in tvals)
|
||||
{
|
||||
if (ts.itemID == itemID)
|
||||
{
|
||||
@@ -167,7 +172,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
|
||||
while (idx < data.Length)
|
||||
{
|
||||
TimerClass ts = new TimerClass();
|
||||
TimerInfo ts = new TimerInfo();
|
||||
|
||||
ts.localID = localID;
|
||||
ts.itemID = itemID;
|
||||
@@ -181,5 +186,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<TimerInfo> GetTimersInfo()
|
||||
{
|
||||
List<TimerInfo> retList = new List<TimerInfo>();
|
||||
|
||||
lock (TimerListLock)
|
||||
{
|
||||
foreach (TimerInfo i in Timers.Values)
|
||||
retList.Add(i.Clone());
|
||||
}
|
||||
|
||||
return retList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,6 +556,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
public const int OBJECT_SERVER_COST = 14;
|
||||
public const int OBJECT_STREAMING_COST = 15;
|
||||
public const int OBJECT_PHYSICS_COST = 16;
|
||||
public const int OBJECT_CHARACTER_TIME = 17;
|
||||
public const int OBJECT_ROOT = 18;
|
||||
public const int OBJECT_ATTACHED_POINT = 19;
|
||||
public const int OBJECT_PATHFINDING_TYPE = 20;
|
||||
public const int OBJECT_PHYSICS = 21;
|
||||
public const int OBJECT_PHANTOM = 22;
|
||||
public const int OBJECT_TEMP_ON_REZ = 23;
|
||||
|
||||
// Pathfinding types
|
||||
public const int OPT_OTHER = -1;
|
||||
public const int OPT_LEGACY_LINKSET = 0;
|
||||
public const int OPT_AVATAR = 1;
|
||||
public const int OPT_CHARACTER = 2;
|
||||
public const int OPT_WALKABLE = 3;
|
||||
public const int OPT_STATIC_OBSTACLE = 4;
|
||||
public const int OPT_MATERIAL_VOLUME = 5;
|
||||
public const int OPT_EXCLUSION_VOLUME = 6;
|
||||
|
||||
// for llGetAgentList
|
||||
public const int AGENT_LIST_PARCEL = 1;
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* 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.Collections.Generic;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
{
|
||||
public class ScriptEngineConsoleCommands
|
||||
{
|
||||
IScriptEngine m_engine;
|
||||
|
||||
public ScriptEngineConsoleCommands(IScriptEngine engine)
|
||||
{
|
||||
m_engine = engine;
|
||||
}
|
||||
|
||||
public void RegisterCommands()
|
||||
{
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Scripts", false, "show script sensors", "show script sensors", "Show script sensors information",
|
||||
HandleShowSensors);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Scripts", false, "show script timers", "show script timers", "Show script sensors information",
|
||||
HandleShowTimers);
|
||||
}
|
||||
|
||||
private bool IsSceneSelected()
|
||||
{
|
||||
return MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_engine.World;
|
||||
}
|
||||
|
||||
private void HandleShowSensors(string module, string[] cmdparams)
|
||||
{
|
||||
if (!IsSceneSelected())
|
||||
return;
|
||||
|
||||
SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(m_engine);
|
||||
|
||||
if (sr == null)
|
||||
{
|
||||
MainConsole.Instance.Output("Plugin not yet initialized");
|
||||
return;
|
||||
}
|
||||
|
||||
List<SensorRepeat.SensorInfo> sensorInfo = sr.GetSensorInfo();
|
||||
|
||||
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
|
||||
cdt.AddColumn("Part name", 40);
|
||||
cdt.AddColumn("Script item ID", 36);
|
||||
cdt.AddColumn("Type", 4);
|
||||
cdt.AddColumn("Interval", 8);
|
||||
cdt.AddColumn("Range", 8);
|
||||
cdt.AddColumn("Arc", 8);
|
||||
|
||||
foreach (SensorRepeat.SensorInfo s in sensorInfo)
|
||||
{
|
||||
cdt.AddRow(s.host.Name, s.itemID, s.type, s.interval, s.range, s.arc);
|
||||
}
|
||||
|
||||
MainConsole.Instance.Output(cdt.ToString());
|
||||
MainConsole.Instance.OutputFormat("Total: {0}", sensorInfo.Count);
|
||||
}
|
||||
|
||||
private void HandleShowTimers(string module, string[] cmdparams)
|
||||
{
|
||||
if (!IsSceneSelected())
|
||||
return;
|
||||
|
||||
Timer timerPlugin = AsyncCommandManager.GetTimerPlugin(m_engine);
|
||||
|
||||
if (timerPlugin == null)
|
||||
{
|
||||
MainConsole.Instance.Output("Plugin not yet initialized");
|
||||
return;
|
||||
}
|
||||
|
||||
List<Timer.TimerInfo> timersInfo = timerPlugin.GetTimersInfo();
|
||||
|
||||
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
|
||||
cdt.AddColumn("Part local ID", 13);
|
||||
cdt.AddColumn("Script item ID", 36);
|
||||
cdt.AddColumn("Interval", 10);
|
||||
cdt.AddColumn("Next", 8);
|
||||
|
||||
foreach (Timer.TimerInfo t in timersInfo)
|
||||
{
|
||||
// Convert from 100 ns ticks back to seconds
|
||||
cdt.AddRow(t.localID, t.itemID, (double)t.interval / 10000000, t.next);
|
||||
}
|
||||
|
||||
MainConsole.Instance.Output(cdt.ToString());
|
||||
MainConsole.Instance.OutputFormat("Total: {0}", timersInfo.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,6 +169,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
IWorkItemResult m_CurrentCompile = null;
|
||||
private Dictionary<UUID, int> m_CompileDict = new Dictionary<UUID, int>();
|
||||
|
||||
private ScriptEngineConsoleCommands m_consoleCommands;
|
||||
|
||||
public string ScriptEngineName
|
||||
{
|
||||
get { return "XEngine"; }
|
||||
@@ -318,50 +320,53 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
OnObjectRemoved += m_XmlRpcRouter.ObjectRemoved;
|
||||
}
|
||||
|
||||
m_consoleCommands = new ScriptEngineConsoleCommands(this);
|
||||
m_consoleCommands.RegisterCommands();
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Scripts", false, "xengine status", "xengine status", "Show status information",
|
||||
"Show status information on the script engine.",
|
||||
HandleShowStatus);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Scripts", false, "scripts show", "scripts show [<script-item-uuid>]", "Show script information",
|
||||
"Scripts", false, "scripts show", "scripts show [<script-item-uuid>+]", "Show script information",
|
||||
"Show information on all scripts known to the script engine.\n"
|
||||
+ "If a <script-item-uuid> is given then only information on that script will be shown.",
|
||||
+ "If one or more <script-item-uuid>s are given then only information on that script will be shown.",
|
||||
HandleShowScripts);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Scripts", false, "show scripts", "show scripts [<script-item-uuid>]", "Show script information",
|
||||
"Scripts", false, "show scripts", "show scripts [<script-item-uuid>+]", "Show script information",
|
||||
"Synonym for scripts show command", HandleShowScripts);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Scripts", false, "scripts suspend", "scripts suspend [<script-item-uuid>]", "Suspends all running scripts",
|
||||
"Scripts", false, "scripts suspend", "scripts suspend [<script-item-uuid>+]", "Suspends all running scripts",
|
||||
"Suspends all currently running scripts. This only suspends event delivery, it will not suspend a"
|
||||
+ " script that is currently processing an event.\n"
|
||||
+ "Suspended scripts will continue to accumulate events but won't process them.\n"
|
||||
+ "If a <script-item-uuid> is given then only that script will be suspended. Otherwise, all suitable scripts are suspended.",
|
||||
+ "If one or more <script-item-uuid>s are given then only that script will be suspended. Otherwise, all suitable scripts are suspended.",
|
||||
(module, cmdparams) => HandleScriptsAction(cmdparams, HandleSuspendScript));
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Scripts", false, "scripts resume", "scripts resume [<script-item-uuid>]", "Resumes all suspended scripts",
|
||||
"Scripts", false, "scripts resume", "scripts resume [<script-item-uuid>+]", "Resumes all suspended scripts",
|
||||
"Resumes all currently suspended scripts.\n"
|
||||
+ "Resumed scripts will process all events accumulated whilst suspended.\n"
|
||||
+ "If a <script-item-uuid> is given then only that script will be resumed. Otherwise, all suitable scripts are resumed.",
|
||||
+ "If one or more <script-item-uuid>s are given then only that script will be resumed. Otherwise, all suitable scripts are resumed.",
|
||||
(module, cmdparams) => HandleScriptsAction(cmdparams, HandleResumeScript));
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Scripts", false, "scripts stop", "scripts stop [<script-item-uuid>]", "Stops all running scripts",
|
||||
"Scripts", false, "scripts stop", "scripts stop [<script-item-uuid>+]", "Stops all running scripts",
|
||||
"Stops all running scripts.\n"
|
||||
+ "If a <script-item-uuid> is given then only that script will be stopped. Otherwise, all suitable scripts are stopped.",
|
||||
+ "If one or more <script-item-uuid>s are given then only that script will be stopped. Otherwise, all suitable scripts are stopped.",
|
||||
(module, cmdparams) => HandleScriptsAction(cmdparams, HandleStopScript));
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Scripts", false, "scripts start", "scripts start [<script-item-uuid>]", "Starts all stopped scripts",
|
||||
"Scripts", false, "scripts start", "scripts start [<script-item-uuid>+]", "Starts all stopped scripts",
|
||||
"Starts all stopped scripts.\n"
|
||||
+ "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.",
|
||||
+ "If one or more <script-item-uuid>s are given then only that script will be started. Otherwise, all suitable scripts are started.",
|
||||
(module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript));
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Scripts", false, "debug script log", "debug scripts log <item-id> <log-level>", "Extra debug logging for a script",
|
||||
"Scripts", false, "debug scripts log", "debug scripts log <item-id> <log-level>", "Extra debug logging for a script",
|
||||
"Activates or deactivates extra debug logging for the given script.\n"
|
||||
+ "Level == 0, deactivate extra debug logging.\n"
|
||||
+ "Level >= 1, log state changes.\n"
|
||||
@@ -478,29 +483,31 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
return;
|
||||
}
|
||||
|
||||
rawItemId = cmdparams[2];
|
||||
|
||||
if (!UUID.TryParse(rawItemId, out itemId))
|
||||
for (int i = 2; i < cmdparams.Length; i++)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid UUID", rawItemId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemId != UUID.Zero)
|
||||
{
|
||||
IScriptInstance instance = GetInstance(itemId);
|
||||
if (instance == null)
|
||||
rawItemId = cmdparams[i];
|
||||
|
||||
if (!UUID.TryParse(rawItemId, out itemId))
|
||||
{
|
||||
// Commented out for now since this will cause false reports on simulators with more than
|
||||
// one scene where the current command line set region is 'root' (which causes commands to
|
||||
// go to both regions... (sigh)
|
||||
// MainConsole.Instance.OutputFormat("Error - No item found with id {0}", itemId);
|
||||
return;
|
||||
MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid UUID", rawItemId);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
|
||||
if (itemId != UUID.Zero)
|
||||
{
|
||||
action(instance);
|
||||
return;
|
||||
IScriptInstance instance = GetInstance(itemId);
|
||||
if (instance == null)
|
||||
{
|
||||
// Commented out for now since this will cause false reports on simulators with more than
|
||||
// one scene where the current command line set region is 'root' (which causes commands to
|
||||
// go to both regions... (sigh)
|
||||
// MainConsole.Instance.OutputFormat("Error - No item found with id {0}", itemId);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
action(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1479,7 +1486,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
m_MaxScriptQueue = maxScriptQueue;
|
||||
|
||||
STPStartInfo startInfo = new STPStartInfo();
|
||||
startInfo.IdleTimeout = idleTimeout*1000; // convert to seconds as stated in .ini
|
||||
startInfo.ThreadPoolName = "XEngine";
|
||||
startInfo.IdleTimeout = idleTimeout * 1000; // convert to seconds as stated in .ini
|
||||
startInfo.MaxWorkerThreads = maxThreads;
|
||||
startInfo.MinWorkerThreads = minThreads;
|
||||
startInfo.ThreadPriority = threadPriority;;
|
||||
@@ -1487,7 +1495,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
startInfo.StartSuspended = true;
|
||||
|
||||
m_ThreadPool = new SmartThreadPool(startInfo);
|
||||
m_ThreadPool.Name = "XEngine";
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -280,8 +280,11 @@ namespace OpenSim.Server.Base
|
||||
{
|
||||
if (!(e is System.MissingMethodException))
|
||||
{
|
||||
m_log.ErrorFormat("Error loading plugin {0} from {1}. Exception: {2}",
|
||||
interfaceName, dllName, e.InnerException == null ? e.Message : e.InnerException.Message);
|
||||
m_log.ErrorFormat("Error loading plugin {0} from {1}. Exception: {2}, {3}",
|
||||
interfaceName,
|
||||
dllName,
|
||||
e.InnerException == null ? e.Message : e.InnerException.Message,
|
||||
e.StackTrace);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
14
ThirdParty/SmartThreadPool/STPStartInfo.cs
vendored
14
ThirdParty/SmartThreadPool/STPStartInfo.cs
vendored
@@ -32,6 +32,11 @@ namespace Amib.Threading
|
||||
/// </summary>
|
||||
private ThreadPriority _threadPriority;
|
||||
|
||||
/// <summary>
|
||||
/// The thread pool name. Threads will get names depending on this.
|
||||
/// </summary>
|
||||
private string _threadPoolName;
|
||||
|
||||
/// <summary>
|
||||
/// If this field is not null then the performance counters are enabled
|
||||
/// and use the string as the name of the instance.
|
||||
@@ -46,6 +51,7 @@ namespace Amib.Threading
|
||||
_minWorkerThreads = SmartThreadPool.DefaultMinWorkerThreads;
|
||||
_maxWorkerThreads = SmartThreadPool.DefaultMaxWorkerThreads;
|
||||
_threadPriority = SmartThreadPool.DefaultThreadPriority;
|
||||
_threadPoolName = SmartThreadPool.DefaultThreadPoolName;
|
||||
_pcInstanceName = SmartThreadPool.DefaultPerformanceCounterInstanceName;
|
||||
_stackSize = SmartThreadPool.DefaultStackSize;
|
||||
}
|
||||
@@ -56,6 +62,7 @@ namespace Amib.Threading
|
||||
_minWorkerThreads = stpStartInfo._minWorkerThreads;
|
||||
_maxWorkerThreads = stpStartInfo._maxWorkerThreads;
|
||||
_threadPriority = stpStartInfo._threadPriority;
|
||||
_threadPoolName = stpStartInfo._threadPoolName;
|
||||
_pcInstanceName = stpStartInfo._pcInstanceName;
|
||||
_stackSize = stpStartInfo._stackSize;
|
||||
}
|
||||
@@ -84,6 +91,13 @@ namespace Amib.Threading
|
||||
set { _threadPriority = value; }
|
||||
}
|
||||
|
||||
public virtual string ThreadPoolName
|
||||
{
|
||||
get { return _threadPoolName; }
|
||||
set { _threadPoolName = value; }
|
||||
}
|
||||
|
||||
|
||||
public string PerformanceCounterInstanceName
|
||||
{
|
||||
get { return _pcInstanceName; }
|
||||
|
||||
@@ -135,6 +135,11 @@ namespace Amib.Threading
|
||||
/// </summary>
|
||||
public const ThreadPriority DefaultThreadPriority = ThreadPriority.Normal;
|
||||
|
||||
/// <summary>
|
||||
/// The default thread pool name
|
||||
/// </summary>
|
||||
public const string DefaultThreadPoolName = "SmartThreadPool";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Member Variables
|
||||
@@ -143,7 +148,7 @@ namespace Amib.Threading
|
||||
/// Contains the name of this instance of SmartThreadPool.
|
||||
/// Can be changed by the user.
|
||||
/// </summary>
|
||||
private string _name = "SmartThreadPool";
|
||||
private string _name = DefaultThreadPoolName;
|
||||
|
||||
/// <summary>
|
||||
/// Hashtable of all the threads in the thread pool.
|
||||
@@ -307,6 +312,7 @@ namespace Amib.Threading
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
Name = _stpStartInfo.ThreadPoolName;
|
||||
ValidateSTPStartInfo();
|
||||
|
||||
if (null != _stpStartInfo.PerformanceCounterInstanceName)
|
||||
|
||||
1276
doc/doxygen.conf
1276
doc/doxygen.conf
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user