Compare commits

...

80 Commits

Author SHA1 Message Date
unknown
e3f229225c Enable scripting interface for windlight 2009-12-09 01:34:26 +01:00
unknown
dbd8c400ce Merge branch 'careminster' into windlight 2009-12-07 18:14:02 +01:00
unknown
29a740ec8c Initial windlight codebase commit 2009-12-07 18:05:40 +01:00
Melanie
c2d3afdeee Same for the remote auth connector 2009-12-07 14:31:20 +00:00
Melanie
9155c9ee37 Merge branch 'master' into careminster 2009-12-07 14:14:00 +00:00
CasperW
b15f20520f Merge branch 'careminster' of ssh://TOR/home/kitto/opensim/ into careminster 2009-12-06 17:23:22 +01:00
CasperW
172e2f4e76 Fix to existing ReaderWriterLockSlim implementations 2009-12-06 17:23:07 +01:00
Melanie
23cd1b1954 Revert "Make ObjectSelect packet processing not use FireAndForget"
This reverts commit cade14c58c.
2009-12-06 05:24:43 +00:00
Melanie
cade14c58c Make ObjectSelect packet processing not use FireAndForget 2009-12-06 05:14:17 +00:00
Melanie
1e222d52e6 Change EntityManager to use RWlocks 2009-12-06 03:56:15 +00:00
Melanie
f9ae9afaac Fix build break from conflicted merge 2009-12-06 03:10:34 +00:00
Melanie
09bbfc1d56 Merge branch 'master' into careminster 2009-12-06 03:01:58 +00:00
Melanie
79511ecce2 Experimental: Remove explicit property sends 2009-12-06 02:15:52 +00:00
Melanie
2fe75a62be Skip single prims in unlink selections 2009-12-06 02:00:32 +00:00
Melanie
da414fd509 Change locking to not mix explicit Monitor.* calls with lock() 2009-12-06 01:20:39 +00:00
Melanie
f2891e7738 Remove extra forced updates. They're not needed for each prim. Really. 2009-12-06 00:50:28 +00:00
Melanie
fbefa8273b Lock updates out while linking and unlinking 2009-12-06 00:25:04 +00:00
Melanie
ceccfe02d0 Eliminate multiple updates on link/unlink 2009-12-06 00:02:24 +00:00
Melanie
129de26032 Cause better packing of ObjectProperties 2009-12-05 23:25:30 +00:00
Melanie
43a6fa1d01 Merge branch 'master' into careminster 2009-12-05 19:53:54 +00:00
Melanie
551696bb45 Merge branch 'master' into careminster 2009-12-02 10:22:21 +00:00
Melanie
ded16d3529 Merge branch 'master' into careminster 2009-12-02 00:36:53 +00:00
CasperW
2e6dce434f Enforce physical prim max size on single prims.
Also convert a lock() to ReaderWriterLockSlim that i missed in the last commit
2009-11-30 21:52:55 +01:00
CasperW
9888f95068 Convert multiple lock()s which directly hinder script performance in linksets to ReaderWriterLockSlim. 2009-11-30 21:17:15 +01:00
Melanie
8bbb88ea4e Merge branch 'master' into careminster 2009-11-30 14:16:42 +00:00
Melanie
69d83e1548 Merge branch 'master' into careminster 2009-11-30 08:25:40 +00:00
Melanie
d3e7a52933 Merge branch 'master' into careminster 2009-11-28 09:26:00 +00:00
Melanie
aa695e92f7 Reset update flag when a SOG is deleted. This fixes llDie(); 2009-11-27 08:58:26 +00:00
Melanie
0ddd1ce0b7 Merge branch 'master' into careminster 2009-11-27 08:18:16 +00:00
Melanie
cc18ab12f8 Merge branch 'master' into careminster 2009-11-27 00:40:56 +00:00
root
2c3f6aaa87 Merge branch 'careminster' into tests 2009-11-26 20:41:38 +01:00
KittoFlora
5dedacca3c First attempt at mult-sit on large single prims. 2009-11-26 20:37:08 +01:00
Melanie
ad2f0a1290 Remove OS version crap from about dialog 2009-11-26 18:04:58 +00:00
Melanie
bd3b9f79c2 Update CM version 2009-11-26 17:59:28 +00:00
Melanie
ed148eba32 Merge branch 'master' into careminster 2009-11-26 17:45:09 +00:00
Melanie
06f41bb017 Merge branch 'master' into careminster 2009-11-26 17:27:03 +00:00
Melanie
a27d33cb63 Remove the old remoting-type interregion code for prim/script crossing 2009-11-26 13:13:56 +00:00
Melanie
22c325aa5a Remove GetAssemblyName and friends from the SE interface. It's now handled
internally
2009-11-26 13:13:48 +00:00
CasperW
ac2fcbe224 Improvements to rAdmin admin_shutdown and admin_restart. Both methods can now accept a parameter of noticetype = dialog in order to display a blue persistant dropdown instead of a short notice. Added an optional and configurable delay to the restart method, defaulting at 30 seconds as before. Both methods can also accept a noticetype = none dialog in order to act silently. 2009-11-26 15:17:44 +01:00
CasperW
63b6b9cdce Added animation support for my last commit 2009-11-26 02:35:27 +01:00
CasperW
de55110247 Merge branch 'careminster' into casper 2009-11-26 02:01:51 +01:00
CasperW
b9d22aa821 Add nudge right and left to avatar movement (faster reaction times when stepping left or right.) 2009-11-26 01:59:08 +01:00
Melanie
de927adf27 Add the dummy "Size" property to the list type 2009-11-25 20:01:21 +00:00
Melanie
79395bc7db Merge branch 'master' into careminster 2009-11-25 17:04:05 +00:00
Melanie
c81f37cf82 Change osTeleportAgent parameters from long to int. That numerical range is
not even supported by the underlying type, so there is no need to ask
for a type the script can not even supply.
2009-11-25 17:01:41 +00:00
Melanie
25b4160434 Merge branch 'master' into careminster 2009-11-25 08:45:41 +00:00
KittoFlora
32c464ad1f Fixed animation sequencing: SitHere, Falling, Stand/Walk etc. Login Init
Av Animation at Stand.
2009-11-25 08:03:09 +01:00
CasperW
d5aceb6d95 Append a prefix to the god avatar names appearing in chat whilst in god mode (disabled by default, config entry admin_prefix) 2009-11-24 23:33:12 +01:00
Melanie
81f7e9b462 Merge branch 'careminster' of kitto@tor.k-grid.com:/home/kitto/opensim into careminster 2009-11-24 16:00:45 +00:00
CasperW
8383bde768 Removed some extra debug chatter 2009-11-24 18:18:19 +01:00
CasperW
d114713694 Drop all locking of part.TaskInventory in favour of a ReaderWriterLockSlim lock handler. This gives us:
- Faster prim inventory actions. Multiple threads can read at once.
 - Fixes the known prim inventory thread locks
 - In the event of a thread lock occurring, it will usually self heal after sixty seconds with an error message in the console
2009-11-24 18:02:12 +01:00
Melanie
cad2bf5b08 Merge branch 'master' into careminster 2009-11-24 16:00:35 +00:00
CasperW
247c66b3fe Swap the locking of m_EventQueue and m_Script to ease locks on script inventory operations 2009-11-23 20:25:53 +01:00
CasperW
73c2162ff6 Fixed nullrefs 2009-11-23 19:51:40 +01:00
CasperW
889ce36afa Added some [DebuggerNonUserCode] modifiers to functions that throw EventAbortException() to ease debugging on Visual Studio 2009-11-23 17:59:24 +01:00
Melanie
c3d4b66953 Revert "testing checkout"
This reverts commit 234b29cf66.
2009-11-23 12:52:52 +00:00
unknown
234b29cf66 testing checkout 2009-11-23 14:59:39 +01:00
Melanie
31827b0286 Merge branch 'tests' of kitto@tor.k-grid.com:/home/kitto/opensim into careminster 2009-11-23 04:26:42 +00:00
Melanie
df121a7cd0 Merge branch 'master' into careminster 2009-11-23 04:24:58 +00:00
Melanie
03df03b269 Merge branch 'master' into careminster 2009-11-22 08:37:07 +00:00
KittoFlora
f1522e6204 Add non-scripted sit, fix scripted sit. 2009-11-22 08:31:35 +01:00
Melanie
87bce90086 Merge branch 'master' into careminster 2009-11-22 03:14:21 +00:00
CasperW
4a29a7f92c Minor packet ordering fix 2009-11-21 16:51:08 +00:00
CasperW
0149265ee8 Improved avatar responsiveness. 2009-11-21 16:50:33 +00:00
Melanie
0844e5951c Merge branch 'master' into careminster 2009-11-21 16:00:18 +00:00
KittoFlora
251d1b8fbb Merge branch 'careminster' into tests 2009-11-19 20:20:03 +01:00
KittoFlora
7f0f5060ec Clean up messages in ODE 2009-11-19 20:13:26 +01:00
Melanie
d179f2cce9 Merge branch 'master' into careminster 2009-11-19 17:53:34 +00:00
Melanie
5d0778014d Merge branch 'master' into careminster 2009-11-18 06:20:21 +00:00
KittoFlora
4c10826caa Fix merge conflicts 2009-11-16 02:12:56 +01:00
KittoFlora
873c9098d8 Merge branch 'careminster' into tests 2009-11-16 01:40:15 +01:00
Melanie
6ce5080049 Merge branch 'master' into careminster 2009-11-15 22:38:22 +00:00
Melanie
b9546d12f2 Change land packet sending back to what the careminster release used
to use, remove the silly spiral stuff. Revert to double packets for
improved user experience
2009-11-15 21:20:42 +00:00
Melanie
a49c524c9e Add the ability to send messages to users ir regions via remote admin 2009-11-15 20:22:15 +00:00
Melanie
b7f1fc116e Prevent a nullref if a recipient of a group message gas left the scene 2009-11-15 20:21:46 +00:00
unknown
28aa8010b2 - Lower TIME_MS_TOLERANCE to 200ms - Allow m_updateFlag to be reset to 0 in the event of a terse update being rejected - Re-add a synchronous SendTo for certain types of packets 2009-11-15 19:40:58 +00:00
KittoFlora
c09eb00031 Merge branch 'vehicles' into tests 2009-10-27 23:32:39 +01:00
KittoFlora
1113b3b6eb Merge branch 'vehicles' into tests
Conflicts:

	OpenSim/Region/Physics/Manager/PhysicsActor.cs
	OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
2009-10-27 22:42:55 +01:00
KittoFlora
a81a16f22f llRotLookAt Pt 2 2009-10-27 19:56:39 +01:00
KittoFlora
8428b25939 Add llRotLookat pt1. 2009-10-26 00:10:23 +01:00
58 changed files with 3174 additions and 1234 deletions

View File

@@ -123,6 +123,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
availableMethods["admin_region_query"] = XmlRpcRegionQueryMethod;
availableMethods["admin_shutdown"] = XmlRpcShutdownMethod;
availableMethods["admin_broadcast"] = XmlRpcAlertMethod;
availableMethods["admin_dialog"] = XmlRpcDialogMethod;
availableMethods["admin_restart"] = XmlRpcRestartMethod;
availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod;
// User management
@@ -212,9 +213,59 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene))
throw new Exception("region not found");
int timeout = 30000;
string message;
if (requestData.ContainsKey("restart")
&& ((string)requestData["restart"] == "delayed")
&& requestData.ContainsKey("milliseconds"))
{
timeout = Int32.Parse(requestData["milliseconds"].ToString());
if (timeout < 15000)
{
//It must be at least 15 seconds or we'll cancel the reboot request
timeout = 15000;
}
message
= "Region is restarting in " + ((int)(timeout / 1000)).ToString()
+ " second(s). Please save what you are doing and log out.";
}
else
{
message = "Region is restarting in 30 second(s). Please save what you are doing and log out.";
}
if (requestData.ContainsKey("noticetype")
&& ((string)requestData["noticetype"] == "dialog"))
{
m_app.SceneManager.ForEachScene(
delegate(Scene scene)
{
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
if (dialogModule != null)
dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message);
});
}
else
{
if (!requestData.ContainsKey("noticetype")
|| ((string)requestData["noticetype"] != "none"))
{
m_app.SceneManager.ForEachScene(
delegate(Scene scene)
{
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
if (dialogModule != null)
dialogModule.SendGeneralAlert(message);
});
}
}
responseData["rebooting"] = true;
response.Value = responseData;
rebootedScene.Restart(30);
rebootedScene.Restart(timeout / 1000,false);
}
catch (Exception e)
{
@@ -277,6 +328,53 @@ namespace OpenSim.ApplicationPlugins.RemoteController
m_log.Info("[RADMIN]: Alert request complete");
return response;
}
public XmlRpcResponse XmlRpcDialogMethod(XmlRpcRequest request, IPEndPoint remoteClient)
{
XmlRpcResponse response = new XmlRpcResponse();
Hashtable responseData = new Hashtable();
m_log.Info("[RADMIN]: Dialog request started");
try
{
Hashtable requestData = (Hashtable)request.Params[0];
checkStringParameters(request, new string[] { "password", "from", "message" });
if (m_requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword))
throw new Exception("wrong password");
string message = (string)requestData["message"];
string fromuuid = (string)requestData["from"];
m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);
responseData["accepted"] = true;
responseData["success"] = true;
response.Value = responseData;
m_app.SceneManager.ForEachScene(
delegate(Scene scene)
{
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
if (dialogModule != null)
dialogModule.SendNotificationToUsersInRegion(UUID.Zero, fromuuid, message);
});
}
catch (Exception e)
{
m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
responseData["accepted"] = false;
responseData["success"] = false;
responseData["error"] = e.Message;
response.Value = responseData;
}
m_log.Info("[RADMIN]: Alert request complete");
return response;
}
public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient)
{
@@ -384,13 +482,33 @@ namespace OpenSim.ApplicationPlugins.RemoteController
message = "Region is going down now.";
}
m_app.SceneManager.ForEachScene(
if (requestData.ContainsKey("noticetype")
&& ((string) requestData["noticetype"] == "dialog"))
{
m_app.SceneManager.ForEachScene(
delegate(Scene scene)
{
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
if (dialogModule != null)
dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message);
});
}
else
{
if (!requestData.ContainsKey("noticetype")
|| ((string)requestData["noticetype"] != "none"))
{
m_app.SceneManager.ForEachScene(
delegate(Scene scene)
{
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
if (dialogModule != null)
dialogModule.SendGeneralAlert(message);
});
}
}
// Perform shutdown
System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing

View File

@@ -902,7 +902,7 @@ namespace OpenSim.Client.MXP.ClientStack
// Need to translate to MXP somehow
}
public void SendGenericMessage(string method, List<string> message)
public void SendGenericMessage(string method, List<byte[]> message)
{
// Need to translate to MXP somehow
}

View File

@@ -483,7 +483,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
throw new System.NotImplementedException();
}
public void SendGenericMessage(string method, List<string> message)
public void SendGenericMessage(string method, List<byte[]> message)
{
throw new System.NotImplementedException();
}

View File

@@ -671,7 +671,16 @@ VALUES
cmd.ExecuteNonQuery();
}
}
public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID)
{
//This connector doesn't support the windlight module yet
//Return default LL windlight settings
return new RegionMeta7WindlightData();
}
public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
{
//This connector doesn't support the windlight module yet
}
/// <summary>
/// Loads the settings of a region.
/// </summary>
@@ -696,7 +705,7 @@ VALUES
}
}
//If comes here then there is now region setting for that region
//If we reach this point then there are new region settings for that region
regionSettings = new RegionSettings();
regionSettings.RegionUUID = regionUUID;
regionSettings.OnSave += StoreRegionSettings;

View File

@@ -693,6 +693,97 @@ namespace OpenSim.Data.MySQL
}
}
public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID)
{
RegionMeta7WindlightData nWP = new RegionMeta7WindlightData();
nWP.OnSave += StoreRegionWindlightSettings;
lock (m_Connection)
{
string command = "select * from `regionwindlight` where region_id = ?regionID";
MySqlCommand cmd = new MySqlCommand(command);
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
IDataReader result = ExecuteReader(cmd);
if (!result.Read())
{
//No result, so store our default windlight profile and return it
nWP.regionID = regionUUID;
StoreRegionWindlightSettings(nWP);
return nWP;
}
else
{
UUID.TryParse(result["region_id"].ToString(), out nWP.regionID);
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
}
}
return nWP;
}
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
RegionSettings rs = null;
@@ -726,6 +817,107 @@ namespace OpenSim.Data.MySQL
return rs;
}
public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
{
lock (m_Connection)
{
using (MySqlCommand cmd = m_Connection.CreateCommand())
{
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
cmd.Parameters.AddWithValue("region_id", wl.regionID);
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
ExecuteNonQuery(cmd);
}
}
}
public void StoreRegionSettings(RegionSettings rs)
{
lock (m_Connection)

View File

@@ -50,7 +50,16 @@ namespace OpenSim.Data.Null
public void StoreRegionSettings(RegionSettings rs)
{
}
public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID)
{
//This connector doesn't support the windlight module yet
//Return default LL windlight settings
return new RegionMeta7WindlightData();
}
public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
{
//This connector doesn't support the windlight module yet
}
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
return null;

View File

@@ -272,7 +272,16 @@ namespace OpenSim.Data.SQLite
Commit();
}
}
public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID)
{
//This connector doesn't support the windlight module yet
//Return default LL windlight settings
return new RegionMeta7WindlightData();
}
public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
{
//This connector doesn't support the windlight module yet
}
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
lock (ds)

View File

@@ -1077,7 +1077,7 @@ namespace OpenSim.Framework
void SendInstantMessage(GridInstantMessage im);
void SendGenericMessage(string method, List<string> message);
void SendGenericMessage(string method, List<byte[]> message);
void SendLayerData(float[] map);
void SendLayerData(int px, int py, float[] map);

View File

@@ -36,8 +36,59 @@ using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework.Console;
namespace OpenSim.Framework
{
public class RegionMeta7WindlightData
{
public UUID regionID = UUID.Zero;
public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f);
public float waterFogDensityExponent = 4.0f;
public float underwaterFogModifier = 0.25f;
public Vector3 reflectionWaveletScale = new Vector3(2.0f,2.0f,2.0f);
public float fresnelScale = 0.40f;
public float fresnelOffset = 0.50f;
public float refractScaleAbove = 0.03f;
public float refractScaleBelow = 0.20f;
public float blurMultiplier = 0.040f;
public Vector2 bigWaveDirection = new Vector2(1.05f,-0.42f);
public Vector2 littleWaveDirection = new Vector2(1.11f,-1.16f);
public UUID normalMapTexture = new UUID("822ded49-9a6c-f61c-cb89-6df54f42cdf4");
public Vector4 horizon = new Vector4(0.26f, 0.24f, 0.34f, 0.33f);
public float hazeHorizon = 0.19f;
public Vector4 blueDensity = new Vector4(0.10f, 0.93f, 0.02f, 0.93f);
public float hazeDensity = 0.70f;
public float densityMultiplier = 0.18f;
public float distanceMultiplier = 0.8f;
public UInt16 maxAltitude = 1605;
public Vector4 sunMoonColor = new Vector4(0.24f, 0.26f, 0.30f, 0.30f);
public float sunMoonPosition = 0.335f;
public Vector4 ambient = new Vector4(0.35f,0.35f,0.35f,0.35f);
public float eastAngle = 0.0f;
public float sunGlowFocus = 0.10f;
public float sunGlowSize = 0.10f;
public float sceneGamma = 1.0f;
public float starBrightness = 0.0f;
public Vector4 cloudColor = new Vector4(0.41f, 0.41f, 0.41f, 0.41f);
public Vector3 cloudXYDensity = new Vector3(1.00f, 0.53f, 1.00f);
public float cloudCoverage = 0.27f;
public float cloudScale = 0.42f;
public Vector3 cloudDetailXYDensity = new Vector3(1.00f, 0.53f, 0.12f);
public float cloudScrollX = 0.20f;
public bool cloudScrollXLock = false;
public float cloudScrollY = 0.01f;
public bool cloudScrollYLock = false;
public bool drawClassicClouds = false;
public delegate void SaveDelegate(RegionMeta7WindlightData wl);
public event SaveDelegate OnSave;
public void Save()
{
if (OnSave != null)
OnSave(this);
}
}
[Serializable]
public class SimpleRegionInfo
{
@@ -304,8 +355,7 @@ namespace OpenSim.Framework
private bool m_clampPrimSize = false;
private int m_objectCapacity = 0;
private string m_regionType = String.Empty;
private RegionMeta7WindlightData m_windlight = new RegionMeta7WindlightData();
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
// MT: Yes. Estates can't span trust boundaries. Therefore, it can be
@@ -454,6 +504,21 @@ namespace OpenSim.Framework
set { m_regionSettings = value; }
}
public RegionMeta7WindlightData WindlightSettings
{
get
{
if (m_windlight == null)
{
m_windlight = new RegionMeta7WindlightData();
}
return m_windlight;
}
set { m_windlight = value; }
}
public int NonphysPrimMax
{
get { return m_nonphysPrimMax; }

View File

@@ -29,7 +29,7 @@ namespace OpenSim
{
public class VersionInfo
{
private const string VERSION_NUMBER = "0.6.9";
private const string VERSION_NUMBER = "0.6.9-CM";
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
public enum Flavour

View File

@@ -27,9 +27,12 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Reflection;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using log4net;
using OpenMetaverse;
namespace OpenSim.Framework
@@ -45,6 +48,111 @@ namespace OpenSim.Framework
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem));
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Thread LockedByThread;
/// <value>
/// An advanced lock for inventory data
/// </value>
private System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim();
/// <summary>
/// Are we readlocked by the calling thread?
/// </summary>
public bool IsReadLockedByMe()
{
if (m_itemLock.RecursiveReadCount > 0)
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// Lock our inventory list for reading (many can read, one can write)
/// </summary>
public void LockItemsForRead(bool locked)
{
if (locked)
{
if (m_itemLock.IsWriteLockHeld && LockedByThread != null)
{
if (!LockedByThread.IsAlive)
{
//Locked by dead thread, reset.
m_itemLock = new System.Threading.ReaderWriterLockSlim();
}
}
if (m_itemLock.RecursiveReadCount > 0)
{
m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
m_itemLock.ExitReadLock();
}
if (m_itemLock.RecursiveWriteCount > 0)
{
m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
m_itemLock.ExitWriteLock();
}
while (!m_itemLock.TryEnterReadLock(60000))
{
m_log.Error("Thread lock detected while trying to aquire READ lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
if (m_itemLock.IsWriteLockHeld)
{
m_itemLock = new System.Threading.ReaderWriterLockSlim();
}
}
}
else
{
if (m_itemLock.RecursiveReadCount>0)
{
m_itemLock.ExitReadLock();
}
}
}
/// <summary>
/// Lock our inventory list for writing (many can read, one can write)
/// </summary>
public void LockItemsForWrite(bool locked)
{
if (locked)
{
//Enter a write lock, wait indefinately for one to open.
if (m_itemLock.RecursiveReadCount > 0)
{
m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
m_itemLock.ExitReadLock();
}
if (m_itemLock.RecursiveWriteCount > 0)
{
m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
m_itemLock.ExitWriteLock();
}
while (!m_itemLock.TryEnterWriteLock(60000))
{
m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
if (m_itemLock.IsWriteLockHeld)
{
m_itemLock = new System.Threading.ReaderWriterLockSlim();
}
}
LockedByThread = Thread.CurrentThread;
}
else
{
if (m_itemLock.RecursiveWriteCount > 0)
{
m_itemLock.ExitWriteLock();
}
}
}
#region ICloneable Members
@@ -52,13 +160,12 @@ namespace OpenSim.Framework
{
TaskInventoryDictionary clone = new TaskInventoryDictionary();
lock (this)
m_itemLock.EnterReadLock();
foreach (UUID uuid in Keys)
{
foreach (UUID uuid in Keys)
{
clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
}
clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
}
m_itemLock.ExitReadLock();
return clone;
}

View File

@@ -990,19 +990,19 @@ namespace OpenSim.Framework
{
string os = String.Empty;
if (Environment.OSVersion.Platform != PlatformID.Unix)
{
os = Environment.OSVersion.ToString();
}
else
{
os = ReadEtcIssue();
}
if (os.Length > 45)
{
os = os.Substring(0, 45);
}
// if (Environment.OSVersion.Platform != PlatformID.Unix)
// {
// os = Environment.OSVersion.ToString();
// }
// else
// {
// os = ReadEtcIssue();
// }
//
// if (os.Length > 45)
// {
// os = os.Substring(0, 45);
// }
return os;
}

View File

@@ -770,16 +770,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
public void SendGenericMessage(string method, List<string> message)
public void SendGenericMessage(string method, List<byte[]> message)
{
GenericMessagePacket gmp = new GenericMessagePacket();
gmp.MethodData.Method = Util.StringToBytes256(method);
gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count];
int i = 0;
foreach (string val in message)
foreach (byte[] val in message)
{
gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock();
gmp.ParamList[i++].Parameter = Util.StringToBytes256(val);
gmp.ParamList[i++].Parameter = val;
}
OutPacket(gmp, ThrottleOutPacketType.Task);
}
@@ -791,6 +791,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public virtual void SendLayerData(float[] map)
{
Util.FireAndForget(DoSendLayerData, map);
// Send it sync, and async. It's not that much data
// and it improves user experience just so much!
DoSendLayerData(map);
}
/// <summary>
@@ -803,16 +807,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
try
{
//for (int y = 0; y < 16; y++)
//{
// for (int x = 0; x < 16; x++)
// {
// SendLayerData(x, y, map);
// }
//}
// Send LayerData in a spiral pattern. Fun!
SendLayerTopRight(map, 0, 0, 15, 15);
for (int y = 0; y < 16; y++)
{
for (int x = 0; x < 16; x+=4)
{
SendLayerPacket(x, y, map);
}
}
}
catch (Exception e)
{
@@ -820,51 +821,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2)
{
// Row
for (int i = x1; i <= x2; i++)
SendLayerData(i, y1, map);
// Column
for (int j = y1 + 1; j <= y2; j++)
SendLayerData(x2, j, map);
if (x2 - x1 > 0)
SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
}
void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2)
{
// Row in reverse
for (int i = x2; i >= x1; i--)
SendLayerData(i, y2, map);
// Column in reverse
for (int j = y2 - 1; j >= y1; j--)
SendLayerData(x1, j, map);
if (x2 - x1 > 0)
SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
}
/// <summary>
/// Sends a set of four patches (x, x+1, ..., x+3) to the client
/// </summary>
/// <param name="map">heightmap</param>
/// <param name="px">X coordinate for patches 0..12</param>
/// <param name="py">Y coordinate for patches 0..15</param>
// private void SendLayerPacket(float[] map, int y, int x)
// {
// int[] patches = new int[4];
// patches[0] = x + 0 + y * 16;
// patches[1] = x + 1 + y * 16;
// patches[2] = x + 2 + y * 16;
// patches[3] = x + 3 + y * 16;
private void SendLayerPacket(int x, int y, float[] map)
{
int[] patches = new int[4];
patches[0] = x + 0 + y * 16;
patches[1] = x + 1 + y * 16;
patches[2] = x + 2 + y * 16;
patches[3] = x + 3 + y * 16;
// Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
// OutPacket(layerpack, ThrottleOutPacketType.Land);
// }
float[] heightmap = (map.Length == 65536) ?
map :
LLHeightFieldMoronize(map);
try
{
Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
OutPacket(layerpack, ThrottleOutPacketType.Land);
}
catch
{
for (int px = x ; px < x + 4 ; px++)
SendLayerData(px, y, map);
}
}
/// <summary>
/// Sends a specified patch to a client
@@ -3142,7 +3127,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data);
OutPacket(objupdate, ThrottleOutPacketType.Task);
}
@@ -3193,8 +3177,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue();
}
// HACK: Using the task category until the tiered reprioritization code is in
OutPacket(terse, ThrottleOutPacketType.Task);
OutPacket(terse, ThrottleOutPacketType.State);
}
public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)

View File

@@ -402,6 +402,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Queue or Send
OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category);
outgoingPacket.Type = type;
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
SendPacketFinal(outgoingPacket);
@@ -513,6 +514,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
byte flags = buffer.Data[0];
bool isResend = (flags & Helpers.MSG_RESENT) != 0;
bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0;
bool sendSynchronous = false;
LLUDPClient udpClient = outgoingPacket.Client;
if (!udpClient.IsConnected)
@@ -568,9 +570,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (isReliable)
Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength);
// Put the UDP payload on the wire
AsyncBeginSend(buffer);
//Some packet types need to be sent synchonously.
//Sorry, i know it's not optimal, but until the LL client
//manages packets correctly and re-orders them as required, this is necessary.
// Put the UDP payload on the wire
if (outgoingPacket.Type == PacketType.ImprovedTerseObjectUpdate)
{
SyncBeginPrioritySend(buffer, 2); // highest priority
}
else if (outgoingPacket.Type == PacketType.ObjectUpdate
|| outgoingPacket.Type == PacketType.LayerData)
{
SyncBeginPrioritySend(buffer, 1); // medium priority
}
else
{
SyncBeginPrioritySend(buffer, 0); // normal priority
}
//AsyncBeginSend(buffer);
// Keep track of when this packet was sent out (right now)
outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue;
}
@@ -851,7 +872,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Buffer.BlockCopy(packetData, 0, buffer.Data, 0, length);
AsyncBeginSend(buffer);
SyncBeginPrioritySend(buffer, 1); //Setting this to a medium priority should help minimise resends
}
private bool IsClientAuthorized(UseCircuitCodePacket useCircuitCode, out AuthenticateResponse sessionInfo)

View File

@@ -29,6 +29,7 @@ using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Collections.Generic;
using log4net;
namespace OpenMetaverse
@@ -52,12 +53,30 @@ namespace OpenMetaverse
/// <summary>Local IP address to bind to in server mode</summary>
protected IPAddress m_localBindAddress;
/// <summary>
/// Standard queue for our outgoing SyncBeginPrioritySend
/// </summary>
private List<UDPPacketBuffer> m_standardQueue = new List<UDPPacketBuffer>();
/// <summary>
/// Medium priority queue for our outgoing SyncBeginPrioritySend
/// </summary>
private List<UDPPacketBuffer> m_mediumPriorityQueue = new List<UDPPacketBuffer>();
/// <summary>
/// Prioritised queue for our outgoing SyncBeginPrioritySend
/// </summary>
private List<UDPPacketBuffer> m_priorityQueue = new List<UDPPacketBuffer>();
/// <summary>UDP socket, used in either client or server mode</summary>
private Socket m_udpSocket;
/// <summary>Flag to process packets asynchronously or synchronously</summary>
private bool m_asyncPacketHandling;
/// <summary>Are we currently sending data asynchronously?</summary>
private volatile bool m_sendingData = false;
/// <summary>The all important shutdown flag</summary>
private volatile bool m_shutdownFlag = true;
@@ -246,7 +265,51 @@ namespace OpenMetaverse
}
}
public void AsyncBeginSend(UDPPacketBuffer buf)
public void SyncBeginPrioritySend(UDPPacketBuffer buf, int Priority)
{
if (!m_shutdownFlag)
{
if (!m_sendingData)
{
m_sendingData = true;
try
{
AsyncBeginSend(buf);
}
catch (SocketException) { }
catch (ObjectDisposedException) { }
}
else
{
if (Priority == 2)
{
lock (m_priorityQueue)
{
m_priorityQueue.Add(buf);
}
}
else
{
if (Priority != 0)
{
lock (m_mediumPriorityQueue)
{
m_mediumPriorityQueue.Add(buf);
}
}
else
{
lock (m_standardQueue)
{
m_standardQueue.Add(buf);
}
}
}
}
}
}
private void AsyncBeginSend(UDPPacketBuffer buf)
{
if (!m_shutdownFlag)
{
@@ -270,8 +333,48 @@ namespace OpenMetaverse
{
try
{
// UDPPacketBuffer buf = (UDPPacketBuffer)result.AsyncState;
m_udpSocket.EndSendTo(result);
if (m_sendingData)
{
lock (m_priorityQueue)
{
if (m_priorityQueue.Count > 0)
{
UDPPacketBuffer buf = m_priorityQueue[0];
m_priorityQueue.RemoveAt(0);
AsyncBeginSend(buf);
}
else
{
lock (m_mediumPriorityQueue)
{
if (m_mediumPriorityQueue.Count > 0)
{
UDPPacketBuffer buf = m_mediumPriorityQueue[0];
m_mediumPriorityQueue.RemoveAt(0);
AsyncBeginSend(buf);
}
else
{
lock (m_standardQueue)
{
if (m_standardQueue.Count > 0)
{
UDPPacketBuffer buf = m_standardQueue[0];
m_standardQueue.RemoveAt(0);
AsyncBeginSend(buf);
}
else
{
m_sendingData = false;
}
}
}
}
}
}
}
}
catch (SocketException) { }
catch (ObjectDisposedException) { }

View File

@@ -28,6 +28,7 @@
using System;
using OpenSim.Framework;
using OpenMetaverse;
using OpenMetaverse.Packets;
namespace OpenSim.Region.ClientStack.LindenUDP
{
@@ -52,7 +53,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public int TickCount;
/// <summary>Category this packet belongs to</summary>
public ThrottleOutPacketType Category;
/// <summary>The type of packet so its delivery method can be determined</summary>
public PacketType Type;
/// <summary>
/// Default constructor
/// </summary>

View File

@@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
private int m_shoutdistance = 100;
private int m_whisperdistance = 10;
private List<Scene> m_scenes = new List<Scene>();
private string m_adminPrefix = "";
internal object m_syncy = new object();
internal IConfig m_config;
@@ -76,6 +76,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance);
m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance);
m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance);
m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", "");
}
public virtual void AddRegion(Scene scene)
@@ -185,6 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c)
{
string fromName = c.From;
string fromNamePrefix = "";
UUID fromID = UUID.Zero;
string message = c.Message;
IScene scene = c.Scene;
@@ -207,7 +209,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
fromPos = avatar.AbsolutePosition;
fromName = avatar.Name;
fromID = c.Sender.AgentId;
if (avatar.GodLevel > 200)
{
fromNamePrefix = m_adminPrefix;
}
break;
case ChatSourceType.Object:
@@ -227,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
s.ForEachScenePresence(
delegate(ScenePresence presence)
{
TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType);
TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType);
}
);
}
@@ -266,25 +271,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
}
// m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
((Scene)c.Scene).ForEachScenePresence(
delegate(ScenePresence presence)
{
// ignore chat from child agents
if (presence.IsChildAgent) return;
IClientAPI client = presence.ControllingClient;
// don't forward SayOwner chat from objects to
// non-owner agents
if ((c.Type == ChatTypeEnum.Owner) &&
(null != c.SenderObject) &&
(((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
return;
client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
(byte)sourceType, (byte)ChatAudibleLevel.Fully);
});
if (c.Scene != null)
{
((Scene)c.Scene).ForEachScenePresence
(
delegate(ScenePresence presence)
{
// ignore chat from child agents
if (presence.IsChildAgent) return;
IClientAPI client = presence.ControllingClient;
// don't forward SayOwner chat from objects to
// non-owner agents
if ((c.Type == ChatTypeEnum.Owner) &&
(null != c.SenderObject) &&
(((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
return;
client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
(byte)sourceType, (byte)ChatAudibleLevel.Fully);
}
);
}
}

View File

@@ -164,19 +164,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
List<GridInstantMessage>msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>(
"POST", m_RestURL+"/RetrieveMessages/", client.AgentId);
foreach (GridInstantMessage im in msglist)
if (msglist != null)
{
// client.SendInstantMessage(im);
foreach (GridInstantMessage im in msglist)
{
// client.SendInstantMessage(im);
// Send through scene event manager so all modules get a chance
// to look at this message before it gets delivered.
//
// Needed for proper state management for stored group
// invitations
//
Scene s = FindScene(client.AgentId);
if (s != null)
s.EventManager.TriggerIncomingInstantMessage(im);
// Send through scene event manager so all modules get a chance
// to look at this message before it gets delivered.
//
// Needed for proper state management for stored group
// invitations
//
Scene s = FindScene(client.AgentId);
if (s != null)
s.EventManager.TriggerIncomingInstantMessage(im);
}
}
}

View File

@@ -389,7 +389,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{
// Check if this is ours to handle
//
m_log.Info("OnFridInstantMessage");
//m_log.Info("OnFridInstantMessage");
if (msg.dialog != (byte) InstantMessageDialog.InventoryOffered)
return;

View File

@@ -70,7 +70,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
IConfig authorizationConfig = source.Configs["AuthorizationService"];
if (authorizationConfig == null)
{
m_log.Error("[REMOTE AUTHORIZATION CONNECTOR]: AuthorizationService missing from OpenSim.ini");
m_log.Info("[REMOTE AUTHORIZATION CONNECTOR]: AuthorizationService missing from OpenSim.ini");
return;
}

View File

@@ -247,21 +247,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// Fix ownership/creator of inventory items
// Not doing so results in inventory items
// being no copy/no mod for everyone
lock (part.TaskInventory)
part.TaskInventory.LockItemsForRead(true);
TaskInventoryDictionary inv = part.TaskInventory;
foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
{
TaskInventoryDictionary inv = part.TaskInventory;
foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
if (!ResolveUserUuid(kvp.Value.OwnerID))
{
if (!ResolveUserUuid(kvp.Value.OwnerID))
{
kvp.Value.OwnerID = masterAvatarId;
}
if (!ResolveUserUuid(kvp.Value.CreatorID))
{
kvp.Value.CreatorID = masterAvatarId;
}
kvp.Value.OwnerID = masterAvatarId;
}
if (!ResolveUserUuid(kvp.Value.CreatorID))
{
kvp.Value.CreatorID = masterAvatarId;
}
}
part.TaskInventory.LockItemsForRead(false);
}
if (m_scene.AddRestoredSceneObject(sceneObject, true, false))

View File

@@ -433,7 +433,7 @@ namespace OpenSim.Region.Examples.SimpleModule
}
public void SendGenericMessage(string method, List<string> message)
public void SendGenericMessage(string method, List<byte[]> message)
{
}

View File

@@ -103,6 +103,8 @@ namespace OpenSim.Region.Framework.Interfaces
void StoreRegionSettings(RegionSettings rs);
RegionSettings LoadRegionSettings(UUID regionUUID);
RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID);
void StoreRegionWindlightSettings(RegionMeta7WindlightData wl);
void Shutdown();
}

View File

@@ -53,8 +53,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
{
get { return m_movementAnimation; }
}
protected string m_movementAnimation = "DEFAULT";
// protected string m_movementAnimation = "DEFAULT"; //KF: 'DEFAULT' does not exist!
protected string m_movementAnimation = "CROUCH"; //KF: CROUCH ensures reliable Av Anim. init.
private int m_animTickFall;
private int m_animTickJump;
@@ -123,17 +123,22 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// </summary>
public void TrySetMovementAnimation(string anim)
{
//m_log.DebugFormat("Updating movement animation to {0}", anim);
//Console.WriteLine("Updating movement animation to {0}", anim);
if (!m_scenePresence.IsChildAgent)
{
if (m_animations.TrySetDefaultAnimation(
anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero))
{
//Console.WriteLine("TSMA {0} success.", anim);
// 16384 is CHANGED_ANIMATION
m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 });
SendAnimPack();
}
else
{
//Console.WriteLine("TSMA {0} fail.", anim);
}
}
}
@@ -156,10 +161,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
Vector3 left = Vector3.Transform(Vector3.UnitY, rotMatrix);
// Check control flags
bool heldForward = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS;
bool heldBack = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG;
bool heldLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS;
bool heldRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG;
bool heldForward = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS);
bool heldBack = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG);
bool heldLeft = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS);
bool heldRight = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG);
//bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT;
//bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT;
bool heldUp = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) == AgentManager.ControlFlags.AGENT_CONTROL_UP_POS;
@@ -312,7 +317,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
public void UpdateMovementAnimations()
{
m_movementAnimation = GetMovementAnimation();
//Console.WriteLine("UMA got {0}", m_movementAnimation);
if (m_movementAnimation == "PREJUMP" && !m_scenePresence.Scene.m_usePreJump)
{
// This was the previous behavior before PREJUMP
@@ -450,4 +455,4 @@ namespace OpenSim.Region.Framework.Scenes.Animation
m_scenePresence = null;
}
}
}
}

View File

@@ -40,7 +40,7 @@ namespace OpenSim.Region.Framework.Scenes
private readonly Dictionary<UUID,EntityBase> m_eb_uuid = new Dictionary<UUID, EntityBase>();
private readonly Dictionary<uint, EntityBase> m_eb_localID = new Dictionary<uint, EntityBase>();
//private readonly Dictionary<UUID, ScenePresence> m_pres_uuid = new Dictionary<UUID, ScenePresence>();
private readonly Object m_lock = new Object();
private System.Threading.ReaderWriterLockSlim m_lock = new System.Threading.ReaderWriterLockSlim();
[Obsolete("Use Add() instead.")]
public void Add(UUID id, EntityBase eb)
@@ -50,7 +50,8 @@ namespace OpenSim.Region.Framework.Scenes
public void Add(EntityBase entity)
{
lock (m_lock)
m_lock.EnterWriteLock();
try
{
try
{
@@ -62,11 +63,16 @@ namespace OpenSim.Region.Framework.Scenes
m_log.ErrorFormat("Add Entity failed: {0}", e.Message);
}
}
finally
{
m_lock.ExitWriteLock();
}
}
public void InsertOrReplace(EntityBase entity)
{
lock (m_lock)
m_lock.EnterWriteLock();
try
{
try
{
@@ -78,15 +84,24 @@ namespace OpenSim.Region.Framework.Scenes
m_log.ErrorFormat("Insert or Replace Entity failed: {0}", e.Message);
}
}
finally
{
m_lock.ExitWriteLock();
}
}
public void Clear()
{
lock (m_lock)
m_lock.EnterWriteLock();
try
{
m_eb_uuid.Clear();
m_eb_localID.Clear();
}
finally
{
m_lock.ExitWriteLock();
}
}
public int Count
@@ -123,7 +138,8 @@ namespace OpenSim.Region.Framework.Scenes
public bool Remove(uint localID)
{
lock (m_lock)
m_lock.EnterWriteLock();
try
{
try
{
@@ -141,11 +157,16 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
}
finally
{
m_lock.ExitWriteLock();
}
}
public bool Remove(UUID id)
{
lock (m_lock)
m_lock.EnterWriteLock();
try
{
try
{
@@ -163,13 +184,18 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
}
finally
{
m_lock.ExitWriteLock();
}
}
public List<EntityBase> GetAllByType<T>()
{
List<EntityBase> tmp = new List<EntityBase>();
lock (m_lock)
m_lock.EnterReadLock();
try
{
try
{
@@ -187,23 +213,33 @@ namespace OpenSim.Region.Framework.Scenes
tmp = null;
}
}
finally
{
m_lock.ExitReadLock();
}
return tmp;
}
public List<EntityBase> GetEntities()
{
lock (m_lock)
m_lock.EnterReadLock();
try
{
return new List<EntityBase>(m_eb_uuid.Values);
}
finally
{
m_lock.ExitReadLock();
}
}
public EntityBase this[UUID id]
{
get
{
lock (m_lock)
m_lock.EnterReadLock();
try
{
EntityBase entity;
if (m_eb_uuid.TryGetValue(id, out entity))
@@ -211,6 +247,10 @@ namespace OpenSim.Region.Framework.Scenes
else
return null;
}
finally
{
m_lock.ExitReadLock();
}
}
set
{
@@ -222,7 +262,8 @@ namespace OpenSim.Region.Framework.Scenes
{
get
{
lock (m_lock)
m_lock.EnterReadLock();
try
{
EntityBase entity;
if (m_eb_localID.TryGetValue(localID, out entity))
@@ -230,6 +271,10 @@ namespace OpenSim.Region.Framework.Scenes
else
return null;
}
finally
{
m_lock.ExitReadLock();
}
}
set
{
@@ -239,18 +284,28 @@ namespace OpenSim.Region.Framework.Scenes
public bool TryGetValue(UUID key, out EntityBase obj)
{
lock (m_lock)
m_lock.EnterReadLock();
try
{
return m_eb_uuid.TryGetValue(key, out obj);
}
finally
{
m_lock.ExitReadLock();
}
}
public bool TryGetValue(uint key, out EntityBase obj)
{
lock (m_lock)
m_lock.EnterReadLock();
try
{
return m_eb_localID.TryGetValue(key, out obj);
}
finally
{
m_lock.ExitReadLock();
}
}
/// <summary>

View File

@@ -193,7 +193,9 @@ namespace OpenSim.Region.Framework.Scenes
public event OnMakeChildAgentDelegate OnMakeChildAgent;
public delegate void OnMakeRootAgentDelegate(ScenePresence presence);
public delegate void OnSaveNewWindlightProfileDelegate();
public event OnMakeRootAgentDelegate OnMakeRootAgent;
public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile;
public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel);
@@ -411,6 +413,7 @@ namespace OpenSim.Region.Framework.Scenes
private IncomingInstantMessage handlerUnhandledInstantMessage = null; //OnUnhandledInstantMessage;
private ClientClosed handlerClientClosed = null; //OnClientClosed;
private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent;
private OnSaveNewWindlightProfileDelegate handlerSaveNewWindlightProfile = null; //OnSaveNewWindlightProfile;
private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent;
private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick;
private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps;
@@ -772,6 +775,15 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void TriggerOnSaveNewWindlightProfile()
{
handlerSaveNewWindlightProfile = OnSaveNewWindlightProfile;
if (handlerSaveNewWindlightProfile != null)
{
handlerSaveNewWindlightProfile();
}
}
public void TriggerOnMakeRootAgent(ScenePresence presence)
{
handlerMakeRootAgent = OnMakeRootAgent;

View File

@@ -840,8 +840,12 @@ namespace OpenSim.Region.Framework.Scenes
public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID)
{
SceneObjectPart part = GetSceneObjectPart(localID);
SceneObjectGroup group = part.ParentGroup;
if (group != null)
SceneObjectGroup group = null;
if (part != null)
{
group = part.ParentGroup;
}
if (part != null && group != null)
{
TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
if (item == null)

View File

@@ -539,6 +539,8 @@ namespace OpenSim.Region.Framework.Scenes
// Load region settings
m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID);
if (m_storageManager.EstateDataStore != null)
{
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID);
@@ -880,6 +882,15 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
/// <param name="seconds">float indicating duration before restart.</param>
public virtual void Restart(float seconds)
{
Restart(seconds, true);
}
/// <summary>
/// Given float seconds, this will restart the region. showDialog will optionally alert the users.
/// </summary>
/// <param name="seconds">float indicating duration before restart.</param>
public virtual void Restart(float seconds, bool showDialog)
{
// notifications are done in 15 second increments
// so .. if the number of seconds is less then 15 seconds, it's not really a restart request
@@ -901,8 +912,11 @@ namespace OpenSim.Region.Framework.Scenes
m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
m_restartTimer.Start();
m_dialogModule.SendNotificationToUsersInRegion(
UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in 2 Minutes");
if (showDialog)
{
m_dialogModule.SendNotificationToUsersInRegion(
UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in " + (seconds / 60).ToString() + " Minutes");
}
}
}
@@ -1173,16 +1187,16 @@ namespace OpenSim.Region.Framework.Scenes
// Check if any objects have reached their targets
CheckAtTargets();
// Update SceneObjectGroups that have scheduled themselves for updates
// Objects queue their updates onto all scene presences
if (m_frame % m_update_objects == 0)
m_sceneGraph.UpdateObjectGroups();
// Run through all ScenePresences looking for updates
// Presence updates and queued object updates for each presence are sent to clients
if (m_frame % m_update_presences == 0)
m_sceneGraph.UpdatePresences();
// Update SceneObjectGroups that have scheduled themselves for updates
// Objects queue their updates onto all scene presences
if (m_frame % m_update_objects == 0)
m_sceneGraph.UpdateObjectGroups();
int tmpPhysicsMS2 = Util.EnvironmentTickCount();
if ((m_frame % m_update_physics == 0) && m_physics_enabled)
m_sceneGraph.UpdatePreparePhysics();
@@ -1491,6 +1505,13 @@ namespace OpenSim.Region.Framework.Scenes
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
}
public void StoreWindlightProfile(RegionMeta7WindlightData wl)
{
m_regInfo.WindlightSettings = wl;
m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
m_eventManager.TriggerOnSaveNewWindlightProfile();
}
/// <summary>
/// Loads the World heightmap
/// </summary>

File diff suppressed because it is too large Load Diff

View File

@@ -389,12 +389,16 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <value>
/// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes
/// Get the inventory list
/// </value>
public TaskInventoryDictionary TaskInventory
{
get { return m_inventory.Items; }
set { m_inventory.Items = value; }
get {
return m_inventory.Items;
}
set {
m_inventory.Items = value;
}
}
public uint ObjectFlags
@@ -1064,14 +1068,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
/// Clear all pending updates of parts to clients
/// </summary>
private void ClearUpdateSchedule()
{
m_updateFlag = 0;
}
private void SendObjectPropertiesToClient(UUID AgentID)
{
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
@@ -2109,17 +2105,18 @@ namespace OpenSim.Region.Framework.Scenes
//Trys to fetch sound id from prim's inventory.
//Prim's inventory doesn't support non script items yet
lock (TaskInventory)
TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
if (item.Value.Name == sound)
{
if (item.Value.Name == sound)
{
soundID = item.Value.ItemID;
break;
}
soundID = item.Value.ItemID;
break;
}
}
TaskInventory.LockItemsForRead(false);
}
List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
@@ -2185,6 +2182,11 @@ namespace OpenSim.Region.Framework.Scenes
ParentGroup.HasGroupChanged = true;
ScheduleFullUpdate();
}
public void RotLookAt(Quaternion target, float strength, float damping)
{
m_parentGroup.rotLookAt(target, strength, damping);
}
/// <summary>
/// Schedules this prim for a full update
@@ -2389,8 +2391,8 @@ namespace OpenSim.Region.Framework.Scenes
{
const float ROTATION_TOLERANCE = 0.01f;
const float VELOCITY_TOLERANCE = 0.001f;
const float POSITION_TOLERANCE = 0.05f;
const int TIME_MS_TOLERANCE = 3000;
const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
if (m_updateFlag == 1)
{
@@ -2404,7 +2406,7 @@ namespace OpenSim.Region.Framework.Scenes
Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
{
AddTerseUpdateToAllAvatars();
ClearUpdateSchedule();
// This causes the Scene to 'poll' physical objects every couple of frames
// bad, so it's been replaced by an event driven method.
@@ -2422,16 +2424,18 @@ namespace OpenSim.Region.Framework.Scenes
m_lastAngularVelocity = AngularVelocity;
m_lastTerseSent = Environment.TickCount;
}
//Moved this outside of the if clause so updates don't get blocked.. *sigh*
m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
}
else
{
if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
{
AddFullUpdateToAllAvatars();
ClearUpdateSchedule();
m_updateFlag = 0; //Same here
}
}
ClearUpdateSchedule();
m_updateFlag = 0;
}
/// <summary>
@@ -2458,17 +2462,16 @@ namespace OpenSim.Region.Framework.Scenes
if (!UUID.TryParse(sound, out soundID))
{
// search sound file from inventory
lock (TaskInventory)
TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
{
if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
{
soundID = item.Value.ItemID;
break;
}
soundID = item.Value.ItemID;
break;
}
}
TaskInventory.LockItemsForRead(false);
}
if (soundID == UUID.Zero)
@@ -2684,6 +2687,13 @@ namespace OpenSim.Region.Framework.Scenes
SetText(text);
}
public void StopLookAt()
{
m_parentGroup.stopLookAt();
m_parentGroup.ScheduleGroupForTerseUpdate();
}
public void StopMoveToTarget()
{
m_parentGroup.stopMoveToTarget();

View File

@@ -80,7 +80,9 @@ namespace OpenSim.Region.Framework.Scenes
/// </value>
protected internal TaskInventoryDictionary Items
{
get { return m_items; }
get {
return m_items;
}
set
{
m_items = value;
@@ -116,22 +118,25 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="linkNum">Link number for the part</param>
public void ResetInventoryIDs()
{
lock (Items)
m_items.LockItemsForWrite(true);
if (0 == Items.Count)
{
if (0 == Items.Count)
return;
HasInventoryChanged = true;
m_part.ParentGroup.HasGroupChanged = true;
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
Items.Clear();
foreach (TaskInventoryItem item in items)
{
item.ResetIDs(m_part.UUID);
Items.Add(item.ItemID, item);
}
m_items.LockItemsForWrite(false);
return;
}
HasInventoryChanged = true;
m_part.ParentGroup.HasGroupChanged = true;
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
Items.Clear();
foreach (TaskInventoryItem item in items)
{
item.ResetIDs(m_part.UUID);
Items.Add(item.ItemID, item);
}
m_items.LockItemsForWrite(false);
}
/// <summary>
@@ -140,25 +145,25 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="ownerId"></param>
public void ChangeInventoryOwner(UUID ownerId)
{
lock (Items)
m_items.LockItemsForWrite(true);
if (0 == Items.Count)
{
if (0 == Items.Count)
{
return;
}
m_items.LockItemsForWrite(false);
return;
}
HasInventoryChanged = true;
m_part.ParentGroup.HasGroupChanged = true;
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
foreach (TaskInventoryItem item in items)
HasInventoryChanged = true;
m_part.ParentGroup.HasGroupChanged = true;
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
foreach (TaskInventoryItem item in items)
{
if (ownerId != item.OwnerID)
{
if (ownerId != item.OwnerID)
{
item.LastOwnerID = item.OwnerID;
item.OwnerID = ownerId;
}
item.LastOwnerID = item.OwnerID;
item.OwnerID = ownerId;
}
}
m_items.LockItemsForWrite(false);
}
/// <summary>
@@ -167,24 +172,24 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="groupID"></param>
public void ChangeInventoryGroup(UUID groupID)
{
lock (Items)
m_items.LockItemsForWrite(true);
if (0 == Items.Count)
{
if (0 == Items.Count)
{
return;
}
m_items.LockItemsForWrite(false);
return;
}
HasInventoryChanged = true;
m_part.ParentGroup.HasGroupChanged = true;
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
foreach (TaskInventoryItem item in items)
HasInventoryChanged = true;
m_part.ParentGroup.HasGroupChanged = true;
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
foreach (TaskInventoryItem item in items)
{
if (groupID != item.GroupID)
{
if (groupID != item.GroupID)
{
item.GroupID = groupID;
}
item.GroupID = groupID;
}
}
m_items.LockItemsForWrite(false);
}
/// <summary>
@@ -192,14 +197,14 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
{
lock (m_items)
Items.LockItemsForRead(true);
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
Items.LockItemsForRead(false);
foreach (TaskInventoryItem item in items)
{
foreach (TaskInventoryItem item in Items.Values)
if ((int)InventoryType.LSL == item.InvType)
{
if ((int)InventoryType.LSL == item.InvType)
{
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
}
CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
}
}
}
@@ -209,17 +214,20 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void RemoveScriptInstances()
{
lock (Items)
Items.LockItemsForRead(true);
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
Items.LockItemsForRead(false);
foreach (TaskInventoryItem item in items)
{
foreach (TaskInventoryItem item in Items.Values)
if ((int)InventoryType.LSL == item.InvType)
{
if ((int)InventoryType.LSL == item.InvType)
{
RemoveScriptInstance(item.ItemID);
m_part.RemoveScriptEvents(item.ItemID);
}
RemoveScriptInstance(item.ItemID);
m_part.RemoveScriptEvents(item.ItemID);
}
}
}
/// <summary>
@@ -244,8 +252,10 @@ namespace OpenSim.Region.Framework.Scenes
if (stateSource == 1 && // Prim crossing
m_part.ParentGroup.Scene.m_trustBinaries)
{
m_items.LockItemsForWrite(true);
m_items[item.ItemID].PermsMask = 0;
m_items[item.ItemID].PermsGranter = UUID.Zero;
m_items.LockItemsForWrite(false);
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource);
m_part.ParentGroup.AddActiveScriptCount(1);
@@ -267,8 +277,10 @@ namespace OpenSim.Region.Framework.Scenes
{
if (m_part.ParentGroup.m_savedScriptState != null)
RestoreSavedScriptState(item.OldItemID, item.ItemID);
m_items.LockItemsForWrite(true);
m_items[item.ItemID].PermsMask = 0;
m_items[item.ItemID].PermsGranter = UUID.Zero;
m_items.LockItemsForWrite(false);
string script = Utils.BytesToString(asset.Data);
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
@@ -303,14 +315,17 @@ namespace OpenSim.Region.Framework.Scenes
/// </param>
public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource)
{
lock (m_items)
m_items.LockItemsForRead(true);
if (m_items.ContainsKey(itemId))
{
if (m_items.ContainsKey(itemId))
{
m_items.LockItemsForRead(false);
CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource);
}
else
{
m_items.LockItemsForRead(false);
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}",
@@ -318,6 +333,15 @@ namespace OpenSim.Region.Framework.Scenes
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
}
}
else
{
m_items.LockItemsForRead(false);
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2}",
itemId, m_part.Name, m_part.UUID);
}
}
/// <summary>
@@ -349,11 +373,16 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns>
private bool InventoryContainsName(string name)
{
foreach (TaskInventoryItem item in Items.Values)
m_items.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_items.Values)
{
if (item.Name == name)
{
m_items.LockItemsForRead(false);
return true;
}
}
m_items.LockItemsForRead(false);
return false;
}
@@ -395,7 +424,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="item"></param>
public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
{
m_items.LockItemsForRead(true);
List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_items.Values);
m_items.LockItemsForRead(false);
foreach (TaskInventoryItem i in il)
{
if (i.Name == item.Name)
@@ -432,15 +463,14 @@ namespace OpenSim.Region.Framework.Scenes
item.ParentPartID = m_part.UUID;
item.Name = name;
lock (m_items)
{
m_items.Add(item.ItemID, item);
m_items.LockItemsForWrite(true);
m_items.Add(item.ItemID, item);
m_items.LockItemsForWrite(false);
if (allowedDrop)
m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP);
else
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
}
m_inventorySerial++;
//m_inventorySerial += 2;
@@ -457,14 +487,13 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="items"></param>
public void RestoreInventoryItems(ICollection<TaskInventoryItem> items)
{
lock (m_items)
m_items.LockItemsForWrite(true);
foreach (TaskInventoryItem item in items)
{
foreach (TaskInventoryItem item in items)
{
m_items.Add(item.ItemID, item);
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
}
m_items.Add(item.ItemID, item);
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
}
m_items.LockItemsForWrite(false);
m_inventorySerial++;
}
@@ -477,8 +506,9 @@ namespace OpenSim.Region.Framework.Scenes
public TaskInventoryItem GetInventoryItem(UUID itemId)
{
TaskInventoryItem item;
m_items.LockItemsForRead(true);
m_items.TryGetValue(itemId, out item);
m_items.LockItemsForRead(false);
return item;
}
@@ -490,46 +520,46 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>false if the item did not exist, true if the update occurred successfully</returns>
public bool UpdateInventoryItem(TaskInventoryItem item)
{
lock (m_items)
m_items.LockItemsForWrite(true);
if (m_items.ContainsKey(item.ItemID))
{
if (m_items.ContainsKey(item.ItemID))
item.ParentID = m_part.UUID;
item.ParentPartID = m_part.UUID;
item.Flags = m_items[item.ItemID].Flags;
if (item.AssetID == UUID.Zero)
{
item.ParentID = m_part.UUID;
item.ParentPartID = m_part.UUID;
item.Flags = m_items[item.ItemID].Flags;
if (item.AssetID == UUID.Zero)
{
item.AssetID = m_items[item.ItemID].AssetID;
}
else if ((InventoryType)item.Type == InventoryType.Notecard)
{
ScenePresence presence = m_part.ParentGroup.Scene.GetScenePresence(item.OwnerID);
if (presence != null)
{
presence.ControllingClient.SendAgentAlertMessage(
"Notecard saved", false);
}
}
m_items[item.ItemID] = item;
m_inventorySerial++;
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
HasInventoryChanged = true;
m_part.ParentGroup.HasGroupChanged = true;
return true;
item.AssetID = m_items[item.ItemID].AssetID;
}
else
else if ((InventoryType)item.Type == InventoryType.Notecard)
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
item.ItemID, m_part.Name, m_part.UUID,
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
ScenePresence presence = m_part.ParentGroup.Scene.GetScenePresence(item.OwnerID);
if (presence != null)
{
presence.ControllingClient.SendAgentAlertMessage(
"Notecard saved", false);
}
}
m_items[item.ItemID] = item;
m_inventorySerial++;
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
HasInventoryChanged = true;
m_part.ParentGroup.HasGroupChanged = true;
m_items.LockItemsForWrite(false);
return true;
}
else
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
item.ItemID, m_part.Name, m_part.UUID,
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
}
m_items.LockItemsForWrite(false);
return false;
}
@@ -542,52 +572,54 @@ namespace OpenSim.Region.Framework.Scenes
/// in this prim's inventory.</returns>
public int RemoveInventoryItem(UUID itemID)
{
lock (m_items)
m_items.LockItemsForRead(true);
if (m_items.ContainsKey(itemID))
{
if (m_items.ContainsKey(itemID))
int type = m_items[itemID].InvType;
m_items.LockItemsForRead(false);
if (type == 10) // Script
{
int type = m_items[itemID].InvType;
if (type == 10) // Script
{
m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
}
m_items.Remove(itemID);
m_inventorySerial++;
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
HasInventoryChanged = true;
m_part.ParentGroup.HasGroupChanged = true;
int scriptcount = 0;
lock (m_items)
{
foreach (TaskInventoryItem item in m_items.Values)
{
if (item.Type == 10)
{
scriptcount++;
}
}
}
if (scriptcount <= 0)
{
m_part.RemFlag(PrimFlags.Scripted);
}
m_part.ScheduleFullUpdate();
return type;
m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
}
else
m_items.LockItemsForWrite(true);
m_items.Remove(itemID);
m_items.LockItemsForWrite(false);
m_inventorySerial++;
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
HasInventoryChanged = true;
m_part.ParentGroup.HasGroupChanged = true;
int scriptcount = 0;
m_items.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_items.Values)
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
itemID, m_part.Name, m_part.UUID,
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
if (item.Type == 10)
{
scriptcount++;
}
}
m_items.LockItemsForRead(false);
if (scriptcount <= 0)
{
m_part.RemFlag(PrimFlags.Scripted);
}
m_part.ScheduleFullUpdate();
return type;
}
else
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Tried to remove item ID {0} from prim {1}, {2} but the item does not exist in this inventory",
itemID, m_part.Name, m_part.UUID);
}
m_items.LockItemsForWrite(false);
return -1;
}
@@ -640,52 +672,53 @@ namespace OpenSim.Region.Framework.Scenes
// isn't available (such as drag from prim inventory to agent inventory)
InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
lock (m_items)
m_items.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_items.Values)
{
foreach (TaskInventoryItem item in m_items.Values)
{
UUID ownerID = item.OwnerID;
uint everyoneMask = 0;
uint baseMask = item.BasePermissions;
uint ownerMask = item.CurrentPermissions;
UUID ownerID = item.OwnerID;
uint everyoneMask = 0;
uint baseMask = item.BasePermissions;
uint ownerMask = item.CurrentPermissions;
invString.AddItemStart();
invString.AddNameValueLine("item_id", item.ItemID.ToString());
invString.AddNameValueLine("parent_id", m_part.UUID.ToString());
invString.AddItemStart();
invString.AddNameValueLine("item_id", item.ItemID.ToString());
invString.AddNameValueLine("parent_id", m_part.UUID.ToString());
invString.AddPermissionsStart();
invString.AddPermissionsStart();
invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
invString.AddNameValueLine("group_mask", Utils.UIntToHexString(0));
invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask));
invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask));
invString.AddNameValueLine("group_mask", Utils.UIntToHexString(0));
invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask));
invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
invString.AddNameValueLine("owner_id", ownerID.ToString());
invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
invString.AddNameValueLine("owner_id", ownerID.ToString());
invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
invString.AddNameValueLine("group_id", item.GroupID.ToString());
invString.AddSectionEnd();
invString.AddNameValueLine("group_id", item.GroupID.ToString());
invString.AddSectionEnd();
invString.AddNameValueLine("asset_id", item.AssetID.ToString());
invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
invString.AddNameValueLine("asset_id", item.AssetID.ToString());
invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]);
invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]);
invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags));
invString.AddSaleStart();
invString.AddNameValueLine("sale_type", "not");
invString.AddNameValueLine("sale_price", "0");
invString.AddSectionEnd();
invString.AddSaleStart();
invString.AddNameValueLine("sale_type", "not");
invString.AddNameValueLine("sale_price", "0");
invString.AddSectionEnd();
invString.AddNameValueLine("name", item.Name + "|");
invString.AddNameValueLine("desc", item.Description + "|");
invString.AddNameValueLine("name", item.Name + "|");
invString.AddNameValueLine("desc", item.Description + "|");
invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
invString.AddSectionEnd();
}
invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
invString.AddSectionEnd();
}
int count = m_items.Count;
m_items.LockItemsForRead(false);
fileData = Utils.StringToBytes(invString.BuildString);
@@ -706,10 +739,9 @@ namespace OpenSim.Region.Framework.Scenes
{
if (HasInventoryChanged)
{
lock (Items)
{
datastore.StorePrimInventory(m_part.UUID, Items.Values);
}
Items.LockItemsForRead(true);
datastore.StorePrimInventory(m_part.UUID, Items.Values);
Items.LockItemsForRead(false);
HasInventoryChanged = false;
}

View File

@@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Scenes
// {
// m_log.Debug("[ScenePresence] Destructor called");
// }
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
@@ -89,7 +89,9 @@ namespace OpenSim.Region.Framework.Scenes
/// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis
/// issue #1716
/// </summary>
private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f);
// private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f);
// Value revised by KF 091121 by comparison with SL.
private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.418f);
public UUID currentParcelUUID = UUID.Zero;
@@ -113,7 +115,9 @@ namespace OpenSim.Region.Framework.Scenes
public Vector3 lastKnownAllowedPosition;
public bool sentMessageAboutRestrictedParcelFlyingDown;
public Vector4 CollisionPlane = Vector4.UnitW;
private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation
private Vector3 m_avUnscriptedSitPos; // for non-scripted prims
private Vector3 m_lastPosition;
private Quaternion m_lastRotation;
private Vector3 m_lastVelocity;
@@ -144,7 +148,6 @@ namespace OpenSim.Region.Framework.Scenes
private int m_perfMonMS;
private bool m_setAlwaysRun;
private bool m_forceFly;
private bool m_flyDisabled;
@@ -168,7 +171,8 @@ namespace OpenSim.Region.Framework.Scenes
protected RegionInfo m_regionInfo;
protected ulong crossingFromRegion;
private readonly Vector3[] Dir_Vectors = new Vector3[6];
private readonly Vector3[] Dir_Vectors = new Vector3[11];
private bool m_isNudging = false;
// Position of agent's camera in world (region cordinates)
protected Vector3 m_CameraCenter;
@@ -203,6 +207,9 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_followCamAuto;
private int m_movementUpdateCount;
private int m_lastColCount = -1; //KF: Look for Collision chnages
private int m_updateCount = 0; //KF: Update Anims for a while
private static readonly int UPDATE_COUNT = 10; // how many frames to update for
private const int NumMovementsBetweenRayCast = 5;
@@ -232,6 +239,10 @@ namespace OpenSim.Region.Framework.Scenes
DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG,
DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS,
DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG,
DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS,
DIR_CONTROL_FLAG_BACK_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG,
DIR_CONTROL_FLAG_LEFT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS,
DIR_CONTROL_FLAG_RIGHT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG,
DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG
}
@@ -658,9 +669,7 @@ namespace OpenSim.Region.Framework.Scenes
AdjustKnownSeeds();
// TODO: I think, this won't send anything, as we are still a child here...
Animator.TrySetMovementAnimation("STAND");
Animator.TrySetMovementAnimation("STAND");
// we created a new ScenePresence (a new child agent) in a fresh region.
// Request info about all the (root) agents in this region
// Note: This won't send data *to* other clients in that region (children don't send)
@@ -716,21 +725,47 @@ namespace OpenSim.Region.Framework.Scenes
Dir_Vectors[3] = -Vector3.UnitY; //RIGHT
Dir_Vectors[4] = Vector3.UnitZ; //UP
Dir_Vectors[5] = -Vector3.UnitZ; //DOWN
Dir_Vectors[5] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge
Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE
Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE
Dir_Vectors[8] = new Vector3(0f, 0.5f, 0f); //LEFT_NUDGE
Dir_Vectors[9] = new Vector3(0f, -0.5f, 0f); //RIGHT_NUDGE
Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge
}
private Vector3[] GetWalkDirectionVectors()
{
Vector3[] vector = new Vector3[6];
Vector3[] vector = new Vector3[11];
vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD
vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK
vector[2] = Vector3.UnitY; //LEFT
vector[3] = -Vector3.UnitY; //RIGHT
vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP
vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN
vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge
vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE
vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE
vector[8] = Vector3.UnitY; //LEFT_NUDGE
vector[9] = -Vector3.UnitY; //RIGHT_NUDGE
vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE
return vector;
}
private bool[] GetDirectionIsNudge()
{
bool[] isNudge = new bool[11];
isNudge[0] = false; //FORWARD
isNudge[1] = false; //BACK
isNudge[2] = false; //LEFT
isNudge[3] = false; //RIGHT
isNudge[4] = false; //UP
isNudge[5] = false; //DOWN
isNudge[6] = true; //FORWARD_NUDGE
isNudge[7] = true; //BACK_NUDGE
isNudge[8] = true; //LEFT_NUDGE
isNudge[9] = true; //RIGHT_NUDGE
isNudge[10] = true; //DOWN_Nudge
return isNudge;
}
#endregion
@@ -994,7 +1029,9 @@ namespace OpenSim.Region.Framework.Scenes
{
AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (1.56f / 6f));
}
m_updateCount = UPDATE_COUNT; //KF: Trigger Anim updates to catch falling anim.
ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient)));
}
@@ -1229,7 +1266,6 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(m_CameraCenter - posAdjusted), Vector3.Distance(m_CameraCenter, posAdjusted) + 0.3f, RayCastCameraCallback);
}
}
lock (scriptedcontrols)
{
if (scriptedcontrols.Count > 0)
@@ -1244,9 +1280,7 @@ namespace OpenSim.Region.Framework.Scenes
if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0)
{
// TODO: This doesn't prevent the user from walking yet.
// Setting parent ID would fix this, if we knew what value
// to use. Or we could add a m_isSitting variable.
m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.
Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
}
@@ -1261,7 +1295,6 @@ namespace OpenSim.Region.Framework.Scenes
{
return;
}
if (m_allowMovement)
{
int i = 0;
@@ -1289,6 +1322,11 @@ namespace OpenSim.Region.Framework.Scenes
update_rotation = true;
}
//guilty until proven innocent..
bool Nudging = true;
//Basically, if there is at least one non-nudge control then we don't need
//to worry about stopping the avatar
if (m_parentID == 0)
{
bool bAllowUpdateMoveToPosition = false;
@@ -1303,6 +1341,12 @@ namespace OpenSim.Region.Framework.Scenes
else
dirVectors = Dir_Vectors;
bool[] isNudge = GetDirectionIsNudge();
foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS)
{
if (((uint)flags & (uint)DCF) != 0)
@@ -1312,6 +1356,10 @@ namespace OpenSim.Region.Framework.Scenes
try
{
agent_control_v3 += dirVectors[i];
if (isNudge[i] == false)
{
Nudging = false;
}
}
catch (IndexOutOfRangeException)
{
@@ -1373,6 +1421,9 @@ namespace OpenSim.Region.Framework.Scenes
// Ignore z component of vector
Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
LocalVectorToTarget2D.Normalize();
//We're not nudging
Nudging = false;
agent_control_v3 += LocalVectorToTarget2D;
// update avatar movement flags. the avatar coordinate system is as follows:
@@ -1455,7 +1506,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat(
// "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
AddNewMovement(agent_control_v3, q);
AddNewMovement(agent_control_v3, q, Nudging);
if (update_movementflag)
Animator.UpdateMovementAnimations();
@@ -1538,7 +1589,7 @@ namespace OpenSim.Region.Framework.Scenes
Velocity = Vector3.Zero;
SendFullUpdateToAllClients();
//HandleAgentSit(ControllingClient, m_requestedSitTargetUUID);
HandleAgentSit(ControllingClient, m_requestedSitTargetUUID); //KF ??
}
//ControllingClient.SendSitResponse(m_requestedSitTargetID, m_requestedSitOffset, Quaternion.Identity, false, Vector3.Zero, Vector3.Zero, false);
m_requestedSitTargetUUID = UUID.Zero;
@@ -1576,21 +1627,19 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
if (part != null)
{
part.TaskInventory.LockItemsForRead(true);
TaskInventoryDictionary taskIDict = part.TaskInventory;
if (taskIDict != null)
{
lock (taskIDict)
foreach (UUID taskID in taskIDict.Keys)
{
foreach (UUID taskID in taskIDict.Keys)
{
UnRegisterControlEventsToScript(LocalId, taskID);
taskIDict[taskID].PermsMask &= ~(
2048 | //PERMISSION_CONTROL_CAMERA
4); // PERMISSION_TAKE_CONTROLS
}
UnRegisterControlEventsToScript(LocalId, taskID);
taskIDict[taskID].PermsMask &= ~(
2048 | //PERMISSION_CONTROL_CAMERA
4); // PERMISSION_TAKE_CONTROLS
}
}
part.TaskInventory.LockItemsForRead(false);
// Reset sit target.
if (part.GetAvatarOnSitTarget() == UUID)
part.SetAvatarOnSitTarget(UUID.Zero);
@@ -1603,9 +1652,9 @@ namespace OpenSim.Region.Framework.Scenes
{
AddToPhysicalScene(false);
}
m_pos += m_parentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight);
m_parentPosition = Vector3.Zero;
//Console.WriteLine("Stand Pos {0}", m_pos);
m_parentID = 0;
SendFullUpdateToAllClients();
@@ -1651,7 +1700,7 @@ namespace OpenSim.Region.Framework.Scenes
bool SitTargetisSet =
(!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && avSitOrientation.W == 1f &&
avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f));
// this test is probably failing
if (SitTargetisSet && SitTargetUnOccupied)
{
//switch the target to this prim
@@ -1678,7 +1727,13 @@ namespace OpenSim.Region.Framework.Scenes
{
// TODO: determine position to sit at based on scene geometry; don't trust offset from client
// see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
// part is the prim to sit on
// offset is the vector distance from that prim center to the click-spot
// UUID is the UUID of the Avatar doing the clicking
m_avInitialPos = AbsolutePosition; // saved to calculate unscripted sit rotation
// Is a sit target available?
Vector3 avSitOffSet = part.SitTargetPosition;
Quaternion avSitOrientation = part.SitTargetOrientation;
@@ -1693,21 +1748,40 @@ namespace OpenSim.Region.Framework.Scenes
|| avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 0f // Invalid Quaternion
)
));
if (SitTargetisSet && SitTargetUnOccupied)
//Console.WriteLine("SendSitResponse offset=" + offset + " UnOccup=" + SitTargetUnOccupied +
// " TargSet=" + SitTargetisSet);
// Sit analysis rewritten by KF 091125
if (SitTargetisSet) // scipted sit
{
part.SetAvatarOnSitTarget(UUID);
offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z);
sitOrientation = avSitOrientation;
autopilot = false;
}
if (SitTargetUnOccupied)
{
part.SetAvatarOnSitTarget(UUID); // set that Av will be on it
offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); // change ofset to the scripted one
sitOrientation = avSitOrientation; // Change rotatione to the scripted one
autopilot = false; // Jump direct to scripted llSitPos()
}
else return;
}
else // Not Scripted
{
if ( (Math.Abs(offset.X) > 0.5f) || (Math.Abs(offset.Y) > 0.5f) ) // large prim
{
Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
m_avUnscriptedSitPos = offset * partIRot; // sit where clicked
pos = part.AbsolutePosition + (offset * partIRot);
}
else // small prim
{
if (SitTargetUnOccupied)
{
m_avUnscriptedSitPos = Vector3.Zero; // Sit on unoccupied small prim center
pos = part.AbsolutePosition;
}
else return; // occupied small
} // end large/small
} // end Scripted/not
pos = part.AbsolutePosition + offset;
//if (Math.Abs(part.AbsolutePosition.Z - AbsolutePosition.Z) > 1)
//{
// offset = pos;
//autopilot = false;
//}
if (m_physicsActor != null)
{
// If we're not using the client autopilot, we're immediately warping the avatar to the location
@@ -1715,17 +1789,17 @@ namespace OpenSim.Region.Framework.Scenes
m_sitAvatarHeight = m_physicsActor.Size.Z;
if (autopilot)
{
{ // its not a scripted sit
if (Util.GetDistanceTo(AbsolutePosition, pos) < 4.5)
{
autopilot = false;
autopilot = false; // close enough
RemoveFromPhysicalScene();
AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight);
}
AbsolutePosition = pos + new Vector3(0.0f, 0.0f, (m_sitAvatarHeight / 2.0f)); // Warp av to Prim
} // else the autopilot will get us close
}
else
{
{ // its a scripted sit
RemoveFromPhysicalScene();
}
}
@@ -1839,29 +1913,52 @@ namespace OpenSim.Region.Framework.Scenes
{
if (part.GetAvatarOnSitTarget() == UUID)
{
// Scripted sit
Vector3 sitTargetPos = part.SitTargetPosition;
Quaternion sitTargetOrient = part.SitTargetOrientation;
//Quaternion vq = new Quaternion(sitTargetPos.X, sitTargetPos.Y+0.2f, sitTargetPos.Z+0.2f, 0);
//Quaternion nq = new Quaternion(-sitTargetOrient.X, -sitTargetOrient.Y, -sitTargetOrient.Z, sitTargetOrient.w);
//Quaternion result = (sitTargetOrient * vq) * nq;
m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z);
m_pos += SIT_TARGET_ADJUSTMENT;
m_bodyRot = sitTargetOrient;
//Rotation = sitTargetOrient;
m_parentPosition = part.AbsolutePosition;
//SendTerseUpdateToAllClients();
}
else
{
m_pos -= part.AbsolutePosition;
// Non-scripted sit by Kitto Flora 21Nov09
// Calculate angle of line from prim to Av
Vector3 sitTargetPos= part.AbsolutePosition + m_avUnscriptedSitPos;
float y_diff = (m_avInitialPos.Y - sitTargetPos.Y);
float x_diff = ( m_avInitialPos.X - sitTargetPos.X);
if(Math.Abs(x_diff) < 0.001f) x_diff = 0.001f; // avoid div by 0
if(Math.Abs(y_diff) < 0.001f) y_diff = 0.001f; // avoid pol flip at 0
float sit_angle = (float)Math.Atan2( (double)y_diff, (double)x_diff);
Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
// NOTE: when sitting m_ pos and m_bodyRot are *relative* to the prim location/rotation, not 'World'.
// Av sits at world euler <0,0, z>, translated by part rotation
m_bodyRot = partIRot * Quaternion.CreateFromEulers(0f, 0f, sit_angle); // sit at 0,0,inv-click
m_parentPosition = part.AbsolutePosition;
}
if(m_avUnscriptedSitPos != Vector3.Zero)
{ // sit where clicked on big prim
m_pos = m_avUnscriptedSitPos + (new Vector3(0.0f, 0f, 0.625f) * partIRot);
}
else
{ // sit at center of small prim
m_pos = new Vector3(0f, 0f, 0.05f) +
(new Vector3(0.0f, 0f, 0.625f) * partIRot) +
(new Vector3(0.25f, 0f, 0.0f) * m_bodyRot);
//Set up raytrace to find top surface of prim
Vector3 size = part.Scale;
float mag = 0.1f + (float)Math.Sqrt((size.X * size.X) + (size.Y * size.Y) + (size.Z * size.Z));
Vector3 start = part.AbsolutePosition + new Vector3(0f, 0f, mag);
Vector3 down = new Vector3(0f, 0f, -1f);
m_scene.PhysicsScene.RaycastWorld(
start, // Vector3 position,
down, // Vector3 direction,
mag, // float length,
SitAltitudeCallback); // retMethod
} // end small/big
} // end scripted/not
}
else
else // no Av
{
return;
}
@@ -1873,11 +1970,21 @@ namespace OpenSim.Region.Framework.Scenes
Animator.TrySetMovementAnimation(sitAnimation);
SendFullUpdateToAllClients();
// This may seem stupid, but Our Full updates don't send avatar rotation :P
// So we're also sending a terse update (which has avatar rotation)
// [Update] We do now.
//SendTerseUpdateToAllClients();
}
public void SitAltitudeCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal)
{
if(hitYN)
{
// m_pos = Av offset from prim center to make look like on center
// m_parentPosition = Actual center pos of prim
// collisionPoint = spot on prim where we want to sit
SceneObjectPart part = m_scene.GetSceneObjectPart(localid);
Vector3 offset = (collisionPoint - m_parentPosition) * Quaternion.Inverse(part.RotationOffset);
m_pos += offset;
// Console.WriteLine("m_pos={0}, offset={1} newsit={2}", m_pos, offset, newsit);
}
}
/// <summary>
/// Event handler for the 'Always run' setting on the client
@@ -1907,7 +2014,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
/// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
/// <param name="rotation">The direction in which this avatar should now face.
public void AddNewMovement(Vector3 vec, Quaternion rotation)
public void AddNewMovement(Vector3 vec, Quaternion rotation, bool Nudging)
{
if (m_isChildAgent)
{
@@ -1981,7 +2088,7 @@ namespace OpenSim.Region.Framework.Scenes
// TODO: Add the force instead of only setting it to support multiple forces per frame?
m_forceToApply = direc;
m_isNudging = Nudging;
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
}
@@ -1996,7 +2103,7 @@ namespace OpenSim.Region.Framework.Scenes
const float POSITION_TOLERANCE = 0.05f;
//const int TIME_MS_TOLERANCE = 3000;
SendPrimUpdates();
if (m_newCoarseLocations)
{
@@ -2032,6 +2139,9 @@ namespace OpenSim.Region.Framework.Scenes
CheckForBorderCrossing();
CheckForSignificantMovement(); // sends update to the modules.
}
//Sending prim updates AFTER the avatar terse updates are sent
SendPrimUpdates();
}
#endregion
@@ -2885,14 +2995,25 @@ namespace OpenSim.Region.Framework.Scenes
{
if (m_forceToApply.HasValue)
{
Vector3 force = m_forceToApply.Value;
Vector3 force = m_forceToApply.Value;
m_updateflag = true;
// movementvector = force;
Velocity = force;
m_forceToApply = null;
}
else
{
if (m_isNudging)
{
Vector3 force = Vector3.Zero;
m_updateflag = true;
Velocity = force;
m_isNudging = false;
m_updateCount = UPDATE_COUNT; //KF: Update anims to pickup "STAND"
}
}
}
public override void SetText(string text, Vector3 color, double alpha)
@@ -2942,10 +3063,15 @@ namespace OpenSim.Region.Framework.Scenes
// Event called by the physics plugin to tell the avatar about a collision.
private void PhysicsCollisionUpdate(EventArgs e)
{
if (m_updateCount > 0) //KF: Update Anims for a short period. Many Anim
{ // changes are very asynchronous.
Animator.UpdateMovementAnimations();
m_updateCount--;
}
if (e == null)
return;
//if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
// The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents(
// as of this comment the interval is set in AddToPhysicalScene
if (Animator!=null)
@@ -2956,6 +3082,12 @@ namespace OpenSim.Region.Framework.Scenes
CollisionPlane = Vector4.UnitW;
if (m_lastColCount != coldata.Count)
{
m_updateCount = 10;
m_lastColCount = coldata.Count;
}
if (coldata.Count != 0 && Animator != null)
{
switch (Animator.CurrentMovementAnimation)
@@ -3604,4 +3736,4 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
}
}

View File

@@ -101,7 +101,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests
{
throw new NotImplementedException();
}
public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID)
{
//This connector doesn't support the windlight module yet
//Return default LL windlight settings
return new RegionMeta7WindlightData();
}
public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
{
//This connector doesn't support the windlight module yet
}
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
return null;

View File

@@ -936,7 +936,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
// TODO
}
public void SendGenericMessage(string method, List<string> message)
public void SendGenericMessage(string method, List<byte[]> message)
{
}

View File

@@ -522,7 +522,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
}
public void SendGenericMessage(string method, List<string> message)
public void SendGenericMessage(string method, List<byte[]> message)
{
}

View File

@@ -303,6 +303,26 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
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)
{
}

View File

@@ -619,6 +619,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
{
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; } }
/// <summary>
/// Adds the force supplied to the Target Velocity

View File

@@ -565,6 +565,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } }
public override float PIDHoverTau { set { m_PIDHoverTau = value; } }
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 AddForce(Vector3 force, bool pushforce)
{

View File

@@ -1238,6 +1238,26 @@ namespace OpenSim.Region.Physics.BulletXPlugin
public override PIDHoverType PIDHoverType { set { return; } }
public override float PIDHoverTau { set { return; } }
public override OpenMetaverse.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)
{

View File

@@ -243,7 +243,12 @@ namespace OpenSim.Region.Physics.Manager
public abstract PIDHoverType PIDHoverType { set;}
public abstract float PIDHoverTau { set;}
// For RotLookAt
public abstract Quaternion APIDTarget { set;}
public abstract bool APIDActive { set;}
public abstract float APIDStrength { set;}
public abstract float APIDDamping { set;}
public abstract void AddForce(Vector3 force, bool pushforce);
public abstract void AddAngularForce(Vector3 force, bool pushforce);
public abstract void SetMomentum(Vector3 momentum);
@@ -476,6 +481,12 @@ namespace OpenSim.Region.Physics.Manager
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 SetMomentum(Vector3 momentum)
{

View File

@@ -1196,6 +1196,28 @@ namespace OpenSim.Region.Physics.OdePlugin
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)
{

View File

@@ -23,6 +23,19 @@
* 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.
*
* Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces
* ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised:
* ODEPrim.cs contains methods dealing with Prim editing, Prim
* characteristics and Kinetic motion.
* ODEDynamics.cs contains methods dealing with Prim Physical motion
* (dynamics) and the associated settings. Old Linear and angular
* motors for dynamic motion have been replace with MoveLinear()
* and MoveAngular(); 'Physical' is used only to switch ODE dynamic
* simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to
* switch between 'VEHICLE' parameter use and general dynamics
* settings use.
*
*/
/* Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces
@@ -120,7 +133,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// private float m_VhoverEfficiency = 0f;
private float m_VhoverTimescale = 0f;
private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height
private float m_VehicleBuoyancy = 0f; //KF: m_VehicleBuoyancy is set by VEHICLE_BUOYANCY for a vehicle.
private float m_VehicleBuoyancy = 0f; // Set by VEHICLE_BUOYANCY, for a vehicle.
// Modifies gravity. Slider between -1 (double-gravity) and 1 (full anti-gravity)
// KF: So far I have found no good method to combine a script-requested .Z velocity and gravity.
// Therefore only m_VehicleBuoyancy=1 (0g) will use the script-requested .Z velocity.
@@ -479,7 +492,7 @@ namespace OpenSim.Region.Physics.OdePlugin
Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object
m_dir *= rotq; // apply obj rotation to velocity vector
// add Gravity andBuoyancy
// add Gravity and Buoyancy
// KF: So far I have found no good method to combine a script-requested
// .Z velocity and gravity. Therefore only 0g will used script-requested
// .Z velocity. >0g (m_VehicleBuoyancy < 1) will used modified gravity only.
@@ -561,6 +574,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate
private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body
*/
//if(frcount == 0) Console.WriteLine("MoveAngular ");
// Get what the body is doing, this includes 'external' influences
d.Vector3 angularVelocity = d.BodyGetAngularVel(Body);
@@ -636,7 +650,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// Deflection section tba
// Sum velocities
m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // + bank + deflection
m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // tba: + bank + deflection
if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f))
{

View File

@@ -21,6 +21,18 @@
* 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.
*
* Revised August 26 2009 by Kitto Flora. ODEDynamics.cs replaces
* ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised:
* ODEPrim.cs contains methods dealing with Prim editing, Prim
* characteristics and Kinetic motion.
* ODEDynamics.cs contains methods dealing with Prim Physical motion
* (dynamics) and the associated settings. Old Linear and angular
* motors for dynamic motion have been replace with MoveLinear()
* and MoveAngular(); 'Physical' is used only to switch ODE dynamic
* simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to
* switch between 'VEHICLE' parameter use and general dynamics
* settings use.
*/
/*
@@ -81,7 +93,12 @@ namespace OpenSim.Region.Physics.OdePlugin
private float m_PIDTau;
private float PID_D = 35f;
private float PID_G = 25f;
private bool m_usePID;
private bool m_usePID = false;
private Quaternion m_APIDTarget = new Quaternion();
private float m_APIDStrength = 0.5f;
private float m_APIDDamping = 0.5f;
private bool m_useAPID = false;
// KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau),
// and are for non-VEHICLES only.
@@ -182,6 +199,9 @@ namespace OpenSim.Region.Physics.OdePlugin
private ODEDynamics m_vehicle;
internal int m_material = (int)Material.Wood;
private int frcount = 0; // Used to limit dynamics debug output to
public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode)
@@ -1561,9 +1581,14 @@ Console.WriteLine(" JointCreateFixed");
float fy = 0;
float fz = 0;
frcount++; // used to limit debug comment output
if (frcount > 100)
frcount = 0;
if (IsPhysical && (Body != IntPtr.Zero) && !m_isSelected && !childPrim) // KF: Only move root prims.
{
//if(frcount == 0) Console.WriteLine("Move " + m_primName + " VTyp " + m_vehicle.Type +
// " usePID=" + m_usePID + " seHover=" + m_useHoverPID + " useAPID=" + m_useAPID);
if (m_vehicle.Type != Vehicle.TYPE_NONE)
{
// 'VEHICLES' are dealt with in ODEDynamics.cs
@@ -1571,7 +1596,6 @@ Console.WriteLine(" JointCreateFixed");
}
else
{
//Console.WriteLine("Move " + m_primName);
if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009
// NON-'VEHICLES' are dealt with here
if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f))
@@ -1593,21 +1617,18 @@ Console.WriteLine(" JointCreateFixed");
//m_log.Info(m_collisionFlags.ToString());
//KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle.
// would come from SceneObjectPart.cs, public void SetBuoyancy(float fvalue) , PhysActor.Buoyancy = fvalue; ??
//KF: m_buoyancy is set by llSetBuoyancy() and is for non-vehicle.
// m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up
// gravityz multiplier = 1 - m_buoyancy
fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass;
// NB Prims in ODE are no subject to global gravity
fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; // force = acceleration * mass
if (m_usePID)
{
//Console.WriteLine("PID " + m_primName);
// KF - this is for object move? eg. llSetPos() ?
//if(frcount == 0) Console.WriteLine("PID " + m_primName);
// KF - this is for object MoveToTarget.
//if (!d.BodyIsEnabled(Body))
//d.BodySetForce(Body, 0f, 0f, 0f);
// If we're using the PID controller, then we have no gravity
//fz = (-1 * _parent_scene.gravityz) * m_mass; //KF: ?? Prims have no global gravity,so simply...
fz = 0f;
// no lock; for now it's only called from within Simulate()
@@ -1742,7 +1763,7 @@ Console.WriteLine(" JointCreateFixed");
d.BodySetPosition(Body, pos.X, pos.Y, m_targetHoverHeight);
d.BodySetLinearVel(Body, vel.X, vel.Y, 0);
d.BodyAddForce(Body, 0, 0, fz);
return;
//KF this prevents furthur motions return;
}
else
{
@@ -1751,8 +1772,46 @@ Console.WriteLine(" JointCreateFixed");
// We're flying and colliding with something
fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass);
}
}
} // end m_useHoverPID && !m_usePID
if (m_useAPID)
{
// RotLookAt, apparently overrides all other rotation sources. Inputs:
// Quaternion m_APIDTarget
// float m_APIDStrength // From SL experiments, this is the time to get there
// float m_APIDDamping // From SL experiments, this is damping, 1.0 = damped, 0.1 = wobbly
// Also in SL the mass of the object has no effect on time to get there.
// Factors:
//if(frcount == 0) Console.WriteLine("APID ");
// get present body rotation
float limit = 1.0f;
float scaler = 50f; // adjusts damping time
float RLAservo = 0f;
d.Quaternion rot = d.BodyGetQuaternion(Body);
Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W);
Quaternion rot_diff = Quaternion.Inverse(rotq) * m_APIDTarget;
float diff_angle;
Vector3 diff_axis;
rot_diff.GetAxisAngle(out diff_axis, out diff_angle);
diff_axis.Normalize();
if(diff_angle > 0.01f) // diff_angle is always +ve
{
// PhysicsVector rotforce = new PhysicsVector(diff_axis.X, diff_axis.Y, diff_axis.Z);
Vector3 rotforce = new Vector3(diff_axis.X, diff_axis.Y, diff_axis.Z);
rotforce = rotforce * rotq;
if(diff_angle > limit) diff_angle = limit; // cap the rotate rate
// RLAservo = timestep / m_APIDStrength * m_mass * scaler;
// rotforce = rotforce * RLAservo * diff_angle ;
// d.BodyAddRelTorque(Body, rotforce.X, rotforce.Y, rotforce.Z);
RLAservo = timestep / m_APIDStrength * scaler;
rotforce = rotforce * RLAservo * diff_angle ;
d.BodySetAngularVel (Body, rotforce.X, rotforce.Y, rotforce.Z);
//Console.WriteLine("axis= " + diff_axis + " angle= " + diff_angle + "servo= " + RLAservo);
}
//if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + " angle= " + diff_angle);
} // end m_useAPID
fx *= m_mass;
fy *= m_mass;
//fz *= m_mass;
@@ -2822,6 +2881,12 @@ Console.WriteLine(" JointCreateFixed");
}
public override bool PIDActive { set { m_usePID = value; } }
public override float PIDTau { set { m_PIDTau = value; } }
// For RotLookAt
public override Quaternion APIDTarget { set { m_APIDTarget = value; } }
public override bool APIDActive { set { m_useAPID = value; } }
public override float APIDStrength { set { m_APIDStrength = value; } }
public override float APIDDamping { set { m_APIDDamping = value; } }
public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } }
public override bool PIDHoverActive { set { m_useHoverPID = value; } }

View File

@@ -304,6 +304,27 @@ namespace OpenSim.Region.Physics.POSPlugin
{
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)
{

View File

@@ -299,6 +299,26 @@ namespace OpenSim.Region.Physics.POSPlugin
{
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)
{

View File

@@ -498,6 +498,28 @@ namespace OpenSim.Region.Physics.PhysXPlugin
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)
{
@@ -780,6 +802,28 @@ namespace OpenSim.Region.Physics.PhysXPlugin
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)
{

View File

@@ -28,6 +28,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics; //for [DebuggerNonUserCode]
using System.Runtime.Remoting.Lifetime;
using System.Text;
using System.Threading;
@@ -151,6 +152,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
get { return m_ScriptEngine.World; }
}
[DebuggerNonUserCode]
public void state(string newState)
{
m_ScriptEngine.SetState(m_itemID, newState);
@@ -160,6 +162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// Reset the named script. The script must be present
/// in the same prim.
/// </summary>
[DebuggerNonUserCode]
public void llResetScript()
{
m_host.AddScriptLPS(1);
@@ -272,40 +275,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected UUID InventorySelf()
{
UUID invItemID = new UUID();
lock (m_host.TaskInventory)
bool unlock = false;
if (!m_host.TaskInventory.IsReadLockedByMe())
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
unlock = true;
}
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
{
if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
{
invItemID = inv.Key;
break;
}
invItemID = inv.Key;
break;
}
}
if (unlock)
{
m_host.TaskInventory.LockItemsForRead(false);
}
return invItemID;
}
protected UUID InventoryKey(string name, int type)
{
m_host.AddScriptLPS(1);
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
if (inv.Value.Name == name)
{
if (inv.Value.Name == name)
m_host.TaskInventory.LockItemsForRead(false);
if (inv.Value.Type != type)
{
if (inv.Value.Type != type)
return UUID.Zero;
return inv.Value.AssetID;
return UUID.Zero;
}
return inv.Value.AssetID;
}
}
m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero;
}
@@ -313,17 +324,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
if (inv.Value.Name == name)
{
if (inv.Value.Name == name)
{
return inv.Value.AssetID;
}
m_host.TaskInventory.LockItemsForRead(false);
return inv.Value.AssetID;
}
}
m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero;
}
@@ -2555,12 +2570,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
m_host.TaskInventory.LockItemsForRead(true);
TaskInventoryItem item = m_host.TaskInventory[invItemID];
lock (m_host.TaskInventory)
{
item = m_host.TaskInventory[invItemID];
}
m_host.TaskInventory.LockItemsForRead(false);
if (item.PermsGranter == UUID.Zero)
return 0;
@@ -2635,6 +2647,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (dist > m_ScriptDistanceFactor * 10.0f)
return;
//Clone is thread-safe
TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
@@ -2720,11 +2733,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Orient the object to the angle calculated
llSetRot(rot);
}
public void llRotLookAt(LSL_Rotation target, double strength, double damping)
{
m_host.AddScriptLPS(1);
// NotImplemented("llRotLookAt");
m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping);
}
public void llStopLookAt()
{
m_host.AddScriptLPS(1);
NotImplemented("llStopLookAt");
// NotImplemented("llStopLookAt");
m_host.StopLookAt();
}
public void llSetTimerEvent(double sec)
@@ -2758,13 +2781,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
TaskInventoryItem item;
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
{
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
return;
else
item = m_host.TaskInventory[InventorySelf()];
m_host.TaskInventory.LockItemsForRead(false);
return;
}
else
{
item = m_host.TaskInventory[InventorySelf()];
}
m_host.TaskInventory.LockItemsForRead(false);
if (item.PermsGranter != UUID.Zero)
{
@@ -2786,13 +2813,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
TaskInventoryItem item;
m_host.TaskInventory.LockItemsForRead(true);
lock (m_host.TaskInventory)
{
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
{
m_host.TaskInventory.LockItemsForRead(false);
return;
}
else
{
item = m_host.TaskInventory[InventorySelf()];
}
}
m_host.TaskInventory.LockItemsForRead(false);
m_host.AddScriptLPS(1);
@@ -2829,13 +2864,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
TaskInventoryItem item;
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
{
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
return;
else
item = m_host.TaskInventory[InventorySelf()];
m_host.TaskInventory.LockItemsForRead(false);
return;
}
else
{
item = m_host.TaskInventory[InventorySelf()];
}
m_host.TaskInventory.LockItemsForRead(false);
if (item.PermsGranter != m_host.OwnerID)
return;
@@ -2861,13 +2902,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
TaskInventoryItem item;
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
{
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
return;
else
item = m_host.TaskInventory[InventorySelf()];
m_host.TaskInventory.LockItemsForRead(false);
return;
}
else
{
item = m_host.TaskInventory[InventorySelf()];
}
m_host.TaskInventory.LockItemsForRead(false);
if (item.PermsGranter != m_host.OwnerID)
return;
@@ -2903,8 +2950,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return m_host.OwnerID.ToString();
}
[DebuggerNonUserCode]
public void llInstantMessage(string user, string message)
{
UUID result;
if (!UUID.TryParse(user, out result))
{
throw new Exception(String.Format("An invalid key of '{0} was passed to llInstantMessage", user));
return;
}
m_host.AddScriptLPS(1);
// We may be able to use ClientView.SendInstantMessage here, but we need a client instance.
@@ -2919,7 +2975,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID friendTransactionID = UUID.Random();
//m_pendingFriendRequests.Add(friendTransactionID, fromAgentID);
GridInstantMessage msg = new GridInstantMessage();
msg.fromAgentID = new Guid(m_host.UUID.ToString()); // fromAgentID.Guid;
msg.toAgentID = new Guid(user); // toAgentID.Guid;
@@ -3068,12 +3124,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
}
public void llRotLookAt(LSL_Rotation target, double strength, double damping)
{
m_host.AddScriptLPS(1);
NotImplemented("llRotLookAt");
}
public LSL_Integer llStringLength(string str)
{
m_host.AddScriptLPS(1);
@@ -3097,14 +3147,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
TaskInventoryItem item;
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
{
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
return;
else
item = m_host.TaskInventory[InventorySelf()];
m_host.TaskInventory.LockItemsForRead(false);
return;
}
else
{
item = m_host.TaskInventory[InventorySelf()];
}
m_host.TaskInventory.LockItemsForRead(false);
if (item.PermsGranter == UUID.Zero)
return;
@@ -3134,13 +3187,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
TaskInventoryItem item;
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
{
if (!m_host.TaskInventory.ContainsKey(InventorySelf()))
return;
else
item = m_host.TaskInventory[InventorySelf()];
m_host.TaskInventory.LockItemsForRead(false);
return;
}
else
{
item = m_host.TaskInventory[InventorySelf()];
}
m_host.TaskInventory.LockItemsForRead(false);
if (item.PermsGranter == UUID.Zero)
return;
@@ -3213,10 +3271,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
TaskInventoryItem item;
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
if (!m_host.TaskInventory.ContainsKey(invItemID))
{
m_host.TaskInventory.LockItemsForRead(false);
return;
}
else
{
item = m_host.TaskInventory[invItemID];
}
m_host.TaskInventory.LockItemsForRead(false);
if (agentID == UUID.Zero || perm == 0) // Releasing permissions
{
@@ -3248,11 +3314,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
{
lock (m_host.TaskInventory)
{
m_host.TaskInventory[invItemID].PermsGranter = agentID;
m_host.TaskInventory[invItemID].PermsMask = perm;
}
m_host.TaskInventory.LockItemsForWrite(true);
m_host.TaskInventory[invItemID].PermsGranter = agentID;
m_host.TaskInventory[invItemID].PermsMask = perm;
m_host.TaskInventory.LockItemsForWrite(false);
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
"run_time_permissions", new Object[] {
@@ -3272,11 +3337,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
{
lock (m_host.TaskInventory)
{
m_host.TaskInventory[invItemID].PermsGranter = agentID;
m_host.TaskInventory[invItemID].PermsMask = perm;
}
m_host.TaskInventory.LockItemsForWrite(true);
m_host.TaskInventory[invItemID].PermsGranter = agentID;
m_host.TaskInventory[invItemID].PermsMask = perm;
m_host.TaskInventory.LockItemsForWrite(false);
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
"run_time_permissions", new Object[] {
@@ -3297,11 +3361,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!m_waitingForScriptAnswer)
{
lock (m_host.TaskInventory)
{
m_host.TaskInventory[invItemID].PermsGranter = agentID;
m_host.TaskInventory[invItemID].PermsMask = 0;
}
m_host.TaskInventory.LockItemsForWrite(true);
m_host.TaskInventory[invItemID].PermsGranter = agentID;
m_host.TaskInventory[invItemID].PermsMask = 0;
m_host.TaskInventory.LockItemsForWrite(false);
presence.ControllingClient.OnScriptAnswer += handleScriptAnswer;
m_waitingForScriptAnswer=true;
@@ -3336,10 +3399,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if ((answer & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
llReleaseControls();
lock (m_host.TaskInventory)
{
m_host.TaskInventory[invItemID].PermsMask = answer;
}
m_host.TaskInventory.LockItemsForWrite(true);
m_host.TaskInventory[invItemID].PermsMask = answer;
m_host.TaskInventory.LockItemsForWrite(false);
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams(
"run_time_permissions", new Object[] {
@@ -3351,16 +3415,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
if (item.Type == 10 && item.ItemID == m_itemID)
{
if (item.Type == 10 && item.ItemID == m_itemID)
{
return item.PermsGranter.ToString();
}
m_host.TaskInventory.LockItemsForRead(false);
return item.PermsGranter.ToString();
}
}
m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero.ToString();
}
@@ -3369,19 +3434,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
if (item.Type == 10 && item.ItemID == m_itemID)
{
if (item.Type == 10 && item.ItemID == m_itemID)
{
int perms = item.PermsMask;
if (m_automaticLinkPermission)
perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
return perms;
}
int perms = item.PermsMask;
if (m_automaticLinkPermission)
perms |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
m_host.TaskInventory.LockItemsForRead(false);
return perms;
}
}
m_host.TaskInventory.LockItemsForRead(false);
return 0;
}
@@ -3414,11 +3480,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID invItemID = InventorySelf();
TaskInventoryItem item;
lock (m_host.TaskInventory)
{
item = m_host.TaskInventory[invItemID];
}
m_host.TaskInventory.LockItemsForRead(true);
item = m_host.TaskInventory[invItemID];
m_host.TaskInventory.LockItemsForRead(false);
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
{
@@ -3471,16 +3536,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
UUID invItemID = InventorySelf();
lock (m_host.TaskInventory)
{
m_host.TaskInventory.LockItemsForRead(true);
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
{
ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
m_host.TaskInventory.LockItemsForRead(false);
return;
}
}
m_host.TaskInventory.LockItemsForRead(false);
if (linknum < ScriptBaseClass.LINK_THIS)
return;
@@ -3657,17 +3722,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
int count = 0;
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
if (inv.Value.Type == type || type == -1)
{
if (inv.Value.Type == type || type == -1)
{
count = count + 1;
}
count = count + 1;
}
}
m_host.TaskInventory.LockItemsForRead(false);
return count;
}
@@ -3676,16 +3740,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
ArrayList keys = new ArrayList();
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
if (inv.Value.Type == type || type == -1)
{
if (inv.Value.Type == type || type == -1)
{
keys.Add(inv.Value.Name);
}
keys.Add(inv.Value.Name);
}
}
m_host.TaskInventory.LockItemsForRead(false);
if (keys.Count == 0)
{
@@ -3722,20 +3785,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
// move the first object found with this inventory name
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
if (inv.Value.Name == inventory)
{
if (inv.Value.Name == inventory)
{
found = true;
objId = inv.Key;
assetType = inv.Value.Type;
objName = inv.Value.Name;
break;
}
found = true;
objId = inv.Key;
assetType = inv.Value.Type;
objName = inv.Value.Name;
break;
}
}
m_host.TaskInventory.LockItemsForRead(false);
if (!found)
{
@@ -3780,24 +3842,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(3000);
}
[DebuggerNonUserCode]
public void llRemoveInventory(string name)
{
m_host.AddScriptLPS(1);
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
if (item.Name == name)
{
if (item.Name == name)
{
if (item.ItemID == m_itemID)
throw new ScriptDeleteException();
else
m_host.Inventory.RemoveInventoryItem(item.ItemID);
return;
}
if (item.ItemID == m_itemID)
throw new ScriptDeleteException();
else
m_host.Inventory.RemoveInventoryItem(item.ItemID);
m_host.TaskInventory.LockItemsForRead(false);
return;
}
}
m_host.TaskInventory.LockItemsForRead(false);
}
public void llSetText(string text, LSL_Vector color, double alpha)
@@ -3886,6 +3950,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
//Clone is thread safe
TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
foreach (TaskInventoryItem item in itemDictionary.Values)
@@ -3976,17 +4041,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID soundId = UUID.Zero;
if (!UUID.TryParse(impact_sound, out soundId))
{
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
if (item.Type == (int)AssetType.Sound && item.Name == impact_sound)
{
if (item.Type == (int)AssetType.Sound && item.Name == impact_sound)
{
soundId = item.AssetID;
break;
}
soundId = item.AssetID;
break;
}
}
m_host.TaskInventory.LockItemsForRead(false);
}
m_host.CollisionSound = soundId;
m_host.CollisionSoundVolume = (float)impact_volume;
@@ -4032,6 +4096,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID partItemID;
foreach (SceneObjectPart part in parts)
{
//Clone is thread safe
TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
foreach (TaskInventoryItem item in itemsDictionary.Values)
@@ -4239,17 +4304,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
if (item.Type == 10 && item.ItemID == m_itemID)
{
if (item.Type == 10 && item.ItemID == m_itemID)
{
result = item.Name!=null?item.Name:String.Empty;
break;
}
result = item.Name!=null?item.Name:String.Empty;
break;
}
}
m_host.TaskInventory.LockItemsForRead(false);
return result;
}
@@ -4507,23 +4571,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
if (inv.Value.Name == name)
{
if (inv.Value.Name == name)
if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
{
if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
{
return inv.Value.AssetID.ToString();
}
else
{
return UUID.Zero.ToString();
}
m_host.TaskInventory.LockItemsForRead(false);
return inv.Value.AssetID.ToString();
}
else
{
m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero.ToString();
}
}
}
m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero.ToString();
}
@@ -6019,14 +6084,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected UUID GetTaskInventoryItem(string name)
{
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
if (inv.Value.Name == name)
{
if (inv.Value.Name == name)
return inv.Key;
m_host.TaskInventory.LockItemsForRead(false);
return inv.Key;
}
}
m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero;
}
@@ -6337,22 +6404,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
// copy the first script found with this inventory name
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
if (inv.Value.Name == name)
{
if (inv.Value.Name == name)
// make sure the object is a script
if (10 == inv.Value.Type)
{
// make sure the object is a script
if (10 == inv.Value.Type)
{
found = true;
srcId = inv.Key;
break;
}
found = true;
srcId = inv.Key;
break;
}
}
}
m_host.TaskInventory.LockItemsForRead(false);
if (!found)
{
@@ -8155,28 +8221,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
if (inv.Value.Name == item)
{
if (inv.Value.Name == item)
m_host.TaskInventory.LockItemsForRead(false);
switch (mask)
{
switch (mask)
{
case 0:
return (int)inv.Value.BasePermissions;
case 1:
return (int)inv.Value.CurrentPermissions;
case 2:
return (int)inv.Value.GroupPermissions;
case 3:
return (int)inv.Value.EveryonePermissions;
case 4:
return (int)inv.Value.NextPermissions;
}
case 0:
return (int)inv.Value.BasePermissions;
case 1:
return (int)inv.Value.CurrentPermissions;
case 2:
return (int)inv.Value.GroupPermissions;
case 3:
return (int)inv.Value.EveryonePermissions;
case 4:
return (int)inv.Value.NextPermissions;
}
}
}
m_host.TaskInventory.LockItemsForRead(false);
return -1;
}
@@ -8191,16 +8257,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
if (inv.Value.Name == item)
{
if (inv.Value.Name == item)
{
return inv.Value.CreatorID.ToString();
}
m_host.TaskInventory.LockItemsForRead(false);
return inv.Value.CreatorID.ToString();
}
}
m_host.TaskInventory.LockItemsForRead(false);
llSay(0, "No item name '" + item + "'");
@@ -8724,16 +8790,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
if (inv.Value.Name == name)
{
if (inv.Value.Name == name)
{
return inv.Value.Type;
}
m_host.TaskInventory.LockItemsForRead(false);
return inv.Value.Type;
}
}
m_host.TaskInventory.LockItemsForRead(false);
return -1;
}
@@ -8764,18 +8830,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (invItemID == UUID.Zero)
return new LSL_Vector();
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
{
if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
return new LSL_Vector();
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
{
ShoutError("No permissions to track the camera");
return new LSL_Vector();
}
m_host.TaskInventory.LockItemsForRead(false);
return new LSL_Vector();
}
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
{
ShoutError("No permissions to track the camera");
m_host.TaskInventory.LockItemsForRead(false);
return new LSL_Vector();
}
m_host.TaskInventory.LockItemsForRead(false);
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
if (presence != null)
{
@@ -8792,17 +8861,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (invItemID == UUID.Zero)
return new LSL_Rotation();
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
{
if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
return new LSL_Rotation();
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
{
ShoutError("No permissions to track the camera");
return new LSL_Rotation();
}
m_host.TaskInventory.LockItemsForRead(false);
return new LSL_Rotation();
}
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
{
ShoutError("No permissions to track the camera");
m_host.TaskInventory.LockItemsForRead(false);
return new LSL_Rotation();
}
m_host.TaskInventory.LockItemsForRead(false);
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
if (presence != null)
@@ -8952,14 +9023,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (objectID == UUID.Zero) return;
UUID agentID;
lock (m_host.TaskInventory)
{
// we need the permission first, to know which avatar we want to set the camera for
agentID = m_host.TaskInventory[invItemID].PermsGranter;
m_host.TaskInventory.LockItemsForRead(true);
// we need the permission first, to know which avatar we want to set the camera for
agentID = m_host.TaskInventory[invItemID].PermsGranter;
if (agentID == UUID.Zero) return;
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
if (agentID == UUID.Zero)
{
m_host.TaskInventory.LockItemsForRead(false);
return;
}
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
{
m_host.TaskInventory.LockItemsForRead(false);
return;
}
m_host.TaskInventory.LockItemsForRead(false);
ScenePresence presence = World.GetScenePresence(agentID);
@@ -9009,12 +9087,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// we need the permission first, to know which avatar we want to clear the camera for
UUID agentID;
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
agentID = m_host.TaskInventory[invItemID].PermsGranter;
if (agentID == UUID.Zero)
{
agentID = m_host.TaskInventory[invItemID].PermsGranter;
if (agentID == UUID.Zero) return;
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0) return;
m_host.TaskInventory.LockItemsForRead(false);
return;
}
if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CONTROL_CAMERA) == 0)
{
m_host.TaskInventory.LockItemsForRead(false);
return;
}
m_host.TaskInventory.LockItemsForRead(false);
ScenePresence presence = World.GetScenePresence(agentID);
@@ -9471,15 +9556,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
internal UUID ScriptByName(string name)
{
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
if (item.Type == 10 && item.Name == name)
{
if (item.Type == 10 && item.Name == name)
return item.ItemID;
m_host.TaskInventory.LockItemsForRead(false);
return item.ItemID;
}
}
m_host.TaskInventory.LockItemsForRead(false);
return UUID.Zero;
}
@@ -9520,6 +9609,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
//Clone is thread safe
TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
UUID assetID = UUID.Zero;
@@ -9582,6 +9672,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
//Clone is thread safe
TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
UUID assetID = UUID.Zero;

View File

@@ -42,6 +42,7 @@ using OpenSim.Region.CoreModules.Avatar.NPC;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Hypergrid;
using OpenSim.Region.CoreModules.World.Meta7Windlight;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
@@ -728,18 +729,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (target != null)
{
UUID animID=UUID.Zero;
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
if (inv.Value.Name == animation)
{
if (inv.Value.Name == animation)
{
if (inv.Value.Type == (int)AssetType.Animation)
animID = inv.Value.AssetID;
continue;
}
if (inv.Value.Type == (int)AssetType.Animation)
animID = inv.Value.AssetID;
continue;
}
}
m_host.TaskInventory.LockItemsForRead(false);
if (animID == UUID.Zero)
target.Animator.AddAnimation(animation, m_host.UUID);
else
@@ -761,18 +761,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (target != null)
{
UUID animID=UUID.Zero;
lock (m_host.TaskInventory)
m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
if (inv.Value.Name == animation)
{
if (inv.Value.Name == animation)
{
if (inv.Value.Type == (int)AssetType.Animation)
animID = inv.Value.AssetID;
continue;
}
if (inv.Value.Type == (int)AssetType.Animation)
animID = inv.Value.AssetID;
continue;
}
}
m_host.TaskInventory.LockItemsForRead(false);
if (animID == UUID.Zero)
target.Animator.RemoveAnimation(animation);
@@ -1541,6 +1540,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(name, out assetID))
{
m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
if (item.Type == 7 && item.Name == name)
@@ -1548,6 +1548,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
assetID = item.AssetID;
}
}
m_host.TaskInventory.LockItemsForRead(false);
}
if (assetID == UUID.Zero)
@@ -1594,6 +1595,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(name, out assetID))
{
m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
if (item.Type == 7 && item.Name == name)
@@ -1601,6 +1603,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
assetID = item.AssetID;
}
}
m_host.TaskInventory.LockItemsForRead(false);
}
if (assetID == UUID.Zero)
@@ -1651,6 +1654,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(name, out assetID))
{
m_host.TaskInventory.LockItemsForRead(true);
foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{
if (item.Type == 7 && item.Name == name)
@@ -1658,6 +1662,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
assetID = item.AssetID;
}
}
m_host.TaskInventory.LockItemsForRead(false);
}
if (assetID == UUID.Zero)
@@ -1970,5 +1975,337 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return ret;
}
/// <summary>
/// Get the current Windlight scene
/// </summary>
/// <returns>List of windlight parameters</returns>
public LSL_List osGetWindlightScene(LSL_List rules)
{
CheckThreatLevel(ThreatLevel.Low, "osGetWindlightScene");
m_host.AddScriptLPS(1);
RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
LSL_List values = new LSL_List();
int idx = 0;
while (idx < rules.Length)
{
uint rule = (uint)rules.GetLSLIntegerItem(idx);
LSL_List toadd = new LSL_List();
switch (rule)
{
case (int)ScriptBaseClass.WL_AMBIENT:
toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W));
break;
case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f));
break;
case (int)ScriptBaseClass.WL_BLUE_DENSITY:
toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W));
break;
case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
toadd.Add(new LSL_Float(wl.blurMultiplier));
break;
case (int)ScriptBaseClass.WL_CLOUD_COLOR:
toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W));
break;
case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
toadd.Add(new LSL_Float(wl.cloudCoverage));
break;
case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z));
break;
case (int)ScriptBaseClass.WL_CLOUD_SCALE:
toadd.Add(new LSL_Float(wl.cloudScale));
break;
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
toadd.Add(new LSL_Float(wl.cloudScrollX));
break;
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0));
break;
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
toadd.Add(new LSL_Float(wl.cloudScrollY));
break;
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0));
break;
case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z));
break;
case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
toadd.Add(new LSL_Float(wl.densityMultiplier));
break;
case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
toadd.Add(new LSL_Float(wl.distanceMultiplier));
break;
case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0));
break;
case (int)ScriptBaseClass.WL_EAST_ANGLE:
toadd.Add(new LSL_Float(wl.eastAngle));
break;
case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
toadd.Add(new LSL_Float(wl.fresnelOffset));
break;
case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
toadd.Add(new LSL_Float(wl.fresnelScale));
break;
case (int)ScriptBaseClass.WL_HAZE_DENSITY:
toadd.Add(new LSL_Float(wl.hazeDensity));
break;
case (int)ScriptBaseClass.WL_HAZE_HORIZON:
toadd.Add(new LSL_Float(wl.hazeHorizon));
break;
case (int)ScriptBaseClass.WL_HORIZON:
toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W));
break;
case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f));
break;
case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
toadd.Add(new LSL_Integer(wl.maxAltitude));
break;
case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
toadd.Add(new LSL_Key(wl.normalMapTexture.ToString()));
break;
case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z));
break;
case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
toadd.Add(new LSL_Float(wl.refractScaleAbove));
break;
case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
toadd.Add(new LSL_Float(wl.refractScaleBelow));
break;
case (int)ScriptBaseClass.WL_SCENE_GAMMA:
toadd.Add(new LSL_Float(wl.sceneGamma));
break;
case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
toadd.Add(new LSL_Float(wl.starBrightness));
break;
case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
toadd.Add(new LSL_Float(wl.sunGlowFocus));
break;
case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
toadd.Add(new LSL_Float(wl.sunGlowSize));
break;
case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W));
break;
case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
toadd.Add(new LSL_Float(wl.underwaterFogModifier));
break;
case (int)ScriptBaseClass.WL_WATER_COLOR:
toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z));
break;
case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
toadd.Add(new LSL_Float(wl.waterFogDensityExponent));
break;
}
if (toadd.Length > 0)
{
values.Add(rule);
values.Add(toadd.Data[0]);
}
idx++;
}
return values;
}
/// <summary>
/// Set the current Windlight scene
/// </summary>
/// <param name="rules"></param>
/// <returns>success: true or false</returns>
public int osSetWindlightScene(LSL_List rules)
{
CheckThreatLevel(ThreatLevel.High, "osSetWindlightScene");
int success = 0;
m_host.AddScriptLPS(1);
if (Meta7WindlightModule.EnableWindlight)
{
RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
LSL_List values = new LSL_List();
int idx = 0;
success = 1;
while (idx < rules.Length)
{
uint rule = (uint)rules.GetLSLIntegerItem(idx);
LSL_Types.Quaternion iQ;
LSL_Types.Vector3 iV;
switch (rule)
{
case (int)ScriptBaseClass.WL_AMBIENT:
idx++;
iQ = rules.GetQuaternionItem(idx);
wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
break;
case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
idx++;
iV = rules.GetVector3Item(idx);
wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
break;
case (int)ScriptBaseClass.WL_BLUE_DENSITY:
idx++;
iQ = rules.GetQuaternionItem(idx);
wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
break;
case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
idx++;
wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_CLOUD_COLOR:
idx++;
iQ = rules.GetQuaternionItem(idx);
wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
break;
case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
idx++;
wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
idx++;
iV = rules.GetVector3Item(idx);
wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
break;
case (int)ScriptBaseClass.WL_CLOUD_SCALE:
idx++;
wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
idx++;
wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
idx++;
wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
break;
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
idx++;
wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
idx++;
wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
break;
case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
idx++;
iV = rules.GetVector3Item(idx);
wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
break;
case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
idx++;
wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
idx++;
wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
idx++;
wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
break;
case (int)ScriptBaseClass.WL_EAST_ANGLE:
idx++;
wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
idx++;
wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
idx++;
wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_HAZE_DENSITY:
idx++;
wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_HAZE_HORIZON:
idx++;
wl.hazeHorizon= (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_HORIZON:
idx++;
iQ = rules.GetQuaternionItem(idx);
wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
break;
case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
idx++;
iV = rules.GetVector3Item(idx);
wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
break;
case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
idx++;
wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
break;
case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
idx++;
wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
break;
case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
idx++;
iV = rules.GetVector3Item(idx);
wl.reflectionWaveletScale= new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
break;
case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
idx++;
wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
idx++;
wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_SCENE_GAMMA:
idx++;
wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
idx++;
wl.starBrightness= (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
idx++;
wl.sunGlowFocus= (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
idx++;
wl.sunGlowSize= (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
idx++;
iQ = rules.GetQuaternionItem(idx);
wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
break;
case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
idx++;
wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
break;
case (int)ScriptBaseClass.WL_WATER_COLOR:
idx++;
iV = rules.GetVector3Item(idx);
wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
break;
case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
idx++;
wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
break;
default:
success = 0;
break;
}
idx++;
}
m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
}
return success;
}
}
}

View File

@@ -80,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
// Avatar Info Commands
string osGetAgentIP(string agent);
LSL_List osGetAgents();
// Teleport commands
void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
@@ -163,5 +163,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
key osGetMapTexture();
key osGetRegionMapTexture(string regionName);
LSL_List osGetRegionStats();
// Windlight Functions
LSL_List osGetWindlightScene(LSL_List rules);
int osSetWindlightScene(LSL_List rules);
}
}

View File

@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics; //for [DebuggerNonUserCode]
using System.Reflection;
using System.Runtime.Remoting.Lifetime;
using OpenSim.Region.ScriptEngine.Shared;
@@ -131,6 +132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return (eventFlags);
}
[DebuggerNonUserCode]
public void ExecuteEvent(string state, string FunctionName, object[] args)
{
// IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.

View File

@@ -539,5 +539,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int STATS_ACTIVE_SCRIPTS = 19;
public const int STATS_SCRIPT_LPS = 20;
// Constants for osWindlight*
public const int WL_WATER_COLOR = 0;
public const int WL_WATER_FOG_DENSITY_EXPONENT = 1;
public const int WL_UNDERWATER_FOG_MODIFIER = 2;
public const int WL_REFLECTION_WAVELET_SCALE = 3;
public const int WL_FRESNEL_SCALE = 4;
public const int WL_FRESNEL_OFFSET = 5;
public const int WL_REFRACT_SCALE_ABOVE = 6;
public const int WL_REFRACT_SCALE_BELOW = 7;
public const int WL_BLUR_MULTIPLIER = 8;
public const int WL_BIG_WAVE_DIRECTION = 9;
public const int WL_LITTLE_WAVE_DIRECTION = 10;
public const int WL_NORMAL_MAP_TEXTURE = 11;
public const int WL_HORIZON = 12;
public const int WL_HAZE_HORIZON = 13;
public const int WL_BLUE_DENSITY = 14;
public const int WL_HAZE_DENSITY = 15;
public const int WL_DENSITY_MULTIPLIER = 16;
public const int WL_DISTANCE_MULTIPLIER = 17;
public const int WL_MAX_ALTITUDE = 18;
public const int WL_SUN_MOON_COLOR = 19;
public const int WL_AMBIENT = 20;
public const int WL_EAST_ANGLE = 21;
public const int WL_SUN_GLOW_FOCUS = 22;
public const int WL_SUN_GLOW_SIZE = 23;
public const int WL_SCENE_GAMMA = 24;
public const int WL_STAR_BRIGHTNESS = 25;
public const int WL_CLOUD_COLOR = 26;
public const int WL_CLOUD_XY_DENSITY = 27;
public const int WL_CLOUD_COVERAGE = 28;
public const int WL_CLOUD_SCALE = 29;
public const int WL_CLOUD_DETAIL_XY_DENSITY = 30;
public const int WL_CLOUD_SCROLL_X = 31;
public const int WL_CLOUD_SCROLL_Y = 32;
public const int WL_CLOUD_SCROLL_Y_LOCK = 33;
public const int WL_CLOUD_SCROLL_X_LOCK = 34;
public const int WL_DRAW_CLASSIC_CLOUDS = 35;
}
}

View File

@@ -637,5 +637,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_OSSL_Functions.osGetRegionStats();
}
public LSL_List osGetWindlightScene(LSL_List rules)
{
return m_OSSL_Functions.osGetWindlightScene(rules);
}
public int osSetWindlightScene(LSL_List rules)
{
return m_OSSL_Functions.osSetWindlightScene(rules);
}
}
}

View File

@@ -33,6 +33,7 @@ using System.Threading;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics; //for [DebuggerNonUserCode]
using OpenSim.Region.ScriptEngine.Interfaces;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api.Runtime;
@@ -90,6 +91,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return (int)m_Executor.GetStateEventFlags(state);
}
[DebuggerNonUserCode]
public void ExecuteEvent(string state, string FunctionName, object[] args)
{
m_Executor.ExecuteEvent(state, FunctionName, args);

View File

@@ -27,6 +27,7 @@
using System;
using System.IO;
using System.Diagnostics; //for [DebuggerNonUserCode]
using System.Runtime.Remoting;
using System.Runtime.Remoting.Lifetime;
using System.Threading;
@@ -237,13 +238,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (part != null)
{
lock (part.TaskInventory)
part.TaskInventory.LockItemsForRead(true);
if (part.TaskInventory.ContainsKey(m_ItemID))
{
if (part.TaskInventory.ContainsKey(m_ItemID))
{
m_thisScriptTask = part.TaskInventory[m_ItemID];
}
m_thisScriptTask = part.TaskInventory[m_ItemID];
}
part.TaskInventory.LockItemsForRead(false);
}
ApiManager am = new ApiManager();
@@ -428,14 +428,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
int permsMask;
UUID permsGranter;
lock (part.TaskInventory)
part.TaskInventory.LockItemsForRead(true);
if (!part.TaskInventory.ContainsKey(m_ItemID))
{
if (!part.TaskInventory.ContainsKey(m_ItemID))
return;
permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
permsMask = part.TaskInventory[m_ItemID].PermsMask;
part.TaskInventory.LockItemsForRead(false);
return;
}
permsGranter = part.TaskInventory[m_ItemID].PermsGranter;
permsMask = part.TaskInventory[m_ItemID].PermsMask;
part.TaskInventory.LockItemsForRead(false);
if ((permsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
{
@@ -544,6 +545,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
return true;
}
[DebuggerNonUserCode] //Prevents the debugger from farting in this function
public void SetState(string state)
{
if (state == State)
@@ -555,7 +557,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
new DetectParams[0]));
PostEvent(new EventParams("state_entry", new Object[0],
new DetectParams[0]));
throw new EventAbortException();
}
@@ -637,140 +639,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
/// </summary>
/// <returns></returns>
public object EventProcessor()
{
EventParams data = null;
lock (m_EventQueue)
{
lock (m_Script)
{
EventParams data = null;
lock (m_EventQueue)
{
data = (EventParams) m_EventQueue.Dequeue();
if (data == null) // Shouldn't happen
{
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
{
m_CurrentResult = m_Engine.QueueEventHandler(this);
}
else
{
m_CurrentResult = null;
}
return 0;
}
if (data.EventName == "timer")
m_TimerQueued = false;
if (data.EventName == "control")
{
if (m_ControlEventsInQueue > 0)
m_ControlEventsInQueue--;
}
if (data.EventName == "collision")
m_CollisionInQueue = false;
}
//m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this);
m_DetectParams = data.DetectParams;
if (data.EventName == "state") // Hardcoded state change
{
// m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
// m_PrimName, m_ScriptName, data.Params[0].ToString());
m_State=data.Params[0].ToString();
AsyncCommandManager.RemoveScript(m_Engine,
m_LocalID, m_ItemID);
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
m_LocalID);
if (part != null)
{
part.SetScriptEvents(m_ItemID,
(int)m_Script.GetStateEventFlags(State));
}
}
else
{
if (m_Engine.World.PipeEventsForScript(m_LocalID) ||
data.EventName == "control") // Don't freeze avies!
{
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
m_LocalID);
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
// m_PrimName, m_ScriptName, data.EventName, m_State);
try
{
m_CurrentEvent = data.EventName;
m_EventStart = DateTime.Now;
m_InEvent = true;
m_Script.ExecuteEvent(State, data.EventName, data.Params);
m_InEvent = false;
m_CurrentEvent = String.Empty;
if (m_SaveState)
{
// This will be the very first event we deliver
// (state_entry) in default state
//
SaveState(m_Assembly);
m_SaveState = false;
}
}
catch (Exception e)
{
// m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message);
m_InEvent = false;
m_CurrentEvent = String.Empty;
if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException))
{
try
{
// DISPLAY ERROR INWORLD
string text = FormatException(e);
if (text.Length > 1000)
text = text.Substring(0, 1000);
m_Engine.World.SimChat(Utils.StringToBytes(text),
ChatTypeEnum.DebugChannel, 2147483647,
part.AbsolutePosition,
part.Name, part.UUID, false);
}
catch (Exception)
{
}
// catch (Exception e2) // LEGIT: User Scripting
// {
// m_log.Error("[SCRIPT]: "+
// "Error displaying error in-world: " +
// e2.ToString());
// m_log.Error("[SCRIPT]: " +
// "Errormessage: Error compiling script:\r\n" +
// e.ToString());
// }
}
else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
{
m_InSelfDelete = true;
if (part != null && part.ParentGroup != null)
m_Engine.World.DeleteSceneObject(part.ParentGroup, false);
}
else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
{
m_InSelfDelete = true;
if (part != null && part.ParentGroup != null)
part.Inventory.RemoveInventoryItem(m_ItemID);
}
}
}
}
lock (m_EventQueue)
data = (EventParams) m_EventQueue.Dequeue();
if (data == null) // Shouldn't happen
{
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
{
@@ -780,13 +658,141 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
m_CurrentResult = null;
}
return 0;
}
m_DetectParams = null;
return 0;
if (data.EventName == "timer")
m_TimerQueued = false;
if (data.EventName == "control")
{
if (m_ControlEventsInQueue > 0)
m_ControlEventsInQueue--;
}
if (data.EventName == "collision")
m_CollisionInQueue = false;
}
}
lock(m_Script)
{
//m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this);
m_DetectParams = data.DetectParams;
if (data.EventName == "state") // Hardcoded state change
{
// m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
// m_PrimName, m_ScriptName, data.Params[0].ToString());
m_State=data.Params[0].ToString();
AsyncCommandManager.RemoveScript(m_Engine,
m_LocalID, m_ItemID);
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
m_LocalID);
if (part != null)
{
part.SetScriptEvents(m_ItemID,
(int)m_Script.GetStateEventFlags(State));
}
}
else
{
if (m_Engine.World.PipeEventsForScript(m_LocalID) ||
data.EventName == "control") // Don't freeze avies!
{
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
m_LocalID);
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
// m_PrimName, m_ScriptName, data.EventName, m_State);
try
{
m_CurrentEvent = data.EventName;
m_EventStart = DateTime.Now;
m_InEvent = true;
m_Script.ExecuteEvent(State, data.EventName, data.Params);
m_InEvent = false;
m_CurrentEvent = String.Empty;
if (m_SaveState)
{
// This will be the very first event we deliver
// (state_entry) in default state
//
SaveState(m_Assembly);
m_SaveState = false;
}
}
catch (Exception e)
{
// m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message);
m_InEvent = false;
m_CurrentEvent = String.Empty;
if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException))
{
try
{
// DISPLAY ERROR INWORLD
string text = FormatException(e);
if (text.Length > 1000)
text = text.Substring(0, 1000);
m_Engine.World.SimChat(Utils.StringToBytes(text),
ChatTypeEnum.DebugChannel, 2147483647,
part.AbsolutePosition,
part.Name, part.UUID, false);
}
catch (Exception)
{
}
// catch (Exception e2) // LEGIT: User Scripting
// {
// m_log.Error("[SCRIPT]: "+
// "Error displaying error in-world: " +
// e2.ToString());
// m_log.Error("[SCRIPT]: " +
// "Errormessage: Error compiling script:\r\n" +
// e.ToString());
// }
}
else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
{
m_InSelfDelete = true;
if (part != null && part.ParentGroup != null)
m_Engine.World.DeleteSceneObject(part.ParentGroup, false);
}
else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
{
m_InSelfDelete = true;
if (part != null && part.ParentGroup != null)
part.Inventory.RemoveInventoryItem(m_ItemID);
}
}
}
}
lock (m_EventQueue)
{
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
{
m_CurrentResult = m_Engine.QueueEventHandler(this);
}
else
{
m_CurrentResult = null;
}
}
m_DetectParams = null;
return 0;
}
}
public int EventTime()
{
@@ -824,6 +830,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
new Object[0], new DetectParams[0]));
}
[DebuggerNonUserCode] //Stops the VS debugger from farting in this function
public void ApiResetScript()
{
// bool running = Running;

View File

@@ -429,6 +429,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
}
}
public int Size
{
get { return 0; }
}
public object[] Data
{
get {

View File

@@ -30,6 +30,7 @@ using System.IO;
using System.Threading;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics; //for [DebuggerNonUserCode]
using System.Security;
using System.Security.Policy;
using System.Reflection;
@@ -100,6 +101,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private Dictionary<UUID, IScriptInstance> m_Scripts =
new Dictionary<UUID, IScriptInstance>();
private OpenMetaverse.ReaderWriterLockSlim m_scriptsLock = new OpenMetaverse.ReaderWriterLockSlim();
// Maps the asset ID to the assembly
private Dictionary<UUID, string> m_Assemblies =
@@ -121,6 +124,71 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private ScriptCompileQueue m_CompileQueue = new ScriptCompileQueue();
IWorkItemResult m_CurrentCompile = null;
private void lockScriptsForRead(bool locked)
{
if (locked)
{
if (m_scriptsLock.RecursiveReadCount > 0)
{
m_log.Error("[XEngine.m_Scripts] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
m_scriptsLock.ExitReadLock();
}
if (m_scriptsLock.RecursiveWriteCount > 0)
{
m_log.Error("[XEngine.m_Scripts] Recursive write lock requested. This should not happen and means something needs to be fixed.");
m_scriptsLock.ExitWriteLock();
}
while (!m_scriptsLock.TryEnterReadLock(60000))
{
m_log.Error("[XEngine.m_Scripts] Thread lock detected while trying to aquire READ lock of m_scripts in XEngine. I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
if (m_scriptsLock.IsWriteLockHeld)
{
m_scriptsLock = new OpenMetaverse.ReaderWriterLockSlim();
}
}
}
else
{
if (m_scriptsLock.RecursiveReadCount > 0)
{
m_scriptsLock.ExitReadLock();
}
}
}
private void lockScriptsForWrite(bool locked)
{
if (locked)
{
if (m_scriptsLock.RecursiveReadCount > 0)
{
m_log.Error("[XEngine.m_Scripts] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
m_scriptsLock.ExitReadLock();
}
if (m_scriptsLock.RecursiveWriteCount > 0)
{
m_log.Error("[XEngine.m_Scripts] Recursive write lock requested. This should not happen and means something needs to be fixed.");
m_scriptsLock.ExitWriteLock();
}
while (!m_scriptsLock.TryEnterWriteLock(60000))
{
m_log.Error("[XEngine.m_Scripts] Thread lock detected while trying to aquire WRITE lock of m_scripts in XEngine. I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
if (m_scriptsLock.IsWriteLockHeld)
{
m_scriptsLock = new OpenMetaverse.ReaderWriterLockSlim();
}
}
}
else
{
if (m_scriptsLock.RecursiveWriteCount > 0)
{
m_scriptsLock.ExitWriteLock();
}
}
}
public string ScriptEngineName
{
get { return "XEngine"; }
@@ -260,43 +328,45 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public void RemoveRegion(Scene scene)
{
lock (m_Scripts)
lockScriptsForRead(true);
foreach (IScriptInstance instance in m_Scripts.Values)
{
foreach (IScriptInstance instance in m_Scripts.Values)
// Force a final state save
//
if (m_Assemblies.ContainsKey(instance.AssetID))
{
// Force a final state save
//
if (m_Assemblies.ContainsKey(instance.AssetID))
{
string assembly = m_Assemblies[instance.AssetID];
instance.SaveState(assembly);
}
// Clear the event queue and abort the instance thread
//
instance.ClearQueue();
instance.Stop(0);
// Release events, timer, etc
//
instance.DestroyScriptInstance();
// Unload scripts and app domains
// Must be done explicitly because they have infinite
// lifetime
//
m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
if (m_DomainScripts[instance.AppDomain].Count == 0)
{
m_DomainScripts.Remove(instance.AppDomain);
UnloadAppDomain(instance.AppDomain);
}
string assembly = m_Assemblies[instance.AssetID];
instance.SaveState(assembly);
}
// Clear the event queue and abort the instance thread
//
instance.ClearQueue();
instance.Stop(0);
// Release events, timer, etc
//
instance.DestroyScriptInstance();
// Unload scripts and app domains
// Must be done explicitly because they have infinite
// lifetime
//
m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
if (m_DomainScripts[instance.AppDomain].Count == 0)
{
m_DomainScripts.Remove(instance.AppDomain);
UnloadAppDomain(instance.AppDomain);
}
m_Scripts.Clear();
m_PrimObjects.Clear();
m_Assemblies.Clear();
m_DomainScripts.Clear();
}
lockScriptsForRead(false);
lockScriptsForWrite(true);
m_Scripts.Clear();
lockScriptsForWrite(false);
m_PrimObjects.Clear();
m_Assemblies.Clear();
m_DomainScripts.Clear();
lock (m_ScriptEngines)
{
m_ScriptEngines.Remove(this);
@@ -355,22 +425,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
List<IScriptInstance> instances = new List<IScriptInstance>();
lock (m_Scripts)
{
foreach (IScriptInstance instance in m_Scripts.Values)
lockScriptsForRead(true);
foreach (IScriptInstance instance in m_Scripts.Values)
instances.Add(instance);
}
lockScriptsForRead(false);
foreach (IScriptInstance i in instances)
{
string assembly = String.Empty;
lock (m_Scripts)
{
if (!m_Assemblies.ContainsKey(i.AssetID))
continue;
assembly = m_Assemblies[i.AssetID];
}
i.SaveState(assembly);
}
@@ -672,173 +740,184 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false;
}
lock (m_Scripts)
ScriptInstance instance = null;
// Create the object record
lockScriptsForRead(true);
if ((!m_Scripts.ContainsKey(itemID)) ||
(m_Scripts[itemID].AssetID != assetID))
{
ScriptInstance instance = null;
// Create the object record
lockScriptsForRead(false);
if ((!m_Scripts.ContainsKey(itemID)) ||
(m_Scripts[itemID].AssetID != assetID))
UUID appDomain = assetID;
if (part.ParentGroup.IsAttachment)
appDomain = part.ParentGroup.RootPart.UUID;
if (!m_AppDomains.ContainsKey(appDomain))
{
UUID appDomain = assetID;
if (part.ParentGroup.IsAttachment)
appDomain = part.ParentGroup.RootPart.UUID;
if (!m_AppDomains.ContainsKey(appDomain))
try
{
try
{
AppDomainSetup appSetup = new AppDomainSetup();
// appSetup.ApplicationBase = Path.Combine(
// "ScriptEngines",
// m_Scene.RegionInfo.RegionID.ToString());
AppDomainSetup appSetup = new AppDomainSetup();
// appSetup.ApplicationBase = Path.Combine(
// "ScriptEngines",
// m_Scene.RegionInfo.RegionID.ToString());
Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
Evidence evidence = new Evidence(baseEvidence);
Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
Evidence evidence = new Evidence(baseEvidence);
AppDomain sandbox;
if (m_AppDomainLoading)
sandbox = AppDomain.CreateDomain(
m_Scene.RegionInfo.RegionID.ToString(),
evidence, appSetup);
else
sandbox = AppDomain.CurrentDomain;
//PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
//AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
//PermissionSet sandboxPermissionSet = sandboxPolicy.GetNamedPermissionSet("Internet");
//PolicyStatement sandboxPolicyStatement = new PolicyStatement(sandboxPermissionSet);
//CodeGroup sandboxCodeGroup = new UnionCodeGroup(sandboxMembershipCondition, sandboxPolicyStatement);
//sandboxPolicy.RootCodeGroup = sandboxCodeGroup;
//sandbox.SetAppDomainPolicy(sandboxPolicy);
m_AppDomains[appDomain] = sandbox;
AppDomain sandbox;
if (m_AppDomainLoading)
sandbox = AppDomain.CreateDomain(
m_Scene.RegionInfo.RegionID.ToString(),
evidence, appSetup);
else
sandbox = AppDomain.CurrentDomain;
m_AppDomains[appDomain].AssemblyResolve +=
new ResolveEventHandler(
AssemblyResolver.OnAssemblyResolve);
m_DomainScripts[appDomain] = new List<UUID>();
}
catch (Exception e)
{
m_log.ErrorFormat("[XEngine] Exception creating app domain:\n {0}", e.ToString());
m_ScriptErrorMessage += "Exception creating app domain:\n";
m_ScriptFailCount++;
lock (m_AddingAssemblies)
{
m_AddingAssemblies[assembly]--;
}
return false;
}
//PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
//AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
//PermissionSet sandboxPermissionSet = sandboxPolicy.GetNamedPermissionSet("Internet");
//PolicyStatement sandboxPolicyStatement = new PolicyStatement(sandboxPermissionSet);
//CodeGroup sandboxCodeGroup = new UnionCodeGroup(sandboxMembershipCondition, sandboxPolicyStatement);
//sandboxPolicy.RootCodeGroup = sandboxCodeGroup;
//sandbox.SetAppDomainPolicy(sandboxPolicy);
m_AppDomains[appDomain] = sandbox;
m_AppDomains[appDomain].AssemblyResolve +=
new ResolveEventHandler(
AssemblyResolver.OnAssemblyResolve);
m_DomainScripts[appDomain] = new List<UUID>();
}
m_DomainScripts[appDomain].Add(itemID);
instance = new ScriptInstance(this, part,
itemID, assetID, assembly,
m_AppDomains[appDomain],
part.ParentGroup.RootPart.Name,
item.Name, startParam, postOnRez,
stateSource, m_MaxScriptQueue);
m_log.DebugFormat("[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}",
part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, part.ParentGroup.RootPart.AbsolutePosition.ToString());
if (presence != null)
catch (Exception e)
{
ShowScriptSaveResponse(item.OwnerID,
assetID, "Compile successful", true);
m_log.ErrorFormat("[XEngine] Exception creating app domain:\n {0}", e.ToString());
m_ScriptErrorMessage += "Exception creating app domain:\n";
m_ScriptFailCount++;
lock (m_AddingAssemblies)
{
m_AddingAssemblies[assembly]--;
}
return false;
}
instance.AppDomain = appDomain;
instance.LineMap = linemap;
m_Scripts[itemID] = instance;
}
m_DomainScripts[appDomain].Add(itemID);
lock (m_PrimObjects)
instance = new ScriptInstance(this, part,
itemID, assetID, assembly,
m_AppDomains[appDomain],
part.ParentGroup.RootPart.Name,
item.Name, startParam, postOnRez,
stateSource, m_MaxScriptQueue);
m_log.DebugFormat("[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}",
part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, part.ParentGroup.RootPart.AbsolutePosition.ToString());
if (presence != null)
{
if (!m_PrimObjects.ContainsKey(localID))
m_PrimObjects[localID] = new List<UUID>();
if (!m_PrimObjects[localID].Contains(itemID))
m_PrimObjects[localID].Add(itemID);
ShowScriptSaveResponse(item.OwnerID,
assetID, "Compile successful", true);
}
if (!m_Assemblies.ContainsKey(assetID))
m_Assemblies[assetID] = assembly;
lock (m_AddingAssemblies)
{
m_AddingAssemblies[assembly]--;
}
if (instance!=null)
instance.Init();
instance.AppDomain = appDomain;
instance.LineMap = linemap;
lockScriptsForWrite(true);
m_Scripts[itemID] = instance;
lockScriptsForWrite(false);
}
else
{
lockScriptsForRead(false);
}
lock (m_PrimObjects)
{
if (!m_PrimObjects.ContainsKey(localID))
m_PrimObjects[localID] = new List<UUID>();
if (!m_PrimObjects[localID].Contains(itemID))
m_PrimObjects[localID].Add(itemID);
}
if (!m_Assemblies.ContainsKey(assetID))
m_Assemblies[assetID] = assembly;
lock (m_AddingAssemblies)
{
m_AddingAssemblies[assembly]--;
}
if (instance!=null)
instance.Init();
return true;
}
public void OnRemoveScript(uint localID, UUID itemID)
{
lock (m_Scripts)
lockScriptsForRead(true);
// Do we even have it?
if (!m_Scripts.ContainsKey(itemID))
{
// Do we even have it?
if (!m_Scripts.ContainsKey(itemID))
return;
lockScriptsForRead(false);
return;
}
IScriptInstance instance=m_Scripts[itemID];
m_Scripts.Remove(itemID);
IScriptInstance instance=m_Scripts[itemID];
lockScriptsForRead(false);
lockScriptsForWrite(true);
m_Scripts.Remove(itemID);
lockScriptsForWrite(false);
instance.ClearQueue();
instance.Stop(0);
instance.ClearQueue();
instance.Stop(0);
SceneObjectPart part =
m_Scene.GetSceneObjectPart(localID);
SceneObjectPart part =
m_Scene.GetSceneObjectPart(localID);
if (part != null)
part.RemoveScriptEvents(itemID);
if (part != null)
part.RemoveScriptEvents(itemID);
// bool objectRemoved = false;
lock (m_PrimObjects)
lock (m_PrimObjects)
{
// Remove the script from it's prim
if (m_PrimObjects.ContainsKey(localID))
{
// Remove the script from it's prim
if (m_PrimObjects.ContainsKey(localID))
{
// Remove inventory item record
if (m_PrimObjects[localID].Contains(itemID))
m_PrimObjects[localID].Remove(itemID);
// Remove inventory item record
if (m_PrimObjects[localID].Contains(itemID))
m_PrimObjects[localID].Remove(itemID);
// If there are no more scripts, remove prim
if (m_PrimObjects[localID].Count == 0)
{
m_PrimObjects.Remove(localID);
// If there are no more scripts, remove prim
if (m_PrimObjects[localID].Count == 0)
{
m_PrimObjects.Remove(localID);
// objectRemoved = true;
}
}
}
instance.RemoveState();
instance.DestroyScriptInstance();
m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
if (m_DomainScripts[instance.AppDomain].Count == 0)
{
m_DomainScripts.Remove(instance.AppDomain);
UnloadAppDomain(instance.AppDomain);
}
instance = null;
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
if (handlerObjectRemoved != null)
handlerObjectRemoved(part.UUID);
CleanAssemblies();
}
instance.RemoveState();
instance.DestroyScriptInstance();
m_DomainScripts[instance.AppDomain].Remove(instance.ItemID);
if (m_DomainScripts[instance.AppDomain].Count == 0)
{
m_DomainScripts.Remove(instance.AppDomain);
UnloadAppDomain(instance.AppDomain);
}
instance = null;
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
if (handlerObjectRemoved != null)
handlerObjectRemoved(part.UUID);
CleanAssemblies();
ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
if (handlerScriptRemoved != null)
handlerScriptRemoved(itemID);
@@ -1090,12 +1169,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private IScriptInstance GetInstance(UUID itemID)
{
IScriptInstance instance;
lock (m_Scripts)
lockScriptsForRead(true);
if (!m_Scripts.ContainsKey(itemID))
{
if (!m_Scripts.ContainsKey(itemID))
return null;
instance = m_Scripts[itemID];
lockScriptsForRead(false);
return null;
}
instance = m_Scripts[itemID];
lockScriptsForRead(false);
return instance;
}
@@ -1119,6 +1200,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false;
}
[DebuggerNonUserCode]
public void ApiResetScript(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
@@ -1170,6 +1252,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return UUID.Zero;
}
[DebuggerNonUserCode]
public void SetState(UUID itemID, string newState)
{
IScriptInstance instance = GetInstance(itemID);
@@ -1197,11 +1280,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{
List<IScriptInstance> instances = new List<IScriptInstance>();
lock (m_Scripts)
{
foreach (IScriptInstance instance in m_Scripts.Values)
lockScriptsForRead(true);
foreach (IScriptInstance instance in m_Scripts.Values)
instances.Add(instance);
}
lockScriptsForRead(false);
foreach (IScriptInstance i in instances)
{

View File

@@ -491,7 +491,7 @@ namespace OpenSim.Tests.Common.Mock
}
public void SendGenericMessage(string method, List<string> message)
public void SendGenericMessage(string method, List<byte[]> message)
{
}

View File

@@ -454,6 +454,9 @@
; Distance in meters that shouts should travel. Default is 100m
shout_distance = 100
; Append a prefix to the god avatar names appearing in chat whilst in god mode
; admin_prefix = "@"
[Messaging]