aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorMelanie2010-08-26 00:11:07 +0100
committerMelanie2010-08-26 00:11:07 +0100
commitfc8d2be632c754338b136fe4a3d57c40b0190ce7 (patch)
tree94bb954bdf258e968e8c337ad1da57ba9fa68b91 /OpenSim/Region/ScriptEngine/Shared
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-fc8d2be632c754338b136fe4a3d57c40b0190ce7.zip
opensim-SC-fc8d2be632c754338b136fe4a3d57c40b0190ce7.tar.gz
opensim-SC-fc8d2be632c754338b136fe4a3d57c40b0190ce7.tar.bz2
opensim-SC-fc8d2be632c754338b136fe4a3d57c40b0190ce7.tar.xz
Merge branch 'master' into careminster-presence-refactor
This was rather conflicted. Please test linking.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs69
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs505
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Helpers.cs11
3 files changed, 551 insertions, 34 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index a407ef3..8381efa 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -293,7 +293,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
293 { 293 {
294 case ScriptBaseClass.LINK_SET: 294 case ScriptBaseClass.LINK_SET:
295 if (m_host.ParentGroup != null) 295 if (m_host.ParentGroup != null)
296 return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); 296 {
297 lock (m_host.ParentGroup.Children)
298 return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
299 }
297 return ret; 300 return ret;
298 301
299 case ScriptBaseClass.LINK_ROOT: 302 case ScriptBaseClass.LINK_ROOT:
@@ -308,7 +311,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
308 case ScriptBaseClass.LINK_ALL_OTHERS: 311 case ScriptBaseClass.LINK_ALL_OTHERS:
309 if (m_host.ParentGroup == null) 312 if (m_host.ParentGroup == null)
310 return new List<SceneObjectPart>(); 313 return new List<SceneObjectPart>();
311 ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); 314
315 lock (m_host.ParentGroup.Children)
316 ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
317
312 if (ret.Contains(m_host)) 318 if (ret.Contains(m_host))
313 ret.Remove(m_host); 319 ret.Remove(m_host);
314 return ret; 320 return ret;
@@ -316,7 +322,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
316 case ScriptBaseClass.LINK_ALL_CHILDREN: 322 case ScriptBaseClass.LINK_ALL_CHILDREN:
317 if (m_host.ParentGroup == null) 323 if (m_host.ParentGroup == null)
318 return new List<SceneObjectPart>(); 324 return new List<SceneObjectPart>();
319 ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); 325
326 lock (m_host.ParentGroup.Children)
327 ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
328
320 if (ret.Contains(m_host.ParentGroup.RootPart)) 329 if (ret.Contains(m_host.ParentGroup.RootPart))
321 ret.Remove(m_host.ParentGroup.RootPart); 330 ret.Remove(m_host.ParentGroup.RootPart);
322 return ret; 331 return ret;
@@ -1272,12 +1281,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1272 if (group == null) 1281 if (group == null)
1273 return; 1282 return;
1274 bool allow = true; 1283 bool allow = true;
1275 foreach (SceneObjectPart part in group.Children.Values) 1284
1285 lock (group.Children)
1276 { 1286 {
1277 if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys) 1287 foreach (SceneObjectPart part in group.Children.Values)
1278 { 1288 {
1279 allow = false; 1289 if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys)
1280 break; 1290 {
1291 allow = false;
1292 break;
1293 }
1281 } 1294 }
1282 } 1295 }
1283 1296
@@ -3757,7 +3770,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3757 { 3770 {
3758 m_host.AddScriptLPS(1); 3771 m_host.AddScriptLPS(1);
3759 3772
3760 if (m_host.ParentGroup.Children.Count > 1) 3773 if (m_host.ParentGroup.PrimCount > 1)
3761 { 3774 {
3762 return m_host.LinkNum; 3775 return m_host.LinkNum;
3763 } 3776 }
@@ -3878,15 +3891,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3878 case ScriptBaseClass.LINK_ALL_OTHERS: 3891 case ScriptBaseClass.LINK_ALL_OTHERS:
3879 case ScriptBaseClass.LINK_ALL_CHILDREN: 3892 case ScriptBaseClass.LINK_ALL_CHILDREN:
3880 case ScriptBaseClass.LINK_THIS: 3893 case ScriptBaseClass.LINK_THIS:
3881 foreach (SceneObjectPart part in parentPrim.Children.Values) 3894 lock (parentPrim.Children)
3882 { 3895 {
3883 if (part.UUID != m_host.UUID) 3896 foreach (SceneObjectPart part in parentPrim.Children.Values)
3884 { 3897 {
3885 childPrim = part; 3898 if (part.UUID != m_host.UUID)
3886 break; 3899 {
3900 childPrim = part;
3901 break;
3902 }
3887 } 3903 }
3904 break;
3888 } 3905 }
3889 break;
3890 default: 3906 default:
3891 childPrim = parentPrim.GetLinkNumPart(linknum); 3907 childPrim = parentPrim.GetLinkNumPart(linknum);
3892 if (childPrim.UUID == m_host.UUID) 3908 if (childPrim.UUID == m_host.UUID)
@@ -3962,26 +3978,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3962 if (parentPrim.RootPart.AttachmentPoint != 0) 3978 if (parentPrim.RootPart.AttachmentPoint != 0)
3963 return; // Fail silently if attached 3979 return; // Fail silently if attached
3964 3980
3965 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values); 3981 lock (parentPrim.Children)
3966 parts.Remove(parentPrim.RootPart);
3967 if (parts.Count > 0)
3968 { 3982 {
3969 try 3983 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
3970 { 3984 parts.Remove(parentPrim.RootPart);
3971 parts[0].ParentGroup.areUpdatesSuspended = true; 3985
3972 foreach (SceneObjectPart part in parts) 3986 foreach (SceneObjectPart part in parts)
3973 {
3974 parentPrim.DelinkFromGroup(part.LocalId, true);
3975 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
3976 }
3977 }
3978 finally
3979 { 3987 {
3980 parts[0].ParentGroup.areUpdatesSuspended = false; 3988 parentPrim.DelinkFromGroup(part.LocalId, true);
3989 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
3981 } 3990 }
3991 parentPrim.HasGroupChanged = true;
3992 parentPrim.ScheduleGroupForFullUpdate();
3982 } 3993 }
3983 parentPrim.HasGroupChanged = true;
3984 parentPrim.ScheduleGroupForFullUpdate();
3985 } 3994 }
3986 3995
3987 public LSL_String llGetLinkKey(int linknum) 3996 public LSL_String llGetLinkKey(int linknum)
@@ -4545,7 +4554,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4545 { 4554 {
4546 partItemID = item.ItemID; 4555 partItemID = item.ItemID;
4547 int linkNumber = m_host.LinkNum; 4556 int linkNumber = m_host.LinkNum;
4548 if (m_host.ParentGroup.Children.Count == 1) 4557 if (m_host.ParentGroup.PrimCount == 1)
4549 linkNumber = 0; 4558 linkNumber = 0;
4550 4559
4551 object[] resobj = new object[] 4560 object[] resobj = new object[]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index f0384f8..91e2c3b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -1,3 +1,4 @@
1<<<<<<< HEAD:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
1/* 2/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 3 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 4 * See CONTRIBUTORS.TXT for a full list of copyright holders.
@@ -505,3 +506,507 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
505 506
506 } 507 }
507} 508}
509=======
510/*
511 * Copyright (c) Contributors, http://opensimulator.org/
512 * See CONTRIBUTORS.TXT for a full list of copyright holders.
513 *
514 * Redistribution and use in source and binary forms, with or without
515 * modification, are permitted provided that the following conditions are met:
516 * * Redistributions of source code must retain the above copyright
517 * notice, this list of conditions and the following disclaimer.
518 * * Redistributions in binary form must reproduce the above copyright
519 * notice, this list of conditions and the following disclaimer in the
520 * documentation and/or other materials provided with the distribution.
521 * * Neither the name of the OpenSimulator Project nor the
522 * names of its contributors may be used to endorse or promote products
523 * derived from this software without specific prior written permission.
524 *
525 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
526 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
527 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
528 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
529 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
530 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
531 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
532 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
533 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
534 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
535 */
536
537using System;
538using System.Reflection;
539using System.Collections;
540using System.Collections.Generic;
541using System.Runtime.Remoting.Lifetime;
542using OpenMetaverse;
543using Nini.Config;
544using OpenSim;
545using OpenSim.Framework;
546using OpenSim.Region.CoreModules.World.LightShare;
547using OpenSim.Region.Framework.Interfaces;
548using OpenSim.Region.Framework.Scenes;
549using OpenSim.Region.ScriptEngine.Shared;
550using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
551using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
552using OpenSim.Region.ScriptEngine.Interfaces;
553using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
554
555using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
556using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
557using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
558using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
559using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
560using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
561using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
562
563namespace OpenSim.Region.ScriptEngine.Shared.Api
564{
565 [Serializable]
566 public class LS_Api : MarshalByRefObject, ILS_Api, IScriptApi
567 {
568 internal IScriptEngine m_ScriptEngine;
569 internal SceneObjectPart m_host;
570 internal uint m_localID;
571 internal UUID m_itemID;
572 internal bool m_LSFunctionsEnabled = false;
573 internal IScriptModuleComms m_comms = null;
574
575 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
576 {
577 m_ScriptEngine = ScriptEngine;
578 m_host = host;
579 m_localID = localID;
580 m_itemID = itemID;
581
582 if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
583 m_LSFunctionsEnabled = true;
584
585 m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>();
586 if (m_comms == null)
587 m_LSFunctionsEnabled = false;
588 }
589
590 public override Object InitializeLifetimeService()
591 {
592 ILease lease = (ILease)base.InitializeLifetimeService();
593
594 if (lease.CurrentState == LeaseState.Initial)
595 {
596 lease.InitialLeaseTime = TimeSpan.FromMinutes(0);
597 // lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
598 // lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
599 }
600 return lease;
601 }
602
603 public Scene World
604 {
605 get { return m_ScriptEngine.World; }
606 }
607
608 //
609 //Dumps an error message on the debug console.
610 //
611
612 internal void LSShoutError(string message)
613 {
614 if (message.Length > 1023)
615 message = message.Substring(0, 1023);
616
617 World.SimChat(Utils.StringToBytes(message),
618 ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true);
619
620 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
621 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
622 }
623
624 /// <summary>
625 /// Get the current Windlight scene
626 /// </summary>
627 /// <returns>List of windlight parameters</returns>
628 public LSL_List lsGetWindlightScene(LSL_List rules)
629 {
630 if (!m_LSFunctionsEnabled)
631 {
632 LSShoutError("LightShare functions are not enabled.");
633 return new LSL_List();
634 }
635 m_host.AddScriptLPS(1);
636 RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
637
638 LSL_List values = new LSL_List();
639 int idx = 0;
640 while (idx < rules.Length)
641 {
642 uint rule = (uint)rules.GetLSLIntegerItem(idx);
643 LSL_List toadd = new LSL_List();
644
645 switch (rule)
646 {
647 case (int)ScriptBaseClass.WL_AMBIENT:
648 toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W));
649 break;
650 case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
651 toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f));
652 break;
653 case (int)ScriptBaseClass.WL_BLUE_DENSITY:
654 toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W));
655 break;
656 case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
657 toadd.Add(new LSL_Float(wl.blurMultiplier));
658 break;
659 case (int)ScriptBaseClass.WL_CLOUD_COLOR:
660 toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W));
661 break;
662 case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
663 toadd.Add(new LSL_Float(wl.cloudCoverage));
664 break;
665 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
666 toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z));
667 break;
668 case (int)ScriptBaseClass.WL_CLOUD_SCALE:
669 toadd.Add(new LSL_Float(wl.cloudScale));
670 break;
671 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
672 toadd.Add(new LSL_Float(wl.cloudScrollX));
673 break;
674 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
675 toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0));
676 break;
677 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
678 toadd.Add(new LSL_Float(wl.cloudScrollY));
679 break;
680 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
681 toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0));
682 break;
683 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
684 toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z));
685 break;
686 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
687 toadd.Add(new LSL_Float(wl.densityMultiplier));
688 break;
689 case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
690 toadd.Add(new LSL_Float(wl.distanceMultiplier));
691 break;
692 case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
693 toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0));
694 break;
695 case (int)ScriptBaseClass.WL_EAST_ANGLE:
696 toadd.Add(new LSL_Float(wl.eastAngle));
697 break;
698 case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
699 toadd.Add(new LSL_Float(wl.fresnelOffset));
700 break;
701 case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
702 toadd.Add(new LSL_Float(wl.fresnelScale));
703 break;
704 case (int)ScriptBaseClass.WL_HAZE_DENSITY:
705 toadd.Add(new LSL_Float(wl.hazeDensity));
706 break;
707 case (int)ScriptBaseClass.WL_HAZE_HORIZON:
708 toadd.Add(new LSL_Float(wl.hazeHorizon));
709 break;
710 case (int)ScriptBaseClass.WL_HORIZON:
711 toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W));
712 break;
713 case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
714 toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f));
715 break;
716 case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
717 toadd.Add(new LSL_Integer(wl.maxAltitude));
718 break;
719 case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
720 toadd.Add(new LSL_Key(wl.normalMapTexture.ToString()));
721 break;
722 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
723 toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z));
724 break;
725 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
726 toadd.Add(new LSL_Float(wl.refractScaleAbove));
727 break;
728 case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
729 toadd.Add(new LSL_Float(wl.refractScaleBelow));
730 break;
731 case (int)ScriptBaseClass.WL_SCENE_GAMMA:
732 toadd.Add(new LSL_Float(wl.sceneGamma));
733 break;
734 case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
735 toadd.Add(new LSL_Float(wl.starBrightness));
736 break;
737 case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
738 toadd.Add(new LSL_Float(wl.sunGlowFocus));
739 break;
740 case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
741 toadd.Add(new LSL_Float(wl.sunGlowSize));
742 break;
743 case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
744 toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W));
745 break;
746 case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
747 toadd.Add(new LSL_Float(wl.underwaterFogModifier));
748 break;
749 case (int)ScriptBaseClass.WL_WATER_COLOR:
750 toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z));
751 break;
752 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
753 toadd.Add(new LSL_Float(wl.waterFogDensityExponent));
754 break;
755 }
756
757 if (toadd.Length > 0)
758 {
759 values.Add(rule);
760 values.Add(toadd.Data[0]);
761 }
762 idx++;
763 }
764
765 return values;
766 }
767
768 private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
769 {
770 RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
771
772// LSL_List values = new LSL_List();
773 int idx = 0;
774 while (idx < rules.Length)
775 {
776 uint rule = (uint)rules.GetLSLIntegerItem(idx);
777 LSL_Types.Quaternion iQ;
778 LSL_Types.Vector3 iV;
779 switch (rule)
780 {
781 case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
782 idx++;
783 wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
784 break;
785 case (int)ScriptBaseClass.WL_AMBIENT:
786 idx++;
787 iQ = rules.GetQuaternionItem(idx);
788 wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
789 break;
790 case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
791 idx++;
792 iV = rules.GetVector3Item(idx);
793 wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
794 break;
795 case (int)ScriptBaseClass.WL_BLUE_DENSITY:
796 idx++;
797 iQ = rules.GetQuaternionItem(idx);
798 wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
799 break;
800 case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
801 idx++;
802 wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
803 break;
804 case (int)ScriptBaseClass.WL_CLOUD_COLOR:
805 idx++;
806 iQ = rules.GetQuaternionItem(idx);
807 wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
808 break;
809 case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
810 idx++;
811 wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
812 break;
813 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
814 idx++;
815 iV = rules.GetVector3Item(idx);
816 wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
817 break;
818 case (int)ScriptBaseClass.WL_CLOUD_SCALE:
819 idx++;
820 wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
821 break;
822 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
823 idx++;
824 wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
825 break;
826 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
827 idx++;
828 wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
829 break;
830 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
831 idx++;
832 wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
833 break;
834 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
835 idx++;
836 wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
837 break;
838 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
839 idx++;
840 iV = rules.GetVector3Item(idx);
841 wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
842 break;
843 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
844 idx++;
845 wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
846 break;
847 case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
848 idx++;
849 wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
850 break;
851 case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
852 idx++;
853 wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
854 break;
855 case (int)ScriptBaseClass.WL_EAST_ANGLE:
856 idx++;
857 wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
858 break;
859 case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
860 idx++;
861 wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
862 break;
863 case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
864 idx++;
865 wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
866 break;
867 case (int)ScriptBaseClass.WL_HAZE_DENSITY:
868 idx++;
869 wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
870 break;
871 case (int)ScriptBaseClass.WL_HAZE_HORIZON:
872 idx++;
873 wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx);
874 break;
875 case (int)ScriptBaseClass.WL_HORIZON:
876 idx++;
877 iQ = rules.GetQuaternionItem(idx);
878 wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
879 break;
880 case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
881 idx++;
882 iV = rules.GetVector3Item(idx);
883 wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
884 break;
885 case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
886 idx++;
887 wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
888 break;
889 case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
890 idx++;
891 wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
892 break;
893 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
894 idx++;
895 iV = rules.GetVector3Item(idx);
896 wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
897 break;
898 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
899 idx++;
900 wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
901 break;
902 case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
903 idx++;
904 wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
905 break;
906 case (int)ScriptBaseClass.WL_SCENE_GAMMA:
907 idx++;
908 wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
909 break;
910 case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
911 idx++;
912 wl.starBrightness = (float)rules.GetLSLFloatItem(idx);
913 break;
914 case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
915 idx++;
916 wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx);
917 break;
918 case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
919 idx++;
920 wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx);
921 break;
922 case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
923 idx++;
924 iQ = rules.GetQuaternionItem(idx);
925 wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
926 break;
927 case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
928 idx++;
929 wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
930 break;
931 case (int)ScriptBaseClass.WL_WATER_COLOR:
932 idx++;
933 iV = rules.GetVector3Item(idx);
934 wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
935 break;
936 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
937 idx++;
938 wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
939 break;
940 }
941 idx++;
942 }
943 return wl;
944 }
945 /// <summary>
946 /// Set the current Windlight scene
947 /// </summary>
948 /// <param name="rules"></param>
949 /// <returns>success: true or false</returns>
950 public int lsSetWindlightScene(LSL_List rules)
951 {
952 if (!m_LSFunctionsEnabled)
953 {
954 LSShoutError("LightShare functions are not enabled.");
955 return 0;
956 }
957 if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
958 {
959 LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
960 return 0;
961 }
962 int success = 0;
963 m_host.AddScriptLPS(1);
964 if (LightShareModule.EnableWindlight)
965 {
966 RegionLightShareData wl = getWindlightProfileFromRules(rules);
967 m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
968 success = 1;
969 }
970 else
971 {
972 LSShoutError("Windlight module is disabled");
973 return 0;
974 }
975 return success;
976 }
977 /// <summary>
978 /// Set the current Windlight scene to a target avatar
979 /// </summary>
980 /// <param name="rules"></param>
981 /// <returns>success: true or false</returns>
982 public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
983 {
984 if (!m_LSFunctionsEnabled)
985 {
986 LSShoutError("LightShare functions are not enabled.");
987 return 0;
988 }
989 if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
990 {
991 LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
992 return 0;
993 }
994 int success = 0;
995 m_host.AddScriptLPS(1);
996 if (LightShareModule.EnableWindlight)
997 {
998 RegionLightShareData wl = getWindlightProfileFromRules(rules);
999 World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
1000 success = 1;
1001 }
1002 else
1003 {
1004 LSShoutError("Windlight module is disabled");
1005 return 0;
1006 }
1007 return success;
1008 }
1009
1010 }
1011}
1012>>>>>>> master:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
index 4855d64..41501f2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs
@@ -209,12 +209,15 @@ namespace OpenSim.Region.ScriptEngine.Shared
209 else 209 else
210 Type = 0x02; // Passive 210 Type = 0x02; // Passive
211 211
212 foreach (SceneObjectPart p in part.ParentGroup.Children.Values) 212 lock (part.ParentGroup.Children)
213 { 213 {
214 if (p.Inventory.ContainsScripts()) 214 foreach (SceneObjectPart p in part.ParentGroup.Children.Values)
215 { 215 {
216 Type |= 0x08; // Scripted 216 if (p.Inventory.ContainsScripts())
217 break; 217 {
218 Type |= 0x08; // Scripted
219 break;
220 }
218 } 221 }
219 } 222 }
220 223