diff options
Diffstat (limited to 'OpenSim/Region')
31 files changed, 2188 insertions, 887 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 10ff57d..693aedc 100644..100755 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -409,7 +409,7 @@ namespace OpenSim | |||
409 | if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) && | 409 | if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) && |
410 | presence.Lastname.ToLower().Contains(cmdparams[3].ToLower())) | 410 | presence.Lastname.ToLower().Contains(cmdparams[3].ToLower())) |
411 | { | 411 | { |
412 | m_log.Info( | 412 | MainConsole.Instance.Output( |
413 | String.Format( | 413 | String.Format( |
414 | "Kicking user: {0,-16}{1,-16}{2,-37} in region: {3,-16}", | 414 | "Kicking user: {0,-16}{1,-16}{2,-37} in region: {3,-16}", |
415 | presence.Firstname, presence.Lastname, presence.UUID, regionInfo.RegionName)); | 415 | presence.Firstname, presence.Lastname, presence.UUID, regionInfo.RegionName)); |
@@ -424,7 +424,7 @@ namespace OpenSim | |||
424 | presence.Scene.IncomingCloseAgent(presence.UUID); | 424 | presence.Scene.IncomingCloseAgent(presence.UUID); |
425 | } | 425 | } |
426 | } | 426 | } |
427 | m_log.Info(""); | 427 | MainConsole.Instance.Output(""); |
428 | } | 428 | } |
429 | 429 | ||
430 | /// <summary> | 430 | /// <summary> |
@@ -471,7 +471,7 @@ namespace OpenSim | |||
471 | 471 | ||
472 | private void HandleClearAssets(string module, string[] args) | 472 | private void HandleClearAssets(string module, string[] args) |
473 | { | 473 | { |
474 | m_log.Info("Not implemented."); | 474 | MainConsole.Instance.Output("Not implemented."); |
475 | } | 475 | } |
476 | 476 | ||
477 | /// <summary> | 477 | /// <summary> |
@@ -481,7 +481,7 @@ namespace OpenSim | |||
481 | /// <param name="args"></param> | 481 | /// <param name="args"></param> |
482 | private void HandleForceUpdate(string module, string[] args) | 482 | private void HandleForceUpdate(string module, string[] args) |
483 | { | 483 | { |
484 | m_log.Info("Updating all clients"); | 484 | MainConsole.Instance.Output("Updating all clients"); |
485 | m_sceneManager.ForceCurrentSceneClientUpdate(); | 485 | m_sceneManager.ForceCurrentSceneClientUpdate(); |
486 | } | 486 | } |
487 | 487 | ||
@@ -498,7 +498,7 @@ namespace OpenSim | |||
498 | } | 498 | } |
499 | else | 499 | else |
500 | { | 500 | { |
501 | m_log.Info("Argument error: edit scale <prim name> <x> <y> <z>"); | 501 | MainConsole.Instance.Output("Argument error: edit scale <prim name> <x> <y> <z>"); |
502 | } | 502 | } |
503 | } | 503 | } |
504 | 504 | ||
@@ -511,7 +511,7 @@ namespace OpenSim | |||
511 | { | 511 | { |
512 | if (cmd.Length < 4) | 512 | if (cmd.Length < 4) |
513 | { | 513 | { |
514 | m_log.Error("Usage: create region <region name> <region_file.ini>"); | 514 | MainConsole.Instance.Output("Usage: create region <region name> <region_file.ini>"); |
515 | return; | 515 | return; |
516 | } | 516 | } |
517 | if (cmd[3].EndsWith(".xml")) | 517 | if (cmd[3].EndsWith(".xml")) |
@@ -538,7 +538,7 @@ namespace OpenSim | |||
538 | } | 538 | } |
539 | else | 539 | else |
540 | { | 540 | { |
541 | m_log.Error("Usage: create region <region name> <region_file.ini>"); | 541 | MainConsole.Instance.Output("Usage: create region <region name> <region_file.ini>"); |
542 | return; | 542 | return; |
543 | } | 543 | } |
544 | } | 544 | } |
@@ -562,8 +562,8 @@ namespace OpenSim | |||
562 | case "set": | 562 | case "set": |
563 | if (cmdparams.Length < 4) | 563 | if (cmdparams.Length < 4) |
564 | { | 564 | { |
565 | m_log.Error("SYNTAX: " + n + " SET SECTION KEY VALUE"); | 565 | MainConsole.Instance.Output(String.Format("SYNTAX: {0} SET SECTION KEY VALUE",n)); |
566 | m_log.Error("EXAMPLE: " + n + " SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5"); | 566 | MainConsole.Instance.Output(String.Format("EXAMPLE: {0} SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5",n)); |
567 | } | 567 | } |
568 | else | 568 | else |
569 | { | 569 | { |
@@ -576,8 +576,7 @@ namespace OpenSim | |||
576 | c.Set(cmdparams[2], _value); | 576 | c.Set(cmdparams[2], _value); |
577 | m_config.Source.Merge(source); | 577 | m_config.Source.Merge(source); |
578 | 578 | ||
579 | m_log.Error(n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " + | 579 | MainConsole.Instance.Output(String.Format("{0} {0} {1} {2} {3}",n,cmdparams[1],cmdparams[2],_value)); |
580 | _value); | ||
581 | } | 580 | } |
582 | } | 581 | } |
583 | break; | 582 | break; |
@@ -585,21 +584,21 @@ namespace OpenSim | |||
585 | case "get": | 584 | case "get": |
586 | if (cmdparams.Length < 3) | 585 | if (cmdparams.Length < 3) |
587 | { | 586 | { |
588 | m_log.Error("SYNTAX: " + n + " GET SECTION KEY"); | 587 | MainConsole.Instance.Output(String.Format("SYNTAX: {0} GET SECTION KEY",n)); |
589 | m_log.Error("EXAMPLE: " + n + " GET ScriptEngine.DotNetEngine NumberOfScriptThreads"); | 588 | MainConsole.Instance.Output(String.Format("EXAMPLE: {0} GET ScriptEngine.DotNetEngine NumberOfScriptThreads",n)); |
590 | } | 589 | } |
591 | else | 590 | else |
592 | { | 591 | { |
593 | IConfig c = m_config.Source.Configs[cmdparams[1]]; | 592 | IConfig c = m_config.Source.Configs[cmdparams[1]]; |
594 | if (c == null) | 593 | if (c == null) |
595 | { | 594 | { |
596 | m_log.Info("Section \"" + cmdparams[1] + "\" does not exist."); | 595 | MainConsole.Instance.Output(String.Format("Section \"{0}\" does not exist.",cmdparams[1])); |
597 | break; | 596 | break; |
598 | } | 597 | } |
599 | else | 598 | else |
600 | { | 599 | { |
601 | m_log.Info(n + " GET " + cmdparams[1] + " " + cmdparams[2] + ": " + | 600 | MainConsole.Instance.Output(String.Format("{0} GET {1} {2} : {3}",n,cmdparams[1],cmdparams[2], |
602 | c.GetString(cmdparams[2])); | 601 | c.GetString(cmdparams[2]))); |
603 | } | 602 | } |
604 | } | 603 | } |
605 | 604 | ||
@@ -608,17 +607,17 @@ namespace OpenSim | |||
608 | case "save": | 607 | case "save": |
609 | if (cmdparams.Length < 2) | 608 | if (cmdparams.Length < 2) |
610 | { | 609 | { |
611 | m_log.Error("SYNTAX: " + n + " SAVE FILE"); | 610 | MainConsole.Instance.Output("SYNTAX: " + n + " SAVE FILE"); |
612 | return; | 611 | return; |
613 | } | 612 | } |
614 | 613 | ||
615 | if (Application.iniFilePath == cmdparams[1]) | 614 | if (Application.iniFilePath == cmdparams[1]) |
616 | { | 615 | { |
617 | m_log.Error("FILE can not be "+Application.iniFilePath); | 616 | MainConsole.Instance.Output("FILE can not be " + Application.iniFilePath); |
618 | return; | 617 | return; |
619 | } | 618 | } |
620 | 619 | ||
621 | m_log.Info("Saving configuration file: " + cmdparams[1]); | 620 | MainConsole.Instance.Output("Saving configuration file: " + cmdparams[1]); |
622 | m_config.Save(cmdparams[1]); | 621 | m_config.Save(cmdparams[1]); |
623 | break; | 622 | break; |
624 | } | 623 | } |
@@ -644,7 +643,7 @@ namespace OpenSim | |||
644 | case "list": | 643 | case "list": |
645 | foreach (IRegionModule irm in m_moduleLoader.GetLoadedSharedModules) | 644 | foreach (IRegionModule irm in m_moduleLoader.GetLoadedSharedModules) |
646 | { | 645 | { |
647 | m_log.Info("Shared region module: " + irm.Name); | 646 | MainConsole.Instance.Output(String.Format("Shared region module: {0}", irm.Name)); |
648 | } | 647 | } |
649 | break; | 648 | break; |
650 | case "unload": | 649 | case "unload": |
@@ -654,7 +653,7 @@ namespace OpenSim | |||
654 | { | 653 | { |
655 | if (rm.Name.ToLower() == cmdparams[1].ToLower()) | 654 | if (rm.Name.ToLower() == cmdparams[1].ToLower()) |
656 | { | 655 | { |
657 | m_log.Info("Unloading module: " + rm.Name); | 656 | MainConsole.Instance.Output(String.Format("Unloading module: {0}", rm.Name)); |
658 | m_moduleLoader.UnloadModule(rm); | 657 | m_moduleLoader.UnloadModule(rm); |
659 | } | 658 | } |
660 | } | 659 | } |
@@ -665,7 +664,7 @@ namespace OpenSim | |||
665 | { | 664 | { |
666 | foreach (Scene s in new ArrayList(m_sceneManager.Scenes)) | 665 | foreach (Scene s in new ArrayList(m_sceneManager.Scenes)) |
667 | { | 666 | { |
668 | m_log.Info("Loading module: " + cmdparams[1]); | 667 | MainConsole.Instance.Output(String.Format("Loading module: {0}", cmdparams[1])); |
669 | m_moduleLoader.LoadRegionModules(cmdparams[1], s); | 668 | m_moduleLoader.LoadRegionModules(cmdparams[1], s); |
670 | } | 669 | } |
671 | } | 670 | } |
@@ -710,7 +709,7 @@ namespace OpenSim | |||
710 | if (m_sceneManager.TryGetScene(regRemoveName, out removeScene)) | 709 | if (m_sceneManager.TryGetScene(regRemoveName, out removeScene)) |
711 | RemoveRegion(removeScene, false); | 710 | RemoveRegion(removeScene, false); |
712 | else | 711 | else |
713 | m_log.Error("no region with that name"); | 712 | MainConsole.Instance.Output("no region with that name"); |
714 | break; | 713 | break; |
715 | 714 | ||
716 | case "delete-region": | 715 | case "delete-region": |
@@ -720,7 +719,7 @@ namespace OpenSim | |||
720 | if (m_sceneManager.TryGetScene(regDeleteName, out killScene)) | 719 | if (m_sceneManager.TryGetScene(regDeleteName, out killScene)) |
721 | RemoveRegion(killScene, true); | 720 | RemoveRegion(killScene, true); |
722 | else | 721 | else |
723 | m_log.Error("no region with that name"); | 722 | MainConsole.Instance.Output("no region with that name"); |
724 | break; | 723 | break; |
725 | 724 | ||
726 | case "restart": | 725 | case "restart": |
@@ -730,7 +729,7 @@ namespace OpenSim | |||
730 | case "Add-InventoryHost": | 729 | case "Add-InventoryHost": |
731 | if (cmdparams.Length > 0) | 730 | if (cmdparams.Length > 0) |
732 | { | 731 | { |
733 | m_log.Info("Not implemented."); | 732 | MainConsole.Instance.Output("Not implemented."); |
734 | } | 733 | } |
735 | break; | 734 | break; |
736 | 735 | ||
@@ -748,20 +747,19 @@ namespace OpenSim | |||
748 | string newRegionName = CombineParams(cmdparams, 2); | 747 | string newRegionName = CombineParams(cmdparams, 2); |
749 | 748 | ||
750 | if (!m_sceneManager.TrySetCurrentScene(newRegionName)) | 749 | if (!m_sceneManager.TrySetCurrentScene(newRegionName)) |
751 | m_log.Error("Couldn't select region " + newRegionName); | 750 | MainConsole.Instance.Output(String.Format("Couldn't select region {0}", newRegionName)); |
752 | } | 751 | } |
753 | else | 752 | else |
754 | { | 753 | { |
755 | m_log.Error("Usage: change region <region name>"); | 754 | MainConsole.Instance.Output("Usage: change region <region name>"); |
756 | } | 755 | } |
757 | 756 | ||
758 | string regionName = (m_sceneManager.CurrentScene == null ? "root" : m_sceneManager.CurrentScene.RegionInfo.RegionName); | 757 | string regionName = (m_sceneManager.CurrentScene == null ? "root" : m_sceneManager.CurrentScene.RegionInfo.RegionName); |
759 | m_log.Info(String.Format("Currently selected region is {0}", regionName)); | 758 | MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName)); |
760 | m_console.DefaultPrompt = String.Format("Region ({0}) ", regionName); | 759 | m_console.DefaultPrompt = String.Format("Region ({0}) ", regionName); |
761 | m_console.ConsoleScene = m_sceneManager.CurrentScene; | 760 | m_console.ConsoleScene = m_sceneManager.CurrentScene; |
762 | } | 761 | } |
763 | 762 | ||
764 | |||
765 | /// <summary> | 763 | /// <summary> |
766 | /// Turn on some debugging values for OpenSim. | 764 | /// Turn on some debugging values for OpenSim. |
767 | /// </summary> | 765 | /// </summary> |
@@ -783,9 +781,9 @@ namespace OpenSim | |||
783 | } | 781 | } |
784 | else | 782 | else |
785 | { | 783 | { |
786 | m_log.Error("packet debug should be 0..255"); | 784 | MainConsole.Instance.Output("packet debug should be 0..255"); |
787 | } | 785 | } |
788 | m_log.Info("New packet debug: " + newDebug.ToString()); | 786 | MainConsole.Instance.Output(String.Format("New packet debug: {0}", newDebug)); |
789 | } | 787 | } |
790 | 788 | ||
791 | break; | 789 | break; |
@@ -795,7 +793,7 @@ namespace OpenSim | |||
795 | { | 793 | { |
796 | if (m_sceneManager.CurrentScene == null) | 794 | if (m_sceneManager.CurrentScene == null) |
797 | { | 795 | { |
798 | m_log.Info("Please use 'change region <regioname>' first"); | 796 | MainConsole.Instance.Output("Please use 'change region <regioname>' first"); |
799 | } | 797 | } |
800 | else | 798 | else |
801 | { | 799 | { |
@@ -804,7 +802,7 @@ namespace OpenSim | |||
804 | bool physicsOn = !Convert.ToBoolean(args[4]); | 802 | bool physicsOn = !Convert.ToBoolean(args[4]); |
805 | m_sceneManager.CurrentScene.SetSceneCoreDebug(scriptingOn, collisionsOn, physicsOn); | 803 | m_sceneManager.CurrentScene.SetSceneCoreDebug(scriptingOn, collisionsOn, physicsOn); |
806 | 804 | ||
807 | m_log.Info( | 805 | MainConsole.Instance.Output( |
808 | String.Format( | 806 | String.Format( |
809 | "Set debug scene scripting = {0}, collisions = {1}, physics = {2}", | 807 | "Set debug scene scripting = {0}, collisions = {1}, physics = {2}", |
810 | !scriptingOn, !collisionsOn, !physicsOn)); | 808 | !scriptingOn, !collisionsOn, !physicsOn)); |
@@ -812,13 +810,13 @@ namespace OpenSim | |||
812 | } | 810 | } |
813 | else | 811 | else |
814 | { | 812 | { |
815 | m_log.Error("debug scene <scripting> <collisions> <physics> (where inside <> is true/false)"); | 813 | MainConsole.Instance.Output("debug scene <scripting> <collisions> <physics> (where inside <> is true/false)"); |
816 | } | 814 | } |
817 | 815 | ||
818 | break; | 816 | break; |
819 | 817 | ||
820 | default: | 818 | default: |
821 | m_log.Error("Unknown debug"); | 819 | MainConsole.Instance.Output("Unknown debug"); |
822 | break; | 820 | break; |
823 | } | 821 | } |
824 | } | 822 | } |
@@ -840,7 +838,7 @@ namespace OpenSim | |||
840 | switch (showParams[0]) | 838 | switch (showParams[0]) |
841 | { | 839 | { |
842 | case "assets": | 840 | case "assets": |
843 | m_log.Info("Not implemented."); | 841 | MainConsole.Instance.Output("Not implemented."); |
844 | break; | 842 | break; |
845 | 843 | ||
846 | case "users": | 844 | case "users": |
@@ -854,9 +852,9 @@ namespace OpenSim | |||
854 | agents = m_sceneManager.GetCurrentSceneAvatars(); | 852 | agents = m_sceneManager.GetCurrentSceneAvatars(); |
855 | } | 853 | } |
856 | 854 | ||
857 | m_log.Info(String.Format("\nAgents connected: {0}\n", agents.Count)); | 855 | MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count)); |
858 | 856 | ||
859 | m_log.Info( | 857 | MainConsole.Instance.Output( |
860 | String.Format("{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}{5,-30}", "Firstname", "Lastname", | 858 | String.Format("{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}{5,-30}", "Firstname", "Lastname", |
861 | "Agent ID", "Root/Child", "Region", "Position")); | 859 | "Agent ID", "Root/Child", "Region", "Position")); |
862 | 860 | ||
@@ -874,7 +872,7 @@ namespace OpenSim | |||
874 | regionName = regionInfo.RegionName; | 872 | regionName = regionInfo.RegionName; |
875 | } | 873 | } |
876 | 874 | ||
877 | m_log.Info( | 875 | MainConsole.Instance.Output( |
878 | String.Format( | 876 | String.Format( |
879 | "{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}{5,-30}", | 877 | "{0,-16}{1,-16}{2,-37}{3,-11}{4,-16}{5,-30}", |
880 | presence.Firstname, | 878 | presence.Firstname, |
@@ -885,7 +883,7 @@ namespace OpenSim | |||
885 | presence.AbsolutePosition.ToString())); | 883 | presence.AbsolutePosition.ToString())); |
886 | } | 884 | } |
887 | 885 | ||
888 | m_log.Info(String.Empty); | 886 | MainConsole.Instance.Output(String.Empty); |
889 | break; | 887 | break; |
890 | 888 | ||
891 | case "connections": | 889 | case "connections": |
@@ -903,25 +901,30 @@ namespace OpenSim | |||
903 | } | 901 | } |
904 | ); | 902 | ); |
905 | 903 | ||
906 | m_log.Info(connections.ToString()); | 904 | MainConsole.Instance.Output(connections.ToString()); |
907 | break; | 905 | break; |
908 | 906 | ||
909 | case "modules": | 907 | case "modules": |
910 | m_log.Info("The currently loaded shared modules are:"); | 908 | MainConsole.Instance.Output("The currently loaded shared modules are:"); |
911 | foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) | 909 | foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) |
912 | { | 910 | { |
913 | m_log.Info("Shared Module: " + module.Name); | 911 | MainConsole.Instance.Output("Shared Module: " + module.Name); |
914 | } | 912 | } |
913 | |||
914 | MainConsole.Instance.Output(""); | ||
915 | break; | 915 | break; |
916 | 916 | ||
917 | case "regions": | 917 | case "regions": |
918 | m_sceneManager.ForEachScene( | 918 | m_sceneManager.ForEachScene( |
919 | delegate(Scene scene) | 919 | delegate(Scene scene) |
920 | { | 920 | { |
921 | m_log.Info("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " + | 921 | MainConsole.Instance.Output(String.Format( |
922 | scene.RegionInfo.RegionLocX + " , Region YLoc: " + | 922 | "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}", |
923 | scene.RegionInfo.RegionLocY + " , Region Port: " + | 923 | scene.RegionInfo.RegionName, |
924 | scene.RegionInfo.InternalEndPoint.Port.ToString()); | 924 | scene.RegionInfo.RegionLocX, |
925 | scene.RegionInfo.RegionLocY, | ||
926 | scene.RegionInfo.InternalEndPoint.Port)); | ||
927 | |||
925 | }); | 928 | }); |
926 | break; | 929 | break; |
927 | 930 | ||
@@ -946,8 +949,10 @@ namespace OpenSim | |||
946 | { | 949 | { |
947 | rating = "PG"; | 950 | rating = "PG"; |
948 | } | 951 | } |
949 | m_log.Info("Region Name: " + scene.RegionInfo.RegionName + " , Region Rating: " + | 952 | MainConsole.Instance.Output(String.Format( |
950 | rating); | 953 | "Region Name: {0}, Region Rating {1}", |
954 | scene.RegionInfo.RegionName, | ||
955 | rating)); | ||
951 | }); | 956 | }); |
952 | break; | 957 | break; |
953 | } | 958 | } |
@@ -968,7 +973,7 @@ namespace OpenSim | |||
968 | if (client is IStatsCollector) | 973 | if (client is IStatsCollector) |
969 | { | 974 | { |
970 | report = report + client.FirstName + | 975 | report = report + client.FirstName + |
971 | " " + client.LastName + "\n"; | 976 | " " + client.LastName; |
972 | 977 | ||
973 | IStatsCollector stats = | 978 | IStatsCollector stats = |
974 | (IStatsCollector) client; | 979 | (IStatsCollector) client; |
@@ -985,7 +990,7 @@ namespace OpenSim | |||
985 | "Texture", | 990 | "Texture", |
986 | "Asset"); | 991 | "Asset"); |
987 | report = report + stats.Report() + | 992 | report = report + stats.Report() + |
988 | "\n\n"; | 993 | "\n"; |
989 | } | 994 | } |
990 | }); | 995 | }); |
991 | }); | 996 | }); |
@@ -1017,7 +1022,7 @@ namespace OpenSim | |||
1017 | /// <param name="cmdparams"></param> | 1022 | /// <param name="cmdparams"></param> |
1018 | protected void SaveXml(string module, string[] cmdparams) | 1023 | protected void SaveXml(string module, string[] cmdparams) |
1019 | { | 1024 | { |
1020 | m_log.Error("[CONSOLE]: PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason."); | 1025 | MainConsole.Instance.Output("PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason."); |
1021 | 1026 | ||
1022 | if (cmdparams.Length > 0) | 1027 | if (cmdparams.Length > 0) |
1023 | { | 1028 | { |
@@ -1036,7 +1041,7 @@ namespace OpenSim | |||
1036 | /// <param name="cmdparams"></param> | 1041 | /// <param name="cmdparams"></param> |
1037 | protected void LoadXml(string module, string[] cmdparams) | 1042 | protected void LoadXml(string module, string[] cmdparams) |
1038 | { | 1043 | { |
1039 | m_log.Error("[CONSOLE]: PLEASE NOTE, load-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use load-xml2, please file a mantis detailing the reason."); | 1044 | MainConsole.Instance.Output("PLEASE NOTE, load-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use load-xml2, please file a mantis detailing the reason."); |
1040 | 1045 | ||
1041 | Vector3 loadOffset = new Vector3(0, 0, 0); | 1046 | Vector3 loadOffset = new Vector3(0, 0, 0); |
1042 | if (cmdparams.Length > 2) | 1047 | if (cmdparams.Length > 2) |
@@ -1059,8 +1064,7 @@ namespace OpenSim | |||
1059 | { | 1064 | { |
1060 | loadOffset.Z = (float) Convert.ToDecimal(cmdparams[6]); | 1065 | loadOffset.Z = (float) Convert.ToDecimal(cmdparams[6]); |
1061 | } | 1066 | } |
1062 | m_log.Error("loadOffsets <X,Y,Z> = <" + loadOffset.X + "," + loadOffset.Y + "," + | 1067 | MainConsole.Instance.Output(String.Format("loadOffsets <X,Y,Z> = <{0},{1},{2}>",loadOffset.X,loadOffset.Y,loadOffset.Z)); |
1063 | loadOffset.Z + ">"); | ||
1064 | } | 1068 | } |
1065 | } | 1069 | } |
1066 | m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset); | 1070 | m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset); |
@@ -1073,7 +1077,7 @@ namespace OpenSim | |||
1073 | } | 1077 | } |
1074 | catch (FileNotFoundException) | 1078 | catch (FileNotFoundException) |
1075 | { | 1079 | { |
1076 | m_log.Error("Default xml not found. Usage: load-xml <filename>"); | 1080 | MainConsole.Instance.Output("Default xml not found. Usage: load-xml <filename>"); |
1077 | } | 1081 | } |
1078 | } | 1082 | } |
1079 | } | 1083 | } |
@@ -1109,7 +1113,7 @@ namespace OpenSim | |||
1109 | } | 1113 | } |
1110 | catch (FileNotFoundException) | 1114 | catch (FileNotFoundException) |
1111 | { | 1115 | { |
1112 | m_log.Error("Specified xml not found. Usage: load xml2 <filename>"); | 1116 | MainConsole.Instance.Output("Specified xml not found. Usage: load xml2 <filename>"); |
1113 | } | 1117 | } |
1114 | } | 1118 | } |
1115 | else | 1119 | else |
@@ -1120,7 +1124,7 @@ namespace OpenSim | |||
1120 | } | 1124 | } |
1121 | catch (FileNotFoundException) | 1125 | catch (FileNotFoundException) |
1122 | { | 1126 | { |
1123 | m_log.Error("Default xml not found. Usage: load xml2 <filename>"); | 1127 | MainConsole.Instance.Output("Default xml not found. Usage: load xml2 <filename>"); |
1124 | } | 1128 | } |
1125 | } | 1129 | } |
1126 | } | 1130 | } |
@@ -1137,7 +1141,7 @@ namespace OpenSim | |||
1137 | } | 1141 | } |
1138 | catch (Exception e) | 1142 | catch (Exception e) |
1139 | { | 1143 | { |
1140 | m_log.Error(e.Message); | 1144 | MainConsole.Instance.Output(e.Message); |
1141 | } | 1145 | } |
1142 | } | 1146 | } |
1143 | 1147 | ||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index b888017..4e2a0b7 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -1471,6 +1471,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1471 | 1471 | ||
1472 | public void SendKillObject(ulong regionHandle, uint localID) | 1472 | public void SendKillObject(ulong regionHandle, uint localID) |
1473 | { | 1473 | { |
1474 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); | ||
1475 | |||
1474 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); | 1476 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); |
1475 | // TODO: don't create new blocks if recycling an old packet | 1477 | // TODO: don't create new blocks if recycling an old packet |
1476 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | 1478 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; |
@@ -3478,6 +3480,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3478 | 3480 | ||
3479 | public void SendPrimitiveToClient(SendPrimitiveData data) | 3481 | public void SendPrimitiveToClient(SendPrimitiveData data) |
3480 | { | 3482 | { |
3483 | // string text = data.text; | ||
3484 | // if (text.IndexOf("\n") >= 0) | ||
3485 | // text = text.Remove(text.IndexOf("\n")); | ||
3486 | // m_log.DebugFormat( | ||
3487 | // "[CLIENT]: Placing request to send full info about prim {0} text {1} to client {2}", | ||
3488 | // data.localID, text, Name); | ||
3489 | |||
3481 | if (data.priority == double.NaN) | 3490 | if (data.priority == double.NaN) |
3482 | { | 3491 | { |
3483 | m_log.Error("[LLClientView] SendPrimitiveToClient received a NaN priority, dropping update"); | 3492 | m_log.Error("[LLClientView] SendPrimitiveToClient received a NaN priority, dropping update"); |
@@ -3515,7 +3524,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3515 | 3524 | ||
3516 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[count]; | 3525 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[count]; |
3517 | for (int i = 0; i < count; i++) | 3526 | for (int i = 0; i < count; i++) |
3527 | { | ||
3518 | outPacket.ObjectData[i] = m_primFullUpdates.Dequeue(); | 3528 | outPacket.ObjectData[i] = m_primFullUpdates.Dequeue(); |
3529 | |||
3530 | // string text = Util.FieldToString(outPacket.ObjectData[i].Text); | ||
3531 | // if (text.IndexOf("\n") >= 0) | ||
3532 | // text = text.Remove(text.IndexOf("\n")); | ||
3533 | // m_log.DebugFormat( | ||
3534 | // "[CLIENT]: Sending full info about prim {0} text {1} to client {2}", | ||
3535 | // outPacket.ObjectData[i].ID, text, Name); | ||
3536 | } | ||
3519 | } | 3537 | } |
3520 | 3538 | ||
3521 | OutPacket(outPacket, ThrottleOutPacketType.State); | 3539 | OutPacket(outPacket, ThrottleOutPacketType.State); |
@@ -5173,6 +5191,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5173 | { | 5191 | { |
5174 | ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; | 5192 | ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; |
5175 | 5193 | ||
5194 | //m_log.DebugFormat("[CLIENT]: Received ScriptDialogReply from {0}", rdialog.Data.ObjectID); | ||
5195 | |||
5176 | #region Packet Session and User Check | 5196 | #region Packet Session and User Check |
5177 | if (m_checkPackets) | 5197 | if (m_checkPackets) |
5178 | { | 5198 | { |
@@ -5193,7 +5213,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5193 | args.Type = ChatTypeEnum.Shout; | 5213 | args.Type = ChatTypeEnum.Shout; |
5194 | args.Position = new Vector3(); | 5214 | args.Position = new Vector3(); |
5195 | args.Scene = Scene; | 5215 | args.Scene = Scene; |
5196 | args.Sender = this; | 5216 | args.Sender = this; |
5197 | ChatMessage handlerChatFromClient2 = OnChatFromClient; | 5217 | ChatMessage handlerChatFromClient2 = OnChatFromClient; |
5198 | if (handlerChatFromClient2 != null) | 5218 | if (handlerChatFromClient2 != null) |
5199 | handlerChatFromClient2(this, args); | 5219 | handlerChatFromClient2(this, args); |
@@ -9095,8 +9115,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9095 | 9115 | ||
9096 | private bool HandleSendPostcard(IClientAPI client, Packet packet) | 9116 | private bool HandleSendPostcard(IClientAPI client, Packet packet) |
9097 | { | 9117 | { |
9098 | SendPostcardPacket SendPostcard = | 9118 | // SendPostcardPacket SendPostcard = |
9099 | (SendPostcardPacket)packet; | 9119 | // (SendPostcardPacket)packet; |
9100 | SendPostcard handlerSendPostcard = OnSendPostcard; | 9120 | SendPostcard handlerSendPostcard = OnSendPostcard; |
9101 | if (handlerSendPostcard != null) | 9121 | if (handlerSendPostcard != null) |
9102 | { | 9122 | { |
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index adcf6bd..9216e0b 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -762,7 +762,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
762 | case "expire": | 762 | case "expire": |
763 | 763 | ||
764 | 764 | ||
765 | if (cmdparams.Length >= 3) | 765 | if (cmdparams.Length < 3) |
766 | { | 766 | { |
767 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] Invalid parameters for Expire, please specify a valid date & time", cmd); | 767 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] Invalid parameters for Expire, please specify a valid date & time", cmd); |
768 | break; | 768 | break; |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index e48b078..fdfcd10 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -172,24 +172,27 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
172 | 172 | ||
173 | private void RetrieveInstantMessages(IClientAPI client) | 173 | private void RetrieveInstantMessages(IClientAPI client) |
174 | { | 174 | { |
175 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); | 175 | if (m_RestURL != "") |
176 | { | ||
177 | m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); | ||
176 | 178 | ||
177 | List<GridInstantMessage>msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( | 179 | List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( |
178 | "POST", m_RestURL+"/RetrieveMessages/", client.AgentId); | 180 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); |
179 | 181 | ||
180 | foreach (GridInstantMessage im in msglist) | 182 | foreach (GridInstantMessage im in msglist) |
181 | { | 183 | { |
182 | // client.SendInstantMessage(im); | 184 | // client.SendInstantMessage(im); |
183 | 185 | ||
184 | // Send through scene event manager so all modules get a chance | 186 | // Send through scene event manager so all modules get a chance |
185 | // to look at this message before it gets delivered. | 187 | // to look at this message before it gets delivered. |
186 | // | 188 | // |
187 | // Needed for proper state management for stored group | 189 | // Needed for proper state management for stored group |
188 | // invitations | 190 | // invitations |
189 | // | 191 | // |
190 | Scene s = FindScene(client.AgentId); | 192 | Scene s = FindScene(client.AgentId); |
191 | if (s != null) | 193 | if (s != null) |
192 | s.EventManager.TriggerIncomingInstantMessage(im); | 194 | s.EventManager.TriggerIncomingInstantMessage(im); |
195 | } | ||
193 | } | 196 | } |
194 | } | 197 | } |
195 | 198 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs index e53290c..e37da9f 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs | |||
@@ -191,7 +191,6 @@ namespace OpenSim.Region.CoreModules.Framework.Library | |||
191 | { | 191 | { |
192 | m_log.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName, e.Message); | 192 | m_log.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName, e.Message); |
193 | } | 193 | } |
194 | |||
195 | } | 194 | } |
196 | 195 | ||
197 | } | 196 | } |
@@ -203,6 +202,14 @@ namespace OpenSim.Region.CoreModules.Framework.Library | |||
203 | m_log.DebugFormat(" - folder {0}", lib.Name); | 202 | m_log.DebugFormat(" - folder {0}", lib.Name); |
204 | DumpFolder(lib); | 203 | DumpFolder(lib); |
205 | } | 204 | } |
205 | // | ||
206 | // private void DumpLibrary() | ||
207 | // { | ||
208 | // InventoryFolderImpl lib = m_Scene.CommsManager.UserProfileCacheService.LibraryRoot; | ||
209 | // | ||
210 | // m_log.DebugFormat(" - folder {0}", lib.Name); | ||
211 | // DumpFolder(lib); | ||
212 | // } | ||
206 | 213 | ||
207 | private void DumpFolder(InventoryFolderImpl folder) | 214 | private void DumpFolder(InventoryFolderImpl folder) |
208 | { | 215 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index 96d65d7..f15f8f6 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | |||
@@ -87,7 +87,10 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
87 | 87 | ||
88 | foreach (IMonitor monitor in m_monitors) | 88 | foreach (IMonitor monitor in m_monitors) |
89 | { | 89 | { |
90 | if (monitor.ToString() == monID) | 90 | string elemName = monitor.ToString(); |
91 | if (elemName.StartsWith(monitor.GetType().Namespace)) | ||
92 | elemName = elemName.Substring(monitor.GetType().Namespace.Length + 1); | ||
93 | if (elemName == monID || monitor.ToString() == monID) | ||
91 | { | 94 | { |
92 | Hashtable ereply3 = new Hashtable(); | 95 | Hashtable ereply3 = new Hashtable(); |
93 | 96 | ||
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index f51d0c2..e3c7bbf 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs | |||
@@ -362,7 +362,14 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
362 | 362 | ||
363 | if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0)) | 363 | if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0)) |
364 | { | 364 | { |
365 | scene.AssetService.Delete(oldID.ToString()); | 365 | if (oldAsset == null) oldAsset = scene.AssetService.Get(oldID.ToString()); |
366 | if (oldAsset != null) | ||
367 | { | ||
368 | if (oldAsset.Temporary == true) | ||
369 | { | ||
370 | scene.AssetService.Delete(oldID.ToString()); | ||
371 | } | ||
372 | } | ||
366 | } | 373 | } |
367 | } | 374 | } |
368 | 375 | ||
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index d57a8e5..3291be4 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -342,6 +342,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
342 | m_log.Error( | 342 | m_log.Error( |
343 | "[VECTORRENDERMODULE]: OpenJpeg Encode Failed. Empty byte data returned!"); | 343 | "[VECTORRENDERMODULE]: OpenJpeg Encode Failed. Empty byte data returned!"); |
344 | } | 344 | } |
345 | |||
345 | m_textureManager.ReturnData(id, imageJ2000); | 346 | m_textureManager.ReturnData(id, imageJ2000); |
346 | } | 347 | } |
347 | 348 | ||
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 60df2e7..d647e71 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -262,44 +262,34 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
262 | { | 262 | { |
263 | case ChatTypeEnum.Whisper: | 263 | case ChatTypeEnum.Whisper: |
264 | if (dis < m_whisperdistance) | 264 | if (dis < m_whisperdistance) |
265 | { | 265 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
266 | lock (m_pending.SyncRoot) | ||
267 | { | ||
268 | m_pending.Enqueue(new ListenerInfo(li,name,id,msg)); | ||
269 | } | ||
270 | } | ||
271 | break; | 266 | break; |
272 | 267 | ||
273 | case ChatTypeEnum.Say: | 268 | case ChatTypeEnum.Say: |
274 | if (dis < m_saydistance) | 269 | if (dis < m_saydistance) |
275 | { | 270 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
276 | lock (m_pending.SyncRoot) | ||
277 | { | ||
278 | m_pending.Enqueue(new ListenerInfo(li,name,id,msg)); | ||
279 | } | ||
280 | } | ||
281 | break; | 271 | break; |
282 | 272 | ||
283 | case ChatTypeEnum.Shout: | 273 | case ChatTypeEnum.Shout: |
284 | if (dis < m_shoutdistance) | 274 | if (dis < m_shoutdistance) |
285 | { | 275 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
286 | lock (m_pending.SyncRoot) | ||
287 | { | ||
288 | m_pending.Enqueue(new ListenerInfo(li,name,id,msg)); | ||
289 | } | ||
290 | } | ||
291 | break; | 276 | break; |
292 | 277 | ||
293 | case ChatTypeEnum.Region: | 278 | case ChatTypeEnum.Region: |
294 | lock (m_pending.SyncRoot) | 279 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
295 | { | ||
296 | m_pending.Enqueue(new ListenerInfo(li,name,id,msg)); | ||
297 | } | ||
298 | break; | 280 | break; |
299 | } | 281 | } |
300 | } | 282 | } |
301 | } | 283 | } |
302 | 284 | ||
285 | protected void QueueMessage(ListenerInfo li) | ||
286 | { | ||
287 | lock (m_pending.SyncRoot) | ||
288 | { | ||
289 | m_pending.Enqueue(li); | ||
290 | } | ||
291 | } | ||
292 | |||
303 | /// <summary> | 293 | /// <summary> |
304 | /// Are there any listen events ready to be dispatched? | 294 | /// Are there any listen events ready to be dispatched? |
305 | /// </summary> | 295 | /// </summary> |
@@ -319,7 +309,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
319 | 309 | ||
320 | lock (m_pending.SyncRoot) | 310 | lock (m_pending.SyncRoot) |
321 | { | 311 | { |
322 | li = (ListenerInfo) m_pending.Dequeue(); | 312 | li = (ListenerInfo)m_pending.Dequeue(); |
323 | } | 313 | } |
324 | 314 | ||
325 | return li; | 315 | return li; |
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs index 8b5a413..127469e 100644 --- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs | |||
@@ -41,9 +41,7 @@ namespace OpenSim.Region.CoreModules.World | |||
41 | { | 41 | { |
42 | public class AccessModule : ISharedRegionModule | 42 | public class AccessModule : ISharedRegionModule |
43 | { | 43 | { |
44 | private static readonly ILog m_log = | 44 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | LogManager.GetLogger( | ||
46 | MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | 45 | ||
48 | private List<Scene> m_SceneList = new List<Scene>(); | 46 | private List<Scene> m_SceneList = new List<Scene>(); |
49 | 47 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index bb9c6fe..59a1b8f 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -420,9 +420,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
420 | currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; | 420 | currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; |
421 | currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; | 421 | currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; |
422 | currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; | 422 | currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; |
423 | 423 | ||
424 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); | 424 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); |
425 | estateModule.sendRegionHandshakeToAll(); | 425 | |
426 | if (estateModule != null) | ||
427 | estateModule.sendRegionHandshakeToAll(); | ||
426 | 428 | ||
427 | return true; | 429 | return true; |
428 | } | 430 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 8c1e1c2..d986274 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -36,11 +36,13 @@ using OpenMetaverse; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | 37 | ||
38 | using OpenSim.Framework.Serialization; | 38 | using OpenSim.Framework.Serialization; |
39 | using OpenSim.Framework.Serialization.External; | ||
39 | using OpenSim.Region.CoreModules.World.Serialiser; | 40 | using OpenSim.Region.CoreModules.World.Serialiser; |
40 | using OpenSim.Region.CoreModules.World.Terrain; | 41 | using OpenSim.Region.CoreModules.World.Terrain; |
41 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.Framework.Scenes.Serialization; | 43 | using OpenSim.Region.Framework.Scenes.Serialization; |
43 | using OpenSim.Tests.Common; | 44 | using OpenSim.Tests.Common; |
45 | using OpenSim.Tests.Common.Mock; | ||
44 | using OpenSim.Tests.Common.Setup; | 46 | using OpenSim.Tests.Common.Setup; |
45 | 47 | ||
46 | namespace OpenSim.Region.CoreModules.World.Archiver.Tests | 48 | namespace OpenSim.Region.CoreModules.World.Archiver.Tests |
@@ -50,6 +52,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
50 | { | 52 | { |
51 | private Guid m_lastRequestId; | 53 | private Guid m_lastRequestId; |
52 | private string m_lastErrorMessage; | 54 | private string m_lastErrorMessage; |
55 | |||
56 | protected TestScene m_scene; | ||
57 | protected ArchiverModule m_archiverModule; | ||
58 | |||
59 | [SetUp] | ||
60 | public void SetUp() | ||
61 | { | ||
62 | m_archiverModule = new ArchiverModule(); | ||
63 | SerialiserModule serialiserModule = new SerialiserModule(); | ||
64 | TerrainModule terrainModule = new TerrainModule(); | ||
65 | |||
66 | m_scene = SceneSetupHelpers.SetupScene("scene1"); | ||
67 | SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); | ||
68 | } | ||
53 | 69 | ||
54 | private void LoadCompleted(Guid requestId, string errorMessage) | 70 | private void LoadCompleted(Guid requestId, string errorMessage) |
55 | { | 71 | { |
@@ -74,6 +90,30 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
74 | } | 90 | } |
75 | } | 91 | } |
76 | 92 | ||
93 | protected SceneObjectPart CreateSceneObjectPart1() | ||
94 | { | ||
95 | string partName = "My Little Pony"; | ||
96 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015"); | ||
97 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | ||
98 | Vector3 groupPosition = new Vector3(10, 20, 30); | ||
99 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | ||
100 | Vector3 offsetPosition = new Vector3(5, 10, 15); | ||
101 | |||
102 | return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; | ||
103 | } | ||
104 | |||
105 | protected SceneObjectPart CreateSceneObjectPart2() | ||
106 | { | ||
107 | string partName = "Action Man"; | ||
108 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000016"); | ||
109 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); | ||
110 | Vector3 groupPosition = new Vector3(90, 80, 70); | ||
111 | Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); | ||
112 | Vector3 offsetPosition = new Vector3(20, 25, 30); | ||
113 | |||
114 | return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; | ||
115 | } | ||
116 | |||
77 | /// <summary> | 117 | /// <summary> |
78 | /// Test saving a V0.2 OpenSim Region Archive. | 118 | /// Test saving a V0.2 OpenSim Region Archive. |
79 | /// </summary> | 119 | /// </summary> |
@@ -83,59 +123,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
83 | TestHelper.InMethod(); | 123 | TestHelper.InMethod(); |
84 | //log4net.Config.XmlConfigurator.Configure(); | 124 | //log4net.Config.XmlConfigurator.Configure(); |
85 | 125 | ||
86 | ArchiverModule archiverModule = new ArchiverModule(); | 126 | SceneObjectPart part1 = CreateSceneObjectPart1(); |
87 | SerialiserModule serialiserModule = new SerialiserModule(); | 127 | m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false); |
88 | TerrainModule terrainModule = new TerrainModule(); | ||
89 | |||
90 | Scene scene = SceneSetupHelpers.SetupScene("asset"); | ||
91 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); | ||
92 | 128 | ||
93 | SceneObjectPart part1; | 129 | SceneObjectPart part2 = CreateSceneObjectPart2(); |
94 | 130 | m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); | |
95 | // Create and add prim 1 | ||
96 | { | ||
97 | string partName = "My Little Pony"; | ||
98 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015"); | ||
99 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | ||
100 | Vector3 groupPosition = new Vector3(10, 20, 30); | ||
101 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | ||
102 | Vector3 offsetPosition = new Vector3(5, 10, 15); | ||
103 | |||
104 | part1 | ||
105 | = new SceneObjectPart( | ||
106 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | ||
107 | part1.Name = partName; | ||
108 | |||
109 | scene.AddNewSceneObject(new SceneObjectGroup(part1), false); | ||
110 | } | ||
111 | |||
112 | SceneObjectPart part2; | ||
113 | |||
114 | // Create and add prim 2 | ||
115 | { | ||
116 | string partName = "Action Man"; | ||
117 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000016"); | ||
118 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); | ||
119 | Vector3 groupPosition = new Vector3(90, 80, 70); | ||
120 | Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); | ||
121 | Vector3 offsetPosition = new Vector3(20, 25, 30); | ||
122 | |||
123 | part2 | ||
124 | = new SceneObjectPart( | ||
125 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | ||
126 | part2.Name = partName; | ||
127 | |||
128 | scene.AddNewSceneObject(new SceneObjectGroup(part2), false); | ||
129 | } | ||
130 | 131 | ||
131 | MemoryStream archiveWriteStream = new MemoryStream(); | 132 | MemoryStream archiveWriteStream = new MemoryStream(); |
132 | scene.EventManager.OnOarFileSaved += SaveCompleted; | 133 | m_scene.EventManager.OnOarFileSaved += SaveCompleted; |
133 | 134 | ||
134 | Guid requestId = new Guid("00000000-0000-0000-0000-808080808080"); | 135 | Guid requestId = new Guid("00000000-0000-0000-0000-808080808080"); |
135 | 136 | ||
136 | lock (this) | 137 | lock (this) |
137 | { | 138 | { |
138 | archiverModule.ArchiveRegion(archiveWriteStream, requestId); | 139 | m_archiverModule.ArchiveRegion(archiveWriteStream, requestId); |
139 | //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; | 140 | //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; |
140 | //while (assetServer.HasWaitingRequests()) | 141 | //while (assetServer.HasWaitingRequests()) |
141 | // assetServer.ProcessNextRequest(); | 142 | // assetServer.ProcessNextRequest(); |
@@ -214,32 +215,58 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
214 | // Also check that direct entries which will also have a file entry containing that directory doesn't | 215 | // Also check that direct entries which will also have a file entry containing that directory doesn't |
215 | // upset load | 216 | // upset load |
216 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); | 217 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); |
217 | 218 | ||
218 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); | 219 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); |
219 | 220 | ||
220 | string part1Name = "object1"; | 221 | SceneObjectPart part1 = CreateSceneObjectPart1(); |
221 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); | 222 | SceneObjectGroup object1 = new SceneObjectGroup(part1); |
222 | Vector3 groupPosition = new Vector3(90, 80, 70); | ||
223 | Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); | ||
224 | Vector3 offsetPosition = new Vector3(20, 25, 30); | ||
225 | |||
226 | SerialiserModule serialiserModule = new SerialiserModule(); | ||
227 | ArchiverModule archiverModule = new ArchiverModule(); | ||
228 | 223 | ||
229 | Scene scene = SceneSetupHelpers.SetupScene(); | 224 | // Let's put some inventory items into our object |
230 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 225 | string soundItemName = "sound-item1"; |
226 | UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); | ||
227 | Type type = GetType(); | ||
228 | Assembly assembly = type.Assembly; | ||
229 | string soundDataResourceName = null; | ||
230 | string[] names = assembly.GetManifestResourceNames(); | ||
231 | foreach (string name in names) | ||
232 | { | ||
233 | if (name.EndsWith(".Resources.test-sound.wav")) | ||
234 | soundDataResourceName = name; | ||
235 | } | ||
236 | Assert.That(soundDataResourceName, Is.Not.Null); | ||
231 | 237 | ||
232 | SceneObjectPart part1 | 238 | byte[] soundData; |
233 | = new SceneObjectPart( | 239 | Console.WriteLine("Loading " + soundDataResourceName); |
234 | UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition); | 240 | using (Stream resource = assembly.GetManifestResourceStream(soundDataResourceName)) |
235 | part1.Name = part1Name; | 241 | { |
236 | SceneObjectGroup object1 = new SceneObjectGroup(part1); | 242 | using (BinaryReader br = new BinaryReader(resource)) |
237 | scene.AddNewSceneObject(object1, false); | 243 | { |
244 | // FIXME: Use the inspector insteadthere are so many forums and lists already, though admittedly none of them are suitable for cross virtual-enivornemnt discussion | ||
245 | soundData = br.ReadBytes(99999999); | ||
246 | UUID soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
247 | string soundAssetFileName | ||
248 | = ArchiveConstants.ASSETS_PATH + soundUuid | ||
249 | + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV]; | ||
250 | tar.WriteFile(soundAssetFileName, soundData); | ||
251 | |||
252 | /* | ||
253 | AssetBase soundAsset = AssetHelpers.CreateAsset(soundUuid, soundData); | ||
254 | scene.AssetService.Store(soundAsset); | ||
255 | asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav"; | ||
256 | */ | ||
257 | |||
258 | TaskInventoryItem item1 | ||
259 | = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid, Name = soundItemName }; | ||
260 | part1.Inventory.AddInventoryItem(item1, true); | ||
261 | } | ||
262 | } | ||
263 | |||
264 | m_scene.AddNewSceneObject(object1, false); | ||
238 | 265 | ||
239 | string object1FileName = string.Format( | 266 | string object1FileName = string.Format( |
240 | "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", | 267 | "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", |
241 | part1Name, | 268 | part1.Name, |
242 | Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z), | 269 | Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z), |
243 | part1.UUID); | 270 | part1.UUID); |
244 | tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, SceneObjectSerializer.ToXml2Format(object1)); | 271 | tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, SceneObjectSerializer.ToXml2Format(object1)); |
245 | 272 | ||
@@ -249,27 +276,125 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
249 | 276 | ||
250 | lock (this) | 277 | lock (this) |
251 | { | 278 | { |
252 | scene.EventManager.OnOarFileLoaded += LoadCompleted; | 279 | m_scene.EventManager.OnOarFileLoaded += LoadCompleted; |
253 | archiverModule.DearchiveRegion(archiveReadStream); | 280 | m_archiverModule.DearchiveRegion(archiveReadStream); |
254 | } | 281 | } |
255 | 282 | ||
256 | Assert.That(m_lastErrorMessage, Is.Null); | 283 | Assert.That(m_lastErrorMessage, Is.Null); |
257 | 284 | ||
258 | SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name); | 285 | SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1.Name); |
259 | 286 | ||
260 | Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded"); | 287 | Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded"); |
261 | Assert.That(object1PartLoaded.Name, Is.EqualTo(part1Name), "object1 names not identical"); | 288 | Assert.That(object1PartLoaded.Name, Is.EqualTo(part1.Name), "object1 names not identical"); |
262 | Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(groupPosition), "object1 group position not equal"); | 289 | Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal"); |
263 | Assert.That( | 290 | Assert.That( |
264 | object1PartLoaded.RotationOffset, Is.EqualTo(rotationOffset), "object1 rotation offset not equal"); | 291 | object1PartLoaded.RotationOffset, Is.EqualTo(part1.RotationOffset), "object1 rotation offset not equal"); |
265 | Assert.That( | 292 | Assert.That( |
266 | object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); | 293 | object1PartLoaded.OffsetPosition, Is.EqualTo(part1.OffsetPosition), "object1 offset position not equal"); |
294 | |||
295 | TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0]; | ||
296 | Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null"); | ||
297 | AssetBase loadedSoundAsset = m_scene.AssetService.Get(loadedSoundItem.AssetID.ToString()); | ||
298 | Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); | ||
299 | Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); | ||
267 | 300 | ||
268 | // Temporary | 301 | // Temporary |
269 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); | 302 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); |
270 | } | 303 | } |
271 | 304 | ||
272 | /// <summary> | 305 | /// <summary> |
306 | /// Test loading the region settings of a V0.2 OpenSim Region Archive. | ||
307 | /// </summary> | ||
308 | [Test] | ||
309 | public void TestLoadOarV0_2RegionSettings() | ||
310 | { | ||
311 | TestHelper.InMethod(); | ||
312 | //log4net.Config.XmlConfigurator.Configure(); | ||
313 | |||
314 | MemoryStream archiveWriteStream = new MemoryStream(); | ||
315 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | ||
316 | |||
317 | tar.WriteDir(ArchiveConstants.TERRAINS_PATH); | ||
318 | tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); | ||
319 | |||
320 | RegionSettings rs = new RegionSettings(); | ||
321 | rs.AgentLimit = 17; | ||
322 | rs.AllowDamage = true; | ||
323 | rs.AllowLandJoinDivide = true; | ||
324 | rs.AllowLandResell = true; | ||
325 | rs.BlockFly = true; | ||
326 | rs.BlockShowInSearch = true; | ||
327 | rs.BlockTerraform = true; | ||
328 | rs.DisableCollisions = true; | ||
329 | rs.DisablePhysics = true; | ||
330 | rs.DisableScripts = true; | ||
331 | rs.Elevation1NW = 15.9; | ||
332 | rs.Elevation1NE = 45.3; | ||
333 | rs.Elevation1SE = 49; | ||
334 | rs.Elevation1SW = 1.9; | ||
335 | rs.Elevation2NW = 4.5; | ||
336 | rs.Elevation2NE = 19.2; | ||
337 | rs.Elevation2SE = 9.2; | ||
338 | rs.Elevation2SW = 2.1; | ||
339 | rs.FixedSun = true; | ||
340 | rs.ObjectBonus = 1.4; | ||
341 | rs.RestrictPushing = true; | ||
342 | rs.TerrainLowerLimit = 0.4; | ||
343 | rs.TerrainRaiseLimit = 17.9; | ||
344 | rs.TerrainTexture1 = UUID.Parse("00000000-0000-0000-0000-000000000020"); | ||
345 | rs.TerrainTexture2 = UUID.Parse("00000000-0000-0000-0000-000000000040"); | ||
346 | rs.TerrainTexture3 = UUID.Parse("00000000-0000-0000-0000-000000000060"); | ||
347 | rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); | ||
348 | rs.UseEstateSun = true; | ||
349 | rs.WaterHeight = 23; | ||
350 | |||
351 | tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs)); | ||
352 | |||
353 | tar.Close(); | ||
354 | |||
355 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | ||
356 | |||
357 | lock (this) | ||
358 | { | ||
359 | m_scene.EventManager.OnOarFileLoaded += LoadCompleted; | ||
360 | m_archiverModule.DearchiveRegion(archiveReadStream); | ||
361 | } | ||
362 | |||
363 | Assert.That(m_lastErrorMessage, Is.Null); | ||
364 | RegionSettings loadedRs = m_scene.RegionInfo.RegionSettings; | ||
365 | |||
366 | Assert.That(loadedRs.AgentLimit, Is.EqualTo(17)); | ||
367 | Assert.That(loadedRs.AllowDamage, Is.True); | ||
368 | Assert.That(loadedRs.AllowLandJoinDivide, Is.True); | ||
369 | Assert.That(loadedRs.AllowLandResell, Is.True); | ||
370 | Assert.That(loadedRs.BlockFly, Is.True); | ||
371 | Assert.That(loadedRs.BlockShowInSearch, Is.True); | ||
372 | Assert.That(loadedRs.BlockTerraform, Is.True); | ||
373 | Assert.That(loadedRs.DisableCollisions, Is.True); | ||
374 | Assert.That(loadedRs.DisablePhysics, Is.True); | ||
375 | Assert.That(loadedRs.DisableScripts, Is.True); | ||
376 | Assert.That(loadedRs.Elevation1NW, Is.EqualTo(15.9)); | ||
377 | Assert.That(loadedRs.Elevation1NE, Is.EqualTo(45.3)); | ||
378 | Assert.That(loadedRs.Elevation1SE, Is.EqualTo(49)); | ||
379 | Assert.That(loadedRs.Elevation1SW, Is.EqualTo(1.9)); | ||
380 | Assert.That(loadedRs.Elevation2NW, Is.EqualTo(4.5)); | ||
381 | Assert.That(loadedRs.Elevation2NE, Is.EqualTo(19.2)); | ||
382 | Assert.That(loadedRs.Elevation2SE, Is.EqualTo(9.2)); | ||
383 | Assert.That(loadedRs.Elevation2SW, Is.EqualTo(2.1)); | ||
384 | Assert.That(loadedRs.FixedSun, Is.True); | ||
385 | Assert.That(loadedRs.ObjectBonus, Is.EqualTo(1.4)); | ||
386 | Assert.That(loadedRs.RestrictPushing, Is.True); | ||
387 | Assert.That(loadedRs.TerrainLowerLimit, Is.EqualTo(0.4)); | ||
388 | Assert.That(loadedRs.TerrainRaiseLimit, Is.EqualTo(17.9)); | ||
389 | Assert.That(loadedRs.TerrainTexture1, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000020"))); | ||
390 | Assert.That(loadedRs.TerrainTexture2, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000040"))); | ||
391 | Assert.That(loadedRs.TerrainTexture3, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000060"))); | ||
392 | Assert.That(loadedRs.TerrainTexture4, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000080"))); | ||
393 | Assert.That(loadedRs.UseEstateSun, Is.True); | ||
394 | Assert.That(loadedRs.WaterHeight, Is.EqualTo(23)); | ||
395 | } | ||
396 | |||
397 | /// <summary> | ||
273 | /// Test merging a V0.2 OpenSim Region Archive into an existing scene | 398 | /// Test merging a V0.2 OpenSim Region Archive into an existing scene |
274 | /// </summary> | 399 | /// </summary> |
275 | //[Test] | 400 | //[Test] |
@@ -280,11 +405,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
280 | 405 | ||
281 | MemoryStream archiveWriteStream = new MemoryStream(); | 406 | MemoryStream archiveWriteStream = new MemoryStream(); |
282 | 407 | ||
283 | string part2Name = "objectMerge"; | 408 | // string part2Name = "objectMerge"; |
284 | PrimitiveBaseShape part2Shape = PrimitiveBaseShape.CreateCylinder(); | 409 | // PrimitiveBaseShape part2Shape = PrimitiveBaseShape.CreateCylinder(); |
285 | Vector3 part2GroupPosition = new Vector3(90, 80, 70); | 410 | // Vector3 part2GroupPosition = new Vector3(90, 80, 70); |
286 | Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90); | 411 | // Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90); |
287 | Vector3 part2OffsetPosition = new Vector3(20, 25, 30); | 412 | // Vector3 part2OffsetPosition = new Vector3(20, 25, 30); |
413 | |||
414 | SceneObjectPart part2 = CreateSceneObjectPart2(); | ||
288 | 415 | ||
289 | // Create an oar file that we can use for the merge | 416 | // Create an oar file that we can use for the merge |
290 | { | 417 | { |
@@ -293,63 +420,39 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
293 | TerrainModule terrainModule = new TerrainModule(); | 420 | TerrainModule terrainModule = new TerrainModule(); |
294 | 421 | ||
295 | Scene scene = SceneSetupHelpers.SetupScene(); | 422 | Scene scene = SceneSetupHelpers.SetupScene(); |
296 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); | 423 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); |
297 | 424 | ||
298 | SceneObjectPart part2 | 425 | m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); |
299 | = new SceneObjectPart( | ||
300 | UUID.Zero, part2Shape, part2GroupPosition, part2RotationOffset, part2OffsetPosition); | ||
301 | part2.Name = part2Name; | ||
302 | SceneObjectGroup object2 = new SceneObjectGroup(part2); | ||
303 | |||
304 | scene.AddNewSceneObject(object2, false); | ||
305 | 426 | ||
306 | // Write out this scene | 427 | // Write out this scene |
307 | scene.EventManager.OnOarFileSaved += SaveCompleted; | 428 | scene.EventManager.OnOarFileSaved += SaveCompleted; |
308 | 429 | ||
309 | lock (this) | 430 | lock (this) |
310 | { | 431 | { |
311 | archiverModule.ArchiveRegion(archiveWriteStream); | 432 | m_archiverModule.ArchiveRegion(archiveWriteStream); |
312 | Monitor.Wait(this, 60000); | 433 | Monitor.Wait(this, 60000); |
313 | } | 434 | } |
314 | } | 435 | } |
315 | 436 | ||
316 | { | 437 | { |
317 | ArchiverModule archiverModule = new ArchiverModule(); | 438 | SceneObjectPart part1 = CreateSceneObjectPart1(); |
318 | SerialiserModule serialiserModule = new SerialiserModule(); | 439 | m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false); |
319 | TerrainModule terrainModule = new TerrainModule(); | ||
320 | |||
321 | Scene scene = SceneSetupHelpers.SetupScene(); | ||
322 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); | ||
323 | |||
324 | string part1Name = "objectExisting"; | ||
325 | PrimitiveBaseShape part1Shape = PrimitiveBaseShape.CreateCylinder(); | ||
326 | Vector3 part1GroupPosition = new Vector3(80, 70, 60); | ||
327 | Quaternion part1RotationOffset = new Quaternion(50, 60, 70, 80); | ||
328 | Vector3 part1OffsetPosition = new Vector3(15, 20, 25); | ||
329 | |||
330 | SceneObjectPart part1 | ||
331 | = new SceneObjectPart( | ||
332 | UUID.Zero, part1Shape, part1GroupPosition, part1RotationOffset, part1OffsetPosition); | ||
333 | part1.Name = part1Name; | ||
334 | SceneObjectGroup object1 = new SceneObjectGroup(part1); | ||
335 | |||
336 | scene.AddNewSceneObject(object1, false); | ||
337 | 440 | ||
338 | // Merge in the archive we created earlier | 441 | // Merge in the archive we created earlier |
339 | byte[] archive = archiveWriteStream.ToArray(); | 442 | byte[] archive = archiveWriteStream.ToArray(); |
340 | MemoryStream archiveReadStream = new MemoryStream(archive); | 443 | MemoryStream archiveReadStream = new MemoryStream(archive); |
341 | 444 | ||
342 | archiverModule.DearchiveRegion(archiveReadStream, true, Guid.Empty); | 445 | m_archiverModule.DearchiveRegion(archiveReadStream, true, Guid.Empty); |
343 | 446 | ||
344 | SceneObjectPart object1Existing = scene.GetSceneObjectPart(part1Name); | 447 | SceneObjectPart object1Existing = m_scene.GetSceneObjectPart(part1.Name); |
345 | Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge"); | 448 | Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge"); |
346 | Assert.That(object1Existing.Name, Is.EqualTo(part1Name), "object1 names not identical after merge"); | 449 | Assert.That(object1Existing.Name, Is.EqualTo(part1.Name), "object1 names not identical after merge"); |
347 | Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1GroupPosition), "object1 group position not equal after merge"); | 450 | Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal after merge"); |
348 | 451 | ||
349 | SceneObjectPart object2PartMerged = scene.GetSceneObjectPart(part2Name); | 452 | SceneObjectPart object2PartMerged = m_scene.GetSceneObjectPart(part2.Name); |
350 | Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge"); | 453 | Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge"); |
351 | Assert.That(object2PartMerged.Name, Is.EqualTo(part2Name), "object2 names not identical after merge"); | 454 | Assert.That(object2PartMerged.Name, Is.EqualTo(part2.Name), "object2 names not identical after merge"); |
352 | Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2GroupPosition), "object2 group position not equal after merge"); | 455 | Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2.GroupPosition), "object2 group position not equal after merge"); |
353 | } | 456 | } |
354 | } | 457 | } |
355 | } | 458 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav b/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav new file mode 100755 index 0000000..b45ee54 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav | |||
Binary files differ | |||
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 72dd373..4652d70 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -142,6 +142,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
142 | private bool m_debugPermissions = false; | 142 | private bool m_debugPermissions = false; |
143 | private bool m_allowGridGods = false; | 143 | private bool m_allowGridGods = false; |
144 | private bool m_RegionOwnerIsGod = false; | 144 | private bool m_RegionOwnerIsGod = false; |
145 | private bool m_RegionManagerIsGod = false; | ||
145 | private bool m_ParcelOwnerIsGod = false; | 146 | private bool m_ParcelOwnerIsGod = false; |
146 | 147 | ||
147 | /// <value> | 148 | /// <value> |
@@ -184,6 +185,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
184 | m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", false); | 185 | m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", false); |
185 | m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true); | 186 | m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true); |
186 | m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); | 187 | m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); |
188 | m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false); | ||
187 | m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); | 189 | m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); |
188 | 190 | ||
189 | m_allowedScriptCreators | 191 | m_allowedScriptCreators |
@@ -479,10 +481,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
479 | 481 | ||
480 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) | 482 | if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) |
481 | { | 483 | { |
482 | if (m_scene.RegionInfo.EstateSettings.EstateOwner == user) | 484 | if (m_scene.RegionInfo.EstateSettings.EstateOwner == user && m_RegionOwnerIsGod) |
483 | return true; | 485 | return true; |
484 | } | 486 | } |
485 | 487 | ||
488 | if (IsEstateManager(user) && m_RegionManagerIsGod) | ||
489 | return true; | ||
490 | |||
486 | if (m_allowGridGods) | 491 | if (m_allowGridGods) |
487 | { | 492 | { |
488 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); | 493 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); |
@@ -495,6 +500,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
495 | 500 | ||
496 | return false; | 501 | return false; |
497 | } | 502 | } |
503 | |||
498 | protected bool IsFriendWithPerms(UUID user,UUID objectOwner) | 504 | protected bool IsFriendWithPerms(UUID user,UUID objectOwner) |
499 | { | 505 | { |
500 | 506 | ||
@@ -896,9 +902,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
896 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 902 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
897 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 903 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
898 | 904 | ||
899 | if (IsEstateManager(user) && m_RegionOwnerIsGod) | ||
900 | return true; | ||
901 | |||
902 | return IsAdministrator(user); | 905 | return IsAdministrator(user); |
903 | } | 906 | } |
904 | 907 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 67395fa..fa9bf19 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -71,13 +71,18 @@ namespace OpenSim.Region.Framework.Interfaces | |||
71 | /// <summary> | 71 | /// <summary> |
72 | /// Start all the scripts contained in this entity's inventory | 72 | /// Start all the scripts contained in this entity's inventory |
73 | /// </summary> | 73 | /// </summary> |
74 | void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); | 74 | void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); |
75 | |||
75 | ArrayList GetScriptErrors(UUID itemID); | 76 | ArrayList GetScriptErrors(UUID itemID); |
76 | 77 | ||
77 | /// <summary> | 78 | /// <summary> |
78 | /// Stop all the scripts in this entity. | 79 | /// Stop all the scripts in this entity. |
79 | /// </summary> | 80 | /// </summary> |
80 | void RemoveScriptInstances(); | 81 | /// <param name="sceneObjectBeingDeleted"> |
82 | /// Should be true if these scripts are being removed because the scene | ||
83 | /// object is being deleted. This will prevent spurious updates to the client. | ||
84 | /// </param> | ||
85 | void RemoveScriptInstances(bool sceneObjectBeingDeleted); | ||
81 | 86 | ||
82 | /// <summary> | 87 | /// <summary> |
83 | /// Start a script which is in this entity's inventory. | 88 | /// Start a script which is in this entity's inventory. |
@@ -103,7 +108,11 @@ namespace OpenSim.Region.Framework.Interfaces | |||
103 | /// Stop a script which is in this prim's inventory. | 108 | /// Stop a script which is in this prim's inventory. |
104 | /// </summary> | 109 | /// </summary> |
105 | /// <param name="itemId"></param> | 110 | /// <param name="itemId"></param> |
106 | void RemoveScriptInstance(UUID itemId); | 111 | /// <param name="sceneObjectBeingDeleted"> |
112 | /// Should be true if these scripts are being removed because the scene | ||
113 | /// object is being deleted. This will prevent spurious updates to the client. | ||
114 | /// </param> | ||
115 | void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted); | ||
107 | 116 | ||
108 | /// <summary> | 117 | /// <summary> |
109 | /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative | 118 | /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative |
@@ -135,6 +144,16 @@ namespace OpenSim.Region.Framework.Interfaces | |||
135 | TaskInventoryItem GetInventoryItem(UUID itemId); | 144 | TaskInventoryItem GetInventoryItem(UUID itemId); |
136 | 145 | ||
137 | /// <summary> | 146 | /// <summary> |
147 | /// Get inventory items by name. | ||
148 | /// </summary> | ||
149 | /// <param name="name"></param> | ||
150 | /// <returns> | ||
151 | /// A list of inventory items with that name. | ||
152 | /// If no inventory item has that name then an empty list is returned. | ||
153 | /// </returns> | ||
154 | IList<TaskInventoryItem> GetInventoryItems(string name); | ||
155 | |||
156 | /// <summary> | ||
138 | /// Update an existing inventory item. | 157 | /// Update an existing inventory item. |
139 | /// </summary> | 158 | /// </summary> |
140 | /// <param name="item">The updated item. An item with the same id must already exist | 159 | /// <param name="item">The updated item. An item with the same id must already exist |
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs index 74526c4..948b9dc 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs | |||
@@ -49,10 +49,49 @@ namespace OpenSim.Region.Framework.Interfaces | |||
49 | 49 | ||
50 | public interface IWorldComm | 50 | public interface IWorldComm |
51 | { | 51 | { |
52 | /// <summary> | ||
53 | /// Create a listen event callback with the specified filters. | ||
54 | /// The parameters localID,itemID are needed to uniquely identify | ||
55 | /// the script during 'peek' time. Parameter hostID is needed to | ||
56 | /// determine the position of the script. | ||
57 | /// </summary> | ||
58 | /// <param name="localID">localID of the script engine</param> | ||
59 | /// <param name="itemID">UUID of the script engine</param> | ||
60 | /// <param name="hostID">UUID of the SceneObjectPart</param> | ||
61 | /// <param name="channel">channel to listen on</param> | ||
62 | /// <param name="name">name to filter on</param> | ||
63 | /// <param name="id">key to filter on (user given, could be totally faked)</param> | ||
64 | /// <param name="msg">msg to filter on</param> | ||
65 | /// <returns>number of the scripts handle</returns> | ||
52 | int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg); | 66 | int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg); |
67 | |||
68 | /// <summary> | ||
69 | /// This method scans over the objects which registered an interest in listen callbacks. | ||
70 | /// For everyone it finds, it checks if it fits the given filter. If it does, then | ||
71 | /// enqueue the message for delivery to the objects listen event handler. | ||
72 | /// The enqueued ListenerInfo no longer has filter values, but the actually trigged values. | ||
73 | /// Objects that do an llSay have their messages delivered here and for nearby avatars, | ||
74 | /// the OnChatFromClient event is used. | ||
75 | /// </summary> | ||
76 | /// <param name="type">type of delvery (whisper,say,shout or regionwide)</param> | ||
77 | /// <param name="channel">channel to sent on</param> | ||
78 | /// <param name="name">name of sender (object or avatar)</param> | ||
79 | /// <param name="id">key of sender (object or avatar)</param> | ||
80 | /// <param name="msg">msg to sent</param> | ||
53 | void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg); | 81 | void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg); |
82 | |||
83 | /// <summary> | ||
84 | /// Are there any listen events ready to be dispatched? | ||
85 | /// </summary> | ||
86 | /// <returns>boolean indication</returns> | ||
54 | bool HasMessages(); | 87 | bool HasMessages(); |
88 | |||
89 | /// <summary> | ||
90 | /// Pop the first availlable listen event from the queue | ||
91 | /// </summary> | ||
92 | /// <returns>ListenerInfo with filter filled in</returns> | ||
55 | IWorldCommListenerInfo GetNextMessage(); | 93 | IWorldCommListenerInfo GetNextMessage(); |
94 | |||
56 | void ListenControl(UUID itemID, int handle, int active); | 95 | void ListenControl(UUID itemID, int handle, int active); |
57 | void ListenRemove(UUID itemID, int handle); | 96 | void ListenRemove(UUID itemID, int handle); |
58 | void DeleteListener(UUID itemID); | 97 | void DeleteListener(UUID itemID); |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 399379e..473920e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -27,11 +27,13 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | ||
31 | using log4net; | ||
30 | using OpenMetaverse; | 32 | using OpenMetaverse; |
31 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
32 | using OpenSim.Framework.Client; | 34 | using OpenSim.Framework.Client; |
33 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
34 | using Caps=OpenSim.Framework.Capabilities.Caps; | 36 | using Caps = OpenSim.Framework.Capabilities.Caps; |
35 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
36 | 38 | ||
37 | namespace OpenSim.Region.Framework.Scenes | 39 | namespace OpenSim.Region.Framework.Scenes |
@@ -41,6 +43,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
41 | /// </summary> | 43 | /// </summary> |
42 | public class EventManager | 44 | public class EventManager |
43 | { | 45 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
44 | public delegate void OnFrameDelegate(); | 48 | public delegate void OnFrameDelegate(); |
45 | 49 | ||
46 | public event OnFrameDelegate OnFrame; | 50 | public event OnFrameDelegate OnFrame; |
@@ -92,8 +96,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
92 | public delegate void OnShutdownDelegate(); | 96 | public delegate void OnShutdownDelegate(); |
93 | 97 | ||
94 | public event OnShutdownDelegate OnShutdown; | 98 | public event OnShutdownDelegate OnShutdown; |
95 | 99 | ||
96 | public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); | ||
97 | public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); | 100 | public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); |
98 | public delegate void ScriptResetDelegate(uint localID, UUID itemID); | 101 | public delegate void ScriptResetDelegate(uint localID, UUID itemID); |
99 | 102 | ||
@@ -103,62 +106,57 @@ namespace OpenSim.Region.Framework.Scenes | |||
103 | 106 | ||
104 | public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; | 107 | public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; |
105 | 108 | ||
109 | /// <summary> | ||
110 | /// Called when an object is touched/grabbed. | ||
111 | /// </summary> | ||
112 | /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of | ||
113 | /// the root part. | ||
114 | public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); | ||
106 | public event ObjectGrabDelegate OnObjectGrab; | 115 | public event ObjectGrabDelegate OnObjectGrab; |
116 | |||
117 | public event ObjectGrabDelegate OnObjectGrabbing; | ||
107 | public event ObjectDeGrabDelegate OnObjectDeGrab; | 118 | public event ObjectDeGrabDelegate OnObjectDeGrab; |
108 | public event ScriptResetDelegate OnScriptReset; | 119 | public event ScriptResetDelegate OnScriptReset; |
109 | 120 | ||
110 | public event OnPermissionErrorDelegate OnPermissionError; | 121 | public event OnPermissionErrorDelegate OnPermissionError; |
111 | 122 | ||
112 | public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); | 123 | public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); |
113 | |||
114 | public event NewRezScript OnRezScript; | 124 | public event NewRezScript OnRezScript; |
115 | 125 | ||
116 | public delegate void RemoveScript(uint localID, UUID itemID); | 126 | public delegate void RemoveScript(uint localID, UUID itemID); |
117 | |||
118 | public event RemoveScript OnRemoveScript; | 127 | public event RemoveScript OnRemoveScript; |
119 | 128 | ||
120 | public delegate void StartScript(uint localID, UUID itemID); | 129 | public delegate void StartScript(uint localID, UUID itemID); |
121 | |||
122 | public event StartScript OnStartScript; | 130 | public event StartScript OnStartScript; |
123 | 131 | ||
124 | public delegate void StopScript(uint localID, UUID itemID); | 132 | public delegate void StopScript(uint localID, UUID itemID); |
125 | |||
126 | public event StopScript OnStopScript; | 133 | public event StopScript OnStopScript; |
127 | 134 | ||
128 | public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta); | 135 | public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta); |
129 | |||
130 | public event SceneGroupMoved OnSceneGroupMove; | 136 | public event SceneGroupMoved OnSceneGroupMove; |
131 | 137 | ||
132 | public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID); | 138 | public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID); |
133 | |||
134 | public event SceneGroupGrabed OnSceneGroupGrab; | 139 | public event SceneGroupGrabed OnSceneGroupGrab; |
135 | 140 | ||
136 | public delegate bool SceneGroupSpinStarted(UUID groupID); | 141 | public delegate bool SceneGroupSpinStarted(UUID groupID); |
137 | |||
138 | public event SceneGroupSpinStarted OnSceneGroupSpinStart; | 142 | public event SceneGroupSpinStarted OnSceneGroupSpinStart; |
139 | 143 | ||
140 | public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation); | 144 | public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation); |
141 | |||
142 | public event SceneGroupSpun OnSceneGroupSpin; | 145 | public event SceneGroupSpun OnSceneGroupSpin; |
143 | 146 | ||
144 | public delegate void LandObjectAdded(ILandObject newParcel); | 147 | public delegate void LandObjectAdded(ILandObject newParcel); |
145 | |||
146 | public event LandObjectAdded OnLandObjectAdded; | 148 | public event LandObjectAdded OnLandObjectAdded; |
147 | 149 | ||
148 | public delegate void LandObjectRemoved(UUID globalID); | 150 | public delegate void LandObjectRemoved(UUID globalID); |
149 | |||
150 | public event LandObjectRemoved OnLandObjectRemoved; | 151 | public event LandObjectRemoved OnLandObjectRemoved; |
151 | 152 | ||
152 | public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); | 153 | public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); |
153 | |||
154 | public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; | 154 | public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; |
155 | 155 | ||
156 | public delegate void SignificantClientMovement(IClientAPI remote_client); | 156 | public delegate void SignificantClientMovement(IClientAPI remote_client); |
157 | |||
158 | public event SignificantClientMovement OnSignificantClientMovement; | 157 | public event SignificantClientMovement OnSignificantClientMovement; |
159 | 158 | ||
160 | public delegate void IncomingInstantMessage(GridInstantMessage message); | 159 | public delegate void IncomingInstantMessage(GridInstantMessage message); |
161 | |||
162 | public event IncomingInstantMessage OnIncomingInstantMessage; | 160 | public event IncomingInstantMessage OnIncomingInstantMessage; |
163 | 161 | ||
164 | public event IncomingInstantMessage OnUnhandledInstantMessage; | 162 | public event IncomingInstantMessage OnUnhandledInstantMessage; |
@@ -214,14 +212,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
214 | public delegate void RequestChangeWaterHeight(float height); | 212 | public delegate void RequestChangeWaterHeight(float height); |
215 | 213 | ||
216 | public event RequestChangeWaterHeight OnRequestChangeWaterHeight; | 214 | public event RequestChangeWaterHeight OnRequestChangeWaterHeight; |
217 | 215 | ||
218 | public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar); | 216 | /// <summary> |
219 | 217 | /// Fired if any avatar is 'killed' due to its health falling to zero | |
218 | /// </summary> | ||
220 | public event AvatarKillData OnAvatarKilled; | 219 | public event AvatarKillData OnAvatarKilled; |
220 | public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar); | ||
221 | 221 | ||
222 | public delegate void ScriptTimerEvent(uint localID, double timerinterval); | 222 | // public delegate void ScriptTimerEvent(uint localID, double timerinterval); |
223 | 223 | ||
224 | public event ScriptTimerEvent OnScriptTimerEvent; | 224 | // public event ScriptTimerEvent OnScriptTimerEvent; |
225 | 225 | ||
226 | public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); | 226 | public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); |
227 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); | 227 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); |
@@ -312,9 +312,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
312 | public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue; | 312 | public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue; |
313 | 313 | ||
314 | /// <summary> | 314 | /// <summary> |
315 | /// Called whenever an object is attached, or detached | 315 | /// Called whenever an object is attached, or detached from an in-world presence. |
316 | /// from an in-world presence. | ||
317 | /// </summary> | 316 | /// </summary> |
317 | /// If the object is being attached, then the avatarID will be present. If the object is being detached then | ||
318 | /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). | ||
318 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); | 319 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); |
319 | public event Attach OnAttach; | 320 | public event Attach OnAttach; |
320 | 321 | ||
@@ -387,607 +388,1263 @@ namespace OpenSim.Region.Framework.Scenes | |||
387 | public event LandBuy OnLandBuy; | 388 | public event LandBuy OnLandBuy; |
388 | public event LandBuy OnValidateLandBuy; | 389 | public event LandBuy OnValidateLandBuy; |
389 | 390 | ||
390 | /* Designated Event Deletage Instances */ | ||
391 | |||
392 | private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; | ||
393 | private ScriptAtTargetEvent handlerScriptAtTargetEvent = null; | ||
394 | private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; | ||
395 | private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null; | ||
396 | private ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = null; | ||
397 | private ClientMovement handlerClientMovement = null; //OnClientMovement; | ||
398 | private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError; | ||
399 | private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole; | ||
400 | private OnFrameDelegate handlerFrame = null; //OnFrame; | ||
401 | private OnNewClientDelegate handlerNewClient = null; //OnNewClient; | ||
402 | private OnClientConnectCoreDelegate handlerClientConnect = null; //OnClientConnect | ||
403 | private OnNewPresenceDelegate handlerNewPresence = null; //OnNewPresence; | ||
404 | private OnRemovePresenceDelegate handlerRemovePresence = null; //OnRemovePresence; | ||
405 | private OnBackupDelegate handlerBackup = null; //OnBackup; | ||
406 | private OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = null; //OnParcelPrimCountUpdate; | ||
407 | private MoneyTransferEvent handlerMoneyTransfer = null; //OnMoneyTransfer; | ||
408 | private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd; | ||
409 | private OnShutdownDelegate handlerShutdown = null; //OnShutdown; | ||
410 | private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab; | ||
411 | private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab; | ||
412 | private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset | ||
413 | private NewRezScript handlerRezScript = null; //OnRezScript; | ||
414 | private RemoveScript handlerRemoveScript = null; //OnRemoveScript; | ||
415 | private StartScript handlerStartScript = null; //OnStartScript; | ||
416 | private StopScript handlerStopScript = null; //OnStopScript; | ||
417 | private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove; | ||
418 | private SceneGroupGrabed handlerSceneGroupGrab = null; //OnSceneGroupGrab; | ||
419 | private SceneGroupSpinStarted handlerSceneGroupSpinStarted = null; //OnSceneGroupSpinStart; | ||
420 | private SceneGroupSpun handlerSceneGroupSpin = null; //OnSceneGroupSpin; | ||
421 | private LandObjectAdded handlerLandObjectAdded = null; //OnLandObjectAdded; | ||
422 | private LandObjectRemoved handlerLandObjectRemoved = null; //OnLandObjectRemoved; | ||
423 | private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = null; //OnAvatarEnteringNewParcel; | ||
424 | private IncomingInstantMessage handlerIncomingInstantMessage = null; //OnIncomingInstantMessage; | ||
425 | private IncomingInstantMessage handlerUnhandledInstantMessage = null; //OnUnhandledInstantMessage; | ||
426 | private ClientClosed handlerClientClosed = null; //OnClientClosed; | ||
427 | private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent; | ||
428 | private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent; | ||
429 | private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick; | ||
430 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; | ||
431 | private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; | ||
432 | private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld; | ||
433 | private ChatFromClientEvent handlerChatFromClient = null; // OnChatFromClient; | ||
434 | private ChatBroadcastEvent handlerChatBroadcast = null; // OnChatBroadcast; | ||
435 | private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; | ||
436 | private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight | ||
437 | private ScriptControlEvent handlerScriptControlEvent = null; | ||
438 | private SignificantClientMovement handlerSignificantClientMovement = null; | ||
439 | |||
440 | private LandBuy handlerLandBuy = null; | ||
441 | private LandBuy handlerValidateLandBuy = null; | ||
442 | private AvatarKillData handlerAvatarKill = null; | ||
443 | |||
444 | private NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = null; | ||
445 | private IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = null; | ||
446 | private SetAllowForcefulBan handlerSetAllowForcefulBan = null; | ||
447 | private RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = null; | ||
448 | private ParcelPrimCountTainted handlerParcelPrimCountTainted = null; | ||
449 | private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null; | ||
450 | // TODO: unused: private ScriptTimerEvent handlerScriptTimerEvent = null; | ||
451 | private EstateToolsSunUpdate handlerEstateToolsSunUpdate = null; | ||
452 | |||
453 | private ScriptColliding handlerCollidingStart = null; | ||
454 | private ScriptColliding handlerColliding = null; | ||
455 | private ScriptColliding handlerCollidingEnd = null; | ||
456 | private ScriptColliding handlerLandCollidingStart = null; | ||
457 | private ScriptColliding handlerLandColliding = null; | ||
458 | private ScriptColliding handlerLandCollidingEnd = null; | ||
459 | private GetScriptRunning handlerGetScriptRunning = null; | ||
460 | |||
461 | private SunLindenHour handlerCurrentTimeAsLindenSunHour = null; | ||
462 | private OnSetRootAgentSceneDelegate handlerSetRootAgentScene = null; | ||
463 | |||
464 | private OarFileLoaded handlerOarFileLoaded = null; | ||
465 | private OarFileSaved handlerOarFileSaved = null; | ||
466 | |||
467 | private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null; | ||
468 | |||
469 | private Attach handlerOnAttach = null; | ||
470 | private RegionUp handlerOnRegionUp = null; | ||
471 | |||
472 | public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID) | 391 | public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID) |
473 | { | 392 | { |
474 | handlerOnAttach = OnAttach; | 393 | Attach handlerOnAttach = OnAttach; |
475 | if (handlerOnAttach != null) | 394 | if (handlerOnAttach != null) |
476 | handlerOnAttach(localID, itemID, avatarID); | 395 | { |
396 | foreach (Attach d in handlerOnAttach.GetInvocationList()) | ||
397 | { | ||
398 | try | ||
399 | { | ||
400 | d(localID, itemID, avatarID); | ||
401 | } | ||
402 | catch (Exception e) | ||
403 | { | ||
404 | m_log.ErrorFormat( | ||
405 | "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", | ||
406 | e.Message, e.StackTrace); | ||
407 | } | ||
408 | } | ||
409 | } | ||
477 | } | 410 | } |
478 | 411 | ||
479 | public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) | 412 | public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) |
480 | { | 413 | { |
481 | handlerGetScriptRunning = OnGetScriptRunning; | 414 | GetScriptRunning handlerGetScriptRunning = OnGetScriptRunning; |
482 | if (handlerGetScriptRunning != null) | 415 | if (handlerGetScriptRunning != null) |
483 | handlerGetScriptRunning(controllingClient, objectID, itemID); | 416 | { |
417 | foreach (GetScriptRunning d in handlerGetScriptRunning.GetInvocationList()) | ||
418 | { | ||
419 | try | ||
420 | { | ||
421 | d(controllingClient, objectID, itemID); | ||
422 | } | ||
423 | catch (Exception e) | ||
424 | { | ||
425 | m_log.ErrorFormat( | ||
426 | "[EVENT MANAGER]: Delegate for TriggerGetScriptRunning failed - continuing. {0} {1}", | ||
427 | e.Message, e.StackTrace); | ||
428 | } | ||
429 | } | ||
430 | } | ||
484 | } | 431 | } |
485 | 432 | ||
486 | public void TriggerOnScriptChangedEvent(uint localID, uint change) | 433 | public void TriggerOnScriptChangedEvent(uint localID, uint change) |
487 | { | 434 | { |
488 | handlerScriptChangedEvent = OnScriptChangedEvent; | 435 | ScriptChangedEvent handlerScriptChangedEvent = OnScriptChangedEvent; |
489 | if (handlerScriptChangedEvent != null) | 436 | if (handlerScriptChangedEvent != null) |
490 | handlerScriptChangedEvent(localID, change); | 437 | { |
438 | foreach (ScriptChangedEvent d in handlerScriptChangedEvent.GetInvocationList()) | ||
439 | { | ||
440 | try | ||
441 | { | ||
442 | d(localID, change); | ||
443 | } | ||
444 | catch (Exception e) | ||
445 | { | ||
446 | m_log.ErrorFormat( | ||
447 | "[EVENT MANAGER]: Delegate for TriggerOnScriptChangedEvent failed - continuing. {0} {1}", | ||
448 | e.Message, e.StackTrace); | ||
449 | } | ||
450 | } | ||
451 | } | ||
491 | } | 452 | } |
492 | 453 | ||
493 | public void TriggerOnClientMovement(ScenePresence avatar) | 454 | public void TriggerOnClientMovement(ScenePresence avatar) |
494 | { | 455 | { |
495 | handlerClientMovement = OnClientMovement; | 456 | ClientMovement handlerClientMovement = OnClientMovement; |
496 | if (handlerClientMovement != null) | 457 | if (handlerClientMovement != null) |
497 | handlerClientMovement(avatar); | 458 | { |
459 | foreach (ClientMovement d in handlerClientMovement.GetInvocationList()) | ||
460 | { | ||
461 | try | ||
462 | { | ||
463 | d(avatar); | ||
464 | } | ||
465 | catch (Exception e) | ||
466 | { | ||
467 | m_log.ErrorFormat( | ||
468 | "[EVENT MANAGER]: Delegate for TriggerOnClientMovement failed - continuing. {0} {1}", | ||
469 | e.Message, e.StackTrace); | ||
470 | } | ||
471 | } | ||
472 | } | ||
498 | } | 473 | } |
499 | 474 | ||
500 | public void TriggerPermissionError(UUID user, string reason) | 475 | public void TriggerPermissionError(UUID user, string reason) |
501 | { | 476 | { |
502 | handlerPermissionError = OnPermissionError; | 477 | OnPermissionErrorDelegate handlerPermissionError = OnPermissionError; |
503 | if (handlerPermissionError != null) | 478 | if (handlerPermissionError != null) |
504 | handlerPermissionError(user, reason); | 479 | { |
480 | foreach (OnPermissionErrorDelegate d in handlerPermissionError.GetInvocationList()) | ||
481 | { | ||
482 | try | ||
483 | { | ||
484 | d(user, reason); | ||
485 | } | ||
486 | catch (Exception e) | ||
487 | { | ||
488 | m_log.ErrorFormat( | ||
489 | "[EVENT MANAGER]: Delegate for TriggerPermissionError failed - continuing. {0} {1}", | ||
490 | e.Message, e.StackTrace); | ||
491 | } | ||
492 | } | ||
493 | } | ||
505 | } | 494 | } |
506 | 495 | ||
507 | public void TriggerOnPluginConsole(string[] args) | 496 | public void TriggerOnPluginConsole(string[] args) |
508 | { | 497 | { |
509 | handlerPluginConsole = OnPluginConsole; | 498 | OnPluginConsoleDelegate handlerPluginConsole = OnPluginConsole; |
510 | if (handlerPluginConsole != null) | 499 | if (handlerPluginConsole != null) |
511 | handlerPluginConsole(args); | 500 | { |
501 | foreach (OnPluginConsoleDelegate d in handlerPluginConsole.GetInvocationList()) | ||
502 | { | ||
503 | try | ||
504 | { | ||
505 | d(args); | ||
506 | } | ||
507 | catch (Exception e) | ||
508 | { | ||
509 | m_log.ErrorFormat( | ||
510 | "[EVENT MANAGER]: Delegate for TriggerOnPluginConsole failed - continuing. {0} {1}", | ||
511 | e.Message, e.StackTrace); | ||
512 | } | ||
513 | } | ||
514 | } | ||
512 | } | 515 | } |
513 | 516 | ||
514 | public void TriggerOnFrame() | 517 | public void TriggerOnFrame() |
515 | { | 518 | { |
516 | handlerFrame = OnFrame; | 519 | OnFrameDelegate handlerFrame = OnFrame; |
517 | if (handlerFrame != null) | 520 | if (handlerFrame != null) |
518 | { | 521 | { |
519 | handlerFrame(); | 522 | foreach (OnFrameDelegate d in handlerFrame.GetInvocationList()) |
520 | } | 523 | { |
524 | try | ||
525 | { | ||
526 | d(); | ||
527 | } | ||
528 | catch (Exception e) | ||
529 | { | ||
530 | m_log.ErrorFormat( | ||
531 | "[EVENT MANAGER]: Delegate for TriggerOnFrame failed - continuing. {0} {1}", | ||
532 | e.Message, e.StackTrace); | ||
533 | } | ||
534 | } | ||
535 | } | ||
521 | } | 536 | } |
522 | 537 | ||
523 | public void TriggerOnNewClient(IClientAPI client) | 538 | public void TriggerOnNewClient(IClientAPI client) |
524 | { | 539 | { |
525 | handlerNewClient = OnNewClient; | 540 | OnNewClientDelegate handlerNewClient = OnNewClient; |
526 | if (handlerNewClient != null) | 541 | if (handlerNewClient != null) |
527 | handlerNewClient(client); | 542 | { |
543 | foreach (OnNewClientDelegate d in handlerNewClient.GetInvocationList()) | ||
544 | { | ||
545 | try | ||
546 | { | ||
547 | d(client); | ||
548 | } | ||
549 | catch (Exception e) | ||
550 | { | ||
551 | m_log.ErrorFormat( | ||
552 | "[EVENT MANAGER]: Delegate for TriggerOnNewClient failed - continuing. {0} {1}", | ||
553 | e.Message, e.StackTrace); | ||
554 | } | ||
555 | } | ||
556 | } | ||
528 | 557 | ||
529 | if (client is IClientCore) | 558 | if (client is IClientCore) |
530 | { | 559 | { |
531 | handlerClientConnect = OnClientConnect; | 560 | OnClientConnectCoreDelegate handlerClientConnect = OnClientConnect; |
532 | if (handlerClientConnect != null) | 561 | if (handlerClientConnect != null) |
533 | handlerClientConnect((IClientCore)client); | 562 | { |
563 | foreach (OnClientConnectCoreDelegate d in handlerClientConnect.GetInvocationList()) | ||
564 | { | ||
565 | try | ||
566 | { | ||
567 | d((IClientCore)client); | ||
568 | } | ||
569 | catch (Exception e) | ||
570 | { | ||
571 | m_log.ErrorFormat( | ||
572 | "[EVENT MANAGER]: Delegate for TriggerOnNewClient (IClientCore) failed - continuing. {0} {1}", | ||
573 | e.Message, e.StackTrace); | ||
574 | } | ||
575 | } | ||
576 | } | ||
534 | } | 577 | } |
535 | } | 578 | } |
536 | 579 | ||
537 | public void TriggerOnNewPresence(ScenePresence presence) | 580 | public void TriggerOnNewPresence(ScenePresence presence) |
538 | { | 581 | { |
539 | handlerNewPresence = OnNewPresence; | 582 | OnNewPresenceDelegate handlerNewPresence = OnNewPresence; |
540 | if (handlerNewPresence != null) | 583 | if (handlerNewPresence != null) |
541 | handlerNewPresence(presence); | 584 | { |
585 | foreach (OnNewPresenceDelegate d in handlerNewPresence.GetInvocationList()) | ||
586 | { | ||
587 | try | ||
588 | { | ||
589 | d(presence); | ||
590 | } | ||
591 | catch (Exception e) | ||
592 | { | ||
593 | m_log.ErrorFormat( | ||
594 | "[EVENT MANAGER]: Delegate for TriggerOnNewPresence failed - continuing. {0} {1}", | ||
595 | e.Message, e.StackTrace); | ||
596 | } | ||
597 | } | ||
598 | } | ||
542 | } | 599 | } |
543 | 600 | ||
544 | public void TriggerOnRemovePresence(UUID agentId) | 601 | public void TriggerOnRemovePresence(UUID agentId) |
545 | { | 602 | { |
546 | handlerRemovePresence = OnRemovePresence; | 603 | OnRemovePresenceDelegate handlerRemovePresence = OnRemovePresence; |
547 | if (handlerRemovePresence != null) | 604 | if (handlerRemovePresence != null) |
548 | { | 605 | { |
549 | handlerRemovePresence(agentId); | 606 | foreach (OnRemovePresenceDelegate d in handlerRemovePresence.GetInvocationList()) |
550 | } | 607 | { |
608 | try | ||
609 | { | ||
610 | d(agentId); | ||
611 | } | ||
612 | catch (Exception e) | ||
613 | { | ||
614 | m_log.ErrorFormat( | ||
615 | "[EVENT MANAGER]: Delegate for TriggerOnRemovePresence failed - continuing. {0} {1}", | ||
616 | e.Message, e.StackTrace); | ||
617 | } | ||
618 | } | ||
619 | } | ||
551 | } | 620 | } |
552 | 621 | ||
553 | public void TriggerOnBackup(IRegionDataStore dstore) | 622 | public void TriggerOnBackup(IRegionDataStore dstore) |
554 | { | 623 | { |
555 | handlerBackup = OnBackup; | 624 | OnBackupDelegate handlerOnAttach = OnBackup; |
556 | if (handlerBackup != null) | 625 | if (handlerOnAttach != null) |
557 | { | 626 | { |
558 | handlerBackup(dstore, false); | 627 | foreach (OnBackupDelegate d in handlerOnAttach.GetInvocationList()) |
559 | } | 628 | { |
629 | try | ||
630 | { | ||
631 | d(dstore, false); | ||
632 | } | ||
633 | catch (Exception e) | ||
634 | { | ||
635 | m_log.ErrorFormat( | ||
636 | "[EVENT MANAGER]: Delegate for TriggerOnBackup failed - continuing. {0} {1}", | ||
637 | e.Message, e.StackTrace); | ||
638 | } | ||
639 | } | ||
640 | } | ||
560 | } | 641 | } |
561 | 642 | ||
562 | public void TriggerParcelPrimCountUpdate() | 643 | public void TriggerParcelPrimCountUpdate() |
563 | { | 644 | { |
564 | handlerParcelPrimCountUpdate = OnParcelPrimCountUpdate; | 645 | OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = OnParcelPrimCountUpdate; |
565 | if (handlerParcelPrimCountUpdate != null) | 646 | if (handlerParcelPrimCountUpdate != null) |
566 | { | 647 | { |
567 | handlerParcelPrimCountUpdate(); | 648 | foreach (OnParcelPrimCountUpdateDelegate d in handlerParcelPrimCountUpdate.GetInvocationList()) |
568 | } | 649 | { |
569 | } | 650 | try |
570 | 651 | { | |
571 | public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs e) | 652 | d(); |
572 | { | 653 | } |
573 | handlerMoneyTransfer = OnMoneyTransfer; | 654 | catch (Exception e) |
655 | { | ||
656 | m_log.ErrorFormat( | ||
657 | "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountUpdate failed - continuing. {0} {1}", | ||
658 | e.Message, e.StackTrace); | ||
659 | } | ||
660 | } | ||
661 | } | ||
662 | } | ||
663 | |||
664 | public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs args) | ||
665 | { | ||
666 | MoneyTransferEvent handlerMoneyTransfer = OnMoneyTransfer; | ||
574 | if (handlerMoneyTransfer != null) | 667 | if (handlerMoneyTransfer != null) |
575 | { | 668 | { |
576 | handlerMoneyTransfer(sender, e); | 669 | foreach (MoneyTransferEvent d in handlerMoneyTransfer.GetInvocationList()) |
577 | } | 670 | { |
671 | try | ||
672 | { | ||
673 | d(sender, args); | ||
674 | } | ||
675 | catch (Exception e) | ||
676 | { | ||
677 | m_log.ErrorFormat( | ||
678 | "[EVENT MANAGER]: Delegate for TriggerMoneyTransfer failed - continuing. {0} {1}", | ||
679 | e.Message, e.StackTrace); | ||
680 | } | ||
681 | } | ||
682 | } | ||
578 | } | 683 | } |
579 | 684 | ||
580 | public void TriggerTerrainTick() | 685 | public void TriggerTerrainTick() |
581 | { | 686 | { |
582 | handlerTerrainTick = OnTerrainTick; | 687 | OnTerrainTickDelegate handlerTerrainTick = OnTerrainTick; |
583 | if (handlerTerrainTick != null) | 688 | if (handlerTerrainTick != null) |
584 | { | 689 | { |
585 | handlerTerrainTick(); | 690 | foreach (OnTerrainTickDelegate d in handlerTerrainTick.GetInvocationList()) |
586 | } | 691 | { |
692 | try | ||
693 | { | ||
694 | d(); | ||
695 | } | ||
696 | catch (Exception e) | ||
697 | { | ||
698 | m_log.ErrorFormat( | ||
699 | "[EVENT MANAGER]: Delegate for TriggerTerrainTick failed - continuing. {0} {1}", | ||
700 | e.Message, e.StackTrace); | ||
701 | } | ||
702 | } | ||
703 | } | ||
587 | } | 704 | } |
588 | 705 | ||
589 | public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) | 706 | public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) |
590 | { | 707 | { |
591 | handlerParcelPrimCountAdd = OnParcelPrimCountAdd; | 708 | OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = OnParcelPrimCountAdd; |
592 | if (handlerParcelPrimCountAdd != null) | 709 | if (handlerParcelPrimCountAdd != null) |
593 | { | 710 | { |
594 | handlerParcelPrimCountAdd(obj); | 711 | foreach (OnParcelPrimCountAddDelegate d in handlerParcelPrimCountAdd.GetInvocationList()) |
595 | } | 712 | { |
713 | try | ||
714 | { | ||
715 | d(obj); | ||
716 | } | ||
717 | catch (Exception e) | ||
718 | { | ||
719 | m_log.ErrorFormat( | ||
720 | "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountAdd failed - continuing. {0} {1}", | ||
721 | e.Message, e.StackTrace); | ||
722 | } | ||
723 | } | ||
724 | } | ||
596 | } | 725 | } |
597 | 726 | ||
598 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) | 727 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) |
599 | { | 728 | { |
600 | handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; | 729 | ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; |
601 | if (handlerObjectBeingRemovedFromScene != null) | 730 | if (handlerObjectBeingRemovedFromScene != null) |
602 | { | 731 | { |
603 | handlerObjectBeingRemovedFromScene(obj); | 732 | foreach (ObjectBeingRemovedFromScene d in handlerObjectBeingRemovedFromScene.GetInvocationList()) |
604 | } | 733 | { |
734 | try | ||
735 | { | ||
736 | d(obj); | ||
737 | } | ||
738 | catch (Exception e) | ||
739 | { | ||
740 | m_log.ErrorFormat( | ||
741 | "[EVENT MANAGER]: Delegate for TriggerObjectBeingRemovedFromScene failed - continuing. {0} {1}", | ||
742 | e.Message, e.StackTrace); | ||
743 | } | ||
744 | } | ||
745 | } | ||
605 | } | 746 | } |
606 | 747 | ||
607 | public void TriggerShutdown() | 748 | public void TriggerShutdown() |
608 | { | 749 | { |
609 | handlerShutdown = OnShutdown; | 750 | OnShutdownDelegate handlerShutdown = OnShutdown; |
610 | if (handlerShutdown != null) | 751 | if (handlerShutdown != null) |
611 | handlerShutdown(); | 752 | { |
753 | foreach (OnShutdownDelegate d in handlerShutdown.GetInvocationList()) | ||
754 | { | ||
755 | try | ||
756 | { | ||
757 | d(); | ||
758 | } | ||
759 | catch (Exception e) | ||
760 | { | ||
761 | m_log.ErrorFormat( | ||
762 | "[EVENT MANAGER]: Delegate for TriggerShutdown failed - continuing. {0} {1}", | ||
763 | e.Message, e.StackTrace); | ||
764 | } | ||
765 | } | ||
766 | } | ||
612 | } | 767 | } |
613 | 768 | ||
614 | public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) | 769 | public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) |
615 | { | 770 | { |
616 | handlerObjectGrab = OnObjectGrab; | 771 | ObjectGrabDelegate handlerObjectGrab = OnObjectGrab; |
617 | if (handlerObjectGrab != null) | 772 | if (handlerObjectGrab != null) |
618 | { | 773 | { |
619 | handlerObjectGrab(localID, originalID, offsetPos, remoteClient, surfaceArgs); | 774 | foreach (ObjectGrabDelegate d in handlerObjectGrab.GetInvocationList()) |
620 | } | 775 | { |
621 | } | 776 | try |
777 | { | ||
778 | d(localID, originalID, offsetPos, remoteClient, surfaceArgs); | ||
779 | } | ||
780 | catch (Exception e) | ||
781 | { | ||
782 | m_log.ErrorFormat( | ||
783 | "[EVENT MANAGER]: Delegate for TriggerObjectGrab failed - continuing. {0} {1}", | ||
784 | e.Message, e.StackTrace); | ||
785 | } | ||
786 | } | ||
787 | } | ||
788 | } | ||
789 | |||
790 | public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) | ||
791 | { | ||
792 | ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing; | ||
793 | if (handlerObjectGrabbing != null) | ||
794 | { | ||
795 | foreach (ObjectGrabDelegate d in handlerObjectGrabbing.GetInvocationList()) | ||
796 | { | ||
797 | try | ||
798 | { | ||
799 | d(localID, originalID, offsetPos, remoteClient, surfaceArgs); | ||
800 | } | ||
801 | catch (Exception e) | ||
802 | { | ||
803 | m_log.ErrorFormat( | ||
804 | "[EVENT MANAGER]: Delegate for TriggerObjectGrabbing failed - continuing. {0} {1}", | ||
805 | e.Message, e.StackTrace); | ||
806 | } | ||
807 | } | ||
808 | } | ||
809 | } | ||
622 | 810 | ||
623 | public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) | 811 | public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) |
624 | { | 812 | { |
625 | handlerObjectDeGrab = OnObjectDeGrab; | 813 | ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab; |
626 | if (handlerObjectDeGrab != null) | 814 | if (handlerObjectDeGrab != null) |
627 | { | 815 | { |
628 | handlerObjectDeGrab(localID, originalID, remoteClient, surfaceArgs); | 816 | foreach (ObjectDeGrabDelegate d in handlerObjectDeGrab.GetInvocationList()) |
629 | } | 817 | { |
818 | try | ||
819 | { | ||
820 | d(localID, originalID, remoteClient, surfaceArgs); | ||
821 | } | ||
822 | catch (Exception e) | ||
823 | { | ||
824 | m_log.ErrorFormat( | ||
825 | "[EVENT MANAGER]: Delegate for TriggerObjectDeGrab failed - continuing. {0} {1}", | ||
826 | e.Message, e.StackTrace); | ||
827 | } | ||
828 | } | ||
829 | } | ||
630 | } | 830 | } |
631 | 831 | ||
632 | public void TriggerScriptReset(uint localID, UUID itemID) | 832 | public void TriggerScriptReset(uint localID, UUID itemID) |
633 | { | 833 | { |
634 | handlerScriptReset = OnScriptReset; | 834 | ScriptResetDelegate handlerScriptReset = OnScriptReset; |
635 | if (handlerScriptReset != null) | 835 | if (handlerScriptReset != null) |
636 | { | 836 | { |
637 | handlerScriptReset(localID, itemID); | 837 | foreach (ScriptResetDelegate d in handlerScriptReset.GetInvocationList()) |
638 | } | 838 | { |
839 | try | ||
840 | { | ||
841 | d(localID, itemID); | ||
842 | } | ||
843 | catch (Exception e) | ||
844 | { | ||
845 | m_log.ErrorFormat( | ||
846 | "[EVENT MANAGER]: Delegate for TriggerScriptReset failed - continuing. {0} {1}", | ||
847 | e.Message, e.StackTrace); | ||
848 | } | ||
849 | } | ||
850 | } | ||
639 | } | 851 | } |
640 | 852 | ||
641 | public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) | 853 | public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) |
642 | { | 854 | { |
643 | handlerRezScript = OnRezScript; | 855 | NewRezScript handlerRezScript = OnRezScript; |
644 | if (handlerRezScript != null) | 856 | if (handlerRezScript != null) |
645 | { | 857 | { |
646 | handlerRezScript(localID, itemID, script, startParam, | 858 | foreach (NewRezScript d in handlerRezScript.GetInvocationList()) |
647 | postOnRez, engine, stateSource); | 859 | { |
648 | } | 860 | try |
861 | { | ||
862 | d(localID, itemID, script, startParam, postOnRez, engine, stateSource); | ||
863 | } | ||
864 | catch (Exception e) | ||
865 | { | ||
866 | m_log.ErrorFormat( | ||
867 | "[EVENT MANAGER]: Delegate for TriggerRezScript failed - continuing. {0} {1}", | ||
868 | e.Message, e.StackTrace); | ||
869 | } | ||
870 | } | ||
871 | } | ||
649 | } | 872 | } |
650 | 873 | ||
651 | public void TriggerStartScript(uint localID, UUID itemID) | 874 | public void TriggerStartScript(uint localID, UUID itemID) |
652 | { | 875 | { |
653 | handlerStartScript = OnStartScript; | 876 | StartScript handlerStartScript = OnStartScript; |
654 | if (handlerStartScript != null) | 877 | if (handlerStartScript != null) |
655 | { | 878 | { |
656 | handlerStartScript(localID, itemID); | 879 | foreach (StartScript d in handlerStartScript.GetInvocationList()) |
657 | } | 880 | { |
881 | try | ||
882 | { | ||
883 | d(localID, itemID); | ||
884 | } | ||
885 | catch (Exception e) | ||
886 | { | ||
887 | m_log.ErrorFormat( | ||
888 | "[EVENT MANAGER]: Delegate for TriggerStartScript failed - continuing. {0} {1}", | ||
889 | e.Message, e.StackTrace); | ||
890 | } | ||
891 | } | ||
892 | } | ||
658 | } | 893 | } |
659 | 894 | ||
660 | public void TriggerStopScript(uint localID, UUID itemID) | 895 | public void TriggerStopScript(uint localID, UUID itemID) |
661 | { | 896 | { |
662 | handlerStopScript = OnStopScript; | 897 | StopScript handlerStopScript = OnStopScript; |
663 | if (handlerStopScript != null) | 898 | if (handlerStopScript != null) |
664 | { | 899 | { |
665 | handlerStopScript(localID, itemID); | 900 | foreach (StopScript d in handlerStopScript.GetInvocationList()) |
666 | } | 901 | { |
902 | try | ||
903 | { | ||
904 | d(localID, itemID); | ||
905 | } | ||
906 | catch (Exception e) | ||
907 | { | ||
908 | m_log.ErrorFormat( | ||
909 | "[EVENT MANAGER]: Delegate for TriggerStopScript failed - continuing. {0} {1}", | ||
910 | e.Message, e.StackTrace); | ||
911 | } | ||
912 | } | ||
913 | } | ||
667 | } | 914 | } |
668 | 915 | ||
669 | public void TriggerRemoveScript(uint localID, UUID itemID) | 916 | public void TriggerRemoveScript(uint localID, UUID itemID) |
670 | { | 917 | { |
671 | handlerRemoveScript = OnRemoveScript; | 918 | RemoveScript handlerRemoveScript = OnRemoveScript; |
672 | if (handlerRemoveScript != null) | 919 | if (handlerRemoveScript != null) |
673 | { | 920 | { |
674 | handlerRemoveScript(localID, itemID); | 921 | foreach (RemoveScript d in handlerRemoveScript.GetInvocationList()) |
675 | } | 922 | { |
923 | try | ||
924 | { | ||
925 | d(localID, itemID); | ||
926 | } | ||
927 | catch (Exception e) | ||
928 | { | ||
929 | m_log.ErrorFormat( | ||
930 | "[EVENT MANAGER]: Delegate for TriggerRemoveScript failed - continuing. {0} {1}", | ||
931 | e.Message, e.StackTrace); | ||
932 | } | ||
933 | } | ||
934 | } | ||
676 | } | 935 | } |
677 | 936 | ||
678 | public bool TriggerGroupMove(UUID groupID, Vector3 delta) | 937 | public bool TriggerGroupMove(UUID groupID, Vector3 delta) |
679 | { | 938 | { |
680 | handlerSceneGroupMove = OnSceneGroupMove; | 939 | bool result = true; |
681 | 940 | ||
941 | SceneGroupMoved handlerSceneGroupMove = OnSceneGroupMove; | ||
682 | if (handlerSceneGroupMove != null) | 942 | if (handlerSceneGroupMove != null) |
683 | { | 943 | { |
684 | return handlerSceneGroupMove(groupID, delta); | 944 | foreach (SceneGroupMoved d in handlerSceneGroupMove.GetInvocationList()) |
945 | { | ||
946 | try | ||
947 | { | ||
948 | if (d(groupID, delta) == false) | ||
949 | result = false; | ||
950 | } | ||
951 | catch (Exception e) | ||
952 | { | ||
953 | m_log.ErrorFormat( | ||
954 | "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", | ||
955 | e.Message, e.StackTrace); | ||
956 | } | ||
957 | } | ||
685 | } | 958 | } |
686 | return true; | 959 | |
960 | return result; | ||
687 | } | 961 | } |
688 | 962 | ||
689 | public bool TriggerGroupSpinStart(UUID groupID) | 963 | public bool TriggerGroupSpinStart(UUID groupID) |
690 | { | 964 | { |
691 | handlerSceneGroupSpinStarted = OnSceneGroupSpinStart; | 965 | bool result = true; |
692 | 966 | ||
967 | SceneGroupSpinStarted handlerSceneGroupSpinStarted = OnSceneGroupSpinStart; | ||
693 | if (handlerSceneGroupSpinStarted != null) | 968 | if (handlerSceneGroupSpinStarted != null) |
694 | { | 969 | { |
695 | return handlerSceneGroupSpinStarted(groupID); | 970 | foreach (SceneGroupSpinStarted d in handlerSceneGroupSpinStarted.GetInvocationList()) |
971 | { | ||
972 | try | ||
973 | { | ||
974 | if (d(groupID) == false) | ||
975 | result = false; | ||
976 | } | ||
977 | catch (Exception e) | ||
978 | { | ||
979 | m_log.ErrorFormat( | ||
980 | "[EVENT MANAGER]: Delegate for TriggerGroupSpinStart failed - continuing. {0} {1}", | ||
981 | e.Message, e.StackTrace); | ||
982 | } | ||
983 | } | ||
696 | } | 984 | } |
697 | return true; | 985 | |
986 | return result; | ||
698 | } | 987 | } |
699 | 988 | ||
700 | public bool TriggerGroupSpin(UUID groupID, Quaternion rotation) | 989 | public bool TriggerGroupSpin(UUID groupID, Quaternion rotation) |
701 | { | 990 | { |
702 | handlerSceneGroupSpin = OnSceneGroupSpin; | 991 | bool result = true; |
703 | 992 | ||
993 | SceneGroupSpun handlerSceneGroupSpin = OnSceneGroupSpin; | ||
704 | if (handlerSceneGroupSpin != null) | 994 | if (handlerSceneGroupSpin != null) |
705 | { | 995 | { |
706 | return handlerSceneGroupSpin(groupID, rotation); | 996 | foreach (SceneGroupSpun d in handlerSceneGroupSpin.GetInvocationList()) |
997 | { | ||
998 | try | ||
999 | { | ||
1000 | if (d(groupID, rotation) == false) | ||
1001 | result = false; | ||
1002 | } | ||
1003 | catch (Exception e) | ||
1004 | { | ||
1005 | m_log.ErrorFormat( | ||
1006 | "[EVENT MANAGER]: Delegate for TriggerGroupSpin failed - continuing. {0} {1}", | ||
1007 | e.Message, e.StackTrace); | ||
1008 | } | ||
1009 | } | ||
707 | } | 1010 | } |
708 | return true; | 1011 | |
1012 | return result; | ||
709 | } | 1013 | } |
710 | 1014 | ||
711 | public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID) | 1015 | public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID) |
712 | { | 1016 | { |
713 | handlerSceneGroupGrab = OnSceneGroupGrab; | 1017 | SceneGroupGrabed handlerSceneGroupGrab = OnSceneGroupGrab; |
714 | if (handlerSceneGroupGrab != null) | 1018 | if (handlerSceneGroupGrab != null) |
715 | { | 1019 | { |
716 | handlerSceneGroupGrab(groupID, offset, userID); | 1020 | foreach (SceneGroupGrabed d in handlerSceneGroupGrab.GetInvocationList()) |
717 | } | 1021 | { |
1022 | try | ||
1023 | { | ||
1024 | d(groupID, offset, userID); | ||
1025 | } | ||
1026 | catch (Exception e) | ||
1027 | { | ||
1028 | m_log.ErrorFormat( | ||
1029 | "[EVENT MANAGER]: Delegate for TriggerGroupGrab failed - continuing. {0} {1}", | ||
1030 | e.Message, e.StackTrace); | ||
1031 | } | ||
1032 | } | ||
1033 | } | ||
718 | } | 1034 | } |
719 | 1035 | ||
720 | public void TriggerLandObjectAdded(ILandObject newParcel) | 1036 | public void TriggerLandObjectAdded(ILandObject newParcel) |
721 | { | 1037 | { |
722 | handlerLandObjectAdded = OnLandObjectAdded; | 1038 | LandObjectAdded handlerLandObjectAdded = OnLandObjectAdded; |
723 | |||
724 | if (handlerLandObjectAdded != null) | 1039 | if (handlerLandObjectAdded != null) |
725 | { | 1040 | { |
726 | handlerLandObjectAdded(newParcel); | 1041 | foreach (LandObjectAdded d in handlerLandObjectAdded.GetInvocationList()) |
727 | } | 1042 | { |
1043 | try | ||
1044 | { | ||
1045 | d(newParcel); | ||
1046 | } | ||
1047 | catch (Exception e) | ||
1048 | { | ||
1049 | m_log.ErrorFormat( | ||
1050 | "[EVENT MANAGER]: Delegate for TriggerLandObjectAdded failed - continuing. {0} {1}", | ||
1051 | e.Message, e.StackTrace); | ||
1052 | } | ||
1053 | } | ||
1054 | } | ||
728 | } | 1055 | } |
729 | 1056 | ||
730 | public void TriggerLandObjectRemoved(UUID globalID) | 1057 | public void TriggerLandObjectRemoved(UUID globalID) |
731 | { | 1058 | { |
732 | handlerLandObjectRemoved = OnLandObjectRemoved; | 1059 | LandObjectRemoved handlerLandObjectRemoved = OnLandObjectRemoved; |
733 | if (handlerLandObjectRemoved != null) | 1060 | if (handlerLandObjectRemoved != null) |
734 | { | 1061 | { |
735 | handlerLandObjectRemoved(globalID); | 1062 | foreach (LandObjectRemoved d in handlerLandObjectRemoved.GetInvocationList()) |
736 | } | 1063 | { |
1064 | try | ||
1065 | { | ||
1066 | d(globalID); | ||
1067 | } | ||
1068 | catch (Exception e) | ||
1069 | { | ||
1070 | m_log.ErrorFormat( | ||
1071 | "[EVENT MANAGER]: Delegate for TriggerLandObjectRemoved failed - continuing. {0} {1}", | ||
1072 | e.Message, e.StackTrace); | ||
1073 | } | ||
1074 | } | ||
1075 | } | ||
737 | } | 1076 | } |
738 | 1077 | ||
739 | public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel) | 1078 | public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel) |
740 | { | 1079 | { |
741 | //triggerLandObjectRemoved(localParcelID); | ||
742 | |||
743 | TriggerLandObjectAdded(newParcel); | 1080 | TriggerLandObjectAdded(newParcel); |
744 | } | 1081 | } |
745 | 1082 | ||
746 | public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) | 1083 | public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) |
747 | { | 1084 | { |
748 | handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel; | 1085 | AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel; |
749 | |||
750 | if (handlerAvatarEnteringNewParcel != null) | 1086 | if (handlerAvatarEnteringNewParcel != null) |
751 | { | 1087 | { |
752 | handlerAvatarEnteringNewParcel(avatar, localLandID, regionID); | 1088 | foreach (AvatarEnteringNewParcel d in handlerAvatarEnteringNewParcel.GetInvocationList()) |
753 | } | 1089 | { |
1090 | try | ||
1091 | { | ||
1092 | d(avatar, localLandID, regionID); | ||
1093 | } | ||
1094 | catch (Exception e) | ||
1095 | { | ||
1096 | m_log.ErrorFormat( | ||
1097 | "[EVENT MANAGER]: Delegate for TriggerAvatarEnteringNewParcel failed - continuing. {0} {1}", | ||
1098 | e.Message, e.StackTrace); | ||
1099 | } | ||
1100 | } | ||
1101 | } | ||
754 | } | 1102 | } |
755 | 1103 | ||
756 | public void TriggerIncomingInstantMessage(GridInstantMessage message) | 1104 | public void TriggerIncomingInstantMessage(GridInstantMessage message) |
757 | { | 1105 | { |
758 | handlerIncomingInstantMessage = OnIncomingInstantMessage; | 1106 | IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; |
759 | if (handlerIncomingInstantMessage != null) | 1107 | if (handlerIncomingInstantMessage != null) |
760 | { | 1108 | { |
761 | handlerIncomingInstantMessage(message); | 1109 | foreach (IncomingInstantMessage d in handlerIncomingInstantMessage.GetInvocationList()) |
762 | } | 1110 | { |
1111 | try | ||
1112 | { | ||
1113 | d(message); | ||
1114 | } | ||
1115 | catch (Exception e) | ||
1116 | { | ||
1117 | m_log.ErrorFormat( | ||
1118 | "[EVENT MANAGER]: Delegate for TriggerIncomingInstantMessage failed - continuing. {0} {1}", | ||
1119 | e.Message, e.StackTrace); | ||
1120 | } | ||
1121 | } | ||
1122 | } | ||
763 | } | 1123 | } |
764 | 1124 | ||
765 | public void TriggerUnhandledInstantMessage(GridInstantMessage message) | 1125 | public void TriggerUnhandledInstantMessage(GridInstantMessage message) |
766 | { | 1126 | { |
767 | handlerUnhandledInstantMessage = OnUnhandledInstantMessage; | 1127 | IncomingInstantMessage handlerUnhandledInstantMessage = OnUnhandledInstantMessage; |
768 | if (handlerUnhandledInstantMessage != null) | 1128 | if (handlerUnhandledInstantMessage != null) |
769 | { | 1129 | { |
770 | handlerUnhandledInstantMessage(message); | 1130 | foreach (IncomingInstantMessage d in handlerUnhandledInstantMessage.GetInvocationList()) |
771 | } | 1131 | { |
1132 | try | ||
1133 | { | ||
1134 | d(message); | ||
1135 | } | ||
1136 | catch (Exception e) | ||
1137 | { | ||
1138 | m_log.ErrorFormat( | ||
1139 | "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", | ||
1140 | e.Message, e.StackTrace); | ||
1141 | } | ||
1142 | } | ||
1143 | } | ||
772 | } | 1144 | } |
773 | 1145 | ||
774 | public void TriggerClientClosed(UUID ClientID, Scene scene) | 1146 | public void TriggerClientClosed(UUID ClientID, Scene scene) |
775 | { | 1147 | { |
776 | handlerClientClosed = OnClientClosed; | 1148 | ClientClosed handlerClientClosed = OnClientClosed; |
777 | if (handlerClientClosed != null) | 1149 | if (handlerClientClosed != null) |
778 | { | 1150 | { |
779 | handlerClientClosed(ClientID, scene); | 1151 | foreach (ClientClosed d in handlerClientClosed.GetInvocationList()) |
780 | } | 1152 | { |
1153 | try | ||
1154 | { | ||
1155 | d(ClientID, scene); | ||
1156 | } | ||
1157 | catch (Exception e) | ||
1158 | { | ||
1159 | m_log.ErrorFormat( | ||
1160 | "[EVENT MANAGER]: Delegate for TriggerClientClosed failed - continuing. {0} {1}", | ||
1161 | e.Message, e.StackTrace); | ||
1162 | } | ||
1163 | } | ||
1164 | } | ||
781 | } | 1165 | } |
782 | 1166 | ||
783 | public void TriggerOnMakeChildAgent(ScenePresence presence) | 1167 | public void TriggerOnMakeChildAgent(ScenePresence presence) |
784 | { | 1168 | { |
785 | handlerMakeChildAgent = OnMakeChildAgent; | 1169 | OnMakeChildAgentDelegate handlerMakeChildAgent = OnMakeChildAgent; |
786 | if (handlerMakeChildAgent != null) | 1170 | if (handlerMakeChildAgent != null) |
787 | { | 1171 | { |
788 | handlerMakeChildAgent(presence); | 1172 | foreach (OnMakeChildAgentDelegate d in handlerMakeChildAgent.GetInvocationList()) |
789 | } | 1173 | { |
1174 | try | ||
1175 | { | ||
1176 | d(presence); | ||
1177 | } | ||
1178 | catch (Exception e) | ||
1179 | { | ||
1180 | m_log.ErrorFormat( | ||
1181 | "[EVENT MANAGER]: Delegate for TriggerOnMakeChildAgent failed - continuing. {0} {1}", | ||
1182 | e.Message, e.StackTrace); | ||
1183 | } | ||
1184 | } | ||
1185 | } | ||
790 | } | 1186 | } |
791 | 1187 | ||
792 | public void TriggerOnMakeRootAgent(ScenePresence presence) | 1188 | public void TriggerOnMakeRootAgent(ScenePresence presence) |
793 | { | 1189 | { |
794 | handlerMakeRootAgent = OnMakeRootAgent; | 1190 | OnMakeRootAgentDelegate handlerMakeRootAgent = OnMakeRootAgent; |
795 | if (handlerMakeRootAgent != null) | 1191 | if (handlerMakeRootAgent != null) |
796 | { | 1192 | { |
797 | handlerMakeRootAgent(presence); | 1193 | foreach (OnMakeRootAgentDelegate d in handlerMakeRootAgent.GetInvocationList()) |
798 | } | 1194 | { |
1195 | try | ||
1196 | { | ||
1197 | d(presence); | ||
1198 | } | ||
1199 | catch (Exception e) | ||
1200 | { | ||
1201 | m_log.ErrorFormat( | ||
1202 | "[EVENT MANAGER]: Delegate for TriggerOnMakeRootAgent failed - continuing. {0} {1}", | ||
1203 | e.Message, e.StackTrace); | ||
1204 | } | ||
1205 | } | ||
1206 | } | ||
799 | } | 1207 | } |
800 | 1208 | ||
801 | public void TriggerOnRegisterCaps(UUID agentID, Caps caps) | 1209 | public void TriggerOnRegisterCaps(UUID agentID, Caps caps) |
802 | { | 1210 | { |
803 | handlerRegisterCaps = OnRegisterCaps; | 1211 | RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps; |
804 | if (handlerRegisterCaps != null) | 1212 | if (handlerRegisterCaps != null) |
805 | { | 1213 | { |
806 | handlerRegisterCaps(agentID, caps); | 1214 | foreach (RegisterCapsEvent d in handlerRegisterCaps.GetInvocationList()) |
807 | } | 1215 | { |
1216 | try | ||
1217 | { | ||
1218 | d(agentID, caps); | ||
1219 | } | ||
1220 | catch (Exception e) | ||
1221 | { | ||
1222 | m_log.ErrorFormat( | ||
1223 | "[EVENT MANAGER]: Delegate for TriggerOnRegisterCaps failed - continuing. {0} {1}", | ||
1224 | e.Message, e.StackTrace); | ||
1225 | } | ||
1226 | } | ||
1227 | } | ||
808 | } | 1228 | } |
809 | 1229 | ||
810 | public void TriggerOnDeregisterCaps(UUID agentID, Caps caps) | 1230 | public void TriggerOnDeregisterCaps(UUID agentID, Caps caps) |
811 | { | 1231 | { |
812 | handlerDeregisterCaps = OnDeregisterCaps; | 1232 | DeregisterCapsEvent handlerDeregisterCaps = OnDeregisterCaps; |
813 | if (handlerDeregisterCaps != null) | 1233 | if (handlerDeregisterCaps != null) |
814 | { | 1234 | { |
815 | handlerDeregisterCaps(agentID, caps); | 1235 | foreach (DeregisterCapsEvent d in handlerDeregisterCaps.GetInvocationList()) |
816 | } | 1236 | { |
1237 | try | ||
1238 | { | ||
1239 | d(agentID, caps); | ||
1240 | } | ||
1241 | catch (Exception e) | ||
1242 | { | ||
1243 | m_log.ErrorFormat( | ||
1244 | "[EVENT MANAGER]: Delegate for TriggerOnDeregisterCaps failed - continuing. {0} {1}", | ||
1245 | e.Message, e.StackTrace); | ||
1246 | } | ||
1247 | } | ||
1248 | } | ||
817 | } | 1249 | } |
818 | 1250 | ||
819 | public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel) | 1251 | public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel) |
820 | { | 1252 | { |
821 | handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete; | 1253 | NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete; |
822 | if (handlerNewInventoryItemUpdateComplete != null) | 1254 | if (handlerNewInventoryItemUpdateComplete != null) |
823 | { | 1255 | { |
824 | handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel); | 1256 | foreach (NewInventoryItemUploadComplete d in handlerNewInventoryItemUpdateComplete.GetInvocationList()) |
825 | } | 1257 | { |
826 | } | 1258 | try |
827 | 1259 | { | |
828 | public void TriggerLandBuy(Object sender, LandBuyArgs e) | 1260 | d(agentID, AssetID, AssetName, userlevel); |
829 | { | 1261 | } |
830 | handlerLandBuy = OnLandBuy; | 1262 | catch (Exception e) |
1263 | { | ||
1264 | m_log.ErrorFormat( | ||
1265 | "[EVENT MANAGER]: Delegate for TriggerOnNewInventoryItemUploadComplete failed - continuing. {0} {1}", | ||
1266 | e.Message, e.StackTrace); | ||
1267 | } | ||
1268 | } | ||
1269 | } | ||
1270 | } | ||
1271 | |||
1272 | public void TriggerLandBuy(Object sender, LandBuyArgs args) | ||
1273 | { | ||
1274 | LandBuy handlerLandBuy = OnLandBuy; | ||
831 | if (handlerLandBuy != null) | 1275 | if (handlerLandBuy != null) |
832 | { | 1276 | { |
833 | handlerLandBuy(sender, e); | 1277 | foreach (LandBuy d in handlerLandBuy.GetInvocationList()) |
834 | } | 1278 | { |
835 | } | 1279 | try |
836 | 1280 | { | |
837 | public void TriggerValidateLandBuy(Object sender, LandBuyArgs e) | 1281 | d(sender, args); |
838 | { | 1282 | } |
839 | handlerValidateLandBuy = OnValidateLandBuy; | 1283 | catch (Exception e) |
1284 | { | ||
1285 | m_log.ErrorFormat( | ||
1286 | "[EVENT MANAGER]: Delegate for TriggerLandBuy failed - continuing. {0} {1}", | ||
1287 | e.Message, e.StackTrace); | ||
1288 | } | ||
1289 | } | ||
1290 | } | ||
1291 | } | ||
1292 | |||
1293 | public void TriggerValidateLandBuy(Object sender, LandBuyArgs args) | ||
1294 | { | ||
1295 | LandBuy handlerValidateLandBuy = OnValidateLandBuy; | ||
840 | if (handlerValidateLandBuy != null) | 1296 | if (handlerValidateLandBuy != null) |
841 | { | 1297 | { |
842 | handlerValidateLandBuy(sender, e); | 1298 | foreach (LandBuy d in handlerValidateLandBuy.GetInvocationList()) |
843 | } | 1299 | { |
1300 | try | ||
1301 | { | ||
1302 | d(sender, args); | ||
1303 | } | ||
1304 | catch (Exception e) | ||
1305 | { | ||
1306 | m_log.ErrorFormat( | ||
1307 | "[EVENT MANAGER]: Delegate for TriggerValidateLandBuy failed - continuing. {0} {1}", | ||
1308 | e.Message, e.StackTrace); | ||
1309 | } | ||
1310 | } | ||
1311 | } | ||
844 | } | 1312 | } |
845 | 1313 | ||
846 | public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos) | 1314 | public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos) |
847 | { | 1315 | { |
848 | handlerScriptAtTargetEvent = OnScriptAtTargetEvent; | 1316 | ScriptAtTargetEvent handlerScriptAtTargetEvent = OnScriptAtTargetEvent; |
849 | if (handlerScriptAtTargetEvent != null) | 1317 | if (handlerScriptAtTargetEvent != null) |
850 | { | 1318 | { |
851 | handlerScriptAtTargetEvent(localID, handle, targetpos, currentpos); | 1319 | foreach (ScriptAtTargetEvent d in handlerScriptAtTargetEvent.GetInvocationList()) |
852 | } | 1320 | { |
1321 | try | ||
1322 | { | ||
1323 | d(localID, handle, targetpos, currentpos); | ||
1324 | } | ||
1325 | catch (Exception e) | ||
1326 | { | ||
1327 | m_log.ErrorFormat( | ||
1328 | "[EVENT MANAGER]: Delegate for TriggerAtTargetEvent failed - continuing. {0} {1}", | ||
1329 | e.Message, e.StackTrace); | ||
1330 | } | ||
1331 | } | ||
1332 | } | ||
853 | } | 1333 | } |
854 | 1334 | ||
855 | public void TriggerNotAtTargetEvent(uint localID) | 1335 | public void TriggerNotAtTargetEvent(uint localID) |
856 | { | 1336 | { |
857 | handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent; | 1337 | ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent; |
858 | if (handlerScriptNotAtTargetEvent != null) | 1338 | if (handlerScriptNotAtTargetEvent != null) |
859 | { | 1339 | { |
860 | handlerScriptNotAtTargetEvent(localID); | 1340 | foreach (ScriptNotAtTargetEvent d in handlerScriptNotAtTargetEvent.GetInvocationList()) |
861 | } | 1341 | { |
1342 | try | ||
1343 | { | ||
1344 | d(localID); | ||
1345 | } | ||
1346 | catch (Exception e) | ||
1347 | { | ||
1348 | m_log.ErrorFormat( | ||
1349 | "[EVENT MANAGER]: Delegate for TriggerNotAtTargetEvent failed - continuing. {0} {1}", | ||
1350 | e.Message, e.StackTrace); | ||
1351 | } | ||
1352 | } | ||
1353 | } | ||
862 | } | 1354 | } |
863 | 1355 | ||
864 | public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) | 1356 | public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) |
865 | { | 1357 | { |
866 | handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; | 1358 | ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; |
867 | if (handlerScriptAtRotTargetEvent != null) | 1359 | if (handlerScriptAtRotTargetEvent != null) |
868 | { | 1360 | { |
869 | handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot); | 1361 | foreach (ScriptAtRotTargetEvent d in handlerScriptAtRotTargetEvent.GetInvocationList()) |
870 | } | 1362 | { |
1363 | try | ||
1364 | { | ||
1365 | d(localID, handle, targetrot, currentrot); | ||
1366 | } | ||
1367 | catch (Exception e) | ||
1368 | { | ||
1369 | m_log.ErrorFormat( | ||
1370 | "[EVENT MANAGER]: Delegate for TriggerAtRotTargetEvent failed - continuing. {0} {1}", | ||
1371 | e.Message, e.StackTrace); | ||
1372 | } | ||
1373 | } | ||
1374 | } | ||
871 | } | 1375 | } |
872 | 1376 | ||
873 | public void TriggerNotAtRotTargetEvent(uint localID) | 1377 | public void TriggerNotAtRotTargetEvent(uint localID) |
874 | { | 1378 | { |
875 | handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; | 1379 | ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; |
876 | if (handlerScriptNotAtRotTargetEvent != null) | 1380 | if (handlerScriptNotAtRotTargetEvent != null) |
877 | { | 1381 | { |
878 | handlerScriptNotAtRotTargetEvent(localID); | 1382 | foreach (ScriptNotAtRotTargetEvent d in handlerScriptNotAtRotTargetEvent.GetInvocationList()) |
879 | } | 1383 | { |
1384 | try | ||
1385 | { | ||
1386 | d(localID); | ||
1387 | } | ||
1388 | catch (Exception e) | ||
1389 | { | ||
1390 | m_log.ErrorFormat( | ||
1391 | "[EVENT MANAGER]: Delegate for TriggerNotAtRotTargetEvent failed - continuing. {0} {1}", | ||
1392 | e.Message, e.StackTrace); | ||
1393 | } | ||
1394 | } | ||
1395 | } | ||
880 | } | 1396 | } |
881 | 1397 | ||
882 | public void TriggerRequestChangeWaterHeight(float height) | 1398 | public void TriggerRequestChangeWaterHeight(float height) |
883 | { | 1399 | { |
884 | handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight; | 1400 | RequestChangeWaterHeight handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight; |
885 | if (handlerRequestChangeWaterHeight != null) | 1401 | if (handlerRequestChangeWaterHeight != null) |
886 | { | 1402 | { |
887 | handlerRequestChangeWaterHeight(height); | 1403 | foreach (RequestChangeWaterHeight d in handlerRequestChangeWaterHeight.GetInvocationList()) |
888 | } | 1404 | { |
1405 | try | ||
1406 | { | ||
1407 | d(height); | ||
1408 | } | ||
1409 | catch (Exception e) | ||
1410 | { | ||
1411 | m_log.ErrorFormat( | ||
1412 | "[EVENT MANAGER]: Delegate for TriggerRequestChangeWaterHeight failed - continuing. {0} {1}", | ||
1413 | e.Message, e.StackTrace); | ||
1414 | } | ||
1415 | } | ||
1416 | } | ||
889 | } | 1417 | } |
890 | 1418 | ||
891 | public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar) | 1419 | public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar) |
892 | { | 1420 | { |
893 | handlerAvatarKill = OnAvatarKilled; | 1421 | AvatarKillData handlerAvatarKill = OnAvatarKilled; |
894 | if (handlerAvatarKill != null) | 1422 | if (handlerAvatarKill != null) |
895 | { | 1423 | { |
896 | handlerAvatarKill(KillerObjectLocalID, DeadAvatar); | 1424 | foreach (AvatarKillData d in handlerAvatarKill.GetInvocationList()) |
897 | } | 1425 | { |
1426 | try | ||
1427 | { | ||
1428 | d(KillerObjectLocalID, DeadAvatar); | ||
1429 | } | ||
1430 | catch (Exception e) | ||
1431 | { | ||
1432 | m_log.ErrorFormat( | ||
1433 | "[EVENT MANAGER]: Delegate for TriggerAvatarKill failed - continuing. {0} {1}", | ||
1434 | e.Message, e.StackTrace); | ||
1435 | } | ||
1436 | } | ||
1437 | } | ||
898 | } | 1438 | } |
899 | 1439 | ||
900 | public void TriggerSignificantClientMovement(IClientAPI client) | 1440 | public void TriggerSignificantClientMovement(IClientAPI client) |
901 | { | 1441 | { |
902 | handlerSignificantClientMovement = OnSignificantClientMovement; | 1442 | SignificantClientMovement handlerSignificantClientMovement = OnSignificantClientMovement; |
903 | if (handlerSignificantClientMovement != null) | 1443 | if (handlerSignificantClientMovement != null) |
904 | { | 1444 | { |
905 | handlerSignificantClientMovement(client); | 1445 | foreach (SignificantClientMovement d in handlerSignificantClientMovement.GetInvocationList()) |
906 | } | 1446 | { |
1447 | try | ||
1448 | { | ||
1449 | d(client); | ||
1450 | } | ||
1451 | catch (Exception e) | ||
1452 | { | ||
1453 | m_log.ErrorFormat( | ||
1454 | "[EVENT MANAGER]: Delegate for TriggerSignificantClientMovement failed - continuing. {0} {1}", | ||
1455 | e.Message, e.StackTrace); | ||
1456 | } | ||
1457 | } | ||
1458 | } | ||
907 | } | 1459 | } |
908 | 1460 | ||
909 | public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat) | 1461 | public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat) |
910 | { | 1462 | { |
911 | handlerChatFromWorld = OnChatFromWorld; | 1463 | ChatFromWorldEvent handlerChatFromWorld = OnChatFromWorld; |
912 | if (handlerChatFromWorld != null) | 1464 | if (handlerChatFromWorld != null) |
913 | { | 1465 | { |
914 | handlerChatFromWorld(sender, chat); | 1466 | foreach (ChatFromWorldEvent d in handlerChatFromWorld.GetInvocationList()) |
915 | } | 1467 | { |
1468 | try | ||
1469 | { | ||
1470 | d(sender, chat); | ||
1471 | } | ||
1472 | catch (Exception e) | ||
1473 | { | ||
1474 | m_log.ErrorFormat( | ||
1475 | "[EVENT MANAGER]: Delegate for TriggerOnChatFromWorld failed - continuing. {0} {1}", | ||
1476 | e.Message, e.StackTrace); | ||
1477 | } | ||
1478 | } | ||
1479 | } | ||
916 | } | 1480 | } |
917 | 1481 | ||
918 | public void TriggerOnChatFromClient(Object sender, OSChatMessage chat) | 1482 | public void TriggerOnChatFromClient(Object sender, OSChatMessage chat) |
919 | { | 1483 | { |
920 | handlerChatFromClient = OnChatFromClient; | 1484 | ChatFromClientEvent handlerChatFromClient = OnChatFromClient; |
921 | if (handlerChatFromClient != null) | 1485 | if (handlerChatFromClient != null) |
922 | { | 1486 | { |
923 | handlerChatFromClient(sender, chat); | 1487 | foreach (ChatFromClientEvent d in handlerChatFromClient.GetInvocationList()) |
924 | } | 1488 | { |
1489 | try | ||
1490 | { | ||
1491 | d(sender, chat); | ||
1492 | } | ||
1493 | catch (Exception e) | ||
1494 | { | ||
1495 | m_log.ErrorFormat( | ||
1496 | "[EVENT MANAGER]: Delegate for TriggerOnChatFromClient failed - continuing. {0} {1}", | ||
1497 | e.Message, e.StackTrace); | ||
1498 | } | ||
1499 | } | ||
1500 | } | ||
925 | } | 1501 | } |
926 | 1502 | ||
927 | public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) | 1503 | public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) |
928 | { | 1504 | { |
929 | handlerChatBroadcast = OnChatBroadcast; | 1505 | ChatBroadcastEvent handlerChatBroadcast = OnChatBroadcast; |
930 | if (handlerChatBroadcast != null) | 1506 | if (handlerChatBroadcast != null) |
931 | { | 1507 | { |
932 | handlerChatBroadcast(sender, chat); | 1508 | foreach (ChatBroadcastEvent d in handlerChatBroadcast.GetInvocationList()) |
933 | } | 1509 | { |
1510 | try | ||
1511 | { | ||
1512 | d(sender, chat); | ||
1513 | } | ||
1514 | catch (Exception e) | ||
1515 | { | ||
1516 | m_log.ErrorFormat( | ||
1517 | "[EVENT MANAGER]: Delegate for TriggerOnChatBroadcast failed - continuing. {0} {1}", | ||
1518 | e.Message, e.StackTrace); | ||
1519 | } | ||
1520 | } | ||
1521 | } | ||
934 | } | 1522 | } |
935 | 1523 | ||
936 | internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed) | 1524 | internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed) |
937 | { | 1525 | { |
938 | handlerScriptControlEvent = OnScriptControlEvent; | 1526 | ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent; |
939 | if (handlerScriptControlEvent != null) | 1527 | if (handlerScriptControlEvent != null) |
940 | { | 1528 | { |
941 | handlerScriptControlEvent(p, scriptUUID, avatarID, held, _changed); | 1529 | foreach (ScriptControlEvent d in handlerScriptControlEvent.GetInvocationList()) |
942 | } | 1530 | { |
1531 | try | ||
1532 | { | ||
1533 | d(p, scriptUUID, avatarID, held, _changed); | ||
1534 | } | ||
1535 | catch (Exception e) | ||
1536 | { | ||
1537 | m_log.ErrorFormat( | ||
1538 | "[EVENT MANAGER]: Delegate for TriggerControlEvent failed - continuing. {0} {1}", | ||
1539 | e.Message, e.StackTrace); | ||
1540 | } | ||
1541 | } | ||
1542 | } | ||
943 | } | 1543 | } |
944 | 1544 | ||
945 | public void TriggerNoticeNoLandDataFromStorage() | 1545 | public void TriggerNoticeNoLandDataFromStorage() |
946 | { | 1546 | { |
947 | handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage; | 1547 | NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage; |
948 | if (handlerNoticeNoLandDataFromStorage != null) | 1548 | if (handlerNoticeNoLandDataFromStorage != null) |
949 | { | 1549 | { |
950 | handlerNoticeNoLandDataFromStorage(); | 1550 | foreach (NoticeNoLandDataFromStorage d in handlerNoticeNoLandDataFromStorage.GetInvocationList()) |
951 | 1551 | { | |
952 | } | 1552 | try |
1553 | { | ||
1554 | d(); | ||
1555 | } | ||
1556 | catch (Exception e) | ||
1557 | { | ||
1558 | m_log.ErrorFormat( | ||
1559 | "[EVENT MANAGER]: Delegate for TriggerNoticeNoLandDataFromStorage failed - continuing. {0} {1}", | ||
1560 | e.Message, e.StackTrace); | ||
1561 | } | ||
1562 | } | ||
1563 | } | ||
953 | } | 1564 | } |
954 | 1565 | ||
955 | public void TriggerIncomingLandDataFromStorage(List<LandData> landData) | 1566 | public void TriggerIncomingLandDataFromStorage(List<LandData> landData) |
956 | { | 1567 | { |
957 | handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage; | 1568 | IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage; |
958 | if (handlerIncomingLandDataFromStorage != null) | 1569 | if (handlerIncomingLandDataFromStorage != null) |
959 | { | 1570 | { |
960 | handlerIncomingLandDataFromStorage(landData); | 1571 | foreach (IncomingLandDataFromStorage d in handlerIncomingLandDataFromStorage.GetInvocationList()) |
961 | 1572 | { | |
962 | } | 1573 | try |
1574 | { | ||
1575 | d(landData); | ||
1576 | } | ||
1577 | catch (Exception e) | ||
1578 | { | ||
1579 | m_log.ErrorFormat( | ||
1580 | "[EVENT MANAGER]: Delegate for TriggerIncomingLandDataFromStorage failed - continuing. {0} {1}", | ||
1581 | e.Message, e.StackTrace); | ||
1582 | } | ||
1583 | } | ||
1584 | } | ||
963 | } | 1585 | } |
964 | 1586 | ||
965 | public void TriggerSetAllowForcefulBan(bool allow) | 1587 | public void TriggerSetAllowForcefulBan(bool allow) |
966 | { | 1588 | { |
967 | handlerSetAllowForcefulBan = OnSetAllowForcefulBan; | 1589 | SetAllowForcefulBan handlerSetAllowForcefulBan = OnSetAllowForcefulBan; |
968 | if (handlerSetAllowForcefulBan != null) | 1590 | if (handlerSetAllowForcefulBan != null) |
969 | { | 1591 | { |
970 | handlerSetAllowForcefulBan(allow); | 1592 | foreach (SetAllowForcefulBan d in handlerSetAllowForcefulBan.GetInvocationList()) |
971 | 1593 | { | |
972 | } | 1594 | try |
1595 | { | ||
1596 | d(allow); | ||
1597 | } | ||
1598 | catch (Exception e) | ||
1599 | { | ||
1600 | m_log.ErrorFormat( | ||
1601 | "[EVENT MANAGER]: Delegate for TriggerSetAllowForcefulBan failed - continuing. {0} {1}", | ||
1602 | e.Message, e.StackTrace); | ||
1603 | } | ||
1604 | } | ||
1605 | } | ||
973 | } | 1606 | } |
974 | 1607 | ||
975 | public void TriggerRequestParcelPrimCountUpdate() | 1608 | public void TriggerRequestParcelPrimCountUpdate() |
976 | { | 1609 | { |
977 | handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate; | 1610 | RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate; |
978 | if (handlerRequestParcelPrimCountUpdate != null) | 1611 | if (handlerRequestParcelPrimCountUpdate != null) |
979 | { | 1612 | { |
980 | handlerRequestParcelPrimCountUpdate(); | 1613 | foreach (RequestParcelPrimCountUpdate d in handlerRequestParcelPrimCountUpdate.GetInvocationList()) |
981 | } | 1614 | { |
1615 | try | ||
1616 | { | ||
1617 | d(); | ||
1618 | } | ||
1619 | catch (Exception e) | ||
1620 | { | ||
1621 | m_log.ErrorFormat( | ||
1622 | "[EVENT MANAGER]: Delegate for TriggerRequestParcelPrimCountUpdate failed - continuing. {0} {1}", | ||
1623 | e.Message, e.StackTrace); | ||
1624 | } | ||
1625 | } | ||
1626 | } | ||
982 | } | 1627 | } |
983 | 1628 | ||
984 | public void TriggerParcelPrimCountTainted() | 1629 | public void TriggerParcelPrimCountTainted() |
985 | { | 1630 | { |
986 | handlerParcelPrimCountTainted = OnParcelPrimCountTainted; | 1631 | ParcelPrimCountTainted handlerParcelPrimCountTainted = OnParcelPrimCountTainted; |
987 | if (handlerParcelPrimCountTainted != null) | 1632 | if (handlerParcelPrimCountTainted != null) |
988 | { | 1633 | { |
989 | handlerParcelPrimCountTainted(); | 1634 | foreach (ParcelPrimCountTainted d in handlerParcelPrimCountTainted.GetInvocationList()) |
990 | } | 1635 | { |
1636 | try | ||
1637 | { | ||
1638 | d(); | ||
1639 | } | ||
1640 | catch (Exception e) | ||
1641 | { | ||
1642 | m_log.ErrorFormat( | ||
1643 | "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountTainted failed - continuing. {0} {1}", | ||
1644 | e.Message, e.StackTrace); | ||
1645 | } | ||
1646 | } | ||
1647 | } | ||
991 | } | 1648 | } |
992 | 1649 | ||
993 | // this lets us keep track of nasty script events like timer, etc. | 1650 | // this lets us keep track of nasty script events like timer, etc. |
@@ -1010,99 +1667,277 @@ namespace OpenSim.Region.Framework.Scenes | |||
1010 | /// <param name="FixedSunHour">The hour 0.0 <= FixedSunHour <= 24.0 at which the sun is fixed at. Sun Hour 0 is sun-rise, when Day/Night ratio is 1:1</param> | 1667 | /// <param name="FixedSunHour">The hour 0.0 <= FixedSunHour <= 24.0 at which the sun is fixed at. Sun Hour 0 is sun-rise, when Day/Night ratio is 1:1</param> |
1011 | public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour) | 1668 | public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour) |
1012 | { | 1669 | { |
1013 | handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; | 1670 | EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; |
1014 | if (handlerEstateToolsSunUpdate != null) | 1671 | if (handlerEstateToolsSunUpdate != null) |
1015 | { | 1672 | { |
1016 | handlerEstateToolsSunUpdate(regionHandle, FixedTime, useEstateTime, FixedSunHour); | 1673 | foreach (EstateToolsSunUpdate d in handlerEstateToolsSunUpdate.GetInvocationList()) |
1017 | } | 1674 | { |
1675 | try | ||
1676 | { | ||
1677 | d(regionHandle, FixedTime, useEstateTime, FixedSunHour); | ||
1678 | } | ||
1679 | catch (Exception e) | ||
1680 | { | ||
1681 | m_log.ErrorFormat( | ||
1682 | "[EVENT MANAGER]: Delegate for TriggerEstateToolsSunUpdate failed - continuing. {0} {1}", | ||
1683 | e.Message, e.StackTrace); | ||
1684 | } | ||
1685 | } | ||
1686 | } | ||
1018 | } | 1687 | } |
1019 | 1688 | ||
1020 | public float GetCurrentTimeAsSunLindenHour() | 1689 | public float GetCurrentTimeAsSunLindenHour() |
1021 | { | 1690 | { |
1022 | handlerCurrentTimeAsLindenSunHour = OnGetCurrentTimeAsLindenSunHour; | 1691 | SunLindenHour handlerCurrentTimeAsLindenSunHour = OnGetCurrentTimeAsLindenSunHour; |
1023 | if (handlerCurrentTimeAsLindenSunHour != null) | 1692 | if (handlerCurrentTimeAsLindenSunHour != null) |
1024 | { | 1693 | { |
1025 | return handlerCurrentTimeAsLindenSunHour(); | 1694 | foreach (SunLindenHour d in handlerCurrentTimeAsLindenSunHour.GetInvocationList()) |
1695 | { | ||
1696 | try | ||
1697 | { | ||
1698 | return d(); | ||
1699 | } | ||
1700 | catch (Exception e) | ||
1701 | { | ||
1702 | m_log.ErrorFormat( | ||
1703 | "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", | ||
1704 | e.Message, e.StackTrace); | ||
1705 | } | ||
1706 | } | ||
1026 | } | 1707 | } |
1708 | |||
1027 | return 6; | 1709 | return 6; |
1028 | } | 1710 | } |
1029 | 1711 | ||
1030 | public void TriggerOarFileLoaded(Guid requestId, string message) | 1712 | public void TriggerOarFileLoaded(Guid requestId, string message) |
1031 | { | 1713 | { |
1032 | handlerOarFileLoaded = OnOarFileLoaded; | 1714 | OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded; |
1033 | if (handlerOarFileLoaded != null) | 1715 | if (handlerOarFileLoaded != null) |
1034 | handlerOarFileLoaded(requestId, message); | 1716 | { |
1717 | foreach (OarFileLoaded d in handlerOarFileLoaded.GetInvocationList()) | ||
1718 | { | ||
1719 | try | ||
1720 | { | ||
1721 | d(requestId, message); | ||
1722 | } | ||
1723 | catch (Exception e) | ||
1724 | { | ||
1725 | m_log.ErrorFormat( | ||
1726 | "[EVENT MANAGER]: Delegate for TriggerOarFileLoaded failed - continuing. {0} {1}", | ||
1727 | e.Message, e.StackTrace); | ||
1728 | } | ||
1729 | } | ||
1730 | } | ||
1035 | } | 1731 | } |
1036 | 1732 | ||
1037 | public void TriggerOarFileSaved(Guid requestId, string message) | 1733 | public void TriggerOarFileSaved(Guid requestId, string message) |
1038 | { | 1734 | { |
1039 | handlerOarFileSaved = OnOarFileSaved; | 1735 | OarFileSaved handlerOarFileSaved = OnOarFileSaved; |
1040 | if (handlerOarFileSaved != null) | 1736 | if (handlerOarFileSaved != null) |
1041 | handlerOarFileSaved(requestId, message); | 1737 | { |
1738 | foreach (OarFileSaved d in handlerOarFileSaved.GetInvocationList()) | ||
1739 | { | ||
1740 | try | ||
1741 | { | ||
1742 | d(requestId, message); | ||
1743 | } | ||
1744 | catch (Exception e) | ||
1745 | { | ||
1746 | m_log.ErrorFormat( | ||
1747 | "[EVENT MANAGER]: Delegate for TriggerOarFileSaved failed - continuing. {0} {1}", | ||
1748 | e.Message, e.StackTrace); | ||
1749 | } | ||
1750 | } | ||
1751 | } | ||
1042 | } | 1752 | } |
1043 | 1753 | ||
1044 | public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message) | 1754 | public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message) |
1045 | { | 1755 | { |
1046 | handlerEmptyScriptCompileQueue = OnEmptyScriptCompileQueue; | 1756 | EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = OnEmptyScriptCompileQueue; |
1047 | if (handlerEmptyScriptCompileQueue != null) | 1757 | if (handlerEmptyScriptCompileQueue != null) |
1048 | handlerEmptyScriptCompileQueue(numScriptsFailed, message); | 1758 | { |
1759 | foreach (EmptyScriptCompileQueue d in handlerEmptyScriptCompileQueue.GetInvocationList()) | ||
1760 | { | ||
1761 | try | ||
1762 | { | ||
1763 | d(numScriptsFailed, message); | ||
1764 | } | ||
1765 | catch (Exception e) | ||
1766 | { | ||
1767 | m_log.ErrorFormat( | ||
1768 | "[EVENT MANAGER]: Delegate for TriggerEmptyScriptCompileQueue failed - continuing. {0} {1}", | ||
1769 | e.Message, e.StackTrace); | ||
1770 | } | ||
1771 | } | ||
1772 | } | ||
1049 | } | 1773 | } |
1050 | 1774 | ||
1051 | public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders) | 1775 | public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders) |
1052 | { | 1776 | { |
1053 | handlerCollidingStart = OnScriptColliderStart; | 1777 | ScriptColliding handlerCollidingStart = OnScriptColliderStart; |
1054 | if (handlerCollidingStart != null) | 1778 | if (handlerCollidingStart != null) |
1055 | handlerCollidingStart(localId, colliders); | 1779 | { |
1780 | foreach (ScriptColliding d in handlerCollidingStart.GetInvocationList()) | ||
1781 | { | ||
1782 | try | ||
1783 | { | ||
1784 | d(localId, colliders); | ||
1785 | } | ||
1786 | catch (Exception e) | ||
1787 | { | ||
1788 | m_log.ErrorFormat( | ||
1789 | "[EVENT MANAGER]: Delegate for TriggerScriptCollidingStart failed - continuing. {0} {1}", | ||
1790 | e.Message, e.StackTrace); | ||
1791 | } | ||
1792 | } | ||
1793 | } | ||
1056 | } | 1794 | } |
1057 | 1795 | ||
1058 | public void TriggerScriptColliding(uint localId, ColliderArgs colliders) | 1796 | public void TriggerScriptColliding(uint localId, ColliderArgs colliders) |
1059 | { | 1797 | { |
1060 | handlerColliding = OnScriptColliding; | 1798 | ScriptColliding handlerColliding = OnScriptColliding; |
1061 | if (handlerColliding != null) | 1799 | if (handlerColliding != null) |
1062 | handlerColliding(localId, colliders); | 1800 | { |
1801 | foreach (ScriptColliding d in handlerColliding.GetInvocationList()) | ||
1802 | { | ||
1803 | try | ||
1804 | { | ||
1805 | d(localId, colliders); | ||
1806 | } | ||
1807 | catch (Exception e) | ||
1808 | { | ||
1809 | m_log.ErrorFormat( | ||
1810 | "[EVENT MANAGER]: Delegate for TriggerScriptColliding failed - continuing. {0} {1}", | ||
1811 | e.Message, e.StackTrace); | ||
1812 | } | ||
1813 | } | ||
1814 | } | ||
1063 | } | 1815 | } |
1064 | 1816 | ||
1065 | public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders) | 1817 | public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders) |
1066 | { | 1818 | { |
1067 | handlerCollidingEnd = OnScriptCollidingEnd; | 1819 | ScriptColliding handlerCollidingEnd = OnScriptCollidingEnd; |
1068 | if (handlerCollidingEnd != null) | 1820 | if (handlerCollidingEnd != null) |
1069 | handlerCollidingEnd(localId, colliders); | 1821 | { |
1822 | foreach (ScriptColliding d in handlerCollidingEnd.GetInvocationList()) | ||
1823 | { | ||
1824 | try | ||
1825 | { | ||
1826 | d(localId, colliders); | ||
1827 | } | ||
1828 | catch (Exception e) | ||
1829 | { | ||
1830 | m_log.ErrorFormat( | ||
1831 | "[EVENT MANAGER]: Delegate for TriggerScriptCollidingEnd failed - continuing. {0} {1}", | ||
1832 | e.Message, e.StackTrace); | ||
1833 | } | ||
1834 | } | ||
1835 | } | ||
1070 | } | 1836 | } |
1071 | 1837 | ||
1072 | public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders) | 1838 | public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders) |
1073 | { | 1839 | { |
1074 | handlerLandCollidingStart = OnScriptLandColliderStart; | 1840 | ScriptColliding handlerLandCollidingStart = OnScriptLandColliderStart; |
1075 | if (handlerLandCollidingStart != null) | 1841 | if (handlerLandCollidingStart != null) |
1076 | handlerLandCollidingStart(localId, colliders); | 1842 | { |
1843 | foreach (ScriptColliding d in handlerLandCollidingStart.GetInvocationList()) | ||
1844 | { | ||
1845 | try | ||
1846 | { | ||
1847 | d(localId, colliders); | ||
1848 | } | ||
1849 | catch (Exception e) | ||
1850 | { | ||
1851 | m_log.ErrorFormat( | ||
1852 | "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingStart failed - continuing. {0} {1}", | ||
1853 | e.Message, e.StackTrace); | ||
1854 | } | ||
1855 | } | ||
1856 | } | ||
1077 | } | 1857 | } |
1078 | 1858 | ||
1079 | public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders) | 1859 | public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders) |
1080 | { | 1860 | { |
1081 | handlerLandColliding = OnScriptLandColliding; | 1861 | ScriptColliding handlerLandColliding = OnScriptLandColliding; |
1082 | if (handlerLandColliding != null) | 1862 | if (handlerLandColliding != null) |
1083 | handlerLandColliding(localId, colliders); | 1863 | { |
1864 | foreach (ScriptColliding d in handlerLandColliding.GetInvocationList()) | ||
1865 | { | ||
1866 | try | ||
1867 | { | ||
1868 | d(localId, colliders); | ||
1869 | } | ||
1870 | catch (Exception e) | ||
1871 | { | ||
1872 | m_log.ErrorFormat( | ||
1873 | "[EVENT MANAGER]: Delegate for TriggerScriptLandColliding failed - continuing. {0} {1}", | ||
1874 | e.Message, e.StackTrace); | ||
1875 | } | ||
1876 | } | ||
1877 | } | ||
1084 | } | 1878 | } |
1085 | 1879 | ||
1086 | public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders) | 1880 | public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders) |
1087 | { | 1881 | { |
1088 | handlerLandCollidingEnd = OnScriptLandColliderEnd; | 1882 | ScriptColliding handlerLandCollidingEnd = OnScriptLandColliderEnd; |
1089 | if (handlerLandCollidingEnd != null) | 1883 | if (handlerLandCollidingEnd != null) |
1090 | handlerLandCollidingEnd(localId, colliders); | 1884 | { |
1885 | foreach (ScriptColliding d in handlerLandCollidingEnd.GetInvocationList()) | ||
1886 | { | ||
1887 | try | ||
1888 | { | ||
1889 | d(localId, colliders); | ||
1890 | } | ||
1891 | catch (Exception e) | ||
1892 | { | ||
1893 | m_log.ErrorFormat( | ||
1894 | "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingEnd failed - continuing. {0} {1}", | ||
1895 | e.Message, e.StackTrace); | ||
1896 | } | ||
1897 | } | ||
1898 | } | ||
1091 | } | 1899 | } |
1092 | 1900 | ||
1093 | public void TriggerSetRootAgentScene(UUID agentID, Scene scene) | 1901 | public void TriggerSetRootAgentScene(UUID agentID, Scene scene) |
1094 | { | 1902 | { |
1095 | handlerSetRootAgentScene = OnSetRootAgentScene; | 1903 | OnSetRootAgentSceneDelegate handlerSetRootAgentScene = OnSetRootAgentScene; |
1096 | if (handlerSetRootAgentScene != null) | 1904 | if (handlerSetRootAgentScene != null) |
1097 | handlerSetRootAgentScene(agentID, scene); | 1905 | { |
1906 | foreach (OnSetRootAgentSceneDelegate d in handlerSetRootAgentScene.GetInvocationList()) | ||
1907 | { | ||
1908 | try | ||
1909 | { | ||
1910 | d(agentID, scene); | ||
1911 | } | ||
1912 | catch (Exception e) | ||
1913 | { | ||
1914 | m_log.ErrorFormat( | ||
1915 | "[EVENT MANAGER]: Delegate for TriggerSetRootAgentScene failed - continuing. {0} {1}", | ||
1916 | e.Message, e.StackTrace); | ||
1917 | } | ||
1918 | } | ||
1919 | } | ||
1098 | } | 1920 | } |
1099 | 1921 | ||
1100 | public void TriggerOnRegionUp(GridRegion otherRegion) | 1922 | public void TriggerOnRegionUp(GridRegion otherRegion) |
1101 | { | 1923 | { |
1102 | handlerOnRegionUp = OnRegionUp; | 1924 | RegionUp handlerOnRegionUp = OnRegionUp; |
1103 | if (handlerOnRegionUp != null) | 1925 | if (handlerOnRegionUp != null) |
1104 | handlerOnRegionUp(otherRegion); | 1926 | { |
1927 | foreach (RegionUp d in handlerOnRegionUp.GetInvocationList()) | ||
1928 | { | ||
1929 | try | ||
1930 | { | ||
1931 | d(otherRegion); | ||
1932 | } | ||
1933 | catch (Exception e) | ||
1934 | { | ||
1935 | m_log.ErrorFormat( | ||
1936 | "[EVENT MANAGER]: Delegate for TriggerOnRegionUp failed - continuing. {0} {1}", | ||
1937 | e.Message, e.StackTrace); | ||
1938 | } | ||
1939 | } | ||
1940 | } | ||
1105 | } | 1941 | } |
1106 | |||
1107 | } | 1942 | } |
1108 | } | 1943 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 45806dd..e032a07 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -197,7 +197,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
197 | 197 | ||
198 | if (isScriptRunning) | 198 | if (isScriptRunning) |
199 | { | 199 | { |
200 | part.Inventory.RemoveScriptInstance(item.ItemID); | 200 | part.Inventory.RemoveScriptInstance(item.ItemID, false); |
201 | } | 201 | } |
202 | 202 | ||
203 | // Update item with new asset | 203 | // Update item with new asset |
@@ -794,8 +794,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
794 | 794 | ||
795 | if (item.Type == 10) | 795 | if (item.Type == 10) |
796 | { | 796 | { |
797 | part.RemoveScriptEvents(itemID); | ||
797 | EventManager.TriggerRemoveScript(localID, itemID); | 798 | EventManager.TriggerRemoveScript(localID, itemID); |
798 | } | 799 | } |
800 | |||
799 | group.RemoveInventoryItem(localID, itemID); | 801 | group.RemoveInventoryItem(localID, itemID); |
800 | part.GetProperties(remoteClient); | 802 | part.GetProperties(remoteClient); |
801 | } | 803 | } |
@@ -1879,9 +1881,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1879 | } | 1881 | } |
1880 | } | 1882 | } |
1881 | 1883 | ||
1882 | public void AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent) | 1884 | /// <summary> |
1885 | /// Attach an object. | ||
1886 | /// </summary> | ||
1887 | /// <param name="controllingClient"></param> | ||
1888 | /// <param name="localID"></param> | ||
1889 | /// <param name="attachPoint"></param> | ||
1890 | /// <param name="rot"></param> | ||
1891 | /// <param name="pos"></param> | ||
1892 | /// <param name="silent"></param> | ||
1893 | /// <returns>true if the object was successfully attached, false otherwise</returns> | ||
1894 | public bool AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent) | ||
1883 | { | 1895 | { |
1884 | m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent); | 1896 | return m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent); |
1885 | } | 1897 | } |
1886 | 1898 | ||
1887 | public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) | 1899 | public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 342b3c5..bc10230 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -292,6 +292,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
292 | } | 292 | } |
293 | } | 293 | } |
294 | 294 | ||
295 | public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | ||
296 | { | ||
297 | List<EntityBase> EntityList = GetEntities(); | ||
298 | |||
299 | SurfaceTouchEventArgs surfaceArg = null; | ||
300 | if (surfaceArgs != null && surfaceArgs.Count > 0) | ||
301 | surfaceArg = surfaceArgs[0]; | ||
302 | |||
303 | foreach (EntityBase ent in EntityList) | ||
304 | { | ||
305 | if (ent is SceneObjectGroup) | ||
306 | { | ||
307 | SceneObjectGroup obj = ent as SceneObjectGroup; | ||
308 | if (obj != null) | ||
309 | { | ||
310 | // Is this prim part of the group | ||
311 | if (obj.HasChildPrim(objectID)) | ||
312 | { | ||
313 | SceneObjectPart part = obj.GetChildPart(objectID); | ||
314 | |||
315 | // If the touched prim handles touches, deliver it | ||
316 | // If not, deliver to root prim | ||
317 | if ((part.ScriptEvents & scriptEvents.touch) != 0) | ||
318 | EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); | ||
319 | // Deliver to the root prim if the touched prim doesn't handle touches | ||
320 | // or if we're meant to pass on touches anyway. Don't send to root prim | ||
321 | // if prim touched is the root prim as we just did it | ||
322 | if (((part.ScriptEvents & scriptEvents.touch) == 0) || | ||
323 | (part.PassTouches && (part.LocalId != obj.RootPart.LocalId))) | ||
324 | { | ||
325 | EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg); | ||
326 | } | ||
327 | |||
328 | return; | ||
329 | } | ||
330 | } | ||
331 | } | ||
332 | } | ||
333 | } | ||
334 | |||
295 | public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | 335 | public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) |
296 | { | 336 | { |
297 | List<EntityBase> EntityList = GetEntities(); | 337 | List<EntityBase> EntityList = GetEntities(); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f800d5f..f109589 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1102,7 +1102,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1102 | { | 1102 | { |
1103 | if (ent is SceneObjectGroup) | 1103 | if (ent is SceneObjectGroup) |
1104 | { | 1104 | { |
1105 | ((SceneObjectGroup) ent).RemoveScriptInstances(); | 1105 | ((SceneObjectGroup) ent).RemoveScriptInstances(false); |
1106 | } | 1106 | } |
1107 | } | 1107 | } |
1108 | } | 1108 | } |
@@ -1977,13 +1977,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1977 | /// <param name="silent">Suppress broadcasting changes to other clients.</param> | 1977 | /// <param name="silent">Suppress broadcasting changes to other clients.</param> |
1978 | public void DeleteSceneObject(SceneObjectGroup group, bool silent) | 1978 | public void DeleteSceneObject(SceneObjectGroup group, bool silent) |
1979 | { | 1979 | { |
1980 | // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); | ||
1981 | |||
1980 | //SceneObjectPart rootPart = group.GetChildPart(group.UUID); | 1982 | //SceneObjectPart rootPart = group.GetChildPart(group.UUID); |
1981 | 1983 | ||
1982 | // Serialise calls to RemoveScriptInstances to avoid | 1984 | // Serialise calls to RemoveScriptInstances to avoid |
1983 | // deadlocking on m_parts inside SceneObjectGroup | 1985 | // deadlocking on m_parts inside SceneObjectGroup |
1984 | lock (m_deleting_scene_object) | 1986 | lock (m_deleting_scene_object) |
1985 | { | 1987 | { |
1986 | group.RemoveScriptInstances(); | 1988 | group.RemoveScriptInstances(true); |
1987 | } | 1989 | } |
1988 | 1990 | ||
1989 | foreach (SceneObjectPart part in group.Children.Values) | 1991 | foreach (SceneObjectPart part in group.Children.Values) |
@@ -2011,6 +2013,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2011 | } | 2013 | } |
2012 | 2014 | ||
2013 | group.DeleteGroup(silent); | 2015 | group.DeleteGroup(silent); |
2016 | |||
2017 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | ||
2014 | } | 2018 | } |
2015 | 2019 | ||
2016 | /// <summary> | 2020 | /// <summary> |
@@ -2539,6 +2543,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2539 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; | 2543 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; |
2540 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; | 2544 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; |
2541 | client.OnGrabObject += ProcessObjectGrab; | 2545 | client.OnGrabObject += ProcessObjectGrab; |
2546 | client.OnGrabUpdate += ProcessObjectGrabUpdate; | ||
2542 | client.OnDeGrabObject += ProcessObjectDeGrab; | 2547 | client.OnDeGrabObject += ProcessObjectDeGrab; |
2543 | client.OnUndo += m_sceneGraph.HandleUndo; | 2548 | client.OnUndo += m_sceneGraph.HandleUndo; |
2544 | client.OnObjectDescription += m_sceneGraph.PrimDescription; | 2549 | client.OnObjectDescription += m_sceneGraph.PrimDescription; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index fbd11c6..7bd4329 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -479,25 +479,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
479 | if (part == null) | 479 | if (part == null) |
480 | return; | 480 | return; |
481 | 481 | ||
482 | if (!m_parentScene.Permissions.CanTakeObject( | 482 | if (!m_parentScene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId)) |
483 | part.UUID, remoteClient.AgentId)) | ||
484 | return; | 483 | return; |
485 | 484 | ||
486 | // Calls attach with a Zero position | 485 | // Calls attach with a Zero position |
487 | AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false); | 486 | if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false)) |
488 | m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); | ||
489 | |||
490 | // Save avatar attachment information | ||
491 | ScenePresence presence; | ||
492 | if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence)) | ||
493 | { | 487 | { |
494 | m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", AttachmentPoint: " + AttachmentPt); | 488 | m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); |
495 | m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 489 | |
490 | // Save avatar attachment information | ||
491 | ScenePresence presence; | ||
492 | if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence)) | ||
493 | { | ||
494 | m_log.Info( | ||
495 | "[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | ||
496 | + ", AttachmentPoint: " + AttachmentPt); | ||
497 | |||
498 | m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
499 | } | ||
496 | } | 500 | } |
497 | } | 501 | } |
498 | 502 | ||
499 | public SceneObjectGroup RezSingleAttachment( | 503 | /// <summary> |
500 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 504 | /// Rez an attachment |
505 | /// </summary> | ||
506 | /// <param name="remoteClient"></param> | ||
507 | /// <param name="itemID"></param> | ||
508 | /// <param name="AttachmentPt"></param> | ||
509 | /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> | ||
510 | public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
501 | { | 511 | { |
502 | IInventoryAccessModule invAccess = m_parentScene.RequestModuleInterface<IInventoryAccessModule>(); | 512 | IInventoryAccessModule invAccess = m_parentScene.RequestModuleInterface<IInventoryAccessModule>(); |
503 | if (invAccess != null) | 513 | if (invAccess != null) |
@@ -560,7 +570,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
560 | } | 570 | } |
561 | } | 571 | } |
562 | 572 | ||
563 | protected internal void AttachObject( | 573 | /// <summary> |
574 | /// Attach a scene object to an avatar. | ||
575 | /// </summary> | ||
576 | /// <param name="remoteClient"></param> | ||
577 | /// <param name="objectLocalID"></param> | ||
578 | /// <param name="AttachmentPt"></param> | ||
579 | /// <param name="rot"></param> | ||
580 | /// <param name="attachPos"></param> | ||
581 | /// <param name="silent"></param> | ||
582 | /// <returns>true if the attachment was successful, false otherwise</returns> | ||
583 | protected internal bool AttachObject( | ||
564 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) | 584 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) |
565 | { | 585 | { |
566 | SceneObjectGroup group = GetGroupByPrim(objectLocalID); | 586 | SceneObjectGroup group = GetGroupByPrim(objectLocalID); |
@@ -589,10 +609,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
589 | // Stick it on left hand with Zero Offset from the attachment point. | 609 | // Stick it on left hand with Zero Offset from the attachment point. |
590 | AttachmentPt = (uint)AttachmentPoint.LeftHand; | 610 | AttachmentPt = (uint)AttachmentPoint.LeftHand; |
591 | attachPos = Vector3.Zero; | 611 | attachPos = Vector3.Zero; |
592 | |||
593 | } | 612 | } |
594 | 613 | ||
595 | |||
596 | group.SetAttachmentPoint((byte)AttachmentPt); | 614 | group.SetAttachmentPoint((byte)AttachmentPt); |
597 | group.AbsolutePosition = attachPos; | 615 | group.AbsolutePosition = attachPos; |
598 | 616 | ||
@@ -615,15 +633,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
615 | // it get cleaned up | 633 | // it get cleaned up |
616 | // | 634 | // |
617 | group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); | 635 | group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); |
618 | group.HasGroupChanged = false; | 636 | group.HasGroupChanged = false; |
619 | } | 637 | } |
620 | else | 638 | else |
621 | { | 639 | { |
622 | remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false); | 640 | remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false); |
641 | return false; | ||
623 | } | 642 | } |
624 | } | 643 | } |
625 | else | 644 | else |
645 | { | ||
626 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID); | 646 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID); |
647 | return false; | ||
648 | } | ||
649 | |||
650 | return true; | ||
627 | } | 651 | } |
628 | 652 | ||
629 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) | 653 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 5a06bdb..71354b4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -74,13 +74,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
74 | /// <summary> | 74 | /// <summary> |
75 | /// Stop the scripts contained in all the prims in this group | 75 | /// Stop the scripts contained in all the prims in this group |
76 | /// </summary> | 76 | /// </summary> |
77 | public void RemoveScriptInstances() | 77 | /// <param name="sceneObjectBeingDeleted"> |
78 | /// Should be true if these scripts are being removed because the scene | ||
79 | /// object is being deleted. This will prevent spurious updates to the client. | ||
80 | /// </param> | ||
81 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) | ||
78 | { | 82 | { |
79 | lock (m_parts) | 83 | lock (m_parts) |
80 | { | 84 | { |
81 | foreach (SceneObjectPart part in m_parts.Values) | 85 | foreach (SceneObjectPart part in m_parts.Values) |
82 | { | 86 | { |
83 | part.Inventory.RemoveScriptInstances(); | 87 | part.Inventory.RemoveScriptInstances(sceneObjectBeingDeleted); |
84 | } | 88 | } |
85 | } | 89 | } |
86 | } | 90 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ec41ac7..8c56870 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -235,6 +235,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
235 | set { m_rootPart.GroupID = value; } | 235 | set { m_rootPart.GroupID = value; } |
236 | } | 236 | } |
237 | 237 | ||
238 | /// <value> | ||
239 | /// The parts of this scene object group. You must lock this property before using it. | ||
240 | /// </value> | ||
238 | public Dictionary<UUID, SceneObjectPart> Children | 241 | public Dictionary<UUID, SceneObjectPart> Children |
239 | { | 242 | { |
240 | get { return m_parts; } | 243 | get { return m_parts; } |
@@ -2097,7 +2100,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2097 | } | 2100 | } |
2098 | 2101 | ||
2099 | /// <summary> | 2102 | /// <summary> |
2100 | /// Get a child part with a given UUID | 2103 | /// Get a part with a given UUID |
2101 | /// </summary> | 2104 | /// </summary> |
2102 | /// <param name="primID"></param> | 2105 | /// <param name="primID"></param> |
2103 | /// <returns>null if a child part with the primID was not found</returns> | 2106 | /// <returns>null if a child part with the primID was not found</returns> |
@@ -2112,7 +2115,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2112 | } | 2115 | } |
2113 | 2116 | ||
2114 | /// <summary> | 2117 | /// <summary> |
2115 | /// Get a child part with a given local ID | 2118 | /// Get a part with a given local ID |
2116 | /// </summary> | 2119 | /// </summary> |
2117 | /// <param name="localID"></param> | 2120 | /// <param name="localID"></param> |
2118 | /// <returns>null if a child part with the local ID was not found</returns> | 2121 | /// <returns>null if a child part with the local ID was not found</returns> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 56b2f13..dd797fc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -90,12 +90,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
90 | SCALE = 0x40 | 90 | SCALE = 0x40 |
91 | } | 91 | } |
92 | 92 | ||
93 | public enum PrimType : int | ||
94 | { | ||
95 | BOX = 0, | ||
96 | CYLINDER = 1, | ||
97 | PRISM = 2, | ||
98 | SPHERE = 3, | ||
99 | TORUS = 4, | ||
100 | TUBE = 5, | ||
101 | RING = 6, | ||
102 | SCULPT = 7 | ||
103 | } | ||
104 | |||
93 | #endregion Enumerations | 105 | #endregion Enumerations |
94 | 106 | ||
95 | public class SceneObjectPart : IScriptHost | 107 | public class SceneObjectPart : IScriptHost |
96 | { | 108 | { |
109 | /// <value> | ||
110 | /// Denote all sides of the prim | ||
111 | /// </value> | ||
112 | public const int ALL_SIDES = -1; | ||
113 | |||
97 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 114 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
98 | 115 | ||
116 | /// <value> | ||
117 | /// Is this sop a root part? | ||
118 | /// </value> | ||
119 | [XmlIgnore] | ||
120 | public bool IsRoot | ||
121 | { | ||
122 | get { return ParentGroup.RootPart == this; } | ||
123 | } | ||
124 | |||
99 | // use only one serializer to give the runtime a chance to optimize it (it won't do that if you | 125 | // use only one serializer to give the runtime a chance to optimize it (it won't do that if you |
100 | // use a new instance every time) | 126 | // use a new instance every time) |
101 | private static XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); | 127 | private static XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); |
@@ -737,6 +763,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
737 | } | 763 | } |
738 | } | 764 | } |
739 | 765 | ||
766 | /// <value> | ||
767 | /// Text color. | ||
768 | /// </value> | ||
740 | public Color Color | 769 | public Color Color |
741 | { | 770 | { |
742 | get { return m_color; } | 771 | get { return m_color; } |
@@ -1901,7 +1930,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1901 | foreach (uint localId in startedColliders) | 1930 | foreach (uint localId in startedColliders) |
1902 | { | 1931 | { |
1903 | if (localId == 0) | 1932 | if (localId == 0) |
1904 | return; | 1933 | continue; |
1905 | // always running this check because if the user deletes the object it would return a null reference. | 1934 | // always running this check because if the user deletes the object it would return a null reference. |
1906 | if (m_parentGroup == null) | 1935 | if (m_parentGroup == null) |
1907 | return; | 1936 | return; |
@@ -2037,7 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2037 | { | 2066 | { |
2038 | // always running this check because if the user deletes the object it would return a null reference. | 2067 | // always running this check because if the user deletes the object it would return a null reference. |
2039 | if (localId == 0) | 2068 | if (localId == 0) |
2040 | return; | 2069 | continue; |
2041 | 2070 | ||
2042 | if (m_parentGroup == null) | 2071 | if (m_parentGroup == null) |
2043 | return; | 2072 | return; |
@@ -2169,7 +2198,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2169 | foreach (uint localId in endedColliders) | 2198 | foreach (uint localId in endedColliders) |
2170 | { | 2199 | { |
2171 | if (localId == 0) | 2200 | if (localId == 0) |
2172 | return; | 2201 | continue; |
2173 | 2202 | ||
2174 | // always running this check because if the user deletes the object it would return a null reference. | 2203 | // always running this check because if the user deletes the object it would return a null reference. |
2175 | if (m_parentGroup == null) | 2204 | if (m_parentGroup == null) |
@@ -2479,7 +2508,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2479 | //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString()); | 2508 | //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString()); |
2480 | //ScheduleFullUpdate(); | 2509 | //ScheduleFullUpdate(); |
2481 | } | 2510 | } |
2482 | 2511 | ||
2483 | public void RemoveScriptEvents(UUID scriptid) | 2512 | public void RemoveScriptEvents(UUID scriptid) |
2484 | { | 2513 | { |
2485 | lock (m_scriptEvents) | 2514 | lock (m_scriptEvents) |
@@ -2533,6 +2562,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2533 | /// </summary> | 2562 | /// </summary> |
2534 | public void ScheduleFullUpdate() | 2563 | public void ScheduleFullUpdate() |
2535 | { | 2564 | { |
2565 | // m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); | ||
2566 | |||
2536 | if (m_parentGroup != null) | 2567 | if (m_parentGroup != null) |
2537 | { | 2568 | { |
2538 | m_parentGroup.QueueForUpdateCheck(); | 2569 | m_parentGroup.QueueForUpdateCheck(); |
@@ -2953,6 +2984,178 @@ namespace OpenSim.Region.Framework.Scenes | |||
2953 | } | 2984 | } |
2954 | } | 2985 | } |
2955 | 2986 | ||
2987 | /// <summary> | ||
2988 | /// Set the color of prim faces | ||
2989 | /// </summary> | ||
2990 | /// <param name="color"></param> | ||
2991 | /// <param name="face"></param> | ||
2992 | public void SetFaceColor(Vector3 color, int face) | ||
2993 | { | ||
2994 | Primitive.TextureEntry tex = Shape.Textures; | ||
2995 | Color4 texcolor; | ||
2996 | if (face >= 0 && face < GetNumberOfSides()) | ||
2997 | { | ||
2998 | texcolor = tex.CreateFace((uint)face).RGBA; | ||
2999 | texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); | ||
3000 | texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); | ||
3001 | texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); | ||
3002 | tex.FaceTextures[face].RGBA = texcolor; | ||
3003 | UpdateTexture(tex); | ||
3004 | return; | ||
3005 | } | ||
3006 | else if (face == ALL_SIDES) | ||
3007 | { | ||
3008 | for (uint i = 0; i < GetNumberOfSides(); i++) | ||
3009 | { | ||
3010 | if (tex.FaceTextures[i] != null) | ||
3011 | { | ||
3012 | texcolor = tex.FaceTextures[i].RGBA; | ||
3013 | texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); | ||
3014 | texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); | ||
3015 | texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); | ||
3016 | tex.FaceTextures[i].RGBA = texcolor; | ||
3017 | } | ||
3018 | texcolor = tex.DefaultTexture.RGBA; | ||
3019 | texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); | ||
3020 | texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); | ||
3021 | texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); | ||
3022 | tex.DefaultTexture.RGBA = texcolor; | ||
3023 | } | ||
3024 | UpdateTexture(tex); | ||
3025 | return; | ||
3026 | } | ||
3027 | } | ||
3028 | |||
3029 | /// <summary> | ||
3030 | /// Get the number of sides that this part has. | ||
3031 | /// </summary> | ||
3032 | /// <returns></returns> | ||
3033 | public int GetNumberOfSides() | ||
3034 | { | ||
3035 | int ret = 0; | ||
3036 | bool hasCut; | ||
3037 | bool hasHollow; | ||
3038 | bool hasDimple; | ||
3039 | bool hasProfileCut; | ||
3040 | |||
3041 | PrimType primType = GetPrimType(); | ||
3042 | HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); | ||
3043 | |||
3044 | switch (primType) | ||
3045 | { | ||
3046 | case PrimType.BOX: | ||
3047 | ret = 6; | ||
3048 | if (hasCut) ret += 2; | ||
3049 | if (hasHollow) ret += 1; | ||
3050 | break; | ||
3051 | case PrimType.CYLINDER: | ||
3052 | ret = 3; | ||
3053 | if (hasCut) ret += 2; | ||
3054 | if (hasHollow) ret += 1; | ||
3055 | break; | ||
3056 | case PrimType.PRISM: | ||
3057 | ret = 5; | ||
3058 | if (hasCut) ret += 2; | ||
3059 | if (hasHollow) ret += 1; | ||
3060 | break; | ||
3061 | case PrimType.SPHERE: | ||
3062 | ret = 1; | ||
3063 | if (hasCut) ret += 2; | ||
3064 | if (hasDimple) ret += 2; | ||
3065 | if (hasHollow) ret += 1; | ||
3066 | break; | ||
3067 | case PrimType.TORUS: | ||
3068 | ret = 1; | ||
3069 | if (hasCut) ret += 2; | ||
3070 | if (hasProfileCut) ret += 2; | ||
3071 | if (hasHollow) ret += 1; | ||
3072 | break; | ||
3073 | case PrimType.TUBE: | ||
3074 | ret = 4; | ||
3075 | if (hasCut) ret += 2; | ||
3076 | if (hasProfileCut) ret += 2; | ||
3077 | if (hasHollow) ret += 1; | ||
3078 | break; | ||
3079 | case PrimType.RING: | ||
3080 | ret = 3; | ||
3081 | if (hasCut) ret += 2; | ||
3082 | if (hasProfileCut) ret += 2; | ||
3083 | if (hasHollow) ret += 1; | ||
3084 | break; | ||
3085 | case PrimType.SCULPT: | ||
3086 | ret = 1; | ||
3087 | break; | ||
3088 | } | ||
3089 | return ret; | ||
3090 | } | ||
3091 | |||
3092 | /// <summary> | ||
3093 | /// Tell us what type this prim is | ||
3094 | /// </summary> | ||
3095 | /// <param name="primShape"></param> | ||
3096 | /// <returns></returns> | ||
3097 | public PrimType GetPrimType() | ||
3098 | { | ||
3099 | if (Shape.SculptEntry) | ||
3100 | return PrimType.SCULPT; | ||
3101 | if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) | ||
3102 | { | ||
3103 | if (Shape.PathCurve == (byte)Extrusion.Straight) | ||
3104 | return PrimType.BOX; | ||
3105 | else if (Shape.PathCurve == (byte)Extrusion.Curve1) | ||
3106 | return PrimType.TUBE; | ||
3107 | } | ||
3108 | else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) | ||
3109 | { | ||
3110 | if (Shape.PathCurve == (byte)Extrusion.Straight) | ||
3111 | return PrimType.CYLINDER; | ||
3112 | // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits | ||
3113 | else if (Shape.PathCurve == (byte)Extrusion.Curve1) | ||
3114 | return PrimType.TORUS; | ||
3115 | } | ||
3116 | else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) | ||
3117 | { | ||
3118 | if (Shape.PathCurve == (byte)Extrusion.Curve1 || Shape.PathCurve == (byte)Extrusion.Curve2) | ||
3119 | return PrimType.SPHERE; | ||
3120 | } | ||
3121 | else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) | ||
3122 | { | ||
3123 | if (Shape.PathCurve == (byte)Extrusion.Straight) | ||
3124 | return PrimType.PRISM; | ||
3125 | else if (Shape.PathCurve == (byte)Extrusion.Curve1) | ||
3126 | return PrimType.RING; | ||
3127 | } | ||
3128 | |||
3129 | return PrimType.BOX; | ||
3130 | } | ||
3131 | |||
3132 | /// <summary> | ||
3133 | /// Tell us if this object has cut, hollow, dimple, and other factors affecting the number of faces | ||
3134 | /// </summary> | ||
3135 | /// <param name="primType"></param> | ||
3136 | /// <param name="shape"></param> | ||
3137 | /// <param name="hasCut"></param> | ||
3138 | /// <param name="hasHollow"></param> | ||
3139 | /// <param name="hasDimple"></param> | ||
3140 | /// <param name="hasProfileCut"></param> | ||
3141 | protected static void HasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, | ||
3142 | out bool hasDimple, out bool hasProfileCut) | ||
3143 | { | ||
3144 | if (primType == PrimType.BOX | ||
3145 | || | ||
3146 | primType == PrimType.CYLINDER | ||
3147 | || | ||
3148 | primType == PrimType.PRISM) | ||
3149 | |||
3150 | hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); | ||
3151 | else | ||
3152 | hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0); | ||
3153 | |||
3154 | hasHollow = shape.ProfileHollow > 0; | ||
3155 | hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms | ||
3156 | hasProfileCut = hasDimple; // is it the same thing? | ||
3157 | } | ||
3158 | |||
2956 | public void SetGroup(UUID groupID, IClientAPI client) | 3159 | public void SetGroup(UUID groupID, IClientAPI client) |
2957 | { | 3160 | { |
2958 | _groupID = groupID; | 3161 | _groupID = groupID; |
@@ -2984,6 +3187,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2984 | } | 3187 | } |
2985 | } | 3188 | } |
2986 | 3189 | ||
3190 | /// <summary> | ||
3191 | /// Set the events that this part will pass on to listeners. | ||
3192 | /// </summary> | ||
3193 | /// <param name="scriptid"></param> | ||
3194 | /// <param name="events"></param> | ||
2987 | public void SetScriptEvents(UUID scriptid, int events) | 3195 | public void SetScriptEvents(UUID scriptid, int events) |
2988 | { | 3196 | { |
2989 | // scriptEvents oldparts; | 3197 | // scriptEvents oldparts; |
@@ -3936,9 +4144,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3936 | ScheduleFullUpdate(); | 4144 | ScheduleFullUpdate(); |
3937 | } | 4145 | } |
3938 | 4146 | ||
3939 | // Added to handle bug in libsecondlife's TextureEntry.ToBytes() | 4147 | /// <summary> |
3940 | // not handling RGBA properly. Cycles through, and "fixes" the color | 4148 | /// Update the textures on the part. |
3941 | // info | 4149 | /// </summary> |
4150 | /// Added to handle bug in libsecondlife's TextureEntry.ToBytes() | ||
4151 | /// not handling RGBA properly. Cycles through, and "fixes" the color | ||
4152 | /// info | ||
4153 | /// <param name="tex"></param> | ||
3942 | public void UpdateTexture(Primitive.TextureEntry tex) | 4154 | public void UpdateTexture(Primitive.TextureEntry tex) |
3943 | { | 4155 | { |
3944 | //Color4 tmpcolor; | 4156 | //Color4 tmpcolor; |
@@ -4042,6 +4254,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4042 | 4254 | ||
4043 | if (m_parentGroup == null) | 4255 | if (m_parentGroup == null) |
4044 | { | 4256 | { |
4257 | // m_log.DebugFormat( | ||
4258 | // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents() since m_parentGroup == null", Name, LocalId); | ||
4045 | ScheduleFullUpdate(); | 4259 | ScheduleFullUpdate(); |
4046 | return; | 4260 | return; |
4047 | } | 4261 | } |
@@ -4058,9 +4272,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4058 | LocalFlags=(PrimFlags)objectflagupdate; | 4272 | LocalFlags=(PrimFlags)objectflagupdate; |
4059 | 4273 | ||
4060 | if (m_parentGroup != null && m_parentGroup.RootPart == this) | 4274 | if (m_parentGroup != null && m_parentGroup.RootPart == this) |
4275 | { | ||
4061 | m_parentGroup.aggregateScriptEvents(); | 4276 | m_parentGroup.aggregateScriptEvents(); |
4277 | } | ||
4062 | else | 4278 | else |
4279 | { | ||
4280 | // m_log.DebugFormat( | ||
4281 | // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); | ||
4063 | ScheduleFullUpdate(); | 4282 | ScheduleFullUpdate(); |
4283 | } | ||
4064 | } | 4284 | } |
4065 | 4285 | ||
4066 | public int registerTargetWaypoint(Vector3 target, float tolerance) | 4286 | public int registerTargetWaypoint(Vector3 target, float tolerance) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 168912e..d0de513 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -229,7 +229,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
229 | /// <summary> | 229 | /// <summary> |
230 | /// Stop all the scripts in this prim. | 230 | /// Stop all the scripts in this prim. |
231 | /// </summary> | 231 | /// </summary> |
232 | public void RemoveScriptInstances() | 232 | /// <param name="sceneObjectBeingDeleted"> |
233 | /// Should be true if these scripts are being removed because the scene | ||
234 | /// object is being deleted. This will prevent spurious updates to the client. | ||
235 | /// </param> | ||
236 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) | ||
233 | { | 237 | { |
234 | lock (Items) | 238 | lock (Items) |
235 | { | 239 | { |
@@ -237,8 +241,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
237 | { | 241 | { |
238 | if ((int)InventoryType.LSL == item.InvType) | 242 | if ((int)InventoryType.LSL == item.InvType) |
239 | { | 243 | { |
240 | RemoveScriptInstance(item.ItemID); | 244 | RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted); |
241 | m_part.RemoveScriptEvents(item.ItemID); | ||
242 | } | 245 | } |
243 | } | 246 | } |
244 | } | 247 | } |
@@ -266,8 +269,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
266 | if (stateSource == 1 && // Prim crossing | 269 | if (stateSource == 1 && // Prim crossing |
267 | m_part.ParentGroup.Scene.m_trustBinaries) | 270 | m_part.ParentGroup.Scene.m_trustBinaries) |
268 | { | 271 | { |
269 | m_items[item.ItemID].PermsMask = 0; | 272 | lock (m_items) |
270 | m_items[item.ItemID].PermsGranter = UUID.Zero; | 273 | { |
274 | m_items[item.ItemID].PermsMask = 0; | ||
275 | m_items[item.ItemID].PermsGranter = UUID.Zero; | ||
276 | } | ||
277 | |||
271 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | 278 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( |
272 | m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); | 279 | m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); |
273 | m_part.ParentGroup.AddActiveScriptCount(1); | 280 | m_part.ParentGroup.AddActiveScriptCount(1); |
@@ -275,33 +282,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
275 | return; | 282 | return; |
276 | } | 283 | } |
277 | 284 | ||
278 | m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset) | 285 | m_part.ParentGroup.Scene.AssetService.Get( |
279 | { | 286 | item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset) |
280 | if (null == asset) | 287 | { |
281 | { | 288 | if (null == asset) |
282 | m_log.ErrorFormat( | 289 | { |
283 | "[PRIM INVENTORY]: " + | 290 | m_log.ErrorFormat( |
284 | "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", | 291 | "[PRIM INVENTORY]: " + |
285 | item.Name, item.ItemID, m_part.AbsolutePosition, | 292 | "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", |
286 | m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); | 293 | item.Name, item.ItemID, m_part.AbsolutePosition, |
287 | } | 294 | m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); |
288 | else | 295 | } |
289 | { | 296 | else |
290 | if (m_part.ParentGroup.m_savedScriptState != null) | 297 | { |
291 | RestoreSavedScriptState(item.OldItemID, item.ItemID); | 298 | if (m_part.ParentGroup.m_savedScriptState != null) |
292 | m_items[item.ItemID].PermsMask = 0; | 299 | RestoreSavedScriptState(item.OldItemID, item.ItemID); |
293 | m_items[item.ItemID].PermsGranter = UUID.Zero; | 300 | |
294 | string script = Utils.BytesToString(asset.Data); | 301 | lock (m_items) |
295 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | 302 | { |
296 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); | 303 | m_items[item.ItemID].PermsMask = 0; |
297 | m_part.ParentGroup.AddActiveScriptCount(1); | 304 | m_items[item.ItemID].PermsGranter = UUID.Zero; |
298 | m_part.ScheduleFullUpdate(); | 305 | } |
299 | } | 306 | |
300 | }); | 307 | string script = Utils.BytesToString(asset.Data); |
301 | } | 308 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( |
302 | } | 309 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); |
303 | 310 | m_part.ParentGroup.AddActiveScriptCount(1); | |
304 | static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | 311 | m_part.ScheduleFullUpdate(); |
312 | } | ||
313 | } | ||
314 | ); | ||
315 | } | ||
316 | } | ||
305 | 317 | ||
306 | private void RestoreSavedScriptState(UUID oldID, UUID newID) | 318 | private void RestoreSavedScriptState(UUID oldID, UUID newID) |
307 | { | 319 | { |
@@ -387,10 +399,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
387 | /// Stop a script which is in this prim's inventory. | 399 | /// Stop a script which is in this prim's inventory. |
388 | /// </summary> | 400 | /// </summary> |
389 | /// <param name="itemId"></param> | 401 | /// <param name="itemId"></param> |
390 | public void RemoveScriptInstance(UUID itemId) | 402 | /// <param name="sceneObjectBeingDeleted"> |
403 | /// Should be true if this script is being removed because the scene | ||
404 | /// object is being deleted. This will prevent spurious updates to the client. | ||
405 | /// </param> | ||
406 | public void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted) | ||
391 | { | 407 | { |
392 | if (m_items.ContainsKey(itemId)) | 408 | bool scriptPresent = false; |
409 | |||
410 | lock (m_items) | ||
411 | { | ||
412 | if (m_items.ContainsKey(itemId)) | ||
413 | scriptPresent = true; | ||
414 | } | ||
415 | |||
416 | if (scriptPresent) | ||
393 | { | 417 | { |
418 | if (!sceneObjectBeingDeleted) | ||
419 | m_part.RemoveScriptEvents(itemId); | ||
420 | |||
394 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemId); | 421 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemId); |
395 | m_part.ParentGroup.AddActiveScriptCount(-1); | 422 | m_part.ParentGroup.AddActiveScriptCount(-1); |
396 | } | 423 | } |
@@ -458,13 +485,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
458 | /// <param name="item"></param> | 485 | /// <param name="item"></param> |
459 | public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) | 486 | public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) |
460 | { | 487 | { |
461 | List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_items.Values); | 488 | List<TaskInventoryItem> il; |
489 | |||
490 | lock (m_items) | ||
491 | { | ||
492 | il = new List<TaskInventoryItem>(m_items.Values); | ||
493 | } | ||
494 | |||
462 | foreach (TaskInventoryItem i in il) | 495 | foreach (TaskInventoryItem i in il) |
463 | { | 496 | { |
464 | if (i.Name == item.Name) | 497 | if (i.Name == item.Name) |
465 | { | 498 | { |
466 | if (i.InvType == (int)InventoryType.LSL) | 499 | if (i.InvType == (int)InventoryType.LSL) |
467 | RemoveScriptInstance(i.ItemID); | 500 | RemoveScriptInstance(i.ItemID, false); |
468 | 501 | ||
469 | RemoveInventoryItem(i.ItemID); | 502 | RemoveInventoryItem(i.ItemID); |
470 | break; | 503 | break; |
@@ -540,11 +573,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
540 | public TaskInventoryItem GetInventoryItem(UUID itemId) | 573 | public TaskInventoryItem GetInventoryItem(UUID itemId) |
541 | { | 574 | { |
542 | TaskInventoryItem item; | 575 | TaskInventoryItem item; |
543 | m_items.TryGetValue(itemId, out item); | 576 | |
577 | lock (m_items) | ||
578 | m_items.TryGetValue(itemId, out item); | ||
544 | 579 | ||
545 | return item; | 580 | return item; |
546 | } | 581 | } |
582 | |||
583 | /// <summary> | ||
584 | /// Get inventory items by name. | ||
585 | /// </summary> | ||
586 | /// <param name="name"></param> | ||
587 | /// <returns> | ||
588 | /// A list of inventory items with that name. | ||
589 | /// If no inventory item has that name then an empty list is returned. | ||
590 | /// </returns> | ||
591 | public IList<TaskInventoryItem> GetInventoryItems(string name) | ||
592 | { | ||
593 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(); | ||
594 | |||
595 | lock (m_items) | ||
596 | { | ||
597 | foreach (TaskInventoryItem item in m_items.Values) | ||
598 | { | ||
599 | if (item.Name == name) | ||
600 | items.Add(item); | ||
601 | } | ||
602 | } | ||
547 | 603 | ||
604 | return items; | ||
605 | } | ||
606 | |||
548 | /// <summary> | 607 | /// <summary> |
549 | /// Update an existing inventory item. | 608 | /// Update an existing inventory item. |
550 | /// </summary> | 609 | /// </summary> |
@@ -612,6 +671,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
612 | int type = m_items[itemID].InvType; | 671 | int type = m_items[itemID].InvType; |
613 | if (type == 10) // Script | 672 | if (type == 10) // Script |
614 | { | 673 | { |
674 | m_part.RemoveScriptEvents(itemID); | ||
615 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); | 675 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); |
616 | } | 676 | } |
617 | m_items.Remove(itemID); | 677 | m_items.Remove(itemID); |
@@ -841,54 +901,61 @@ namespace OpenSim.Region.Framework.Scenes | |||
841 | { | 901 | { |
842 | uint mask=0x7fffffff; | 902 | uint mask=0x7fffffff; |
843 | 903 | ||
844 | foreach (TaskInventoryItem item in m_items.Values) | 904 | lock (m_items) |
845 | { | 905 | { |
846 | if (item.InvType != (int)InventoryType.Object) | 906 | foreach (TaskInventoryItem item in m_items.Values) |
847 | { | ||
848 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) | ||
849 | mask &= ~((uint)PermissionMask.Copy >> 13); | ||
850 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) | ||
851 | mask &= ~((uint)PermissionMask.Transfer >> 13); | ||
852 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) | ||
853 | mask &= ~((uint)PermissionMask.Modify >> 13); | ||
854 | } | ||
855 | else | ||
856 | { | 907 | { |
857 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | 908 | if (item.InvType != (int)InventoryType.Object) |
858 | mask &= ~((uint)PermissionMask.Copy >> 13); | 909 | { |
859 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | 910 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) |
860 | mask &= ~((uint)PermissionMask.Transfer >> 13); | 911 | mask &= ~((uint)PermissionMask.Copy >> 13); |
861 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | 912 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) |
862 | mask &= ~((uint)PermissionMask.Modify >> 13); | 913 | mask &= ~((uint)PermissionMask.Transfer >> 13); |
914 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) | ||
915 | mask &= ~((uint)PermissionMask.Modify >> 13); | ||
916 | } | ||
917 | else | ||
918 | { | ||
919 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | ||
920 | mask &= ~((uint)PermissionMask.Copy >> 13); | ||
921 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | ||
922 | mask &= ~((uint)PermissionMask.Transfer >> 13); | ||
923 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | ||
924 | mask &= ~((uint)PermissionMask.Modify >> 13); | ||
925 | } | ||
926 | |||
927 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | ||
928 | mask &= ~(uint)PermissionMask.Copy; | ||
929 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
930 | mask &= ~(uint)PermissionMask.Transfer; | ||
931 | if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) | ||
932 | mask &= ~(uint)PermissionMask.Modify; | ||
863 | } | 933 | } |
864 | |||
865 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | ||
866 | mask &= ~(uint)PermissionMask.Copy; | ||
867 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
868 | mask &= ~(uint)PermissionMask.Transfer; | ||
869 | if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) | ||
870 | mask &= ~(uint)PermissionMask.Modify; | ||
871 | } | 934 | } |
935 | |||
872 | return mask; | 936 | return mask; |
873 | } | 937 | } |
874 | 938 | ||
875 | public void ApplyNextOwnerPermissions() | 939 | public void ApplyNextOwnerPermissions() |
876 | { | 940 | { |
877 | foreach (TaskInventoryItem item in m_items.Values) | 941 | lock (m_items) |
878 | { | 942 | { |
879 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) | 943 | foreach (TaskInventoryItem item in m_items.Values) |
880 | { | 944 | { |
881 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | 945 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) |
882 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; | 946 | { |
883 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | 947 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) |
884 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; | 948 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; |
885 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | 949 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) |
886 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | 950 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; |
887 | item.CurrentPermissions |= 8; | 951 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) |
952 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | ||
953 | item.CurrentPermissions |= 8; | ||
954 | } | ||
955 | item.CurrentPermissions &= item.NextPermissions; | ||
956 | item.BasePermissions &= item.NextPermissions; | ||
957 | item.EveryonePermissions &= item.NextPermissions; | ||
888 | } | 958 | } |
889 | item.CurrentPermissions &= item.NextPermissions; | ||
890 | item.BasePermissions &= item.NextPermissions; | ||
891 | item.EveryonePermissions &= item.NextPermissions; | ||
892 | } | 959 | } |
893 | 960 | ||
894 | m_part.TriggerScriptChangedEvent(Changed.OWNER); | 961 | m_part.TriggerScriptChangedEvent(Changed.OWNER); |
@@ -896,22 +963,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
896 | 963 | ||
897 | public void ApplyGodPermissions(uint perms) | 964 | public void ApplyGodPermissions(uint perms) |
898 | { | 965 | { |
899 | foreach (TaskInventoryItem item in m_items.Values) | 966 | lock (m_items) |
900 | { | 967 | { |
901 | item.CurrentPermissions = perms; | 968 | foreach (TaskInventoryItem item in m_items.Values) |
902 | item.BasePermissions = perms; | 969 | { |
970 | item.CurrentPermissions = perms; | ||
971 | item.BasePermissions = perms; | ||
972 | } | ||
903 | } | 973 | } |
904 | } | 974 | } |
905 | 975 | ||
906 | public bool ContainsScripts() | 976 | public bool ContainsScripts() |
907 | { | 977 | { |
908 | foreach (TaskInventoryItem item in m_items.Values) | 978 | lock (m_items) |
909 | { | 979 | { |
910 | if (item.InvType == (int)InventoryType.LSL) | 980 | foreach (TaskInventoryItem item in m_items.Values) |
911 | { | 981 | { |
912 | return true; | 982 | if (item.InvType == (int)InventoryType.LSL) |
983 | { | ||
984 | return true; | ||
985 | } | ||
913 | } | 986 | } |
914 | } | 987 | } |
988 | |||
915 | return false; | 989 | return false; |
916 | } | 990 | } |
917 | 991 | ||
@@ -919,8 +993,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
919 | { | 993 | { |
920 | List<UUID> ret = new List<UUID>(); | 994 | List<UUID> ret = new List<UUID>(); |
921 | 995 | ||
922 | foreach (TaskInventoryItem item in m_items.Values) | 996 | lock (m_items) |
923 | ret.Add(item.ItemID); | 997 | { |
998 | foreach (TaskInventoryItem item in m_items.Values) | ||
999 | ret.Add(item.ItemID); | ||
1000 | } | ||
924 | 1001 | ||
925 | return ret; | 1002 | return ret; |
926 | } | 1003 | } |
@@ -933,26 +1010,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
933 | if (engines == null) // No engine at all | 1010 | if (engines == null) // No engine at all |
934 | return ret; | 1011 | return ret; |
935 | 1012 | ||
936 | foreach (TaskInventoryItem item in m_items.Values) | 1013 | lock (m_items) |
937 | { | 1014 | { |
938 | if (item.InvType == (int)InventoryType.LSL) | 1015 | foreach (TaskInventoryItem item in m_items.Values) |
939 | { | 1016 | { |
940 | foreach (IScriptModule e in engines) | 1017 | if (item.InvType == (int)InventoryType.LSL) |
941 | { | 1018 | { |
942 | if (e != null) | 1019 | foreach (IScriptModule e in engines) |
943 | { | 1020 | { |
944 | string n = e.GetXMLState(item.ItemID); | 1021 | if (e != null) |
945 | if (n != String.Empty) | ||
946 | { | 1022 | { |
947 | if (!ret.ContainsKey(item.ItemID)) | 1023 | string n = e.GetXMLState(item.ItemID); |
948 | ret[item.ItemID] = n; | 1024 | if (n != String.Empty) |
949 | break; | 1025 | { |
1026 | if (!ret.ContainsKey(item.ItemID)) | ||
1027 | ret[item.ItemID] = n; | ||
1028 | break; | ||
1029 | } | ||
950 | } | 1030 | } |
951 | } | 1031 | } |
952 | } | 1032 | } |
953 | } | 1033 | } |
954 | } | 1034 | } |
1035 | |||
955 | return ret; | 1036 | return ret; |
956 | } | 1037 | } |
957 | } | 1038 | } |
958 | } | 1039 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index afb5b9a..29f607b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -104,6 +104,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
104 | } | 104 | } |
105 | protected ScenePresenceAnimator m_animator; | 105 | protected ScenePresenceAnimator m_animator; |
106 | 106 | ||
107 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); | ||
108 | |||
107 | private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>(); | 109 | private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>(); |
108 | private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; | 110 | private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; |
109 | private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; | 111 | private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; |
@@ -217,7 +219,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
217 | 219 | ||
218 | protected AvatarAppearance m_appearance; | 220 | protected AvatarAppearance m_appearance; |
219 | 221 | ||
220 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); | ||
221 | public List<SceneObjectGroup> Attachments | 222 | public List<SceneObjectGroup> Attachments |
222 | { | 223 | { |
223 | get { return m_attachments; } | 224 | get { return m_attachments; } |
@@ -636,12 +637,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
636 | #endregion | 637 | #endregion |
637 | 638 | ||
638 | #region Constructor(s) | 639 | #region Constructor(s) |
639 | 640 | ||
640 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) | 641 | public ScenePresence() |
641 | { | 642 | { |
642 | m_animator = new ScenePresenceAnimator(this); | ||
643 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; | 643 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; |
644 | CreateSceneViewer(); | 644 | CreateSceneViewer(); |
645 | m_animator = new ScenePresenceAnimator(this); | ||
646 | } | ||
647 | |||
648 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() | ||
649 | { | ||
645 | m_rootRegionHandle = reginfo.RegionHandle; | 650 | m_rootRegionHandle = reginfo.RegionHandle; |
646 | m_controllingClient = client; | 651 | m_controllingClient = client; |
647 | m_firstname = m_controllingClient.FirstName; | 652 | m_firstname = m_controllingClient.FirstName; |
@@ -665,7 +670,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
665 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); | 670 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); |
666 | m_reprioritization_timer.AutoReset = false; | 671 | m_reprioritization_timer.AutoReset = false; |
667 | 672 | ||
668 | |||
669 | AdjustKnownSeeds(); | 673 | AdjustKnownSeeds(); |
670 | 674 | ||
671 | // TODO: I think, this won't send anything, as we are still a child here... | 675 | // TODO: I think, this won't send anything, as we are still a child here... |
@@ -1294,6 +1298,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1294 | 1298 | ||
1295 | if (m_allowMovement) | 1299 | if (m_allowMovement) |
1296 | { | 1300 | { |
1301 | if (agentData.UseClientAgentPosition) | ||
1302 | { | ||
1303 | m_moveToPositionInProgress = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; | ||
1304 | m_moveToPositionTarget = agentData.ClientAgentPosition; | ||
1305 | } | ||
1306 | |||
1297 | int i = 0; | 1307 | int i = 0; |
1298 | 1308 | ||
1299 | bool update_rotation = false; | 1309 | bool update_rotation = false; |
@@ -1400,7 +1410,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1400 | if (bAllowUpdateMoveToPosition && (m_moveToPositionInProgress && !m_autopilotMoving)) | 1410 | if (bAllowUpdateMoveToPosition && (m_moveToPositionInProgress && !m_autopilotMoving)) |
1401 | { | 1411 | { |
1402 | //Check the error term of the current position in relation to the target position | 1412 | //Check the error term of the current position in relation to the target position |
1403 | if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 1.5f) | 1413 | if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 0.5f) |
1404 | { | 1414 | { |
1405 | // we are close enough to the target | 1415 | // we are close enough to the target |
1406 | m_moveToPositionTarget = Vector3.Zero; | 1416 | m_moveToPositionTarget = Vector3.Zero; |
@@ -2795,7 +2805,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2795 | protected void CrossToNewRegion() | 2805 | protected void CrossToNewRegion() |
2796 | { | 2806 | { |
2797 | InTransit(); | 2807 | InTransit(); |
2798 | m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); | 2808 | try |
2809 | { | ||
2810 | m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); | ||
2811 | } | ||
2812 | catch | ||
2813 | { | ||
2814 | m_scene.CrossAgentToNewRegion(this, false); | ||
2815 | } | ||
2799 | } | 2816 | } |
2800 | 2817 | ||
2801 | public void InTransit() | 2818 | public void InTransit() |
@@ -2873,7 +2890,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2873 | { | 2890 | { |
2874 | RemoveNeighbourRegion(handle); | 2891 | RemoveNeighbourRegion(handle); |
2875 | } | 2892 | } |
2876 | |||
2877 | } | 2893 | } |
2878 | 2894 | ||
2879 | #endregion | 2895 | #endregion |
@@ -3037,7 +3053,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3037 | List<int> attPoints = m_appearance.GetAttachedPoints(); | 3053 | List<int> attPoints = m_appearance.GetAttachedPoints(); |
3038 | if (attPoints != null) | 3054 | if (attPoints != null) |
3039 | { | 3055 | { |
3040 | m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); | 3056 | //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); |
3041 | int i = 0; | 3057 | int i = 0; |
3042 | AttachmentData[] attachs = new AttachmentData[attPoints.Count]; | 3058 | AttachmentData[] attachs = new AttachmentData[attPoints.Count]; |
3043 | foreach (int point in attPoints) | 3059 | foreach (int point in attPoints) |
@@ -3261,17 +3277,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3261 | uint killerObj = 0; | 3277 | uint killerObj = 0; |
3262 | foreach (uint localid in coldata.Keys) | 3278 | foreach (uint localid in coldata.Keys) |
3263 | { | 3279 | { |
3264 | if (coldata[localid].PenetrationDepth <= 0.10f || m_invulnerable) | 3280 | SceneObjectPart part = Scene.GetSceneObjectPart(localid); |
3265 | continue; | ||
3266 | //if (localid == 0) | ||
3267 | //continue; | ||
3268 | |||
3269 | SceneObjectPart part = m_scene.GetSceneObjectPart(localid); | ||
3270 | 3281 | ||
3271 | if (part != null && part.ParentGroup.Damage != -1.0f) | 3282 | if (part != null && part.ParentGroup.Damage != -1.0f) |
3272 | Health -= part.ParentGroup.Damage; | 3283 | Health -= part.ParentGroup.Damage; |
3273 | else | 3284 | else |
3274 | Health -= coldata[localid].PenetrationDepth * 5.0f; | 3285 | { |
3286 | if (coldata[localid].PenetrationDepth >= 0.10f) | ||
3287 | Health -= coldata[localid].PenetrationDepth * 5.0f; | ||
3288 | } | ||
3275 | 3289 | ||
3276 | if (Health <= 0.0f) | 3290 | if (Health <= 0.0f) |
3277 | { | 3291 | { |
@@ -3289,9 +3303,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3289 | } | 3303 | } |
3290 | if (m_health <= 0) | 3304 | if (m_health <= 0) |
3291 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); | 3305 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); |
3292 | } | 3306 | } |
3293 | |||
3294 | |||
3295 | } | 3307 | } |
3296 | 3308 | ||
3297 | public void setHealthWithUpdate(float health) | 3309 | public void setHealthWithUpdate(float health) |
@@ -3338,13 +3350,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3338 | m_animator = null; | 3350 | m_animator = null; |
3339 | } | 3351 | } |
3340 | 3352 | ||
3341 | public ScenePresence() | ||
3342 | { | ||
3343 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; | ||
3344 | CreateSceneViewer(); | ||
3345 | m_animator = new ScenePresenceAnimator(this); | ||
3346 | } | ||
3347 | |||
3348 | public void AddAttachment(SceneObjectGroup gobj) | 3353 | public void AddAttachment(SceneObjectGroup gobj) |
3349 | { | 3354 | { |
3350 | lock (m_attachments) | 3355 | lock (m_attachments) |
@@ -3843,4 +3848,4 @@ namespace OpenSim.Region.Framework.Scenes | |||
3843 | } | 3848 | } |
3844 | } | 3849 | } |
3845 | } | 3850 | } |
3846 | } \ No newline at end of file | 3851 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index b4866b2..2ddc31b 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | |||
@@ -116,7 +116,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
116 | 116 | ||
117 | static string ConvertMRMKeywords(string script) | 117 | static string ConvertMRMKeywords(string script) |
118 | { | 118 | { |
119 | script = script.Replace("microthreaded void ", "IEnumerable"); | 119 | script = script.Replace("microthreaded void", "IEnumerable"); |
120 | script = script.Replace("relax;", "yield return null;"); | 120 | script = script.Replace("relax;", "yield return null;"); |
121 | 121 | ||
122 | return script; | 122 | return script; |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 973aa84..44b2727 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -1575,6 +1575,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1575 | { | 1575 | { |
1576 | //Console.WriteLine("Move " + m_primName); | 1576 | //Console.WriteLine("Move " + m_primName); |
1577 | if (!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 | 1577 | if (!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 |
1578 | /* | ||
1578 | // NON-'VEHICLES' are dealt with here | 1579 | // NON-'VEHICLES' are dealt with here |
1579 | if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) | 1580 | if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) |
1580 | { | 1581 | { |
@@ -1587,6 +1588,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1587 | avel2.Z = 0; | 1588 | avel2.Z = 0; |
1588 | d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z); | 1589 | d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z); |
1589 | } | 1590 | } |
1591 | */ | ||
1590 | //float PID_P = 900.0f; | 1592 | //float PID_P = 900.0f; |
1591 | 1593 | ||
1592 | float m_mass = CalculateMass(); | 1594 | float m_mass = CalculateMass(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ee2a94c..e77425a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -55,7 +55,7 @@ using OpenSim.Services.Interfaces; | |||
55 | using OpenSim.Services.Interfaces; | 55 | using OpenSim.Services.Interfaces; |
56 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 56 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
57 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | 57 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; |
58 | 58 | using PrimType = OpenSim.Region.Framework.Scenes.PrimType; | |
59 | using AssetLandmark = OpenSim.Framework.AssetLandmark; | 59 | using AssetLandmark = OpenSim.Framework.AssetLandmark; |
60 | 60 | ||
61 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; | 61 | using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; |
@@ -1331,44 +1331,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1331 | { | 1331 | { |
1332 | m_host.AddScriptLPS(1); | 1332 | m_host.AddScriptLPS(1); |
1333 | 1333 | ||
1334 | SetColor(m_host, color, face); | 1334 | if (face == ScriptBaseClass.ALL_SIDES) |
1335 | } | 1335 | face = SceneObjectPart.ALL_SIDES; |
1336 | 1336 | ||
1337 | protected void SetColor(SceneObjectPart part, LSL_Vector color, int face) | 1337 | m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); |
1338 | { | ||
1339 | Primitive.TextureEntry tex = part.Shape.Textures; | ||
1340 | Color4 texcolor; | ||
1341 | if (face >= 0 && face < GetNumberOfSides(part)) | ||
1342 | { | ||
1343 | texcolor = tex.CreateFace((uint)face).RGBA; | ||
1344 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
1345 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
1346 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
1347 | tex.FaceTextures[face].RGBA = texcolor; | ||
1348 | part.UpdateTexture(tex); | ||
1349 | return; | ||
1350 | } | ||
1351 | else if (face == ScriptBaseClass.ALL_SIDES) | ||
1352 | { | ||
1353 | for (uint i = 0; i < GetNumberOfSides(part); i++) | ||
1354 | { | ||
1355 | if (tex.FaceTextures[i] != null) | ||
1356 | { | ||
1357 | texcolor = tex.FaceTextures[i].RGBA; | ||
1358 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
1359 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
1360 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
1361 | tex.FaceTextures[i].RGBA = texcolor; | ||
1362 | } | ||
1363 | texcolor = tex.DefaultTexture.RGBA; | ||
1364 | texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); | ||
1365 | texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); | ||
1366 | texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); | ||
1367 | tex.DefaultTexture.RGBA = texcolor; | ||
1368 | } | ||
1369 | part.UpdateTexture(tex); | ||
1370 | return; | ||
1371 | } | ||
1372 | } | 1338 | } |
1373 | 1339 | ||
1374 | public void SetTexGen(SceneObjectPart part, int face,int style) | 1340 | public void SetTexGen(SceneObjectPart part, int face,int style) |
@@ -1515,7 +1481,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1515 | { | 1481 | { |
1516 | int i; | 1482 | int i; |
1517 | double sum = 0.0; | 1483 | double sum = 0.0; |
1518 | for (i = 0 ; i < GetNumberOfSides(part) ; i++) | 1484 | for (i = 0 ; i < GetNumberOfSides(part); i++) |
1519 | sum += (double)tex.GetFace((uint)i).RGBA.A; | 1485 | sum += (double)tex.GetFace((uint)i).RGBA.A; |
1520 | return sum; | 1486 | return sum; |
1521 | } | 1487 | } |
@@ -1662,7 +1628,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1662 | { | 1628 | { |
1663 | int i; | 1629 | int i; |
1664 | 1630 | ||
1665 | for (i = 0 ; i < GetNumberOfSides(part) ; i++) | 1631 | for (i = 0 ; i < GetNumberOfSides(part); i++) |
1666 | { | 1632 | { |
1667 | texcolor = tex.GetFace((uint)i).RGBA; | 1633 | texcolor = tex.GetFace((uint)i).RGBA; |
1668 | rgb.x += texcolor.R; | 1634 | rgb.x += texcolor.R; |
@@ -3415,7 +3381,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3415 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | 3381 | List<SceneObjectPart> parts = GetLinkParts(linknumber); |
3416 | 3382 | ||
3417 | foreach (SceneObjectPart part in parts) | 3383 | foreach (SceneObjectPart part in parts) |
3418 | SetColor(part, color, face); | 3384 | part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); |
3419 | } | 3385 | } |
3420 | 3386 | ||
3421 | public void llCreateLink(string target, int parent) | 3387 | public void llCreateLink(string target, int parent) |
@@ -4262,7 +4228,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4262 | { | 4228 | { |
4263 | if (item.Type == 10 && item.ItemID == m_itemID) | 4229 | if (item.Type == 10 && item.ItemID == m_itemID) |
4264 | { | 4230 | { |
4265 | result = item.Name!=null?item.Name:String.Empty; | 4231 | result = item.Name != null ? item.Name : String.Empty; |
4266 | break; | 4232 | break; |
4267 | } | 4233 | } |
4268 | } | 4234 | } |
@@ -4271,63 +4237,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4271 | return result; | 4237 | return result; |
4272 | } | 4238 | } |
4273 | 4239 | ||
4274 | // this function to understand which shape it is (taken from meshmerizer) | ||
4275 | // quite useful can be used by meshmerizer to have a centralized point of understanding the shape | ||
4276 | // except that it refers to scripting constants | ||
4277 | public int getScriptPrimType(PrimitiveBaseShape primShape) | ||
4278 | { | ||
4279 | if (primShape.SculptEntry) | ||
4280 | return ScriptBaseClass.PRIM_TYPE_SCULPT; | ||
4281 | if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) | ||
4282 | { | ||
4283 | if (primShape.PathCurve == (byte)Extrusion.Straight) | ||
4284 | return ScriptBaseClass.PRIM_TYPE_BOX; | ||
4285 | else if (primShape.PathCurve == (byte)Extrusion.Curve1) | ||
4286 | return ScriptBaseClass.PRIM_TYPE_TUBE; | ||
4287 | } | ||
4288 | else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) | ||
4289 | { | ||
4290 | if (primShape.PathCurve == (byte)Extrusion.Straight) | ||
4291 | return ScriptBaseClass.PRIM_TYPE_CYLINDER; | ||
4292 | // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits | ||
4293 | else if (primShape.PathCurve == (byte)Extrusion.Curve1) | ||
4294 | return ScriptBaseClass.PRIM_TYPE_TORUS; | ||
4295 | } | ||
4296 | else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) | ||
4297 | { | ||
4298 | if (primShape.PathCurve == (byte)Extrusion.Curve1 || primShape.PathCurve == (byte)Extrusion.Curve2) | ||
4299 | return ScriptBaseClass.PRIM_TYPE_SPHERE; | ||
4300 | } | ||
4301 | else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) | ||
4302 | { | ||
4303 | if (primShape.PathCurve == (byte)Extrusion.Straight) | ||
4304 | return ScriptBaseClass.PRIM_TYPE_PRISM; | ||
4305 | else if (primShape.PathCurve == (byte)Extrusion.Curve1) | ||
4306 | return ScriptBaseClass.PRIM_TYPE_RING; | ||
4307 | } | ||
4308 | return ScriptBaseClass.PRIM_TYPE_BOX; | ||
4309 | } | ||
4310 | |||
4311 | // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces | ||
4312 | protected void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, | ||
4313 | out bool hasDimple, out bool hasProfileCut) | ||
4314 | { | ||
4315 | if (primType == ScriptBaseClass.PRIM_TYPE_BOX | ||
4316 | || | ||
4317 | primType == ScriptBaseClass.PRIM_TYPE_CYLINDER | ||
4318 | || | ||
4319 | primType == ScriptBaseClass.PRIM_TYPE_PRISM) | ||
4320 | |||
4321 | hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); | ||
4322 | else | ||
4323 | hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0); | ||
4324 | |||
4325 | hasHollow = shape.ProfileHollow > 0; | ||
4326 | hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms | ||
4327 | hasProfileCut = hasDimple; // is it the same thing? | ||
4328 | |||
4329 | } | ||
4330 | |||
4331 | public LSL_Integer llGetNumberOfSides() | 4240 | public LSL_Integer llGetNumberOfSides() |
4332 | { | 4241 | { |
4333 | m_host.AddScriptLPS(1); | 4242 | m_host.AddScriptLPS(1); |
@@ -4337,63 +4246,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4337 | 4246 | ||
4338 | protected int GetNumberOfSides(SceneObjectPart part) | 4247 | protected int GetNumberOfSides(SceneObjectPart part) |
4339 | { | 4248 | { |
4340 | int ret = 0; | 4249 | int sides = part.GetNumberOfSides(); |
4341 | bool hasCut; | ||
4342 | bool hasHollow; | ||
4343 | bool hasDimple; | ||
4344 | bool hasProfileCut; | ||
4345 | |||
4346 | int primType = getScriptPrimType(part.Shape); | ||
4347 | hasCutHollowDimpleProfileCut(primType, part.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); | ||
4348 | 4250 | ||
4349 | switch (primType) | 4251 | if (part.GetPrimType() == PrimType.SPHERE && part.Shape.ProfileHollow > 0) |
4350 | { | 4252 | { |
4351 | case ScriptBaseClass.PRIM_TYPE_BOX: | 4253 | // Make up for a bug where LSL shows 4 sides rather than 2 |
4352 | ret = 6; | 4254 | sides += 2; |
4353 | if (hasCut) ret += 2; | ||
4354 | if (hasHollow) ret += 1; | ||
4355 | break; | ||
4356 | case ScriptBaseClass.PRIM_TYPE_CYLINDER: | ||
4357 | ret = 3; | ||
4358 | if (hasCut) ret += 2; | ||
4359 | if (hasHollow) ret += 1; | ||
4360 | break; | ||
4361 | case ScriptBaseClass.PRIM_TYPE_PRISM: | ||
4362 | ret = 5; | ||
4363 | if (hasCut) ret += 2; | ||
4364 | if (hasHollow) ret += 1; | ||
4365 | break; | ||
4366 | case ScriptBaseClass.PRIM_TYPE_SPHERE: | ||
4367 | ret = 1; | ||
4368 | if (hasCut) ret += 2; | ||
4369 | if (hasDimple) ret += 2; | ||
4370 | if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1) | ||
4371 | break; | ||
4372 | case ScriptBaseClass.PRIM_TYPE_TORUS: | ||
4373 | ret = 1; | ||
4374 | if (hasCut) ret += 2; | ||
4375 | if (hasProfileCut) ret += 2; | ||
4376 | if (hasHollow) ret += 1; | ||
4377 | break; | ||
4378 | case ScriptBaseClass.PRIM_TYPE_TUBE: | ||
4379 | ret = 4; | ||
4380 | if (hasCut) ret += 2; | ||
4381 | if (hasProfileCut) ret += 2; | ||
4382 | if (hasHollow) ret += 1; | ||
4383 | break; | ||
4384 | case ScriptBaseClass.PRIM_TYPE_RING: | ||
4385 | ret = 3; | ||
4386 | if (hasCut) ret += 2; | ||
4387 | if (hasProfileCut) ret += 2; | ||
4388 | if (hasHollow) ret += 1; | ||
4389 | break; | ||
4390 | case ScriptBaseClass.PRIM_TYPE_SCULPT: | ||
4391 | ret = 1; | ||
4392 | break; | ||
4393 | } | 4255 | } |
4394 | return ret; | ||
4395 | } | ||
4396 | 4256 | ||
4257 | return sides; | ||
4258 | } | ||
4259 | |||
4397 | 4260 | ||
4398 | /* The new / changed functions were tested with the following LSL script: | 4261 | /* The new / changed functions were tested with the following LSL script: |
4399 | 4262 | ||
@@ -4418,8 +4281,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4418 | } | 4281 | } |
4419 | */ | 4282 | */ |
4420 | 4283 | ||
4421 | |||
4422 | |||
4423 | // Xantor 29/apr/2008 | 4284 | // Xantor 29/apr/2008 |
4424 | // Returns rotation described by rotating angle radians about axis. | 4285 | // Returns rotation described by rotating angle radians about axis. |
4425 | // q = cos(a/2) + i (x * sin(a/2)) + j (y * sin(a/2)) + k (z * sin(a/2)) | 4286 | // q = cos(a/2) + i (x * sin(a/2)) + j (y * sin(a/2)) + k (z * sin(a/2)) |
@@ -7020,10 +6881,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7020 | LSL_Vector color=rules.GetVector3Item(idx++); | 6881 | LSL_Vector color=rules.GetVector3Item(idx++); |
7021 | double alpha=(double)rules.GetLSLFloatItem(idx++); | 6882 | double alpha=(double)rules.GetLSLFloatItem(idx++); |
7022 | 6883 | ||
7023 | SetColor(part, color, face); | 6884 | part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); |
7024 | SetAlpha(part, alpha, face); | 6885 | SetAlpha(part, alpha, face); |
7025 | 6886 | ||
7026 | break; | 6887 | break; |
6888 | |||
7027 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: | 6889 | case (int)ScriptBaseClass.PRIM_FLEXIBLE: |
7028 | if (remain < 7) | 6890 | if (remain < 7) |
7029 | return; | 6891 | return; |
@@ -7039,6 +6901,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7039 | SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); | 6901 | SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); |
7040 | 6902 | ||
7041 | break; | 6903 | break; |
6904 | |||
7042 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: | 6905 | case (int)ScriptBaseClass.PRIM_POINT_LIGHT: |
7043 | if (remain < 5) | 6906 | if (remain < 5) |
7044 | return; | 6907 | return; |
@@ -7051,6 +6914,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7051 | SetPointLight(part, light, lightcolor, intensity, radius, falloff); | 6914 | SetPointLight(part, light, lightcolor, intensity, radius, falloff); |
7052 | 6915 | ||
7053 | break; | 6916 | break; |
6917 | |||
7054 | case (int)ScriptBaseClass.PRIM_GLOW: | 6918 | case (int)ScriptBaseClass.PRIM_GLOW: |
7055 | if (remain < 2) | 6919 | if (remain < 2) |
7056 | return; | 6920 | return; |
@@ -7060,6 +6924,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7060 | SetGlow(part, face, glow); | 6924 | SetGlow(part, face, glow); |
7061 | 6925 | ||
7062 | break; | 6926 | break; |
6927 | |||
7063 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: | 6928 | case (int)ScriptBaseClass.PRIM_BUMP_SHINY: |
7064 | if (remain < 3) | 6929 | if (remain < 3) |
7065 | return; | 6930 | return; |
@@ -7070,6 +6935,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7070 | SetShiny(part, face, shiny, bump); | 6935 | SetShiny(part, face, shiny, bump); |
7071 | 6936 | ||
7072 | break; | 6937 | break; |
6938 | |||
7073 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: | 6939 | case (int)ScriptBaseClass.PRIM_FULLBRIGHT: |
7074 | if (remain < 2) | 6940 | if (remain < 2) |
7075 | return; | 6941 | return; |
@@ -7077,6 +6943,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7077 | bool st = rules.GetLSLIntegerItem(idx++); | 6943 | bool st = rules.GetLSLIntegerItem(idx++); |
7078 | SetFullBright(part, face , st); | 6944 | SetFullBright(part, face , st); |
7079 | break; | 6945 | break; |
6946 | |||
7080 | case (int)ScriptBaseClass.PRIM_MATERIAL: | 6947 | case (int)ScriptBaseClass.PRIM_MATERIAL: |
7081 | if (remain < 1) | 6948 | if (remain < 1) |
7082 | return; | 6949 | return; |
@@ -7086,6 +6953,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7086 | 6953 | ||
7087 | part.Material = Convert.ToByte(mat); | 6954 | part.Material = Convert.ToByte(mat); |
7088 | break; | 6955 | break; |
6956 | |||
7089 | case (int)ScriptBaseClass.PRIM_PHANTOM: | 6957 | case (int)ScriptBaseClass.PRIM_PHANTOM: |
7090 | if (remain < 1) | 6958 | if (remain < 1) |
7091 | return; | 6959 | return; |
@@ -7100,6 +6968,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7100 | 6968 | ||
7101 | part.ScriptSetPhantomStatus(phantom); | 6969 | part.ScriptSetPhantomStatus(phantom); |
7102 | break; | 6970 | break; |
6971 | |||
7103 | case (int)ScriptBaseClass.PRIM_PHYSICS: | 6972 | case (int)ScriptBaseClass.PRIM_PHYSICS: |
7104 | if (remain < 1) | 6973 | if (remain < 1) |
7105 | return; | 6974 | return; |
@@ -7113,6 +6982,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7113 | 6982 | ||
7114 | part.ScriptSetPhysicsStatus(physics); | 6983 | part.ScriptSetPhysicsStatus(physics); |
7115 | break; | 6984 | break; |
6985 | |||
7116 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: | 6986 | case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: |
7117 | if (remain < 1) | 6987 | if (remain < 1) |
7118 | return; | 6988 | return; |
@@ -7380,7 +7250,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7380 | 7250 | ||
7381 | public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) | 7251 | public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) |
7382 | { | 7252 | { |
7383 | |||
7384 | LSL_List res = new LSL_List(); | 7253 | LSL_List res = new LSL_List(); |
7385 | int idx=0; | 7254 | int idx=0; |
7386 | while (idx < rules.Length) | 7255 | while (idx < rules.Length) |
@@ -7442,7 +7311,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7442 | case (int)ScriptBaseClass.PRIM_TYPE: | 7311 | case (int)ScriptBaseClass.PRIM_TYPE: |
7443 | // implementing box | 7312 | // implementing box |
7444 | PrimitiveBaseShape Shape = part.Shape; | 7313 | PrimitiveBaseShape Shape = part.Shape; |
7445 | int primType = getScriptPrimType(part.Shape); | 7314 | int primType = (int)part.GetPrimType(); |
7446 | res.Add(new LSL_Integer(primType)); | 7315 | res.Add(new LSL_Integer(primType)); |
7447 | double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX | 7316 | double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX |
7448 | double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY. | 7317 | double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY. |
@@ -7522,7 +7391,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7522 | Primitive.TextureEntry tex = part.Shape.Textures; | 7391 | Primitive.TextureEntry tex = part.Shape.Textures; |
7523 | if (face == ScriptBaseClass.ALL_SIDES) | 7392 | if (face == ScriptBaseClass.ALL_SIDES) |
7524 | { | 7393 | { |
7525 | for (face = 0 ; face < GetNumberOfSides(part) ; face++) | 7394 | for (face = 0 ; face < GetNumberOfSides(part); face++) |
7526 | { | 7395 | { |
7527 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | 7396 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); |
7528 | 7397 | ||
@@ -7564,7 +7433,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7564 | Color4 texcolor; | 7433 | Color4 texcolor; |
7565 | if (face == ScriptBaseClass.ALL_SIDES) | 7434 | if (face == ScriptBaseClass.ALL_SIDES) |
7566 | { | 7435 | { |
7567 | for (face = 0 ; face < GetNumberOfSides(part) ; face++) | 7436 | for (face = 0 ; face < GetNumberOfSides(part); face++) |
7568 | { | 7437 | { |
7569 | texcolor = tex.GetFace((uint)face).RGBA; | 7438 | texcolor = tex.GetFace((uint)face).RGBA; |
7570 | res.Add(new LSL_Vector(texcolor.R, | 7439 | res.Add(new LSL_Vector(texcolor.R, |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index 16309ef..09b79d0 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs | |||
@@ -55,6 +55,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
55 | m_log.Info("[XEngine] Hooking up to server events"); | 55 | m_log.Info("[XEngine] Hooking up to server events"); |
56 | myScriptEngine.World.EventManager.OnAttach += attach; | 56 | myScriptEngine.World.EventManager.OnAttach += attach; |
57 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; | 57 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; |
58 | myScriptEngine.World.EventManager.OnObjectGrabbing += touch; | ||
58 | myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; | 59 | myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; |
59 | myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; | 60 | myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; |
60 | myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; | 61 | myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; |
@@ -148,7 +149,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
148 | } | 149 | } |
149 | 150 | ||
150 | public void touch(uint localID, uint originalID, Vector3 offsetPos, | 151 | public void touch(uint localID, uint originalID, Vector3 offsetPos, |
151 | IClientAPI remoteClient) | 152 | IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) |
152 | { | 153 | { |
153 | // Add to queue for all scripts in ObjectID object | 154 | // Add to queue for all scripts in ObjectID object |
154 | DetectParams[] det = new DetectParams[1]; | 155 | DetectParams[] det = new DetectParams[1]; |
@@ -172,6 +173,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
172 | SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID); | 173 | SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID); |
173 | det[0].LinkNum = originalPart.LinkNum; | 174 | det[0].LinkNum = originalPart.LinkNum; |
174 | } | 175 | } |
176 | if (surfaceArgs != null) | ||
177 | { | ||
178 | det[0].SurfaceTouchArgs = surfaceArgs; | ||
179 | } | ||
175 | 180 | ||
176 | myScriptEngine.PostObjectEvent(localID, new EventParams( | 181 | myScriptEngine.PostObjectEvent(localID, new EventParams( |
177 | "touch", new Object[] { new LSL_Types.LSLInteger(1) }, | 182 | "touch", new Object[] { new LSL_Types.LSLInteger(1) }, |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 6dd94bb..c552b92 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -806,12 +806,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
806 | instance.ClearQueue(); | 806 | instance.ClearQueue(); |
807 | instance.Stop(0); | 807 | instance.Stop(0); |
808 | 808 | ||
809 | SceneObjectPart part = | ||
810 | m_Scene.GetSceneObjectPart(localID); | ||
811 | |||
812 | if (part != null) | ||
813 | part.RemoveScriptEvents(itemID); | ||
814 | |||
815 | // bool objectRemoved = false; | 809 | // bool objectRemoved = false; |
816 | 810 | ||
817 | lock (m_PrimObjects) | 811 | lock (m_PrimObjects) |
@@ -846,7 +840,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
846 | 840 | ||
847 | ObjectRemoved handlerObjectRemoved = OnObjectRemoved; | 841 | ObjectRemoved handlerObjectRemoved = OnObjectRemoved; |
848 | if (handlerObjectRemoved != null) | 842 | if (handlerObjectRemoved != null) |
843 | { | ||
844 | SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); | ||
849 | handlerObjectRemoved(part.UUID); | 845 | handlerObjectRemoved(part.UUID); |
846 | } | ||
850 | 847 | ||
851 | CleanAssemblies(); | 848 | CleanAssemblies(); |
852 | } | 849 | } |