diff options
author | Melanie | 2013-03-15 23:45:32 +0000 |
---|---|---|
committer | Melanie | 2013-03-15 23:45:32 +0000 |
commit | b9146a79220c7e15ff0241fb6216028ddf15bee8 (patch) | |
tree | 18e3342a99e448b19a1a5bb29d9579ef9d9bb817 /OpenSim/Region | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Change the table and field names of XAssetService mysql db tables to be capit... (diff) | |
download | opensim-SC_OLD-b9146a79220c7e15ff0241fb6216028ddf15bee8.zip opensim-SC_OLD-b9146a79220c7e15ff0241fb6216028ddf15bee8.tar.gz opensim-SC_OLD-b9146a79220c7e15ff0241fb6216028ddf15bee8.tar.bz2 opensim-SC_OLD-b9146a79220c7e15ff0241fb6216028ddf15bee8.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Framework/Servers/BaseOpenSimServer.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region')
11 files changed, 233 insertions, 176 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index a5b9443..a7e7d03 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -159,6 +159,7 @@ namespace OpenSim | |||
159 | 159 | ||
160 | MainConsole.Instance = m_console; | 160 | MainConsole.Instance = m_console; |
161 | 161 | ||
162 | LogEnvironmentInformation(); | ||
162 | RegisterCommonAppenders(Config.Configs["Startup"]); | 163 | RegisterCommonAppenders(Config.Configs["Startup"]); |
163 | RegisterConsoleCommands(); | 164 | RegisterConsoleCommands(); |
164 | 165 | ||
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 7497d88..7361f50 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -138,10 +138,6 @@ namespace OpenSim | |||
138 | /// <param name="configSource"></param> | 138 | /// <param name="configSource"></param> |
139 | public OpenSimBase(IConfigSource configSource) : base() | 139 | public OpenSimBase(IConfigSource configSource) : base() |
140 | { | 140 | { |
141 | // FIXME: This should be done down in ServerBase but we need to sort out and refactor the log4net | ||
142 | // XmlConfigurator calls first accross servers. | ||
143 | m_log.InfoFormat("[SERVER BASE]: Starting in {0}", m_startupDirectory); | ||
144 | |||
145 | LoadConfigSettings(configSource); | 141 | LoadConfigSettings(configSource); |
146 | } | 142 | } |
147 | 143 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index d49f1f7..e07ce4c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -281,25 +281,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
281 | m_shouldCollectStats = false; | 281 | m_shouldCollectStats = false; |
282 | if (config != null) | 282 | if (config != null) |
283 | { | 283 | { |
284 | if (config.Contains("enabled") && config.GetBoolean("enabled")) | 284 | m_shouldCollectStats = config.GetBoolean("Enabled", false); |
285 | { | 285 | binStatsMaxFilesize = TimeSpan.FromSeconds(config.GetInt("packet_headers_period_seconds", 300)); |
286 | if (config.Contains("collect_packet_headers")) | 286 | binStatsDir = config.GetString("stats_dir", "."); |
287 | m_shouldCollectStats = config.GetBoolean("collect_packet_headers"); | 287 | m_aggregatedBWStats = config.GetBoolean("aggregatedBWStats", false); |
288 | if (config.Contains("packet_headers_period_seconds")) | 288 | } |
289 | { | 289 | #endregion BinaryStats |
290 | binStatsMaxFilesize = TimeSpan.FromSeconds(config.GetInt("region_stats_period_seconds")); | ||
291 | } | ||
292 | if (config.Contains("stats_dir")) | ||
293 | { | ||
294 | binStatsDir = config.GetString("stats_dir"); | ||
295 | } | ||
296 | } | ||
297 | else | ||
298 | { | ||
299 | m_shouldCollectStats = false; | ||
300 | } | ||
301 | } | ||
302 | #endregion BinaryStats | ||
303 | 290 | ||
304 | m_throttle = new TokenBucket(null, sceneThrottleBps); | 291 | m_throttle = new TokenBucket(null, sceneThrottleBps); |
305 | ThrottleRates = new ThrottleRates(configSource); | 292 | ThrottleRates = new ThrottleRates(configSource); |
@@ -1309,8 +1296,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1309 | static object binStatsLogLock = new object(); | 1296 | static object binStatsLogLock = new object(); |
1310 | static string binStatsDir = ""; | 1297 | static string binStatsDir = ""; |
1311 | 1298 | ||
1299 | //for Aggregated In/Out BW logging | ||
1300 | static bool m_aggregatedBWStats = false; | ||
1301 | static long m_aggregatedBytesIn = 0; | ||
1302 | static long m_aggregatedByestOut = 0; | ||
1303 | static object aggBWStatsLock = new object(); | ||
1304 | |||
1305 | public static long AggregatedLLUDPBytesIn | ||
1306 | { | ||
1307 | get { return m_aggregatedBytesIn; } | ||
1308 | } | ||
1309 | public static long AggregatedLLUDPBytesOut | ||
1310 | { | ||
1311 | get {return m_aggregatedByestOut;} | ||
1312 | } | ||
1313 | |||
1312 | public static void LogPacketHeader(bool incoming, uint circuit, byte flags, PacketType packetType, ushort size) | 1314 | public static void LogPacketHeader(bool incoming, uint circuit, byte flags, PacketType packetType, ushort size) |
1313 | { | 1315 | { |
1316 | if (m_aggregatedBWStats) | ||
1317 | { | ||
1318 | lock (aggBWStatsLock) | ||
1319 | { | ||
1320 | if (incoming) | ||
1321 | m_aggregatedBytesIn += size; | ||
1322 | else | ||
1323 | m_aggregatedByestOut += size; | ||
1324 | } | ||
1325 | } | ||
1326 | |||
1314 | if (!m_shouldCollectStats) return; | 1327 | if (!m_shouldCollectStats) return; |
1315 | 1328 | ||
1316 | // Binary logging format is TTTTTTTTCCCCFPPPSS, T=Time, C=Circuit, F=Flags, P=PacketType, S=size | 1329 | // Binary logging format is TTTTTTTTCCCCFPPPSS, T=Time, C=Circuit, F=Flags, P=PacketType, S=size |
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs index f874495..1f1568f 100644 --- a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs +++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs | |||
@@ -39,7 +39,7 @@ using OpenSim.Region.Framework; | |||
39 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | 41 | ||
42 | namespace OpenSim.Region.Framework.DynamicAttributes.DAExampleModule | 42 | namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule |
43 | { | 43 | { |
44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DAExampleModule")] | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DAExampleModule")] |
45 | public class DAExampleModule : INonSharedRegionModule | 45 | public class DAExampleModule : INonSharedRegionModule |
@@ -48,6 +48,8 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DAExampleModule | |||
48 | 48 | ||
49 | private static readonly bool ENABLED = false; // enable for testing | 49 | private static readonly bool ENABLED = false; // enable for testing |
50 | 50 | ||
51 | public const string DANamespace = "DAExample Module"; | ||
52 | |||
51 | protected Scene m_scene; | 53 | protected Scene m_scene; |
52 | protected IDialogModule m_dialogMod; | 54 | protected IDialogModule m_dialogMod; |
53 | 55 | ||
@@ -89,7 +91,7 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DAExampleModule | |||
89 | if (sop == null) | 91 | if (sop == null) |
90 | return true; | 92 | return true; |
91 | 93 | ||
92 | if (!sop.DynAttrs.TryGetValue(Name, out attrs)) | 94 | if (!sop.DynAttrs.TryGetValue(DANamespace, out attrs)) |
93 | attrs = new OSDMap(); | 95 | attrs = new OSDMap(); |
94 | 96 | ||
95 | OSDInteger newValue; | 97 | OSDInteger newValue; |
@@ -104,8 +106,10 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DAExampleModule | |||
104 | 106 | ||
105 | attrs["moves"] = newValue; | 107 | attrs["moves"] = newValue; |
106 | 108 | ||
107 | sop.DynAttrs[Name] = attrs; | 109 | sop.DynAttrs[DANamespace] = attrs; |
108 | } | 110 | } |
111 | |||
112 | sop.ParentGroup.HasGroupChanged = true; | ||
109 | 113 | ||
110 | m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue)); | 114 | m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue)); |
111 | 115 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs index 71bb3f0..650aa35 100644 --- a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs +++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DOExampleModule.cs | |||
@@ -36,6 +36,7 @@ using OpenMetaverse.Packets; | |||
36 | using OpenMetaverse.StructuredData; | 36 | using OpenMetaverse.StructuredData; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework; | 38 | using OpenSim.Region.Framework; |
39 | using OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule; | ||
39 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
40 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
41 | 42 | ||
@@ -50,9 +51,14 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule | |||
50 | public class MyObject | 51 | public class MyObject |
51 | { | 52 | { |
52 | public int Moves { get; set; } | 53 | public int Moves { get; set; } |
54 | |||
55 | public MyObject(int moves) | ||
56 | { | ||
57 | Moves = moves; | ||
58 | } | ||
53 | } | 59 | } |
54 | 60 | ||
55 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 61 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
56 | 62 | ||
57 | private static readonly bool ENABLED = false; // enable for testing | 63 | private static readonly bool ENABLED = false; // enable for testing |
58 | 64 | ||
@@ -92,7 +98,23 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule | |||
92 | 98 | ||
93 | private void OnObjectAddedToScene(SceneObjectGroup so) | 99 | private void OnObjectAddedToScene(SceneObjectGroup so) |
94 | { | 100 | { |
95 | so.RootPart.DynObjs.Add(Name, new MyObject()); | 101 | SceneObjectPart rootPart = so.RootPart; |
102 | |||
103 | OSDMap attrs; | ||
104 | |||
105 | int movesSoFar = 0; | ||
106 | |||
107 | // Console.WriteLine("Here for {0}", so.Name); | ||
108 | |||
109 | if (rootPart.DynAttrs.TryGetValue(DAExampleModule.DANamespace, out attrs)) | ||
110 | { | ||
111 | movesSoFar = attrs["moves"].AsInteger(); | ||
112 | |||
113 | m_log.DebugFormat( | ||
114 | "[DO EXAMPLE MODULE]: Found saved moves {0} for {1} in {2}", movesSoFar, so.Name, m_scene.Name); | ||
115 | } | ||
116 | |||
117 | rootPart.DynObjs.Add(Name, new MyObject(movesSoFar)); | ||
96 | } | 118 | } |
97 | 119 | ||
98 | private bool OnSceneGroupMove(UUID groupId, Vector3 delta) | 120 | private bool OnSceneGroupMove(UUID groupId, Vector3 delta) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 7fc358d..73c592d 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs | |||
@@ -95,6 +95,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
95 | return null; | 95 | return null; |
96 | } | 96 | } |
97 | 97 | ||
98 | public ILandObject GetLandObject(Vector3 position) | ||
99 | { | ||
100 | return GetLandObject(position.X, position.Y); | ||
101 | } | ||
102 | |||
98 | public ILandObject GetLandObject(int x, int y) | 103 | public ILandObject GetLandObject(int x, int y) |
99 | { | 104 | { |
100 | if (m_landManagementModule != null) | 105 | if (m_landManagementModule != null) |
diff --git a/OpenSim/Region/OptionalModules/Framework/Monitoring/ServerStats.cs b/OpenSim/Region/OptionalModules/Framework/Monitoring/ServerStats.cs index a3d2436..6e74ce0 100644 --- a/OpenSim/Region/OptionalModules/Framework/Monitoring/ServerStats.cs +++ b/OpenSim/Region/OptionalModules/Framework/Monitoring/ServerStats.cs | |||
@@ -140,9 +140,12 @@ public class ServerStats : ISharedRegionModule | |||
140 | } | 140 | } |
141 | #endregion ISharedRegionModule | 141 | #endregion ISharedRegionModule |
142 | 142 | ||
143 | private void MakeStat(string pName, string pUnit, string pContainer, Action<Stat> act) | 143 | private void MakeStat(string pName, string pDesc, string pUnit, string pContainer, Action<Stat> act) |
144 | { | 144 | { |
145 | Stat stat = new Stat(pName, pName, "", pUnit, CategoryServer, pContainer, StatType.Pull, act, StatVerbosity.Info); | 145 | string desc = pDesc; |
146 | if (desc == null) | ||
147 | desc = pName; | ||
148 | Stat stat = new Stat(pName, pName, desc, pUnit, CategoryServer, pContainer, StatType.Pull, act, StatVerbosity.Info); | ||
146 | StatsManager.RegisterStat(stat); | 149 | StatsManager.RegisterStat(stat); |
147 | RegisteredStats.Add(pName, stat); | 150 | RegisteredStats.Add(pName, stat); |
148 | } | 151 | } |
@@ -166,16 +169,16 @@ public class ServerStats : ISharedRegionModule | |||
166 | StatsManager.RegisterStat(tempStat); | 169 | StatsManager.RegisterStat(tempStat); |
167 | RegisteredStats.Add(tempName, tempStat); | 170 | RegisteredStats.Add(tempName, tempStat); |
168 | 171 | ||
169 | MakeStat("TotalProcessorTime", "sec", ContainerProcessor, | 172 | MakeStat("TotalProcessorTime", null, "sec", ContainerProcessor, |
170 | (s) => { s.Value = Process.GetCurrentProcess().TotalProcessorTime.TotalSeconds; }); | 173 | (s) => { s.Value = Process.GetCurrentProcess().TotalProcessorTime.TotalSeconds; }); |
171 | 174 | ||
172 | MakeStat("UserProcessorTime", "sec", ContainerProcessor, | 175 | MakeStat("UserProcessorTime", null, "sec", ContainerProcessor, |
173 | (s) => { s.Value = Process.GetCurrentProcess().UserProcessorTime.TotalSeconds; }); | 176 | (s) => { s.Value = Process.GetCurrentProcess().UserProcessorTime.TotalSeconds; }); |
174 | 177 | ||
175 | MakeStat("PrivilegedProcessorTime", "sec", ContainerProcessor, | 178 | MakeStat("PrivilegedProcessorTime", null, "sec", ContainerProcessor, |
176 | (s) => { s.Value = Process.GetCurrentProcess().PrivilegedProcessorTime.TotalSeconds; }); | 179 | (s) => { s.Value = Process.GetCurrentProcess().PrivilegedProcessorTime.TotalSeconds; }); |
177 | 180 | ||
178 | MakeStat("Threads", "threads", ContainerProcessor, | 181 | MakeStat("Threads", null, "threads", ContainerProcessor, |
179 | (s) => { s.Value = Process.GetCurrentProcess().Threads.Count; }); | 182 | (s) => { s.Value = Process.GetCurrentProcess().Threads.Count; }); |
180 | } | 183 | } |
181 | catch (Exception e) | 184 | catch (Exception e) |
@@ -196,8 +199,10 @@ public class ServerStats : ISharedRegionModule | |||
196 | string nicInterfaceType = nic.NetworkInterfaceType.ToString(); | 199 | string nicInterfaceType = nic.NetworkInterfaceType.ToString(); |
197 | if (!okInterfaceTypes.Contains(nicInterfaceType)) | 200 | if (!okInterfaceTypes.Contains(nicInterfaceType)) |
198 | { | 201 | { |
199 | m_log.DebugFormat("{0} Not including stats for network interface '{1}' of type '{2}'. To include, add to [Monitoring]NetworkInterfaceTypes='Ethernet,Loopback'", | 202 | m_log.DebugFormat("{0} Not including stats for network interface '{1}' of type '{2}'.", |
200 | LogHeader, nic.Name, nicInterfaceType); | 203 | LogHeader, nic.Name, nicInterfaceType); |
204 | m_log.DebugFormat("{0} To include, add to comma separated list in [Monitoring]NetworkInterfaceTypes={1}", | ||
205 | LogHeader, NetworkInterfaceTypes); | ||
201 | continue; | 206 | continue; |
202 | } | 207 | } |
203 | 208 | ||
@@ -206,14 +211,15 @@ public class ServerStats : ISharedRegionModule | |||
206 | IPv4InterfaceStatistics nicStats = nic.GetIPv4Statistics(); | 211 | IPv4InterfaceStatistics nicStats = nic.GetIPv4Statistics(); |
207 | if (nicStats != null) | 212 | if (nicStats != null) |
208 | { | 213 | { |
209 | MakeStat("BytesRcvd/" + nic.Name, "KB", ContainerNetwork, | 214 | MakeStat("BytesRcvd/" + nic.Name, nic.Name, "KB", ContainerNetwork, |
210 | (s) => { LookupNic(s, (ns) => { return ns.BytesReceived; }, 1024.0); }); | 215 | (s) => { LookupNic(s, (ns) => { return ns.BytesReceived; }, 1024.0); }); |
211 | MakeStat("BytesSent/" + nic.Name, "KB", ContainerNetwork, | 216 | MakeStat("BytesSent/" + nic.Name, nic.Name, "KB", ContainerNetwork, |
212 | (s) => { LookupNic(s, (ns) => { return ns.BytesSent; }, 1024.0); }); | 217 | (s) => { LookupNic(s, (ns) => { return ns.BytesSent; }, 1024.0); }); |
213 | MakeStat("TotalBytes/" + nic.Name, "KB", ContainerNetwork, | 218 | MakeStat("TotalBytes/" + nic.Name, nic.Name, "KB", ContainerNetwork, |
214 | (s) => { LookupNic(s, (ns) => { return ns.BytesSent + ns.BytesReceived; }, 1024.0); }); | 219 | (s) => { LookupNic(s, (ns) => { return ns.BytesSent + ns.BytesReceived; }, 1024.0); }); |
215 | } | 220 | } |
216 | } | 221 | } |
222 | // TODO: add IPv6 (it may actually happen someday) | ||
217 | } | 223 | } |
218 | } | 224 | } |
219 | catch (Exception e) | 225 | catch (Exception e) |
@@ -221,13 +227,13 @@ public class ServerStats : ISharedRegionModule | |||
221 | m_log.ErrorFormat("{0} Exception creating 'Network Interface': {1}", LogHeader, e); | 227 | m_log.ErrorFormat("{0} Exception creating 'Network Interface': {1}", LogHeader, e); |
222 | } | 228 | } |
223 | 229 | ||
224 | MakeStat("ProcessMemory", "MB", ContainerMemory, | 230 | MakeStat("ProcessMemory", null, "MB", ContainerMemory, |
225 | (s) => { s.Value = Process.GetCurrentProcess().WorkingSet64 / 1024d / 1024d; }); | 231 | (s) => { s.Value = Process.GetCurrentProcess().WorkingSet64 / 1024d / 1024d; }); |
226 | MakeStat("ObjectMemory", "MB", ContainerMemory, | 232 | MakeStat("ObjectMemory", null, "MB", ContainerMemory, |
227 | (s) => { s.Value = GC.GetTotalMemory(false) / 1024d / 1024d; }); | 233 | (s) => { s.Value = GC.GetTotalMemory(false) / 1024d / 1024d; }); |
228 | MakeStat("LastMemoryChurn", "MB/sec", ContainerMemory, | 234 | MakeStat("LastMemoryChurn", null, "MB/sec", ContainerMemory, |
229 | (s) => { s.Value = Math.Round(MemoryWatchdog.LastMemoryChurn * 1000d / 1024d / 1024d, 3); }); | 235 | (s) => { s.Value = Math.Round(MemoryWatchdog.LastMemoryChurn * 1000d / 1024d / 1024d, 3); }); |
230 | MakeStat("AverageMemoryChurn", "MB/sec", ContainerMemory, | 236 | MakeStat("AverageMemoryChurn", null, "MB/sec", ContainerMemory, |
231 | (s) => { s.Value = Math.Round(MemoryWatchdog.AverageMemoryChurn * 1000d / 1024d / 1024d, 3); }); | 237 | (s) => { s.Value = Math.Round(MemoryWatchdog.AverageMemoryChurn * 1000d / 1024d / 1024d, 3); }); |
232 | } | 238 | } |
233 | 239 | ||
@@ -263,6 +269,8 @@ public class ServerStats : ISharedRegionModule | |||
263 | } | 269 | } |
264 | } | 270 | } |
265 | 271 | ||
272 | // Lookup the nic that goes with this stat and set the value by using a fetch action. | ||
273 | // Not sure about closure with delegates inside delegates. | ||
266 | private delegate double GetIPv4StatValue(IPv4InterfaceStatistics interfaceStat); | 274 | private delegate double GetIPv4StatValue(IPv4InterfaceStatistics interfaceStat); |
267 | private void LookupNic(Stat stat, GetIPv4StatValue getter, double factor) | 275 | private void LookupNic(Stat stat, GetIPv4StatValue getter, double factor) |
268 | { | 276 | { |
@@ -275,7 +283,10 @@ public class ServerStats : ISharedRegionModule | |||
275 | { | 283 | { |
276 | IPv4InterfaceStatistics intrStats = nic.GetIPv4Statistics(); | 284 | IPv4InterfaceStatistics intrStats = nic.GetIPv4Statistics(); |
277 | if (intrStats != null) | 285 | if (intrStats != null) |
278 | stat.Value = Math.Round(getter(intrStats) / factor, 3); | 286 | { |
287 | double newVal = Math.Round(getter(intrStats) / factor, 3); | ||
288 | stat.Value = newVal; | ||
289 | } | ||
279 | break; | 290 | break; |
280 | } | 291 | } |
281 | } | 292 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 235cefc..d347159 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -1335,7 +1335,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1335 | Vector3 unscaledContribVerticalErrorV = vertContributionV; // DEBUG DEBUG | 1335 | Vector3 unscaledContribVerticalErrorV = vertContributionV; // DEBUG DEBUG |
1336 | vertContributionV /= m_verticalAttractionTimescale; | 1336 | vertContributionV /= m_verticalAttractionTimescale; |
1337 | 1337 | ||
1338 | VehicleRotationalVelocity += vertContributionV * VehicleOrientation; | 1338 | VehicleRotationalVelocity += vertContributionV; |
1339 | 1339 | ||
1340 | VDetailLog("{0}, MoveAngular,verticalAttraction,,origRotVW={1},vertError={2},unscaledV={3},eff={4},ts={5},vertContribV={6}", | 1340 | VDetailLog("{0}, MoveAngular,verticalAttraction,,origRotVW={1},vertError={2},unscaledV={3},eff={4},ts={5},vertContribV={6}", |
1341 | Prim.LocalID, origRotVelW, verticalError, unscaledContribVerticalErrorV, | 1341 | Prim.LocalID, origRotVelW, verticalError, unscaledContribVerticalErrorV, |
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs index a133e51..b4abc1d 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs | |||
@@ -68,6 +68,11 @@ public class RegionCombinerLargeLandChannel : ILandChannel | |||
68 | RootRegionLandChannel.Clear(setupDefaultParcel); | 68 | RootRegionLandChannel.Clear(setupDefaultParcel); |
69 | } | 69 | } |
70 | 70 | ||
71 | public ILandObject GetLandObject(Vector3 position) | ||
72 | { | ||
73 | return GetLandObject(position.X, position.Y); | ||
74 | } | ||
75 | |||
71 | public ILandObject GetLandObject(int x, int y) | 76 | public ILandObject GetLandObject(int x, int y) |
72 | { | 77 | { |
73 | //m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y); | 78 | //m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d634805..1fbfc52 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -371,6 +371,80 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
371 | } | 371 | } |
372 | } | 372 | } |
373 | 373 | ||
374 | /// <summary> | ||
375 | /// Get a given link entity from a linkset (linked objects and any sitting avatars). | ||
376 | /// </summary> | ||
377 | /// <remarks> | ||
378 | /// If there are any ScenePresence's in the linkset (i.e. because they are sat upon one of the prims), then | ||
379 | /// these are counted as extra entities that correspond to linknums beyond the number of prims in the linkset. | ||
380 | /// The ScenePresences receive linknums in the order in which they sat. | ||
381 | /// </remarks> | ||
382 | /// <returns> | ||
383 | /// The link entity. null if not found. | ||
384 | /// </returns> | ||
385 | /// <param name='linknum'> | ||
386 | /// Can be either a non-negative integer or ScriptBaseClass.LINK_THIS (-4). | ||
387 | /// If ScriptBaseClass.LINK_THIS then the entity containing the script is returned. | ||
388 | /// If the linkset has one entity and a linknum of zero is given, then the single entity is returned. If any | ||
389 | /// positive integer is given in this case then null is returned. | ||
390 | /// If the linkset has more than one entity and a linknum greater than zero but equal to or less than the number | ||
391 | /// of entities, then the entity which corresponds to that linknum is returned. | ||
392 | /// Otherwise, if a positive linknum is given which is greater than the number of entities in the linkset, then | ||
393 | /// null is returned. | ||
394 | /// </param> | ||
395 | public ISceneEntity GetLinkEntity(int linknum) | ||
396 | { | ||
397 | if (linknum < 0) | ||
398 | { | ||
399 | if (linknum == ScriptBaseClass.LINK_THIS) | ||
400 | return m_host; | ||
401 | else | ||
402 | return null; | ||
403 | } | ||
404 | |||
405 | int actualPrimCount = m_host.ParentGroup.PrimCount; | ||
406 | List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars(); | ||
407 | int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count; | ||
408 | |||
409 | // Special case for a single prim. In this case the linknum is zero. However, this will not match a single | ||
410 | // prim that has any avatars sat upon it (in which case the root prim is link 1). | ||
411 | if (linknum == 0) | ||
412 | { | ||
413 | if (actualPrimCount == 1 && sittingAvatarIds.Count == 0) | ||
414 | return m_host; | ||
415 | |||
416 | return null; | ||
417 | } | ||
418 | // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but | ||
419 | // here we must match 1 (ScriptBaseClass.LINK_ROOT). | ||
420 | else if (linknum == ScriptBaseClass.LINK_ROOT && actualPrimCount == 1) | ||
421 | { | ||
422 | if (sittingAvatarIds.Count > 0) | ||
423 | return m_host.ParentGroup.RootPart; | ||
424 | else | ||
425 | return null; | ||
426 | } | ||
427 | else if (linknum <= adjustedPrimCount) | ||
428 | { | ||
429 | if (linknum <= actualPrimCount) | ||
430 | { | ||
431 | return m_host.ParentGroup.GetLinkNumPart(linknum); | ||
432 | } | ||
433 | else | ||
434 | { | ||
435 | ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]); | ||
436 | if (sp != null) | ||
437 | return sp; | ||
438 | else | ||
439 | return null; | ||
440 | } | ||
441 | } | ||
442 | else | ||
443 | { | ||
444 | return null; | ||
445 | } | ||
446 | } | ||
447 | |||
374 | public List<SceneObjectPart> GetLinkParts(int linkType) | 448 | public List<SceneObjectPart> GetLinkParts(int linkType) |
375 | { | 449 | { |
376 | return GetLinkParts(m_host, linkType); | 450 | return GetLinkParts(m_host, linkType); |
@@ -4149,55 +4223,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4149 | { | 4223 | { |
4150 | m_host.AddScriptLPS(1); | 4224 | m_host.AddScriptLPS(1); |
4151 | 4225 | ||
4152 | if (linknum < 0) | 4226 | ISceneEntity entity = GetLinkEntity(linknum); |
4153 | { | ||
4154 | if (linknum == ScriptBaseClass.LINK_THIS) | ||
4155 | return m_host.Name; | ||
4156 | else | ||
4157 | return ScriptBaseClass.NULL_KEY; | ||
4158 | } | ||
4159 | |||
4160 | int actualPrimCount = m_host.ParentGroup.PrimCount; | ||
4161 | List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars(); | ||
4162 | int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count; | ||
4163 | |||
4164 | // Special case for a single prim. In this case the linknum is zero. However, this will not match a single | ||
4165 | // prim that has any avatars sat upon it (in which case the root prim is link 1). | ||
4166 | if (linknum == 0) | ||
4167 | { | ||
4168 | if (actualPrimCount == 1 && sittingAvatarIds.Count == 0) | ||
4169 | return m_host.Name; | ||
4170 | 4227 | ||
4171 | return ScriptBaseClass.NULL_KEY; | 4228 | if (entity != null) |
4172 | } | 4229 | return entity.Name; |
4173 | // Special case to handle a single prim with sitting avatars. GetLinkPart() would only match zero but | ||
4174 | // here we must match 1 (ScriptBaseClass.LINK_ROOT). | ||
4175 | else if (linknum == 1 && actualPrimCount == 1) | ||
4176 | { | ||
4177 | if (sittingAvatarIds.Count > 0) | ||
4178 | return m_host.ParentGroup.RootPart.Name; | ||
4179 | else | ||
4180 | return ScriptBaseClass.NULL_KEY; | ||
4181 | } | ||
4182 | else if (linknum <= adjustedPrimCount) | ||
4183 | { | ||
4184 | if (linknum <= actualPrimCount) | ||
4185 | { | ||
4186 | return m_host.ParentGroup.GetLinkNumPart(linknum).Name; | ||
4187 | } | ||
4188 | else | ||
4189 | { | ||
4190 | ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]); | ||
4191 | if (sp != null) | ||
4192 | return sp.Name; | ||
4193 | else | ||
4194 | return ScriptBaseClass.NULL_KEY; | ||
4195 | } | ||
4196 | } | ||
4197 | else | 4230 | else |
4198 | { | ||
4199 | return ScriptBaseClass.NULL_KEY; | 4231 | return ScriptBaseClass.NULL_KEY; |
4200 | } | ||
4201 | } | 4232 | } |
4202 | 4233 | ||
4203 | public LSL_Integer llGetInventoryNumber(int type) | 4234 | public LSL_Integer llGetInventoryNumber(int type) |
@@ -4562,8 +4593,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4562 | if (presence.UserLevel >= 200) return; | 4593 | if (presence.UserLevel >= 200) return; |
4563 | 4594 | ||
4564 | // agent must be over the owners land | 4595 | // agent must be over the owners land |
4565 | if (m_host.OwnerID == World.LandChannel.GetLandObject( | 4596 | if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) |
4566 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | ||
4567 | { | 4597 | { |
4568 | if (!World.TeleportClientHome(agentId, presence.ControllingClient)) | 4598 | if (!World.TeleportClientHome(agentId, presence.ControllingClient)) |
4569 | { | 4599 | { |
@@ -4579,6 +4609,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4579 | } | 4609 | } |
4580 | } | 4610 | } |
4581 | } | 4611 | } |
4612 | |||
4582 | ScriptSleep(5000); | 4613 | ScriptSleep(5000); |
4583 | } | 4614 | } |
4584 | 4615 | ||
@@ -4598,10 +4629,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4598 | if (destination == String.Empty) | 4629 | if (destination == String.Empty) |
4599 | destination = World.RegionInfo.RegionName; | 4630 | destination = World.RegionInfo.RegionName; |
4600 | 4631 | ||
4601 | Vector3 pos = presence.AbsolutePosition; | ||
4602 | |||
4603 | // agent must be over the owners land | 4632 | // agent must be over the owners land |
4604 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) | 4633 | if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) |
4605 | { | 4634 | { |
4606 | DoLLTeleport(presence, destination, targetPos, targetLookAt); | 4635 | DoLLTeleport(presence, destination, targetPos, targetLookAt); |
4607 | } | 4636 | } |
@@ -4631,10 +4660,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4631 | // agent must not be a god | 4660 | // agent must not be a god |
4632 | if (presence.GodLevel >= 200) return; | 4661 | if (presence.GodLevel >= 200) return; |
4633 | 4662 | ||
4634 | Vector3 pos = presence.AbsolutePosition; | ||
4635 | |||
4636 | // agent must be over the owners land | 4663 | // agent must be over the owners land |
4637 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) | 4664 | if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) |
4638 | { | 4665 | { |
4639 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); | 4666 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); |
4640 | } | 4667 | } |
@@ -4849,7 +4876,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4849 | { | 4876 | { |
4850 | if (pushrestricted) | 4877 | if (pushrestricted) |
4851 | { | 4878 | { |
4852 | ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos.X, PusheePos.Y); | 4879 | ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos); |
4853 | 4880 | ||
4854 | // We didn't find the parcel but region is push restricted so assume it is NOT ok | 4881 | // We didn't find the parcel but region is push restricted so assume it is NOT ok |
4855 | if (targetlandObj == null) | 4882 | if (targetlandObj == null) |
@@ -4864,7 +4891,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4864 | } | 4891 | } |
4865 | else | 4892 | else |
4866 | { | 4893 | { |
4867 | ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos.X, PusheePos.Y); | 4894 | ILandObject targetlandObj = World.LandChannel.GetLandObject(PusheePos); |
4868 | if (targetlandObj == null) | 4895 | if (targetlandObj == null) |
4869 | { | 4896 | { |
4870 | // We didn't find the parcel but region isn't push restricted so assume it's ok | 4897 | // We didn't find the parcel but region isn't push restricted so assume it's ok |
@@ -6146,12 +6173,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6146 | } | 6173 | } |
6147 | 6174 | ||
6148 | ILandObject land; | 6175 | ILandObject land; |
6149 | Vector3 pos; | ||
6150 | UUID id = UUID.Zero; | 6176 | UUID id = UUID.Zero; |
6177 | |||
6151 | if (parcel || parcelOwned) | 6178 | if (parcel || parcelOwned) |
6152 | { | 6179 | { |
6153 | pos = m_host.ParentGroup.RootPart.GetWorldPosition(); | 6180 | land = World.LandChannel.GetLandObject(m_host.ParentGroup.RootPart.GetWorldPosition()); |
6154 | land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
6155 | if (land == null) | 6181 | if (land == null) |
6156 | { | 6182 | { |
6157 | id = UUID.Zero; | 6183 | id = UUID.Zero; |
@@ -6177,8 +6203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6177 | { | 6203 | { |
6178 | if (!regionWide) | 6204 | if (!regionWide) |
6179 | { | 6205 | { |
6180 | pos = ssp.AbsolutePosition; | 6206 | land = World.LandChannel.GetLandObject(ssp.AbsolutePosition); |
6181 | land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
6182 | if (land != null) | 6207 | if (land != null) |
6183 | { | 6208 | { |
6184 | if (parcelOwned && land.LandData.OwnerID == id || | 6209 | if (parcelOwned && land.LandData.OwnerID == id || |
@@ -6308,10 +6333,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6308 | ScenePresence presence = World.GetScenePresence(agentID); | 6333 | ScenePresence presence = World.GetScenePresence(agentID); |
6309 | if (presence != null) | 6334 | if (presence != null) |
6310 | { | 6335 | { |
6311 | Vector3 pos = presence.AbsolutePosition; | ||
6312 | |||
6313 | // agent must be over the owners land | 6336 | // agent must be over the owners land |
6314 | ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); | 6337 | ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition); |
6315 | if (land == null) | 6338 | if (land == null) |
6316 | return; | 6339 | return; |
6317 | 6340 | ||
@@ -6340,9 +6363,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6340 | ScenePresence presence = World.GetScenePresence(key); | 6363 | ScenePresence presence = World.GetScenePresence(key); |
6341 | if (presence != null) // object is an avatar | 6364 | if (presence != null) // object is an avatar |
6342 | { | 6365 | { |
6343 | Vector3 pos = presence.AbsolutePosition; | 6366 | if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) |
6344 | |||
6345 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) | ||
6346 | return 1; | 6367 | return 1; |
6347 | } | 6368 | } |
6348 | else // object is not an avatar | 6369 | else // object is not an avatar |
@@ -6351,9 +6372,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6351 | 6372 | ||
6352 | if (obj != null) | 6373 | if (obj != null) |
6353 | { | 6374 | { |
6354 | Vector3 pos = obj.AbsolutePosition; | 6375 | if (m_host.OwnerID == World.LandChannel.GetLandObject(obj.AbsolutePosition).LandData.OwnerID) |
6355 | |||
6356 | if (m_host.OwnerID == World.LandChannel.GetLandObject(pos.X, pos.Y).LandData.OwnerID) | ||
6357 | return 1; | 6376 | return 1; |
6358 | } | 6377 | } |
6359 | } | 6378 | } |
@@ -6463,10 +6482,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6463 | // if the land is group owned and the object is group owned by the same group | 6482 | // if the land is group owned and the object is group owned by the same group |
6464 | // or | 6483 | // or |
6465 | // if the object is owned by a person with estate access. | 6484 | // if the object is owned by a person with estate access. |
6466 | 6485 | ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition); | |
6467 | Vector3 pos = av.AbsolutePosition; | ||
6468 | |||
6469 | ILandObject parcel = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
6470 | if (parcel != null) | 6486 | if (parcel != null) |
6471 | { | 6487 | { |
6472 | if (m_host.OwnerID == parcel.LandData.OwnerID || | 6488 | if (m_host.OwnerID == parcel.LandData.OwnerID || |
@@ -7053,9 +7069,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7053 | { | 7069 | { |
7054 | m_host.AddScriptLPS(1); | 7070 | m_host.AddScriptLPS(1); |
7055 | UUID key; | 7071 | UUID key; |
7056 | Vector3 pos = m_host.AbsolutePosition; | 7072 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
7057 | 7073 | ||
7058 | ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
7059 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) | 7074 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
7060 | { | 7075 | { |
7061 | int expires = 0; | 7076 | int expires = 0; |
@@ -8492,8 +8507,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8492 | { | 8507 | { |
8493 | m_host.AddScriptLPS(1); | 8508 | m_host.AddScriptLPS(1); |
8494 | 8509 | ||
8495 | Vector3 pos = m_host.AbsolutePosition; | 8510 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
8496 | ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
8497 | 8511 | ||
8498 | if (land.LandData.OwnerID != m_host.OwnerID) | 8512 | if (land.LandData.OwnerID != m_host.OwnerID) |
8499 | return; | 8513 | return; |
@@ -8507,8 +8521,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8507 | { | 8521 | { |
8508 | m_host.AddScriptLPS(1); | 8522 | m_host.AddScriptLPS(1); |
8509 | 8523 | ||
8510 | Vector3 pos = m_host.AbsolutePosition; | 8524 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
8511 | ILandObject land = World.LandChannel.GetLandObject(pos.X, pos.Y); | ||
8512 | 8525 | ||
8513 | if (land.LandData.OwnerID != m_host.OwnerID) | 8526 | if (land.LandData.OwnerID != m_host.OwnerID) |
8514 | return String.Empty; | 8527 | return String.Empty; |
@@ -8717,8 +8730,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8717 | 8730 | ||
8718 | public LSL_Vector llGetGeometricCenter() | 8731 | public LSL_Vector llGetGeometricCenter() |
8719 | { | 8732 | { |
8720 | Vector3 tmp = m_host.GetGeometricCenter(); | 8733 | return new LSL_Vector(m_host.GetGeometricCenter()); |
8721 | return new LSL_Vector(tmp.X, tmp.Y, tmp.Z); | ||
8722 | } | 8734 | } |
8723 | 8735 | ||
8724 | public LSL_List llGetPrimitiveParams(LSL_List rules) | 8736 | public LSL_List llGetPrimitiveParams(LSL_List rules) |
@@ -8825,9 +8837,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8825 | break; | 8837 | break; |
8826 | 8838 | ||
8827 | case (int)ScriptBaseClass.PRIM_SIZE: | 8839 | case (int)ScriptBaseClass.PRIM_SIZE: |
8828 | res.Add(new LSL_Vector(part.Scale.X, | 8840 | res.Add(new LSL_Vector(part.Scale)); |
8829 | part.Scale.Y, | ||
8830 | part.Scale.Z)); | ||
8831 | break; | 8841 | break; |
8832 | 8842 | ||
8833 | case (int)ScriptBaseClass.PRIM_ROTATION: | 8843 | case (int)ScriptBaseClass.PRIM_ROTATION: |
@@ -9188,9 +9198,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9188 | case (int)ScriptBaseClass.PRIM_DESC: | 9198 | case (int)ScriptBaseClass.PRIM_DESC: |
9189 | res.Add(new LSL_String(part.Description)); | 9199 | res.Add(new LSL_String(part.Description)); |
9190 | break; | 9200 | break; |
9191 | 9201 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | |
9192 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 9202 | res.Add(new LSL_Rotation(part.RotationOffset)); |
9193 | res.Add(new LSL_Rotation(part.RotationOffset.X, part.RotationOffset.Y, part.RotationOffset.Z, part.RotationOffset.W)); | ||
9194 | break; | 9203 | break; |
9195 | 9204 | ||
9196 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 9205 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: |
@@ -10374,7 +10383,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10374 | 10383 | ||
10375 | // according to the docs, this command only works if script owner and land owner are the same | 10384 | // according to the docs, this command only works if script owner and land owner are the same |
10376 | // lets add estate owners and gods, too, and use the generic permission check. | 10385 | // lets add estate owners and gods, too, and use the generic permission check. |
10377 | ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 10386 | ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
10378 | if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return; | 10387 | if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return; |
10379 | 10388 | ||
10380 | bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? | 10389 | bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? |
@@ -10697,22 +10706,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10697 | m_host.AddScriptLPS(1); | 10706 | m_host.AddScriptLPS(1); |
10698 | 10707 | ||
10699 | if (m_item.PermsGranter == UUID.Zero) | 10708 | if (m_item.PermsGranter == UUID.Zero) |
10700 | return new LSL_Vector(); | 10709 | return Vector3.Zero; |
10701 | 10710 | ||
10702 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 10711 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
10703 | { | 10712 | { |
10704 | ShoutError("No permissions to track the camera"); | 10713 | ShoutError("No permissions to track the camera"); |
10705 | return new LSL_Vector(); | 10714 | return Vector3.Zero; |
10706 | } | 10715 | } |
10707 | 10716 | ||
10708 | // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 10717 | // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
10709 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); | 10718 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
10710 | if (presence != null) | 10719 | if (presence != null) |
10711 | { | 10720 | { |
10712 | LSL_Vector pos = new LSL_Vector(presence.CameraPosition.X, presence.CameraPosition.Y, presence.CameraPosition.Z); | 10721 | LSL_Vector pos = new LSL_Vector(presence.CameraPosition); |
10713 | return pos; | 10722 | return pos; |
10714 | } | 10723 | } |
10715 | return new LSL_Vector(); | 10724 | |
10725 | return Vector3.Zero; | ||
10716 | } | 10726 | } |
10717 | 10727 | ||
10718 | public LSL_Rotation llGetCameraRot() | 10728 | public LSL_Rotation llGetCameraRot() |
@@ -10720,22 +10730,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10720 | m_host.AddScriptLPS(1); | 10730 | m_host.AddScriptLPS(1); |
10721 | 10731 | ||
10722 | if (m_item.PermsGranter == UUID.Zero) | 10732 | if (m_item.PermsGranter == UUID.Zero) |
10723 | return new LSL_Rotation(); | 10733 | return Quaternion.Identity; |
10724 | 10734 | ||
10725 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) | 10735 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) |
10726 | { | 10736 | { |
10727 | ShoutError("No permissions to track the camera"); | 10737 | ShoutError("No permissions to track the camera"); |
10728 | return new LSL_Rotation(); | 10738 | return Quaternion.Identity; |
10729 | } | 10739 | } |
10730 | 10740 | ||
10731 | // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 10741 | // ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
10732 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); | 10742 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
10733 | if (presence != null) | 10743 | if (presence != null) |
10734 | { | 10744 | { |
10735 | return new LSL_Rotation(presence.CameraRotation.X, presence.CameraRotation.Y, presence.CameraRotation.Z, presence.CameraRotation.W); | 10745 | return new LSL_Rotation(presence.CameraRotation); |
10736 | } | 10746 | } |
10737 | 10747 | ||
10738 | return new LSL_Rotation(); | 10748 | return Quaternion.Identity; |
10739 | } | 10749 | } |
10740 | 10750 | ||
10741 | /// <summary> | 10751 | /// <summary> |
@@ -10816,7 +10826,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10816 | { | 10826 | { |
10817 | m_host.AddScriptLPS(1); | 10827 | m_host.AddScriptLPS(1); |
10818 | UUID key; | 10828 | UUID key; |
10819 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 10829 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
10820 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) | 10830 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
10821 | { | 10831 | { |
10822 | int expires = 0; | 10832 | int expires = 0; |
@@ -10857,7 +10867,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10857 | { | 10867 | { |
10858 | m_host.AddScriptLPS(1); | 10868 | m_host.AddScriptLPS(1); |
10859 | UUID key; | 10869 | UUID key; |
10860 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 10870 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
10861 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) | 10871 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) |
10862 | { | 10872 | { |
10863 | if (UUID.TryParse(avatar, out key)) | 10873 | if (UUID.TryParse(avatar, out key)) |
@@ -10884,7 +10894,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10884 | { | 10894 | { |
10885 | m_host.AddScriptLPS(1); | 10895 | m_host.AddScriptLPS(1); |
10886 | UUID key; | 10896 | UUID key; |
10887 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 10897 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
10888 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) | 10898 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
10889 | { | 10899 | { |
10890 | if (UUID.TryParse(avatar, out key)) | 10900 | if (UUID.TryParse(avatar, out key)) |
@@ -11250,7 +11260,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11250 | public void llResetLandBanList() | 11260 | public void llResetLandBanList() |
11251 | { | 11261 | { |
11252 | m_host.AddScriptLPS(1); | 11262 | m_host.AddScriptLPS(1); |
11253 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 11263 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData; |
11254 | if (land.OwnerID == m_host.OwnerID) | 11264 | if (land.OwnerID == m_host.OwnerID) |
11255 | { | 11265 | { |
11256 | foreach (LandAccessEntry entry in land.ParcelAccessList) | 11266 | foreach (LandAccessEntry entry in land.ParcelAccessList) |
@@ -11267,7 +11277,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11267 | public void llResetLandPassList() | 11277 | public void llResetLandPassList() |
11268 | { | 11278 | { |
11269 | m_host.AddScriptLPS(1); | 11279 | m_host.AddScriptLPS(1); |
11270 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 11280 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData; |
11271 | if (land.OwnerID == m_host.OwnerID) | 11281 | if (land.OwnerID == m_host.OwnerID) |
11272 | { | 11282 | { |
11273 | foreach (LandAccessEntry entry in land.ParcelAccessList) | 11283 | foreach (LandAccessEntry entry in land.ParcelAccessList) |
@@ -11967,7 +11977,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11967 | World.ForEachScenePresence(delegate(ScenePresence sp) | 11977 | World.ForEachScenePresence(delegate(ScenePresence sp) |
11968 | { | 11978 | { |
11969 | Vector3 ac = sp.AbsolutePosition - rayStart; | 11979 | Vector3 ac = sp.AbsolutePosition - rayStart; |
11970 | Vector3 bc = sp.AbsolutePosition - rayEnd; | 11980 | // Vector3 bc = sp.AbsolutePosition - rayEnd; |
11971 | 11981 | ||
11972 | double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); | 11982 | double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); |
11973 | 11983 | ||
@@ -12057,7 +12067,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12057 | radius = Math.Abs(maxZ); | 12067 | radius = Math.Abs(maxZ); |
12058 | radius = radius*1.413f; | 12068 | radius = radius*1.413f; |
12059 | Vector3 ac = group.AbsolutePosition - rayStart; | 12069 | Vector3 ac = group.AbsolutePosition - rayStart; |
12060 | Vector3 bc = group.AbsolutePosition - rayEnd; | 12070 | // Vector3 bc = group.AbsolutePosition - rayEnd; |
12061 | 12071 | ||
12062 | double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); | 12072 | double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); |
12063 | 12073 | ||
@@ -12435,7 +12445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12435 | list.Add(new LSL_Integer(linkNum)); | 12445 | list.Add(new LSL_Integer(linkNum)); |
12436 | 12446 | ||
12437 | if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL) | 12447 | if ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) == ScriptBaseClass.RC_GET_NORMAL) |
12438 | list.Add(new LSL_Vector(result.Normal.X, result.Normal.Y, result.Normal.Z)); | 12448 | list.Add(new LSL_Vector(result.Normal)); |
12439 | 12449 | ||
12440 | values++; | 12450 | values++; |
12441 | if (values >= count) | 12451 | if (values >= count) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a214935..234ba34 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -372,7 +372,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
372 | //OSSL only may be used if object is in the same group as the parcel | 372 | //OSSL only may be used if object is in the same group as the parcel |
373 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) | 373 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) |
374 | { | 374 | { |
375 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 375 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
376 | 376 | ||
377 | if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) | 377 | if (land.LandData.GroupID == m_item.GroupID && land.LandData.GroupID != UUID.Zero) |
378 | { | 378 | { |
@@ -383,7 +383,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
383 | //Only Parcelowners may use the function | 383 | //Only Parcelowners may use the function |
384 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_OWNER")) | 384 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_OWNER")) |
385 | { | 385 | { |
386 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 386 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
387 | 387 | ||
388 | if (land.LandData.OwnerID == ownerID) | 388 | if (land.LandData.OwnerID == ownerID) |
389 | { | 389 | { |
@@ -1511,8 +1511,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1511 | 1511 | ||
1512 | m_host.AddScriptLPS(1); | 1512 | m_host.AddScriptLPS(1); |
1513 | 1513 | ||
1514 | ILandObject land | 1514 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
1515 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
1516 | 1515 | ||
1517 | if (land.LandData.OwnerID != m_host.OwnerID) | 1516 | if (land.LandData.OwnerID != m_host.OwnerID) |
1518 | return; | 1517 | return; |
@@ -1528,8 +1527,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1528 | 1527 | ||
1529 | m_host.AddScriptLPS(1); | 1528 | m_host.AddScriptLPS(1); |
1530 | 1529 | ||
1531 | ILandObject land | 1530 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); |
1532 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
1533 | 1531 | ||
1534 | if (land.LandData.OwnerID != m_host.OwnerID) | 1532 | if (land.LandData.OwnerID != m_host.OwnerID) |
1535 | { | 1533 | { |
@@ -2578,13 +2576,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2578 | ScenePresence sp = World.GetScenePresence(npcId); | 2576 | ScenePresence sp = World.GetScenePresence(npcId); |
2579 | 2577 | ||
2580 | if (sp != null) | 2578 | if (sp != null) |
2581 | { | 2579 | return new LSL_Vector(sp.AbsolutePosition); |
2582 | Vector3 pos = sp.AbsolutePosition; | ||
2583 | return new LSL_Vector(pos.X, pos.Y, pos.Z); | ||
2584 | } | ||
2585 | } | 2580 | } |
2586 | 2581 | ||
2587 | return new LSL_Vector(0, 0, 0); | 2582 | return Vector3.Zero; |
2588 | } | 2583 | } |
2589 | 2584 | ||
2590 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos) | 2585 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos) |
@@ -2652,7 +2647,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2652 | return new LSL_Rotation(sp.GetWorldRotation()); | 2647 | return new LSL_Rotation(sp.GetWorldRotation()); |
2653 | } | 2648 | } |
2654 | 2649 | ||
2655 | return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); | 2650 | return Quaternion.Identity; |
2656 | } | 2651 | } |
2657 | 2652 | ||
2658 | public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) | 2653 | public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) |
@@ -3098,20 +3093,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3098 | 3093 | ||
3099 | UUID avatarId = new UUID(avatar); | 3094 | UUID avatarId = new UUID(avatar); |
3100 | ScenePresence presence = World.GetScenePresence(avatarId); | 3095 | ScenePresence presence = World.GetScenePresence(avatarId); |
3101 | Vector3 pos = m_host.GetWorldPosition(); | 3096 | |
3102 | bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.X, (float)pos.Y, (float)pos.Z)); | 3097 | if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) |
3103 | if (result) | ||
3104 | { | 3098 | { |
3105 | if (presence != null) | 3099 | float health = presence.Health; |
3106 | { | 3100 | health += (float)healing; |
3107 | float health = presence.Health; | 3101 | |
3108 | health += (float)healing; | 3102 | if (health >= 100) |
3109 | if (health >= 100) | 3103 | health = 100; |
3110 | { | 3104 | |
3111 | health = 100; | 3105 | presence.setHealthWithUpdate(health); |
3112 | } | ||
3113 | presence.setHealthWithUpdate(health); | ||
3114 | } | ||
3115 | } | 3106 | } |
3116 | } | 3107 | } |
3117 | 3108 | ||
@@ -3188,8 +3179,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3188 | if (avatar != null && avatar.UUID != m_host.OwnerID) | 3179 | if (avatar != null && avatar.UUID != m_host.OwnerID) |
3189 | { | 3180 | { |
3190 | result.Add(new LSL_String(avatar.UUID.ToString())); | 3181 | result.Add(new LSL_String(avatar.UUID.ToString())); |
3191 | OpenMetaverse.Vector3 ap = avatar.AbsolutePosition; | 3182 | result.Add(new LSL_Vector(avatar.AbsolutePosition)); |
3192 | result.Add(new LSL_Vector(ap.X, ap.Y, ap.Z)); | ||
3193 | result.Add(new LSL_String(avatar.Name)); | 3183 | result.Add(new LSL_String(avatar.Name)); |
3194 | } | 3184 | } |
3195 | }); | 3185 | }); |