Compare commits
187 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e8496ffc5 | ||
|
|
88d6c4ec0e | ||
|
|
135eeb45d6 | ||
|
|
54ee59c0bb | ||
|
|
4a5c61a33d | ||
|
|
179c0f5f56 | ||
|
|
4dbf937707 | ||
|
|
9edb57e5e9 | ||
|
|
4d15ad63bf | ||
|
|
4021709371 | ||
|
|
3c13f5c3aa | ||
|
|
381517b451 | ||
|
|
6ecf36d49c | ||
|
|
64eb4b8408 | ||
|
|
318da3fdcd | ||
|
|
50c99fcda6 | ||
|
|
321de1f263 | ||
|
|
fa30ace67d | ||
|
|
92baa79253 | ||
|
|
e861b45313 | ||
|
|
cf91ac68b6 | ||
|
|
d4aba13526 | ||
|
|
d36c7c3782 | ||
|
|
4385fcdeae | ||
|
|
04eb170624 | ||
|
|
4803686078 | ||
|
|
20b0fda3bb | ||
|
|
4e5f823595 | ||
|
|
a74408d1d2 | ||
|
|
8206537efd | ||
|
|
a9a77bb3ab | ||
|
|
6390de689d | ||
|
|
41ce19836b | ||
|
|
883a4f6fff | ||
|
|
5f1da80fc1 | ||
|
|
64217d67f6 | ||
|
|
b01c79354c | ||
|
|
9ecbcb787c | ||
|
|
e17e376b04 | ||
|
|
1b4ea4f178 | ||
|
|
1de29fb362 | ||
|
|
7e4bd492fd | ||
|
|
588d56503d | ||
|
|
e9602656f8 | ||
|
|
0116d418f0 | ||
|
|
9992974c66 | ||
|
|
ba27d8a389 | ||
|
|
f96e985763 | ||
|
|
5b9eaae50d | ||
|
|
74a13f7e3b | ||
|
|
3e88fc8aad | ||
|
|
881740d702 | ||
|
|
9a643a1bb9 | ||
|
|
a5488650ff | ||
|
|
a275127a65 | ||
|
|
02db31db6a | ||
|
|
8bd813e6fc | ||
|
|
09ff121654 | ||
|
|
0434758a0d | ||
|
|
8bb0a71083 | ||
|
|
d7651a389e | ||
|
|
824318a0c1 | ||
|
|
5e9ed22e84 | ||
|
|
a6c611e7c9 | ||
|
|
72b325f8b5 | ||
|
|
54d0514b13 | ||
|
|
58b1c3cec0 | ||
|
|
71641523a3 | ||
|
|
94c5e25c3b | ||
|
|
20bad0aa6c | ||
|
|
e7f23a6218 | ||
|
|
25c29db8b6 | ||
|
|
1750fba9ce | ||
|
|
b18e410586 | ||
|
|
38d5e1fab3 | ||
|
|
4180c32eb1 | ||
|
|
5115229fdf | ||
|
|
e8f2d814e7 | ||
|
|
1fda8c5a86 | ||
|
|
6b77b55d40 | ||
|
|
82cdb08c1f | ||
|
|
b48b0b1e58 | ||
|
|
f9066e7d86 | ||
|
|
dafcb3bcd7 | ||
|
|
7b5e42c744 | ||
|
|
bafef292f4 | ||
|
|
9e6ffe7798 | ||
|
|
84735b644c | ||
|
|
f67f37074f | ||
|
|
fe229f10e6 | ||
|
|
0b9f4d7e74 | ||
|
|
f034958bdc | ||
|
|
90ea00a109 | ||
|
|
9ed4245d9e | ||
|
|
1dfc990264 | ||
|
|
5d31267185 | ||
|
|
cf9b3e7708 | ||
|
|
1c533eb520 | ||
|
|
5397a6d4c6 | ||
|
|
76f411147d | ||
|
|
15ce73caca | ||
|
|
a27e5a9c95 | ||
|
|
daee2eda93 | ||
|
|
a15b00d3ef | ||
|
|
1b906ef2ad | ||
|
|
68a4ef5ef6 | ||
|
|
90dc5f47e7 | ||
|
|
19d271d3fc | ||
|
|
3259b1d1e0 | ||
|
|
4a329098e8 | ||
|
|
512910a51f | ||
|
|
99b9c1a9d5 | ||
|
|
fdda57cf10 | ||
|
|
ec8e34950d | ||
|
|
93964ef3a4 | ||
|
|
5c8af6a136 | ||
|
|
1c3ee5d1ce | ||
|
|
b489c85226 | ||
|
|
dcea23906b | ||
|
|
20c65ac438 | ||
|
|
4d0c8aca05 | ||
|
|
8fc16ece96 | ||
|
|
fcbb375e8f | ||
|
|
49c65279fa | ||
|
|
86e8a56fe1 | ||
|
|
b199330682 | ||
|
|
7a7ebaebd1 | ||
|
|
164ae0b24b | ||
|
|
bcb9577495 | ||
|
|
d22715126c | ||
|
|
a114367b9b | ||
|
|
7156545fca | ||
|
|
2ffc055f7e | ||
|
|
14e9bf894c | ||
|
|
f4cd35322f | ||
|
|
7bdcf9eb26 | ||
|
|
9846a1e56e | ||
|
|
4cc97df8f3 | ||
|
|
0ef64fbe03 | ||
|
|
fbccff4994 | ||
|
|
84184708de | ||
|
|
8f8b478d36 | ||
|
|
b817c337dc | ||
|
|
d03e878d53 | ||
|
|
b313d16493 | ||
|
|
784263f5e3 | ||
|
|
6baa13ab7a | ||
|
|
0e16e0fb6a | ||
|
|
ba98d6fffe | ||
|
|
73a5abf4d9 | ||
|
|
630c8dc828 | ||
|
|
972f73ed2b | ||
|
|
6de89246c2 | ||
|
|
c5ff37bf3e | ||
|
|
6b867773a8 | ||
|
|
96973a5778 | ||
|
|
912aac3447 | ||
|
|
4486b7d8e8 | ||
|
|
1267094a51 | ||
|
|
2b842958cc | ||
|
|
80ec2ac167 | ||
|
|
df960d5767 | ||
|
|
c0760f9f91 | ||
|
|
c906128191 | ||
|
|
96843f2b17 | ||
|
|
f574d3c8fc | ||
|
|
ebe5e1731d | ||
|
|
2ebb421331 | ||
|
|
a9e8bd59a3 | ||
|
|
4589ce61bc | ||
|
|
33e66107be | ||
|
|
db90dea9bd | ||
|
|
04544b4510 | ||
|
|
0b17a66e68 | ||
|
|
04986bbb15 | ||
|
|
b0d02adeee | ||
|
|
48b962c401 | ||
|
|
04a195266b | ||
|
|
21393af631 | ||
|
|
189c67db95 | ||
|
|
b92b9228ef | ||
|
|
f49897a419 | ||
|
|
aab30f5e67 | ||
|
|
e7fd732209 | ||
|
|
8a36f54cf4 | ||
|
|
1a14e660d2 | ||
|
|
2502aae5db |
@@ -2,13 +2,37 @@
|
||||
<!-- please leave the top comment for us emacs folks -->
|
||||
<property name="nunitcmd" value="nunit-console" />
|
||||
|
||||
<!-- For safety/laziness sake, we're going to take the approach of deleting known extraneous files here rather than
|
||||
trying to copy across only the essential ones -->
|
||||
<property name="distbindir" value="distbin" />
|
||||
<target name="distbin">
|
||||
<!-- This target produces a source distribution of OpenSimulator -->
|
||||
<!-- TODO: A few parameters still need to be tweaked after running this - need to do this automatically with sed or similar -->
|
||||
<target name="distsrc">
|
||||
<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" />
|
||||
<!-- This target produces a binary directory called distbin/ in OpenSim/bin which contains everything needed for binary distribution -->
|
||||
<!-- For safety/laziness sake, we're going to take the approach of deleting known extraneous files here rather than
|
||||
trying to copy across only the essential ones -->
|
||||
<target name="distbin">
|
||||
<delete dir="${distbindir}"/>
|
||||
<copy todir="${distbindir}">
|
||||
<fileset>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,4 +235,11 @@ CREATE NONCLUSTERED INDEX IX_regions_name ON dbo.regions
|
||||
regionName
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
|
||||
COMMIT
|
||||
COMMIT
|
||||
|
||||
:VERSION 9
|
||||
|
||||
BEGIN TRANSACTION
|
||||
ALTER TABLE regions ADD parcelMapTexture uniqueidentifier NULL;
|
||||
|
||||
COMMIT
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -472,3 +472,95 @@ COMMIT;
|
||||
BEGIN;
|
||||
ALTER TABLE regionsettings ADD COLUMN covenant_datetime INTEGER NOT NULL default 0;
|
||||
COMMIT;
|
||||
|
||||
:VERSION 23
|
||||
BEGIN;
|
||||
CREATE TABLE regionwindlight (
|
||||
region_id VARCHAR(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000' PRIMARY KEY,
|
||||
water_color_r FLOAT NOT NULL DEFAULT '4.000000',
|
||||
water_color_g FLOAT NOT NULL DEFAULT '38.000000',
|
||||
water_color_b FLOAT NOT NULL DEFAULT '64.000000',
|
||||
water_color_i FLOAT NOT NULL DEFAULT '1.000000',
|
||||
water_fog_density_exponent FLOAT NOT NULL DEFAULT '4.0',
|
||||
underwater_fog_modifier FLOAT NOT NULL DEFAULT '0.25',
|
||||
reflection_wavelet_scale_1 FLOAT NOT NULL DEFAULT '2.0',
|
||||
reflection_wavelet_scale_2 FLOAT NOT NULL DEFAULT '2.0',
|
||||
reflection_wavelet_scale_3 FLOAT NOT NULL DEFAULT '2.0',
|
||||
fresnel_scale FLOAT NOT NULL DEFAULT '0.40',
|
||||
fresnel_offset FLOAT NOT NULL DEFAULT '0.50',
|
||||
refract_scale_above FLOAT NOT NULL DEFAULT '0.03',
|
||||
refract_scale_below FLOAT NOT NULL DEFAULT '0.20',
|
||||
blur_multiplier FLOAT NOT NULL DEFAULT '0.040',
|
||||
big_wave_direction_x FLOAT NOT NULL DEFAULT '1.05',
|
||||
big_wave_direction_y FLOAT NOT NULL DEFAULT '-0.42',
|
||||
little_wave_direction_x FLOAT NOT NULL DEFAULT '1.11',
|
||||
little_wave_direction_y FLOAT NOT NULL DEFAULT '-1.16',
|
||||
normal_map_texture VARCHAR(36) NOT NULL DEFAULT '822ded49-9a6c-f61c-cb89-6df54f42cdf4',
|
||||
horizon_r FLOAT NOT NULL DEFAULT '0.25',
|
||||
horizon_g FLOAT NOT NULL DEFAULT '0.25',
|
||||
horizon_b FLOAT NOT NULL DEFAULT '0.32',
|
||||
horizon_i FLOAT NOT NULL DEFAULT '0.32',
|
||||
haze_horizon FLOAT NOT NULL DEFAULT '0.19',
|
||||
blue_density_r FLOAT NOT NULL DEFAULT '0.12',
|
||||
blue_density_g FLOAT NOT NULL DEFAULT '0.22',
|
||||
blue_density_b FLOAT NOT NULL DEFAULT '0.38',
|
||||
blue_density_i FLOAT NOT NULL DEFAULT '0.38',
|
||||
haze_density FLOAT NOT NULL DEFAULT '0.70',
|
||||
density_multiplier FLOAT NOT NULL DEFAULT '0.18',
|
||||
distance_multiplier FLOAT NOT NULL DEFAULT '0.8',
|
||||
max_altitude INTEGER NOT NULL DEFAULT '1605',
|
||||
sun_moon_color_r FLOAT NOT NULL DEFAULT '0.24',
|
||||
sun_moon_color_g FLOAT NOT NULL DEFAULT '0.26',
|
||||
sun_moon_color_b FLOAT NOT NULL DEFAULT '0.30',
|
||||
sun_moon_color_i FLOAT NOT NULL DEFAULT '0.30',
|
||||
sun_moon_position FLOAT NOT NULL DEFAULT '0.317',
|
||||
ambient_r FLOAT NOT NULL DEFAULT '0.35',
|
||||
ambient_g FLOAT NOT NULL DEFAULT '0.35',
|
||||
ambient_b FLOAT NOT NULL DEFAULT '0.35',
|
||||
ambient_i FLOAT NOT NULL DEFAULT '0.35',
|
||||
east_angle FLOAT NOT NULL DEFAULT '0.00',
|
||||
sun_glow_focus FLOAT NOT NULL DEFAULT '0.10',
|
||||
sun_glow_size FLOAT NOT NULL DEFAULT '1.75',
|
||||
scene_gamma FLOAT NOT NULL DEFAULT '1.00',
|
||||
star_brightness FLOAT NOT NULL DEFAULT '0.00',
|
||||
cloud_color_r FLOAT NOT NULL DEFAULT '0.41',
|
||||
cloud_color_g FLOAT NOT NULL DEFAULT '0.41',
|
||||
cloud_color_b FLOAT NOT NULL DEFAULT '0.41',
|
||||
cloud_color_i FLOAT NOT NULL DEFAULT '0.41',
|
||||
cloud_x FLOAT NOT NULL DEFAULT '1.00',
|
||||
cloud_y FLOAT NOT NULL DEFAULT '0.53',
|
||||
cloud_density FLOAT NOT NULL DEFAULT '1.00',
|
||||
cloud_coverage FLOAT NOT NULL DEFAULT '0.27',
|
||||
cloud_scale FLOAT NOT NULL DEFAULT '0.42',
|
||||
cloud_detail_x FLOAT NOT NULL DEFAULT '1.00',
|
||||
cloud_detail_y FLOAT NOT NULL DEFAULT '0.53',
|
||||
cloud_detail_density FLOAT NOT NULL DEFAULT '0.12',
|
||||
cloud_scroll_x FLOAT NOT NULL DEFAULT '0.20',
|
||||
cloud_scroll_x_lock INTEGER NOT NULL DEFAULT '0',
|
||||
cloud_scroll_y FLOAT NOT NULL DEFAULT '0.01',
|
||||
cloud_scroll_y_lock INTEGER NOT NULL DEFAULT '0',
|
||||
draw_classic_clouds INTEGER NOT NULL DEFAULT '1');
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
:VERSION 24
|
||||
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `spawn_points` (
|
||||
`RegionID` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
|
||||
`Yaw` float NOT NULL,
|
||||
`Pitch` float NOT NULL,
|
||||
`Distance` float NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 25
|
||||
|
||||
BEGIN;
|
||||
ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
|
||||
COMMIT;
|
||||
|
||||
@@ -81,6 +81,9 @@ namespace OpenSim.Data.SQLite
|
||||
/// <param name="dbconnect">connect string</param>
|
||||
override public void Initialise(string dbconnect)
|
||||
{
|
||||
if (Util.IsWindows())
|
||||
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
|
||||
|
||||
if (dbconnect == string.Empty)
|
||||
{
|
||||
dbconnect = "URI=file:Asset.db,version=3";
|
||||
|
||||
@@ -65,6 +65,9 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
if (!m_initialized)
|
||||
{
|
||||
if (Util.IsWindows())
|
||||
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
|
||||
|
||||
m_Connection = new SqliteConnection(connectionString);
|
||||
m_Connection.Open();
|
||||
|
||||
|
||||
@@ -69,6 +69,9 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
public void Initialise(string connectionString)
|
||||
{
|
||||
if (Util.IsWindows())
|
||||
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
|
||||
|
||||
m_connectionString = connectionString;
|
||||
|
||||
m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString);
|
||||
|
||||
@@ -48,6 +48,8 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
protected SQLiteFramework(string connectionString)
|
||||
{
|
||||
if (Util.IsWindows())
|
||||
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -77,6 +77,9 @@ namespace OpenSim.Data.SQLite
|
||||
{
|
||||
m_Initialized = true;
|
||||
|
||||
if (Util.IsWindows())
|
||||
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
|
||||
|
||||
if (dbconnect == string.Empty)
|
||||
{
|
||||
dbconnect = "URI=file:inventoryStore.db,version=3";
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -52,6 +52,9 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
public SQLiteXInventoryData(string conn, string realm)
|
||||
{
|
||||
if (Util.IsWindows())
|
||||
Util.LoadArchSpecificWindowsDll("sqlite3.dll");
|
||||
|
||||
m_Folders = new SQLiteGenericTableHandler<XInventoryFolder>(
|
||||
conn, "inventoryfolders", "XInventoryStore");
|
||||
m_Items = new SqliteItemHandler(
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -49,15 +49,16 @@ namespace OpenSim.Framework.Serialization.External
|
||||
/// <param name="nodeToFill"></param>
|
||||
/// <param name="processors">/param>
|
||||
/// <param name="xtr"></param>
|
||||
public static void ExecuteReadProcessors<NodeType>(
|
||||
/// <returns>true on successful, false if there were any processing failures</returns>
|
||||
public static bool ExecuteReadProcessors<NodeType>(
|
||||
NodeType nodeToFill, Dictionary<string, Action<NodeType, XmlTextReader>> processors, XmlTextReader xtr)
|
||||
{
|
||||
ExecuteReadProcessors(
|
||||
return ExecuteReadProcessors(
|
||||
nodeToFill,
|
||||
processors,
|
||||
xtr,
|
||||
(o, name, e)
|
||||
=> m_log.ErrorFormat(
|
||||
=> m_log.DebugFormat(
|
||||
"[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}",
|
||||
name, e.Message, e.StackTrace));
|
||||
}
|
||||
@@ -71,12 +72,15 @@ namespace OpenSim.Framework.Serialization.External
|
||||
/// <param name="parseExceptionAction">
|
||||
/// Action to take if there is a parsing problem. This will usually just be to log the exception
|
||||
/// </param>
|
||||
public static void ExecuteReadProcessors<NodeType>(
|
||||
/// <returns>true on successful, false if there were any processing failures</returns>
|
||||
public static bool ExecuteReadProcessors<NodeType>(
|
||||
NodeType nodeToFill,
|
||||
Dictionary<string, Action<NodeType, XmlTextReader>> processors,
|
||||
XmlTextReader xtr,
|
||||
Action<NodeType, string, Exception> parseExceptionAction)
|
||||
{
|
||||
bool errors = false;
|
||||
|
||||
string nodeName = string.Empty;
|
||||
while (xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
@@ -95,6 +99,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
errors = true;
|
||||
parseExceptionAction(nodeToFill, nodeName, e);
|
||||
|
||||
if (xtr.NodeType == XmlNodeType.EndElement)
|
||||
@@ -107,6 +112,8 @@ namespace OpenSim.Framework.Serialization.External
|
||||
xtr.ReadOuterXml(); // ignore
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -140,6 +147,7 @@ namespace OpenSim.Framework.Serialization.External
|
||||
UUID.TryParse(node.InnerText, out uuid);
|
||||
creator = userService.GetUserAccount(scopeID, uuid);
|
||||
}
|
||||
|
||||
if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty)
|
||||
hasCreatorData = true;
|
||||
|
||||
@@ -163,7 +171,6 @@ namespace OpenSim.Framework.Serialization.External
|
||||
doc.Save(wr);
|
||||
return wr.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ namespace OpenSim.Framework.Servers
|
||||
string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}";
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads();
|
||||
Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreadsInfo();
|
||||
|
||||
sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -308,7 +312,9 @@ namespace OpenSim.Framework.Servers
|
||||
// clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
|
||||
// the clr version number doesn't match the project version number under Mono.
|
||||
//m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine);
|
||||
m_log.Info("[STARTUP]: Operating system version: " + Environment.OSVersion + Environment.NewLine);
|
||||
m_log.InfoFormat(
|
||||
"[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n",
|
||||
Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32");
|
||||
|
||||
StartupSpecific();
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
String.Format("PollServiceWorkerThread{0}", i),
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
int.MaxValue);
|
||||
}
|
||||
|
||||
@@ -73,6 +74,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
"PollServiceWatcherThread",
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
true,
|
||||
1000 * 60 * 10);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenSim
|
||||
public class VersionInfo
|
||||
{
|
||||
private const string VERSION_NUMBER = "0.7.3";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Extended;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Security.Cryptography;
|
||||
@@ -80,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.
|
||||
@@ -143,7 +147,6 @@ namespace OpenSim.Framework
|
||||
return lerp(y, lerp(x, a, b), lerp(x, c, d));
|
||||
}
|
||||
|
||||
|
||||
public static Encoding UTF8 = Encoding.UTF8;
|
||||
|
||||
/// <value>
|
||||
@@ -375,6 +378,50 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is the platform Windows?
|
||||
/// </summary>
|
||||
/// <returns>true if so, false otherwise</returns>
|
||||
public static bool IsWindows()
|
||||
{
|
||||
PlatformID platformId = Environment.OSVersion.Platform;
|
||||
|
||||
return (platformId == PlatformID.Win32NT
|
||||
|| platformId == PlatformID.Win32S
|
||||
|| platformId == PlatformID.Win32Windows
|
||||
|| platformId == PlatformID.WinCE);
|
||||
}
|
||||
|
||||
public static bool LoadArchSpecificWindowsDll(string libraryName)
|
||||
{
|
||||
// We do this so that OpenSimulator on Windows loads the correct native library depending on whether
|
||||
// it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports
|
||||
// will find it already loaded later on.
|
||||
//
|
||||
// This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
|
||||
// controlled in config files.
|
||||
string nativeLibraryPath;
|
||||
|
||||
if (Util.Is64BitProcess())
|
||||
nativeLibraryPath = "lib64/" + libraryName;
|
||||
else
|
||||
nativeLibraryPath = "lib32/" + libraryName;
|
||||
|
||||
m_log.DebugFormat("[UTIL]: Loading native Windows library at {0}", nativeLibraryPath);
|
||||
|
||||
if (Util.LoadLibrary(nativeLibraryPath) == IntPtr.Zero)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[UTIL]: Couldn't find native Windows library at {0}", nativeLibraryPath);
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsEnvironmentSupported(ref string reason)
|
||||
@@ -1457,6 +1504,27 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to trigger an early library load on Windows systems.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Required to get 32-bit and 64-bit processes to automatically use the
|
||||
/// appropriate native library.
|
||||
/// </remarks>
|
||||
/// <param name="dllToLoad"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("kernel32.dll")]
|
||||
public static extern IntPtr LoadLibrary(string dllToLoad);
|
||||
|
||||
/// <summary>
|
||||
/// Determine whether the current process is 64 bit
|
||||
/// </summary>
|
||||
/// <returns>true if so, false if not</returns>
|
||||
public static bool Is64BitProcess()
|
||||
{
|
||||
return IntPtr.Size == 8;
|
||||
}
|
||||
|
||||
#region FireAndForget Threading Pattern
|
||||
@@ -1605,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;
|
||||
|
||||
@@ -72,6 +72,11 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
public bool IsTimedOut { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Will this thread trigger the alarm function if it has timed out?
|
||||
/// </summary>
|
||||
public bool AlarmIfTimeout { get; set; }
|
||||
|
||||
public ThreadWatchdogInfo(Thread thread, int timeout)
|
||||
{
|
||||
Thread = thread;
|
||||
@@ -112,12 +117,13 @@ namespace OpenSim.Framework
|
||||
/// <param name="start">The method that will be executed in a new thread</param>
|
||||
/// <param name="name">A name to give to the new thread</param>
|
||||
/// <param name="priority">Priority to run the thread at</param>
|
||||
/// <param name="isBackground">True to run this thread as a background
|
||||
/// thread, otherwise false</param>
|
||||
/// <param name="isBackground">True to run this thread as a background thread, otherwise false</param>
|
||||
/// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
|
||||
/// <returns>The newly created Thread object</returns>
|
||||
public static Thread StartThread(ThreadStart start, string name, ThreadPriority priority, bool isBackground)
|
||||
public static Thread StartThread(
|
||||
ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout)
|
||||
{
|
||||
return StartThread(start, name, priority, isBackground, WATCHDOG_TIMEOUT_MS);
|
||||
return StartThread(start, name, priority, isBackground, alarmIfTimeout, WATCHDOG_TIMEOUT_MS);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -128,21 +134,21 @@ namespace OpenSim.Framework
|
||||
/// <param name="priority">Priority to run the thread at</param>
|
||||
/// <param name="isBackground">True to run this thread as a background
|
||||
/// thread, otherwise false</param>
|
||||
/// <param name="timeout">
|
||||
/// Number of milliseconds to wait until we issue a warning about timeout.
|
||||
/// </para>
|
||||
/// <param name="alarmIfTimeout">Trigger an alarm function is we have timed out</param>
|
||||
/// <param name="timeout">Number of milliseconds to wait until we issue a warning about timeout.</param>
|
||||
/// <returns>The newly created Thread object</returns>
|
||||
public static Thread StartThread(
|
||||
ThreadStart start, string name, ThreadPriority priority, bool isBackground, int timeout)
|
||||
ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout, int timeout)
|
||||
{
|
||||
Thread thread = new Thread(start);
|
||||
thread.Name = name;
|
||||
thread.Priority = priority;
|
||||
thread.IsBackground = isBackground;
|
||||
|
||||
ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout);
|
||||
ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout) { AlarmIfTimeout = alarmIfTimeout };
|
||||
|
||||
m_log.Debug("[WATCHDOG]: Started tracking thread \"" + twi.Thread.Name + "\" (ID " + twi.Thread.ManagedThreadId + ")");
|
||||
m_log.DebugFormat(
|
||||
"[WATCHDOG]: Started tracking thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId);
|
||||
|
||||
lock (m_threads)
|
||||
m_threads.Add(twi.Thread.ManagedThreadId, twi);
|
||||
@@ -224,19 +230,39 @@ namespace OpenSim.Framework
|
||||
/// Get currently watched threads for diagnostic purposes
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ThreadWatchdogInfo[] GetThreads()
|
||||
public static ThreadWatchdogInfo[] GetThreadsInfo()
|
||||
{
|
||||
lock (m_threads)
|
||||
return m_threads.Values.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the current thread's watchdog info.
|
||||
/// </summary>
|
||||
/// <returns>The watchdog info. null if the thread isn't being monitored.</returns>
|
||||
public static ThreadWatchdogInfo GetCurrentThreadInfo()
|
||||
{
|
||||
lock (m_threads)
|
||||
{
|
||||
if (m_threads.ContainsKey(Thread.CurrentThread.ManagedThreadId))
|
||||
return m_threads[Thread.CurrentThread.ManagedThreadId];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check watched threads. Fire alarm if appropriate.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
WatchdogTimeout callback = OnWatchdogTimeout;
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
ThreadWatchdogInfo timedOut = null;
|
||||
List<ThreadWatchdogInfo> callbackInfos = null;
|
||||
|
||||
lock (m_threads)
|
||||
{
|
||||
@@ -246,21 +272,31 @@ namespace OpenSim.Framework
|
||||
{
|
||||
if (threadInfo.Thread.ThreadState == ThreadState.Stopped)
|
||||
{
|
||||
timedOut = threadInfo;
|
||||
RemoveThread(threadInfo.Thread.ManagedThreadId);
|
||||
break;
|
||||
|
||||
if (callbackInfos == null)
|
||||
callbackInfos = new List<ThreadWatchdogInfo>();
|
||||
|
||||
callbackInfos.Add(threadInfo);
|
||||
}
|
||||
else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
|
||||
{
|
||||
threadInfo.IsTimedOut = true;
|
||||
timedOut = threadInfo;
|
||||
break;
|
||||
|
||||
if (threadInfo.AlarmIfTimeout)
|
||||
{
|
||||
if (callbackInfos == null)
|
||||
callbackInfos = new List<ThreadWatchdogInfo>();
|
||||
|
||||
callbackInfos.Add(threadInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (timedOut != null)
|
||||
callback(timedOut.Thread, timedOut.LastTick);
|
||||
if (callbackInfos != null)
|
||||
foreach (ThreadWatchdogInfo callbackInfo in callbackInfos)
|
||||
callback(callbackInfo.Thread, callbackInfo.LastTick);
|
||||
}
|
||||
|
||||
m_watchdogTimer.Start();
|
||||
|
||||
@@ -244,8 +244,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
base.Start(m_recvBufferSize, m_asyncPacketHandling);
|
||||
|
||||
// Start the packet processing threads
|
||||
Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
|
||||
Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
|
||||
Watchdog.StartThread(
|
||||
IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
|
||||
Watchdog.StartThread(
|
||||
OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true);
|
||||
|
||||
m_elapsedMSSinceLastStatReport = Environment.TickCount;
|
||||
}
|
||||
|
||||
@@ -903,47 +906,64 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
private void HandleUseCircuitCode(object o)
|
||||
{
|
||||
// DateTime startTime = DateTime.Now;
|
||||
object[] array = (object[])o;
|
||||
UDPPacketBuffer buffer = (UDPPacketBuffer)array[0];
|
||||
UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1];
|
||||
IPEndPoint remoteEndPoint = null;
|
||||
IClientAPI client = null;
|
||||
|
||||
try
|
||||
{
|
||||
// DateTime startTime = DateTime.Now;
|
||||
object[] array = (object[])o;
|
||||
UDPPacketBuffer buffer = (UDPPacketBuffer)array[0];
|
||||
UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1];
|
||||
|
||||
m_log.DebugFormat("[LLUDPSERVER]: Handling UseCircuitCode request from {0}", buffer.RemoteEndPoint);
|
||||
|
||||
remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint;
|
||||
|
||||
AuthenticateResponse sessionInfo;
|
||||
if (IsClientAuthorized(uccp, out sessionInfo))
|
||||
{
|
||||
// Begin the process of adding the client to the simulator
|
||||
client
|
||||
= AddClient(
|
||||
uccp.CircuitCode.Code,
|
||||
uccp.CircuitCode.ID,
|
||||
uccp.CircuitCode.SessionID,
|
||||
remoteEndPoint,
|
||||
sessionInfo);
|
||||
|
||||
m_log.DebugFormat("[LLUDPSERVER]: Handling UseCircuitCode request from {0}", buffer.RemoteEndPoint);
|
||||
// Send ack straight away to let the viewer know that the connection is active.
|
||||
// The client will be null if it already exists (e.g. if on a region crossing the client sends a use
|
||||
// circuit code to the existing child agent. This is not particularly obvious.
|
||||
SendAckImmediate(remoteEndPoint, uccp.Header.Sequence);
|
||||
|
||||
// We only want to send initial data to new clients, not ones which are being converted from child to root.
|
||||
if (client != null)
|
||||
client.SceneAgent.SendInitialDataToMe();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't create clients for unauthorized requesters.
|
||||
m_log.WarnFormat(
|
||||
"[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}",
|
||||
uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
|
||||
// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
|
||||
|
||||
IPEndPoint remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint;
|
||||
|
||||
AuthenticateResponse sessionInfo;
|
||||
if (IsClientAuthorized(uccp, out sessionInfo))
|
||||
{
|
||||
// Begin the process of adding the client to the simulator
|
||||
IClientAPI client
|
||||
= AddClient(
|
||||
uccp.CircuitCode.Code,
|
||||
uccp.CircuitCode.ID,
|
||||
uccp.CircuitCode.SessionID,
|
||||
remoteEndPoint,
|
||||
sessionInfo);
|
||||
|
||||
// Send ack straight away to let the viewer know that the connection is active.
|
||||
// The client will be null if it already exists (e.g. if on a region crossing the client sends a use
|
||||
// circuit code to the existing child agent. This is not particularly obvious.
|
||||
SendAckImmediate(remoteEndPoint, uccp.Header.Sequence);
|
||||
|
||||
// We only want to send initial data to new clients, not ones which are being converted from child to root.
|
||||
if (client != null)
|
||||
client.SceneAgent.SendInitialDataToMe();
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
// Don't create clients for unauthorized requesters.
|
||||
m_log.WarnFormat(
|
||||
"[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}",
|
||||
uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint);
|
||||
m_log.ErrorFormat(
|
||||
"[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}",
|
||||
remoteEndPoint != null ? remoteEndPoint.ToString() : "n/a",
|
||||
client != null ? client.Name : "unknown",
|
||||
client != null ? client.AgentId.ToString() : "unknown",
|
||||
e.Message,
|
||||
e.StackTrace);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
|
||||
// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -111,6 +111,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
|
||||
#region IAvatarFactoryModule
|
||||
|
||||
/// </summary>
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="texture"></param>
|
||||
/// <param name="visualParam"></param>
|
||||
public void SetAppearance(IScenePresence sp, AvatarAppearance appearance)
|
||||
{
|
||||
SetAppearance(sp, appearance.Texture, appearance.VisualParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set appearance data (texture asset IDs and slider settings)
|
||||
/// </summary>
|
||||
@@ -156,14 +165,23 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
|
||||
|
||||
// WriteBakedTexturesReport(sp, m_log.DebugFormat);
|
||||
if (!ValidateBakedTextureCache(sp))
|
||||
|
||||
// If bake textures are missing and this is not an NPC, request a rebake from client
|
||||
if (!ValidateBakedTextureCache(sp) && (((ScenePresence)sp).PresenceType != PresenceType.Npc))
|
||||
RequestRebake(sp, true);
|
||||
|
||||
// This appears to be set only in the final stage of the appearance
|
||||
// update transaction. In theory, we should be able to do an immediate
|
||||
// appearance send and save here.
|
||||
}
|
||||
|
||||
|
||||
// NPC should send to clients immediately and skip saving appearance
|
||||
if (((ScenePresence)sp).PresenceType == PresenceType.Npc)
|
||||
{
|
||||
SendAppearance((ScenePresence)sp);
|
||||
return;
|
||||
}
|
||||
|
||||
// save only if there were changes, send no matter what (doesn't hurt to send twice)
|
||||
if (changed)
|
||||
QueueAppearanceSave(sp.ControllingClient.AgentId);
|
||||
@@ -174,6 +192,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
// m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString());
|
||||
}
|
||||
|
||||
private void SendAppearance(ScenePresence sp)
|
||||
{
|
||||
// Send the appearance to everyone in the scene
|
||||
sp.SendAppearanceToAllOtherAgents();
|
||||
|
||||
// Send animations back to the avatar as well
|
||||
sp.Animator.SendAnimPack();
|
||||
}
|
||||
|
||||
public bool SendAppearance(UUID agentId)
|
||||
{
|
||||
// m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId);
|
||||
@@ -185,12 +212,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
return false;
|
||||
}
|
||||
|
||||
// Send the appearance to everyone in the scene
|
||||
sp.SendAppearanceToAllOtherAgents();
|
||||
|
||||
// Send animations back to the avatar as well
|
||||
sp.Animator.SendAnimPack();
|
||||
|
||||
SendAppearance(sp);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -474,6 +496,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
SetAppearanceAssets(sp.UUID, sp.Appearance);
|
||||
|
||||
m_scene.AvatarService.SetAppearance(agentid, sp.Appearance);
|
||||
|
||||
// Trigger this here because it's the final step in the set/queue/save process for appearance setting.
|
||||
// Everything has been updated and stored. Ensures bakes have been persisted (if option is set to persist bakes).
|
||||
m_scene.EventManager.TriggerAvatarAppearanceChanged(sp);
|
||||
}
|
||||
|
||||
private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance)
|
||||
@@ -626,4 +652,4 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
outputAction("{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -349,8 +349,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
{
|
||||
try
|
||||
{
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
|
||||
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||
OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
|
||||
|
||||
@@ -412,7 +410,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
|
||||
if (options.ContainsKey("home"))
|
||||
m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR");
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -994,6 +994,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
neighbourRegion.RegionHandle);
|
||||
return agent;
|
||||
}
|
||||
// No turning back
|
||||
agent.IsChildAgent = true;
|
||||
|
||||
string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
|
||||
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
|
||||
@@ -1138,7 +1141,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
/// <summary>
|
||||
/// This informs all neighbouring regions about agent "avatar".
|
||||
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
|
||||
/// </summary>
|
||||
/// <param name="sp"></param>
|
||||
public void EnableChildAgents(ScenePresence sp)
|
||||
@@ -1258,12 +1260,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle)
|
||||
{
|
||||
InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
|
||||
try
|
||||
{
|
||||
d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent,
|
||||
InformClientOfNeighbourCompleted,
|
||||
d);
|
||||
// Let's put this back at sync, so that it doesn't clog
|
||||
// the network, especially for regions in the same physical server.
|
||||
// We're really not in a hurry here.
|
||||
InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent);
|
||||
//InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
|
||||
//d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent,
|
||||
// InformClientOfNeighbourCompleted,
|
||||
// d);
|
||||
}
|
||||
|
||||
catch (ArgumentOutOfRangeException)
|
||||
@@ -1698,14 +1704,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
// Offset the positions for the new region across the border
|
||||
Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
|
||||
grp.RootPart.GroupPosition = pos;
|
||||
|
||||
// If we fail to cross the border, then reset the position of the scene object on that border.
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(newRegionHandle, out x, out y);
|
||||
GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
if (destination == null || !CrossPrimGroupIntoNewRegion(destination, grp, silent))
|
||||
if (destination == null || !CrossPrimGroupIntoNewRegion(destination, pos, grp, silent))
|
||||
{
|
||||
m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID);
|
||||
|
||||
@@ -1735,7 +1740,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
/// true if the crossing itself was successful, false on failure
|
||||
/// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region
|
||||
/// </returns>
|
||||
protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, SceneObjectGroup grp, bool silent)
|
||||
protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent)
|
||||
{
|
||||
//m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<");
|
||||
|
||||
@@ -1760,7 +1765,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
//if (m_interregionCommsOut != null)
|
||||
// successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
|
||||
if (m_aScene.SimulationService != null)
|
||||
successYN = m_aScene.SimulationService.CreateObject(destination, grp, true);
|
||||
successYN = m_aScene.SimulationService.CreateObject(destination, newPosition, grp, true);
|
||||
|
||||
if (successYN)
|
||||
{
|
||||
@@ -1819,7 +1824,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
gobj.IsAttachment = false;
|
||||
//gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
|
||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
|
||||
CrossPrimGroupIntoNewRegion(destination, gobj, silent);
|
||||
CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, gobj, silent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -551,9 +551,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
// "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is {1} {2}",
|
||||
// action, remoteClient.Name, userID);
|
||||
}
|
||||
else if (so.RootPart.OwnerID == so.RootPart.GroupID)
|
||||
{
|
||||
// Group owned objects go to the last owner before the object was transferred.
|
||||
userID = so.RootPart.LastOwnerID;
|
||||
}
|
||||
else
|
||||
{
|
||||
// All returns / deletes go to the object owner
|
||||
// Other returns / deletes go to the object owner
|
||||
//
|
||||
userID = so.RootPart.OwnerID;
|
||||
|
||||
|
||||
@@ -1210,7 +1210,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
|
||||
if (homeScene.TryGetScenePresence(avatarId,out avatar))
|
||||
{
|
||||
KillAUser ku = new KillAUser(avatar,mod);
|
||||
Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true);
|
||||
Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,13 +65,26 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
}
|
||||
}
|
||||
|
||||
internal struct ScopedRegionPosition
|
||||
{
|
||||
public UUID m_scopeID;
|
||||
public ulong m_regionHandle;
|
||||
public ScopedRegionPosition(UUID scopeID, ulong handle)
|
||||
{
|
||||
m_scopeID = scopeID;
|
||||
m_regionHandle = handle;
|
||||
}
|
||||
}
|
||||
|
||||
private ExpiringCache<ScopedRegionUUID, GridRegion> m_UUIDCache;
|
||||
private ExpiringCache<ScopedRegionName, ScopedRegionUUID> m_NameCache;
|
||||
private ExpiringCache<ScopedRegionPosition, GridRegion> m_PositionCache;
|
||||
|
||||
public RegionInfoCache()
|
||||
{
|
||||
m_UUIDCache = new ExpiringCache<ScopedRegionUUID, GridRegion>();
|
||||
m_NameCache = new ExpiringCache<ScopedRegionName, ScopedRegionUUID>();
|
||||
m_NameCache = new ExpiringCache<ScopedRegionName, ScopedRegionUUID>();
|
||||
m_PositionCache = new ExpiringCache<ScopedRegionPosition, GridRegion>();
|
||||
}
|
||||
|
||||
public void Cache(GridRegion rinfo)
|
||||
@@ -96,6 +109,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
{
|
||||
ScopedRegionName name = new ScopedRegionName(scopeID,rinfo.RegionName);
|
||||
m_NameCache.AddOrUpdate(name, id, CACHE_EXPIRATION_SECONDS);
|
||||
|
||||
ScopedRegionPosition pos = new ScopedRegionPosition(scopeID, rinfo.RegionHandle);
|
||||
m_PositionCache.AddOrUpdate(pos, rinfo, CACHE_EXPIRATION_SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +130,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
return null;
|
||||
}
|
||||
|
||||
public GridRegion Get(UUID scopeID, ulong handle, out bool inCache)
|
||||
{
|
||||
inCache = false;
|
||||
|
||||
GridRegion rinfo = null;
|
||||
ScopedRegionPosition pos = new ScopedRegionPosition(scopeID, handle);
|
||||
if (m_PositionCache.TryGetValue(pos, out rinfo))
|
||||
{
|
||||
inCache = true;
|
||||
return rinfo;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public GridRegion Get(UUID scopeID, string name, out bool inCache)
|
||||
{
|
||||
inCache = false;
|
||||
|
||||
@@ -186,10 +186,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
|
||||
public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
|
||||
{
|
||||
GridRegion rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y);
|
||||
bool inCache = false;
|
||||
GridRegion rinfo = m_RegionInfoCache.Get(scopeID, Util.UIntsToLong((uint)x, (uint)y), out inCache);
|
||||
if (inCache)
|
||||
return rinfo;
|
||||
|
||||
rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y);
|
||||
if (rinfo == null)
|
||||
rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y);
|
||||
|
||||
m_RegionInfoCache.Cache(rinfo);
|
||||
return rinfo;
|
||||
}
|
||||
|
||||
|
||||
@@ -315,7 +315,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
* Object-related communications
|
||||
*/
|
||||
|
||||
public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
|
||||
public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
|
||||
{
|
||||
if (destination == null)
|
||||
return false;
|
||||
@@ -330,12 +330,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
// We need to make a local copy of the object
|
||||
ISceneObject sogClone = sog.CloneForNewScene();
|
||||
sogClone.SetState(sog.GetStateSnapshot(), s);
|
||||
return s.IncomingCreateObject(sogClone);
|
||||
return s.IncomingCreateObject(newPosition, sogClone);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the object as it came through the wire
|
||||
return s.IncomingCreateObject(sog);
|
||||
return s.IncomingCreateObject(newPosition, sog);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,13 +282,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
* Object-related communications
|
||||
*/
|
||||
|
||||
public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
|
||||
public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
|
||||
{
|
||||
if (destination == null)
|
||||
return false;
|
||||
|
||||
// Try local first
|
||||
if (m_localBackend.CreateObject(destination, sog, isLocalCall))
|
||||
if (m_localBackend.CreateObject(destination, newPosition, sog, isLocalCall))
|
||||
{
|
||||
//m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded");
|
||||
return true;
|
||||
@@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
|
||||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
|
||||
return m_remoteConnector.CreateObject(destination, sog, isLocalCall);
|
||||
return m_remoteConnector.CreateObject(destination, newPosition, sog, isLocalCall);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -94,8 +94,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
// caches ExtendedLandData
|
||||
private Cache parcelInfoCache;
|
||||
private Dictionary<UUID, Vector3> forcedPosition =
|
||||
new Dictionary<UUID, Vector3>();
|
||||
|
||||
/// <summary>
|
||||
/// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions.
|
||||
/// </summary>
|
||||
private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>();
|
||||
|
||||
#region INonSharedRegionModule Members
|
||||
|
||||
@@ -224,22 +227,34 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
//When the avatar walks into a ban line on the ground, it prevents getting stuck
|
||||
agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
|
||||
|
||||
|
||||
//Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines
|
||||
if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2)
|
||||
{
|
||||
Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition));
|
||||
// m_log.DebugFormat(
|
||||
// "[LAND MANAGEMENT MODULE]: Stopping force position of {0} because {1} is close enough to {2}",
|
||||
// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]);
|
||||
|
||||
forcedPosition.Remove(remoteClient.AgentId);
|
||||
}
|
||||
//if we are far away, teleport
|
||||
else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3)
|
||||
{
|
||||
Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition));
|
||||
clientAvatar.Teleport(forcedPosition[remoteClient.AgentId]);
|
||||
Vector3 forcePosition = forcedPosition[remoteClient.AgentId];
|
||||
// m_log.DebugFormat(
|
||||
// "[LAND MANAGEMENT MODULE]: Teleporting out {0} because {1} is too far from avatar position {2}",
|
||||
// clientAvatar.Name, clientAvatar.AbsolutePosition, forcePosition);
|
||||
|
||||
m_scene.RequestTeleportLocation(remoteClient, m_scene.RegionInfo.RegionHandle,
|
||||
forcePosition, clientAvatar.Lookat, (uint)Constants.TeleportFlags.ForceRedirect);
|
||||
|
||||
forcedPosition.Remove(remoteClient.AgentId);
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[LAND MANAGEMENT MODULE]: Forcing {0} from {1} to {2}",
|
||||
// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]);
|
||||
|
||||
//Forces them toward the forced position we want if they aren't there yet
|
||||
agentData.UseClientAgentPosition = true;
|
||||
agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId];
|
||||
|
||||
@@ -272,7 +272,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
ParcelFlags.AllowGroupScripts |
|
||||
ParcelFlags.CreateGroupObjects |
|
||||
ParcelFlags.AllowAPrimitiveEntry |
|
||||
ParcelFlags.AllowGroupObjectEntry);
|
||||
ParcelFlags.AllowGroupObjectEntry |
|
||||
ParcelFlags.AllowFly);
|
||||
}
|
||||
|
||||
if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale))
|
||||
@@ -447,8 +448,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
public bool IsRestrictedFromLand(UUID avatar)
|
||||
{
|
||||
ExpireAccessList();
|
||||
|
||||
if (m_scene.Permissions.IsAdministrator(avatar))
|
||||
return false;
|
||||
|
||||
@@ -458,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
|
||||
@@ -677,18 +681,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
bool permission = false;
|
||||
bool locked = false;
|
||||
|
||||
if (!m_scene.Entities.ContainsKey(objId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(objId);
|
||||
|
||||
// If it's not an object, we cant edit it.
|
||||
if ((!(m_scene.Entities[objId] is SceneObjectGroup)))
|
||||
{
|
||||
if (part == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId];
|
||||
SceneObjectGroup group = part.ParentGroup;
|
||||
|
||||
UUID objectOwner = group.OwnerID;
|
||||
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
|
||||
@@ -707,7 +705,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
// Object owners should be able to edit their own content
|
||||
if (currentUser == objectOwner)
|
||||
{
|
||||
permission = true;
|
||||
// there is no way that later code can change this back to false
|
||||
// so just return true immediately and short circuit the more
|
||||
// expensive group checks
|
||||
return true;
|
||||
|
||||
//permission = true;
|
||||
}
|
||||
else if (group.IsAttachment)
|
||||
{
|
||||
@@ -825,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;
|
||||
}
|
||||
|
||||
@@ -972,16 +979,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
|
||||
|
||||
// If we selected a sub-prim to edit, the objectID won't represent the object, but only a part.
|
||||
// We have to check the permissions of the group, though.
|
||||
if (part.ParentID != 0)
|
||||
{
|
||||
objectID = part.ParentUUID;
|
||||
part = m_scene.GetSceneObjectPart(objectID);
|
||||
}
|
||||
|
||||
return GenericObjectPermission(editorID, objectID, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -148,6 +148,113 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
|
||||
<OtherParts />
|
||||
</SceneObjectGroup>";
|
||||
|
||||
private string badFloatsXml = @"
|
||||
<SceneObjectGroup>
|
||||
<RootPart>
|
||||
<SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
|
||||
<AllowedDrop>false</AllowedDrop>
|
||||
<CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID>
|
||||
<FolderID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></FolderID>
|
||||
<InventorySerial>1</InventorySerial>
|
||||
<TaskInventory />
|
||||
<ObjectFlags>0</ObjectFlags>
|
||||
<UUID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></UUID>
|
||||
<LocalId>2698615125</LocalId>
|
||||
<Name>NaughtyPrim</Name>
|
||||
<Material>0</Material>
|
||||
<PassTouches>false</PassTouches>
|
||||
<RegionHandle>1099511628032000</RegionHandle>
|
||||
<ScriptAccessPin>0</ScriptAccessPin>
|
||||
<GroupPosition><X>147.23</X><Y>92.698</Y><Z>22.78084</Z></GroupPosition>
|
||||
<OffsetPosition><X>0</X><Y>0</Y><Z>0</Z></OffsetPosition>
|
||||
<RotationOffset><X>-4.371139E-08</X><Y>-1</Y><Z>-4.371139E-08</Z><W>0</W></RotationOffset>
|
||||
<Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity>
|
||||
<RotationalVelocity><X>0</X><Y>0</Y><Z>0</Z></RotationalVelocity>
|
||||
<AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity>
|
||||
<Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration>
|
||||
<Description />
|
||||
<Color />
|
||||
<Text />
|
||||
<SitName />
|
||||
<TouchName />
|
||||
<LinkNum>0</LinkNum>
|
||||
<ClickAction>0</ClickAction>
|
||||
<Shape>
|
||||
<ProfileCurve>1</ProfileCurve>
|
||||
<TextureEntry>AAAAAAAAERGZmQAAAAAABQCVlZUAAAAAQEAAAABAQAAAAAAAAAAAAAAAAAAAAA==</TextureEntry>
|
||||
<ExtraParams>AA==</ExtraParams>
|
||||
<PathBegin>0</PathBegin>
|
||||
<PathCurve>16</PathCurve>
|
||||
<PathEnd>0</PathEnd>
|
||||
<PathRadiusOffset>0</PathRadiusOffset>
|
||||
<PathRevolutions>0</PathRevolutions>
|
||||
<PathScaleX>100</PathScaleX>
|
||||
<PathScaleY>100</PathScaleY>
|
||||
<PathShearX>0</PathShearX>
|
||||
<PathShearY>0</PathShearY>
|
||||
<PathSkew>0</PathSkew>
|
||||
<PathTaperX>0</PathTaperX>
|
||||
<PathTaperY>0</PathTaperY>
|
||||
<PathTwist>0</PathTwist>
|
||||
<PathTwistBegin>0</PathTwistBegin>
|
||||
<PCode>9</PCode>
|
||||
<ProfileBegin>0</ProfileBegin>
|
||||
<ProfileEnd>0</ProfileEnd>
|
||||
<ProfileHollow>0</ProfileHollow>
|
||||
<Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale>
|
||||
<State>0</State>
|
||||
<ProfileShape>Square</ProfileShape>
|
||||
<HollowShape>Same</HollowShape>
|
||||
<SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture>
|
||||
<SculptType>0</SculptType><SculptData />
|
||||
<FlexiSoftness>0</FlexiSoftness>
|
||||
<FlexiTension>0,5</FlexiTension>
|
||||
<FlexiDrag>yo mamma</FlexiDrag>
|
||||
<FlexiGravity>0</FlexiGravity>
|
||||
<FlexiWind>0</FlexiWind>
|
||||
<FlexiForceX>0</FlexiForceX>
|
||||
<FlexiForceY>0</FlexiForceY>
|
||||
<FlexiForceZ>0</FlexiForceZ>
|
||||
<LightColorR>0</LightColorR>
|
||||
<LightColorG>0</LightColorG>
|
||||
<LightColorB>0</LightColorB>
|
||||
<LightColorA>1</LightColorA>
|
||||
<LightRadius>0</LightRadius>
|
||||
<LightCutoff>0</LightCutoff>
|
||||
<LightFalloff>0</LightFalloff>
|
||||
<LightIntensity>1</LightIntensity>
|
||||
<FlexiEntry>false</FlexiEntry>
|
||||
<LightEntry>false</LightEntry>
|
||||
<SculptEntry>false</SculptEntry>
|
||||
</Shape>
|
||||
<Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale>
|
||||
<UpdateFlag>0</UpdateFlag>
|
||||
<SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation>
|
||||
<SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition>
|
||||
<SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL>
|
||||
<SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL>
|
||||
<ParentID>0</ParentID>
|
||||
<CreationDate>1211330445</CreationDate>
|
||||
<Category>0</Category>
|
||||
<SalePrice>0</SalePrice>
|
||||
<ObjectSaleType>0</ObjectSaleType>
|
||||
<OwnershipCost>0</OwnershipCost>
|
||||
<GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID>
|
||||
<OwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></OwnerID>
|
||||
<LastOwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></LastOwnerID>
|
||||
<BaseMask>2147483647</BaseMask>
|
||||
<OwnerMask>2147483647</OwnerMask>
|
||||
<GroupMask>0</GroupMask>
|
||||
<EveryoneMask>0</EveryoneMask>
|
||||
<NextOwnerMask>2147483647</NextOwnerMask>
|
||||
<Flags>None</Flags>
|
||||
<CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound>
|
||||
<CollisionSoundVolume>0</CollisionSoundVolume>
|
||||
</SceneObjectPart>
|
||||
</RootPart>
|
||||
<OtherParts />
|
||||
</SceneObjectGroup>";
|
||||
|
||||
private string xml2 = @"
|
||||
<SceneObjectGroup>
|
||||
<SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
|
||||
@@ -256,6 +363,32 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
|
||||
// TODO: Check other properties
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDeserializeBadFloatsXml()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(badFloatsXml);
|
||||
SceneObjectPart rootPart = so.RootPart;
|
||||
|
||||
Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
|
||||
Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
|
||||
Assert.That(rootPart.Name, Is.EqualTo("NaughtyPrim"));
|
||||
|
||||
// This terminates the deserialization earlier if couldn't be parsed.
|
||||
// TODO: Need to address this
|
||||
Assert.That(rootPart.GroupPosition.X, Is.EqualTo(147.23f));
|
||||
|
||||
Assert.That(rootPart.Shape.PathCurve, Is.EqualTo(16));
|
||||
|
||||
// Defaults for bad parses
|
||||
Assert.That(rootPart.Shape.FlexiTension, Is.EqualTo(0));
|
||||
Assert.That(rootPart.Shape.FlexiDrag, Is.EqualTo(0));
|
||||
|
||||
// TODO: Check other properties
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSerializeXml()
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -351,6 +351,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
process,
|
||||
string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName),
|
||||
ThreadPriority.BelowNormal,
|
||||
true,
|
||||
true);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
|
||||
public interface IAvatarFactoryModule
|
||||
{
|
||||
void SetAppearance(IScenePresence sp, AvatarAppearance appearance);
|
||||
void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -138,8 +138,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);
|
||||
|
||||
@@ -173,6 +176,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID);
|
||||
public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
|
||||
|
||||
public delegate void AvatarAppearanceChange(ScenePresence avatar);
|
||||
public event AvatarAppearanceChange OnAvatarAppearanceChange;
|
||||
|
||||
public event Action<ScenePresence> OnSignificantClientMovement;
|
||||
|
||||
public delegate void IncomingInstantMessage(GridInstantMessage message);
|
||||
@@ -184,10 +190,74 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public event ClientClosed OnClientClosed;
|
||||
|
||||
public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID);
|
||||
|
||||
/// <summary>
|
||||
/// This is fired when a scene object property that a script might be interested in (such as color, scale or
|
||||
/// inventory) changes. Only enough information is sent for the LSL changed event
|
||||
/// (see http://lslwiki.net/lslwiki/wakka.php?wakka=changed)
|
||||
/// 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;
|
||||
if (handlerNewScript != null)
|
||||
{
|
||||
foreach (NewScript d in handlerNewScript.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(clientID, part, itemID);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing. {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
if (handlerUpdateScript != null)
|
||||
{
|
||||
foreach (UpdateScript d in handlerUpdateScript.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(clientId, itemId, primId, isScriptRunning, newAssetID);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[EVENT MANAGER]: Delegate for TriggerUpdateScript failed - continuing. {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ScriptChangedEvent is fired when a scene object property that a script might be interested
|
||||
/// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event.
|
||||
/// This is not an indication that the script has changed (see OnUpdateScript for that).
|
||||
/// This event is sent to a script to tell it that some property changed on
|
||||
/// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed .
|
||||
/// </summary>
|
||||
public event ScriptChangedEvent OnScriptChangedEvent;
|
||||
public delegate void ScriptChangedEvent(uint localID, uint change);
|
||||
@@ -411,6 +481,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);
|
||||
@@ -1238,6 +1315,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerAvatarAppearanceChanged(ScenePresence avatar)
|
||||
{
|
||||
AvatarAppearanceChange handler = OnAvatarAppearanceChange;
|
||||
if (handler != null)
|
||||
{
|
||||
foreach (AvatarAppearanceChange d in handler.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d(avatar);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerIncomingInstantMessage(GridInstantMessage message)
|
||||
{
|
||||
IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage;
|
||||
|
||||
@@ -283,6 +283,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("Script saved", false);
|
||||
}
|
||||
|
||||
// Tell anyone managing scripts that a script has been reloaded/changed
|
||||
EventManager.TriggerUpdateScript(remoteClient.AgentId, itemId, primId, isScriptRunning, item.AssetID);
|
||||
|
||||
part.ParentGroup.ResumeScripts();
|
||||
return errors;
|
||||
}
|
||||
@@ -1151,8 +1155,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return;
|
||||
}
|
||||
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId);
|
||||
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
||||
if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
||||
{
|
||||
// If the item to be moved is no copy, we need to be able to
|
||||
// edit the prim.
|
||||
@@ -1207,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);
|
||||
@@ -1235,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();
|
||||
|
||||
@@ -1624,9 +1624,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// have state in inventory
|
||||
part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
|
||||
|
||||
// tell anyone watching that there is a new script in town
|
||||
EventManager.TriggerNewScript(agentID, part, copyID);
|
||||
|
||||
// m_log.InfoFormat("[PRIMINVENTORY]: " +
|
||||
// "Rezzed script {0} into prim local ID {1} for user {2}",
|
||||
// item.inventoryName, localID, remoteClient.Name);
|
||||
|
||||
part.ParentGroup.ResumeScripts();
|
||||
|
||||
return part;
|
||||
@@ -1707,6 +1711,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
part.Inventory.AddInventoryItem(taskItem, false);
|
||||
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
|
||||
|
||||
// tell anyone managing scripts that a new script exists
|
||||
EventManager.TriggerNewScript(agentID, part, taskItem.ItemID);
|
||||
|
||||
part.ParentGroup.ResumeScripts();
|
||||
|
||||
return part;
|
||||
@@ -1926,7 +1934,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
foreach (SceneObjectGroup g in deleteGroups)
|
||||
{
|
||||
AddReturn(g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return");
|
||||
AddReturn(g.OwnerID == g.GroupID ? g.LastOwnerID : g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,9 +203,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// TODO: Possibly stop other classes being able to manipulate this directly.
|
||||
private SceneGraph m_sceneGraph;
|
||||
private volatile int m_bordersLocked;
|
||||
// private int m_RestartTimerCounter;
|
||||
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
|
||||
// private int m_incrementsof15seconds;
|
||||
private volatile bool m_backingup;
|
||||
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
|
||||
private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
|
||||
@@ -213,14 +211,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
private bool m_physics_enabled = true;
|
||||
private bool m_scripts_enabled = true;
|
||||
private string m_defaultScriptEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Tick at which the last login occurred.
|
||||
/// </summary>
|
||||
private int m_LastLogin;
|
||||
|
||||
private Thread HeartbeatThread;
|
||||
private volatile bool shuttingdown;
|
||||
|
||||
private int m_lastUpdate;
|
||||
private bool m_firstHeartbeat = true;
|
||||
|
||||
private object m_deleting_scene_object = new object();
|
||||
// private int m_lastUpdate;
|
||||
// private bool m_firstHeartbeat = true;
|
||||
|
||||
private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
|
||||
private bool m_reprioritizationEnabled = true;
|
||||
@@ -797,7 +798,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
m_permissions = new ScenePermissions(this);
|
||||
|
||||
m_lastUpdate = Util.EnvironmentTickCount();
|
||||
// m_lastUpdate = Util.EnvironmentTickCount();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -864,16 +865,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
try
|
||||
{
|
||||
ForEachRootScenePresence(delegate(ScenePresence agent)
|
||||
{
|
||||
//agent.ControllingClient.new
|
||||
//this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
|
||||
{
|
||||
//agent.ControllingClient.new
|
||||
//this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
|
||||
|
||||
List<ulong> old = new List<ulong>();
|
||||
old.Add(otherRegion.RegionHandle);
|
||||
agent.DropOldNeighbours(old);
|
||||
if (m_teleportModule != null)
|
||||
m_teleportModule.EnableChildAgent(agent, otherRegion);
|
||||
});
|
||||
List<ulong> old = new List<ulong>();
|
||||
old.Add(otherRegion.RegionHandle);
|
||||
agent.DropOldNeighbours(old);
|
||||
if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc)
|
||||
m_teleportModule.EnableChildAgent(agent, otherRegion);
|
||||
});
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
@@ -881,7 +882,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// This shouldn't happen too often anymore.
|
||||
m_log.Error("[SCENE]: Couldn't inform client of regionup because we got a null reference exception");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1009,10 +1009,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
try
|
||||
{
|
||||
ForEachRootScenePresence(delegate(ScenePresence agent)
|
||||
{
|
||||
if (m_teleportModule != null)
|
||||
m_teleportModule.EnableChildAgent(agent, r);
|
||||
});
|
||||
{
|
||||
if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc)
|
||||
m_teleportModule.EnableChildAgent(agent, r);
|
||||
});
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
@@ -1137,11 +1137,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
HeartbeatThread.Abort();
|
||||
HeartbeatThread = null;
|
||||
}
|
||||
m_lastUpdate = Util.EnvironmentTickCount();
|
||||
// m_lastUpdate = Util.EnvironmentTickCount();
|
||||
|
||||
HeartbeatThread
|
||||
= Watchdog.StartThread(
|
||||
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false);
|
||||
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1179,11 +1179,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
try
|
||||
{
|
||||
m_eventManager.TriggerOnRegionStarted(this);
|
||||
|
||||
// The first frame can take a very long time due to physics actors being added on startup. Therefore,
|
||||
// don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
|
||||
// alarms for scenes with many objects.
|
||||
Update();
|
||||
Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
|
||||
|
||||
while (!shuttingdown)
|
||||
Update();
|
||||
|
||||
m_lastUpdate = Util.EnvironmentTickCount();
|
||||
m_firstHeartbeat = false;
|
||||
// m_lastUpdate = Util.EnvironmentTickCount();
|
||||
// m_firstHeartbeat = false;
|
||||
}
|
||||
catch (ThreadAbortException)
|
||||
{
|
||||
@@ -1207,7 +1214,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
++Frame;
|
||||
|
||||
// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame);
|
||||
// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1362,26 +1369,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (AccessViolationException e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[REGION]: Failed on region {0} with exception {1}{2}",
|
||||
RegionInfo.RegionName, e.Message, e.StackTrace);
|
||||
}
|
||||
//catch (NullReferenceException e)
|
||||
//{
|
||||
// m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
|
||||
//}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[REGION]: Failed on region {0} with exception {1}{2}",
|
||||
RegionInfo.RegionName, e.Message, e.StackTrace);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[REGION]: Failed on region {0} with exception {1}{2}",
|
||||
"[SCENE]: Failed on region {0} with exception {1}{2}",
|
||||
RegionInfo.RegionName, e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
@@ -1419,7 +1410,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
entry.checkAtTargets();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send out simstats data to all clients
|
||||
/// </summary>
|
||||
@@ -1594,8 +1584,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);
|
||||
}
|
||||
@@ -2010,15 +2007,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;
|
||||
|
||||
@@ -2318,7 +2308,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
/// <param name="sog"></param>
|
||||
/// <returns></returns>
|
||||
public bool IncomingCreateObject(ISceneObject sog)
|
||||
public bool IncomingCreateObject(Vector3 newPosition, ISceneObject sog)
|
||||
{
|
||||
//m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition,
|
||||
// ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment);
|
||||
@@ -2334,6 +2324,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return false;
|
||||
}
|
||||
|
||||
if (newPosition != Vector3.Zero)
|
||||
newObject.RootPart.GroupPosition = newPosition;
|
||||
|
||||
if (!AddSceneObject(newObject))
|
||||
{
|
||||
m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
|
||||
@@ -2497,7 +2490,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
= (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0
|
||||
|| (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
|
||||
|
||||
CheckHeartbeat();
|
||||
// CheckHeartbeat();
|
||||
|
||||
ScenePresence sp = GetScenePresence(client.AgentId);
|
||||
|
||||
@@ -3075,7 +3068,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public override void RemoveClient(UUID agentID, bool closeChildAgents)
|
||||
{
|
||||
CheckHeartbeat();
|
||||
// CheckHeartbeat();
|
||||
bool isChildAgent = false;
|
||||
ScenePresence avatar = GetScenePresence(agentID);
|
||||
if (avatar != null)
|
||||
@@ -3259,8 +3252,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// also return a reason.</returns>
|
||||
public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup)
|
||||
{
|
||||
bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
|
||||
(teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
|
||||
bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 ||
|
||||
(teleportFlags & (uint)TPFlags.ViaHGLogin) != 0);
|
||||
bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0);
|
||||
bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0);
|
||||
|
||||
reason = String.Empty;
|
||||
|
||||
//Teleport flags:
|
||||
@@ -3272,9 +3268,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// Don't disable this log message - it's too helpful
|
||||
m_log.DebugFormat(
|
||||
"[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6}, position {7})",
|
||||
RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
|
||||
agent.AgentID, agent.circuitcode, teleportFlags, agent.startpos);
|
||||
"[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})",
|
||||
RegionInfo.RegionName, (agent.child ? "child" : "root"),agent.firstname, agent.lastname,
|
||||
agent.AgentID, agent.circuitcode, agent.IPAddress, agent.Viewer, ((TPFlags)teleportFlags).ToString(), agent.startpos);
|
||||
|
||||
if (LoginsDisabled)
|
||||
{
|
||||
@@ -3427,6 +3423,29 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
agent.startpos.Z = 720;
|
||||
}
|
||||
}
|
||||
|
||||
// Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags
|
||||
if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero &&
|
||||
RegionInfo.EstateSettings.AllowDirectTeleport == false &&
|
||||
!viahome && !godlike)
|
||||
{
|
||||
SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject);
|
||||
// Can have multiple SpawnPoints
|
||||
List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints();
|
||||
if ( spawnpoints.Count > 1)
|
||||
{
|
||||
// We have multiple SpawnPoints, Route the agent to a random one
|
||||
agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count)].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We have a single SpawnPoint and will route the agent to it
|
||||
agent.startpos = spawnpoints[0].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Honor parcel landing type and position.
|
||||
if (land != null)
|
||||
{
|
||||
@@ -3522,8 +3541,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;
|
||||
}
|
||||
@@ -4232,10 +4251,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="action"></param>
|
||||
public void ForEachRootScenePresence(Action<ScenePresence> action)
|
||||
{
|
||||
if (m_sceneGraph != null)
|
||||
{
|
||||
m_sceneGraph.ForEachAvatar(action);
|
||||
}
|
||||
m_sceneGraph.ForEachAvatar(action);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -4244,10 +4260,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="action"></param>
|
||||
public void ForEachScenePresence(Action<ScenePresence> action)
|
||||
{
|
||||
if (m_sceneGraph != null)
|
||||
{
|
||||
m_sceneGraph.ForEachScenePresence(action);
|
||||
}
|
||||
m_sceneGraph.ForEachScenePresence(action);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -4447,8 +4460,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
//
|
||||
int health=1; // Start at 1, means we're up
|
||||
|
||||
if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000)
|
||||
health+=1;
|
||||
if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000)
|
||||
health += 1;
|
||||
else
|
||||
return health;
|
||||
|
||||
@@ -4459,7 +4472,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
else
|
||||
return health;
|
||||
|
||||
CheckHeartbeat();
|
||||
// CheckHeartbeat();
|
||||
|
||||
return health;
|
||||
}
|
||||
@@ -4647,14 +4660,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z;
|
||||
}
|
||||
|
||||
private void CheckHeartbeat()
|
||||
{
|
||||
if (m_firstHeartbeat)
|
||||
return;
|
||||
|
||||
if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000)
|
||||
StartTimer();
|
||||
}
|
||||
// private void CheckHeartbeat()
|
||||
// {
|
||||
// if (m_firstHeartbeat)
|
||||
// return;
|
||||
//
|
||||
// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000)
|
||||
// StartTimer();
|
||||
// }
|
||||
|
||||
public override ISceneObject DeserializeObject(string representation)
|
||||
{
|
||||
@@ -4677,7 +4690,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
|
||||
if (nearestPoint != null)
|
||||
{
|
||||
Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString());
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}",
|
||||
// avatar.Name, nearestPoint, nearestParcel.LandData.Name);
|
||||
|
||||
return nearestPoint.Value;
|
||||
}
|
||||
|
||||
@@ -4687,12 +4703,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
|
||||
if (nearestPoint != null)
|
||||
{
|
||||
Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString());
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint);
|
||||
|
||||
return nearestPoint.Value;
|
||||
}
|
||||
|
||||
//Ultimate backup if we have no idea where they are
|
||||
Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString());
|
||||
//Ultimate backup if we have no idea where they are
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition);
|
||||
|
||||
return avatar.lastKnownAllowedPosition;
|
||||
}
|
||||
|
||||
@@ -5098,7 +5118,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget);
|
||||
|
||||
Vector3 agent_control_v3 = new Vector3();
|
||||
presence.HandleMoveToTargetUpdate(ref agent_control_v3);
|
||||
presence.HandleMoveToTargetUpdate(1, ref agent_control_v3);
|
||||
presence.AddNewMovement(agent_control_v3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,16 +156,21 @@ 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);
|
||||
if (! simulatorList.Contains(dest.ServerURI))
|
||||
|
||||
// bool v = true;
|
||||
if (!simulatorList.Contains(dest.ServerURI))
|
||||
{
|
||||
// we havent seen this simulator before, add it to the list
|
||||
// and send it an update
|
||||
simulatorList.Add(dest.ServerURI);
|
||||
// Let move this to sync. Mono definitely does not like async networking.
|
||||
m_scene.SimulationService.UpdateAgent(dest, cAgentData);
|
||||
|
||||
SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
|
||||
d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest,
|
||||
SendChildAgentDataUpdateCompleted,
|
||||
d);
|
||||
// Leaving this here as a reminder that we tried, and it sucks.
|
||||
//SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
|
||||
//d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest,
|
||||
// SendChildAgentDataUpdateCompleted,
|
||||
// d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_log.ErrorFormat(
|
||||
"[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}",
|
||||
sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -368,12 +368,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()",
|
||||
// m_parentScene.RegionInfo.RegionName, sceneObject.UUID);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
|
||||
// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
|
||||
// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName);
|
||||
|
||||
SceneObjectPart[] parts = sceneObject.Parts;
|
||||
@@ -409,7 +409,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
lock (SceneObjectGroupsByFullID)
|
||||
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
|
||||
|
||||
|
||||
lock (SceneObjectGroupsByFullPartID)
|
||||
{
|
||||
foreach (SceneObjectPart part in parts)
|
||||
@@ -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
|
||||
@@ -1592,7 +1563,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (group != null)
|
||||
{
|
||||
if (m_parentScene.Permissions.CanEditObject(group.UUID,agentID))
|
||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID))
|
||||
{
|
||||
group.UpdateExtraParam(primLocalID, type, inUse, data);
|
||||
}
|
||||
@@ -1609,7 +1580,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
||||
if (group != null)
|
||||
{
|
||||
if (m_parentScene.Permissions.CanEditObject(group.GetPartsFullID(primLocalID), agentID))
|
||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID))
|
||||
{
|
||||
ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock();
|
||||
shapeData.ObjectLocalID = shapeBlock.ObjectLocalID;
|
||||
|
||||
@@ -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)
|
||||
@@ -1330,7 +1323,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_log.DebugFormat(
|
||||
"[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn",
|
||||
RootPart.UUID);
|
||||
m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel autoreturn");
|
||||
m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn");
|
||||
m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero,
|
||||
DeRezAction.Return, UUID.Zero);
|
||||
|
||||
|
||||
@@ -303,6 +303,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// ~SceneObjectPart()
|
||||
// {
|
||||
// Console.WriteLine(
|
||||
// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}",
|
||||
// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId);
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}",
|
||||
// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId);
|
||||
@@ -1553,9 +1556,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
dupe.GroupPosition = GroupPosition;
|
||||
dupe.OffsetPosition = OffsetPosition;
|
||||
dupe.RotationOffset = RotationOffset;
|
||||
dupe.Velocity = new Vector3(0, 0, 0);
|
||||
dupe.Acceleration = new Vector3(0, 0, 0);
|
||||
dupe.AngularVelocity = new Vector3(0, 0, 0);
|
||||
dupe.Velocity = Velocity;
|
||||
dupe.Acceleration = Acceleration;
|
||||
dupe.AngularVelocity = AngularVelocity;
|
||||
dupe.Flags = Flags;
|
||||
|
||||
dupe.OwnershipCost = OwnershipCost;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -291,13 +291,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
public PhysicsActor PhysicsActor { get; private set; }
|
||||
|
||||
private byte m_movementflag;
|
||||
|
||||
public byte MovementFlag
|
||||
{
|
||||
set { m_movementflag = value; }
|
||||
get { return m_movementflag; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Record user movement inputs.
|
||||
/// </summary>
|
||||
public byte MovementFlag { get; private set; }
|
||||
|
||||
private bool m_updateflag;
|
||||
|
||||
@@ -1051,7 +1048,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Do not call this directly. Call Scene.RequestTeleportLocation() instead.
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
public void Teleport(Vector3 pos)
|
||||
@@ -1222,7 +1219,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
|
||||
if (m_agentTransfer != null)
|
||||
m_agentTransfer.EnableChildAgents(this);
|
||||
Util.FireAndForget(delegate { m_agentTransfer.EnableChildAgents(this); });
|
||||
|
||||
IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
||||
if (friendsModule != null)
|
||||
@@ -1525,7 +1522,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else if (bAllowUpdateMoveToPosition)
|
||||
{
|
||||
if (HandleMoveToTargetUpdate(ref agent_control_v3))
|
||||
// The UseClientAgentPosition is set if parcel ban is forcing the avatar to move to a
|
||||
// certain position. It's only check for tolerance on returning to that position is 0.2
|
||||
// rather than 1, at which point it removes its force target.
|
||||
if (HandleMoveToTargetUpdate(agentData.UseClientAgentPosition ? 0.2 : 1, ref agent_control_v3))
|
||||
update_movementflag = true;
|
||||
}
|
||||
}
|
||||
@@ -1587,7 +1587,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </remarks>
|
||||
/// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param>
|
||||
/// <returns>True if movement has been updated in some way. False otherwise.</returns>
|
||||
public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3)
|
||||
public bool HandleMoveToTargetUpdate(double tolerance, ref Vector3 agent_control_v3)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
|
||||
|
||||
@@ -1604,7 +1604,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget);
|
||||
|
||||
// Check the error term of the current position in relation to the target position
|
||||
if (distanceToTarget <= 1)
|
||||
if (distanceToTarget <= tolerance)
|
||||
{
|
||||
// We are close enough to the target
|
||||
AbsolutePosition = MoveToPositionTarget;
|
||||
@@ -1780,7 +1780,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation);
|
||||
|
||||
Vector3 agent_control_v3 = new Vector3();
|
||||
HandleMoveToTargetUpdate(ref agent_control_v3);
|
||||
HandleMoveToTargetUpdate(1, ref agent_control_v3);
|
||||
AddNewMovement(agent_control_v3);
|
||||
}
|
||||
|
||||
@@ -2741,7 +2741,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
AgentPosition agentpos = new AgentPosition();
|
||||
agentpos.CopyFrom(cadu);
|
||||
|
||||
m_scene.SendOutChildAgentUpdates(agentpos, this);
|
||||
// Let's get this out of the update loop
|
||||
Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3225,7 +3226,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
((SceneObjectGroup)so).LocalId = 0;
|
||||
((SceneObjectGroup)so).RootPart.ClearUpdateSchedule();
|
||||
so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
|
||||
m_scene.IncomingCreateObject(so);
|
||||
m_scene.IncomingCreateObject(Vector3.Zero, so);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
@@ -570,13 +571,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
|
||||
private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)
|
||||
{
|
||||
bool errors = false;
|
||||
obj.Shape = ReadShape(reader, "Shape", out errors);
|
||||
List<string> errorNodeNames;
|
||||
obj.Shape = ReadShape(reader, "Shape", out errorNodeNames);
|
||||
|
||||
if (errors)
|
||||
if (errorNodeNames != null)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors. Please see earlier log entries.",
|
||||
obj.Name, obj.UUID);
|
||||
"[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors in properties {2}.",
|
||||
obj.Name, obj.UUID, string.Join(", ", errorNodeNames.ToArray()));
|
||||
}
|
||||
}
|
||||
|
||||
private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader)
|
||||
@@ -1470,7 +1473,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
m_SOPXmlProcessors,
|
||||
reader,
|
||||
(o, nodeName, e)
|
||||
=> m_log.ErrorFormat(
|
||||
=> m_log.DebugFormat(
|
||||
"[SceneObjectSerializer]: Exception while parsing {0} in object {1} {2}: {3}{4}",
|
||||
((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID, nodeName, e.Message, e.StackTrace));
|
||||
|
||||
@@ -1519,17 +1522,18 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <param name="name">The name of the xml element containing the shape</param>
|
||||
/// <param name="errors">true if any errors were encountered during parsing, false otherwise</param>
|
||||
/// <param name="errors">a list containing the failing node names. If no failures then null.</param>
|
||||
/// <returns>The shape parsed</returns>
|
||||
public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out bool errors)
|
||||
public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out List<string> errorNodeNames)
|
||||
{
|
||||
errors = false;
|
||||
List<string> internalErrorNodeNames = null;
|
||||
|
||||
PrimitiveBaseShape shape = new PrimitiveBaseShape();
|
||||
|
||||
if (reader.IsEmptyElement)
|
||||
{
|
||||
reader.Read();
|
||||
errorNodeNames = null;
|
||||
return shape;
|
||||
}
|
||||
|
||||
@@ -1540,12 +1544,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
m_ShapeXmlProcessors,
|
||||
reader,
|
||||
(o, nodeName, e)
|
||||
=> m_log.ErrorFormat(
|
||||
"[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}",
|
||||
nodeName, e.Message, e.StackTrace));
|
||||
=>
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}",
|
||||
// nodeName, e.Message, e.StackTrace);
|
||||
if (internalErrorNodeNames == null)
|
||||
internalErrorNodeNames = new List<string>();
|
||||
|
||||
internalErrorNodeNames.Add(nodeName);
|
||||
}
|
||||
);
|
||||
|
||||
reader.ReadEndElement(); // Shape
|
||||
|
||||
errorNodeNames = internalErrorNodeNames;
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
@@ -43,6 +44,42 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
[TestFixture]
|
||||
public class SceneObjectBasicTests
|
||||
{
|
||||
// [TearDown]
|
||||
// public void TearDown()
|
||||
// {
|
||||
// Console.WriteLine("TearDown");
|
||||
// GC.Collect();
|
||||
// Thread.Sleep(3000);
|
||||
// }
|
||||
|
||||
// public class GcNotify
|
||||
// {
|
||||
// public static AutoResetEvent gcEvent = new AutoResetEvent(false);
|
||||
// private static bool _initialized = false;
|
||||
//
|
||||
// public static void Initialize()
|
||||
// {
|
||||
// if (!_initialized)
|
||||
// {
|
||||
// _initialized = true;
|
||||
// new GcNotify();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private GcNotify(){}
|
||||
//
|
||||
// ~GcNotify()
|
||||
// {
|
||||
// if (!Environment.HasShutdownStarted &&
|
||||
// !AppDomain.CurrentDomain.IsFinalizingForUnload())
|
||||
// {
|
||||
// Console.WriteLine("GcNotify called");
|
||||
// gcEvent.Set();
|
||||
// new GcNotify();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Test adding an object to a scene.
|
||||
/// </summary>
|
||||
@@ -147,11 +184,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
public void TestDeleteSceneObject()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
|
||||
TestScene scene = SceneHelpers.SetupScene();
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
|
||||
scene.DeleteSceneObject(part.ParentGroup, false);
|
||||
|
||||
|
||||
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
||||
Assert.That(retrievedPart, Is.Null);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||
m_client = client;
|
||||
m_scene = scene;
|
||||
|
||||
Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false);
|
||||
Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true);
|
||||
}
|
||||
|
||||
private void SendServerCommand(string command)
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||
|
||||
m_listener.Start(50);
|
||||
|
||||
Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false);
|
||||
Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true);
|
||||
m_baseScene = baseScene;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,9 +63,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
// Capability string prefixes
|
||||
private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
|
||||
private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
|
||||
private static readonly string m_chatSessionRequestPath = "0009/";
|
||||
private static readonly string m_parcelVoiceInfoRequestPath = "0207/";
|
||||
private static readonly string m_provisionVoiceAccountRequestPath = "0208/";
|
||||
private static readonly string m_chatSessionRequestPath = "0209/";
|
||||
|
||||
// Control info
|
||||
private static bool m_Enabled = false;
|
||||
|
||||
@@ -30,6 +30,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
||||
using Nwc.XmlRpc;
|
||||
|
||||
@@ -167,6 +168,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
|
||||
private bool m_debugEnabled = false;
|
||||
|
||||
private Dictionary<string, bool> m_pendingRequests = new Dictionary<string,bool>();
|
||||
|
||||
private ExpiringCache<string, OSDMap> m_memoryCache;
|
||||
private int m_cacheTimeout = 30;
|
||||
|
||||
@@ -1348,6 +1351,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
// Immediately forward the request if the cache is disabled.
|
||||
if (m_cacheTimeout == 0)
|
||||
{
|
||||
m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: cache is disabled");
|
||||
return WebUtil.PostToService(m_groupsServerURI, requestArgs);
|
||||
}
|
||||
|
||||
@@ -1355,6 +1359,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
if (requestArgs["RequestMethod"] == "RemoveGeneric"
|
||||
|| requestArgs["RequestMethod"] == "AddGeneric")
|
||||
{
|
||||
m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: clearing generics cache");
|
||||
|
||||
// Any and all updates cause the cache to clear
|
||||
m_memoryCache.Clear();
|
||||
|
||||
@@ -1366,18 +1372,67 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
|
||||
// Create the cache key for the request and see if we have it cached
|
||||
string CacheKey = WebUtil.BuildQueryString(requestArgs);
|
||||
OSDMap response = null;
|
||||
if (!m_memoryCache.TryGetValue(CacheKey, out response))
|
||||
{
|
||||
// if it wasn't in the cache, pass the request to the Simian Grid Services
|
||||
response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
|
||||
|
||||
// and cache the response
|
||||
m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout));
|
||||
// This code uses a leader/follower pattern. On a cache miss, the request is added
|
||||
// to a queue; the first thread to add it to the queue completes the request while
|
||||
// follow on threads busy wait for the results, this situation seems to happen
|
||||
// often when checking permissions
|
||||
while (true)
|
||||
{
|
||||
OSDMap response = null;
|
||||
bool firstRequest = false;
|
||||
|
||||
lock (m_memoryCache)
|
||||
{
|
||||
if (m_memoryCache.TryGetValue(CacheKey, out response))
|
||||
return response;
|
||||
|
||||
if (! m_pendingRequests.ContainsKey(CacheKey))
|
||||
{
|
||||
m_pendingRequests.Add(CacheKey,true);
|
||||
firstRequest = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (firstRequest)
|
||||
{
|
||||
// if it wasn't in the cache, pass the request to the Simian Grid Services
|
||||
try
|
||||
{
|
||||
response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[SIMIAN GROUPS CONNECTOR] request failed {0}",CacheKey);
|
||||
}
|
||||
|
||||
// and cache the response
|
||||
lock (m_memoryCache)
|
||||
{
|
||||
m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout));
|
||||
m_pendingRequests.Remove(CacheKey);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Thread.Sleep(50); // waiting for a web request to complete, 50msecs is reasonable
|
||||
}
|
||||
|
||||
// return cached response
|
||||
return response;
|
||||
// if (!m_memoryCache.TryGetValue(CacheKey, out response))
|
||||
// {
|
||||
// m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: query not in the cache");
|
||||
// Util.PrintCallStack();
|
||||
|
||||
// // if it wasn't in the cache, pass the request to the Simian Grid Services
|
||||
// response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
|
||||
|
||||
// // and cache the response
|
||||
// m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout));
|
||||
// }
|
||||
|
||||
// // return cached response
|
||||
// return response;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -230,8 +230,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
|
||||
|
||||
m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
|
||||
|
||||
m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
|
||||
m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
|
||||
// m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
|
||||
// m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
|
||||
|
||||
m_log.InfoFormat("[RegionReady]: Logins enabled for {0}", m_scene.RegionInfo.RegionName);
|
||||
|
||||
if ( m_uri != string.Empty )
|
||||
{
|
||||
|
||||
@@ -88,23 +88,27 @@ 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;
|
||||
|
||||
scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false);
|
||||
// Delete existing npc attachments
|
||||
scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false);
|
||||
|
||||
// XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments
|
||||
AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
|
||||
sp.Appearance = npcAppearance;
|
||||
scene.AttachmentsModule.RezAttachments(sp);
|
||||
npc.Appearance = npcAppearance;
|
||||
|
||||
// Rez needed npc attachments
|
||||
scene.AttachmentsModule.RezAttachments(npc);
|
||||
|
||||
IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>();
|
||||
module.SendAppearance(sp.UUID);
|
||||
|
||||
module.SendAppearance(npc.UUID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -121,8 +125,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[NPC MODULE]: Creating NPC {0} {1} {2} at {3} in {4}",
|
||||
firstname, lastname, npcAvatar.AgentId, position, scene.RegionInfo.RegionName);
|
||||
"[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
|
||||
firstname, lastname, npcAvatar.AgentId, owner, senseAsAgent, position, scene.RegionInfo.RegionName);
|
||||
|
||||
AgentCircuitData acd = new AgentCircuitData();
|
||||
acd.AgentID = npcAvatar.AgentId;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -51,6 +51,9 @@ public class BSPlugin : IPhysicsPlugin
|
||||
{
|
||||
if (_mScene == null)
|
||||
{
|
||||
if (Util.IsWindows())
|
||||
Util.LoadArchSpecificWindowsDll("BulletSim.dll");
|
||||
|
||||
_mScene = new BSScene(sceneIdentifier);
|
||||
}
|
||||
return (_mScene);
|
||||
|
||||
@@ -30,7 +30,8 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using log4net;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.Physics.Manager
|
||||
{
|
||||
|
||||
@@ -313,7 +313,7 @@ namespace OpenSim.Region.Physics.Meshing
|
||||
private bool GenerateCoordsAndFacesFromPrimMeshData(
|
||||
string primName, PrimitiveBaseShape primShape, Vector3 size, out List<Coord> coords, out List<Face> faces)
|
||||
{
|
||||
m_log.DebugFormat("[MESH]: experimental mesh proxy generation for {0}", primName);
|
||||
// m_log.DebugFormat("[MESH]: experimental mesh proxy generation for {0}", primName);
|
||||
|
||||
coords = new List<Coord>();
|
||||
faces = new List<Face>();
|
||||
@@ -321,7 +321,7 @@ namespace OpenSim.Region.Physics.Meshing
|
||||
|
||||
if (primShape.SculptData.Length <= 0)
|
||||
{
|
||||
m_log.Error("[MESH]: asset data is zero length");
|
||||
m_log.ErrorFormat("[MESH]: asset data for {0} is zero length", primName);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +156,22 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
internal UUID m_uuid { get; private set; }
|
||||
internal bool bad = false;
|
||||
|
||||
/// <summary>
|
||||
/// ODE Avatar.
|
||||
/// </summary>
|
||||
/// <param name="avName"></param>
|
||||
/// <param name="parent_scene"></param>
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="size"></param>
|
||||
/// <param name="pid_d"></param>
|
||||
/// <param name="pid_p"></param>
|
||||
/// <param name="capsule_radius"></param>
|
||||
/// <param name="tensor"></param>
|
||||
/// <param name="density">
|
||||
/// Only used right now to return information to LSL. Not actually used to set mass in ODE!
|
||||
/// </param>
|
||||
/// <param name="walk_divisor"></param>
|
||||
/// <param name="rundivisor"></param>
|
||||
public OdeCharacter(
|
||||
String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p,
|
||||
float capsule_radius, float tensor, float density,
|
||||
@@ -786,6 +802,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
Vector3 vec = Vector3.Zero;
|
||||
d.Vector3 vel = d.BodyGetLinearVel(Body);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[ODE CHARACTER]: Current velocity in Move() is <{0},{1},{2}>, target {3} for {4}",
|
||||
// vel.X, vel.Y, vel.Z, _target_velocity, Name);
|
||||
|
||||
float movementdivisor = 1f;
|
||||
|
||||
if (!m_alwaysRun)
|
||||
@@ -884,18 +904,20 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
|
||||
if (flying)
|
||||
{
|
||||
// This also acts as anti-gravity so that we hover when flying rather than fall.
|
||||
vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
|
||||
}
|
||||
}
|
||||
|
||||
if (flying)
|
||||
{
|
||||
// Anti-gravity so that we hover when flying rather than fall.
|
||||
vec.Z += ((-1 * _parent_scene.gravityz) * m_mass);
|
||||
|
||||
//Added for auto fly height. Kitto Flora
|
||||
//d.Vector3 pos = d.BodyGetPosition(Body);
|
||||
float target_altitude = _parent_scene.GetTerrainHeightAtXY(_position.X, _position.Y) + MinimumGroundFlightOffset;
|
||||
|
||||
|
||||
if (_position.Z < target_altitude)
|
||||
{
|
||||
vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f;
|
||||
@@ -921,6 +943,25 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
d.Vector3 newVel = d.BodyGetLinearVel(Body);
|
||||
if (newVel.X >= 256 || newVel.X <= 256 || newVel.Y >= 256 || newVel.Y <= 256 || newVel.Z >= 256 || newVel.Z <= 256)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ODE CHARACTER]: Limiting falling velocity from {0} to {1} for {2}", newVel.Z, -9.8, Name);
|
||||
|
||||
newVel.X = Util.Clamp<float>(newVel.X, -255f, 255f);
|
||||
newVel.Y = Util.Clamp<float>(newVel.Y, -255f, 255f);
|
||||
|
||||
if (!flying)
|
||||
newVel.Z
|
||||
= Util.Clamp<float>(
|
||||
newVel.Z, -_parent_scene.AvatarTerminalVelocity, _parent_scene.AvatarTerminalVelocity);
|
||||
else
|
||||
newVel.Z = Util.Clamp<float>(newVel.Z, -255f, 255f);
|
||||
|
||||
d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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);
|
||||
@@ -1474,6 +1480,8 @@ Console.WriteLine("CreateGeom:");
|
||||
/// </summary>
|
||||
private void changeadd()
|
||||
{
|
||||
// m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name);
|
||||
|
||||
int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
|
||||
IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
/// </summary>
|
||||
public class OdePlugin : IPhysicsPlugin
|
||||
{
|
||||
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private OdeScene m_scene;
|
||||
|
||||
@@ -59,13 +59,23 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
{
|
||||
if (m_scene == null)
|
||||
{
|
||||
// We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether
|
||||
// it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports
|
||||
// will find it already loaded later on.
|
||||
//
|
||||
// This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
|
||||
// controlled in Ode.NET.dll.config
|
||||
if (Util.IsWindows())
|
||||
Util.LoadArchSpecificWindowsDll("ode.dll");
|
||||
|
||||
// Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to
|
||||
// http://opensimulator.org/mantis/view.php?id=2750).
|
||||
d.InitODE();
|
||||
|
||||
m_scene = new OdeScene(sceneIdentifier);
|
||||
}
|
||||
return (m_scene);
|
||||
|
||||
return m_scene;
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
|
||||
@@ -144,6 +144,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
public float gravityy = 0f;
|
||||
public float gravityz = -9.8f;
|
||||
|
||||
public float AvatarTerminalVelocity { get; set; }
|
||||
|
||||
private float contactsurfacelayer = 0.001f;
|
||||
|
||||
private int worldHashspaceLow = -4;
|
||||
@@ -459,6 +461,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
gravityy = physicsconfig.GetFloat("world_gravityy", 0f);
|
||||
gravityz = physicsconfig.GetFloat("world_gravityz", -9.8f);
|
||||
|
||||
float avatarTerminalVelocity = physicsconfig.GetFloat("avatar_terminal_velocity", 54f);
|
||||
AvatarTerminalVelocity = Util.Clamp<float>(avatarTerminalVelocity, 0, 255f);
|
||||
if (AvatarTerminalVelocity != avatarTerminalVelocity)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[ODE SCENE]: avatar_terminal_velocity of {0} is invalid. Clamping to {1}",
|
||||
avatarTerminalVelocity, AvatarTerminalVelocity);
|
||||
}
|
||||
|
||||
worldHashspaceLow = physicsconfig.GetInt("world_hashspace_size_low", -4);
|
||||
worldHashspaceHigh = physicsconfig.GetInt("world_hashspace_size_high", 128);
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Information about this assembly is defined by the following
|
||||
// attributes.
|
||||
//
|
||||
// change them to the information which is associated with the assembly
|
||||
// you compile.
|
||||
|
||||
[assembly : AssemblyTitle("RealPhysXplugin")]
|
||||
[assembly : AssemblyDescription("")]
|
||||
[assembly : AssemblyConfiguration("")]
|
||||
[assembly : AssemblyCompany("http://opensimulator.org")]
|
||||
[assembly : AssemblyProduct("RealPhysXplugin")]
|
||||
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
|
||||
[assembly : AssemblyTrademark("")]
|
||||
[assembly : AssemblyCulture("")]
|
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
|
||||
[assembly : ComVisible(false)]
|
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all values by your own or you can build default build and revision
|
||||
// numbers with the '*' character (the default):
|
||||
|
||||
[assembly : AssemblyVersion("0.6.5.*")]
|
||||
@@ -1,349 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using PhysXWrapper;
|
||||
using Quaternion=OpenMetaverse.Quaternion;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Physics.PhysXPlugin
|
||||
{
|
||||
public class PhysXCharacter : PhysicsActor
|
||||
{
|
||||
private Vector3 _position;
|
||||
private Vector3 _velocity;
|
||||
private Vector3 m_rotationalVelocity = Vector3.Zero;
|
||||
private Vector3 _acceleration;
|
||||
private NxCharacter _character;
|
||||
private bool flying;
|
||||
private bool iscolliding = false;
|
||||
private float gravityAccel;
|
||||
|
||||
public PhysXCharacter(NxCharacter character)
|
||||
{
|
||||
_character = character;
|
||||
}
|
||||
|
||||
public override int PhysicsActorType
|
||||
{
|
||||
get { return (int) ActorTypes.Agent; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool SetAlwaysRun
|
||||
{
|
||||
get { return false; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override uint LocalID
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Grabbed
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float Buoyancy
|
||||
{
|
||||
get { return 0f; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool FloatOnWater
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool IsPhysical
|
||||
{
|
||||
get { return false; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool ThrottleUpdates
|
||||
{
|
||||
get { return false; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Flying
|
||||
{
|
||||
get { return flying; }
|
||||
set { flying = value; }
|
||||
}
|
||||
|
||||
public override bool IsColliding
|
||||
{
|
||||
get { return iscolliding; }
|
||||
set { iscolliding = value; }
|
||||
}
|
||||
|
||||
public override bool CollidingGround
|
||||
{
|
||||
get { return false; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool CollidingObj
|
||||
{
|
||||
get { return false; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override Vector3 RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
}
|
||||
|
||||
public override bool Stopped
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override Vector3 Position
|
||||
{
|
||||
get { return _position; }
|
||||
set
|
||||
{
|
||||
_position = value;
|
||||
Vec3 ps = new Vec3();
|
||||
ps.X = value.X;
|
||||
ps.Y = value.Y;
|
||||
ps.Z = value.Z;
|
||||
_character.Position = ps;
|
||||
}
|
||||
}
|
||||
|
||||
public override Vector3 Size
|
||||
{
|
||||
get { return Vector3.Zero; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public override float Mass
|
||||
{
|
||||
get { return 0f; }
|
||||
}
|
||||
|
||||
public override Vector3 Force
|
||||
{
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override int VehicleType
|
||||
{
|
||||
get { return 0; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override void VehicleFloatParam(int param, float value)
|
||||
{
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
}
|
||||
|
||||
public override void VehicleRotationParam(int param, Quaternion rotation)
|
||||
{
|
||||
}
|
||||
|
||||
public override void VehicleFlags(int param, bool remove)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetVolumeDetect(int param)
|
||||
{
|
||||
}
|
||||
|
||||
public override Vector3 CenterOfMass
|
||||
{
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override Vector3 GeometricCenter
|
||||
{
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override Vector3 Velocity
|
||||
{
|
||||
get { return _velocity; }
|
||||
set { _velocity = value; }
|
||||
}
|
||||
|
||||
public override float CollisionScore
|
||||
{
|
||||
get { return 0f; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public override bool Kinematic
|
||||
{
|
||||
get { return false; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public override Quaternion Orientation
|
||||
{
|
||||
get { return Quaternion.Identity; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return _acceleration; }
|
||||
set { _acceleration = value; }
|
||||
}
|
||||
|
||||
public override void AddForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override Vector3 Torque
|
||||
{
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override void link(PhysicsActor obj)
|
||||
{
|
||||
}
|
||||
|
||||
public override void delink()
|
||||
{
|
||||
}
|
||||
|
||||
public override void LockAngularMotion(Vector3 axis)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetMomentum(Vector3 momentum)
|
||||
{
|
||||
}
|
||||
|
||||
public void Move(float timeStep)
|
||||
{
|
||||
Vec3 vec = new Vec3();
|
||||
vec.X = _velocity.X*timeStep;
|
||||
vec.Y = _velocity.Y*timeStep;
|
||||
if (flying)
|
||||
{
|
||||
vec.Z = (_velocity.Z)*timeStep;
|
||||
}
|
||||
else
|
||||
{
|
||||
gravityAccel += -9.8f;
|
||||
vec.Z = (gravityAccel + _velocity.Z)*timeStep;
|
||||
}
|
||||
int res = _character.Move(vec);
|
||||
if (res == 1)
|
||||
{
|
||||
gravityAccel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override PrimitiveBaseShape Shape
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public void UpdatePosition()
|
||||
{
|
||||
Vec3 vec = _character.Position;
|
||||
_position.X = vec.X;
|
||||
_position.Y = vec.Y;
|
||||
_position.Z = vec.Z;
|
||||
}
|
||||
|
||||
public override void CrossingFailure()
|
||||
{
|
||||
}
|
||||
|
||||
public override Vector3 PIDTarget { set { return; } }
|
||||
public override bool PIDActive { set { return; } }
|
||||
public override float PIDTau { set { return; } }
|
||||
|
||||
public override float PIDHoverHeight { set { return; } }
|
||||
public override bool PIDHoverActive { set { return; } }
|
||||
public override PIDHoverType PIDHoverType { set { return; } }
|
||||
public override float PIDHoverTau { set { return; } }
|
||||
|
||||
public override Quaternion APIDTarget
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool APIDActive
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDStrength
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDDamping
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override void SubscribeEvents(int ms)
|
||||
{
|
||||
|
||||
}
|
||||
public override void UnSubscribeEvents()
|
||||
{
|
||||
|
||||
}
|
||||
public override bool SubscribedEvents()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using PhysXWrapper;
|
||||
using Quaternion=OpenMetaverse.Quaternion;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Physics.PhysXPlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Will be the PhysX plugin but for now will be a very basic physics engine
|
||||
/// </summary>
|
||||
public class PhysXPlugin : IPhysicsPlugin
|
||||
{
|
||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private PhysXScene _mScene;
|
||||
|
||||
public PhysXPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
public bool Init()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public PhysicsScene GetScene(string sceneIdentifier)
|
||||
{
|
||||
if (_mScene == null)
|
||||
{
|
||||
_mScene = new PhysXScene(sceneIdentifier);
|
||||
}
|
||||
return (_mScene);
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return ("RealPhysX");
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,341 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using PhysXWrapper;
|
||||
using Quaternion=OpenMetaverse.Quaternion;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Physics.PhysXPlugin
|
||||
{
|
||||
public class PhysXPrim : PhysicsActor
|
||||
{
|
||||
private Vector3 _velocity;
|
||||
private Vector3 _acceleration;
|
||||
private Vector3 m_rotationalVelocity;
|
||||
private NxActor _prim;
|
||||
|
||||
public PhysXPrim(NxActor prim)
|
||||
{
|
||||
_velocity = Vector3.Zero;
|
||||
_acceleration = Vector3.Zero;
|
||||
_prim = prim;
|
||||
}
|
||||
|
||||
public override int PhysicsActorType
|
||||
{
|
||||
get { return (int) ActorTypes.Prim; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool IsPhysical
|
||||
{
|
||||
get { return false; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool SetAlwaysRun
|
||||
{
|
||||
get { return false; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override uint LocalID
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Grabbed
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float Buoyancy
|
||||
{
|
||||
get { return 0f; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool FloatOnWater
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool ThrottleUpdates
|
||||
{
|
||||
get { return false; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override Vector3 RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
}
|
||||
|
||||
public override bool Flying
|
||||
{
|
||||
get { return false; //no flying prims for you
|
||||
}
|
||||
set { }
|
||||
}
|
||||
|
||||
public override bool IsColliding
|
||||
{
|
||||
get { return false; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public override bool CollidingGround
|
||||
{
|
||||
get { return false; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool CollidingObj
|
||||
{
|
||||
get { return false; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool Stopped
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override Vector3 Position
|
||||
{
|
||||
get
|
||||
{
|
||||
Vector3 pos = Vector3.Zero;
|
||||
Vec3 vec = _prim.Position;
|
||||
pos.X = vec.X;
|
||||
pos.Y = vec.Y;
|
||||
pos.Z = vec.Z;
|
||||
return pos;
|
||||
}
|
||||
set
|
||||
{
|
||||
Vector3 vec = value;
|
||||
Vec3 pos = new Vec3();
|
||||
pos.X = vec.X;
|
||||
pos.Y = vec.Y;
|
||||
pos.Z = vec.Z;
|
||||
_prim.Position = pos;
|
||||
}
|
||||
}
|
||||
|
||||
public override PrimitiveBaseShape Shape
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override Vector3 Velocity
|
||||
{
|
||||
get { return _velocity; }
|
||||
set { _velocity = value; }
|
||||
}
|
||||
|
||||
public override Vector3 Torque
|
||||
{
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float CollisionScore
|
||||
{
|
||||
get { return 0f; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public override bool Kinematic
|
||||
{
|
||||
get { return _prim.Kinematic; }
|
||||
set { _prim.Kinematic = value; }
|
||||
}
|
||||
|
||||
public override Quaternion Orientation
|
||||
{
|
||||
get
|
||||
{
|
||||
Quaternion res;
|
||||
PhysXWrapper.Quaternion quat = _prim.GetOrientation();
|
||||
res.W = quat.W;
|
||||
res.X = quat.X;
|
||||
res.Y = quat.Y;
|
||||
res.Z = quat.Z;
|
||||
return res;
|
||||
}
|
||||
set { }
|
||||
}
|
||||
|
||||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return _acceleration; }
|
||||
set { _acceleration = value; }
|
||||
}
|
||||
|
||||
public override void AddForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetMomentum(Vector3 momentum)
|
||||
{
|
||||
}
|
||||
|
||||
public override Vector3 Size
|
||||
{
|
||||
get { return Vector3.Zero; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public override void link(PhysicsActor obj)
|
||||
{
|
||||
}
|
||||
|
||||
public override void delink()
|
||||
{
|
||||
}
|
||||
|
||||
public override void LockAngularMotion(Vector3 axis)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override float Mass
|
||||
{
|
||||
get { return 0f; }
|
||||
}
|
||||
|
||||
public override Vector3 Force
|
||||
{
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override int VehicleType
|
||||
{
|
||||
get { return 0; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override void VehicleFloatParam(int param, float value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void VehicleRotationParam(int param, Quaternion rotation)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void VehicleFlags(int param, bool remove) { }
|
||||
|
||||
public override void SetVolumeDetect(int param)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override Vector3 CenterOfMass
|
||||
{
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override Vector3 GeometricCenter
|
||||
{
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override void CrossingFailure()
|
||||
{
|
||||
}
|
||||
|
||||
public override Vector3 PIDTarget { set { return; } }
|
||||
public override bool PIDActive { set { return; } }
|
||||
public override float PIDTau { set { return; } }
|
||||
|
||||
public override float PIDHoverHeight { set { return; } }
|
||||
public override bool PIDHoverActive { set { return; } }
|
||||
public override PIDHoverType PIDHoverType { set { return; } }
|
||||
public override float PIDHoverTau { set { return; } }
|
||||
|
||||
public override Quaternion APIDTarget
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool APIDActive
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDStrength
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDDamping
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void SubscribeEvents(int ms)
|
||||
{
|
||||
|
||||
}
|
||||
public override void UnSubscribeEvents()
|
||||
{
|
||||
|
||||
}
|
||||
public override bool SubscribedEvents()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using PhysXWrapper;
|
||||
using Quaternion=OpenMetaverse.Quaternion;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Physics.PhysXPlugin
|
||||
{
|
||||
public class PhysXScene : PhysicsScene
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private List<PhysXCharacter> _characters = new List<PhysXCharacter>();
|
||||
private List<PhysXPrim> _prims = new List<PhysXPrim>();
|
||||
private float[] _heightMap = null;
|
||||
private NxPhysicsSDK mySdk;
|
||||
private NxScene scene;
|
||||
|
||||
// protected internal string sceneIdentifier;
|
||||
public PhysXScene(string _sceneIdentifier)
|
||||
{
|
||||
//sceneIdentifier = _sceneIdentifier;
|
||||
|
||||
mySdk = NxPhysicsSDK.CreateSDK();
|
||||
m_log.Info("Sdk created - now creating scene");
|
||||
scene = mySdk.CreateScene();
|
||||
}
|
||||
|
||||
public override void Initialise(IMesher meshmerizer, IConfigSource config)
|
||||
{
|
||||
// Does nothing right now
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SetWaterLevel(float baseheight)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||
{
|
||||
Vec3 pos = new Vec3();
|
||||
pos.X = position.X;
|
||||
pos.Y = position.Y;
|
||||
pos.Z = position.Z;
|
||||
PhysXCharacter act = new PhysXCharacter(scene.AddCharacter(pos));
|
||||
act.Flying = isFlying;
|
||||
act.Position = position;
|
||||
_characters.Add(act);
|
||||
return act;
|
||||
}
|
||||
|
||||
public override void RemovePrim(PhysicsActor prim)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RemoveAvatar(PhysicsActor actor)
|
||||
{
|
||||
}
|
||||
|
||||
private PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
|
||||
{
|
||||
Vec3 pos = new Vec3();
|
||||
pos.X = position.X;
|
||||
pos.Y = position.Y;
|
||||
pos.Z = position.Z;
|
||||
Vec3 siz = new Vec3();
|
||||
siz.X = size.X;
|
||||
siz.Y = size.Y;
|
||||
siz.Z = size.Z;
|
||||
PhysXPrim act = new PhysXPrim(scene.AddNewBox(pos, siz));
|
||||
_prims.Add(act);
|
||||
return act;
|
||||
}
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
|
||||
{
|
||||
return AddPrim(position, size, rotation);
|
||||
}
|
||||
|
||||
public override void AddPhysicsActorTaint(PhysicsActor prim)
|
||||
{
|
||||
}
|
||||
|
||||
public override float Simulate(float timeStep)
|
||||
{
|
||||
float fps = 0f;
|
||||
try
|
||||
{
|
||||
foreach (PhysXCharacter actor in _characters)
|
||||
{
|
||||
actor.Move(timeStep);
|
||||
}
|
||||
scene.Simulate(timeStep);
|
||||
scene.FetchResults();
|
||||
scene.UpdateControllers();
|
||||
|
||||
foreach (PhysXCharacter actor in _characters)
|
||||
{
|
||||
actor.UpdatePosition();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e.Message);
|
||||
}
|
||||
return fps;
|
||||
}
|
||||
|
||||
public override void GetResults()
|
||||
{
|
||||
}
|
||||
|
||||
public override bool IsThreaded
|
||||
{
|
||||
// for now we won't be multithreaded
|
||||
get { return (false); }
|
||||
}
|
||||
|
||||
public override void SetTerrain(float[] heightMap)
|
||||
{
|
||||
if (_heightMap != null)
|
||||
{
|
||||
m_log.Debug("PhysX - deleting old terrain");
|
||||
scene.DeleteTerrain();
|
||||
}
|
||||
_heightMap = heightMap;
|
||||
scene.AddTerrain(heightMap);
|
||||
}
|
||||
|
||||
public override void DeleteTerrain()
|
||||
{
|
||||
scene.DeleteTerrain();
|
||||
}
|
||||
|
||||
public override Dictionary<uint, float> GetTopColliders()
|
||||
{
|
||||
Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
|
||||
return returncolliders;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -137,7 +137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (cmdHandlerThread == null)
|
||||
{
|
||||
// Start the thread that will be doing the work
|
||||
cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true);
|
||||
cmdHandlerThread
|
||||
= Watchdog.StartThread(
|
||||
CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,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)
|
||||
@@ -268,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)
|
||||
@@ -3845,7 +3850,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
// Single prim
|
||||
if (m_host.LinkNum == 0)
|
||||
{
|
||||
if (linknum == 0)
|
||||
if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT)
|
||||
return m_host.Name;
|
||||
else
|
||||
return UUID.Zero.ToString();
|
||||
@@ -6376,16 +6381,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
|
||||
public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
|
||||
protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
// LSL quaternions can normalize to 0, normal Quaternions can't.
|
||||
if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
|
||||
rot.z = 1; // ZERO_ROTATION = 0,0,0,1
|
||||
|
||||
m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
|
||||
m_host.SitTargetOrientation = Rot2Quaternion(rot);
|
||||
m_host.ParentGroup.HasGroupChanged = true;
|
||||
part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
|
||||
part.SitTargetOrientation = Rot2Quaternion(rot);
|
||||
part.ParentGroup.HasGroupChanged = true;
|
||||
}
|
||||
|
||||
public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
SitTarget(m_host, offset, rot);
|
||||
}
|
||||
|
||||
public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
if (link == ScriptBaseClass.LINK_ROOT)
|
||||
SitTarget(m_host.ParentGroup.RootPart, offset, rot);
|
||||
else if (link == ScriptBaseClass.LINK_THIS)
|
||||
SitTarget(m_host, offset, rot);
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
|
||||
if (null != part)
|
||||
{
|
||||
SitTarget(part, offset, rot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LSL_String llAvatarOnSitTarget()
|
||||
@@ -7047,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;
|
||||
@@ -8151,23 +8180,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
ScriptSleep(1000);
|
||||
return GetPrimMediaParams(m_host, face, rules);
|
||||
}
|
||||
|
||||
public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
ScriptSleep(1000);
|
||||
if (link == ScriptBaseClass.LINK_ROOT)
|
||||
return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
|
||||
else if (link == ScriptBaseClass.LINK_THIS)
|
||||
return GetPrimMediaParams(m_host, face, rules);
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
|
||||
if (null != part)
|
||||
return GetPrimMediaParams(part, face, rules);
|
||||
}
|
||||
|
||||
return new LSL_List();
|
||||
}
|
||||
|
||||
private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules)
|
||||
{
|
||||
// LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid
|
||||
// TODO: Need to correctly handle case where a face has no media (which gives back an empty list).
|
||||
// Assuming silently fail means give back an empty list. Ideally, need to check this.
|
||||
if (face < 0 || face > m_host.GetNumberOfSides() - 1)
|
||||
if (face < 0 || face > part.GetNumberOfSides() - 1)
|
||||
return new LSL_List();
|
||||
|
||||
return GetPrimMediaParams(face, rules);
|
||||
}
|
||||
|
||||
private LSL_List GetPrimMediaParams(int face, LSL_List rules)
|
||||
{
|
||||
IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
|
||||
if (null == module)
|
||||
throw new Exception("Media on a prim functions not available");
|
||||
return new LSL_List();
|
||||
|
||||
MediaEntry me = module.GetMediaEntry(m_host, face);
|
||||
MediaEntry me = module.GetMediaEntry(part, face);
|
||||
|
||||
// As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams
|
||||
if (null == me)
|
||||
@@ -8249,33 +8295,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
|
||||
res.Add(new LSL_Integer((int)me.ControlPermissions));
|
||||
break;
|
||||
|
||||
default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
|
||||
public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
ScriptSleep(1000);
|
||||
return SetPrimMediaParams(m_host, face, rules);
|
||||
}
|
||||
|
||||
public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
ScriptSleep(1000);
|
||||
if (link == ScriptBaseClass.LINK_ROOT)
|
||||
return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
|
||||
else if (link == ScriptBaseClass.LINK_THIS)
|
||||
return SetPrimMediaParams(m_host, face, rules);
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
|
||||
if (null != part)
|
||||
return SetPrimMediaParams(part, face, rules);
|
||||
}
|
||||
|
||||
return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules)
|
||||
{
|
||||
// LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid
|
||||
// Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
|
||||
// Don't perform the media check directly
|
||||
if (face < 0 || face > m_host.GetNumberOfSides() - 1)
|
||||
return ScriptBaseClass.LSL_STATUS_OK;
|
||||
if (face < 0 || face > part.GetNumberOfSides() - 1)
|
||||
return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
|
||||
|
||||
return SetPrimMediaParams(face, rules);
|
||||
}
|
||||
|
||||
private LSL_Integer SetPrimMediaParams(int face, LSL_List rules)
|
||||
{
|
||||
IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
|
||||
if (null == module)
|
||||
throw new Exception("Media on a prim functions not available");
|
||||
return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
|
||||
|
||||
MediaEntry me = module.GetMediaEntry(m_host, face);
|
||||
MediaEntry me = module.GetMediaEntry(part, face);
|
||||
if (null == me)
|
||||
me = new MediaEntry();
|
||||
|
||||
@@ -8354,10 +8419,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL:
|
||||
me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
|
||||
break;
|
||||
|
||||
default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS;
|
||||
}
|
||||
}
|
||||
|
||||
module.SetMediaEntry(m_host, face, me);
|
||||
module.SetMediaEntry(part, face, me);
|
||||
|
||||
return ScriptBaseClass.LSL_STATUS_OK;
|
||||
}
|
||||
@@ -8366,18 +8433,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
ScriptSleep(1000);
|
||||
return ClearPrimMedia(m_host, face);
|
||||
}
|
||||
|
||||
public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
ScriptSleep(1000);
|
||||
if (link == ScriptBaseClass.LINK_ROOT)
|
||||
return ClearPrimMedia(m_host.ParentGroup.RootPart, face);
|
||||
else if (link == ScriptBaseClass.LINK_THIS)
|
||||
return ClearPrimMedia(m_host, face);
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
|
||||
if (null != part)
|
||||
return ClearPrimMedia(part, face);
|
||||
}
|
||||
|
||||
return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face)
|
||||
{
|
||||
// LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid
|
||||
// Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this.
|
||||
// FIXME: Don't perform the media check directly
|
||||
if (face < 0 || face > m_host.GetNumberOfSides() - 1)
|
||||
return ScriptBaseClass.LSL_STATUS_OK;
|
||||
if (face < 0 || face > part.GetNumberOfSides() - 1)
|
||||
return ScriptBaseClass.LSL_STATUS_NOT_FOUND;
|
||||
|
||||
IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
|
||||
if (null == module)
|
||||
throw new Exception("Media on a prim functions not available");
|
||||
return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED;
|
||||
|
||||
module.ClearMediaEntry(m_host, face);
|
||||
module.ClearMediaEntry(part, face);
|
||||
|
||||
return ScriptBaseClass.LSL_STATUS_OK;
|
||||
}
|
||||
|
||||
@@ -2233,7 +2233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
return NpcCreate(firstname, lastname, position, notecard, false, true);
|
||||
return NpcCreate(firstname, lastname, position, notecard, false, false);
|
||||
}
|
||||
|
||||
public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options)
|
||||
@@ -2244,7 +2244,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return NpcCreate(
|
||||
firstname, lastname, position, notecard,
|
||||
(options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0,
|
||||
(options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) == 0);
|
||||
(options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) != 0);
|
||||
}
|
||||
|
||||
private LSL_Key NpcCreate(
|
||||
@@ -2595,7 +2595,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
UUID npcID = new UUID(npc.m_string);
|
||||
|
||||
if (module.CheckPermissions(npcID, m_host.OwnerID))
|
||||
AvatarPlayAnimation(npcID.ToString(), animation);
|
||||
AvatarStopAnimation(npcID.ToString(), animation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2740,7 +2740,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
|
||||
m_host.AddScriptLPS(1);
|
||||
ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
|
||||
avatar.SpeedModifier = (float)SpeedModifier;
|
||||
|
||||
if (avatar != null)
|
||||
avatar.SpeedModifier = (float)SpeedModifier;
|
||||
}
|
||||
|
||||
public void osKickAvatar(string FirstName,string SurName,string alert)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,6 @@ using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using log4net;
|
||||
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
@@ -41,8 +40,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
{
|
||||
public class SensorRepeat
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
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;
|
||||
@@ -156,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)
|
||||
{
|
||||
@@ -447,11 +460,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
|
||||
Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence =>
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SENSOR REPEAT]: Inspecting scene presence {0}, type {1} on sensor sweep for {2}, type {3}",
|
||||
// presence.Name, presence.PresenceType, ts.name, ts.type);
|
||||
|
||||
if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc)
|
||||
{
|
||||
INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
|
||||
if (npcData == null || !npcData.SenseAsAgent)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SENSOR REPEAT]: Discarding NPC {0} from agent sense sweep for script item id {1}",
|
||||
// presence.Name, ts.itemID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((ts.type & AGENT) == 0)
|
||||
@@ -464,7 +486,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
{
|
||||
INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
|
||||
if (npcData != null && npcData.SenseAsAgent)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SENSOR REPEAT]: Discarding NPC {0} from non-agent sense sweep for script item id {1}",
|
||||
// presence.Name, ts.itemID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -620,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;
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options);
|
||||
LSL_Integer llCeil(double f);
|
||||
void llClearCameraParams();
|
||||
LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face);
|
||||
LSL_Integer llClearPrimMedia(LSL_Integer face);
|
||||
void llCloseRemoteDataChannel(string channel);
|
||||
LSL_Float llCloud(LSL_Vector offset);
|
||||
@@ -139,7 +140,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
LSL_String llGetLinkName(int linknum);
|
||||
LSL_Integer llGetLinkNumber();
|
||||
LSL_Integer llGetLinkNumberOfSides(int link);
|
||||
LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules);
|
||||
LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules);
|
||||
LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules);
|
||||
LSL_Integer llGetListEntryType(LSL_List src, int index);
|
||||
LSL_Integer llGetListLength(LSL_List src);
|
||||
LSL_Vector llGetLocalPos();
|
||||
@@ -218,6 +220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
LSL_String llGetDisplayName(string id);
|
||||
LSL_String llRequestDisplayName(string id);
|
||||
void llLinkParticleSystem(int linknum, LSL_List rules);
|
||||
void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot);
|
||||
LSL_String llList2CSV(LSL_List src);
|
||||
LSL_Float llList2Float(LSL_List src, int index);
|
||||
LSL_Integer llList2Integer(LSL_List src, int index);
|
||||
@@ -334,6 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
void llSetInventoryPermMask(string item, int mask, int value);
|
||||
void llSetLinkAlpha(int linknumber, double alpha, int face);
|
||||
void llSetLinkColor(int linknumber, LSL_Vector color, int face);
|
||||
LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules);
|
||||
void llSetLinkPrimitiveParams(int linknumber, LSL_List rules);
|
||||
void llSetLinkTexture(int linknumber, string texture, int face);
|
||||
void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate);
|
||||
@@ -344,7 +348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
void llSetParcelMusicURL(string url);
|
||||
void llSetPayPrice(int price, LSL_List quick_pay_buttons);
|
||||
void llSetPos(LSL_Vector pos);
|
||||
LSL_Integer llSetPrimMediaParams(int face, LSL_List rules);
|
||||
LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules);
|
||||
void llSetPrimitiveParams(LSL_List rules);
|
||||
void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules);
|
||||
void llSetPrimURL(string url);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1688,6 +1688,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
m_LSL_Functions.llSitTarget(offset, rot);
|
||||
}
|
||||
|
||||
public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
|
||||
{
|
||||
m_LSL_Functions.llLinkSitTarget(link, offset, rot);
|
||||
}
|
||||
|
||||
public void llSleep(double sec)
|
||||
{
|
||||
m_LSL_Functions.llSleep(sec);
|
||||
@@ -1882,17 +1887,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
{
|
||||
return m_LSL_Functions.llGetPrimMediaParams(face, rules);
|
||||
}
|
||||
|
||||
|
||||
public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
|
||||
{
|
||||
return m_LSL_Functions.llGetLinkMedia(link, face, rules);
|
||||
}
|
||||
|
||||
public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules)
|
||||
{
|
||||
return m_LSL_Functions.llSetPrimMediaParams(face, rules);
|
||||
}
|
||||
|
||||
|
||||
public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
|
||||
{
|
||||
return m_LSL_Functions.llSetLinkMedia(link, face, rules);
|
||||
}
|
||||
|
||||
public LSL_Integer llClearPrimMedia(LSL_Integer face)
|
||||
{
|
||||
return m_LSL_Functions.llClearPrimMedia(face);
|
||||
}
|
||||
|
||||
public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
|
||||
{
|
||||
return m_LSL_Functions.llClearLinkMedia(link, face);
|
||||
}
|
||||
|
||||
public void print(string str)
|
||||
{
|
||||
m_LSL_Functions.print(str);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user