aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorTeravus Ovares2008-02-05 05:26:18 +0000
committerTeravus Ovares2008-02-05 05:26:18 +0000
commitca5aadfbff63e03b7ca081e753204d8da040c9bb (patch)
treee2d19e01678c27cff57bc26257cec7385c3df274 /OpenSim/Region/ScriptEngine
parentAdded copyright statements. (diff)
downloadopensim-SC_OLD-ca5aadfbff63e03b7ca081e753204d8da040c9bb.zip
opensim-SC_OLD-ca5aadfbff63e03b7ca081e753204d8da040c9bb.tar.gz
opensim-SC_OLD-ca5aadfbff63e03b7ca081e753204d8da040c9bb.tar.bz2
opensim-SC_OLD-ca5aadfbff63e03b7ca081e753204d8da040c9bb.tar.xz
* Refactored the sound calls to SceneObjectPart
* Fixed a few bugs * Wrote an example module to make certain event systems more mature.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs119
1 files changed, 5 insertions, 114 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 367a5f7..80df86e 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -906,37 +906,8 @@ namespace OpenSim.Region.ScriptEngine.Common
906 906
907 public void llPlaySound(string sound, double volume) 907 public void llPlaySound(string sound, double volume)
908 { 908 {
909 if (volume > 1) 909
910 volume = 1; 910 m_host.SendSound(sound, volume, false);
911 if (volume < 0)
912 volume = 0;
913
914 LLUUID ownerID = m_host.OwnerID;
915 LLUUID objectID = m_host.UUID;
916 LLUUID soundID = LLUUID.Zero;
917 byte flags = 0;
918
919 if (!LLUUID.TryParse(sound, out soundID))
920 {
921 //Trys to fetch sound id from prim's inventory.
922 //Prim's inventory doesn't support non script items yet
923 SceneObjectPart op = World.GetSceneObjectPart(objectID);
924 foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory)
925 {
926 if (item.Value.Name == sound)
927 {
928 soundID = item.Value.ItemID;
929 break;
930 }
931 }
932 }
933
934 List<ScenePresence> avatarts = World.GetAvatars();
935 foreach (ScenePresence p in avatarts)
936 {
937 // TODO: some filtering by distance of avatar
938 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)volume, flags);
939 }
940 } 911 }
941 912
942 public void llLoopSound(string sound, double volume) 913 public void llLoopSound(string sound, double volume)
@@ -961,38 +932,7 @@ namespace OpenSim.Region.ScriptEngine.Common
961 932
962 public void llTriggerSound(string sound, double volume) 933 public void llTriggerSound(string sound, double volume)
963 { 934 {
964 if (volume > 1) 935 m_host.SendSound(sound, volume, true);
965 volume = 1;
966 if (volume < 0)
967 volume = 0;
968
969 LLUUID ownerID = m_host.OwnerID;
970 LLUUID objectID = m_host.UUID;
971 LLUUID parentID = this.m_host.GetRootPartUUID();
972 LLUUID soundID = LLUUID.Zero;
973 LLVector3 position = this.m_host.AbsolutePosition; // region local
974 ulong regionHandle = World.RegionInfo.RegionHandle;
975
976 if (!LLUUID.TryParse(sound, out soundID))
977 {
978 // search sound file from inventory
979 SceneObjectPart op = World.GetSceneObjectPart(objectID);
980 foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory)
981 {
982 if (item.Value.Name == sound)
983 {
984 soundID = item.Value.ItemID;
985 break;
986 }
987 }
988 }
989
990 List<ScenePresence> avatarts = World.GetAvatars();
991 foreach (ScenePresence p in avatarts)
992 {
993 // TODO: some filtering by distance of avatar
994 p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float)volume);
995 }
996 } 936 }
997 937
998 public void llStopSound() 938 public void llStopSound()
@@ -1002,31 +942,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1002 942
1003 public void llPreloadSound(string sound) 943 public void llPreloadSound(string sound)
1004 { 944 {
1005 LLUUID ownerID = m_host.OwnerID; 945 m_host.PreloadSound(sound);
1006 LLUUID objectID = m_host.UUID;
1007 LLUUID soundID = LLUUID.Zero;
1008
1009 if (!LLUUID.TryParse(sound, out soundID))
1010 {
1011 //Trys to fetch sound id from prim's inventory.
1012 //Prim's inventory doesn't support non script items yet
1013 SceneObjectPart op = World.GetSceneObjectPart(objectID);
1014 foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory)
1015 {
1016 if (item.Value.Name == sound)
1017 {
1018 soundID = item.Value.ItemID;
1019 break;
1020 }
1021 }
1022 }
1023
1024 List<ScenePresence> avatarts = World.GetAvatars();
1025 foreach (ScenePresence p in avatarts)
1026 {
1027 // TODO: some filtering by distance of avatar
1028 p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
1029 }
1030 } 946 }
1031 947
1032 public string llGetSubString(string src, int start, int end) 948 public string llGetSubString(string src, int start, int end)
@@ -2439,32 +2355,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2439 2355
2440 } 2356 }
2441 prules.CRC = 1; 2357 prules.CRC = 1;
2442 Console.WriteLine("----------ps----------\n"); 2358
2443 Console.WriteLine(" AngularVelocity:" + prules.AngularVelocity.ToString() + "\n" +
2444 " BurstPartCount:" + prules.BurstPartCount.ToString() + "\n" +
2445 " BurstRadius:" + prules.BurstRadius.ToString() + "\n" +
2446 " BurstRate:" + prules.BurstRate.ToString() + "\n" +
2447 " BurstSpeedMax:" + prules.BurstSpeedMax.ToString() + "\n" +
2448 " BurstSpeedMin:" + prules.BurstSpeedMin.ToString() + "\n" +
2449 " CRC:" + prules.CRC.ToString() + "\n" +
2450 " InnerAngle:" + prules.InnerAngle.ToString() + "\n" +
2451 " MaxAge:" + prules.MaxAge.ToString() + "\n" +
2452 " OuterAngle:" + prules.OuterAngle.ToString() + "\n" +
2453 " PartAcceleration:" + prules.PartAcceleration.ToString() + "\n" +
2454 " PartDataFlags:" + prules.PartDataFlags.ToString() + "\n" +
2455 " PartEndColor:" + prules.PartEndColor.ToString() + "\n" +
2456 " PartEndScaleX:" + prules.PartEndScaleX.ToString() + "\n" +
2457 " PartEndScaleY:" + prules.PartEndScaleY.ToString() + "\n" +
2458 " PartFlags:" + prules.PartFlags.ToString() + "\n" +
2459 " PartMaxAge:" + prules.PartMaxAge.ToString() + "\n" +
2460 " PartStartColor:" + prules.PartStartColor.ToString() + "\n" +
2461 " PartStartScaleX:" + prules.PartStartScaleX.ToString() + "\n" +
2462 " PartStartScaleY:" + prules.PartStartScaleY.ToString() + "\n" +
2463 " Pattern:" + prules.Pattern.ToString() + "\n" +
2464 " StartAge:" + prules.StartAge.ToString() + "\n" +
2465 " Target:" + prules.Target.ToString() + "\n" +
2466 " Texture:" + prules.Texture.ToString() + "");
2467 OpenSim.Framework.Console.MainLog.Instance.Verbose("PARTICLE", "PS: " + prules.ToString());
2468 m_host.AddNewParticleSystem(prules); 2359 m_host.AddNewParticleSystem(prules);
2469 m_host.SendFullUpdateToAllClients(); 2360 m_host.SendFullUpdateToAllClients();
2470 } 2361 }