diff options
Diffstat (limited to '')
11 files changed, 599 insertions, 94 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs new file mode 100644 index 0000000..e951d9e --- /dev/null +++ b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs | |||
@@ -0,0 +1,215 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Linq; | ||
31 | using System.Reflection; | ||
32 | using System.Text; | ||
33 | using log4net; | ||
34 | using Mono.Addins; | ||
35 | using Nini.Config; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Console; | ||
39 | using OpenSim.Framework.Monitoring; | ||
40 | using OpenSim.Region.ClientStack.LindenUDP; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | using OpenSim.Region.Framework.Scenes.Animation; | ||
44 | using OpenSim.Services.Interfaces; | ||
45 | |||
46 | namespace OpenSim.Region.OptionalModules.Avatar.Animations | ||
47 | { | ||
48 | /// <summary> | ||
49 | /// A module that just holds commands for inspecting avatar animations. | ||
50 | /// </summary> | ||
51 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AnimationsCommandModule")] | ||
52 | public class AnimationsCommandModule : ISharedRegionModule | ||
53 | { | ||
54 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | |||
56 | private List<Scene> m_scenes = new List<Scene>(); | ||
57 | |||
58 | public string Name { get { return "Animations Command Module"; } } | ||
59 | |||
60 | public Type ReplaceableInterface { get { return null; } } | ||
61 | |||
62 | public void Initialise(IConfigSource source) | ||
63 | { | ||
64 | // m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: INITIALIZED MODULE"); | ||
65 | } | ||
66 | |||
67 | public void PostInitialise() | ||
68 | { | ||
69 | // m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: POST INITIALIZED MODULE"); | ||
70 | } | ||
71 | |||
72 | public void Close() | ||
73 | { | ||
74 | // m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: CLOSED MODULE"); | ||
75 | } | ||
76 | |||
77 | public void AddRegion(Scene scene) | ||
78 | { | ||
79 | // m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | ||
80 | } | ||
81 | |||
82 | public void RemoveRegion(Scene scene) | ||
83 | { | ||
84 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); | ||
85 | |||
86 | lock (m_scenes) | ||
87 | m_scenes.Remove(scene); | ||
88 | } | ||
89 | |||
90 | public void RegionLoaded(Scene scene) | ||
91 | { | ||
92 | // m_log.DebugFormat("[ANIMATIONS COMMAND MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | ||
93 | |||
94 | lock (m_scenes) | ||
95 | m_scenes.Add(scene); | ||
96 | |||
97 | scene.AddCommand( | ||
98 | "Users", this, "show animations", | ||
99 | "show animations [<first-name> <last-name>]", | ||
100 | "Show animation information for avatars in this simulator.", | ||
101 | "If no name is supplied then information for all avatars is shown.\n" | ||
102 | + "Please note that for inventory animations, the animation name is the name under which the animation was originally uploaded\n" | ||
103 | + ", which is not necessarily the current inventory name.", | ||
104 | HandleShowAnimationsCommand); | ||
105 | } | ||
106 | |||
107 | protected void HandleShowAnimationsCommand(string module, string[] cmd) | ||
108 | { | ||
109 | if (cmd.Length != 2 && cmd.Length < 4) | ||
110 | { | ||
111 | MainConsole.Instance.OutputFormat("Usage: show animations [<first-name> <last-name>]"); | ||
112 | return; | ||
113 | } | ||
114 | |||
115 | bool targetNameSupplied = false; | ||
116 | string optionalTargetFirstName = null; | ||
117 | string optionalTargetLastName = null; | ||
118 | |||
119 | if (cmd.Length >= 4) | ||
120 | { | ||
121 | targetNameSupplied = true; | ||
122 | optionalTargetFirstName = cmd[2]; | ||
123 | optionalTargetLastName = cmd[3]; | ||
124 | } | ||
125 | |||
126 | StringBuilder sb = new StringBuilder(); | ||
127 | |||
128 | lock (m_scenes) | ||
129 | { | ||
130 | foreach (Scene scene in m_scenes) | ||
131 | { | ||
132 | if (targetNameSupplied) | ||
133 | { | ||
134 | ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName); | ||
135 | if (sp != null && !sp.IsChildAgent) | ||
136 | GetAttachmentsReport(sp, sb); | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | scene.ForEachRootScenePresence(sp => GetAttachmentsReport(sp, sb)); | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | |||
145 | MainConsole.Instance.Output(sb.ToString()); | ||
146 | } | ||
147 | |||
148 | private void GetAttachmentsReport(ScenePresence sp, StringBuilder sb) | ||
149 | { | ||
150 | sb.AppendFormat("Animations for {0}\n", sp.Name); | ||
151 | |||
152 | ConsoleDisplayList cdl = new ConsoleDisplayList() { Indent = 2 }; | ||
153 | ScenePresenceAnimator spa = sp.Animator; | ||
154 | AnimationSet anims = sp.Animator.Animations; | ||
155 | |||
156 | string cma = spa.CurrentMovementAnimation; | ||
157 | cdl.AddRow( | ||
158 | "Current movement anim", | ||
159 | string.Format("{0}, {1}", DefaultAvatarAnimations.GetDefaultAnimation(cma), cma)); | ||
160 | |||
161 | UUID defaultAnimId = anims.DefaultAnimation.AnimID; | ||
162 | cdl.AddRow( | ||
163 | "Default anim", | ||
164 | string.Format("{0}, {1}", defaultAnimId, GetAnimName(sp.Scene.AssetService, defaultAnimId))); | ||
165 | |||
166 | UUID implicitDefaultAnimId = anims.ImplicitDefaultAnimation.AnimID; | ||
167 | cdl.AddRow( | ||
168 | "Implicit default anim", | ||
169 | string.Format("{0}, {1}", implicitDefaultAnimId, GetAnimName(sp.Scene.AssetService, implicitDefaultAnimId))); | ||
170 | |||
171 | cdl.AddToStringBuilder(sb); | ||
172 | |||
173 | ConsoleDisplayTable cdt = new ConsoleDisplayTable() { Indent = 2 }; | ||
174 | cdt.AddColumn("Animation ID", 36); | ||
175 | cdt.AddColumn("Name", 20); | ||
176 | cdt.AddColumn("Seq", 3); | ||
177 | cdt.AddColumn("Object ID", 36); | ||
178 | |||
179 | UUID[] animIds; | ||
180 | int[] sequenceNumbers; | ||
181 | UUID[] objectIds; | ||
182 | |||
183 | sp.Animator.Animations.GetArrays(out animIds, out sequenceNumbers, out objectIds); | ||
184 | |||
185 | for (int i = 0; i < animIds.Length; i++) | ||
186 | { | ||
187 | UUID animId = animIds[i]; | ||
188 | string animName = GetAnimName(sp.Scene.AssetService, animId); | ||
189 | int seq = sequenceNumbers[i]; | ||
190 | UUID objectId = objectIds[i]; | ||
191 | |||
192 | cdt.AddRow(animId, animName, seq, objectId); | ||
193 | } | ||
194 | |||
195 | cdt.AddToStringBuilder(sb); | ||
196 | sb.Append("\n"); | ||
197 | } | ||
198 | |||
199 | private string GetAnimName(IAssetService assetService, UUID animId) | ||
200 | { | ||
201 | string animName; | ||
202 | |||
203 | if (!DefaultAvatarAnimations.AnimsNames.TryGetValue(animId, out animName)) | ||
204 | { | ||
205 | AssetMetadata amd = assetService.GetMetadata(animId.ToString()); | ||
206 | if (amd != null) | ||
207 | animName = amd.Name; | ||
208 | else | ||
209 | animName = "Unknown"; | ||
210 | } | ||
211 | |||
212 | return animName; | ||
213 | } | ||
214 | } | ||
215 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs index 68bcb4a..d97e3b3 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/AttachmentsCommandModule.cs | |||
@@ -97,6 +97,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments | |||
97 | "Users", this, "attachments show", | 97 | "Users", this, "attachments show", |
98 | "attachments show [<first-name> <last-name>]", | 98 | "attachments show [<first-name> <last-name>]", |
99 | "Show attachment information for avatars in this simulator.", | 99 | "Show attachment information for avatars in this simulator.", |
100 | "If no name is supplied then information for all avatars is shown.", | ||
100 | HandleShowAttachmentsCommand); | 101 | HandleShowAttachmentsCommand); |
101 | } | 102 | } |
102 | 103 | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index ae0ad02..d764936 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -126,7 +126,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
126 | { | 126 | { |
127 | scene.RegisterModuleInterface<IGroupsModule>(this); | 127 | scene.RegisterModuleInterface<IGroupsModule>(this); |
128 | scene.AddCommand( | 128 | scene.AddCommand( |
129 | "debug", | 129 | "Debug", |
130 | this, | 130 | this, |
131 | "debug groups verbose", | 131 | "debug groups verbose", |
132 | "debug groups verbose <true|false>", | 132 | "debug groups verbose <true|false>", |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs index 6d26075..6b5b40a 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs | |||
@@ -36,7 +36,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
36 | { | 36 | { |
37 | UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); | 37 | UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID); |
38 | void UpdateGroup(UUID RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); | 38 | void UpdateGroup(UUID RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); |
39 | |||
40 | /// <summary> | ||
41 | /// Get the group record. | ||
42 | /// </summary> | ||
43 | /// <returns></returns> | ||
44 | /// <param name='RequestingAgentID'>The UUID of the user making the request.</param> | ||
45 | /// <param name='GroupID'> | ||
46 | /// The ID of the record to retrieve. | ||
47 | /// GroupName may be specified instead, in which case this parameter will be UUID.Zero | ||
48 | /// </param> | ||
49 | /// <param name='GroupName'> | ||
50 | /// The name of the group to retrieve. | ||
51 | /// GroupID may be specified instead, in which case this parmeter will be null. | ||
52 | /// </param> | ||
39 | GroupRecord GetGroupRecord(UUID RequestingAgentID, UUID GroupID, string GroupName); | 53 | GroupRecord GetGroupRecord(UUID RequestingAgentID, UUID GroupID, string GroupName); |
54 | |||
40 | List<DirGroupsReplyData> FindGroups(UUID RequestingAgentID, string search); | 55 | List<DirGroupsReplyData> FindGroups(UUID RequestingAgentID, string search); |
41 | List<GroupMembersData> GetGroupMembers(UUID RequestingAgentID, UUID GroupID); | 56 | List<GroupMembersData> GetGroupMembers(UUID RequestingAgentID, UUID GroupID); |
42 | 57 | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index ac638f1..c1bdacb 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests | |||
42 | /// Basic groups module tests | 42 | /// Basic groups module tests |
43 | /// </summary> | 43 | /// </summary> |
44 | [TestFixture] | 44 | [TestFixture] |
45 | public class GroupsModuleTests | 45 | public class GroupsModuleTests : OpenSimTestCase |
46 | { | 46 | { |
47 | [Test] | 47 | [Test] |
48 | public void TestBasic() | 48 | public void TestBasic() |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index d0c3ea5..1101851 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -54,13 +54,62 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
54 | 54 | ||
55 | private bool m_debugEnabled = false; | 55 | private bool m_debugEnabled = false; |
56 | 56 | ||
57 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | | 57 | public const GroupPowers DefaultEveryonePowers |
58 | GroupPowers.Accountable | | 58 | = GroupPowers.AllowSetHome |
59 | GroupPowers.JoinChat | | 59 | | GroupPowers.Accountable |
60 | GroupPowers.AllowVoiceChat | | 60 | | GroupPowers.JoinChat |
61 | GroupPowers.ReceiveNotices | | 61 | | GroupPowers.AllowVoiceChat |
62 | GroupPowers.StartProposal | | 62 | | GroupPowers.ReceiveNotices |
63 | GroupPowers.VoteOnProposal; | 63 | | GroupPowers.StartProposal |
64 | | GroupPowers.VoteOnProposal; | ||
65 | |||
66 | // Would this be cleaner as (GroupPowers)ulong.MaxValue? | ||
67 | public const GroupPowers DefaultOwnerPowers | ||
68 | = GroupPowers.Accountable | ||
69 | | GroupPowers.AllowEditLand | ||
70 | | GroupPowers.AllowFly | ||
71 | | GroupPowers.AllowLandmark | ||
72 | | GroupPowers.AllowRez | ||
73 | | GroupPowers.AllowSetHome | ||
74 | | GroupPowers.AllowVoiceChat | ||
75 | | GroupPowers.AssignMember | ||
76 | | GroupPowers.AssignMemberLimited | ||
77 | | GroupPowers.ChangeActions | ||
78 | | GroupPowers.ChangeIdentity | ||
79 | | GroupPowers.ChangeMedia | ||
80 | | GroupPowers.ChangeOptions | ||
81 | | GroupPowers.CreateRole | ||
82 | | GroupPowers.DeedObject | ||
83 | | GroupPowers.DeleteRole | ||
84 | | GroupPowers.Eject | ||
85 | | GroupPowers.FindPlaces | ||
86 | | GroupPowers.Invite | ||
87 | | GroupPowers.JoinChat | ||
88 | | GroupPowers.LandChangeIdentity | ||
89 | | GroupPowers.LandDeed | ||
90 | | GroupPowers.LandDivideJoin | ||
91 | | GroupPowers.LandEdit | ||
92 | | GroupPowers.LandEjectAndFreeze | ||
93 | | GroupPowers.LandGardening | ||
94 | | GroupPowers.LandManageAllowed | ||
95 | | GroupPowers.LandManageBanned | ||
96 | | GroupPowers.LandManagePasses | ||
97 | | GroupPowers.LandOptions | ||
98 | | GroupPowers.LandRelease | ||
99 | | GroupPowers.LandSetSale | ||
100 | | GroupPowers.ModerateChat | ||
101 | | GroupPowers.ObjectManipulate | ||
102 | | GroupPowers.ObjectSetForSale | ||
103 | | GroupPowers.ReceiveNotices | ||
104 | | GroupPowers.RemoveMember | ||
105 | | GroupPowers.ReturnGroupOwned | ||
106 | | GroupPowers.ReturnGroupSet | ||
107 | | GroupPowers.ReturnNonGroup | ||
108 | | GroupPowers.RoleProperties | ||
109 | | GroupPowers.SendNotices | ||
110 | | GroupPowers.SetLandingPoint | ||
111 | | GroupPowers.StartProposal | ||
112 | | GroupPowers.VoteOnProposal; | ||
64 | 113 | ||
65 | private bool m_connectorEnabled = false; | 114 | private bool m_connectorEnabled = false; |
66 | 115 | ||
@@ -219,59 +268,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
219 | param["AllowPublish"] = allowPublish == true ? 1 : 0; | 268 | param["AllowPublish"] = allowPublish == true ? 1 : 0; |
220 | param["MaturePublish"] = maturePublish == true ? 1 : 0; | 269 | param["MaturePublish"] = maturePublish == true ? 1 : 0; |
221 | param["FounderID"] = founderID.ToString(); | 270 | param["FounderID"] = founderID.ToString(); |
222 | param["EveryonePowers"] = ((ulong)m_DefaultEveryonePowers).ToString(); | 271 | param["EveryonePowers"] = ((ulong)DefaultEveryonePowers).ToString(); |
223 | param["OwnerRoleID"] = OwnerRoleID.ToString(); | 272 | param["OwnerRoleID"] = OwnerRoleID.ToString(); |
224 | 273 | param["OwnersPowers"] = ((ulong)DefaultOwnerPowers).ToString(); | |
225 | // Would this be cleaner as (GroupPowers)ulong.MaxValue; | ||
226 | GroupPowers OwnerPowers = GroupPowers.Accountable | ||
227 | | GroupPowers.AllowEditLand | ||
228 | | GroupPowers.AllowFly | ||
229 | | GroupPowers.AllowLandmark | ||
230 | | GroupPowers.AllowRez | ||
231 | | GroupPowers.AllowSetHome | ||
232 | | GroupPowers.AllowVoiceChat | ||
233 | | GroupPowers.AssignMember | ||
234 | | GroupPowers.AssignMemberLimited | ||
235 | | GroupPowers.ChangeActions | ||
236 | | GroupPowers.ChangeIdentity | ||
237 | | GroupPowers.ChangeMedia | ||
238 | | GroupPowers.ChangeOptions | ||
239 | | GroupPowers.CreateRole | ||
240 | | GroupPowers.DeedObject | ||
241 | | GroupPowers.DeleteRole | ||
242 | | GroupPowers.Eject | ||
243 | | GroupPowers.FindPlaces | ||
244 | | GroupPowers.Invite | ||
245 | | GroupPowers.JoinChat | ||
246 | | GroupPowers.LandChangeIdentity | ||
247 | | GroupPowers.LandDeed | ||
248 | | GroupPowers.LandDivideJoin | ||
249 | | GroupPowers.LandEdit | ||
250 | | GroupPowers.LandEjectAndFreeze | ||
251 | | GroupPowers.LandGardening | ||
252 | | GroupPowers.LandManageAllowed | ||
253 | | GroupPowers.LandManageBanned | ||
254 | | GroupPowers.LandManagePasses | ||
255 | | GroupPowers.LandOptions | ||
256 | | GroupPowers.LandRelease | ||
257 | | GroupPowers.LandSetSale | ||
258 | | GroupPowers.ModerateChat | ||
259 | | GroupPowers.ObjectManipulate | ||
260 | | GroupPowers.ObjectSetForSale | ||
261 | | GroupPowers.ReceiveNotices | ||
262 | | GroupPowers.RemoveMember | ||
263 | | GroupPowers.ReturnGroupOwned | ||
264 | | GroupPowers.ReturnGroupSet | ||
265 | | GroupPowers.ReturnNonGroup | ||
266 | | GroupPowers.RoleProperties | ||
267 | | GroupPowers.SendNotices | ||
268 | | GroupPowers.SetLandingPoint | ||
269 | | GroupPowers.StartProposal | ||
270 | | GroupPowers.VoteOnProposal; | ||
271 | param["OwnersPowers"] = ((ulong)OwnerPowers).ToString(); | ||
272 | |||
273 | |||
274 | |||
275 | 274 | ||
276 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param); | 275 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param); |
277 | 276 | ||
@@ -612,8 +611,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
612 | } | 611 | } |
613 | 612 | ||
614 | return Roles; | 613 | return Roles; |
615 | |||
616 | |||
617 | } | 614 | } |
618 | 615 | ||
619 | public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID) | 616 | public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID) |
@@ -676,7 +673,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
676 | } | 673 | } |
677 | 674 | ||
678 | return members; | 675 | return members; |
679 | |||
680 | } | 676 | } |
681 | 677 | ||
682 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) | 678 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) |
@@ -727,9 +723,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
727 | values.Add(data); | 723 | values.Add(data); |
728 | } | 724 | } |
729 | } | 725 | } |
730 | return values; | ||
731 | 726 | ||
727 | return values; | ||
732 | } | 728 | } |
729 | |||
733 | public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) | 730 | public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) |
734 | { | 731 | { |
735 | Hashtable param = new Hashtable(); | 732 | Hashtable param = new Hashtable(); |
@@ -737,7 +734,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
737 | 734 | ||
738 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param); | 735 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param); |
739 | 736 | ||
740 | |||
741 | if (respData.Contains("error")) | 737 | if (respData.Contains("error")) |
742 | { | 738 | { |
743 | return null; | 739 | return null; |
@@ -761,6 +757,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
761 | 757 | ||
762 | return data; | 758 | return data; |
763 | } | 759 | } |
760 | |||
764 | public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) | 761 | public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) |
765 | { | 762 | { |
766 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); | 763 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); |
@@ -777,8 +774,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
777 | XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param); | 774 | XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param); |
778 | } | 775 | } |
779 | 776 | ||
780 | |||
781 | |||
782 | #endregion | 777 | #endregion |
783 | 778 | ||
784 | #region GroupSessionTracking | 779 | #region GroupSessionTracking |
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs index 6120a81..709d389 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs | |||
@@ -46,6 +46,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
46 | { | 46 | { |
47 | public class XmlRpcInfo | 47 | public class XmlRpcInfo |
48 | { | 48 | { |
49 | public UUID item; | ||
49 | public UUID channel; | 50 | public UUID channel; |
50 | public string uri; | 51 | public string uri; |
51 | } | 52 | } |
@@ -88,6 +89,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
88 | return; | 89 | return; |
89 | 90 | ||
90 | scene.RegisterModuleInterface<IXmlRpcRouter>(this); | 91 | scene.RegisterModuleInterface<IXmlRpcRouter>(this); |
92 | |||
93 | IScriptModule scriptEngine = scene.RequestModuleInterface<IScriptModule>(); | ||
94 | if ( scriptEngine != null ) | ||
95 | { | ||
96 | scriptEngine.OnScriptRemoved += this.ScriptRemoved; | ||
97 | scriptEngine.OnObjectRemoved += this.ObjectRemoved; | ||
98 | |||
99 | } | ||
91 | } | 100 | } |
92 | 101 | ||
93 | public void RegionLoaded(Scene scene) | 102 | public void RegionLoaded(Scene scene) |
@@ -120,22 +129,36 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
120 | 129 | ||
121 | public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) | 130 | public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) |
122 | { | 131 | { |
123 | if (!m_Channels.ContainsKey(itemID)) | 132 | if (!m_Enabled) |
124 | { | 133 | return; |
125 | XmlRpcInfo info = new XmlRpcInfo(); | ||
126 | info.channel = channel; | ||
127 | info.uri = uri; | ||
128 | 134 | ||
129 | bool success = SynchronousRestObjectRequester.MakeRequest<XmlRpcInfo, bool>( | 135 | m_log.InfoFormat("[XMLRPC GRID ROUTER]: New receiver Obj: {0} Ch: {1} ID: {2} URI: {3}", |
130 | "POST", m_ServerURI+"/RegisterChannel/", info); | 136 | objectID.ToString(), channel.ToString(), itemID.ToString(), uri); |
131 | 137 | ||
132 | if (!success) | 138 | XmlRpcInfo info = new XmlRpcInfo(); |
133 | { | 139 | info.channel = channel; |
134 | m_log.Error("[XMLRPC GRID ROUTER] Error contacting server"); | 140 | info.uri = uri; |
135 | } | 141 | info.item = itemID; |
142 | |||
143 | bool success = SynchronousRestObjectRequester.MakeRequest<XmlRpcInfo, bool>( | ||
144 | "POST", m_ServerURI+"/RegisterChannel/", info); | ||
136 | 145 | ||
137 | m_Channels[itemID] = channel; | 146 | if (!success) |
147 | { | ||
148 | m_log.Error("[XMLRPC GRID ROUTER] Error contacting server"); | ||
138 | } | 149 | } |
150 | |||
151 | m_Channels[itemID] = channel; | ||
152 | |||
153 | } | ||
154 | |||
155 | public void UnRegisterReceiver(string channelID, UUID itemID) | ||
156 | { | ||
157 | if (!m_Enabled) | ||
158 | return; | ||
159 | |||
160 | RemoveChannel(itemID); | ||
161 | |||
139 | } | 162 | } |
140 | 163 | ||
141 | public void ScriptRemoved(UUID itemID) | 164 | public void ScriptRemoved(UUID itemID) |
@@ -143,10 +166,33 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
143 | if (!m_Enabled) | 166 | if (!m_Enabled) |
144 | return; | 167 | return; |
145 | 168 | ||
146 | if (m_Channels.ContainsKey(itemID)) | 169 | RemoveChannel(itemID); |
170 | |||
171 | } | ||
172 | |||
173 | public void ObjectRemoved(UUID objectID) | ||
174 | { | ||
175 | // m_log.InfoFormat("[XMLRPC GRID ROUTER]: Object Removed {0}",objectID.ToString()); | ||
176 | } | ||
177 | |||
178 | private bool RemoveChannel(UUID itemID) | ||
179 | { | ||
180 | if(!m_Channels.ContainsKey(itemID)) | ||
181 | { | ||
182 | m_log.InfoFormat("[XMLRPC GRID ROUTER]: Attempted to unregister non-existing Item: {0}", itemID.ToString()); | ||
183 | return false; | ||
184 | } | ||
185 | |||
186 | XmlRpcInfo info = new XmlRpcInfo(); | ||
187 | |||
188 | info.channel = m_Channels[itemID]; | ||
189 | info.item = itemID; | ||
190 | info.uri = "http://0.0.0.0:00"; | ||
191 | |||
192 | if (info != null) | ||
147 | { | 193 | { |
148 | bool success = SynchronousRestObjectRequester.MakeRequest<UUID, bool>( | 194 | bool success = SynchronousRestObjectRequester.MakeRequest<XmlRpcInfo, bool>( |
149 | "POST", m_ServerURI+"/RemoveChannel/", m_Channels[itemID]); | 195 | "POST", m_ServerURI+"/RemoveChannel/", info); |
150 | 196 | ||
151 | if (!success) | 197 | if (!success) |
152 | { | 198 | { |
@@ -154,11 +200,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
154 | } | 200 | } |
155 | 201 | ||
156 | m_Channels.Remove(itemID); | 202 | m_Channels.Remove(itemID); |
203 | return true; | ||
157 | } | 204 | } |
158 | } | 205 | return false; |
159 | |||
160 | public void ObjectRemoved(UUID objectID) | ||
161 | { | ||
162 | } | 206 | } |
163 | } | 207 | } |
164 | } | 208 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs index 4bde52a..32549d6 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs | |||
@@ -104,12 +104,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule | |||
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | public void UnRegisterReceiver(string channelID, UUID itemID) | ||
108 | { | ||
109 | } | ||
110 | |||
107 | public void ScriptRemoved(UUID itemID) | 111 | public void ScriptRemoved(UUID itemID) |
108 | { | 112 | { |
113 | // System.Console.WriteLine("TEST Script Removed!"); | ||
109 | } | 114 | } |
110 | 115 | ||
111 | public void ObjectRemoved(UUID objectID) | 116 | public void ObjectRemoved(UUID objectID) |
112 | { | 117 | { |
118 | // System.Console.WriteLine("TEST Obj Removed!"); | ||
113 | } | 119 | } |
114 | } | 120 | } |
115 | } | 121 | } |
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index c7e3a7a..57d9217 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs | |||
@@ -49,7 +49,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
49 | /// (such as land transfers). There is no money code here! Use FORGE as an example for money code. | 49 | /// (such as land transfers). There is no money code here! Use FORGE as an example for money code. |
50 | /// Demo Economy/Money Module. This is a purposely crippled module! | 50 | /// Demo Economy/Money Module. This is a purposely crippled module! |
51 | /// // To land transfer you need to add: | 51 | /// // To land transfer you need to add: |
52 | /// -helperuri <ADDRESS TO THIS SERVER> | 52 | /// -helperuri http://serveraddress:port/ |
53 | /// to the command line parameters you use to start up your client | 53 | /// to the command line parameters you use to start up your client |
54 | /// This commonly looks like -helperuri http://127.0.0.1:9000/ | 54 | /// This commonly looks like -helperuri http://127.0.0.1:9000/ |
55 | /// | 55 | /// |
@@ -116,10 +116,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
116 | } | 116 | } |
117 | 117 | ||
118 | /// <summary> | 118 | /// <summary> |
119 | /// Startup | 119 | /// Called on startup so the module can be configured. |
120 | /// </summary> | 120 | /// </summary> |
121 | /// <param name="scene"></param> | 121 | /// <param name="config">Configuration source.</param> |
122 | /// <param name="config"></param> | ||
123 | public void Initialise(IConfigSource config) | 122 | public void Initialise(IConfigSource config) |
124 | { | 123 | { |
125 | m_gConfig = config; | 124 | m_gConfig = config; |
@@ -674,9 +673,12 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
674 | } | 673 | } |
675 | 674 | ||
676 | /// <summary> | 675 | /// <summary> |
677 | /// When the client closes the connection we remove their accounting info from memory to free up resources. | 676 | /// When the client closes the connection we remove their accounting |
677 | /// info from memory to free up resources. | ||
678 | /// </summary> | 678 | /// </summary> |
679 | /// <param name="AgentID"></param> | 679 | /// <param name="AgentID">UUID of agent</param> |
680 | /// <param name="scene">Scene the agent was connected to.</param> | ||
681 | /// <see cref="OpenSim.Region.Framework.Scenes.EventManager.ClientClosed"/> | ||
680 | public void ClientClosed(UUID AgentID, Scene scene) | 682 | public void ClientClosed(UUID AgentID, Scene scene) |
681 | { | 683 | { |
682 | 684 | ||
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index ef4005b..365fd78 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -48,7 +48,7 @@ using OpenSim.Tests.Common.Mock; | |||
48 | namespace OpenSim.Region.OptionalModules.World.NPC.Tests | 48 | namespace OpenSim.Region.OptionalModules.World.NPC.Tests |
49 | { | 49 | { |
50 | [TestFixture] | 50 | [TestFixture] |
51 | public class NPCModuleTests | 51 | public class NPCModuleTests : OpenSimTestCase |
52 | { | 52 | { |
53 | private TestScene m_scene; | 53 | private TestScene m_scene; |
54 | private AvatarFactoryModule m_afMod; | 54 | private AvatarFactoryModule m_afMod; |
diff --git a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs new file mode 100644 index 0000000..8b8758e --- /dev/null +++ b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs | |||
@@ -0,0 +1,227 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Linq; | ||
31 | using System.Reflection; | ||
32 | using System.Text; | ||
33 | using log4net; | ||
34 | using Mono.Addins; | ||
35 | using Nini.Config; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Console; | ||
39 | using OpenSim.Framework.Monitoring; | ||
40 | using OpenSim.Region.Framework.Interfaces; | ||
41 | using OpenSim.Region.Framework.Scenes; | ||
42 | |||
43 | namespace OpenSim.Region.OptionalModules.Avatar.Attachments | ||
44 | { | ||
45 | /// <summary> | ||
46 | /// A module that just holds commands for inspecting avatar appearance. | ||
47 | /// </summary> | ||
48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SceneCommandsModule")] | ||
49 | public class SceneCommandsModule : ISceneCommandsModule, INonSharedRegionModule | ||
50 | { | ||
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
53 | private Scene m_scene; | ||
54 | |||
55 | public string Name { get { return "Scene Commands Module"; } } | ||
56 | |||
57 | public Type ReplaceableInterface { get { return null; } } | ||
58 | |||
59 | public void Initialise(IConfigSource source) | ||
60 | { | ||
61 | // m_log.DebugFormat("[SCENE COMMANDS MODULE]: INITIALIZED MODULE"); | ||
62 | } | ||
63 | |||
64 | public void PostInitialise() | ||
65 | { | ||
66 | // m_log.DebugFormat("[SCENE COMMANDS MODULE]: POST INITIALIZED MODULE"); | ||
67 | } | ||
68 | |||
69 | public void Close() | ||
70 | { | ||
71 | // m_log.DebugFormat("[SCENE COMMANDS MODULE]: CLOSED MODULE"); | ||
72 | } | ||
73 | |||
74 | public void AddRegion(Scene scene) | ||
75 | { | ||
76 | // m_log.DebugFormat("[SCENE COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | ||
77 | |||
78 | m_scene = scene; | ||
79 | |||
80 | m_scene.RegisterModuleInterface<ISceneCommandsModule>(this); | ||
81 | } | ||
82 | |||
83 | public void RemoveRegion(Scene scene) | ||
84 | { | ||
85 | // m_log.DebugFormat("[SCENE COMMANDS MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); | ||
86 | } | ||
87 | |||
88 | public void RegionLoaded(Scene scene) | ||
89 | { | ||
90 | // m_log.DebugFormat("[ATTACHMENTS COMMAND MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | ||
91 | |||
92 | scene.AddCommand( | ||
93 | "Debug", this, "debug scene get", | ||
94 | "debug scene get", | ||
95 | "List current scene options.", | ||
96 | "If active is false then main scene update and maintenance loops are suspended.\n" | ||
97 | + "If collisions is false then collisions with other objects are turned off.\n" | ||
98 | + "If pbackup is false then periodic scene backup is turned off.\n" | ||
99 | + "If physics is false then all physics objects are non-physical.\n" | ||
100 | + "If scripting is false then no scripting operations happen.\n" | ||
101 | + "If teleport is true then some extra teleport debug information is logged.\n" | ||
102 | + "If updates is true then any frame which exceeds double the maximum desired frame time is logged.", | ||
103 | HandleDebugSceneGetCommand); | ||
104 | |||
105 | scene.AddCommand( | ||
106 | "Debug", this, "debug scene set", | ||
107 | "debug scene set active|collisions|pbackup|physics|scripting|teleport|updates true|false", | ||
108 | "Turn on scene debugging options.", | ||
109 | "If active is false then main scene update and maintenance loops are suspended.\n" | ||
110 | + "If collisions is false then collisions with other objects are turned off.\n" | ||
111 | + "If pbackup is false then periodic scene backup is turned off.\n" | ||
112 | + "If physics is false then all physics objects are non-physical.\n" | ||
113 | + "If scripting is false then no scripting operations happen.\n" | ||
114 | + "If teleport is true then some extra teleport debug information is logged.\n" | ||
115 | + "If updates is true then any frame which exceeds double the maximum desired frame time is logged.", | ||
116 | HandleDebugSceneSetCommand); | ||
117 | } | ||
118 | |||
119 | private void HandleDebugSceneGetCommand(string module, string[] args) | ||
120 | { | ||
121 | if (args.Length == 3) | ||
122 | { | ||
123 | if (MainConsole.Instance.ConsoleScene == null) | ||
124 | MainConsole.Instance.Output("Please use 'change region <regioname>' first"); | ||
125 | else | ||
126 | OutputSceneDebugOptions(); | ||
127 | } | ||
128 | else | ||
129 | { | ||
130 | MainConsole.Instance.Output("Usage: debug scene get"); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | private void OutputSceneDebugOptions() | ||
135 | { | ||
136 | ConsoleDisplayList cdl = new ConsoleDisplayList(); | ||
137 | cdl.AddRow("active", m_scene.Active); | ||
138 | cdl.AddRow("pbackup", m_scene.PeriodicBackup); | ||
139 | cdl.AddRow("physics", m_scene.PhysicsEnabled); | ||
140 | cdl.AddRow("scripting", m_scene.ScriptsEnabled); | ||
141 | cdl.AddRow("teleport", m_scene.DebugTeleporting); | ||
142 | cdl.AddRow("updates", m_scene.DebugUpdates); | ||
143 | |||
144 | MainConsole.Instance.Output(cdl.ToString()); | ||
145 | } | ||
146 | |||
147 | private void HandleDebugSceneSetCommand(string module, string[] args) | ||
148 | { | ||
149 | if (args.Length == 5) | ||
150 | { | ||
151 | if (MainConsole.Instance.ConsoleScene == null) | ||
152 | { | ||
153 | MainConsole.Instance.Output("Please use 'change region <regioname>' first"); | ||
154 | } | ||
155 | else | ||
156 | { | ||
157 | string key = args[3]; | ||
158 | string value = args[4]; | ||
159 | SetSceneDebugOptions(new Dictionary<string, string>() { { key, value } }); | ||
160 | |||
161 | MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value); | ||
162 | } | ||
163 | } | ||
164 | else | ||
165 | { | ||
166 | MainConsole.Instance.Output( | ||
167 | "Usage: debug scene set active|collisions|pbackup|physics|scripting|teleport|updates true|false"); | ||
168 | } | ||
169 | } | ||
170 | |||
171 | public void SetSceneDebugOptions(Dictionary<string, string> options) | ||
172 | { | ||
173 | if (options.ContainsKey("active")) | ||
174 | { | ||
175 | bool active; | ||
176 | |||
177 | if (bool.TryParse(options["active"], out active)) | ||
178 | m_scene.Active = active; | ||
179 | } | ||
180 | |||
181 | if (options.ContainsKey("pbackup")) | ||
182 | { | ||
183 | bool active; | ||
184 | |||
185 | if (bool.TryParse(options["pbackup"], out active)) | ||
186 | m_scene.PeriodicBackup = active; | ||
187 | } | ||
188 | |||
189 | if (options.ContainsKey("scripting")) | ||
190 | { | ||
191 | bool enableScripts = true; | ||
192 | if (bool.TryParse(options["scripting"], out enableScripts)) | ||
193 | m_scene.ScriptsEnabled = enableScripts; | ||
194 | } | ||
195 | |||
196 | if (options.ContainsKey("physics")) | ||
197 | { | ||
198 | bool enablePhysics; | ||
199 | if (bool.TryParse(options["physics"], out enablePhysics)) | ||
200 | m_scene.PhysicsEnabled = enablePhysics; | ||
201 | } | ||
202 | |||
203 | // if (options.ContainsKey("collisions")) | ||
204 | // { | ||
205 | // // TODO: Implement. If false, should stop objects colliding, though possibly should still allow | ||
206 | // // the avatar themselves to collide with the ground. | ||
207 | // } | ||
208 | |||
209 | if (options.ContainsKey("teleport")) | ||
210 | { | ||
211 | bool enableTeleportDebugging; | ||
212 | if (bool.TryParse(options["teleport"], out enableTeleportDebugging)) | ||
213 | m_scene.DebugTeleporting = enableTeleportDebugging; | ||
214 | } | ||
215 | |||
216 | if (options.ContainsKey("updates")) | ||
217 | { | ||
218 | bool enableUpdateDebugging; | ||
219 | if (bool.TryParse(options["updates"], out enableUpdateDebugging)) | ||
220 | { | ||
221 | m_scene.DebugUpdates = enableUpdateDebugging; | ||
222 | GcNotify.Enabled = enableUpdateDebugging; | ||
223 | } | ||
224 | } | ||
225 | } | ||
226 | } | ||
227 | } \ No newline at end of file | ||