aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLSimulationData.cs5
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs37
-rw-r--r--OpenSim/Data/Null/NullSimulationData.cs5
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs33
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs29
-rw-r--r--OpenSim/Region/CoreModules/World/Region/RestartModule.cs83
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRestartModule.cs1
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/CollisionSounds.cs105
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs185
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationDataService.cs5
-rw-r--r--OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs10
17 files changed, 379 insertions, 144 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
index d9dfe86..df496a7 100644
--- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
@@ -2136,5 +2136,10 @@ VALUES
2136 } 2136 }
2137 } 2137 }
2138 } 2138 }
2139
2140 public UUID[] GetObjectIDs(UUID regionID)
2141 {
2142 return new UUID[0];
2143 }
2139 } 2144 }
2140} 2145}
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index ec7a454..1999d89 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -119,8 +119,10 @@ namespace OpenSim.Data.MySQL
119 119
120 // Eligibility check 120 // Eligibility check
121 // 121 //
122 if ((flags & (uint)PrimFlags.Temporary) != 0) 122 // PrimFlags.Temporary is not used in OpenSim code and cannot
123 return; 123 // be guaranteed to always be clear. Don't check it.
124// if ((flags & (uint)PrimFlags.Temporary) != 0)
125// return;
124 if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) 126 if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
125 return; 127 return;
126 128
@@ -1911,6 +1913,37 @@ namespace OpenSim.Data.MySQL
1911 } 1913 }
1912 } 1914 }
1913 1915
1916 public UUID[] GetObjectIDs(UUID regionID)
1917 {
1918 List<UUID> uuids = new List<UUID>();
1919
1920 lock (m_dbLock)
1921 {
1922 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
1923 {
1924 dbcon.Open();
1925
1926 using (MySqlCommand cmd = dbcon.CreateCommand())
1927 {
1928 cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID";
1929 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
1930
1931 using (IDataReader reader = ExecuteReader(cmd))
1932 {
1933 while (reader.Read())
1934 {
1935 UUID id = new UUID(reader["UUID"].ToString());
1936
1937 uuids.Add(id);
1938 }
1939 }
1940 }
1941 }
1942 }
1943
1944 return uuids.ToArray();
1945 }
1946
1914 private void LoadSpawnPoints(RegionSettings rs) 1947 private void LoadSpawnPoints(RegionSettings rs)
1915 { 1948 {
1916 rs.ClearSpawnPoints(); 1949 rs.ClearSpawnPoints();
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs
index b788976..24b4511 100644
--- a/OpenSim/Data/Null/NullSimulationData.cs
+++ b/OpenSim/Data/Null/NullSimulationData.cs
@@ -133,5 +133,10 @@ namespace OpenSim.Data.Null
133 public void Shutdown() 133 public void Shutdown()
134 { 134 {
135 } 135 }
136
137 public UUID[] GetObjectIDs(UUID regionID)
138 {
139 return new UUID[0];
140 }
136 } 141 }
137} 142}
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 7e7c08a..9ec285c 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -2791,5 +2791,9 @@ namespace OpenSim.Data.SQLite
2791 } 2791 }
2792 } 2792 }
2793 2793
2794 public UUID[] GetObjectIDs(UUID regionID)
2795 {
2796 return new UUID[0];
2797 }
2794 } 2798 }
2795} 2799}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 77dbca7..5a87958 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -2777,6 +2777,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2777 } 2777 }
2778 } 2778 }
2779 2779
2780 public void SendAssetNotFound(AssetRequestToClient req)
2781 {
2782 TransferInfoPacket Transfer = new TransferInfoPacket();
2783 Transfer.TransferInfo.ChannelType = 2;
2784 Transfer.TransferInfo.Status = -2;
2785 Transfer.TransferInfo.TargetType = 0;
2786 Transfer.TransferInfo.Params = req.Params;
2787 Transfer.TransferInfo.Size = 0;
2788 Transfer.TransferInfo.TransferID = req.TransferRequestID;
2789 Transfer.Header.Zerocoded = true;
2790 OutPacket(Transfer, ThrottleOutPacketType.Asset);
2791 }
2792
2780 public void SendTexture(AssetBase TextureAsset) 2793 public void SendTexture(AssetBase TextureAsset)
2781 { 2794 {
2782 2795
@@ -12178,14 +12191,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12178 /// <param name="asset"></param> 12191 /// <param name="asset"></param>
12179 protected void AssetReceived(string id, Object sender, AssetBase asset) 12192 protected void AssetReceived(string id, Object sender, AssetBase asset)
12180 { 12193 {
12181 if (asset == null)
12182 return;
12183
12184 TransferRequestPacket transferRequest = (TransferRequestPacket)sender; 12194 TransferRequestPacket transferRequest = (TransferRequestPacket)sender;
12185 12195
12186 UUID requestID = UUID.Zero; 12196 UUID requestID = UUID.Zero;
12187 byte source = (byte)SourceType.Asset; 12197 byte source = (byte)SourceType.Asset;
12188 12198
12199 AssetRequestToClient req = new AssetRequestToClient();
12200
12201 if (asset == null)
12202 {
12203 req.AssetInf = null;
12204 req.AssetRequestSource = source;
12205 req.IsTextureRequest = false;
12206 req.NumPackets = 0;
12207 req.Params = transferRequest.TransferInfo.Params;
12208 req.RequestAssetID = requestID;
12209 req.TransferRequestID = transferRequest.TransferInfo.TransferID;
12210
12211 SendAssetNotFound(req);
12212 return;
12213 }
12214
12189 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) 12215 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
12190 { 12216 {
12191 requestID = new UUID(transferRequest.TransferInfo.Params, 0); 12217 requestID = new UUID(transferRequest.TransferInfo.Params, 0);
@@ -12202,7 +12228,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12202 return; 12228 return;
12203 12229
12204 // The asset is known to exist and is in our cache, so add it to the AssetRequests list 12230 // The asset is known to exist and is in our cache, so add it to the AssetRequests list
12205 AssetRequestToClient req = new AssetRequestToClient();
12206 req.AssetInf = asset; 12231 req.AssetInf = asset;
12207 req.AssetRequestSource = source; 12232 req.AssetRequestSource = source;
12208 req.IsTextureRequest = false; 12233 req.IsTextureRequest = false;
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 1e743c3..97a2f4a 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -61,6 +61,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
61 public event ChangeDelegate OnEstateInfoChange; 61 public event ChangeDelegate OnEstateInfoChange;
62 public event MessageDelegate OnEstateMessage; 62 public event MessageDelegate OnEstateMessage;
63 63
64 private int m_delayCount = 0;
65
64 #region Packet Data Responders 66 #region Packet Data Responders
65 67
66 private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) 68 private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice)
@@ -259,7 +261,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
259 { 261 {
260 if (timeInSeconds == -1) 262 if (timeInSeconds == -1)
261 { 263 {
262 restartModule.AbortRestart("Restart aborted by region manager"); 264 m_delayCount++;
265 if (m_delayCount > 3)
266 return;
267
268 restartModule.DelayRestart(3600, "Restart delayed by region manager");
263 return; 269 return;
264 } 270 }
265 271
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 02ac091..add1551 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -1101,8 +1101,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1101 { 1101 {
1102 if (!temp.Contains(currentParcel)) 1102 if (!temp.Contains(currentParcel))
1103 { 1103 {
1104 currentParcel.ForceUpdateLandInfo(); 1104 if (!currentParcel.IsEitherBannedOrRestricted(remote_client.AgentId))
1105 temp.Add(currentParcel); 1105 {
1106 currentParcel.ForceUpdateLandInfo();
1107 temp.Add(currentParcel);
1108 }
1106 } 1109 }
1107 } 1110 }
1108 } 1111 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 509c4d7..4284444 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -50,6 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Land
50 private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax]; 50 private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax];
51 51
52 private int m_lastSeqId = 0; 52 private int m_lastSeqId = 0;
53 private int m_expiryCounter = 0;
53 54
54 protected LandData m_landData = new LandData(); 55 protected LandData m_landData = new LandData();
55 protected Scene m_scene; 56 protected Scene m_scene;
@@ -135,6 +136,8 @@ namespace OpenSim.Region.CoreModules.World.Land
135 else 136 else
136 LandData.GroupID = UUID.Zero; 137 LandData.GroupID = UUID.Zero;
137 LandData.IsGroupOwned = is_group_owned; 138 LandData.IsGroupOwned = is_group_owned;
139
140 m_scene.EventManager.OnFrame += OnFrame;
138 } 141 }
139 142
140 #endregion 143 #endregion
@@ -1196,6 +1199,17 @@ namespace OpenSim.Region.CoreModules.World.Land
1196 1199
1197 #endregion 1200 #endregion
1198 1201
1202 private void OnFrame()
1203 {
1204 m_expiryCounter++;
1205
1206 if (m_expiryCounter >= 50)
1207 {
1208 ExpireAccessList();
1209 m_expiryCounter = 0;
1210 }
1211 }
1212
1199 private void ExpireAccessList() 1213 private void ExpireAccessList()
1200 { 1214 {
1201 List<LandAccessEntry> delete = new List<LandAccessEntry>(); 1215 List<LandAccessEntry> delete = new List<LandAccessEntry>();
@@ -1206,7 +1220,22 @@ namespace OpenSim.Region.CoreModules.World.Land
1206 delete.Add(entry); 1220 delete.Add(entry);
1207 } 1221 }
1208 foreach (LandAccessEntry entry in delete) 1222 foreach (LandAccessEntry entry in delete)
1223 {
1209 LandData.ParcelAccessList.Remove(entry); 1224 LandData.ParcelAccessList.Remove(entry);
1225 ScenePresence presence;
1226
1227 if (m_scene.TryGetScenePresence(entry.AgentID, out presence) && (!presence.IsChildAgent))
1228 {
1229 ILandObject land = m_scene.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y);
1230 if (land.LandData.LocalID == LandData.LocalID)
1231 {
1232 Vector3 pos = m_scene.GetNearestAllowedPosition(presence, land);
1233 presence.TeleportWithMomentum(pos);
1234 presence.ControllingClient.SendAlertMessage("You have been ejected from this land");
1235 }
1236 }
1237 m_log.DebugFormat("[LAND]: Removing entry {0} because it has expired", entry.AgentID);
1238 }
1210 1239
1211 if (delete.Count > 0) 1240 if (delete.Count > 0)
1212 m_scene.EventManager.TriggerLandObjectUpdated((uint)LandData.LocalID, this); 1241 m_scene.EventManager.TriggerLandObjectUpdated((uint)LandData.LocalID, this);
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
index 65180b5a..287738a 100644
--- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
+++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
@@ -59,6 +59,7 @@ namespace OpenSim.Region.CoreModules.World.Region
59 protected bool m_Notice = false; 59 protected bool m_Notice = false;
60 protected IDialogModule m_DialogModule = null; 60 protected IDialogModule m_DialogModule = null;
61 protected string m_MarkerPath = String.Empty; 61 protected string m_MarkerPath = String.Empty;
62 private int[] m_CurrentAlerts = null;
62 63
63 public void Initialise(IConfigSource config) 64 public void Initialise(IConfigSource config)
64 { 65 {
@@ -141,6 +142,7 @@ namespace OpenSim.Region.CoreModules.World.Region
141 m_Message = message; 142 m_Message = message;
142 m_Initiator = initiator; 143 m_Initiator = initiator;
143 m_Notice = notice; 144 m_Notice = notice;
145 m_CurrentAlerts = alerts;
144 m_Alerts = new List<int>(alerts); 146 m_Alerts = new List<int>(alerts);
145 m_Alerts.Sort(); 147 m_Alerts.Sort();
146 m_Alerts.Reverse(); 148 m_Alerts.Reverse();
@@ -152,12 +154,12 @@ namespace OpenSim.Region.CoreModules.World.Region
152 return; 154 return;
153 } 155 }
154 156
155 int nextInterval = DoOneNotice(); 157 int nextInterval = DoOneNotice(true);
156 158
157 SetTimer(nextInterval); 159 SetTimer(nextInterval);
158 } 160 }
159 161
160 public int DoOneNotice() 162 public int DoOneNotice(bool sendOut)
161 { 163 {
162 if (m_Alerts.Count == 0 || m_Alerts[0] == 0) 164 if (m_Alerts.Count == 0 || m_Alerts[0] == 0)
163 { 165 {
@@ -182,34 +184,37 @@ namespace OpenSim.Region.CoreModules.World.Region
182 184
183 m_Alerts.RemoveAt(0); 185 m_Alerts.RemoveAt(0);
184 186
185 int minutes = currentAlert / 60; 187 if (sendOut)
186 string currentAlertString = String.Empty;
187 if (minutes > 0)
188 { 188 {
189 if (minutes == 1) 189 int minutes = currentAlert / 60;
190 currentAlertString += "1 minute"; 190 string currentAlertString = String.Empty;
191 else 191 if (minutes > 0)
192 currentAlertString += String.Format("{0} minutes", minutes); 192 {
193 if (minutes == 1)
194 currentAlertString += "1 minute";
195 else
196 currentAlertString += String.Format("{0} minutes", minutes);
197 if ((currentAlert % 60) != 0)
198 currentAlertString += " and ";
199 }
193 if ((currentAlert % 60) != 0) 200 if ((currentAlert % 60) != 0)
194 currentAlertString += " and "; 201 {
195 } 202 int seconds = currentAlert % 60;
196 if ((currentAlert % 60) != 0) 203 if (seconds == 1)
197 { 204 currentAlertString += "1 second";
198 int seconds = currentAlert % 60; 205 else
199 if (seconds == 1) 206 currentAlertString += String.Format("{0} seconds", seconds);
200 currentAlertString += "1 second"; 207 }
201 else
202 currentAlertString += String.Format("{0} seconds", seconds);
203 }
204 208
205 string msg = String.Format(m_Message, currentAlertString); 209 string msg = String.Format(m_Message, currentAlertString);
206 210
207 if (m_DialogModule != null && msg != String.Empty) 211 if (m_DialogModule != null && msg != String.Empty)
208 { 212 {
209 if (m_Notice) 213 if (m_Notice)
210 m_DialogModule.SendGeneralAlert(msg); 214 m_DialogModule.SendGeneralAlert(msg);
211 else 215 else
212 m_DialogModule.SendNotificationToUsersInRegion(m_Initiator, "System", msg); 216 m_DialogModule.SendNotificationToUsersInRegion(m_Initiator, "System", msg);
217 }
213 } 218 }
214 219
215 return currentAlert - nextAlert; 220 return currentAlert - nextAlert;
@@ -226,7 +231,25 @@ namespace OpenSim.Region.CoreModules.World.Region
226 231
227 private void OnTimer(object source, ElapsedEventArgs e) 232 private void OnTimer(object source, ElapsedEventArgs e)
228 { 233 {
229 int nextInterval = DoOneNotice(); 234 int nextInterval = DoOneNotice(true);
235
236 SetTimer(nextInterval);
237 }
238
239 public void DelayRestart(int seconds, string message)
240 {
241 if (m_CountdownTimer == null)
242 return;
243
244 m_CountdownTimer.Stop();
245 m_CountdownTimer = null;
246
247 m_Alerts = new List<int>(m_CurrentAlerts);
248 m_Alerts.Add(seconds);
249 m_Alerts.Sort();
250 m_Alerts.Reverse();
251
252 int nextInterval = DoOneNotice(false);
230 253
231 SetTimer(nextInterval); 254 SetTimer(nextInterval);
232 } 255 }
@@ -240,9 +263,9 @@ namespace OpenSim.Region.CoreModules.World.Region
240 if (m_DialogModule != null && message != String.Empty) 263 if (m_DialogModule != null && message != String.Empty)
241 m_DialogModule.SendGeneralAlert(message); 264 m_DialogModule.SendGeneralAlert(message);
242 } 265 }
243 if (m_MarkerPath != String.Empty) 266 if (m_MarkerPath != String.Empty)
244 File.Delete(Path.Combine(m_MarkerPath, 267 File.Delete(Path.Combine(m_MarkerPath,
245 m_Scene.RegionInfo.RegionID.ToString())); 268 m_Scene.RegionInfo.RegionID.ToString()));
246 } 269 }
247 270
248 private void HandleRegionRestart(string module, string[] args) 271 private void HandleRegionRestart(string module, string[] args)
diff --git a/OpenSim/Region/Framework/Interfaces/IRestartModule.cs b/OpenSim/Region/Framework/Interfaces/IRestartModule.cs
index c68550f..9b25beb 100644
--- a/OpenSim/Region/Framework/Interfaces/IRestartModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRestartModule.cs
@@ -35,5 +35,6 @@ namespace OpenSim.Region.Framework.Interfaces
35 TimeSpan TimeUntilRestart { get; } 35 TimeSpan TimeUntilRestart { get; }
36 void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice); 36 void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice);
37 void AbortRestart(string message); 37 void AbortRestart(string message);
38 void DelayRestart(int seconds, string message);
38 } 39 }
39} 40}
diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs
index 5295a72..5b69616 100644
--- a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs
@@ -95,5 +95,7 @@ namespace OpenSim.Region.Framework.Interfaces
95 RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); 95 RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID);
96 void StoreRegionWindlightSettings(RegionLightShareData wl); 96 void StoreRegionWindlightSettings(RegionLightShareData wl);
97 void RemoveRegionWindlightSettings(UUID regionID); 97 void RemoveRegionWindlightSettings(UUID regionID);
98
99 UUID[] GetObjectIDs(UUID regionID);
98 } 100 }
99} 101}
diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs
index 615f377..b7d9cfa 100644
--- a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs
@@ -106,6 +106,7 @@ namespace OpenSim.Region.Framework.Interfaces
106 RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); 106 RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID);
107 void StoreRegionWindlightSettings(RegionLightShareData wl); 107 void StoreRegionWindlightSettings(RegionLightShareData wl);
108 void RemoveRegionWindlightSettings(UUID regionID); 108 void RemoveRegionWindlightSettings(UUID regionID);
109 UUID[] GetObjectIDs(UUID regionID);
109 110
110 void Shutdown(); 111 void Shutdown();
111 } 112 }
diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs
index de82ddc..075724e 100644
--- a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs
+++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs
@@ -27,9 +27,11 @@
27// Ubit 2012 27// Ubit 2012
28 28
29using System; 29using System;
30using System.Reflection;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
34using log4net;
33 35
34namespace OpenSim.Region.Framework.Scenes 36namespace OpenSim.Region.Framework.Scenes
35{ 37{
@@ -42,9 +44,11 @@ namespace OpenSim.Region.Framework.Scenes
42 44
43 public static class CollisionSounds 45 public static class CollisionSounds
44 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
45 private const int MaxMaterials = 7; 49 private const int MaxMaterials = 7;
46 // part part 50 // part part
47/* 51
48 private static UUID snd_StoneStone = new UUID("be7295c0-a158-11e1-b3dd-0800200c9a66"); 52 private static UUID snd_StoneStone = new UUID("be7295c0-a158-11e1-b3dd-0800200c9a66");
49 private static UUID snd_StoneMetal = new UUID("be7295c0-a158-11e1-b3dd-0800201c9a66"); 53 private static UUID snd_StoneMetal = new UUID("be7295c0-a158-11e1-b3dd-0800201c9a66");
50 private static UUID snd_StoneGlass = new UUID("be7295c0-a158-11e1-b3dd-0800202c9a66"); 54 private static UUID snd_StoneGlass = new UUID("be7295c0-a158-11e1-b3dd-0800202c9a66");
@@ -53,7 +57,6 @@ namespace OpenSim.Region.Framework.Scenes
53 private static UUID snd_StonePlastic = new UUID("be7295c0-a158-11e1-b3dd-0800205c9a66"); 57 private static UUID snd_StonePlastic = new UUID("be7295c0-a158-11e1-b3dd-0800205c9a66");
54 private static UUID snd_StoneRubber = new UUID("be7295c0-a158-11e1-b3dd-0800206c9a66"); 58 private static UUID snd_StoneRubber = new UUID("be7295c0-a158-11e1-b3dd-0800206c9a66");
55 59
56 private static UUID snd_MetalStone = new UUID("be7295c0-a158-11e1-b3dd-0801200c9a66");
57 private static UUID snd_MetalMetal = new UUID("be7295c0-a158-11e1-b3dd-0801201c9a66"); 60 private static UUID snd_MetalMetal = new UUID("be7295c0-a158-11e1-b3dd-0801201c9a66");
58 private static UUID snd_MetalGlass = new UUID("be7295c0-a158-11e1-b3dd-0801202c9a66"); 61 private static UUID snd_MetalGlass = new UUID("be7295c0-a158-11e1-b3dd-0801202c9a66");
59 private static UUID snd_MetalWood = new UUID("be7295c0-a158-11e1-b3dd-0801203c9a66"); 62 private static UUID snd_MetalWood = new UUID("be7295c0-a158-11e1-b3dd-0801203c9a66");
@@ -61,44 +64,24 @@ namespace OpenSim.Region.Framework.Scenes
61 private static UUID snd_MetalPlastic = new UUID("be7295c0-a158-11e1-b3dd-0801205c9a66"); 64 private static UUID snd_MetalPlastic = new UUID("be7295c0-a158-11e1-b3dd-0801205c9a66");
62 private static UUID snd_MetalRubber = new UUID("be7295c0-a158-11e1-b3dd-0801206c9a66"); 65 private static UUID snd_MetalRubber = new UUID("be7295c0-a158-11e1-b3dd-0801206c9a66");
63 66
64 private static UUID snd_GlassStone = new UUID("be7295c0-a158-11e1-b3dd-0802200c9a66");
65 private static UUID snd_GlassMetal = new UUID("be7295c0-a158-11e1-b3dd-0802201c9a66");
66 private static UUID snd_GlassGlass = new UUID("be7295c0-a158-11e1-b3dd-0802202c9a66"); 67 private static UUID snd_GlassGlass = new UUID("be7295c0-a158-11e1-b3dd-0802202c9a66");
67 private static UUID snd_GlassWood = new UUID("be7295c0-a158-11e1-b3dd-0802203c9a66"); 68 private static UUID snd_GlassWood = new UUID("be7295c0-a158-11e1-b3dd-0802203c9a66");
68 private static UUID snd_GlassFlesh = new UUID("be7295c0-a158-11e1-b3dd-0802204c9a66"); 69 private static UUID snd_GlassFlesh = new UUID("be7295c0-a158-11e1-b3dd-0802204c9a66");
69 private static UUID snd_GlassPlastic = new UUID("be7295c0-a158-11e1-b3dd-0802205c9a66"); 70 private static UUID snd_GlassPlastic = new UUID("be7295c0-a158-11e1-b3dd-0802205c9a66");
70 private static UUID snd_GlassRubber = new UUID("be7295c0-a158-11e1-b3dd-0802206c9a66"); 71 private static UUID snd_GlassRubber = new UUID("be7295c0-a158-11e1-b3dd-0802206c9a66");
71 72
72 private static UUID snd_WoodStone = new UUID("be7295c0-a158-11e1-b3dd-0803200c9a66");
73 private static UUID snd_WoodMetal = new UUID("be7295c0-a158-11e1-b3dd-0803201c9a66");
74 private static UUID snd_WoodGlass = new UUID("be7295c0-a158-11e1-b3dd-0803202c9a66");
75 private static UUID snd_WoodWood = new UUID("be7295c0-a158-11e1-b3dd-0803203c9a66"); 73 private static UUID snd_WoodWood = new UUID("be7295c0-a158-11e1-b3dd-0803203c9a66");
76 private static UUID snd_WoodFlesh = new UUID("be7295c0-a158-11e1-b3dd-0803204c9a66"); 74 private static UUID snd_WoodFlesh = new UUID("be7295c0-a158-11e1-b3dd-0803204c9a66");
77 private static UUID snd_WoodPlastic = new UUID("be7295c0-a158-11e1-b3dd-0803205c9a66"); 75 private static UUID snd_WoodPlastic = new UUID("be7295c0-a158-11e1-b3dd-0803205c9a66");
78 private static UUID snd_WoodRubber = new UUID("be7295c0-a158-11e1-b3dd-0803206c9a66"); 76 private static UUID snd_WoodRubber = new UUID("be7295c0-a158-11e1-b3dd-0803206c9a66");
79 77
80 private static UUID snd_FleshStone = new UUID("be7295c0-a158-11e1-b3dd-0804200c9a66");
81 private static UUID snd_FleshMetal = new UUID("be7295c0-a158-11e1-b3dd-0804201c9a66");
82 private static UUID snd_FleshGlass = new UUID("be7295c0-a158-11e1-b3dd-0804202c9a66");
83 private static UUID snd_FleshWood = new UUID("be7295c0-a158-11e1-b3dd-0804203c9a66");
84 private static UUID snd_FleshFlesh = new UUID("be7295c0-a158-11e1-b3dd-0804204c9a66"); 78 private static UUID snd_FleshFlesh = new UUID("be7295c0-a158-11e1-b3dd-0804204c9a66");
85 private static UUID snd_FleshPlastic = new UUID("be7295c0-a158-11e1-b3dd-0804205c9a66"); 79 private static UUID snd_FleshPlastic = new UUID("be7295c0-a158-11e1-b3dd-0804205c9a66");
86 private static UUID snd_FleshRubber = new UUID("be7295c0-a158-11e1-b3dd-0804206c9a66"); 80 private static UUID snd_FleshRubber = new UUID("be7295c0-a158-11e1-b3dd-0804206c9a66");
87 81
88 private static UUID snd_PlasticStone = new UUID("be7295c0-a158-11e1-b3dd-0805200c9a66");
89 private static UUID snd_PlasticMetal = new UUID("be7295c0-a158-11e1-b3dd-0805201c9a66");
90 private static UUID snd_PlasticGlass = new UUID("be7295c0-a158-11e1-b3dd-0805202c9a66");
91 private static UUID snd_PlasticWood = new UUID("be7295c0-a158-11e1-b3dd-0805203c9a66");
92 private static UUID snd_PlasticFlesh = new UUID("be7295c0-a158-11e1-b3dd-0805204c9a66");
93 private static UUID snd_PlasticPlastic = new UUID("be7295c0-a158-11e1-b3dd-0805205c9a66"); 82 private static UUID snd_PlasticPlastic = new UUID("be7295c0-a158-11e1-b3dd-0805205c9a66");
94 private static UUID snd_PlasticRubber = new UUID("be7295c0-a158-11e1-b3dd-0805206c9a66"); 83 private static UUID snd_PlasticRubber = new UUID("be7295c0-a158-11e1-b3dd-0805206c9a66");
95 84
96 private static UUID snd_RubberStone = new UUID("be7295c0-a158-11e1-b3dd-0806200c9a66");
97 private static UUID snd_RubberMetal = new UUID("be7295c0-a158-11e1-b3dd-0806201c9a66");
98 private static UUID snd_RubberGlass = new UUID("be7295c0-a158-11e1-b3dd-0806202c9a66");
99 private static UUID snd_RubberWood = new UUID("be7295c0-a158-11e1-b3dd-0806203c9a66");
100 private static UUID snd_RubberFlesh = new UUID("be7295c0-a158-11e1-b3dd-0806204c9a66");
101 private static UUID snd_RubberPlastic = new UUID("be7295c0-a158-11e1-b3dd-0806205c9a66");
102 private static UUID snd_RubberRubber = new UUID("be7295c0-a158-11e1-b3dd-0806206c9a66"); 85 private static UUID snd_RubberRubber = new UUID("be7295c0-a158-11e1-b3dd-0806206c9a66");
103 86
104 // terrain part 87 // terrain part
@@ -109,50 +92,6 @@ namespace OpenSim.Region.Framework.Scenes
109 private static UUID snd_TerrainFlesh = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); 92 private static UUID snd_TerrainFlesh = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66");
110 private static UUID snd_TerrainPlastic = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); 93 private static UUID snd_TerrainPlastic = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66");
111 private static UUID snd_TerrainRubber = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); 94 private static UUID snd_TerrainRubber = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66");
112*/
113 private static UUID snd_StoneStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
114 private static UUID snd_StoneMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
115 private static UUID snd_StoneGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
116 private static UUID snd_StoneWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
117 private static UUID snd_StoneFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
118 private static UUID snd_StonePlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
119 private static UUID snd_StoneRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
120
121 private static UUID snd_MetalMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
122 private static UUID snd_MetalGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
123 private static UUID snd_MetalWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
124 private static UUID snd_MetalFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
125 private static UUID snd_MetalPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
126 private static UUID snd_MetalRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
127
128 private static UUID snd_GlassGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
129 private static UUID snd_GlassWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
130 private static UUID snd_GlassFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
131 private static UUID snd_GlassPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
132 private static UUID snd_GlassRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
133
134 private static UUID snd_WoodWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
135 private static UUID snd_WoodFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
136 private static UUID snd_WoodPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
137 private static UUID snd_WoodRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
138
139 private static UUID snd_FleshFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
140 private static UUID snd_FleshPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
141 private static UUID snd_FleshRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
142
143 private static UUID snd_PlasticPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
144 private static UUID snd_PlasticRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
145
146 private static UUID snd_RubberRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
147
148 // terrain part
149 private static UUID snd_TerrainStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
150 private static UUID snd_TerrainMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
151 private static UUID snd_TerrainGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
152 private static UUID snd_TerrainWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
153 private static UUID snd_TerrainFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
154 private static UUID snd_TerrainPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
155 private static UUID snd_TerrainRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
156 95
157 public static UUID[] m_TerrainPart = { 96 public static UUID[] m_TerrainPart = {
158 snd_TerrainStone, 97 snd_TerrainStone,
@@ -163,18 +102,7 @@ namespace OpenSim.Region.Framework.Scenes
163 snd_TerrainPlastic, 102 snd_TerrainPlastic,
164 snd_TerrainRubber 103 snd_TerrainRubber
165 }; 104 };
166/* 105
167 //full assimetric sounds
168 public static UUID[] m_PartPart = {
169 snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber,
170 snd_MetalStone, snd_MetalMetal, snd_MetalGlass, snd_MetalWood, snd_MetalFlesh, snd_MetalPlastic, snd_MetalRubber,
171 snd_GlassStone, snd_GlassMetal, snd_GlassGlass, snd_GlassWood, snd_GlassFlesh, snd_GlassPlastic, snd_GlassRubber,
172 snd_WoodStone, snd_WoodMetal, snd_WoodGlass, snd_WoodWood, snd_WoodFlesh, snd_WoodPlastic, snd_WoodRubber,
173 snd_FleshStone, snd_FleshMetal, snd_FleshGlass, snd_FleshWood, snd_FleshFlesh, snd_FleshPlastic, snd_FleshRubber,
174 snd_PlasticStone, snd_PlasticMetal, snd_PlasticGlass, snd_PlasticWood, snd_PlasticFlesh, snd_PlasticPlastic, snd_PlasticRubber,
175 snd_RubberStone, snd_RubberMetal, snd_RubberGlass, snd_RubberWood, snd_RubberFlesh, snd_RubberPlastic, snd_RubberRubber
176 };
177*/
178 // simetric sounds 106 // simetric sounds
179 public static UUID[] m_PartPart = { 107 public static UUID[] m_PartPart = {
180 snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber, 108 snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber,
@@ -188,9 +116,6 @@ namespace OpenSim.Region.Framework.Scenes
188 116
189 public static void PartCollisionSound(SceneObjectPart part, List<CollisionForSoundInfo> collidersinfolist) 117 public static void PartCollisionSound(SceneObjectPart part, List<CollisionForSoundInfo> collidersinfolist)
190 { 118 {
191 // disable for now
192 return;
193
194 if (collidersinfolist.Count == 0 || part == null) 119 if (collidersinfolist.Count == 0 || part == null)
195 return; 120 return;
196 121
@@ -300,9 +225,6 @@ namespace OpenSim.Region.Framework.Scenes
300 225
301 public static void AvatarCollisionSound(ScenePresence av, List<CollisionForSoundInfo> collidersinfolist) 226 public static void AvatarCollisionSound(ScenePresence av, List<CollisionForSoundInfo> collidersinfolist)
302 { 227 {
303 // disable for now
304 return;
305
306 if (collidersinfolist.Count == 0 || av == null) 228 if (collidersinfolist.Count == 0 || av == null)
307 return; 229 return;
308 230
@@ -344,12 +266,17 @@ namespace OpenSim.Region.Framework.Scenes
344 else 266 else
345 { 267 {
346 volume = Math.Abs(colInfo.relativeVel); 268 volume = Math.Abs(colInfo.relativeVel);
347 if (volume < 0.2f) 269 // Most noral collisions (running into walls, stairs)
270 // should never be heard.
271 if (volume < 3.2f)
348 continue; 272 continue;
273// m_log.DebugFormat("Collision speed was {0}", volume);
349 274
350 volume *= volume * .0625f; // 4m/s == full volume 275 // Cap to 0.2 times volume because climbing stairs should not be noisy
351 if (volume > 1.0f) 276 // Also changed scaling
352 volume = 1.0f; 277 volume *= volume * .0125f; // 4m/s == volume 0.2
278 if (volume > 0.2f)
279 volume = 0.2f;
353 otherMaterial = (int)otherPart.Material; 280 otherMaterial = (int)otherPart.Material;
354 if (otherMaterial >= MaxMaterials) 281 if (otherMaterial >= MaxMaterials)
355 otherMaterial = 3; 282 otherMaterial = 3;
@@ -374,4 +301,4 @@ namespace OpenSim.Region.Framework.Scenes
374 } 301 }
375 } 302 }
376 } 303 }
377} \ No newline at end of file 304}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 7568888..8fa7880 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3926,10 +3926,11 @@ namespace OpenSim.Region.Framework.Scenes
3926 scriptPosTarget target = m_targets[idx]; 3926 scriptPosTarget target = m_targets[idx];
3927 if (Util.GetDistanceTo(target.targetPos, m_rootPart.GroupPosition) <= target.tolerance) 3927 if (Util.GetDistanceTo(target.targetPos, m_rootPart.GroupPosition) <= target.tolerance)
3928 { 3928 {
3929 at_target = true;
3930
3929 // trigger at_target 3931 // trigger at_target
3930 if (m_scriptListens_atTarget) 3932 if (m_scriptListens_atTarget)
3931 { 3933 {
3932 at_target = true;
3933 scriptPosTarget att = new scriptPosTarget(); 3934 scriptPosTarget att = new scriptPosTarget();
3934 att.targetPos = target.targetPos; 3935 att.targetPos = target.targetPos;
3935 att.tolerance = target.tolerance; 3936 att.tolerance = target.tolerance;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d83b05d..523a6ca 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2536,12 +2536,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2536 { 2536 {
2537 m_host.AddScriptLPS(1); 2537 m_host.AddScriptLPS(1);
2538 2538
2539 Vector3 vel; 2539 Vector3 vel = Vector3.Zero;
2540 2540
2541 if (m_host.ParentGroup.IsAttachment) 2541 if (m_host.ParentGroup.IsAttachment)
2542 { 2542 {
2543 ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar); 2543 ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
2544 vel = avatar.Velocity; 2544 if (avatar != null)
2545 vel = avatar.Velocity;
2545 } 2546 }
2546 else 2547 else
2547 { 2548 {
@@ -4811,6 +4812,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4811 { 4812 {
4812 m_host.CollisionSoundVolume = (float)impact_volume; 4813 m_host.CollisionSoundVolume = (float)impact_volume;
4813 m_host.CollisionSound = m_host.invalidCollisionSoundUUID; 4814 m_host.CollisionSound = m_host.invalidCollisionSoundUUID;
4815 m_host.CollisionSoundType = 0;
4814 return; 4816 return;
4815 } 4817 }
4816 // TODO: Parameter check logic required. 4818 // TODO: Parameter check logic required.
@@ -4830,6 +4832,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4830 } 4832 }
4831 m_host.CollisionSoundVolume = (float)impact_volume; 4833 m_host.CollisionSoundVolume = (float)impact_volume;
4832 m_host.CollisionSound = soundId; 4834 m_host.CollisionSound = soundId;
4835 m_host.CollisionSoundType = 1;
4833 } 4836 }
4834 4837
4835 public LSL_String llGetAnimation(string id) 4838 public LSL_String llGetAnimation(string id)
@@ -7840,7 +7843,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7840 protected void SetPrimParams(ScenePresence av, LSL_List rules) 7843 protected void SetPrimParams(ScenePresence av, LSL_List rules)
7841 { 7844 {
7842 //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset. 7845 //This is a special version of SetPrimParams to deal with avatars which are sat on the linkset.
7843 //We only support PRIM_POSITION and PRIM_ROTATION
7844 7846
7845 int idx = 0; 7847 int idx = 0;
7846 7848
@@ -7875,7 +7877,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7875 v /= localRot; 7877 v /= localRot;
7876 7878
7877 LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); 7879 LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f);
7878 7880
7879 v = v + 2 * sitOffset; 7881 v = v + 2 * sitOffset;
7880 7882
7881 av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); 7883 av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
@@ -7884,6 +7886,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7884 } 7886 }
7885 break; 7887 break;
7886 7888
7889 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
7890 {
7891 if (remain < 1)
7892 return;
7893 LSL_Vector v;
7894 v = rules.GetVector3Item(idx++);
7895
7896 SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
7897 if (part == null)
7898 break;
7899
7900 LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f);
7901
7902 v += 2 * sitOffset;
7903
7904 av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
7905 av.SendAvatarDataToAllAgents();
7906
7907 }
7908 break;
7909
7887 case (int)ScriptBaseClass.PRIM_ROTATION: 7910 case (int)ScriptBaseClass.PRIM_ROTATION:
7888 { 7911 {
7889 if (remain < 1) 7912 if (remain < 1)
@@ -7904,6 +7927,109 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7904 av.SendAvatarDataToAllAgents(); 7927 av.SendAvatarDataToAllAgents();
7905 } 7928 }
7906 break; 7929 break;
7930
7931 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
7932 {
7933 if (remain < 1)
7934 return;
7935
7936 LSL_Rotation r;
7937 r = rules.GetQuaternionItem(idx++);
7938 av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
7939 av.SendAvatarDataToAllAgents();
7940 }
7941 break;
7942
7943 // parse rest doing nothing but number of parameters error check
7944 case (int)ScriptBaseClass.PRIM_SIZE:
7945 case (int)ScriptBaseClass.PRIM_MATERIAL:
7946 case (int)ScriptBaseClass.PRIM_PHANTOM:
7947 case (int)ScriptBaseClass.PRIM_PHYSICS:
7948 case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
7949 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
7950 case (int)ScriptBaseClass.PRIM_NAME:
7951 case (int)ScriptBaseClass.PRIM_DESC:
7952 if (remain < 1)
7953 return;
7954 idx++;
7955 break;
7956
7957 case (int)ScriptBaseClass.PRIM_GLOW:
7958 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
7959 case (int)ScriptBaseClass.PRIM_TEXGEN:
7960 if (remain < 2)
7961 return;
7962 idx += 2;
7963 break;
7964
7965 case (int)ScriptBaseClass.PRIM_TYPE:
7966 if (remain < 3)
7967 return;
7968 code = (int)rules.GetLSLIntegerItem(idx++);
7969 remain = rules.Length - idx;
7970 switch (code)
7971 {
7972 case (int)ScriptBaseClass.PRIM_TYPE_BOX:
7973 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
7974 case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
7975 if (remain < 6)
7976 return;
7977 idx += 6;
7978 break;
7979
7980 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE:
7981 if (remain < 5)
7982 return;
7983 idx += 5;
7984 break;
7985
7986 case (int)ScriptBaseClass.PRIM_TYPE_TORUS:
7987 case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
7988 case (int)ScriptBaseClass.PRIM_TYPE_RING:
7989 if (remain < 11)
7990 return;
7991 idx += 11;
7992 break;
7993
7994 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
7995 if (remain < 2)
7996 return;
7997 idx += 2;
7998 break;
7999 }
8000 break;
8001
8002 case (int)ScriptBaseClass.PRIM_COLOR:
8003 case (int)ScriptBaseClass.PRIM_TEXT:
8004 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
8005 case (int)ScriptBaseClass.PRIM_OMEGA:
8006 if (remain < 3)
8007 return;
8008 idx += 3;
8009 break;
8010
8011 case (int)ScriptBaseClass.PRIM_TEXTURE:
8012 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
8013 case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL:
8014 if (remain < 5)
8015 return;
8016 idx += 5;
8017 break;
8018
8019 case (int)ScriptBaseClass.PRIM_FLEXIBLE:
8020 if (remain < 7)
8021 return;
8022
8023 idx += 7;
8024 break;
8025
8026 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
8027 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
8028 return;
8029 LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++);
8030 LSL_List new_rules = rules.GetSublist(idx, -1);
8031 setLinkPrimParams((int)new_linknumber, new_rules);
8032 return;
7907 } 8033 }
7908 } 8034 }
7909 } 8035 }
@@ -7915,6 +8041,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7915 8041
7916 int idx = 0; 8042 int idx = 0;
7917 8043
8044 SceneObjectGroup parentgrp = part.ParentGroup;
8045
7918 bool positionChanged = false; 8046 bool positionChanged = false;
7919 LSL_Vector currentPosition = GetPartLocalPos(part); 8047 LSL_Vector currentPosition = GetPartLocalPos(part);
7920 8048
@@ -7954,8 +8082,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7954 return; 8082 return;
7955 8083
7956 LSL_Rotation q = rules.GetQuaternionItem(idx++); 8084 LSL_Rotation q = rules.GetQuaternionItem(idx++);
8085 SceneObjectPart rootPart = parentgrp.RootPart;
7957 // try to let this work as in SL... 8086 // try to let this work as in SL...
7958 if (part.ParentID == 0) 8087 if (rootPart == part)
7959 { 8088 {
7960 // special case: If we are root, rotate complete SOG to new rotation 8089 // special case: If we are root, rotate complete SOG to new rotation
7961 SetRot(part, Rot2Quaternion(q)); 8090 SetRot(part, Rot2Quaternion(q));
@@ -7963,7 +8092,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7963 else 8092 else
7964 { 8093 {
7965 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. 8094 // we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask.
7966 SceneObjectPart rootPart = part.ParentGroup.RootPart; 8095 // sounds like sl bug that we need to replicate
7967 SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q)); 8096 SetRot(part, rootPart.RotationOffset * Rot2Quaternion(q));
7968 } 8097 }
7969 8098
@@ -8216,7 +8345,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8216 return; 8345 return;
8217 8346
8218 string ph = rules.Data[idx++].ToString(); 8347 string ph = rules.Data[idx++].ToString();
8219 m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); 8348 parentgrp.ScriptSetPhantomStatus(ph.Equals("1"));
8220 8349
8221 break; 8350 break;
8222 8351
@@ -8269,7 +8398,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8269 return; 8398 return;
8270 string temp = rules.Data[idx++].ToString(); 8399 string temp = rules.Data[idx++].ToString();
8271 8400
8272 m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); 8401 parentgrp.ScriptSetTemporaryStatus(temp.Equals("1"));
8273 8402
8274 break; 8403 break;
8275 8404
@@ -8322,16 +8451,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8322 case (int)ScriptBaseClass.PRIM_LINK_TARGET: 8451 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
8323 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. 8452 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
8324 return; 8453 return;
8454
8455 // do a pending position change
8456 if (positionChanged)
8457 {
8458 if (parentgrp == null)
8459 return;
8460
8461 if (parentgrp.RootPart == part)
8462 {
8463
8464 Util.FireAndForget(delegate(object x)
8465 {
8466 parentgrp.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z));
8467 });
8468 }
8469 else
8470 {
8471 part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z);
8472 parentgrp.HasGroupChanged = true;
8473 parentgrp.ScheduleGroupForTerseUpdate();
8474 }
8475 }
8476
8325 LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); 8477 LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++);
8326 LSL_List new_rules = rules.GetSublist(idx, -1); 8478 LSL_List new_rules = rules.GetSublist(idx, -1);
8327 setLinkPrimParams((int)new_linknumber, new_rules); 8479 setLinkPrimParams((int)new_linknumber, new_rules);
8328
8329 return; 8480 return;
8330 } 8481 }
8331 } 8482 }
8332 } 8483 }
8333 finally 8484 finally
8334 { 8485 {
8486/*
8335 if (positionChanged) 8487 if (positionChanged)
8336 { 8488 {
8337 if (part.ParentGroup.RootPart == part) 8489 if (part.ParentGroup.RootPart == part)
@@ -8349,23 +8501,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8349 parent.ScheduleGroupForTerseUpdate(); 8501 parent.ScheduleGroupForTerseUpdate();
8350 } 8502 }
8351 } 8503 }
8504 */
8352 } 8505 }
8353 8506
8354 if (positionChanged) 8507 if (positionChanged)
8355 { 8508 {
8356 if (part.ParentGroup.RootPart == part) 8509 if (parentgrp == null)
8510 return;
8511
8512 if (parentgrp.RootPart == part)
8357 { 8513 {
8358 SceneObjectGroup parent = part.ParentGroup; 8514
8359 Util.FireAndForget(delegate(object x) { 8515 Util.FireAndForget(delegate(object x) {
8360 parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); 8516 parentgrp.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z));
8361 }); 8517 });
8362 } 8518 }
8363 else 8519 else
8364 { 8520 {
8365 part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z); 8521 part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z);
8366 SceneObjectGroup parent = part.ParentGroup; 8522 parentgrp.HasGroupChanged = true;
8367 parent.HasGroupChanged = true; 8523 parentgrp.ScheduleGroupForTerseUpdate();
8368 parent.ScheduleGroupForTerseUpdate();
8369 } 8524 }
8370 } 8525 }
8371 } 8526 }
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
index ccef50b..620bb10 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
@@ -148,5 +148,10 @@ namespace OpenSim.Services.Connectors
148 { 148 {
149 m_database.RemoveRegionWindlightSettings(regionID); 149 m_database.RemoveRegionWindlightSettings(regionID);
150 } 150 }
151
152 public UUID[] GetObjectIDs(UUID regionID)
153 {
154 return m_database.GetObjectIDs(regionID);
155 }
151 } 156 }
152} 157}
diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
index 579d41c..38fbbe3 100644
--- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
@@ -112,6 +112,11 @@ namespace OpenSim.Data.Null
112 { 112 {
113 m_store.StoreRegionWindlightSettings(wl); 113 m_store.StoreRegionWindlightSettings(wl);
114 } 114 }
115
116 public UUID[] GetObjectIDs(UUID regionID)
117 {
118 return new UUID[0];
119 }
115 } 120 }
116 121
117 /// <summary> 122 /// <summary>
@@ -285,5 +290,10 @@ namespace OpenSim.Data.Null
285 public void Shutdown() 290 public void Shutdown()
286 { 291 {
287 } 292 }
293
294 public UUID[] GetObjectIDs(UUID regionID)
295 {
296 return new UUID[0];
297 }
288 } 298 }
289} 299}