Compare commits
116 Commits
master
...
0.7.3-post
Author | SHA1 | Date |
---|---|---|
Justin Clark-Casey (justincc) | 911e751019 | |
Justin Clark-Casey (justincc) | 27f3f71a24 | |
Justin Clark-Casey (justincc) | e0cb9a5d27 | |
Justin Clark-Casey (justincc) | 9d00fba777 | |
Justin Clark-Casey (justincc) | 0c5437e021 | |
Justin Clark-Casey (justincc) | e391bdab22 | |
Justin Clark-Casey (justincc) | b13ddfc590 | |
Melanie | c83a80d847 | |
Melanie | 96e8795382 | |
Justin Clark-Casey (justincc) | 487a6f3d15 | |
Justin Clark-Casey (justincc) | 906f6820c7 | |
nebadon | 8dea2c8e40 | |
Justin Clark-Casey (justincc) | de667ea00a | |
Justin Clark-Casey (justincc) | 88b2247d94 | |
Justin Clark-Casey (justincc) | 54ee59c0bb | |
Justin Clark-Casey (justincc) | 4a5c61a33d | |
Diva Canto | 179c0f5f56 | |
Justin Clark-Casey (justincc) | 4dbf937707 | |
Justin Clark-Casey (justincc) | 9edb57e5e9 | |
Justin Clark-Casey (justincc) | 4d15ad63bf | |
Justin Clark-Casey (justincc) | 4021709371 | |
Justin Clark-Casey (justincc) | 3c13f5c3aa | |
Justin Clark-Casey (justincc) | 381517b451 | |
Justin Clark-Casey (justincc) | 6ecf36d49c | |
Justin Clark-Casey (justincc) | 64eb4b8408 | |
Diva Canto | 318da3fdcd | |
Melanie | 50c99fcda6 | |
Melanie | 321de1f263 | |
Diva Canto | fa30ace67d | |
Justin Clark-Casey (justincc) | 92baa79253 | |
Justin Clark-Casey (justincc) | e861b45313 | |
Justin Clark-Casey (justincc) | cf91ac68b6 | |
Justin Clark-Casey (justincc) | d4aba13526 | |
Justin Clark-Casey (justincc) | d36c7c3782 | |
Justin Clark-Casey (justincc) | 4385fcdeae | |
Justin Clark-Casey (justincc) | 04eb170624 | |
Justin Clark-Casey (justincc) | 4803686078 | |
Justin Clark-Casey (justincc) | 20b0fda3bb | |
Justin Clark-Casey (justincc) | 4e5f823595 | |
Justin Clark-Casey (justincc) | a74408d1d2 | |
Justin Clark-Casey (justincc) | 8206537efd | |
Justin Clark-Casey (justincc) | a9a77bb3ab | |
Justin Clark-Casey (justincc) | 6390de689d | |
Justin Clark-Casey (justincc) | 41ce19836b | |
Melanie | 883a4f6fff | |
Justin Clark-Casey (justincc) | 5f1da80fc1 | |
Justin Clark-Casey (justincc) | 64217d67f6 | |
Justin Clark-Casey (justincc) | b01c79354c | |
Justin Clark-Casey (justincc) | 9ecbcb787c | |
Justin Clark-Casey (justincc) | e17e376b04 | |
Justin Clark-Casey (justincc) | 1b4ea4f178 | |
Melanie | 1de29fb362 | |
Justin Clark-Casey (justincc) | 7e4bd492fd | |
Justin Clark-Casey (justincc) | 588d56503d | |
Justin Clark-Casey (justincc) | e9602656f8 | |
Justin Clark-Casey (justincc) | 0116d418f0 | |
Justin Clark-Casey (justincc) | 9992974c66 | |
Justin Clark-Casey (justincc) | ba27d8a389 | |
Justin Clark-Casey (justincc) | f96e985763 | |
Diva Canto | 5b9eaae50d | |
Diva Canto | 74a13f7e3b | |
Diva Canto | 3e88fc8aad | |
Diva Canto | 881740d702 | |
Diva Canto | 9a643a1bb9 | |
Diva Canto | a5488650ff | |
Diva Canto | a275127a65 | |
Diva Canto | 02db31db6a | |
Diva Canto | 8bd813e6fc | |
Diva Canto | 09ff121654 | |
Diva Canto | 0434758a0d | |
Diva Canto | 8bb0a71083 | |
Diva Canto | d7651a389e | |
Justin Clark-Casey (justincc) | 824318a0c1 | |
Justin Clark-Casey (justincc) | 5e9ed22e84 | |
Chris Hart | a6c611e7c9 | |
Diva Canto | 72b325f8b5 | |
Justin Clark-Casey (justincc) | 54d0514b13 | |
Justin Clark-Casey (justincc) | 58b1c3cec0 | |
Justin Clark-Casey (justincc) | 71641523a3 | |
Justin Clark-Casey (justincc) | 94c5e25c3b | |
Justin Clark-Casey (justincc) | 20bad0aa6c | |
Justin Clark-Casey (justincc) | e7f23a6218 | |
Justin Clark-Casey (justincc) | 25c29db8b6 | |
Justin Clark-Casey (justincc) | 1750fba9ce | |
PixelTomsen | b18e410586 | |
Justin Clark-Casey (justincc) | 38d5e1fab3 | |
Justin Clark-Casey (justincc) | 4180c32eb1 | |
Justin Clark-Casey (justincc) | 5115229fdf | |
Justin Clark-Casey (justincc) | e8f2d814e7 | |
Diva Canto | 1fda8c5a86 | |
Justin Clark-Casey (justincc) | 6b77b55d40 | |
Justin Clark-Casey (justincc) | 82cdb08c1f | |
Justin Clark-Casey (justincc) | dafcb3bcd7 | |
Diva Canto | 3259b1d1e0 | |
Diva Canto | 512910a51f | |
Diva Canto | fdda57cf10 | |
Diva Canto | ec8e34950d | |
Diva Canto | 93964ef3a4 | |
Diva Canto | 5c8af6a136 | |
PixelTomsen | 4d0c8aca05 | |
PixelTomsen | 8fc16ece96 | |
BlueWall | fcbb375e8f | |
BlueWall | 49c65279fa | |
BlueWall | 86e8a56fe1 | |
BlueWall | b199330682 | |
BlueWall | 7a7ebaebd1 | |
BlueWall | 164ae0b24b | |
Diva Canto | 7156545fca | |
Justin Clark-Casey (justincc) | 73a5abf4d9 | |
Justin Clark-Casey (justincc) | 630c8dc828 | |
Justin Clark-Casey (justincc) | 6de89246c2 | |
Justin Clark-Casey (justincc) | 96973a5778 | |
Justin Clark-Casey (justincc) | 96843f2b17 | |
Justin Clark-Casey (justincc) | 8a36f54cf4 | |
Justin Clark-Casey (justincc) | 1a14e660d2 | |
Justin Clark-Casey (justincc) | 2502aae5db |
|
@ -8,6 +8,24 @@
|
|||
<copy file="bin/OpenSim.ini.example" tofile="bin/OpenSim.ini"/>
|
||||
<copy file="bin/config-include/StandaloneCommon.ini.example" tofile="bin/config-include/StandaloneCommon.ini"/>
|
||||
<copy file="bin/config-include/FlotsamCache.ini.example" tofile="bin/config-include/FlotsamCache.ini"/>
|
||||
<!-- delete files generated by runprebuild.sh which had to be run in order to generate the build file for this target-->
|
||||
<delete>
|
||||
<fileset basedir="OpenSim">
|
||||
<include name="**/*.build"/>
|
||||
<include name="**/*.csproj*"/>
|
||||
<include name="**/*.dll.build"/>
|
||||
<include name="**/*.pidb"/>
|
||||
<exclude name="Tools/OpenSim.32BitLaunch/**"/>
|
||||
<exclude name="Tools/Robust.32BitLaunch/**"/>
|
||||
<exclude name="Tools/LaunchSLClient/**"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
<delete>
|
||||
<fileset>
|
||||
<include name="OpenSim.build"/>
|
||||
<include name="OpenSim.sln"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<property name="distbindir" value="distbin" />
|
||||
|
|
|
@ -101,18 +101,8 @@ namespace OpenSim.Capabilities.Handlers
|
|||
llsdItem.item_id = invItem.ID;
|
||||
llsdItem.name = invItem.Name;
|
||||
llsdItem.parent_id = invItem.Folder;
|
||||
|
||||
try
|
||||
{
|
||||
llsdItem.type = Utils.AssetTypeToString((AssetType)invItem.AssetType);
|
||||
llsdItem.inv_type = Utils.InventoryTypeToString((InventoryType)invItem.InvType);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[WEB FETCH INV DESC HANDLER]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}",
|
||||
invItem.AssetType, invItem.InvType, invItem.Name, e.Message);
|
||||
}
|
||||
llsdItem.type = invItem.AssetType;
|
||||
llsdItem.inv_type = invItem.InvType;
|
||||
|
||||
llsdItem.permissions = new LLSDPermissions();
|
||||
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
|
||||
|
@ -126,21 +116,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
|
||||
llsdItem.sale_info = new LLSDSaleInfo();
|
||||
llsdItem.sale_info.sale_price = invItem.SalePrice;
|
||||
switch (invItem.SaleType)
|
||||
{
|
||||
default:
|
||||
llsdItem.sale_info.sale_type = "not";
|
||||
break;
|
||||
case 1:
|
||||
llsdItem.sale_info.sale_type = "original";
|
||||
break;
|
||||
case 2:
|
||||
llsdItem.sale_info.sale_type = "copy";
|
||||
break;
|
||||
case 3:
|
||||
llsdItem.sale_info.sale_type = "contents";
|
||||
break;
|
||||
}
|
||||
llsdItem.sale_info.sale_type = invItem.SaleType;
|
||||
|
||||
return llsdItem;
|
||||
}
|
||||
|
|
|
@ -230,6 +230,11 @@ namespace OpenSim.Capabilities.Handlers
|
|||
}
|
||||
else
|
||||
{
|
||||
// Handle the case where no second range value was given. This is equivalent to requesting
|
||||
// the rest of the entity.
|
||||
if (end == -1)
|
||||
end = int.MaxValue;
|
||||
|
||||
end = Utils.Clamp(end, 0, texture.Data.Length - 1);
|
||||
start = Utils.Clamp(start, 0, end);
|
||||
int len = end - start + 1;
|
||||
|
@ -277,15 +282,43 @@ namespace OpenSim.Capabilities.Handlers
|
|||
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse a range header.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// As per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html,
|
||||
/// this obeys range headers with two values (e.g. 533-4165) and no second value (e.g. 533-).
|
||||
/// Where there is no value, -1 is returned.
|
||||
/// FIXME: Need to cover the case where only a second value is specified (e.g. -4165), probably by returning -1
|
||||
/// for start.</remarks>
|
||||
/// <returns></returns>
|
||||
/// <param name='header'></param>
|
||||
/// <param name='start'>Undefined if the parse fails.</param>
|
||||
/// <param name='end'>Undefined if the parse fails.</param>
|
||||
private bool TryParseRange(string header, out int start, out int end)
|
||||
{
|
||||
start = end = 0;
|
||||
|
||||
if (header.StartsWith("bytes="))
|
||||
{
|
||||
string[] rangeValues = header.Substring(6).Split('-');
|
||||
|
||||
if (rangeValues.Length == 2)
|
||||
{
|
||||
if (Int32.TryParse(rangeValues[0], out start) && Int32.TryParse(rangeValues[1], out end))
|
||||
if (!Int32.TryParse(rangeValues[0], out start))
|
||||
return false;
|
||||
|
||||
string rawEnd = rangeValues[1];
|
||||
|
||||
if (rawEnd == "")
|
||||
{
|
||||
end = -1;
|
||||
return true;
|
||||
}
|
||||
else if (Int32.TryParse(rawEnd, out end))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,11 +156,12 @@ namespace OpenSim.Capabilities.Handlers
|
|||
inv.Folders = new List<InventoryFolderBase>();
|
||||
inv.Items = new List<InventoryItemBase>();
|
||||
int version = 0;
|
||||
int descendents = 0;
|
||||
|
||||
inv
|
||||
= Fetch(
|
||||
invFetch.owner_id, invFetch.folder_id, invFetch.owner_id,
|
||||
invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version);
|
||||
invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version, out descendents);
|
||||
|
||||
if (inv.Folders != null)
|
||||
{
|
||||
|
@ -168,6 +169,8 @@ namespace OpenSim.Capabilities.Handlers
|
|||
{
|
||||
contents.categories.Array.Add(ConvertInventoryFolder(invFolder));
|
||||
}
|
||||
|
||||
descendents += inv.Folders.Count;
|
||||
}
|
||||
|
||||
if (inv.Items != null)
|
||||
|
@ -178,7 +181,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
}
|
||||
}
|
||||
|
||||
contents.descendents = contents.items.Array.Count + contents.categories.Array.Count;
|
||||
contents.descendents = descendents;
|
||||
contents.version = version;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
|
@ -206,7 +209,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
/// <returns>An empty InventoryCollection if the inventory look up failed</returns>
|
||||
private InventoryCollection Fetch(
|
||||
UUID agentID, UUID folderID, UUID ownerID,
|
||||
bool fetchFolders, bool fetchItems, int sortOrder, out int version)
|
||||
bool fetchFolders, bool fetchItems, int sortOrder, out int version, out int descendents)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
|
||||
|
@ -215,6 +218,8 @@ namespace OpenSim.Capabilities.Handlers
|
|||
// FIXME MAYBE: We're not handling sortOrder!
|
||||
|
||||
version = 0;
|
||||
descendents = 0;
|
||||
|
||||
InventoryFolderImpl fold;
|
||||
if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner)
|
||||
{
|
||||
|
@ -223,6 +228,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
InventoryCollection ret = new InventoryCollection();
|
||||
ret.Folders = new List<InventoryFolderBase>();
|
||||
ret.Items = fold.RequestListOfItems();
|
||||
descendents = ret.Folders.Count + ret.Items.Count;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -246,24 +252,73 @@ namespace OpenSim.Capabilities.Handlers
|
|||
|
||||
version = containingFolder.Version;
|
||||
|
||||
// if (fetchItems)
|
||||
if (fetchItems)
|
||||
{
|
||||
List<InventoryItemBase> itemsToReturn = contents.Items;
|
||||
List<InventoryItemBase> originalItems = new List<InventoryItemBase>(itemsToReturn);
|
||||
|
||||
// descendents must only include the links, not the linked items we add
|
||||
descendents = originalItems.Count;
|
||||
|
||||
// Second, add target items for links in this folder
|
||||
foreach (InventoryItemBase item in originalItems)
|
||||
{
|
||||
if (item.AssetType == (int)AssetType.Link)
|
||||
{
|
||||
InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
|
||||
|
||||
// Take care of genuinely broken links where the target doesn't exist
|
||||
// HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
|
||||
// but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
|
||||
// rather than having to keep track of every folder requested in the recursion.
|
||||
if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
|
||||
itemsToReturn.Insert(0, linkedItem);
|
||||
}
|
||||
}
|
||||
|
||||
// First, scan for folder links and add target items in those folders.
|
||||
foreach (InventoryItemBase item in originalItems)
|
||||
{
|
||||
if (item.AssetType == (int)AssetType.LinkFolder)
|
||||
{
|
||||
InventoryCollection linkedFolderContents = m_InventoryService.GetFolderContent(ownerID, item.AssetID);
|
||||
List<InventoryItemBase> links = linkedFolderContents.Items;
|
||||
|
||||
// Second, insert the links contained in this linked folder.
|
||||
itemsToReturn.InsertRange(0, links);
|
||||
|
||||
// Third, insert the real items linked by the links in this linked folder.
|
||||
foreach (InventoryItemBase link in linkedFolderContents.Items)
|
||||
{
|
||||
// Take care of genuinely broken links where the target doesn't exist
|
||||
// HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
|
||||
// but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
|
||||
// rather than having to keep track of every folder requested in the recursion.
|
||||
if (link != null)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC HANDLER]: Adding item {0} {1} from folder {2} linked from {3}",
|
||||
// link.Name, (AssetType)link.AssetType, item.AssetID, containingFolder.Name);
|
||||
|
||||
InventoryItemBase linkedItem
|
||||
= m_InventoryService.GetItem(new InventoryItemBase(link.AssetID));
|
||||
|
||||
itemsToReturn.Insert(0, linkedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// foreach (InventoryItemBase item in contents.Items)
|
||||
// {
|
||||
// List<InventoryItemBase> linkedItemsToAdd = new List<InventoryItemBase>();
|
||||
//
|
||||
// foreach (InventoryItemBase item in contents.Items)
|
||||
// {
|
||||
// if (item.AssetType == (int)AssetType.Link)
|
||||
// {
|
||||
// InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID));
|
||||
//
|
||||
// // Take care of genuinely broken links where the target doesn't exist
|
||||
// // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
|
||||
// // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles
|
||||
// // rather than having to keep track of every folder requested in the recursion.
|
||||
// if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link)
|
||||
// linkedItemsToAdd.Insert(0, linkedItem);
|
||||
// }
|
||||
// }
|
||||
// m_log.DebugFormat(
|
||||
// "[WEB FETCH INV DESC HANDLER]: Returning item {0}, type {1}, parent {2} in {3} {4}",
|
||||
// item.Name, (AssetType)item.AssetType, item.Folder, containingFolder.Name, containingFolder.ID);
|
||||
// }
|
||||
|
||||
// =====
|
||||
|
||||
//
|
||||
// foreach (InventoryItemBase linkedItem in linkedItemsToAdd)
|
||||
// {
|
||||
|
@ -365,18 +420,8 @@ namespace OpenSim.Capabilities.Handlers
|
|||
llsdItem.item_id = invItem.ID;
|
||||
llsdItem.name = invItem.Name;
|
||||
llsdItem.parent_id = invItem.Folder;
|
||||
|
||||
try
|
||||
{
|
||||
llsdItem.type = Utils.AssetTypeToString((AssetType)invItem.AssetType);
|
||||
llsdItem.inv_type = Utils.InventoryTypeToString((InventoryType)invItem.InvType);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[WEB FETCH INV DESC HANDLER]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}",
|
||||
invItem.AssetType, invItem.InvType, invItem.Name, e.Message);
|
||||
}
|
||||
llsdItem.type = invItem.AssetType;
|
||||
llsdItem.inv_type = invItem.InvType;
|
||||
|
||||
llsdItem.permissions = new LLSDPermissions();
|
||||
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
|
||||
|
@ -390,21 +435,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
|
||||
llsdItem.sale_info = new LLSDSaleInfo();
|
||||
llsdItem.sale_info.sale_price = invItem.SalePrice;
|
||||
switch (invItem.SaleType)
|
||||
{
|
||||
default:
|
||||
llsdItem.sale_info.sale_type = "not";
|
||||
break;
|
||||
case 1:
|
||||
llsdItem.sale_info.sale_type = "original";
|
||||
break;
|
||||
case 2:
|
||||
llsdItem.sale_info.sale_type = "copy";
|
||||
break;
|
||||
case 3:
|
||||
llsdItem.sale_info.sale_type = "contents";
|
||||
break;
|
||||
}
|
||||
llsdItem.sale_info.sale_type = invItem.SaleType;
|
||||
|
||||
return llsdItem;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ namespace OpenSim.Framework.Capabilities
|
|||
public UUID asset_id;
|
||||
public UUID item_id;
|
||||
public LLSDPermissions permissions;
|
||||
public string type;
|
||||
public string inv_type;
|
||||
public int type;
|
||||
public int inv_type;
|
||||
public int flags;
|
||||
|
||||
public LLSDSaleInfo sale_info;
|
||||
|
@ -65,7 +65,7 @@ namespace OpenSim.Framework.Capabilities
|
|||
public class LLSDSaleInfo
|
||||
{
|
||||
public int sale_price;
|
||||
public string sale_type;
|
||||
public int sale_type;
|
||||
}
|
||||
|
||||
[OSDMap]
|
||||
|
|
|
@ -89,5 +89,11 @@ namespace OpenSim.Data.MSSQL
|
|||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public FriendsData[] GetFriends(Guid principalID)
|
||||
{
|
||||
return GetFriends(principalID.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -813,7 +813,7 @@ namespace OpenSim.Data.MSSQL
|
|||
{
|
||||
try
|
||||
{
|
||||
using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID", connection))
|
||||
using (SqlCommand command = new SqlCommand("DELETE FROM inventoryfolders WHERE folderID=@folderID and type=-1", connection))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("folderID", folderID));
|
||||
|
||||
|
|
|
@ -675,7 +675,7 @@ VALUES
|
|||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags]) VALUES (@LandUUID,@AccessUUID,@Flags)";
|
||||
sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags],[Expires]) VALUES (@LandUUID,@AccessUUID,@Flags,@Expires)";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
|
@ -1215,6 +1215,8 @@ VALUES
|
|||
//Store new values
|
||||
StoreNewRegionSettings(regionSettings);
|
||||
|
||||
LoadSpawnPoints(regionSettings);
|
||||
|
||||
return regionSettings;
|
||||
}
|
||||
|
||||
|
@ -1252,7 +1254,7 @@ VALUES
|
|||
,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se
|
||||
,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit
|
||||
,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position
|
||||
,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id
|
||||
,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id, [map_tile_id] = @TerrainImageID, [telehubobject] = @telehubobject, [parcel_tile_id] = @ParcelImageID
|
||||
WHERE [regionUUID] = @regionUUID";
|
||||
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
|
@ -1263,6 +1265,7 @@ VALUES
|
|||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
SaveSpawnPoints(regionSettings);
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
|
@ -1383,6 +1386,11 @@ VALUES
|
|||
newSettings.LoadedCreationID = "";
|
||||
else
|
||||
newSettings.LoadedCreationID = (String)row["loaded_creation_id"];
|
||||
|
||||
newSettings.TerrainImageID = new UUID((string)row["map_tile_ID"]);
|
||||
newSettings.ParcelImageID = new UUID((Guid)row["parcel_tile_ID"]);
|
||||
newSettings.TelehubObject = new UUID((Guid)row["TelehubObject"]);
|
||||
|
||||
return newSettings;
|
||||
}
|
||||
|
||||
|
@ -1454,6 +1462,13 @@ VALUES
|
|||
}
|
||||
|
||||
newData.ParcelAccessList = new List<LandAccessEntry>();
|
||||
newData.MediaDescription = (string)row["MediaDescription"];
|
||||
newData.MediaType = (string)row["MediaType"];
|
||||
newData.MediaWidth = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[0]);
|
||||
newData.MediaHeight = Convert.ToInt32((((string)row["MediaSize"]).Split(','))[1]);
|
||||
newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
|
||||
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
|
||||
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
|
||||
|
||||
return newData;
|
||||
}
|
||||
|
@ -1468,7 +1483,7 @@ VALUES
|
|||
LandAccessEntry entry = new LandAccessEntry();
|
||||
entry.AgentID = new UUID((Guid)row["AccessUUID"]);
|
||||
entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]);
|
||||
entry.Expires = 0;
|
||||
entry.Expires = Convert.ToInt32(row["Expires"]);
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
@ -1497,7 +1512,8 @@ VALUES
|
|||
prim.TouchName = (string)primRow["TouchName"];
|
||||
// permissions
|
||||
prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]);
|
||||
prim.CreatorID = new UUID((Guid)primRow["CreatorID"]);
|
||||
//prim.CreatorID = new UUID((Guid)primRow["CreatorID"]);
|
||||
prim.CreatorIdentification = (string)primRow["CreatorID"];
|
||||
prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
|
||||
prim.GroupID = new UUID((Guid)primRow["GroupID"]);
|
||||
prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
|
||||
|
@ -1691,7 +1707,8 @@ VALUES
|
|||
taskItem.Name = (string)inventoryRow["name"];
|
||||
taskItem.Description = (string)inventoryRow["description"];
|
||||
taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]);
|
||||
taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]);
|
||||
//taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]);
|
||||
taskItem.CreatorIdentification = (string)inventoryRow["creatorID"];
|
||||
taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]);
|
||||
taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]);
|
||||
taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]);
|
||||
|
@ -1792,6 +1809,9 @@ VALUES
|
|||
parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime));
|
||||
parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime));
|
||||
parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID));
|
||||
parameters.Add(_Database.CreateParameter("TerrainImageID", settings.TerrainImageID));
|
||||
parameters.Add(_Database.CreateParameter("ParcelImageID", settings.ParcelImageID));
|
||||
parameters.Add(_Database.CreateParameter("TelehubObject", settings.TelehubObject));
|
||||
|
||||
return parameters.ToArray();
|
||||
}
|
||||
|
@ -1859,6 +1879,7 @@ VALUES
|
|||
parameters.Add(_Database.CreateParameter("LandUUID", parcelID));
|
||||
parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID));
|
||||
parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags));
|
||||
parameters.Add(_Database.CreateParameter("Expires", parcelAccessEntry.Expires));
|
||||
|
||||
return parameters.ToArray();
|
||||
}
|
||||
|
@ -2063,5 +2084,57 @@ VALUES
|
|||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
private void LoadSpawnPoints(RegionSettings rs)
|
||||
{
|
||||
rs.ClearSpawnPoints();
|
||||
|
||||
string sql = "SELECT Yaw, Pitch, Distance FROM spawn_points WHERE RegionUUID = @RegionUUID";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID.ToString()));
|
||||
conn.Open();
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
SpawnPoint sp = new SpawnPoint();
|
||||
|
||||
sp.Yaw = (float)reader["Yaw"];
|
||||
sp.Pitch = (float)reader["Pitch"];
|
||||
sp.Distance = (float)reader["Distance"];
|
||||
|
||||
rs.AddSpawnPoint(sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveSpawnPoints(RegionSettings rs)
|
||||
{
|
||||
string sql = "DELETE FROM spawn_points WHERE RegionUUID = @RegionUUID";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID));
|
||||
conn.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
foreach (SpawnPoint p in rs.SpawnPoints())
|
||||
{
|
||||
sql = "INSERT INTO spawn_points (RegionUUID, Yaw, Pitch, Distance) VALUES (@RegionUUID, @Yaw, @Pitch, @Distance)";
|
||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@Yaw", p.Yaw));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@Pitch", p.Pitch));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("@Distance", p.Distance));
|
||||
conn.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1044,10 +1044,93 @@ ALTER TABLE primitems ALTER COLUMN CreatorID uniqueidentifier NOT NULL
|
|||
|
||||
COMMIT
|
||||
|
||||
:VERSION 29 #---------------------
|
||||
:VERSION 29 #----------------- Region Covenant changed time
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 30 #------------------Migrate creatorID storage to varchars instead of UUIDs for HG support
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
EXECUTE sp_rename N'dbo.prims.creatorid', N'creatoridold', 'COLUMN'
|
||||
EXECUTE sp_rename N'dbo.primitems.creatorid', N'creatoridold', 'COLUMN'
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 31 #---------------------
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE prims ADD CreatorID varchar(255)
|
||||
ALTER TABLE primitems ADD CreatorID varchar(255)
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 32 #---------------------
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
UPDATE prims SET prims.CreatorID = CONVERT(varchar(255), creatoridold)
|
||||
UPDATE primitems SET primitems.CreatorID = CONVERT(varchar(255), creatoridold)
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 33 #---------------------
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE prims
|
||||
ADD CONSTRAINT DF_prims_CreatorIDNew
|
||||
DEFAULT '00000000-0000-0000-0000-000000000000'
|
||||
FOR CreatorID
|
||||
|
||||
ALTER TABLE prims ALTER COLUMN CreatorID varchar(255) NOT NULL
|
||||
|
||||
ALTER TABLE primitems
|
||||
ADD CONSTRAINT DF_primitems_CreatorIDNew
|
||||
DEFAULT '00000000-0000-0000-0000-000000000000'
|
||||
FOR CreatorID
|
||||
|
||||
ALTER TABLE primitems ALTER COLUMN CreatorID varchar(255) NOT NULL
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 34 #--------------- Telehub support
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
CREATE TABLE [dbo].[Spawn_Points](
|
||||
[RegionUUID] [uniqueidentifier] NOT NULL,
|
||||
[Yaw] [float] NOT NULL,
|
||||
[Pitch] [float] NOT NULL,
|
||||
[Distance] [float] NOT NULL,
|
||||
PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[RegionUUID] ASC
|
||||
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
|
||||
ALTER TABLE regionsettings ADD TelehubObject uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 35 #---------------- Parcels for sale
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE regionsettings ADD parcel_tile_ID uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
COMMIT
|
||||
|
||||
:VERSION 36 #---------------- Timed bans/access
|
||||
|
||||
BEGIN TRANSACTION
|
||||
|
||||
ALTER TABLE landaccesslist ADD Expires integer NOT NULL DEFAULT 0;
|
||||
|
||||
COMMIT
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ namespace OpenSim.Framework
|
|||
bool IsEitherBannedOrRestricted(UUID avatar);
|
||||
bool IsBannedFromLand(UUID avatar);
|
||||
bool IsRestrictedFromLand(UUID avatar);
|
||||
bool IsInLandAccessList(UUID avatar);
|
||||
void SendLandUpdateToClient(IClientAPI remote_client);
|
||||
void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client);
|
||||
List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag);
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace OpenSim.Framework
|
|||
(uint) ParcelFlags.AllowAPrimitiveEntry |
|
||||
(uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform |
|
||||
(uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts |
|
||||
(uint) ParcelFlags.SoundLocal;
|
||||
(uint) ParcelFlags.SoundLocal | (uint) ParcelFlags.AllowVoiceChat;
|
||||
|
||||
private byte _landingType = 0;
|
||||
private string _name = "Your Parcel";
|
||||
|
|
|
@ -269,15 +269,19 @@ namespace OpenSim.Framework.Servers
|
|||
t.Priority,
|
||||
t.ThreadState);
|
||||
|
||||
sb.Append(Environment.NewLine);
|
||||
sb.Append("\n");
|
||||
}
|
||||
|
||||
int workers = 0, ports = 0, maxWorkers = 0, maxPorts = 0;
|
||||
ThreadPool.GetAvailableThreads(out workers, out ports);
|
||||
ThreadPool.GetMaxThreads(out maxWorkers, out maxPorts);
|
||||
sb.Append("\n");
|
||||
|
||||
sb.Append(Environment.NewLine + "*** ThreadPool threads ***" + Environment.NewLine);
|
||||
sb.Append("workers: " + (maxWorkers - workers) + " (" + maxWorkers + "); ports: " + (maxPorts - ports) + " (" + maxPorts + ")" + Environment.NewLine);
|
||||
// For some reason mono 2.6.7 returns an empty threads set! Not going to confuse people by reporting
|
||||
// zero active threads.
|
||||
int totalThreads = Process.GetCurrentProcess().Threads.Count;
|
||||
if (totalThreads > 0)
|
||||
sb.AppendFormat("Total threads active: {0}\n\n", totalThreads);
|
||||
|
||||
sb.Append("Main threadpool (excluding script engine pools)\n");
|
||||
sb.Append(Util.GetThreadPoolReport());
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ namespace OpenSim
|
|||
{
|
||||
public class VersionInfo
|
||||
{
|
||||
private const string VERSION_NUMBER = "0.7.3";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||
private const string VERSION_NUMBER = "0.7.3.1";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Post_Fixes;
|
||||
|
||||
public enum Flavour
|
||||
{
|
||||
|
@ -39,7 +39,8 @@ namespace OpenSim
|
|||
RC1,
|
||||
RC2,
|
||||
Release,
|
||||
Post_Fixes
|
||||
Post_Fixes,
|
||||
Extended
|
||||
}
|
||||
|
||||
public static string Version
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
|
@ -46,8 +46,12 @@ namespace OpenSim.Framework.Statistics
|
|||
sb.Append(Environment.NewLine);
|
||||
sb.Append(
|
||||
string.Format(
|
||||
"Allocated to OpenSim : {0} MB" + Environment.NewLine,
|
||||
"Allocated to OpenSim objects: {0} MB\n",
|
||||
Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
|
||||
sb.Append(
|
||||
string.Format(
|
||||
"Process memory : {0} MB\n",
|
||||
Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0)));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
|
|
@ -81,12 +81,15 @@ namespace OpenSim.Framework
|
|||
|
||||
private static uint nextXferID = 5000;
|
||||
private static Random randomClass = new Random();
|
||||
|
||||
// Get a list of invalid file characters (OS dependent)
|
||||
private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
|
||||
private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
|
||||
private static object XferLock = new object();
|
||||
/// <summary>Thread pool used for Util.FireAndForget if
|
||||
/// FireAndForgetMethod.SmartThreadPool is used</summary>
|
||||
|
||||
/// <summary>
|
||||
/// Thread pool used for Util.FireAndForget if FireAndForgetMethod.SmartThreadPool is used
|
||||
/// </summary>
|
||||
private static SmartThreadPool m_ThreadPool;
|
||||
|
||||
// Unix-epoch starts at January 1st 1970, 00:00:00 UTC. And all our times in the server are (or at least should be) in UTC.
|
||||
|
@ -144,7 +147,6 @@ namespace OpenSim.Framework
|
|||
return lerp(y, lerp(x, a, b), lerp(x, c, d));
|
||||
}
|
||||
|
||||
|
||||
public static Encoding UTF8 = Encoding.UTF8;
|
||||
|
||||
/// <value>
|
||||
|
@ -1671,6 +1673,61 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a thread pool report.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetThreadPoolReport()
|
||||
{
|
||||
string threadPoolUsed = null;
|
||||
int maxThreads = 0;
|
||||
int minThreads = 0;
|
||||
int allocatedThreads = 0;
|
||||
int inUseThreads = 0;
|
||||
int waitingCallbacks = 0;
|
||||
int completionPortThreads = 0;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
|
||||
{
|
||||
threadPoolUsed = "SmartThreadPool";
|
||||
maxThreads = m_ThreadPool.MaxThreads;
|
||||
minThreads = m_ThreadPool.MinThreads;
|
||||
inUseThreads = m_ThreadPool.InUseThreads;
|
||||
allocatedThreads = m_ThreadPool.ActiveThreads;
|
||||
waitingCallbacks = m_ThreadPool.WaitingCallbacks;
|
||||
}
|
||||
else if (
|
||||
FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem
|
||||
|| FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem)
|
||||
{
|
||||
threadPoolUsed = "BuiltInThreadPool";
|
||||
ThreadPool.GetMaxThreads(out maxThreads, out completionPortThreads);
|
||||
ThreadPool.GetMinThreads(out minThreads, out completionPortThreads);
|
||||
int availableThreads;
|
||||
ThreadPool.GetAvailableThreads(out availableThreads, out completionPortThreads);
|
||||
inUseThreads = maxThreads - availableThreads;
|
||||
allocatedThreads = -1;
|
||||
waitingCallbacks = -1;
|
||||
}
|
||||
|
||||
if (threadPoolUsed != null)
|
||||
{
|
||||
sb.AppendFormat("Thread pool used : {0}\n", threadPoolUsed);
|
||||
sb.AppendFormat("Max threads : {0}\n", maxThreads);
|
||||
sb.AppendFormat("Min threads : {0}\n", minThreads);
|
||||
sb.AppendFormat("Allocated threads : {0}\n", allocatedThreads < 0 ? "not applicable" : allocatedThreads.ToString());
|
||||
sb.AppendFormat("In use threads : {0}\n", inUseThreads);
|
||||
sb.AppendFormat("Work items waiting : {0}\n", waitingCallbacks < 0 ? "not available" : waitingCallbacks.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendFormat("Thread pool not used\n");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static object SmartThreadPoolCallback(object o)
|
||||
{
|
||||
object[] array = (object[])o;
|
||||
|
|
|
@ -124,15 +124,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
this, "save iar",
|
||||
"save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]",
|
||||
"Save user inventory archive (IAR).",
|
||||
"<first> is the user's first name." + Environment.NewLine
|
||||
+ "<last> is the user's last name." + Environment.NewLine
|
||||
+ "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine
|
||||
+ "-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
|
||||
+ "-c|--creators preserves information about foreign creators." + Environment.NewLine
|
||||
+ "-v|--verbose extra debug messages." + Environment.NewLine
|
||||
+ "--noassets stops assets being saved to the IAR."
|
||||
"<first> is the user's first name.\n"
|
||||
+ "<last> is the user's last name.\n"
|
||||
+ "<inventory path> is the path inside the user's inventory for the folder/item to be saved.\n"
|
||||
+ "<IAR path> is the filesystem path at which to save the IAR."
|
||||
+ string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
|
||||
+ string.Format(" If this is not given then the filename {0} in the current directory is used.\n", DEFAULT_INV_BACKUP_FILENAME)
|
||||
+ "-h|--home=<url> adds the url of the profile service to the saved user information.\n"
|
||||
+ "-c|--creators preserves information about foreign creators.\n"
|
||||
+ "-v|--verbose extra debug messages.\n"
|
||||
+ "--noassets stops assets being saved to the IAR.",
|
||||
HandleSaveInvConsoleCommand);
|
||||
|
||||
m_aScene = scene;
|
||||
|
|
|
@ -150,7 +150,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
|
|||
string skillsText = String.Empty;
|
||||
string languages = String.Empty;
|
||||
|
||||
Byte[] charterMember = Utils.StringToBytes("Avatar");
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, avatarID);
|
||||
|
||||
string name = "Avatar";
|
||||
int created = 0;
|
||||
if (account != null)
|
||||
{
|
||||
name = account.FirstName + " " + account.LastName;
|
||||
created = account.Created;
|
||||
}
|
||||
Byte[] charterMember = Utils.StringToBytes(name);
|
||||
|
||||
profileUrl = "No profile data";
|
||||
aboutText = string.Empty;
|
||||
|
@ -160,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
|
|||
partner = UUID.Zero;
|
||||
|
||||
remoteClient.SendAvatarProperties(avatarID, aboutText,
|
||||
Util.ToDateTime(0).ToString(
|
||||
Util.ToDateTime(created).ToString(
|
||||
"M/d/yyyy", CultureInfo.InvariantCulture),
|
||||
charterMember, firstLifeAboutText,
|
||||
(uint)(0 & 0xff),
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
string userAssetServer = string.Empty;
|
||||
if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission)
|
||||
{
|
||||
Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); });
|
||||
m_assMapper.Post(assetID, avatarID, userAssetServer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -151,6 +151,14 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
|||
|
||||
#region IWorldComm Members
|
||||
|
||||
public int ListenerCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_listenerManager.ListenerCount;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a listen event callback with the specified filters.
|
||||
/// The parameters localID,itemID are needed to uniquely identify
|
||||
|
@ -438,6 +446,18 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
|||
private int m_maxhandles;
|
||||
private int m_curlisteners;
|
||||
|
||||
/// <summary>
|
||||
/// Total number of listeners
|
||||
/// </summary>
|
||||
public int ListenerCount
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (m_listeners)
|
||||
return m_listeners.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public ListenerManager(int maxlisteners, int maxhandles)
|
||||
{
|
||||
m_maxlisteners = maxlisteners;
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* 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 Nini.Config;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenMetaverse;
|
||||
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
||||
{
|
||||
public class AuthorizationService : IAuthorizationService
|
||||
{
|
||||
private enum AccessFlags
|
||||
{
|
||||
None = 0, /* No restrictions */
|
||||
DisallowResidents = 1, /* Only gods and managers*/
|
||||
DisallowForeigners = 2, /* Only local people */
|
||||
}
|
||||
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IUserManagement m_UserManagement;
|
||||
private IGridService m_GridService;
|
||||
|
||||
private Scene m_Scene;
|
||||
AccessFlags m_accessValue = AccessFlags.None;
|
||||
|
||||
|
||||
public AuthorizationService(IConfig config, Scene scene)
|
||||
{
|
||||
m_Scene = scene;
|
||||
m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
|
||||
m_GridService = scene.GridService;
|
||||
|
||||
if (config != null)
|
||||
{
|
||||
string accessStr = config.GetString("Region_" + scene.RegionInfo.RegionName.Replace(' ', '_'), String.Empty);
|
||||
if (accessStr != string.Empty)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_accessValue = (AccessFlags)Enum.Parse(typeof(AccessFlags), accessStr);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
m_log.WarnFormat("[AuthorizationService]: {0} is not a valid access flag", accessStr);
|
||||
}
|
||||
}
|
||||
m_log.DebugFormat("[AuthorizationService]: Region {0} access restrictions: {1}", m_Scene.RegionInfo.RegionName, m_accessValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool IsAuthorizedForRegion(
|
||||
string user, string firstName, string lastName, string regionID, out string message)
|
||||
{
|
||||
message = "authorized";
|
||||
|
||||
// This should not happen
|
||||
if (m_Scene.RegionInfo.RegionID.ToString() != regionID)
|
||||
{
|
||||
m_log.WarnFormat("[AuthorizationService]: Service for region {0} received request to authorize for region {1}",
|
||||
m_Scene.RegionInfo.RegionID, regionID);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_accessValue == AccessFlags.None)
|
||||
return true;
|
||||
|
||||
UUID userID = new UUID(user);
|
||||
bool authorized = true;
|
||||
if ((m_accessValue & AccessFlags.DisallowForeigners) == AccessFlags.DisallowForeigners)
|
||||
{
|
||||
authorized = m_UserManagement.IsLocalGridUser(userID);
|
||||
if (!authorized)
|
||||
message = "no foreigner users allowed in this region";
|
||||
}
|
||||
if (authorized && (m_accessValue & AccessFlags.DisallowResidents) == AccessFlags.DisallowResidents)
|
||||
{
|
||||
authorized = m_Scene.Permissions.IsGod(userID) | m_Scene.Permissions.IsAdministrator(userID);
|
||||
if (!authorized)
|
||||
message = "only Admins and Managers allowed in this region";
|
||||
}
|
||||
|
||||
return authorized;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -39,13 +39,15 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
||||
{
|
||||
public class LocalAuthorizationServicesConnector : ISharedRegionModule, IAuthorizationService
|
||||
public class LocalAuthorizationServicesConnector : INonSharedRegionModule, IAuthorizationService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IAuthorizationService m_AuthorizationService;
|
||||
private Scene m_Scene;
|
||||
private IConfig m_AuthorizationConfig;
|
||||
|
||||
private bool m_Enabled = false;
|
||||
|
||||
|
@ -69,33 +71,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
|||
string name = moduleConfig.GetString("AuthorizationServices", string.Empty);
|
||||
if (name == Name)
|
||||
{
|
||||
IConfig authorizationConfig = source.Configs["AuthorizationService"];
|
||||
if (authorizationConfig == null)
|
||||
{
|
||||
m_log.Error("[AUTHORIZATION CONNECTOR]: AuthorizationService missing from OpenSim.ini");
|
||||
return;
|
||||
}
|
||||
|
||||
string serviceDll = authorizationConfig.GetString("LocalServiceModule",
|
||||
String.Empty);
|
||||
|
||||
if (serviceDll == String.Empty)
|
||||
{
|
||||
m_log.Error("[AUTHORIZATION CONNECTOR]: No LocalServiceModule named in section AuthorizationService");
|
||||
return;
|
||||
}
|
||||
|
||||
Object[] args = new Object[] { source };
|
||||
m_AuthorizationService =
|
||||
ServerUtils.LoadPlugin<IAuthorizationService>(serviceDll,
|
||||
args);
|
||||
|
||||
if (m_AuthorizationService == null)
|
||||
{
|
||||
m_log.Error("[AUTHORIZATION CONNECTOR]: Can't load authorization service");
|
||||
return;
|
||||
}
|
||||
m_Enabled = true;
|
||||
m_AuthorizationConfig = source.Configs["AuthorizationService"];
|
||||
m_log.Info("[AUTHORIZATION CONNECTOR]: Local authorization connector enabled");
|
||||
}
|
||||
}
|
||||
|
@ -115,6 +92,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
|||
return;
|
||||
|
||||
scene.RegisterModuleInterface<IAuthorizationService>(this);
|
||||
m_Scene = scene;
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
|
@ -126,6 +104,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
|||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_AuthorizationService = new AuthorizationService(m_AuthorizationConfig, m_Scene);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[AUTHORIZATION CONNECTOR]: Enabled local authorization for region {0}",
|
||||
scene.RegionInfo.RegionName);
|
||||
|
@ -134,6 +114,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
|||
public bool IsAuthorizedForRegion(
|
||||
string userID, string firstName, string lastName, string regionID, out string message)
|
||||
{
|
||||
message = "";
|
||||
if (!m_Enabled)
|
||||
return true;
|
||||
|
||||
return m_AuthorizationService.IsAuthorizedForRegion(userID, firstName, lastName, regionID, out message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,10 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security;
|
||||
using log4net;
|
||||
|
@ -45,8 +47,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private delegate void LookupUUIDS(List<UUID> uuidLst);
|
||||
|
||||
public Scene Scene { get; private set; }
|
||||
public IUserManagement UserManager { get; private set; }
|
||||
|
||||
|
@ -876,98 +876,77 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false))
|
||||
return;
|
||||
|
||||
Dictionary<uint, float> SceneData = new Dictionary<uint,float>();
|
||||
Dictionary<uint, float> sceneData = null;
|
||||
List<UUID> uuidNameLookupList = new List<UUID>();
|
||||
|
||||
if (reportType == 1)
|
||||
{
|
||||
SceneData = Scene.PhysicsScene.GetTopColliders();
|
||||
sceneData = Scene.PhysicsScene.GetTopColliders();
|
||||
}
|
||||
else if (reportType == 0)
|
||||
{
|
||||
SceneData = Scene.SceneGraph.GetTopScripts();
|
||||
IScriptModule scriptModule = Scene.RequestModuleInterface<IScriptModule>();
|
||||
|
||||
if (scriptModule != null)
|
||||
sceneData = scriptModule.GetObjectScriptsExecutionTimes();
|
||||
}
|
||||
|
||||
List<LandStatReportItem> SceneReport = new List<LandStatReportItem>();
|
||||
lock (SceneData)
|
||||
if (sceneData != null)
|
||||
{
|
||||
foreach (uint obj in SceneData.Keys)
|
||||
var sortedSceneData
|
||||
= sceneData.Select(
|
||||
item => new { Measurement = item.Value, Part = Scene.GetSceneObjectPart(item.Key) });
|
||||
|
||||
sortedSceneData.OrderBy(item => item.Measurement);
|
||||
|
||||
int items = 0;
|
||||
|
||||
foreach (var entry in sortedSceneData)
|
||||
{
|
||||
SceneObjectPart prt = Scene.GetSceneObjectPart(obj);
|
||||
if (prt != null)
|
||||
// The object may have been deleted since we received the data.
|
||||
if (entry.Part == null)
|
||||
continue;
|
||||
|
||||
// Don't show scripts that haven't executed or where execution time is below one microsecond in
|
||||
// order to produce a more readable report.
|
||||
if (entry.Measurement < 0.001)
|
||||
continue;
|
||||
|
||||
items++;
|
||||
SceneObjectGroup so = entry.Part.ParentGroup;
|
||||
|
||||
LandStatReportItem lsri = new LandStatReportItem();
|
||||
lsri.LocationX = so.AbsolutePosition.X;
|
||||
lsri.LocationY = so.AbsolutePosition.Y;
|
||||
lsri.LocationZ = so.AbsolutePosition.Z;
|
||||
lsri.Score = entry.Measurement;
|
||||
lsri.TaskID = so.UUID;
|
||||
lsri.TaskLocalID = so.LocalId;
|
||||
lsri.TaskName = entry.Part.Name;
|
||||
lsri.OwnerName = UserManager.GetUserName(so.OwnerID);
|
||||
|
||||
if (filter.Length != 0)
|
||||
{
|
||||
SceneObjectGroup sog = prt.ParentGroup;
|
||||
LandStatReportItem lsri = new LandStatReportItem();
|
||||
lsri.LocationX = sog.AbsolutePosition.X;
|
||||
lsri.LocationY = sog.AbsolutePosition.Y;
|
||||
lsri.LocationZ = sog.AbsolutePosition.Z;
|
||||
lsri.Score = SceneData[obj];
|
||||
lsri.TaskID = sog.UUID;
|
||||
lsri.TaskLocalID = sog.LocalId;
|
||||
lsri.TaskName = sog.GetPartName(obj);
|
||||
lsri.OwnerName = "waiting";
|
||||
lock (uuidNameLookupList)
|
||||
uuidNameLookupList.Add(sog.OwnerID);
|
||||
|
||||
if (filter.Length != 0)
|
||||
if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
|
||||
{
|
||||
if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
SceneReport.Add(lsri);
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
SceneReport.Add(lsri);
|
||||
|
||||
if (items >= 100)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray());
|
||||
|
||||
if (uuidNameLookupList.Count > 0)
|
||||
LookupUUID(uuidNameLookupList);
|
||||
}
|
||||
|
||||
private static void LookupUUIDSCompleted(IAsyncResult iar)
|
||||
{
|
||||
LookupUUIDS icon = (LookupUUIDS)iar.AsyncState;
|
||||
icon.EndInvoke(iar);
|
||||
}
|
||||
|
||||
private void LookupUUID(List<UUID> uuidLst)
|
||||
{
|
||||
LookupUUIDS d = LookupUUIDsAsync;
|
||||
|
||||
d.BeginInvoke(uuidLst,
|
||||
LookupUUIDSCompleted,
|
||||
d);
|
||||
}
|
||||
|
||||
private void LookupUUIDsAsync(List<UUID> uuidLst)
|
||||
{
|
||||
UUID[] uuidarr;
|
||||
|
||||
lock (uuidLst)
|
||||
{
|
||||
uuidarr = uuidLst.ToArray();
|
||||
}
|
||||
|
||||
for (int i = 0; i < uuidarr.Length; i++)
|
||||
{
|
||||
// string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]);
|
||||
|
||||
IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>();
|
||||
if (userManager != null)
|
||||
userManager.GetUserName(uuidarr[i]);
|
||||
|
||||
// we drop it. It gets cached though... so we're ready for the next request.
|
||||
// diva commnent 11/21/2010: uh?!? wft?
|
||||
// justincc comment 21/01/2011: A side effect of userManager.GetUserName() I presume.
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Outgoing Packets
|
||||
|
|
|
@ -448,8 +448,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
|
||||
public bool IsRestrictedFromLand(UUID avatar)
|
||||
{
|
||||
ExpireAccessList();
|
||||
|
||||
if (m_scene.Permissions.IsAdministrator(avatar))
|
||||
return false;
|
||||
|
||||
|
@ -459,20 +457,27 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
if (avatar == LandData.OwnerID)
|
||||
return false;
|
||||
|
||||
if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
|
||||
if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0)
|
||||
return false;
|
||||
|
||||
return (!IsInLandAccessList(avatar));
|
||||
}
|
||||
|
||||
public bool IsInLandAccessList(UUID avatar)
|
||||
{
|
||||
ExpireAccessList();
|
||||
|
||||
if (LandData.ParcelAccessList.FindIndex(
|
||||
delegate(LandAccessEntry e)
|
||||
{
|
||||
if (e.AgentID == avatar && e.Flags == AccessList.Access)
|
||||
return true;
|
||||
return false;
|
||||
}) == -1)
|
||||
{
|
||||
if (LandData.ParcelAccessList.FindIndex(
|
||||
delegate(LandAccessEntry e)
|
||||
{
|
||||
if (e.AgentID == avatar && e.Flags == AccessList.Access)
|
||||
return true;
|
||||
return false;
|
||||
}) == -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SendLandUpdateToClient(IClientAPI remote_client)
|
||||
|
|
|
@ -94,7 +94,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
private bool m_RegionOwnerIsGod = false;
|
||||
private bool m_RegionManagerIsGod = false;
|
||||
private bool m_ParcelOwnerIsGod = false;
|
||||
|
||||
|
||||
private bool m_SimpleBuildPermissions = false;
|
||||
|
||||
/// <value>
|
||||
/// The set of users that are allowed to create scripts. This is only active if permissions are not being
|
||||
/// bypassed. This overrides normal permissions.
|
||||
|
@ -139,7 +141,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true);
|
||||
m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false);
|
||||
m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true);
|
||||
|
||||
|
||||
m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false);
|
||||
|
||||
m_allowedScriptCreators
|
||||
= ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators);
|
||||
m_allowedScriptEditors
|
||||
|
@ -824,6 +828,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
permission = true;
|
||||
}
|
||||
|
||||
if (m_SimpleBuildPermissions &&
|
||||
(parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsInLandAccessList(user))
|
||||
permission = true;
|
||||
|
||||
return permission;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
private volatile bool m_tainted;
|
||||
private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
|
||||
|
||||
private String m_InitialTerrain = "pinhead-island";
|
||||
|
||||
/// <summary>
|
||||
/// Human readable list of terrain file extensions that are supported.
|
||||
/// </summary>
|
||||
|
@ -109,6 +111,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
/// <param name="config">Config for the region</param>
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
IConfig terrainConfig = config.Configs["Terrain"];
|
||||
if (terrainConfig != null)
|
||||
m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain);
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
|
@ -120,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
{
|
||||
if (m_scene.Heightmap == null)
|
||||
{
|
||||
m_channel = new TerrainChannel();
|
||||
m_channel = new TerrainChannel(m_InitialTerrain);
|
||||
m_scene.Heightmap = m_channel;
|
||||
m_revert = new TerrainChannel();
|
||||
UpdateRevertMap();
|
||||
|
@ -593,6 +598,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
"[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
|
||||
m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.ErrorFormat(
|
||||
// "[TERRAIN]: Could not save terrain from {0} to {1}. {2} {3} {4} {5} {6} {7}",
|
||||
// m_scene.RegionInfo.RegionName, filename, fileWidth, fileHeight, fileStartX, fileStartY, offsetX, offsetY);
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -92,7 +92,23 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
return;
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("MAP NAME=({0})", mapName);
|
||||
//m_log.DebugFormat("MAP NAME=({0})", mapName);
|
||||
|
||||
// Hack to get around the fact that ll V3 now drops the port from the
|
||||
// map name. See https://jira.secondlife.com/browse/VWR-28570
|
||||
//
|
||||
// Caller, use this magic form instead:
|
||||
// secondlife://http|!!mygrid.com|8002|Region+Name/128/128
|
||||
// or url encode if possible.
|
||||
// the hacks we do with this viewer...
|
||||
//
|
||||
string mapNameOrig = mapName;
|
||||
if (mapName.Contains("|"))
|
||||
mapName = mapName.Replace('|', ':');
|
||||
if (mapName.Contains("+"))
|
||||
mapName = mapName.Replace('+', ' ');
|
||||
if (mapName.Contains("!"))
|
||||
mapName = mapName.Replace('!', '/');
|
||||
|
||||
// try to fetch from GridServer
|
||||
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
|
||||
|
@ -114,7 +130,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
data.MapImageId = UUID.Zero;
|
||||
else
|
||||
data.MapImageId = info.TerrainImage;
|
||||
data.Name = info.RegionName;
|
||||
// ugh! V2-3 is very sensitive about the result being
|
||||
// exactly the same as the requested name
|
||||
if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+"))
|
||||
data.Name = mapNameOrig;
|
||||
else
|
||||
data.Name = info.RegionName;
|
||||
data.RegionFlags = 0; // TODO not used?
|
||||
data.WaterHeight = 0; // not used
|
||||
data.X = (ushort)(info.RegionLocX / Constants.RegionSize);
|
||||
|
@ -138,6 +159,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
// flags are agent flags sent from the viewer.
|
||||
// they have different values depending on different viewers, apparently
|
||||
remoteClient.SendMapBlock(blocks, flags);
|
||||
|
||||
// send extra user messages for V3
|
||||
// because the UI is very confusing
|
||||
// while we don't fix the hard-coded urls
|
||||
if (flags == 2)
|
||||
{
|
||||
if (regionInfos.Count == 0)
|
||||
remoteClient.SendAgentAlertMessage("No regions found with that name.", true);
|
||||
else if (regionInfos.Count == 1)
|
||||
remoteClient.SendAgentAlertMessage("Region found!", false);
|
||||
}
|
||||
}
|
||||
|
||||
// private Scene GetClientScene(IClientAPI client)
|
||||
|
|
|
@ -46,8 +46,6 @@ namespace OpenSim.Region.DataSnapshot
|
|||
private DataSnapshotManager m_externalData = null;
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private readonly string m_discoveryPath = "DS0001/";
|
||||
|
||||
public DataRequestHandler(Scene scene, DataSnapshotManager externalData)
|
||||
{
|
||||
m_scene = scene;
|
||||
|
@ -58,37 +56,9 @@ namespace OpenSim.Region.DataSnapshot
|
|||
{
|
||||
m_log.Info("[DATASNAPSHOT]: Set up snapshot service");
|
||||
}
|
||||
// Register validation callback handler
|
||||
MainServer.Instance.AddHTTPHandler("validate", OnValidate);
|
||||
|
||||
//Register CAPS handler event
|
||||
m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
|
||||
|
||||
//harbl
|
||||
}
|
||||
|
||||
public void OnRegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
// m_log.InfoFormat("[DATASNAPSHOT]: Registering service discovery capability for {0}", agentID);
|
||||
string capsBase = "/CAPS/" + caps.CapsObjectPath;
|
||||
caps.RegisterHandler("PublicSnapshotDataInfo",
|
||||
new RestStreamHandler("POST", capsBase + m_discoveryPath, OnDiscoveryAttempt));
|
||||
}
|
||||
|
||||
public string OnDiscoveryAttempt(string request, string path, string param,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
//Very static for now, flexible enough to add new formats
|
||||
LLSDDiscoveryResponse llsd_response = new LLSDDiscoveryResponse();
|
||||
llsd_response.snapshot_resources = new OSDArray();
|
||||
|
||||
LLSDDiscoveryDataURL llsd_dataurl = new LLSDDiscoveryDataURL();
|
||||
llsd_dataurl.snapshot_format = "os-datasnapshot-v1";
|
||||
llsd_dataurl.snapshot_url = "http://" + m_externalData.m_hostname + ":" + m_externalData.m_listener_port + "/?method=collector";
|
||||
|
||||
llsd_response.snapshot_resources.Array.Add(llsd_dataurl);
|
||||
|
||||
string response = LLSDHelpers.SerialiseLLSDReply(llsd_response);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public Hashtable OnGetSnapshot(Hashtable keysvals)
|
||||
|
@ -107,5 +77,23 @@ namespace OpenSim.Region.DataSnapshot
|
|||
|
||||
return reply;
|
||||
}
|
||||
|
||||
public Hashtable OnValidate(Hashtable keysvals)
|
||||
{
|
||||
m_log.Info("[DATASNAPSHOT] Received validation request");
|
||||
Hashtable reply = new Hashtable();
|
||||
int statuscode = 200;
|
||||
|
||||
string secret = (string)keysvals["secret"];
|
||||
if (secret == m_externalData.Secret.ToString())
|
||||
statuscode = 403;
|
||||
|
||||
reply["str_response_string"] = string.Empty;
|
||||
reply["int_response_code"] = statuscode;
|
||||
reply["content_type"] = "text/plain";
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ namespace OpenSim.Region.DataSnapshot
|
|||
private string m_dataServices = "noservices";
|
||||
public string m_listener_port = ConfigSettings.DefaultRegionHttpPort.ToString();
|
||||
public string m_hostname = "127.0.0.1";
|
||||
private UUID m_Secret = UUID.Random();
|
||||
|
||||
//Update timers
|
||||
private int m_period = 20; // in seconds
|
||||
|
@ -85,6 +86,11 @@ namespace OpenSim.Region.DataSnapshot
|
|||
get { return m_exposure_level; }
|
||||
}
|
||||
|
||||
public UUID Secret
|
||||
{
|
||||
get { return m_Secret; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRegionModule
|
||||
|
@ -103,10 +109,10 @@ namespace OpenSim.Region.DataSnapshot
|
|||
m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled);
|
||||
IConfig conf = config.Configs["GridService"];
|
||||
if (conf != null)
|
||||
m_gridinfo.Add("gridserverURL", conf.GetString("GridServerURI", "http://127.0.0.1:8003"));
|
||||
m_gridinfo.Add("gatekeeperURL", conf.GetString("Gatekeeper", String.Empty));
|
||||
|
||||
m_gridinfo.Add(
|
||||
"Name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo"));
|
||||
"name", config.Configs["DataSnapshot"].GetString("gridname", "the lost continent of hippo"));
|
||||
m_exposure_level = config.Configs["DataSnapshot"].GetString("data_exposure", m_exposure_level);
|
||||
m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period);
|
||||
m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales);
|
||||
|
@ -315,6 +321,7 @@ namespace OpenSim.Region.DataSnapshot
|
|||
cli.AddQueryParameter("service", serviceName);
|
||||
cli.AddQueryParameter("host", m_hostname);
|
||||
cli.AddQueryParameter("port", m_listener_port);
|
||||
cli.AddQueryParameter("secret", m_Secret.ToString());
|
||||
cli.RequestMethod = "GET";
|
||||
try
|
||||
{
|
||||
|
@ -341,7 +348,7 @@ namespace OpenSim.Region.DataSnapshot
|
|||
}
|
||||
// This is not quite working, so...
|
||||
// string responseStr = Util.UTF8.GetString(response);
|
||||
m_log.Info("[DATASNAPSHOT]: data service notified: " + url);
|
||||
m_log.Info("[DATASNAPSHOT]: data service " + url + " notified. Secret: " + m_Secret);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -154,6 +154,15 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <returns>null if the item does not exist</returns>
|
||||
TaskInventoryItem GetInventoryItem(UUID itemId);
|
||||
|
||||
/// <summary>
|
||||
/// Get all inventory items.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns>
|
||||
/// If there are no inventory items then an empty list is returned.
|
||||
/// </returns>
|
||||
List<TaskInventoryItem> GetInventoryItems();
|
||||
|
||||
/// <summary>
|
||||
/// Get inventory items by name.
|
||||
/// </summary>
|
||||
|
@ -162,7 +171,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// A list of inventory items with that name.
|
||||
/// If no inventory item has that name then an empty list is returned.
|
||||
/// </returns>
|
||||
IList<TaskInventoryItem> GetInventoryItems(string name);
|
||||
List<TaskInventoryItem> GetInventoryItems(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Get the scene object referenced by an inventory item.
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
|
@ -74,5 +75,14 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// Starts the processing threads.
|
||||
/// </summary>
|
||||
void StartProcessing();
|
||||
|
||||
/// <summary>
|
||||
/// Get the execution times of all scripts in each object.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A dictionary where the key is the root object ID of a linkset
|
||||
/// and the value is a representative execution time in milliseconds of all scripts in that linkset.
|
||||
/// </returns>
|
||||
Dictionary<uint, float> GetObjectScriptsExecutionTimes();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -49,6 +49,11 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
|
||||
public interface IWorldComm
|
||||
{
|
||||
/// <summary>
|
||||
/// Total number of listeners
|
||||
/// </summary>
|
||||
int ListenerCount { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a listen event callback with the specified filters.
|
||||
/// The parameters localID,itemID are needed to uniquely identify
|
||||
|
|
|
@ -68,9 +68,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public delegate void OnNewClientDelegate(IClientAPI client);
|
||||
|
||||
/// <summary>
|
||||
/// Deprecated in favour of OnClientConnect.
|
||||
/// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces.
|
||||
/// Triggered when a new client is added to the scene.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered before OnClientLogin.
|
||||
/// </remarks>
|
||||
public event OnNewClientDelegate OnNewClient;
|
||||
|
||||
/// <summary>
|
||||
|
@ -138,8 +140,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public event OnPermissionErrorDelegate OnPermissionError;
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a new script is created.
|
||||
/// Fired when a script is run.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Occurs after OnNewScript.
|
||||
/// </remarks>
|
||||
public event NewRezScript OnRezScript;
|
||||
public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
|
||||
|
||||
|
@ -185,12 +190,24 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public delegate void ClientClosed(UUID clientID, Scene scene);
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a client is removed from a scene.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// At the point of firing, the scene still contains the client's scene presence.
|
||||
/// </remarks>
|
||||
public event ClientClosed OnClientClosed;
|
||||
|
||||
// Fired when a script is created
|
||||
// The indication that a new script exists in this region.
|
||||
public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID);
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a script is created.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Occurs before OnRezScript
|
||||
/// </remarks>
|
||||
public event NewScript OnNewScript;
|
||||
|
||||
public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
|
||||
{
|
||||
NewScript handlerNewScript = OnNewScript;
|
||||
|
@ -212,10 +229,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
//TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset
|
||||
// An indication that the script has changed.
|
||||
public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID);
|
||||
|
||||
/// <summary>
|
||||
/// An indication that the script has changed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset.
|
||||
/// </remarks>
|
||||
public event UpdateScript OnUpdateScript;
|
||||
|
||||
public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
|
||||
{
|
||||
UpdateScript handlerUpdateScript = OnUpdateScript;
|
||||
|
@ -466,6 +489,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
|
||||
|
||||
public delegate void LoginsEnabled(string regionName);
|
||||
|
||||
/// <summary>
|
||||
/// This should only fire in all circumstances if the RegionReady module is active.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// TODO: Fire this even when the RegionReady module is not active.
|
||||
/// </remarks>
|
||||
public event LoginsEnabled OnLoginsEnabled;
|
||||
|
||||
public delegate void PrimsLoaded(Scene s);
|
||||
|
|
|
@ -1210,9 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <summary>
|
||||
/// Copy a task (prim) inventory item to another task (prim)
|
||||
/// </summary>
|
||||
/// <param name="destId"></param>
|
||||
/// <param name="part"></param>
|
||||
/// <param name="itemId"></param>
|
||||
/// <param name="destId">ID of destination part</param>
|
||||
/// <param name="part">Source part</param>
|
||||
/// <param name="itemId">Source item id to transfer</param>
|
||||
public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId)
|
||||
{
|
||||
TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId);
|
||||
|
@ -1238,24 +1238,21 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
// Can't transfer this
|
||||
//
|
||||
if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0))
|
||||
return;
|
||||
|
||||
if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
|
||||
if (part.OwnerID != destPart.OwnerID)
|
||||
{
|
||||
// object cannot copy items to an object owned by a different owner
|
||||
// unless llAllowInventoryDrop has been called
|
||||
// Source must have transfer permissions
|
||||
if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
|
||||
return;
|
||||
|
||||
return;
|
||||
// Object cannot copy items to an object owned by a different owner
|
||||
// unless llAllowInventoryDrop has been called on the destination
|
||||
if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
// must have both move and modify permission to put an item in an object
|
||||
if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TaskInventoryItem destTaskItem = new TaskInventoryItem();
|
||||
|
||||
|
|
|
@ -219,8 +219,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
private int m_lastUpdate;
|
||||
private bool m_firstHeartbeat = true;
|
||||
|
||||
private object m_deleting_scene_object = new object();
|
||||
|
||||
private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
|
||||
private bool m_reprioritizationEnabled = true;
|
||||
|
@ -1583,8 +1581,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID);
|
||||
if (map == null)
|
||||
{
|
||||
m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain.");
|
||||
Heightmap = new TerrainChannel();
|
||||
// This should be in the Terrain module, but it isn't because
|
||||
// the heightmap is needed _way_ before the modules are initialized...
|
||||
IConfig terrainConfig = m_config.Configs["Terrain"];
|
||||
String m_InitialTerrain = "pinhead-island";
|
||||
if (terrainConfig != null)
|
||||
m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain);
|
||||
|
||||
m_log.InfoFormat("[TERRAIN]: No default terrain. Generating a new terrain {0}.", m_InitialTerrain);
|
||||
Heightmap = new TerrainChannel(m_InitialTerrain);
|
||||
|
||||
SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
|
||||
}
|
||||
|
@ -1999,15 +2004,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public void DeleteSceneObject(SceneObjectGroup group, bool silent)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
|
||||
|
||||
//SceneObjectPart rootPart = group.GetChildPart(group.UUID);
|
||||
|
||||
// Serialise calls to RemoveScriptInstances to avoid
|
||||
// deadlocking on m_parts inside SceneObjectGroup
|
||||
lock (m_deleting_scene_object)
|
||||
{
|
||||
group.RemoveScriptInstances(true);
|
||||
}
|
||||
group.RemoveScriptInstances(true);
|
||||
|
||||
SceneObjectPart[] partList = group.Parts;
|
||||
|
||||
|
@ -3540,8 +3538,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (!AuthorizationService.IsAuthorizedForRegion(
|
||||
agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason))
|
||||
{
|
||||
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
|
||||
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because {4}",
|
||||
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -156,6 +156,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// that the region position is cached or performance will degrade
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
|
||||
// bool v = true;
|
||||
if (!simulatorList.Contains(dest.ServerURI))
|
||||
{
|
||||
|
|
|
@ -751,6 +751,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
#endregion
|
||||
|
||||
#region Get Methods
|
||||
|
||||
/// <summary>
|
||||
/// Get the controlling client for the given avatar, if there is one.
|
||||
///
|
||||
|
@ -1092,36 +1093,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return Entities.GetEntities();
|
||||
}
|
||||
|
||||
public Dictionary<uint, float> GetTopScripts()
|
||||
{
|
||||
Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
|
||||
|
||||
EntityBase[] EntityList = GetEntities();
|
||||
int limit = 0;
|
||||
foreach (EntityBase ent in EntityList)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
SceneObjectGroup grp = (SceneObjectGroup)ent;
|
||||
if ((grp.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
|
||||
{
|
||||
if (grp.scriptScore >= 0.01)
|
||||
{
|
||||
topScripts.Add(grp.LocalId, grp.scriptScore);
|
||||
limit++;
|
||||
if (limit >= 100)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
grp.scriptScore = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return topScripts;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Other Methods
|
||||
|
|
|
@ -229,8 +229,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
get { return RootPart.VolumeDetectActive; }
|
||||
}
|
||||
|
||||
public float scriptScore;
|
||||
|
||||
private Vector3 lastPhysGroupPos;
|
||||
private Quaternion lastPhysGroupRot;
|
||||
|
||||
|
@ -1184,12 +1182,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void AddScriptLPS(int count)
|
||||
{
|
||||
if (scriptScore + count >= float.MaxValue - count)
|
||||
scriptScore = 0;
|
||||
|
||||
scriptScore += (float)count;
|
||||
SceneGraph d = m_scene.SceneGraph;
|
||||
d.AddToScriptLPS(count);
|
||||
m_scene.SceneGraph.AddToScriptLPS(count);
|
||||
}
|
||||
|
||||
public void AddActiveScriptCount(int count)
|
||||
|
|
|
@ -590,9 +590,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// A list of inventory items with that name.
|
||||
/// If no inventory item has that name then an empty list is returned.
|
||||
/// </returns>
|
||||
public IList<TaskInventoryItem> GetInventoryItems(string name)
|
||||
public List<TaskInventoryItem> GetInventoryItems(string name)
|
||||
{
|
||||
IList<TaskInventoryItem> items = new List<TaskInventoryItem>();
|
||||
List<TaskInventoryItem> items = new List<TaskInventoryItem>();
|
||||
|
||||
lock (m_items)
|
||||
{
|
||||
|
@ -1100,7 +1100,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public List<TaskInventoryItem> GetInventoryItems()
|
||||
{
|
||||
List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
|
||||
List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
|
||||
|
||||
lock (m_items)
|
||||
ret = new List<TaskInventoryItem>(m_items.Values);
|
||||
|
|
|
@ -178,7 +178,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_objectCapacity = scene.RegionInfo.ObjectCapacity;
|
||||
m_report.AutoReset = true;
|
||||
m_report.Interval = statsUpdatesEveryMS;
|
||||
m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat);
|
||||
m_report.Elapsed += statsHeartBeat;
|
||||
m_report.Enabled = true;
|
||||
|
||||
if (StatsManager.SimExtraStats != null)
|
||||
|
|
|
@ -46,23 +46,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public TerrainChannel()
|
||||
{
|
||||
map = new double[Constants.RegionSize, Constants.RegionSize];
|
||||
taint = new bool[Constants.RegionSize / 16,Constants.RegionSize / 16];
|
||||
taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16];
|
||||
|
||||
int x;
|
||||
for (x = 0; x < Constants.RegionSize; x++)
|
||||
{
|
||||
int y;
|
||||
for (y = 0; y < Constants.RegionSize; y++)
|
||||
{
|
||||
map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10;
|
||||
double spherFacA = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 50) * 0.01;
|
||||
double spherFacB = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 100) * 0.001;
|
||||
if (map[x, y] < spherFacA)
|
||||
map[x, y] = spherFacA;
|
||||
if (map[x, y] < spherFacB)
|
||||
map[x, y] = spherFacB;
|
||||
}
|
||||
}
|
||||
PinHeadIsland();
|
||||
}
|
||||
|
||||
public TerrainChannel(String type)
|
||||
{
|
||||
map = new double[Constants.RegionSize, Constants.RegionSize];
|
||||
taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16];
|
||||
|
||||
if (type.Equals("flat"))
|
||||
FlatLand();
|
||||
else
|
||||
PinHeadIsland();
|
||||
}
|
||||
|
||||
public TerrainChannel(double[,] import)
|
||||
|
@ -238,5 +235,36 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PinHeadIsland()
|
||||
{
|
||||
int x;
|
||||
for (x = 0; x < Constants.RegionSize; x++)
|
||||
{
|
||||
int y;
|
||||
for (y = 0; y < Constants.RegionSize; y++)
|
||||
{
|
||||
map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10;
|
||||
double spherFacA = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 50) * 0.01;
|
||||
double spherFacB = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 100) * 0.001;
|
||||
if (map[x, y] < spherFacA)
|
||||
map[x, y] = spherFacA;
|
||||
if (map[x, y] < spherFacB)
|
||||
map[x, y] = spherFacB;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FlatLand()
|
||||
{
|
||||
int x;
|
||||
for (x = 0; x < Constants.RegionSize; x++)
|
||||
{
|
||||
int y;
|
||||
for (y = 0; y < Constants.RegionSize; y++)
|
||||
map[x, y] = 21;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace OpenSim.Region.Framework.Tests
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test MoveTaskInventoryItem where the item has no parent folder assigned.
|
||||
/// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This should place it in the most suitable user folder.
|
||||
|
@ -143,9 +143,11 @@ namespace OpenSim.Region.Framework.Tests
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test MoveTaskInventoryItem where the item has no parent folder assigned.
|
||||
/// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This should place it in the most suitable user folder.
|
||||
/// </remarks>
|
||||
[Test]
|
||||
public void TestMoveTaskInventoryItemNoParent()
|
||||
{
|
||||
|
|
|
@ -88,22 +88,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
|
||||
public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene)
|
||||
{
|
||||
ScenePresence sp = scene.GetScenePresence(agentId);
|
||||
if (sp == null || sp.IsChildAgent)
|
||||
ScenePresence npc = scene.GetScenePresence(agentId);
|
||||
if (npc == null || npc.IsChildAgent)
|
||||
return false;
|
||||
|
||||
lock (m_avatars)
|
||||
if (!m_avatars.ContainsKey(agentId))
|
||||
return false;
|
||||
|
||||
// Delete existing sp attachments
|
||||
scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false);
|
||||
// Delete existing npc attachments
|
||||
scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false);
|
||||
|
||||
// Set new sp appearance. Also sends to clients.
|
||||
scene.RequestModuleInterface<IAvatarFactoryModule>().SetAppearance(sp, new AvatarAppearance(appearance, true));
|
||||
// XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments
|
||||
AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
|
||||
npc.Appearance = npcAppearance;
|
||||
|
||||
// Rez needed sp attachments
|
||||
scene.AttachmentsModule.RezAttachments(sp);
|
||||
// Rez needed npc attachments
|
||||
scene.AttachmentsModule.RezAttachments(npc);
|
||||
|
||||
IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>();
|
||||
module.SendAppearance(npc.UUID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -50,10 +50,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
[TestFixture]
|
||||
public class NPCModuleTests
|
||||
{
|
||||
private TestScene scene;
|
||||
private AvatarFactoryModule afm;
|
||||
private UserManagementModule umm;
|
||||
private AttachmentsModule am;
|
||||
private TestScene m_scene;
|
||||
private AvatarFactoryModule m_afMod;
|
||||
private UserManagementModule m_umMod;
|
||||
private AttachmentsModule m_attMod;
|
||||
private NPCModule m_npcMod;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void FixtureInit()
|
||||
|
@ -79,12 +80,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
config.AddConfig("Modules");
|
||||
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
||||
|
||||
afm = new AvatarFactoryModule();
|
||||
umm = new UserManagementModule();
|
||||
am = new AttachmentsModule();
|
||||
m_afMod = new AvatarFactoryModule();
|
||||
m_umMod = new UserManagementModule();
|
||||
m_attMod = new AttachmentsModule();
|
||||
m_npcMod = new NPCModule();
|
||||
|
||||
scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule());
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -93,7 +95,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
|
||||
// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
|
||||
|
||||
// 8 is the index of the first baked texture in AvatarAppearance
|
||||
|
@ -104,18 +106,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
|
||||
// We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell
|
||||
// ScenePresence.SendInitialData() to reset our entire appearance.
|
||||
scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));
|
||||
m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));
|
||||
|
||||
afm.SetAppearance(sp, originalTe, null);
|
||||
m_afMod.SetAppearance(sp, originalTe, null);
|
||||
|
||||
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||
UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance);
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
ScenePresence npc = scene.GetScenePresence(npcId);
|
||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||
|
||||
Assert.That(npc, Is.Not.Null);
|
||||
Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId));
|
||||
Assert.That(umm.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname)));
|
||||
Assert.That(m_umMod.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -124,42 +125,83 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
|
||||
// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
|
||||
|
||||
Vector3 startPos = new Vector3(128, 128, 30);
|
||||
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||
UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
npcModule.DeleteNPC(npcId, scene);
|
||||
m_npcMod.DeleteNPC(npcId, m_scene);
|
||||
|
||||
ScenePresence deletedNpc = scene.GetScenePresence(npcId);
|
||||
ScenePresence deletedNpc = m_scene.GetScenePresence(npcId);
|
||||
|
||||
Assert.That(deletedNpc, Is.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAttachments()
|
||||
public void TestCreateWithAttachments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
UserAccountHelpers.CreateUserWithInventory(scene, userId);
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
|
||||
|
||||
UUID attItemId = TestHelpers.ParseTail(0x2);
|
||||
UUID attAssetId = TestHelpers.ParseTail(0x3);
|
||||
string attName = "att";
|
||||
|
||||
UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
|
||||
UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
|
||||
|
||||
am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);
|
||||
m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);
|
||||
|
||||
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||
UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance);
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
ScenePresence npc = scene.GetScenePresence(npcId);
|
||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||
|
||||
// Check scene presence status
|
||||
Assert.That(npc.HasAttachments(), Is.True);
|
||||
List<SceneObjectGroup> attachments = npc.GetAttachments();
|
||||
Assert.That(attachments.Count, Is.EqualTo(1));
|
||||
SceneObjectGroup attSo = attachments[0];
|
||||
|
||||
// Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item
|
||||
// name. TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC.
|
||||
// Assert.That(attSo.Name, Is.EqualTo(attName));
|
||||
|
||||
Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
|
||||
Assert.That(attSo.IsAttachment);
|
||||
Assert.That(attSo.UsesPhysics, Is.False);
|
||||
Assert.That(attSo.IsTemporary, Is.False);
|
||||
Assert.That(attSo.OwnerID, Is.EqualTo(npc.UUID));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLoadAppearance()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
|
||||
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
// Now add the attachment to the original avatar and use that to load a new appearance
|
||||
// TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here
|
||||
UUID attItemId = TestHelpers.ParseTail(0x2);
|
||||
UUID attAssetId = TestHelpers.ParseTail(0x3);
|
||||
string attName = "att";
|
||||
|
||||
UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
|
||||
|
||||
m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);
|
||||
|
||||
m_npcMod.SetNPCAppearance(npcId, sp.Appearance, m_scene);
|
||||
|
||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||
|
||||
// Check scene presence status
|
||||
Assert.That(npc.HasAttachments(), Is.True);
|
||||
|
@ -184,31 +226,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
|
||||
// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
|
||||
|
||||
Vector3 startPos = new Vector3(128, 128, 30);
|
||||
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||
UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
ScenePresence npc = scene.GetScenePresence(npcId);
|
||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
||||
|
||||
// For now, we'll make the scene presence fly to simplify this test, but this needs to change.
|
||||
npc.Flying = true;
|
||||
|
||||
scene.Update();
|
||||
m_scene.Update();
|
||||
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
||||
|
||||
Vector3 targetPos = startPos + new Vector3(0, 10, 0);
|
||||
npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false);
|
||||
m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false);
|
||||
|
||||
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
||||
//Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f)));
|
||||
Assert.That(
|
||||
npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001));
|
||||
|
||||
scene.Update();
|
||||
m_scene.Update();
|
||||
|
||||
// We should really check the exact figure.
|
||||
Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X));
|
||||
|
@ -217,7 +258,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X));
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
scene.Update();
|
||||
m_scene.Update();
|
||||
|
||||
double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
|
||||
Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move");
|
||||
|
@ -227,14 +268,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
// Try a second movement
|
||||
startPos = npc.AbsolutePosition;
|
||||
targetPos = startPos + new Vector3(10, 0, 0);
|
||||
npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false);
|
||||
m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false);
|
||||
|
||||
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
||||
// Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1)));
|
||||
Assert.That(
|
||||
npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001));
|
||||
|
||||
scene.Update();
|
||||
m_scene.Update();
|
||||
|
||||
// We should really check the exact figure.
|
||||
Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X));
|
||||
|
@ -243,7 +284,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z));
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
scene.Update();
|
||||
m_scene.Update();
|
||||
|
||||
distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
|
||||
Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move");
|
||||
|
@ -256,17 +297,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
|
||||
|
||||
Vector3 startPos = new Vector3(128, 128, 30);
|
||||
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||
UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
ScenePresence npc = scene.GetScenePresence(npcId);
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
|
||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
||||
|
||||
part.SitTargetPosition = new Vector3(0, 0, 1);
|
||||
npcModule.Sit(npc.UUID, part.UUID, scene);
|
||||
m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
|
||||
|
||||
Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
|
||||
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
|
||||
|
@ -274,7 +314,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
npc.AbsolutePosition,
|
||||
Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
|
||||
|
||||
npcModule.Stand(npc.UUID, scene);
|
||||
m_npcMod.Stand(npc.UUID, m_scene);
|
||||
|
||||
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
|
||||
Assert.That(npc.ParentID, Is.EqualTo(0));
|
||||
|
@ -286,19 +326,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
|
||||
|
||||
// FIXME: To get this to work for now, we are going to place the npc right next to the target so that
|
||||
// the autopilot doesn't trigger
|
||||
Vector3 startPos = new Vector3(1, 1, 1);
|
||||
|
||||
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
|
||||
UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance);
|
||||
UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
|
||||
|
||||
ScenePresence npc = scene.GetScenePresence(npcId);
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
|
||||
ScenePresence npc = m_scene.GetScenePresence(npcId);
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
|
||||
|
||||
npcModule.Sit(npc.UUID, part.UUID, scene);
|
||||
m_npcMod.Sit(npc.UUID, part.UUID, m_scene);
|
||||
|
||||
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
|
||||
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
|
||||
|
@ -311,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
npc.AbsolutePosition,
|
||||
Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f)));
|
||||
|
||||
npcModule.Stand(npc.UUID, scene);
|
||||
m_npcMod.Stand(npc.UUID, m_scene);
|
||||
|
||||
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
|
||||
Assert.That(npc.ParentID, Is.EqualTo(0));
|
||||
|
|
|
@ -358,7 +358,7 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
|
||||
if (physicsParms == null)
|
||||
{
|
||||
m_log.Warn("[MESH]: no recognized physics mesh found in mesh asset");
|
||||
m_log.WarnFormat("[MESH]: No recognized physics mesh found in mesh asset for {0}", primName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -842,17 +842,23 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage
|
||||
|
||||
mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
|
||||
if (m_MeshToTriMeshMap.ContainsKey(mesh))
|
||||
{
|
||||
_triMeshData = m_MeshToTriMeshMap[mesh];
|
||||
}
|
||||
else
|
||||
{
|
||||
_triMeshData = d.GeomTriMeshDataCreate();
|
||||
|
||||
d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
|
||||
d.GeomTriMeshDataPreprocess(_triMeshData);
|
||||
m_MeshToTriMeshMap[mesh] = _triMeshData;
|
||||
// We must lock here since m_MeshToTriMeshMap is static and multiple scene threads may call this method at
|
||||
// the same time.
|
||||
lock (m_MeshToTriMeshMap)
|
||||
{
|
||||
if (m_MeshToTriMeshMap.ContainsKey(mesh))
|
||||
{
|
||||
_triMeshData = m_MeshToTriMeshMap[mesh];
|
||||
}
|
||||
else
|
||||
{
|
||||
_triMeshData = d.GeomTriMeshDataCreate();
|
||||
|
||||
d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
|
||||
d.GeomTriMeshDataPreprocess(_triMeshData);
|
||||
m_MeshToTriMeshMap[mesh] = _triMeshData;
|
||||
}
|
||||
}
|
||||
|
||||
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
||||
|
|
|
@ -68,14 +68,48 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
|||
/// </summary>
|
||||
bool Suspended { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Is the script shutting down?
|
||||
/// </summary>
|
||||
bool ShuttingDown { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Script state
|
||||
/// </summary>
|
||||
string State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Time the script was last started
|
||||
/// </summary>
|
||||
DateTime TimeStarted { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Tick the last measurement period was started.
|
||||
/// </summary>
|
||||
long MeasurementPeriodTickStart { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Ticks spent executing in the last measurement period.
|
||||
/// </summary>
|
||||
long MeasurementPeriodExecutionTime { get; }
|
||||
|
||||
IScriptEngine Engine { get; }
|
||||
UUID AppDomain { get; set; }
|
||||
string PrimName { get; }
|
||||
string ScriptName { get; }
|
||||
UUID ItemID { get; }
|
||||
UUID ObjectID { get; }
|
||||
|
||||
/// <summary>
|
||||
/// UUID of the root object for the linkset that the script is in.
|
||||
/// </summary>
|
||||
UUID RootObjectID { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Local id of the root object for the linkset that the script is in.
|
||||
/// </summary>
|
||||
uint RootLocalID { get; }
|
||||
|
||||
uint LocalID { get; }
|
||||
UUID AssetID { get; }
|
||||
Queue EventQueue { get; }
|
||||
|
@ -89,7 +123,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
|||
void Start();
|
||||
|
||||
/// <summary>
|
||||
/// Stop the script.
|
||||
/// Stop the script instance.
|
||||
/// </summary>
|
||||
/// <param name="timeout"></param>
|
||||
/// <returns>true if the script was successfully stopped, false otherwise</returns>
|
||||
|
@ -97,13 +131,17 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
|||
|
||||
void SetState(string state);
|
||||
|
||||
/// <summary>
|
||||
/// Post an event to this script instance.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void PostEvent(EventParams data);
|
||||
|
||||
void Suspend();
|
||||
void Resume();
|
||||
|
||||
/// <summary>
|
||||
/// Process the next event queued for this script
|
||||
/// Process the next event queued for this script instance.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
object EventProcessor();
|
||||
|
|
|
@ -247,7 +247,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
// Remove Sensors
|
||||
m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the sensor repeat plugin for this script engine.
|
||||
/// </summary>
|
||||
/// <param name="engine"></param>
|
||||
/// <returns></returns>
|
||||
public static SensorRepeat GetSensorRepeatPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_SensorRepeat.ContainsKey(engine))
|
||||
return m_SensorRepeat[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the dataserver plugin for this script engine.
|
||||
/// </summary>
|
||||
/// <param name="engine"></param>
|
||||
/// <returns></returns>
|
||||
public static Dataserver GetDataserverPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_Dataserver.ContainsKey(engine))
|
||||
return m_Dataserver[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the timer plugin for this script engine.
|
||||
/// </summary>
|
||||
/// <param name="engine"></param>
|
||||
/// <returns></returns>
|
||||
public static Timer GetTimerPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_Timer.ContainsKey(engine))
|
||||
return m_Timer[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the listener plugin for this script engine.
|
||||
/// </summary>
|
||||
/// <param name="engine"></param>
|
||||
/// <returns></returns>
|
||||
public static Listener GetListenerPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_Listener.ContainsKey(engine))
|
||||
return m_Listener[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID)
|
||||
|
@ -270,7 +321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
data.AddRange(timers);
|
||||
}
|
||||
|
||||
Object[] sensors=m_SensorRepeat[engine].GetSerializationData(itemID);
|
||||
Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID);
|
||||
if (sensors.Length > 0)
|
||||
{
|
||||
data.Add("sensor");
|
||||
|
|
|
@ -2771,64 +2771,69 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
|
||||
return;
|
||||
float dist = (float)llVecDist(llGetPos(), pos);
|
||||
|
||||
if (dist > m_ScriptDistanceFactor * 10.0f)
|
||||
return;
|
||||
|
||||
TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
|
||||
|
||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
|
||||
Util.FireAndForget(delegate (object x)
|
||||
{
|
||||
if (inv.Value.Name == inventory)
|
||||
if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s))
|
||||
return;
|
||||
float dist = (float)llVecDist(llGetPos(), pos);
|
||||
|
||||
if (dist > m_ScriptDistanceFactor * 10.0f)
|
||||
return;
|
||||
|
||||
//Clone is thread-safe
|
||||
TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
|
||||
|
||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
|
||||
{
|
||||
// make sure we're an object.
|
||||
if (inv.Value.InvType != (int)InventoryType.Object)
|
||||
if (inv.Value.Name == inventory)
|
||||
{
|
||||
llSay(0, "Unable to create requested object. Object is missing from database.");
|
||||
// make sure we're an object.
|
||||
if (inv.Value.InvType != (int)InventoryType.Object)
|
||||
{
|
||||
llSay(0, "Unable to create requested object. Object is missing from database.");
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
|
||||
Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
|
||||
|
||||
// need the magnitude later
|
||||
// float velmag = (float)Util.GetMagnitude(llvel);
|
||||
|
||||
SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param);
|
||||
|
||||
// If either of these are null, then there was an unknown error.
|
||||
if (new_group == null)
|
||||
continue;
|
||||
|
||||
// objects rezzed with this method are die_at_edge by default.
|
||||
new_group.RootPart.SetDieAtEdge(true);
|
||||
|
||||
new_group.ResumeScripts();
|
||||
|
||||
m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams(
|
||||
"object_rez", new Object[] {
|
||||
new LSL_String(
|
||||
new_group.RootPart.UUID.ToString()) },
|
||||
new DetectParams[0]));
|
||||
|
||||
float groupmass = new_group.GetMass();
|
||||
|
||||
if (new_group.RootPart.PhysActor != null && new_group.RootPart.PhysActor.IsPhysical && llvel != Vector3.Zero)
|
||||
{
|
||||
//Recoil.
|
||||
llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
|
||||
}
|
||||
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
|
||||
Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
|
||||
|
||||
// need the magnitude later
|
||||
float velmag = (float)Util.GetMagnitude(llvel);
|
||||
|
||||
SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param);
|
||||
|
||||
// If either of these are null, then there was an unknown error.
|
||||
if (new_group == null)
|
||||
continue;
|
||||
|
||||
// objects rezzed with this method are die_at_edge by default.
|
||||
new_group.RootPart.SetDieAtEdge(true);
|
||||
|
||||
new_group.ResumeScripts();
|
||||
|
||||
m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams(
|
||||
"object_rez", new Object[] {
|
||||
new LSL_String(
|
||||
new_group.RootPart.UUID.ToString()) },
|
||||
new DetectParams[0]));
|
||||
|
||||
float groupmass = new_group.GetMass();
|
||||
|
||||
if (new_group.RootPart.PhysActor != null && new_group.RootPart.PhysActor.IsPhysical && llvel != Vector3.Zero)
|
||||
{
|
||||
//Recoil.
|
||||
llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
|
||||
}
|
||||
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
|
||||
ScriptSleep((int)((groupmass * velmag) / 10));
|
||||
ScriptSleep(100);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
llSay(0, "Could not find object " + inventory);
|
||||
llSay(0, "Could not find object " + inventory);
|
||||
});
|
||||
|
||||
//ScriptSleep((int)((groupmass * velmag) / 10));
|
||||
ScriptSleep(100);
|
||||
}
|
||||
|
||||
public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
|
||||
|
@ -7069,10 +7074,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
shapeBlock.PathScaleX = 100;
|
||||
shapeBlock.PathScaleY = 150;
|
||||
|
||||
if (type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER &&
|
||||
type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE &&
|
||||
type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE &&
|
||||
type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS)
|
||||
int flag = type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR);
|
||||
|
||||
if (type != (ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER | flag) &&
|
||||
type != (ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE | flag) &&
|
||||
type != (ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE | flag) &&
|
||||
type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag))
|
||||
{
|
||||
// default
|
||||
type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE;
|
||||
|
|
|
@ -38,6 +38,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
{
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
public int DataserverRequestsCount
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (DataserverRequests)
|
||||
return DataserverRequests.Count;
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, DataserverRequest> DataserverRequests =
|
||||
new Dictionary<string, DataserverRequest>();
|
||||
|
||||
|
|
|
@ -42,22 +42,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
private IWorldComm m_commsPlugin;
|
||||
|
||||
public int ListenerCount
|
||||
{
|
||||
get { return m_commsPlugin.ListenerCount; }
|
||||
}
|
||||
|
||||
public Listener(AsyncCommandManager CmdManager)
|
||||
{
|
||||
m_CmdManager = CmdManager;
|
||||
m_commsPlugin = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
}
|
||||
|
||||
public void CheckListeners()
|
||||
{
|
||||
if (m_CmdManager.m_ScriptEngine.World == null)
|
||||
return;
|
||||
IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
|
||||
if (comms != null)
|
||||
if (m_commsPlugin != null)
|
||||
{
|
||||
while (comms.HasMessages())
|
||||
while (m_commsPlugin.HasMessages())
|
||||
{
|
||||
ListenerInfo lInfo = (ListenerInfo)comms.GetNextMessage();
|
||||
ListenerInfo lInfo = (ListenerInfo)m_commsPlugin.GetNextMessage();
|
||||
|
||||
//Deliver data to prim's listen handler
|
||||
object[] resobj = new object[]
|
||||
|
@ -81,17 +88,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
|
||||
public Object[] GetSerializationData(UUID itemID)
|
||||
{
|
||||
IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
|
||||
return comms.GetSerializationData(itemID);
|
||||
return m_commsPlugin.GetSerializationData(itemID);
|
||||
}
|
||||
|
||||
public void CreateFromData(uint localID, UUID itemID, UUID hostID,
|
||||
Object[] data)
|
||||
{
|
||||
IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
|
||||
comms.CreateFromData(localID, itemID, hostID, data);
|
||||
m_commsPlugin.CreateFromData(localID, itemID, hostID, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,6 +44,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
/// <summary>
|
||||
/// Number of sensors active.
|
||||
/// </summary>
|
||||
public int SensorsCount
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (SenseRepeatListLock)
|
||||
return SenseRepeaters.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public SensorRepeat(AsyncCommandManager CmdManager)
|
||||
{
|
||||
m_CmdManager = CmdManager;
|
||||
|
@ -157,12 +169,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
|
||||
public void CheckSenseRepeaterEvents()
|
||||
{
|
||||
// Nothing to do here?
|
||||
if (SenseRepeaters.Count == 0)
|
||||
return;
|
||||
|
||||
lock (SenseRepeatListLock)
|
||||
{
|
||||
// Nothing to do here?
|
||||
if (SenseRepeaters.Count == 0)
|
||||
return;
|
||||
|
||||
// Go through all timers
|
||||
foreach (SenseRepeatClass ts in SenseRepeaters)
|
||||
{
|
||||
|
@ -635,7 +647,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
ts.next =
|
||||
DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
|
||||
|
||||
SenseRepeaters.Add(ts);
|
||||
lock (SenseRepeatListLock)
|
||||
SenseRepeaters.Add(ts);
|
||||
|
||||
idx += 6;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
{
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
public int TimersCount
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (TimerListLock)
|
||||
return Timers.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public Timer(AsyncCommandManager CmdManager)
|
||||
{
|
||||
m_CmdManager = CmdManager;
|
||||
|
|
|
@ -378,6 +378,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
public const int PRIM_SCULPT_TYPE_TORUS = 2;
|
||||
public const int PRIM_SCULPT_TYPE_PLANE = 3;
|
||||
public const int PRIM_SCULPT_TYPE_CYLINDER = 4;
|
||||
public const int PRIM_SCULPT_FLAG_INVERT = 64;
|
||||
public const int PRIM_SCULPT_FLAG_MIRROR = 128;
|
||||
|
||||
public const int MASK_BASE = 0;
|
||||
public const int MASK_OWNER = 1;
|
||||
|
|
|
@ -226,7 +226,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int z = 0;
|
||||
try
|
||||
{
|
||||
if (gotMatch)
|
||||
|
@ -235,8 +235,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
|
|||
finally
|
||||
{
|
||||
// Manually finalize all the iterators.
|
||||
for (int i = 0; i < nIterators; ++i)
|
||||
iterators[i].Dispose();
|
||||
for (z = 0; z < nIterators; ++z)
|
||||
iterators[z].Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -576,7 +576,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int z = 0;
|
||||
try
|
||||
{
|
||||
if (gotMatch)
|
||||
|
@ -585,8 +585,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
|
|||
finally
|
||||
{
|
||||
// Manually finalize all the iterators.
|
||||
for (int i = 0; i < nIterators; ++i)
|
||||
iterators[i].Dispose();
|
||||
for (z = 0; z < nIterators; ++z)
|
||||
iterators[z].Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
|||
emessage = emessage.Substring(slinfo.Length+2);
|
||||
|
||||
message = String.Format("({0},{1}) {2}",
|
||||
e.slInfo.lineNumber - 2,
|
||||
e.slInfo.lineNumber - 1,
|
||||
e.slInfo.charPosition - 1, emessage);
|
||||
|
||||
throw new Exception(message);
|
||||
|
|
|
@ -29,6 +29,7 @@ using System.Collections.Generic;
|
|||
using System.Text.RegularExpressions;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Region.ScriptEngine.Shared.CodeTools;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
||||
{
|
||||
|
@ -43,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
[Test]
|
||||
public void TestDefaultState()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -63,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
[Test]
|
||||
public void TestCustomState()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -93,6 +98,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestEventWithArguments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
at_rot_target(integer tnum, rotation targetrot, rotation ourrot)
|
||||
|
@ -113,6 +120,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestIntegerDeclaration()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -135,6 +144,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestLoneIdent()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// A lone ident should be removed completely as it's an error in C#
|
||||
// (MONO at least).
|
||||
string input = @"default
|
||||
|
@ -161,6 +172,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestAssignments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -187,6 +200,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestAdditionSubtractionOperator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -215,6 +230,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestStrings()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -242,6 +259,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestBinaryExpression()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -284,6 +303,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestFloatConstants()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -336,6 +357,8 @@ state another_state
|
|||
[Test]
|
||||
public void TestComments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// this test tests comments
|
||||
default
|
||||
{
|
||||
|
@ -358,6 +381,8 @@ default
|
|||
[Test]
|
||||
public void TestStringsWithEscapedQuotesAndComments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// this test tests strings, with escaped quotes and comments in strings
|
||||
default
|
||||
{
|
||||
|
@ -397,6 +422,8 @@ default
|
|||
[Test]
|
||||
public void TestCStyleComments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"/* this test tests comments
|
||||
of the C variety
|
||||
*/
|
||||
|
@ -426,6 +453,8 @@ default
|
|||
[Test]
|
||||
public void TestGlobalDefinedFunctions()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// this test tests custom defined functions
|
||||
|
||||
string onefunc()
|
||||
|
@ -470,6 +499,8 @@ default
|
|||
[Test]
|
||||
public void TestGlobalDeclaredVariables()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// this test tests custom defined functions and global variables
|
||||
|
||||
string globalString;
|
||||
|
@ -525,6 +556,8 @@ default
|
|||
[Test]
|
||||
public void TestMoreAssignments()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// this test tests +=, -=, *=, /=, %=
|
||||
|
||||
string globalString;
|
||||
|
@ -579,6 +612,8 @@ default
|
|||
[Test]
|
||||
public void TestVectorConstantNotation()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -606,6 +641,8 @@ default
|
|||
[Test]
|
||||
public void TestVectorMemberAccess()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -632,6 +669,8 @@ default
|
|||
[Test]
|
||||
public void TestExpressionInParentheses()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
touch_start(integer num_detected)
|
||||
|
@ -660,6 +699,8 @@ default
|
|||
[Test]
|
||||
public void TestIncrementDecrementOperator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// here we'll test the ++ and -- operators
|
||||
|
||||
default
|
||||
|
@ -690,6 +731,8 @@ default
|
|||
[Test]
|
||||
public void TestLists()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// testing lists
|
||||
|
||||
default
|
||||
|
@ -718,6 +761,8 @@ default
|
|||
[Test]
|
||||
public void TestIfStatement()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test if statements
|
||||
|
||||
default
|
||||
|
@ -822,6 +867,8 @@ default
|
|||
[Test]
|
||||
public void TestIfElseStatement()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test complex logical expressions
|
||||
|
||||
default
|
||||
|
@ -928,6 +975,8 @@ default
|
|||
[Test]
|
||||
public void TestWhileLoop()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test while loops
|
||||
|
||||
default
|
||||
|
@ -968,6 +1017,8 @@ default
|
|||
[Test]
|
||||
public void TestDoWhileLoop()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test do-while loops
|
||||
|
||||
default
|
||||
|
@ -1012,6 +1063,8 @@ default
|
|||
[Test]
|
||||
public void TestForLoop()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test for loops
|
||||
|
||||
default
|
||||
|
@ -1056,6 +1109,8 @@ default
|
|||
[Test]
|
||||
public void TestFloatsWithTrailingDecimal()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// a curious feature of LSL that allows floats to be defined with a trailing dot
|
||||
|
||||
default
|
||||
|
@ -1108,6 +1163,8 @@ default
|
|||
[Test]
|
||||
public void TestUnaryAndBinaryOperators()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test a few more operators
|
||||
|
||||
default
|
||||
|
@ -1144,6 +1201,8 @@ default
|
|||
[Test]
|
||||
public void TestTypecasts()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test typecasts
|
||||
|
||||
default
|
||||
|
@ -1189,6 +1248,8 @@ default
|
|||
[Test]
|
||||
public void TestStates()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test states
|
||||
|
||||
default
|
||||
|
@ -1229,6 +1290,8 @@ state statetwo
|
|||
[Test]
|
||||
public void TestHexIntegerConstants()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test hex integers
|
||||
|
||||
default
|
||||
|
@ -1261,6 +1324,8 @@ default
|
|||
[Test]
|
||||
public void TestJumps()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test jumps
|
||||
|
||||
default
|
||||
|
@ -1291,6 +1356,8 @@ default
|
|||
[Test]
|
||||
public void TestImplicitVariableInitialization()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test implicitly initializing variables
|
||||
|
||||
default
|
||||
|
@ -1334,6 +1401,8 @@ default
|
|||
[Test]
|
||||
public void TestMultipleEqualsExpression()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test x = y = 5 type expressions
|
||||
|
||||
default
|
||||
|
@ -1366,6 +1435,8 @@ default
|
|||
[Test]
|
||||
public void TestUnaryExpressionLastInVectorConstant()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test unary expressions some more
|
||||
|
||||
default
|
||||
|
@ -1390,6 +1461,8 @@ default
|
|||
[Test]
|
||||
public void TestVectorMemberPlusEquals()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"// let's test unary expressions some more
|
||||
|
||||
default
|
||||
|
@ -1424,6 +1497,8 @@ default
|
|||
[Test]
|
||||
public void TestWhileLoopWithNoBody()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1447,6 +1522,8 @@ default
|
|||
[Test]
|
||||
public void TestDoWhileLoopWithNoBody()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1472,6 +1549,8 @@ default
|
|||
[Test]
|
||||
public void TestIfWithNoBody()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1495,6 +1574,8 @@ default
|
|||
[Test]
|
||||
public void TestIfElseWithNoBody()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1521,6 +1602,8 @@ default
|
|||
[Test]
|
||||
public void TestForLoopWithNoBody()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1544,6 +1627,8 @@ default
|
|||
[Test]
|
||||
public void TestForLoopWithNoAssignment()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1569,6 +1654,8 @@ default
|
|||
[Test]
|
||||
public void TestForLoopWithOnlyIdentInAssignment()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1594,6 +1681,8 @@ default
|
|||
[Test]
|
||||
public void TestAssignmentInIfWhileDoWhile()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1631,6 +1720,8 @@ default
|
|||
[Test]
|
||||
public void TestLSLListHack()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1653,9 +1744,12 @@ default
|
|||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(System.Exception))]
|
||||
public void TestSyntaxError()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
bool gotException = false;
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1671,17 +1765,22 @@ default
|
|||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
// The syntax error is on line 6, char 5 (expected ';', found
|
||||
// The syntax error is on line 5, char 4 (expected ';', found
|
||||
// '}').
|
||||
Assert.AreEqual("(4,4) syntax error", e.Message);
|
||||
throw;
|
||||
Assert.AreEqual("(5,4) syntax error", e.Message);
|
||||
gotException = true;
|
||||
}
|
||||
|
||||
Assert.That(gotException, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(System.Exception))]
|
||||
public void TestSyntaxErrorDeclaringVariableInForLoop()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
bool gotException = false;
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1697,11 +1796,13 @@ default
|
|||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
// The syntax error is on line 5, char 14 (Syntax error)
|
||||
Assert.AreEqual("(3,13) syntax error", e.Message);
|
||||
// The syntax error is on line 4, char 13 (Syntax error)
|
||||
Assert.AreEqual("(4,13) syntax error", e.Message);
|
||||
|
||||
throw;
|
||||
gotException = true;
|
||||
}
|
||||
|
||||
Assert.That(gotException, Is.True);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.Collections.Generic;
|
|||
using Microsoft.CSharp;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Region.ScriptEngine.Shared.CodeTools;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
||||
{
|
||||
|
@ -92,6 +93,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
//[Test]
|
||||
public void TestUseUndeclaredVariable()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll");
|
||||
|
||||
string input = @"default
|
||||
|
@ -124,6 +127,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
//[Test]
|
||||
public void TestCastAndConcatString()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll");
|
||||
|
||||
string input = @"string s = "" a string"";
|
||||
|
@ -150,4 +155,4 @@ default
|
|||
Assert.AreEqual(0, m_compilerResults.Errors.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -56,36 +56,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
public class ScriptInstance : MarshalByRefObject, IScriptInstance
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IScriptEngine m_Engine;
|
||||
private IScriptWorkItem m_CurrentResult = null;
|
||||
private Queue m_EventQueue = new Queue(32);
|
||||
private bool m_RunEvents = false;
|
||||
private UUID m_ItemID;
|
||||
private uint m_LocalID;
|
||||
private UUID m_ObjectID;
|
||||
private UUID m_AssetID;
|
||||
|
||||
/// <summary>
|
||||
/// The current work item if an event for this script is running or waiting to run,
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Null if there is no running or waiting to run event. Must be changed only under an EventQueue lock.
|
||||
/// </remarks>
|
||||
private IScriptWorkItem m_CurrentWorkItem;
|
||||
|
||||
private IScript m_Script;
|
||||
private UUID m_AppDomain;
|
||||
private DetectParams[] m_DetectParams;
|
||||
private bool m_TimerQueued;
|
||||
private DateTime m_EventStart;
|
||||
private bool m_InEvent;
|
||||
private string m_PrimName;
|
||||
private string m_ScriptName;
|
||||
private string m_Assembly;
|
||||
private int m_StartParam;
|
||||
private string m_CurrentEvent = String.Empty;
|
||||
private bool m_InSelfDelete;
|
||||
private int m_MaxScriptQueue;
|
||||
private bool m_SaveState = true;
|
||||
private bool m_ShuttingDown;
|
||||
private int m_ControlEventsInQueue;
|
||||
private int m_LastControlLevel;
|
||||
private bool m_CollisionInQueue;
|
||||
private TaskInventoryItem m_thisScriptTask;
|
||||
|
||||
// The following is for setting a minimum delay between events
|
||||
private double m_minEventDelay;
|
||||
|
||||
private long m_eventDelayTicks;
|
||||
private long m_nextEventTimeTicks;
|
||||
private bool m_startOnInit = true;
|
||||
|
@ -96,21 +92,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
private UUID m_CurrentStateHash;
|
||||
private UUID m_RegionID;
|
||||
|
||||
private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
|
||||
m_LineMap;
|
||||
|
||||
public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
|
||||
LineMap
|
||||
{
|
||||
get { return m_LineMap; }
|
||||
set { m_LineMap = value; }
|
||||
}
|
||||
public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; }
|
||||
|
||||
private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
|
||||
|
||||
// Script state
|
||||
private string m_State = "default";
|
||||
|
||||
public Object[] PluginData = new Object[0];
|
||||
|
||||
/// <summary>
|
||||
|
@ -133,11 +118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
}
|
||||
}
|
||||
|
||||
public bool Running
|
||||
{
|
||||
get { return m_RunEvents; }
|
||||
set { m_RunEvents = value; }
|
||||
}
|
||||
public bool Running { get; set; }
|
||||
|
||||
public bool Suspended
|
||||
{
|
||||
|
@ -153,11 +134,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
|
||||
if (wasSuspended && !m_Suspended)
|
||||
{
|
||||
lock (m_EventQueue)
|
||||
lock (EventQueue)
|
||||
{
|
||||
// Need to place ourselves back in a work item if there are events to process
|
||||
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
|
||||
m_CurrentResult = m_Engine.QueueEventHandler(this);
|
||||
if (EventQueue.Count > 0 && Running && !ShuttingDown)
|
||||
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,79 +146,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
}
|
||||
private bool m_Suspended;
|
||||
|
||||
public bool ShuttingDown
|
||||
{
|
||||
get { return m_ShuttingDown; }
|
||||
set { m_ShuttingDown = value; }
|
||||
}
|
||||
public bool ShuttingDown { get; set; }
|
||||
|
||||
public string State
|
||||
{
|
||||
get { return m_State; }
|
||||
set { m_State = value; }
|
||||
}
|
||||
public string State { get; set; }
|
||||
|
||||
public IScriptEngine Engine
|
||||
{
|
||||
get { return m_Engine; }
|
||||
}
|
||||
public IScriptEngine Engine { get; private set; }
|
||||
|
||||
public UUID AppDomain
|
||||
{
|
||||
get { return m_AppDomain; }
|
||||
set { m_AppDomain = value; }
|
||||
}
|
||||
public UUID AppDomain { get; set; }
|
||||
|
||||
public string PrimName
|
||||
{
|
||||
get { return m_PrimName; }
|
||||
}
|
||||
public string PrimName { get; private set; }
|
||||
|
||||
public string ScriptName
|
||||
{
|
||||
get { return m_ScriptName; }
|
||||
}
|
||||
public string ScriptName { get; private set; }
|
||||
|
||||
public UUID ItemID
|
||||
{
|
||||
get { return m_ItemID; }
|
||||
}
|
||||
public UUID ItemID { get; private set; }
|
||||
|
||||
public UUID ObjectID
|
||||
{
|
||||
get { return m_ObjectID; }
|
||||
}
|
||||
public UUID ObjectID { get; private set; }
|
||||
|
||||
public uint LocalID
|
||||
{
|
||||
get { return m_LocalID; }
|
||||
}
|
||||
public uint LocalID { get; private set; }
|
||||
|
||||
public UUID AssetID
|
||||
{
|
||||
get { return m_AssetID; }
|
||||
}
|
||||
public UUID RootObjectID { get; private set; }
|
||||
|
||||
public Queue EventQueue
|
||||
{
|
||||
get { return m_EventQueue; }
|
||||
}
|
||||
public uint RootLocalID { get; private set; }
|
||||
|
||||
public UUID AssetID { get; private set; }
|
||||
|
||||
public Queue EventQueue { get; private set; }
|
||||
|
||||
public int StartParam { get; set; }
|
||||
|
||||
public TaskInventoryItem ScriptTask { get; private set; }
|
||||
|
||||
public DateTime TimeStarted { get; private set; }
|
||||
|
||||
public long MeasurementPeriodTickStart { get; private set; }
|
||||
|
||||
public long MeasurementPeriodExecutionTime { get; private set; }
|
||||
|
||||
public static readonly long MaxMeasurementPeriod = 30 * TimeSpan.TicksPerMinute;
|
||||
|
||||
public void ClearQueue()
|
||||
{
|
||||
m_TimerQueued = false;
|
||||
m_EventQueue.Clear();
|
||||
}
|
||||
|
||||
public int StartParam
|
||||
{
|
||||
get { return m_StartParam; }
|
||||
set { m_StartParam = value; }
|
||||
}
|
||||
|
||||
public TaskInventoryItem ScriptTask
|
||||
{
|
||||
get { return m_thisScriptTask; }
|
||||
EventQueue.Clear();
|
||||
}
|
||||
|
||||
public ScriptInstance(IScriptEngine engine, SceneObjectPart part,
|
||||
|
@ -246,16 +196,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
int startParam, bool postOnRez, StateSource stateSource,
|
||||
int maxScriptQueue)
|
||||
{
|
||||
m_Engine = engine;
|
||||
State = "default";
|
||||
EventQueue = new Queue(32);
|
||||
|
||||
m_LocalID = part.LocalId;
|
||||
m_ObjectID = part.UUID;
|
||||
m_ItemID = itemID;
|
||||
m_AssetID = assetID;
|
||||
m_PrimName = primName;
|
||||
m_ScriptName = scriptName;
|
||||
Engine = engine;
|
||||
LocalID = part.LocalId;
|
||||
ObjectID = part.UUID;
|
||||
RootLocalID = part.ParentGroup.LocalId;
|
||||
RootObjectID = part.ParentGroup.UUID;
|
||||
ItemID = itemID;
|
||||
AssetID = assetID;
|
||||
PrimName = primName;
|
||||
ScriptName = scriptName;
|
||||
m_Assembly = assembly;
|
||||
m_StartParam = startParam;
|
||||
StartParam = startParam;
|
||||
m_MaxScriptQueue = maxScriptQueue;
|
||||
m_stateSource = stateSource;
|
||||
m_postOnRez = postOnRez;
|
||||
|
@ -266,9 +220,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
{
|
||||
lock (part.TaskInventory)
|
||||
{
|
||||
if (part.TaskInventory.ContainsKey(m_ItemID))
|
||||
if (part.TaskInventory.ContainsKey(ItemID))
|
||||
{
|
||||
m_thisScriptTask = part.TaskInventory[m_ItemID];
|
||||
ScriptTask = part.TaskInventory[ItemID];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -278,20 +232,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
foreach (string api in am.GetApis())
|
||||
{
|
||||
m_Apis[api] = am.CreateApi(api);
|
||||
m_Apis[api].Initialize(engine, part, m_LocalID, itemID);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (dom != System.AppDomain.CurrentDomain)
|
||||
m_Script = (IScript)dom.CreateInstanceAndUnwrap(
|
||||
Path.GetFileNameWithoutExtension(assembly),
|
||||
"SecondLife.Script");
|
||||
else
|
||||
m_Script = (IScript)Assembly.Load(
|
||||
Path.GetFileNameWithoutExtension(assembly)).CreateInstance(
|
||||
"SecondLife.Script");
|
||||
|
||||
m_Apis[api].Initialize(engine, part, LocalID, itemID);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (dom != System.AppDomain.CurrentDomain)
|
||||
m_Script = (IScript)dom.CreateInstanceAndUnwrap(
|
||||
Path.GetFileNameWithoutExtension(assembly),
|
||||
"SecondLife.Script");
|
||||
else
|
||||
m_Script = (IScript)Assembly.Load(
|
||||
Path.GetFileNameWithoutExtension(assembly)).CreateInstance(
|
||||
"SecondLife.Script");
|
||||
|
||||
//ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
|
||||
//RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
|
||||
|
@ -313,7 +266,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
|
||||
// // m_log.Debug("[Script] Script instance created");
|
||||
|
||||
part.SetScriptEvents(m_ItemID,
|
||||
part.SetScriptEvents(ItemID,
|
||||
(int)m_Script.GetStateEventFlags(State));
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -328,7 +281,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
m_SaveState = true;
|
||||
|
||||
string savedState = Path.Combine(Path.GetDirectoryName(assembly),
|
||||
m_ItemID.ToString() + ".state");
|
||||
ItemID.ToString() + ".state");
|
||||
if (File.Exists(savedState))
|
||||
{
|
||||
string xml = String.Empty;
|
||||
|
@ -352,24 +305,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
|
||||
ScriptSerializer.Deserialize(xml, this);
|
||||
|
||||
AsyncCommandManager.CreateFromData(m_Engine,
|
||||
m_LocalID, m_ItemID, m_ObjectID,
|
||||
AsyncCommandManager.CreateFromData(Engine,
|
||||
LocalID, ItemID, ObjectID,
|
||||
PluginData);
|
||||
|
||||
// m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", m_PrimName, m_ScriptName);
|
||||
// m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", PrimName, m_ScriptName);
|
||||
|
||||
part.SetScriptEvents(m_ItemID,
|
||||
part.SetScriptEvents(ItemID,
|
||||
(int)m_Script.GetStateEventFlags(State));
|
||||
|
||||
if (m_RunEvents && (!m_ShuttingDown))
|
||||
{
|
||||
m_RunEvents = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RunEvents = false;
|
||||
Running = false;
|
||||
|
||||
if (ShuttingDown)
|
||||
m_startOnInit = false;
|
||||
}
|
||||
|
||||
// we get new rez events on sim restart, too
|
||||
// but if there is state, then we fire the change
|
||||
|
@ -378,7 +326,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
// We loaded state, don't force a re-save
|
||||
m_SaveState = false;
|
||||
m_startedFromSavedState = true;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -397,7 +344,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
}
|
||||
// else
|
||||
// {
|
||||
// ScenePresence presence = m_Engine.World.GetScenePresence(part.OwnerID);
|
||||
// ScenePresence presence = Engine.World.GetScenePresence(part.OwnerID);
|
||||
|
||||
// if (presence != null && (!postOnRez))
|
||||
// presence.ControllingClient.SendAgentAlertMessage("Compile successful", false);
|
||||
|
@ -415,7 +362,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
if (m_postOnRez)
|
||||
{
|
||||
PostEvent(new EventParams("on_rez",
|
||||
new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0]));
|
||||
new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0]));
|
||||
}
|
||||
|
||||
if (m_stateSource == StateSource.AttachedRez)
|
||||
|
@ -449,7 +396,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
if (m_postOnRez)
|
||||
{
|
||||
PostEvent(new EventParams("on_rez",
|
||||
new Object[] {new LSL_Types.LSLInteger(m_StartParam)}, new DetectParams[0]));
|
||||
new Object[] {new LSL_Types.LSLInteger(StartParam)}, new DetectParams[0]));
|
||||
}
|
||||
|
||||
if (m_stateSource == StateSource.AttachedRez)
|
||||
|
@ -463,7 +410,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
|
||||
private void ReleaseControls()
|
||||
{
|
||||
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(m_LocalID);
|
||||
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
|
||||
|
||||
if (part != null)
|
||||
{
|
||||
|
@ -471,18 +418,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
UUID permsGranter;
|
||||
lock (part.TaskInventory)
|
||||
{
|
||||
if (!part.TaskInventory.ContainsKey(m_ItemID))
|
||||
if (!part.TaskInventory.ContainsKey(ItemID))
|
||||
return;
|
||||
|
||||
permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
|
||||
permsMask = part.TaskInventory[m_ItemID].PermsMask;
|
||||
permsGranter = part.TaskInventory[ItemID].PermsGranter;
|
||||
permsMask = part.TaskInventory[ItemID].PermsMask;
|
||||
}
|
||||
|
||||
if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
||||
{
|
||||
ScenePresence presence = m_Engine.World.GetScenePresence(permsGranter);
|
||||
ScenePresence presence = Engine.World.GetScenePresence(permsGranter);
|
||||
if (presence != null)
|
||||
presence.UnRegisterControlEventsToScript(m_LocalID, m_ItemID);
|
||||
presence.UnRegisterControlEventsToScript(LocalID, ItemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -490,13 +437,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
public void DestroyScriptInstance()
|
||||
{
|
||||
ReleaseControls();
|
||||
AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID);
|
||||
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
|
||||
}
|
||||
|
||||
public void RemoveState()
|
||||
{
|
||||
string savedState = Path.Combine(Path.GetDirectoryName(m_Assembly),
|
||||
m_ItemID.ToString() + ".state");
|
||||
ItemID.ToString() + ".state");
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -509,7 +456,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
|
||||
public void VarDump(Dictionary<string, object> vars)
|
||||
{
|
||||
// m_log.Info("Variable dump for script "+ m_ItemID.ToString());
|
||||
// m_log.Info("Variable dump for script "+ ItemID.ToString());
|
||||
// foreach (KeyValuePair<string, object> v in vars)
|
||||
// {
|
||||
// m_log.Info("Variable: "+v.Key+" = "+v.Value.ToString());
|
||||
|
@ -518,17 +465,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
|
||||
public void Start()
|
||||
{
|
||||
lock (m_EventQueue)
|
||||
lock (EventQueue)
|
||||
{
|
||||
if (Running)
|
||||
return;
|
||||
|
||||
m_RunEvents = true;
|
||||
Running = true;
|
||||
|
||||
if (m_EventQueue.Count > 0)
|
||||
TimeStarted = DateTime.Now;
|
||||
MeasurementPeriodTickStart = Util.EnvironmentTickCount();
|
||||
MeasurementPeriodExecutionTime = 0;
|
||||
|
||||
if (EventQueue.Count > 0)
|
||||
{
|
||||
if (m_CurrentResult == null)
|
||||
m_CurrentResult = m_Engine.QueueEventHandler(this);
|
||||
if (m_CurrentWorkItem == null)
|
||||
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
||||
// else
|
||||
// m_log.Error("[Script] Tried to start a script that was already queued");
|
||||
}
|
||||
|
@ -538,51 +489,63 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
public bool Stop(int timeout)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCRIPT INSTANCE]: Stopping script {0} {1} with timeout {2}", ScriptName, ItemID, timeout);
|
||||
// "[SCRIPT INSTANCE]: Stopping script {0} {1} in {2} {3} with timeout {4} {5} {6}",
|
||||
// ScriptName, ItemID, PrimName, ObjectID, timeout, m_InSelfDelete, DateTime.Now.Ticks);
|
||||
|
||||
IScriptWorkItem result;
|
||||
IScriptWorkItem workItem;
|
||||
|
||||
lock (m_EventQueue)
|
||||
lock (EventQueue)
|
||||
{
|
||||
if (!Running)
|
||||
return true;
|
||||
|
||||
if (m_CurrentResult == null)
|
||||
// If we're not running or waiting to run an event then we can safely stop.
|
||||
if (m_CurrentWorkItem == null)
|
||||
{
|
||||
m_RunEvents = false;
|
||||
Running = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_CurrentResult.Cancel())
|
||||
// If we are waiting to run an event then we can try to cancel it.
|
||||
if (m_CurrentWorkItem.Cancel())
|
||||
{
|
||||
m_CurrentResult = null;
|
||||
m_RunEvents = false;
|
||||
m_CurrentWorkItem = null;
|
||||
Running = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
result = m_CurrentResult;
|
||||
m_RunEvents = false;
|
||||
workItem = m_CurrentWorkItem;
|
||||
Running = false;
|
||||
}
|
||||
|
||||
if (result.Wait(new TimeSpan((long)timeout * 100000)))
|
||||
// Wait for the current event to complete.
|
||||
if (!m_InSelfDelete && workItem.Wait(new TimeSpan((long)timeout * 100000)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
lock (m_EventQueue)
|
||||
lock (EventQueue)
|
||||
{
|
||||
result = m_CurrentResult;
|
||||
workItem = m_CurrentWorkItem;
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
if (workItem == null)
|
||||
return true;
|
||||
|
||||
// If the event still hasn't stopped and we the stop isn't the result of script or object removal, then
|
||||
// forcibly abort the work item (this aborts the underlying thread).
|
||||
if (!m_InSelfDelete)
|
||||
result.Abort();
|
||||
|
||||
lock (m_EventQueue)
|
||||
{
|
||||
m_CurrentResult = null;
|
||||
// m_log.ErrorFormat(
|
||||
// "[SCRIPT INSTANCE]: Aborting script {0} {1} in prim {2} {3} {4} {5}",
|
||||
// ScriptName, ItemID, PrimName, ObjectID, m_InSelfDelete, DateTime.Now.Ticks);
|
||||
|
||||
workItem.Abort();
|
||||
}
|
||||
|
||||
lock (EventQueue)
|
||||
{
|
||||
m_CurrentWorkItem = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -603,10 +566,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
throw new EventAbortException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Post an event to this script instance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The request to run the event is sent
|
||||
/// </remarks>
|
||||
/// <param name="data"></param>
|
||||
public void PostEvent(EventParams data)
|
||||
{
|
||||
// m_log.DebugFormat("[Script] Posted event {2} in state {3} to {0}.{1}",
|
||||
// m_PrimName, m_ScriptName, data.EventName, m_State);
|
||||
// PrimName, ScriptName, data.EventName, State);
|
||||
|
||||
if (!Running)
|
||||
return;
|
||||
|
@ -621,9 +591,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
m_nextEventTimeTicks = DateTime.Now.Ticks + m_eventDelayTicks;
|
||||
}
|
||||
|
||||
lock (m_EventQueue)
|
||||
lock (EventQueue)
|
||||
{
|
||||
if (m_EventQueue.Count >= m_MaxScriptQueue)
|
||||
if (EventQueue.Count >= m_MaxScriptQueue)
|
||||
return;
|
||||
|
||||
if (data.EventName == "timer")
|
||||
|
@ -667,11 +637,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
m_CollisionInQueue = true;
|
||||
}
|
||||
|
||||
m_EventQueue.Enqueue(data);
|
||||
EventQueue.Enqueue(data);
|
||||
|
||||
if (m_CurrentResult == null)
|
||||
if (m_CurrentWorkItem == null)
|
||||
{
|
||||
m_CurrentResult = m_Engine.QueueEventHandler(this);
|
||||
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -682,6 +652,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
/// <returns></returns>
|
||||
public object EventProcessor()
|
||||
{
|
||||
// We check here as the thread stopping this instance from running may itself hold the m_Script lock.
|
||||
if (!Running)
|
||||
return 0;
|
||||
|
||||
lock (m_Script)
|
||||
{
|
||||
// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName);
|
||||
|
@ -691,18 +665,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
|
||||
EventParams data = null;
|
||||
|
||||
lock (m_EventQueue)
|
||||
lock (EventQueue)
|
||||
{
|
||||
data = (EventParams) m_EventQueue.Dequeue();
|
||||
data = (EventParams)EventQueue.Dequeue();
|
||||
if (data == null) // Shouldn't happen
|
||||
{
|
||||
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
|
||||
if (EventQueue.Count > 0 && Running && !ShuttingDown)
|
||||
{
|
||||
m_CurrentResult = m_Engine.QueueEventHandler(this);
|
||||
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CurrentResult = null;
|
||||
m_CurrentWorkItem = null;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -725,28 +699,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
if (data.EventName == "state") // Hardcoded state change
|
||||
{
|
||||
// m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
|
||||
// m_PrimName, m_ScriptName, data.Params[0].ToString());
|
||||
m_State = data.Params[0].ToString();
|
||||
AsyncCommandManager.RemoveScript(m_Engine,
|
||||
m_LocalID, m_ItemID);
|
||||
// PrimName, ScriptName, data.Params[0].ToString());
|
||||
State = data.Params[0].ToString();
|
||||
AsyncCommandManager.RemoveScript(Engine,
|
||||
LocalID, ItemID);
|
||||
|
||||
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
|
||||
m_LocalID);
|
||||
SceneObjectPart part = Engine.World.GetSceneObjectPart(
|
||||
LocalID);
|
||||
if (part != null)
|
||||
{
|
||||
part.SetScriptEvents(m_ItemID,
|
||||
part.SetScriptEvents(ItemID,
|
||||
(int)m_Script.GetStateEventFlags(State));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Engine.World.PipeEventsForScript(m_LocalID) ||
|
||||
if (Engine.World.PipeEventsForScript(LocalID) ||
|
||||
data.EventName == "control") // Don't freeze avies!
|
||||
{
|
||||
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
|
||||
m_LocalID);
|
||||
SceneObjectPart part = Engine.World.GetSceneObjectPart(
|
||||
LocalID);
|
||||
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
|
||||
// m_PrimName, m_ScriptName, data.EventName, m_State);
|
||||
// PrimName, ScriptName, data.EventName, State);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -754,8 +728,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
m_EventStart = DateTime.Now;
|
||||
m_InEvent = true;
|
||||
|
||||
int start = Util.EnvironmentTickCount();
|
||||
|
||||
// Reset the measurement period when we reach the end of the current one.
|
||||
if (start - MeasurementPeriodTickStart > MaxMeasurementPeriod)
|
||||
MeasurementPeriodTickStart = start;
|
||||
|
||||
m_Script.ExecuteEvent(State, data.EventName, data.Params);
|
||||
|
||||
MeasurementPeriodExecutionTime += Util.EnvironmentTickCount() - start;
|
||||
|
||||
m_InEvent = false;
|
||||
m_CurrentEvent = String.Empty;
|
||||
|
||||
|
@ -764,7 +746,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
// This will be the very first event we deliver
|
||||
// (state_entry) in default state
|
||||
//
|
||||
|
||||
SaveState(m_Assembly);
|
||||
|
||||
m_SaveState = false;
|
||||
|
@ -788,7 +769,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
|
||||
if (text.Length > 1000)
|
||||
text = text.Substring(0, 1000);
|
||||
m_Engine.World.SimChat(Utils.StringToBytes(text),
|
||||
Engine.World.SimChat(Utils.StringToBytes(text),
|
||||
ChatTypeEnum.DebugChannel, 2147483647,
|
||||
part.AbsolutePosition,
|
||||
part.Name, part.UUID, false);
|
||||
|
@ -810,27 +791,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
{
|
||||
m_InSelfDelete = true;
|
||||
if (part != null)
|
||||
m_Engine.World.DeleteSceneObject(part.ParentGroup, false);
|
||||
Engine.World.DeleteSceneObject(part.ParentGroup, false);
|
||||
}
|
||||
else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
|
||||
{
|
||||
m_InSelfDelete = true;
|
||||
if (part != null)
|
||||
part.Inventory.RemoveInventoryItem(m_ItemID);
|
||||
part.Inventory.RemoveInventoryItem(ItemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lock (m_EventQueue)
|
||||
// If there are more events and we are currently running and not shutting down, then ask the
|
||||
// script engine to run the next event.
|
||||
lock (EventQueue)
|
||||
{
|
||||
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
|
||||
if (EventQueue.Count > 0 && Running && !ShuttingDown)
|
||||
{
|
||||
m_CurrentResult = m_Engine.QueueEventHandler(this);
|
||||
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CurrentResult = null;
|
||||
m_CurrentWorkItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -859,15 +842,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
ReleaseControls();
|
||||
|
||||
Stop(0);
|
||||
SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID);
|
||||
part.Inventory.GetInventoryItem(m_ItemID).PermsMask = 0;
|
||||
part.Inventory.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero;
|
||||
AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID);
|
||||
m_EventQueue.Clear();
|
||||
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
|
||||
part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
|
||||
part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
|
||||
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
|
||||
EventQueue.Clear();
|
||||
m_Script.ResetVars();
|
||||
m_State = "default";
|
||||
State = "default";
|
||||
|
||||
part.SetScriptEvents(m_ItemID,
|
||||
part.SetScriptEvents(ItemID,
|
||||
(int)m_Script.GetStateEventFlags(State));
|
||||
if (running)
|
||||
Start();
|
||||
|
@ -884,16 +867,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
ReleaseControls();
|
||||
|
||||
m_Script.ResetVars();
|
||||
SceneObjectPart part=m_Engine.World.GetSceneObjectPart(m_LocalID);
|
||||
part.Inventory.GetInventoryItem(m_ItemID).PermsMask = 0;
|
||||
part.Inventory.GetInventoryItem(m_ItemID).PermsGranter = UUID.Zero;
|
||||
AsyncCommandManager.RemoveScript(m_Engine, m_LocalID, m_ItemID);
|
||||
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
|
||||
part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
|
||||
part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
|
||||
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
|
||||
|
||||
m_EventQueue.Clear();
|
||||
EventQueue.Clear();
|
||||
m_Script.ResetVars();
|
||||
m_State = "default";
|
||||
State = "default";
|
||||
|
||||
part.SetScriptEvents(m_ItemID,
|
||||
part.SetScriptEvents(ItemID,
|
||||
(int)m_Script.GetStateEventFlags(State));
|
||||
|
||||
if (m_CurrentEvent != "state_entry")
|
||||
|
@ -940,8 +923,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
|
||||
public void SaveState(string assembly)
|
||||
{
|
||||
|
||||
|
||||
// If we're currently in an event, just tell it to save upon return
|
||||
//
|
||||
if (m_InEvent)
|
||||
|
@ -950,7 +931,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
return;
|
||||
}
|
||||
|
||||
PluginData = AsyncCommandManager.GetSerializationData(m_Engine, m_ItemID);
|
||||
PluginData = AsyncCommandManager.GetSerializationData(Engine, ItemID);
|
||||
|
||||
string xml = ScriptSerializer.Serialize(this);
|
||||
|
||||
|
@ -962,7 +943,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
{
|
||||
try
|
||||
{
|
||||
FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state"));
|
||||
FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state"));
|
||||
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
|
||||
Byte[] buf = enc.GetBytes(xml);
|
||||
fs.Write(buf, 0, buf.Length);
|
||||
|
@ -972,7 +953,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
{
|
||||
// m_log.Error("Unable to save xml\n"+e.ToString());
|
||||
}
|
||||
//if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state")))
|
||||
//if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state")))
|
||||
//{
|
||||
// throw new Exception("Completed persistence save, but no file was created");
|
||||
//}
|
||||
|
@ -989,7 +970,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0} {1} on {2}", m_ScriptName, m_ItemID, m_PrimName);
|
||||
return String.Format("{0} {1} on {2}", ScriptName, ItemID, PrimName);
|
||||
}
|
||||
|
||||
string FormatException(Exception e)
|
||||
|
@ -1057,7 +1038,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
|
||||
// Force an update of the in-memory plugin data
|
||||
//
|
||||
PluginData = AsyncCommandManager.GetSerializationData(m_Engine, m_ItemID);
|
||||
PluginData = AsyncCommandManager.GetSerializationData(Engine, ItemID);
|
||||
|
||||
return ScriptSerializer.Serialize(this);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
* 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.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Assets;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
|
||||
using OpenSim.Region.OptionalModules.World.NPC;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests for inventory functions in LSL
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class LSL_ApiInventoryTests
|
||||
{
|
||||
protected Scene m_scene;
|
||||
protected XEngine.XEngine m_engine;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
IConfigSource initConfigSource = new IniConfigSource();
|
||||
IConfig config = initConfigSource.AddConfig("XEngine");
|
||||
config.Set("Enabled", "true");
|
||||
|
||||
m_scene = SceneHelpers.SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, initConfigSource);
|
||||
|
||||
m_engine = new XEngine.XEngine();
|
||||
m_engine.Initialise(initConfigSource);
|
||||
m_engine.AddRegion(m_scene);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test giving inventory from an object to an object where both are owned by the same user.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLlGiveInventoryO2OSameOwner()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
string inventoryItemName = "item1";
|
||||
|
||||
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, userId, "so1", 0x10);
|
||||
m_scene.AddSceneObject(so1);
|
||||
|
||||
// Create an object embedded inside the first
|
||||
UUID itemId = TestHelpers.ParseTail(0x20);
|
||||
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId);
|
||||
|
||||
LSL_Api api = new LSL_Api();
|
||||
api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);
|
||||
|
||||
// Create a second object
|
||||
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
|
||||
m_scene.AddSceneObject(so2);
|
||||
|
||||
api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
|
||||
|
||||
// Item has copy permissions so original should stay intact.
|
||||
List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
|
||||
Assert.That(originalItems.Count, Is.EqualTo(1));
|
||||
|
||||
List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
|
||||
Assert.That(copiedItems.Count, Is.EqualTo(1));
|
||||
Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test giving inventory from an object to an object where they have different owners
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLlGiveInventoryO2ODifferentOwners()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID user1Id = TestHelpers.ParseTail(0x1);
|
||||
UUID user2Id = TestHelpers.ParseTail(0x2);
|
||||
string inventoryItemName = "item1";
|
||||
|
||||
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
|
||||
m_scene.AddSceneObject(so1);
|
||||
LSL_Api api = new LSL_Api();
|
||||
api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);
|
||||
|
||||
// Create an object embedded inside the first
|
||||
UUID itemId = TestHelpers.ParseTail(0x20);
|
||||
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id);
|
||||
|
||||
// Create a second object
|
||||
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
|
||||
m_scene.AddSceneObject(so2);
|
||||
LSL_Api api2 = new LSL_Api();
|
||||
api2.Initialize(m_engine, so2.RootPart, so2.RootPart.LocalId, so2.RootPart.UUID);
|
||||
|
||||
// *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
|
||||
api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
|
||||
|
||||
{
|
||||
// Item has copy permissions so original should stay intact.
|
||||
List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
|
||||
Assert.That(originalItems.Count, Is.EqualTo(1));
|
||||
|
||||
// Should have not copied
|
||||
List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
|
||||
Assert.That(copiedItems.Count, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
// *** Secondly, we turn on allow inventory drop in the target and retest. ***
|
||||
api2.llAllowInventoryDrop(1);
|
||||
api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
|
||||
|
||||
{
|
||||
// Item has copy permissions so original should stay intact.
|
||||
List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
|
||||
Assert.That(originalItems.Count, Is.EqualTo(1));
|
||||
|
||||
// Should now have copied.
|
||||
List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
|
||||
Assert.That(copiedItems.Count, Is.EqualTo(1));
|
||||
Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,7 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[TestFixture, LongRunning]
|
||||
public class LSL_ApiTest
|
||||
{
|
||||
|
||||
private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6;
|
||||
private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d;
|
||||
private const float FLOAT_ACCURACY = 0.00005f;
|
||||
|
@ -55,7 +54,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
|
||||
IConfigSource initConfigSource = new IniConfigSource();
|
||||
IConfig config = initConfigSource.AddConfig("XEngine");
|
||||
config.Set("Enabled", "true");
|
||||
|
@ -75,6 +73,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestllAngleBetween()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
CheckllAngleBetween(new Vector3(1, 0, 0), 0, 1, 1);
|
||||
CheckllAngleBetween(new Vector3(1, 0, 0), 90, 1, 1);
|
||||
CheckllAngleBetween(new Vector3(1, 0, 0), 180, 1, 1);
|
||||
|
@ -158,6 +158,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
// llRot2Euler test.
|
||||
public void TestllRot2Euler()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// 180, 90 and zero degree rotations.
|
||||
CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.707107f, 0.707107f));
|
||||
|
@ -256,6 +258,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
// llSetPrimitiveParams and llGetPrimitiveParams test.
|
||||
public void TestllSetPrimitiveParams()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Create Prim1.
|
||||
Scene scene = SceneHelpers.SetupScene();
|
||||
string obj1Name = "Prim1";
|
||||
|
@ -486,9 +490,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
}
|
||||
|
||||
[Test]
|
||||
// llVecNorm test.
|
||||
public void TestllVecNorm()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// Check special case for normalizing zero vector.
|
||||
CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d));
|
||||
// Check various vectors.
|
||||
|
|
|
@ -213,6 +213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestConstructFromInt()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (KeyValuePair<int, double> number in m_intDoubleSet)
|
||||
|
@ -228,6 +230,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestConstructFromDouble()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
|
||||
|
@ -243,6 +247,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLFloatToInt()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
int testNumber;
|
||||
|
||||
foreach (KeyValuePair<double, int> number in m_doubleIntSet)
|
||||
|
@ -258,6 +264,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLFloatToUint()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
uint testNumber;
|
||||
|
||||
foreach (KeyValuePair<double, int> number in m_doubleUintSet)
|
||||
|
@ -273,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastLSLFloatToBooleanTrue()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
bool testBool;
|
||||
|
||||
|
@ -291,6 +301,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastLSLFloatToBooleanFalse()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat = new LSL_Types.LSLFloat(0.0);
|
||||
bool testBool = testFloat;
|
||||
|
||||
|
@ -303,6 +315,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastIntToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (int number in m_intList)
|
||||
|
@ -318,6 +332,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastLSLIntegerToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (int number in m_intList)
|
||||
|
@ -333,6 +349,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLIntegerToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (int number in m_intList)
|
||||
|
@ -348,6 +366,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastStringToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (KeyValuePair<string, double> number in m_stringDoubleSet)
|
||||
|
@ -363,6 +383,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLStringToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (KeyValuePair<string, double> number in m_stringDoubleSet)
|
||||
|
@ -378,6 +400,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastDoubleToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (double number in m_doubleList)
|
||||
|
@ -393,6 +417,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastLSLFloatToDouble()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
double testNumber;
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
|
@ -411,26 +437,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLFloatToFloat()
|
||||
{
|
||||
float testFloat;
|
||||
float numberAsFloat;
|
||||
LSL_Types.LSLFloat testLSLFloat;
|
||||
foreach (double number in m_doubleList)
|
||||
{
|
||||
testLSLFloat = new LSL_Types.LSLFloat(number);
|
||||
numberAsFloat = (float)number;
|
||||
testFloat = (float)testLSLFloat;
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance));
|
||||
}
|
||||
float testFloat;
|
||||
float numberAsFloat;
|
||||
LSL_Types.LSLFloat testLSLFloat;
|
||||
|
||||
foreach (double number in m_doubleList)
|
||||
{
|
||||
testLSLFloat = new LSL_Types.LSLFloat(number);
|
||||
numberAsFloat = (float)number;
|
||||
testFloat = (float)testLSLFloat;
|
||||
|
||||
Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Tests the equality (==) operator.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestEqualsOperator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloatA, testFloatB;
|
||||
|
||||
foreach (double number in m_doubleList)
|
||||
|
@ -450,6 +480,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestNotEqualOperator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloatA, testFloatB;
|
||||
|
||||
foreach (double number in m_doubleList)
|
||||
|
@ -469,6 +501,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestIncrementOperator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
double testNumber;
|
||||
|
||||
|
@ -493,6 +527,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestDecrementOperator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
double testNumber;
|
||||
|
||||
|
@ -517,6 +553,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestToString()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
foreach (KeyValuePair<double, string> number in m_doubleStringSet)
|
||||
|
@ -532,6 +570,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestAddTwoLSLFloats()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testResult;
|
||||
|
||||
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
|
||||
|
@ -547,6 +587,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestSubtractTwoLSLFloats()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testResult;
|
||||
|
||||
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
|
||||
|
@ -562,6 +604,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestMultiplyTwoLSLFloats()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testResult;
|
||||
|
||||
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
|
||||
|
@ -577,6 +621,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestDivideTwoLSLFloats()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testResult;
|
||||
|
||||
foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
|
||||
|
@ -595,6 +641,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastBooleanToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testFloat;
|
||||
|
||||
testFloat = (1 == 0);
|
||||
|
@ -610,4 +658,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
Assert.That(testFloat.value, new DoubleToleranceConstraint(1.0, _lowPrecisionTolerance));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -79,6 +79,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLFloatToLSLInteger()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLInteger testInteger;
|
||||
|
||||
foreach (KeyValuePair<double, int> number in m_doubleIntSet)
|
||||
|
@ -94,6 +96,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastStringToLSLInteger()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLInteger testInteger;
|
||||
|
||||
foreach (KeyValuePair<string, int> number in m_stringIntSet)
|
||||
|
@ -109,6 +113,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLStringToLSLInteger()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLInteger testInteger;
|
||||
|
||||
foreach (KeyValuePair<string, int> number in m_stringIntSet)
|
||||
|
@ -124,6 +130,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastBooleanToLSLInteger()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLInteger testInteger;
|
||||
|
||||
testInteger = (1 == 0);
|
||||
|
|
|
@ -71,6 +71,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestConstructFromLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLString testString;
|
||||
|
||||
foreach (KeyValuePair<double, string> number in m_doubleStringSet)
|
||||
|
@ -86,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLFloatToLSLString()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLString testString;
|
||||
|
||||
foreach (KeyValuePair<double, string> number in m_doubleStringSet)
|
||||
|
@ -101,6 +105,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestExplicitCastLSLStringToQuaternion()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string quaternionString = "<0.00000, 0.70711, 0.00000, 0.70711>";
|
||||
LSL_Types.LSLString quaternionLSLString = new LSL_Types.LSLString(quaternionString);
|
||||
|
||||
|
@ -118,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestImplicitCastBooleanToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLString testString;
|
||||
|
||||
testString = (LSL_Types.LSLString) (1 == 0);
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestConcatenateString()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test"));
|
||||
testList += new LSL_Types.LSLString("addition");
|
||||
|
||||
|
@ -64,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestConcatenateInteger()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test"));
|
||||
testList += new LSL_Types.LSLInteger(20);
|
||||
|
||||
|
@ -84,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestConcatenateDouble()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test"));
|
||||
testList += new LSL_Types.LSLFloat(2.0f);
|
||||
|
||||
|
@ -104,6 +110,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestCastLSLIntegerItemToLSLInteger()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(123);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -116,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestCastLSLFloatItemToLSLFloat()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(123.45678987);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -128,6 +138,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestCastLSLStringItemToLSLString()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello there");
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -140,6 +152,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestCastVector3ItemToVector3()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.Vector3 testValue = new LSL_Types.Vector3(12.34, 56.987654, 0.00987);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -151,6 +165,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestCastQuaternionItemToQuaternion()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.34, 56.44323, 765.983421, 0.00987);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -165,6 +181,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetLSLIntegerItemForLSLIntegerItem()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(999911);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -177,6 +195,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetLSLFloatItemForLSLFloatItem()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(321.45687876);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -189,11 +209,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetLSLFloatItemForLSLIntegerItem()
|
||||
{
|
||||
LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987);
|
||||
LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Assert.AreEqual(testFloatValue, testList.GetLSLFloatItem(0));
|
||||
LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987);
|
||||
LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
Assert.AreEqual(testFloatValue, testList.GetLSLFloatItem(0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -202,6 +224,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetLSLStringItemForLSLStringItem()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello all");
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -214,6 +238,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetLSLStringItemForKeyItem()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.key testValue
|
||||
= new LSL_Types.key("98000000-0000-2222-3333-100000001000");
|
||||
LSL_Types.LSLString testStringValue = new LSL_Types.LSLString(testValue);
|
||||
|
@ -228,6 +254,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetVector3ItemForVector3Item()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.Vector3 testValue = new LSL_Types.Vector3(92.34, 58.98754, -0.10987);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -239,6 +267,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetQuaternionItemForQuaternionItem()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987);
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
||||
|
@ -251,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
[Test]
|
||||
public void TestGetKeyItemForKeyItem()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_Types.key testValue
|
||||
= new LSL_Types.key("00000000-0000-2222-3333-100000001012");
|
||||
LSL_Types.list testList = new LSL_Types.list(testValue);
|
||||
|
@ -258,4 +290,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
Assert.AreEqual(testValue, testList.GetKeyItem(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,16 +32,17 @@ using OpenSim.Region.ScriptEngine.Shared;
|
|||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests for Vector3
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class LSL_TypesTestVector3
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests for Vector3
|
||||
/// </summary>
|
||||
[Test]
|
||||
|
||||
public void TestDotProduct()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
// The numbers we test for.
|
||||
Dictionary<string, double> expectsSet = new Dictionary<string, double>();
|
||||
expectsSet.Add("<1, 2, 3> * <2, 3, 4>", 20.0);
|
||||
|
|
|
@ -49,7 +49,10 @@ using OpenSim.Region.ScriptEngine.Shared;
|
|||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
using OpenSim.Region.ScriptEngine.Shared.CodeTools;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Instance;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using Timer = OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer;
|
||||
|
||||
using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>;
|
||||
|
||||
|
@ -173,12 +176,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
get { return m_ConfigSource; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event fired after the script engine has finished removing a script.
|
||||
/// </summary>
|
||||
public event ScriptRemoved OnScriptRemoved;
|
||||
|
||||
/// <summary>
|
||||
/// Event fired after the script engine has finished removing a script from an object.
|
||||
/// </summary>
|
||||
public event ObjectRemoved OnObjectRemoved;
|
||||
|
||||
//
|
||||
// IRegionModule functions
|
||||
//
|
||||
public void Initialise(IConfigSource configSource)
|
||||
{
|
||||
if (configSource.Configs["XEngine"] == null)
|
||||
|
@ -373,6 +380,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene))
|
||||
return;
|
||||
|
||||
MainConsole.Instance.OutputFormat(GetStatusReport());
|
||||
}
|
||||
|
||||
public string GetStatusReport()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendFormat("Status of XEngine instance for {0}\n", m_Scene.RegionInfo.RegionName);
|
||||
|
||||
|
@ -381,12 +393,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
|
||||
sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count);
|
||||
sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count);
|
||||
sb.AppendFormat("Max threads : {0}\n", m_ThreadPool.MaxThreads);
|
||||
sb.AppendFormat("Min threads : {0}\n", m_ThreadPool.MinThreads);
|
||||
sb.AppendFormat("Allocated threads : {0}\n", m_ThreadPool.ActiveThreads);
|
||||
sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads);
|
||||
sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks);
|
||||
// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count);
|
||||
|
||||
MainConsole.Instance.OutputFormat(sb.ToString());
|
||||
SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this);
|
||||
sb.AppendFormat("Sensors : {0}\n", sr != null ? sr.SensorsCount : 0);
|
||||
|
||||
Dataserver ds = AsyncCommandManager.GetDataserverPlugin(this);
|
||||
sb.AppendFormat("Dataserver requests : {0}\n", ds != null ? ds.DataserverRequestsCount : 0);
|
||||
|
||||
Timer t = AsyncCommandManager.GetTimerPlugin(this);
|
||||
sb.AppendFormat("Timers : {0}\n", t != null ? t.TimersCount : 0);
|
||||
|
||||
Listener l = AsyncCommandManager.GetListenerPlugin(this);
|
||||
sb.AppendFormat("Listeners : {0}\n", l != null ? l.ListenerCount : 0);
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public void HandleShowScripts(string module, string[] cmdparams)
|
||||
|
@ -973,7 +999,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
lock (m_Scripts)
|
||||
{
|
||||
// Create the object record
|
||||
|
||||
if ((!m_Scripts.ContainsKey(itemID)) ||
|
||||
(m_Scripts[itemID].AssetID != assetID))
|
||||
{
|
||||
|
@ -996,11 +1021,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
|
||||
AppDomain sandbox;
|
||||
if (m_AppDomainLoading)
|
||||
{
|
||||
sandbox = AppDomain.CreateDomain(
|
||||
m_Scene.RegionInfo.RegionID.ToString(),
|
||||
evidence, appSetup);
|
||||
sandbox.AssemblyResolve +=
|
||||
new ResolveEventHandler(
|
||||
AssemblyResolver.OnAssemblyResolve);
|
||||
}
|
||||
else
|
||||
{
|
||||
sandbox = AppDomain.CurrentDomain;
|
||||
}
|
||||
|
||||
//PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
|
||||
//AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
|
||||
|
@ -1012,9 +1044,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
|
||||
m_AppDomains[appDomain] = sandbox;
|
||||
|
||||
m_AppDomains[appDomain].AssemblyResolve +=
|
||||
new ResolveEventHandler(
|
||||
AssemblyResolver.OnAssemblyResolve);
|
||||
m_DomainScripts[appDomain] = new List<UUID>();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -1063,7 +1092,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
|
||||
if (!m_PrimObjects[localID].Contains(itemID))
|
||||
m_PrimObjects[localID].Add(itemID);
|
||||
|
||||
}
|
||||
|
||||
if (!m_Assemblies.ContainsKey(assetID))
|
||||
|
@ -1102,7 +1130,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
}
|
||||
|
||||
instance.ClearQueue();
|
||||
instance.Stop(0);
|
||||
|
||||
// Give the script some time to finish processing its last event. Simply aborting the script thread can
|
||||
// cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort.
|
||||
instance.Stop(1000);
|
||||
|
||||
// bool objectRemoved = false;
|
||||
|
||||
lock (m_PrimObjects)
|
||||
|
@ -1133,14 +1165,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
UnloadAppDomain(instance.AppDomain);
|
||||
}
|
||||
|
||||
instance = null;
|
||||
|
||||
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
|
||||
if (handlerObjectRemoved != null)
|
||||
{
|
||||
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
|
||||
handlerObjectRemoved(part.UUID);
|
||||
}
|
||||
handlerObjectRemoved(instance.ObjectID);
|
||||
|
||||
ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
|
||||
if (handlerScriptRemoved != null)
|
||||
|
@ -1872,6 +1899,59 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
}
|
||||
}
|
||||
|
||||
public Dictionary<uint, float> GetObjectScriptsExecutionTimes()
|
||||
{
|
||||
long tickNow = Util.EnvironmentTickCount();
|
||||
Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
|
||||
|
||||
lock (m_Scripts)
|
||||
{
|
||||
foreach (IScriptInstance si in m_Scripts.Values)
|
||||
{
|
||||
if (!topScripts.ContainsKey(si.LocalID))
|
||||
topScripts[si.RootLocalID] = 0;
|
||||
|
||||
// long ticksElapsed = tickNow - si.MeasurementPeriodTickStart;
|
||||
// float framesElapsed = ticksElapsed / (18.1818 * TimeSpan.TicksPerMillisecond);
|
||||
|
||||
// Execution time of the script adjusted by it's measurement period to make scripts started at
|
||||
// different times comparable.
|
||||
// float adjustedExecutionTime
|
||||
// = (float)si.MeasurementPeriodExecutionTime
|
||||
// / ((float)(tickNow - si.MeasurementPeriodTickStart) / ScriptInstance.MaxMeasurementPeriod)
|
||||
// / TimeSpan.TicksPerMillisecond;
|
||||
|
||||
long ticksElapsed = tickNow - si.MeasurementPeriodTickStart;
|
||||
|
||||
// Avoid divide by zerp
|
||||
if (ticksElapsed == 0)
|
||||
ticksElapsed = 1;
|
||||
|
||||
// Scale execution time to the ideal 55 fps frame time for these reasons.
|
||||
//
|
||||
// 1) XEngine does not execute scripts per frame, unlike other script engines. Hence, there is no
|
||||
// 'script execution time per frame', which is the original purpose of this value.
|
||||
//
|
||||
// 2) Giving the raw execution times is misleading since scripts start at different times, making
|
||||
// it impossible to compare scripts.
|
||||
//
|
||||
// 3) Scaling the raw execution time to the time that the script has been running is better but
|
||||
// is still misleading since a script that has just been rezzed may appear to have been running
|
||||
// for much longer.
|
||||
//
|
||||
// 4) Hence, we scale execution time to an idealised frame time (55 fps). This is also not perfect
|
||||
// since the figure does not represent actual execution time and very hard running scripts will
|
||||
// never exceed 18ms (though this is a very high number for script execution so is a warning sign).
|
||||
float adjustedExecutionTime
|
||||
= ((float)si.MeasurementPeriodExecutionTime / ticksElapsed) * 18.1818f;
|
||||
|
||||
topScripts[si.RootLocalID] += adjustedExecutionTime;
|
||||
}
|
||||
}
|
||||
|
||||
return topScripts;
|
||||
}
|
||||
|
||||
public void SuspendScript(UUID itemID)
|
||||
{
|
||||
// m_log.DebugFormat("[XEngine]: Received request to suspend script with ID {0}", itemID);
|
||||
|
@ -1894,4 +1974,4 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,13 +224,11 @@ namespace OpenSim.Region.UserStatistics
|
|||
concurrencyCounter--;
|
||||
|
||||
response_code = 200;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
strOut = MainServer.Instance.GetHTTP404("");
|
||||
}
|
||||
|
||||
|
||||
responsedata["int_response_code"] = response_code;
|
||||
responsedata["content_type"] = contenttype;
|
||||
|
@ -247,43 +245,44 @@ namespace OpenSim.Region.UserStatistics
|
|||
// TODO: FIXME: implement stats migrations
|
||||
const string SQL = @"SELECT * FROM migrations LIMIT 1";
|
||||
|
||||
SqliteCommand cmd = new SqliteCommand(SQL, db);
|
||||
|
||||
try
|
||||
using (SqliteCommand cmd = new SqliteCommand(SQL, db))
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (SqliteSyntaxException)
|
||||
{
|
||||
CreateTables(db);
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (SqliteSyntaxException)
|
||||
{
|
||||
CreateTables(db);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateTables(SqliteConnection db)
|
||||
{
|
||||
SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db);
|
||||
createcmd.ExecuteNonQuery();
|
||||
using (SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db))
|
||||
{
|
||||
createcmd.ExecuteNonQuery();
|
||||
|
||||
createcmd.CommandText = SQL_MIGRA_TABLE_CREATE;
|
||||
createcmd.ExecuteNonQuery();
|
||||
createcmd.CommandText = SQL_MIGRA_TABLE_CREATE;
|
||||
createcmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void PostInitialise()
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AddHandlers();
|
||||
}
|
||||
|
||||
public virtual void Close()
|
||||
{
|
||||
if (!enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dbConn.Close();
|
||||
dbConn.Dispose();
|
||||
m_sessions.Clear();
|
||||
|
@ -304,7 +303,8 @@ namespace OpenSim.Region.UserStatistics
|
|||
|
||||
public void OnRegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
|
||||
// m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
|
||||
|
||||
string capsPath = "/CAPS/VS/" + UUID.Random();
|
||||
caps.RegisterHandler("ViewerStats",
|
||||
new RestStreamHandler("POST", capsPath,
|
||||
|
@ -318,7 +318,6 @@ namespace OpenSim.Region.UserStatistics
|
|||
|
||||
public void OnDeRegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected virtual void AddHandlers()
|
||||
|
@ -368,7 +367,6 @@ namespace OpenSim.Region.UserStatistics
|
|||
|
||||
public void OnMakeChildAgent(ScenePresence agent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnClientClosed(UUID agentID, Scene scene)
|
||||
|
@ -430,6 +428,7 @@ namespace OpenSim.Region.UserStatistics
|
|||
return scene.RegionInfo.RegionID;
|
||||
}
|
||||
}
|
||||
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
|
@ -447,7 +446,7 @@ namespace OpenSim.Region.UserStatistics
|
|||
{
|
||||
// m_log.DebugFormat("[WEB STATS MODULE]: Received viewer starts report from {0}", agentID);
|
||||
|
||||
UpdateUserStats(ParseViewerStats(request,agentID), dbConn);
|
||||
UpdateUserStats(ParseViewerStats(request, agentID), dbConn);
|
||||
|
||||
return String.Empty;
|
||||
}
|
||||
|
@ -458,14 +457,14 @@ namespace OpenSim.Region.UserStatistics
|
|||
UserSessionData usd;
|
||||
OSD message = OSDParser.DeserializeLLSDXml(request);
|
||||
OSDMap mmap;
|
||||
|
||||
lock (m_sessions)
|
||||
{
|
||||
if (agentID != UUID.Zero)
|
||||
{
|
||||
|
||||
if (!m_sessions.ContainsKey(agentID))
|
||||
{
|
||||
m_log.Warn("[WEB STATS MODULE]: no session for stat disclosure");
|
||||
m_log.WarnFormat("[WEB STATS MODULE]: no session for stat disclosure for agent {0}", agentID);
|
||||
return new UserSessionID();
|
||||
}
|
||||
uid = m_sessions[agentID];
|
||||
|
@ -585,8 +584,6 @@ namespace OpenSim.Region.UserStatistics
|
|||
usd.n_out_kb = (float)net_out["kbytes"].AsReal();
|
||||
usd.n_out_pk = net_out["packets"].AsInteger();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -602,83 +599,90 @@ namespace OpenSim.Region.UserStatistics
|
|||
|
||||
lock (db)
|
||||
{
|
||||
SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db);
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":last_updated", (int) uid.session_data.last_updated));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":remote_ip", uid.session_data.remote_ip));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":name_f", uid.session_data.name_f));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":name_l", uid.session_data.name_l));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_agents_in_view", uid.session_data.avg_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_agents_in_view",
|
||||
(int) uid.session_data.min_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_agents_in_view",
|
||||
(int) uid.session_data.max_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_agents_in_view",
|
||||
(int) uid.session_data.mode_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_fps", uid.session_data.avg_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_fps", uid.session_data.min_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_fps", uid.session_data.max_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_fps", uid.session_data.mode_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":a_language", uid.session_data.a_language));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mem_use", uid.session_data.mem_use));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":meters_traveled", uid.session_data.meters_traveled));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_ping", uid.session_data.avg_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_ping", uid.session_data.min_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_ping", uid.session_data.max_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_ping", uid.session_data.mode_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":regions_visited", uid.session_data.regions_visited));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":run_time", uid.session_data.run_time));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_sim_fps", uid.session_data.avg_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_sim_fps", uid.session_data.min_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_sim_fps", uid.session_data.max_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_sim_fps", uid.session_data.mode_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":start_time", uid.session_data.start_time));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":client_version", uid.session_data.client_version));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_cpu", uid.session_data.s_cpu));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_gpu", uid.session_data.s_gpu));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_os", uid.session_data.s_os));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_ram", uid.session_data.s_ram));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":d_object_kb", uid.session_data.d_object_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":d_texture_kb", uid.session_data.d_texture_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":d_world_kb", uid.session_data.d_world_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_in_kb", uid.session_data.n_in_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_in_pk", uid.session_data.n_in_pk));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_out_kb", uid.session_data.n_out_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_out_pk", uid.session_data.n_out_pk));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid));
|
||||
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet));
|
||||
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString()));
|
||||
// m_log.Debug("UPDATE");
|
||||
|
||||
int result = updatecmd.ExecuteNonQuery();
|
||||
|
||||
if (result == 0)
|
||||
using (SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db))
|
||||
{
|
||||
// m_log.Debug("INSERT");
|
||||
updatecmd.CommandText = SQL_STATS_TABLE_INSERT;
|
||||
try
|
||||
{
|
||||
updatecmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (SqliteExecutionException)
|
||||
{
|
||||
m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage Execution Exception");
|
||||
}
|
||||
catch (SqliteSyntaxException)
|
||||
{
|
||||
m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage SQL Syntax Exception");
|
||||
}
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString()));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":last_updated", (int) uid.session_data.last_updated));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":remote_ip", uid.session_data.remote_ip));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":name_f", uid.session_data.name_f));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":name_l", uid.session_data.name_l));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_agents_in_view", uid.session_data.avg_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_agents_in_view",
|
||||
(int) uid.session_data.min_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_agents_in_view",
|
||||
(int) uid.session_data.max_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_agents_in_view",
|
||||
(int) uid.session_data.mode_agents_in_view));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_fps", uid.session_data.avg_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_fps", uid.session_data.min_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_fps", uid.session_data.max_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_fps", uid.session_data.mode_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":a_language", uid.session_data.a_language));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mem_use", uid.session_data.mem_use));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":meters_traveled", uid.session_data.meters_traveled));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_ping", uid.session_data.avg_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_ping", uid.session_data.min_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_ping", uid.session_data.max_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_ping", uid.session_data.mode_ping));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":regions_visited", uid.session_data.regions_visited));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":run_time", uid.session_data.run_time));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":avg_sim_fps", uid.session_data.avg_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":min_sim_fps", uid.session_data.min_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":max_sim_fps", uid.session_data.max_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":mode_sim_fps", uid.session_data.mode_sim_fps));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":start_time", uid.session_data.start_time));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":client_version", uid.session_data.client_version));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_cpu", uid.session_data.s_cpu));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_gpu", uid.session_data.s_gpu));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_os", uid.session_data.s_os));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":s_ram", uid.session_data.s_ram));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":d_object_kb", uid.session_data.d_object_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":d_texture_kb", uid.session_data.d_texture_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":d_world_kb", uid.session_data.d_world_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_in_kb", uid.session_data.n_in_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_in_pk", uid.session_data.n_in_pk));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_out_kb", uid.session_data.n_out_kb));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":n_out_pk", uid.session_data.n_out_pk));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid));
|
||||
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent));
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet));
|
||||
|
||||
updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString()));
|
||||
|
||||
// m_log.DebugFormat("[WEB STATS MODULE]: Database stats update for {0}", uid.session_data.agent_id);
|
||||
|
||||
int result = updatecmd.ExecuteNonQuery();
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
// m_log.DebugFormat("[WEB STATS MODULE]: Database stats insert for {0}", uid.session_data.agent_id);
|
||||
|
||||
updatecmd.CommandText = SQL_STATS_TABLE_INSERT;
|
||||
|
||||
// StringBuilder parameters = new StringBuilder();
|
||||
// SqliteParameterCollection spc = updatecmd.Parameters;
|
||||
// foreach (SqliteParameter sp in spc)
|
||||
// parameters.AppendFormat("{0}={1},", sp.ParameterName, sp.Value);
|
||||
//
|
||||
// m_log.DebugFormat("[WEB STATS MODULE]: Parameters {0}", parameters);
|
||||
|
||||
try
|
||||
{
|
||||
updatecmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (SqliteExecutionException e)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[WEB STATS MODULE]: failed to write stats for {0}, storage Execution Exception {1}{2}",
|
||||
uid.session_data.agent_id, e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -802,7 +806,7 @@ set session_id=:session_id,
|
|||
f_off_circuit=:f_off_circuit,
|
||||
f_resent=:f_resent,
|
||||
f_send_packet=:f_send_packet
|
||||
WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key";
|
||||
WHERE session_id=:session_key";
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,20 @@ namespace OpenSim.Server.Handlers.Login
|
|||
|
||||
if (requestData != null)
|
||||
{
|
||||
// Debug code to show exactly what login parameters the viewer is sending us.
|
||||
// TODO: Extract into a method that can be generally applied if one doesn't already exist.
|
||||
// foreach (string key in requestData.Keys)
|
||||
// {
|
||||
// object value = requestData[key];
|
||||
// Console.WriteLine("{0}:{1}", key, value);
|
||||
// if (value is ArrayList)
|
||||
// {
|
||||
// ICollection col = value as ICollection;
|
||||
// foreach (object item in col)
|
||||
// Console.WriteLine(" {0}", item);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (requestData.ContainsKey("first") && requestData["first"] != null &&
|
||||
requestData.ContainsKey("last") && requestData["last"] != null && (
|
||||
(requestData.ContainsKey("passwd") && requestData["passwd"] != null) ||
|
||||
|
|
|
@ -94,6 +94,5 @@ namespace OpenSim.Server.Handlers.Login
|
|||
server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false);
|
||||
server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -296,9 +296,10 @@ namespace OpenSim.Services.HypergridService
|
|||
aCircuit.firstname = account.FirstName;
|
||||
aCircuit.lastname = account.LastName;
|
||||
}
|
||||
if (account == null && !aCircuit.lastname.StartsWith("@"))
|
||||
if (account == null)
|
||||
{
|
||||
aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname;
|
||||
if (!aCircuit.lastname.StartsWith("@"))
|
||||
aCircuit.firstname = aCircuit.firstname + "." + aCircuit.lastname;
|
||||
try
|
||||
{
|
||||
Uri uri = new Uri(aCircuit.ServiceURLs["HomeURI"].ToString());
|
||||
|
|
|
@ -386,7 +386,7 @@ namespace OpenSim.Services.InventoryService
|
|||
public virtual bool AddItem(InventoryItemBase item)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[XINVENTORY SERVICE]: Adding item {0} to folder {1} for {2}", item.ID, item.Folder, item.Owner);
|
||||
// "[XINVENTORY SERVICE]: Adding item {0} {1} to folder {2} for {3}", item.Name, item.ID, item.Folder, item.Owner);
|
||||
|
||||
return m_Database.StoreItem(ConvertFromOpenSim(item));
|
||||
}
|
||||
|
|
|
@ -521,7 +521,7 @@ namespace OpenSim.Services.UserAccountService
|
|||
else
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[USER ACCOUNT SERVICE]; Created user inventory for {0} {1}", firstName, lastName);
|
||||
"[USER ACCOUNT SERVICE]: Created user inventory for {0} {1}", firstName, lastName);
|
||||
}
|
||||
|
||||
if (m_CreateDefaultAvatarEntries)
|
||||
|
|
|
@ -56,6 +56,10 @@ namespace pCampBot
|
|||
{
|
||||
Help();
|
||||
}
|
||||
else if (config.Get("firstname") == null || config.Get("lastname") == null || config.Get("password") == null)
|
||||
{
|
||||
Console.WriteLine("ERROR: You must supply a firstname, lastname and password for the bots.");
|
||||
}
|
||||
else
|
||||
{
|
||||
int botcount = config.GetInt("botcount", 1);
|
||||
|
|
Binary file not shown.
|
@ -209,49 +209,6 @@ namespace Prebuild.Core.Targets
|
|||
ss.WriteLine(" <target name=\"{0}\">", "build");
|
||||
ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
|
||||
ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
|
||||
ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\" flatten=\"true\">");
|
||||
ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
|
||||
foreach (ReferenceNode refr in project.References)
|
||||
{
|
||||
if (refr.LocalCopy)
|
||||
{
|
||||
ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)) + "\" />", '/'));
|
||||
}
|
||||
}
|
||||
|
||||
ss.WriteLine(" </fileset>");
|
||||
ss.WriteLine(" </copy>");
|
||||
if (project.ConfigFile != null && project.ConfigFile.Length!=0)
|
||||
{
|
||||
ss.Write(" <copy file=\"" + project.ConfigFile + "\" tofile=\"${project::get-base-directory()}/${build.dir}/${project::get-name()}");
|
||||
|
||||
if (project.Type == ProjectType.Library)
|
||||
{
|
||||
ss.Write(".dll.config\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
ss.Write(".exe.config\"");
|
||||
}
|
||||
ss.WriteLine(" />");
|
||||
}
|
||||
|
||||
// Add the content files to just be copied
|
||||
ss.WriteLine(" {0}", "<copy todir=\"${project::get-base-directory()}/${build.dir}\">");
|
||||
ss.WriteLine(" {0}", "<fileset basedir=\".\">");
|
||||
|
||||
foreach (string file in project.Files)
|
||||
{
|
||||
// Ignore if we aren't content
|
||||
if (project.Files.GetBuildAction(file) != BuildAction.Content)
|
||||
continue;
|
||||
|
||||
// Create a include tag
|
||||
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
|
||||
}
|
||||
|
||||
ss.WriteLine(" {0}", "</fileset>");
|
||||
ss.WriteLine(" {0}", "</copy>");
|
||||
|
||||
ss.Write(" <csc ");
|
||||
ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
<configuration>
|
||||
<dllmap os="osx" dll="sqlite3" target="./libsqlite3.dylib" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" wordsize="64" dll="sqlite3" target="./libsqlite3_64.so" />
|
||||
<dllmap os="!windows,osx" cpu="x86" wordsize="32" dll="sqlite3" target="./libsqlite3_32.so" />
|
||||
<dllmap os="osx" dll="sqlite3" target="lib64/libsqlite3.dylib" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" wordsize="64" dll="sqlite3" target="lib64/libsqlite3_64.so" />
|
||||
<dllmap os="!windows,osx" cpu="x86" wordsize="32" dll="sqlite3" target="lib32/libsqlite3_32.so" />
|
||||
</configuration>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<configuration>
|
||||
<dllmap os="osx" dll="ode" target="libode.dylib" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="ode" target="libode-x86_64" />
|
||||
<dllmap os="!windows,osx" cpu="x86" dll="ode" target="libode" />
|
||||
<dllmap os="!windows,osx" cpu="ppc64" dll="ode" target="libode-ppc64" />
|
||||
<dllmap os="!windows,osx" cpu="s390x" dll="ode" target="libode-s390x" />
|
||||
</configuration>
|
||||
<dllmap os="osx" dll="ode" target="lib64/libode.dylib" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="ode" target="lib64/libode-x86_64" />
|
||||
<dllmap os="!windows,osx" cpu="x86" dll="ode" target="lib32/libode" />
|
||||
<dllmap os="!windows,osx" cpu="ppc64" dll="ode" target="lib64/libode-ppc64" />
|
||||
<dllmap os="!windows,osx" cpu="s390x" dll="ode" target="lib64/libode-s390x" />
|
||||
</configuration>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<configuration>
|
||||
<dllmap os="osx" dll="openjpeg-dotnet.dll" target="libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="openjpeg-dotnet.dll" target="libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="openjpeg-dotnet-x86_64.dll" target="libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64" />
|
||||
<dllmap os="!windows,osx" cpu="x86" dll="openjpeg-dotnet.dll" target="libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686" />
|
||||
<dllmap os="!windows,osx" cpu="x86" dll="openjpeg-dotnet-x86_64.dll" target="libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686" />
|
||||
<dllmap os="osx" dll="openjpeg-dotnet.dll" target="lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="openjpeg-dotnet.dll" target="lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="openjpeg-dotnet-x86_64.dll" target="lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64" />
|
||||
<dllmap os="!windows,osx" cpu="x86" dll="openjpeg-dotnet.dll" target="lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686" />
|
||||
<dllmap os="!windows,osx" cpu="x86" dll="openjpeg-dotnet-x86_64.dll" target="lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686" />
|
||||
</configuration>
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
|
||||
[Startup]
|
||||
|
||||
;# {ConsolePrompt} {} {ConsolePrompt} {} "Region (\R) "
|
||||
;; Console prompt
|
||||
;; Certain special characters can be used to customize the prompt
|
||||
|
@ -173,6 +172,7 @@
|
|||
|
||||
;# {permissionmodules} {} {Permission modules to use (may specify multiple modules, separated by comma} {} DefaultPermissionsModule
|
||||
;; Permission modules to use, separated by comma.
|
||||
;; Possible modules are DefaultPermissionsModule, PrimLimitsModule
|
||||
; permissionmodules = DefaultPermissionsModule
|
||||
|
||||
;# {serverside_object_permissions} {permissionmodules:DefaultPermissionsModule} {Activate permission handling by the sim?} {true false} true
|
||||
|
@ -194,6 +194,15 @@
|
|||
; region_manager_is_god = false
|
||||
; parcel_owner_is_god = true
|
||||
|
||||
;; More control over permissions
|
||||
;; This is definitely not SL!
|
||||
; Provides a simple control for land owners to give build rights to specific avatars
|
||||
; in publicly accessible parcels that disallow object creation in general.
|
||||
; Owners specific avatars by adding them to the Access List of the parcel
|
||||
; without having to use the Groups feature
|
||||
; simple_build_permissions = false
|
||||
|
||||
|
||||
;; Default script engine to use. Currently, we only have XEngine
|
||||
; DefaultScriptEngine = "XEngine"
|
||||
|
||||
|
@ -773,11 +782,9 @@
|
|||
;# {Enabled} {} {Enable Non Player Character (NPC) facilities} {true false} false
|
||||
; Enabled = false
|
||||
|
||||
|
||||
[PrimLimitsModule]
|
||||
;# {EnforcePrimLimits} {} {Enforce parcel prim limits} {true false} false
|
||||
;; Enable parcel prim limits. Off by default to emulate pre-existing behavior.
|
||||
; EnforcePrimLimits = false
|
||||
[Terrain]
|
||||
;# {InitialTerrain} {} {Initial terrain type} {pinhead-island flat} pinhead-island
|
||||
; InitialTerrain = "pinhead-island"
|
||||
|
||||
|
||||
[Architecture]
|
||||
|
|
|
@ -260,6 +260,14 @@
|
|||
; Default value is all
|
||||
; allowed_script_editors = all
|
||||
|
||||
; Provides a simple control for land owners to give build rights to specific avatars
|
||||
; in publicly accessible parcels that disallow object creation in general.
|
||||
; Owners specific avatars by adding them to the Access List of the parcel
|
||||
; without having to use the Groups feature
|
||||
; Disabled by default
|
||||
; simple_build_permissions = False
|
||||
|
||||
|
||||
; ##
|
||||
; ## SCRIPT ENGINE
|
||||
; ##
|
||||
|
@ -579,13 +587,12 @@
|
|||
Cap_ViewerStartAuction = ""
|
||||
Cap_ViewerStats = ""
|
||||
|
||||
; The various fetch inventory caps are supported by OpenSim, but may
|
||||
; lead to poor sim performance if served by the simulators,
|
||||
; so they are currently disabled by default.
|
||||
; Capabilities for fetching inventory over HTTP rather than UDP
|
||||
; FetchInventoryDescendents2 and FetchInventory2 are the ones used in the latest Linden Lab viewers (from some point in the v2 series and above)
|
||||
; It appears that Linden Lab viewer 3.3.1 onwards will not work properly if FetchInventoryDescendents2 and FetchInventory2 are not enabled
|
||||
Cap_WebFetchInventoryDescendents = ""
|
||||
Cap_FetchInventoryDescendents2 = ""
|
||||
Cap_FetchInventory2 = ""
|
||||
Cap_FetchInventoryDescendents2 = "localhost"
|
||||
Cap_FetchInventory2 = "localhost"
|
||||
|
||||
|
||||
[Chat]
|
||||
|
@ -1512,6 +1519,9 @@
|
|||
;; Enable Non Player Character (NPC) facilities
|
||||
Enabled = false
|
||||
|
||||
[Terrain]
|
||||
InitialTerrain = "pinhead-island"
|
||||
|
||||
;;
|
||||
;; If you are using a simian grid frontend you can enable
|
||||
;; this module to upload tile images for the mapping fn
|
||||
|
|
BIN
bin/Prebuild.exe
BIN
bin/Prebuild.exe
Binary file not shown.
|
@ -14,6 +14,7 @@
|
|||
AvatarServices = "RemoteAvatarServicesConnector"
|
||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
||||
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||
PresenceServices = "RemotePresenceServicesConnector"
|
||||
UserAccountServices = "RemoteUserAccountServicesConnector"
|
||||
GridUserServices = "RemoteGridUserServicesConnector"
|
||||
|
|
|
@ -146,3 +146,13 @@
|
|||
|
||||
[MapImageService]
|
||||
MapImageServerURI = "http://mygridserver.com:8003"
|
||||
|
||||
[AuthorizationService]
|
||||
; If you have regions with access restrictions
|
||||
; specify them here using the convention
|
||||
; Region_<Region_Name> = <flags>
|
||||
; Valid flags are:
|
||||
; DisallowForeigners -- HG visitors not allowed
|
||||
; DisallowResidents -- only Admins and Managers allowed
|
||||
; Example:
|
||||
; Region_Test_1 = "DisallowForeigners"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
AvatarServices = "RemoteAvatarServicesConnector"
|
||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
||||
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||
PresenceServices = "RemotePresenceServicesConnector"
|
||||
UserAccountServices = "RemoteUserAccountServicesConnector"
|
||||
GridUserServices = "RemoteGridUserServicesConnector"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
InventoryServices = "LocalInventoryServicesConnector"
|
||||
NeighbourServices = "LocalNeighbourServicesConnector"
|
||||
AuthenticationServices = "LocalAuthenticationServicesConnector"
|
||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||
GridServices = "LocalGridServicesConnector"
|
||||
PresenceServices = "LocalPresenceServicesConnector"
|
||||
UserAccountServices = "LocalUserAccountServicesConnector"
|
||||
|
@ -47,9 +48,6 @@
|
|||
[AvatarService]
|
||||
LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService"
|
||||
|
||||
[AuthorizationService]
|
||||
LocalServiceModule = "OpenSim.Services.AuthorizationService.dll:AuthorizationService"
|
||||
|
||||
[AuthenticationService]
|
||||
LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||
|
||||
|
|
|
@ -231,3 +231,13 @@
|
|||
[MapImageService]
|
||||
; Set this if you want to change the default
|
||||
; TilesStoragePath = "maptiles"
|
||||
|
||||
[AuthorizationService]
|
||||
; If you have regions with access restrictions
|
||||
; specify them here using the convention
|
||||
; Region_<Region_Name> = <flags>
|
||||
; Valid flags are:
|
||||
; DisallowForeigners -- HG visitors not allowed
|
||||
; DisallowResidents -- only Admins and Managers allowed
|
||||
; Example:
|
||||
; Region_Test_1 = "DisallowForeigners"
|
|
@ -12,6 +12,7 @@
|
|||
InventoryServices = "HGInventoryBroker"
|
||||
NeighbourServices = "LocalNeighbourServicesConnector"
|
||||
AuthenticationServices = "LocalAuthenticationServicesConnector"
|
||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||
GridServices = "LocalGridServicesConnector"
|
||||
PresenceServices = "LocalPresenceServicesConnector"
|
||||
UserAccountServices = "LocalUserAccountServicesConnector"
|
||||
|
@ -68,9 +69,6 @@
|
|||
LibraryName = "OpenSim Library"
|
||||
DefaultLibrary = "./inventory/Libraries.xml"
|
||||
|
||||
[AuthorizationService]
|
||||
LocalServiceModule = "OpenSim.Services.AuthorizationService.dll:AuthorizationService"
|
||||
|
||||
[AuthenticationService]
|
||||
LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue