diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/GodController.cs | 228 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 122 |
3 files changed, 278 insertions, 73 deletions
diff --git a/OpenSim/Region/Framework/Scenes/GodController.cs b/OpenSim/Region/Framework/Scenes/GodController.cs new file mode 100644 index 0000000..5763e03 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/GodController.cs | |||
@@ -0,0 +1,228 @@ | |||
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.Xml; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using System.Timers; | ||
34 | using Timer = System.Timers.Timer; | ||
35 | using OpenMetaverse; | ||
36 | using OpenMetaverse.StructuredData; | ||
37 | using log4net; | ||
38 | using Nini.Config; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Framework.Client; | ||
41 | using OpenSim.Framework.Monitoring; | ||
42 | using OpenSim.Region.Framework.Interfaces; | ||
43 | using OpenSim.Region.Framework.Scenes.Types; | ||
44 | using OpenSim.Services.Interfaces; | ||
45 | |||
46 | namespace OpenSim.Region.Framework.Scenes | ||
47 | { | ||
48 | public class GodController | ||
49 | { | ||
50 | ScenePresence m_scenePresence; | ||
51 | Scene m_scene; | ||
52 | protected bool m_allowGridGods; | ||
53 | protected bool m_regionOwnerIsGod; | ||
54 | protected bool m_regionManagerIsGod; | ||
55 | protected bool m_parcelOwnerIsGod; | ||
56 | protected bool m_forceGodModeAlwaysOn; | ||
57 | protected bool m_allowGodActionsWithoutGodMode; | ||
58 | |||
59 | protected bool m_viewerUiIsGod = false; | ||
60 | |||
61 | protected int m_userLevel = 0; | ||
62 | |||
63 | public GodController(Scene scene, ScenePresence sp) | ||
64 | { | ||
65 | m_scene = scene; | ||
66 | m_scenePresence = sp; | ||
67 | |||
68 | IConfigSource config = scene.Config; | ||
69 | |||
70 | string[] sections = new string[] { "Startup", "Permissions" }; | ||
71 | |||
72 | // God level is based on UserLevel. Gods will have that | ||
73 | // level grid-wide. Others may become god locally but grid | ||
74 | // gods are god everywhere. | ||
75 | m_allowGridGods = | ||
76 | Util.GetConfigVarFromSections<bool>(config, | ||
77 | "allow_grid_gods", sections, false); | ||
78 | |||
79 | // The owner of a region is a god in his region only. | ||
80 | m_regionOwnerIsGod = | ||
81 | Util.GetConfigVarFromSections<bool>(config, | ||
82 | "region_owner_is_god", sections, true); | ||
83 | |||
84 | // Region managers are gods in the regions they manage. | ||
85 | m_regionManagerIsGod = | ||
86 | Util.GetConfigVarFromSections<bool>(config, | ||
87 | "region_manager_is_god", sections, false); | ||
88 | |||
89 | // Parcel owners are gods in their own parcels only. | ||
90 | m_parcelOwnerIsGod = | ||
91 | Util.GetConfigVarFromSections<bool>(config, | ||
92 | "parcel_owner_is_god", sections, false); | ||
93 | |||
94 | // God mode should be turned on in the viewer whenever | ||
95 | // the user has god rights somewhere. They may choose | ||
96 | // to turn it off again, though. | ||
97 | m_forceGodModeAlwaysOn = | ||
98 | Util.GetConfigVarFromSections<bool>(config, | ||
99 | "automatic_gods", sections, false); | ||
100 | |||
101 | // The user can execute any and all god functions, as | ||
102 | // permitted by the viewer UI, without actually "godding | ||
103 | // up". This is the default state in 0.8.2. | ||
104 | m_allowGodActionsWithoutGodMode = | ||
105 | Util.GetConfigVarFromSections<bool>(config, | ||
106 | "implicit_gods", sections, false); | ||
107 | |||
108 | } | ||
109 | |||
110 | protected bool CanBeGod() | ||
111 | { | ||
112 | bool canBeGod = false; | ||
113 | |||
114 | if (m_allowGridGods && m_userLevel > 0) | ||
115 | canBeGod = true; | ||
116 | |||
117 | if (m_regionOwnerIsGod && m_scene.RegionInfo.EstateSettings.IsEstateOwner(m_scenePresence.UUID)) | ||
118 | canBeGod = true; | ||
119 | |||
120 | if (m_regionManagerIsGod && m_scene.Permissions.IsEstateManager(m_scenePresence.UUID)) | ||
121 | canBeGod = true; | ||
122 | |||
123 | if (!canBeGod && m_parcelOwnerIsGod) // Skip expensive check if we're already god! | ||
124 | { | ||
125 | Vector3 pos = m_scenePresence.AbsolutePosition; | ||
126 | ILandObject parcel = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); | ||
127 | if (parcel != null && parcel.LandData.OwnerID == m_scenePresence.UUID) | ||
128 | canBeGod = true; | ||
129 | } | ||
130 | |||
131 | return canBeGod; | ||
132 | } | ||
133 | |||
134 | protected void SyncViewerState() | ||
135 | { | ||
136 | bool canBeGod = CanBeGod(); | ||
137 | |||
138 | bool shoudBeGod = m_forceGodModeAlwaysOn ? canBeGod : (m_viewerUiIsGod && canBeGod); | ||
139 | |||
140 | int godLevel = m_allowGridGods ? m_userLevel : 200; | ||
141 | if (!shoudBeGod) | ||
142 | godLevel = 0; | ||
143 | |||
144 | if (m_viewerUiIsGod != shoudBeGod) | ||
145 | { | ||
146 | m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)godLevel); | ||
147 | m_viewerUiIsGod = shoudBeGod; | ||
148 | } | ||
149 | } | ||
150 | |||
151 | public bool RequestGodMode(bool god) | ||
152 | { | ||
153 | if (!god) | ||
154 | { | ||
155 | if (m_viewerUiIsGod) | ||
156 | m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, 0); | ||
157 | |||
158 | m_viewerUiIsGod = false; | ||
159 | |||
160 | return true; | ||
161 | } | ||
162 | |||
163 | if (!CanBeGod()) | ||
164 | return false; | ||
165 | |||
166 | int godLevel = m_allowGridGods ? m_userLevel : 200; | ||
167 | |||
168 | if (!m_viewerUiIsGod) | ||
169 | m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)godLevel); | ||
170 | |||
171 | m_viewerUiIsGod = true; | ||
172 | |||
173 | return true; | ||
174 | } | ||
175 | |||
176 | public OSD State() | ||
177 | { | ||
178 | OSDMap godMap = new OSDMap(2); | ||
179 | |||
180 | godMap.Add("ViewerUiIsGod", OSD.FromBoolean(m_viewerUiIsGod)); | ||
181 | |||
182 | return godMap; | ||
183 | } | ||
184 | |||
185 | public void SetState(OSD state) | ||
186 | { | ||
187 | OSDMap s = (OSDMap)state; | ||
188 | |||
189 | if (s.ContainsKey("ViewerUiIsGod")) | ||
190 | m_viewerUiIsGod = s["ViewerUiIsGod"].AsBoolean(); | ||
191 | |||
192 | SyncViewerState(); | ||
193 | } | ||
194 | |||
195 | public int UserLevel | ||
196 | { | ||
197 | get { return m_userLevel; } | ||
198 | set { m_userLevel = UserLevel; } | ||
199 | } | ||
200 | |||
201 | public int GodLevel | ||
202 | { | ||
203 | get | ||
204 | { | ||
205 | int godLevel = m_allowGridGods ? m_userLevel : 200; | ||
206 | if (!m_viewerUiIsGod) | ||
207 | godLevel = 0; | ||
208 | |||
209 | return godLevel; | ||
210 | } | ||
211 | } | ||
212 | |||
213 | public int EffectiveLevel | ||
214 | { | ||
215 | get | ||
216 | { | ||
217 | int godLevel = m_allowGridGods ? m_userLevel : 200; | ||
218 | if (m_viewerUiIsGod) | ||
219 | return godLevel; | ||
220 | |||
221 | if (m_allowGodActionsWithoutGodMode && CanBeGod()) | ||
222 | return godLevel; | ||
223 | |||
224 | return 0; | ||
225 | } | ||
226 | } | ||
227 | } | ||
228 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 352bc05..87c3049 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1207,7 +1207,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1207 | 1207 | ||
1208 | #endregion Interest Management | 1208 | #endregion Interest Management |
1209 | 1209 | ||
1210 | |||
1211 | StatsReporter = new SimStatsReporter(this); | 1210 | StatsReporter = new SimStatsReporter(this); |
1212 | 1211 | ||
1213 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1212 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 29e139b..339f1b1 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -501,21 +501,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
501 | get { return m_invulnerable; } | 501 | get { return m_invulnerable; } |
502 | } | 502 | } |
503 | 503 | ||
504 | private int m_userLevel; | 504 | public GodController GodController { get; private set; } |
505 | |||
506 | public int UserLevel | ||
507 | { | ||
508 | get { return m_userLevel; } | ||
509 | private set { m_userLevel = value; } | ||
510 | } | ||
511 | |||
512 | private int m_godLevel; | ||
513 | |||
514 | public int GodLevel | ||
515 | { | ||
516 | get { return m_godLevel; } | ||
517 | private set { m_godLevel = value; } | ||
518 | } | ||
519 | 505 | ||
520 | private ulong m_rootRegionHandle; | 506 | private ulong m_rootRegionHandle; |
521 | private Vector3 m_rootRegionPosition = new Vector3(); | 507 | private Vector3 m_rootRegionPosition = new Vector3(); |
@@ -1059,6 +1045,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1059 | public ScenePresence( | 1045 | public ScenePresence( |
1060 | IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) | 1046 | IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) |
1061 | { | 1047 | { |
1048 | GodController = new GodController(world, this); | ||
1049 | |||
1062 | m_scene = world; | 1050 | m_scene = world; |
1063 | AttachmentsSyncLock = new Object(); | 1051 | AttachmentsSyncLock = new Object(); |
1064 | AllowMovement = true; | 1052 | AllowMovement = true; |
@@ -1085,7 +1073,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1085 | m_userFlags = 0; | 1073 | m_userFlags = 0; |
1086 | 1074 | ||
1087 | if (account != null) | 1075 | if (account != null) |
1088 | UserLevel = account.UserLevel; | 1076 | GodController.UserLevel = account.UserLevel; |
1089 | 1077 | ||
1090 | // IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); | 1078 | // IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); |
1091 | // if (gm != null) | 1079 | // if (gm != null) |
@@ -2113,18 +2101,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2113 | 2101 | ||
2114 | m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2102 | m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
2115 | 2103 | ||
2116 | 2104 | if(m_teleportFlags > 0) | |
2117 | if(m_teleportFlags > 0) //sanity check | 2105 | { |
2118 | gotCrossUpdate = false; | 2106 | gotCrossUpdate = false; // sanity check |
2107 | Thread.Sleep(500); // let viewers catch us | ||
2108 | } | ||
2119 | 2109 | ||
2120 | if(!gotCrossUpdate) | 2110 | if(!gotCrossUpdate) |
2121 | RotateToLookAt(look); | 2111 | RotateToLookAt(look); |
2122 | 2112 | ||
2123 | |||
2124 | // start sending terrain patchs | ||
2125 | if (!gotCrossUpdate && !isNPC) | ||
2126 | Scene.SendLayerData(ControllingClient); | ||
2127 | |||
2128 | // HG | 2113 | // HG |
2129 | bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; | 2114 | bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0; |
2130 | if(isHGTP) | 2115 | if(isHGTP) |
@@ -2133,6 +2118,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2133 | m_log.DebugFormat("[CompleteMovement] HG"); | 2118 | m_log.DebugFormat("[CompleteMovement] HG"); |
2134 | } | 2119 | } |
2135 | 2120 | ||
2121 | if(!IsChildAgent && !isNPC) | ||
2122 | |||
2123 | // start sending terrain patchs | ||
2124 | if (!gotCrossUpdate && !isNPC) | ||
2125 | Scene.SendLayerData(ControllingClient); | ||
2126 | |||
2136 | m_previusParcelHide = false; | 2127 | m_previusParcelHide = false; |
2137 | m_previusParcelUUID = UUID.Zero; | 2128 | m_previusParcelUUID = UUID.Zero; |
2138 | m_currentParcelHide = false; | 2129 | m_currentParcelHide = false; |
@@ -2201,7 +2192,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2201 | if (p == this) | 2192 | if (p == this) |
2202 | continue; | 2193 | continue; |
2203 | 2194 | ||
2204 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 2195 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
2205 | continue; | 2196 | continue; |
2206 | 2197 | ||
2207 | SendAppearanceToAgentNF(p); | 2198 | SendAppearanceToAgentNF(p); |
@@ -2251,7 +2242,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2251 | continue; | 2242 | continue; |
2252 | } | 2243 | } |
2253 | 2244 | ||
2254 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 2245 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
2255 | continue; | 2246 | continue; |
2256 | 2247 | ||
2257 | SendAttachmentsToAgentNF(p); | 2248 | SendAttachmentsToAgentNF(p); |
@@ -3867,7 +3858,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3867 | if (!remoteClient.IsActive) | 3858 | if (!remoteClient.IsActive) |
3868 | return; | 3859 | return; |
3869 | 3860 | ||
3870 | if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID && p.GodLevel < 200) | 3861 | if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID && p.GodController.GodLevel < 200) |
3871 | return; | 3862 | return; |
3872 | 3863 | ||
3873 | //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); | 3864 | //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); |
@@ -3977,7 +3968,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3977 | // get the avatar, then a kill if can't see it | 3968 | // get the avatar, then a kill if can't see it |
3978 | p.SendInitialAvatarDataToAgent(this); | 3969 | p.SendInitialAvatarDataToAgent(this); |
3979 | 3970 | ||
3980 | if (p.ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && GodLevel < 200) | 3971 | if (p.ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && GodController.GodLevel < 200) |
3981 | return; | 3972 | return; |
3982 | 3973 | ||
3983 | p.SendAppearanceToAgentNF(this); | 3974 | p.SendAppearanceToAgentNF(this); |
@@ -4025,7 +4016,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4025 | foreach (ScenePresence p in presences) | 4016 | foreach (ScenePresence p in presences) |
4026 | { | 4017 | { |
4027 | p.ControllingClient.SendAvatarDataImmediate(this); | 4018 | p.ControllingClient.SendAvatarDataImmediate(this); |
4028 | if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 4019 | if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
4029 | // either just kill the object | 4020 | // either just kill the object |
4030 | // p.ControllingClient.SendKillObject(new List<uint> {LocalId}); | 4021 | // p.ControllingClient.SendKillObject(new List<uint> {LocalId}); |
4031 | // or also attachments viewer may still know about | 4022 | // or also attachments viewer may still know about |
@@ -4038,7 +4029,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4038 | public void SendInitialAvatarDataToAgent(ScenePresence p) | 4029 | public void SendInitialAvatarDataToAgent(ScenePresence p) |
4039 | { | 4030 | { |
4040 | p.ControllingClient.SendAvatarDataImmediate(this); | 4031 | p.ControllingClient.SendAvatarDataImmediate(this); |
4041 | if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 4032 | if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
4042 | // either just kill the object | 4033 | // either just kill the object |
4043 | // p.ControllingClient.SendKillObject(new List<uint> {LocalId}); | 4034 | // p.ControllingClient.SendKillObject(new List<uint> {LocalId}); |
4044 | // or also attachments viewer may still know about | 4035 | // or also attachments viewer may still know about |
@@ -4052,7 +4043,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4052 | public void SendAvatarDataToAgent(ScenePresence avatar) | 4043 | public void SendAvatarDataToAgent(ScenePresence avatar) |
4053 | { | 4044 | { |
4054 | //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); | 4045 | //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); |
4055 | if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) | 4046 | if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodController.GodLevel < 200) |
4056 | return; | 4047 | return; |
4057 | avatar.ControllingClient.SendAvatarDataImmediate(this); | 4048 | avatar.ControllingClient.SendAvatarDataImmediate(this); |
4058 | } | 4049 | } |
@@ -4097,7 +4088,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4097 | { | 4088 | { |
4098 | // m_log.DebugFormat( | 4089 | // m_log.DebugFormat( |
4099 | // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); | 4090 | // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); |
4100 | if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) | 4091 | if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodController.GodLevel < 200) |
4101 | return; | 4092 | return; |
4102 | SendAppearanceToAgentNF(avatar); | 4093 | SendAppearanceToAgentNF(avatar); |
4103 | } | 4094 | } |
@@ -4113,7 +4104,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4113 | if (IsChildAgent || Animator == null) | 4104 | if (IsChildAgent || Animator == null) |
4114 | return; | 4105 | return; |
4115 | 4106 | ||
4116 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 4107 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
4117 | return; | 4108 | return; |
4118 | 4109 | ||
4119 | Animator.SendAnimPackToClient(p.ControllingClient); | 4110 | Animator.SendAnimPackToClient(p.ControllingClient); |
@@ -4124,7 +4115,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4124 | if (IsChildAgent) | 4115 | if (IsChildAgent) |
4125 | return; | 4116 | return; |
4126 | 4117 | ||
4127 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 4118 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
4128 | return; | 4119 | return; |
4129 | 4120 | ||
4130 | p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); | 4121 | p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); |
@@ -4149,7 +4140,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4149 | 4140 | ||
4150 | m_scene.ForEachScenePresence(delegate(ScenePresence p) | 4141 | m_scene.ForEachScenePresence(delegate(ScenePresence p) |
4151 | { | 4142 | { |
4152 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 4143 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
4153 | return; | 4144 | return; |
4154 | p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); | 4145 | p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); |
4155 | }); | 4146 | }); |
@@ -4262,6 +4253,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4262 | agentpos.Position = AbsolutePosition; | 4253 | agentpos.Position = AbsolutePosition; |
4263 | agentpos.Velocity = Velocity; | 4254 | agentpos.Velocity = Velocity; |
4264 | agentpos.RegionHandle = RegionHandle; | 4255 | agentpos.RegionHandle = RegionHandle; |
4256 | agentpos.GodData = GodController.State(); | ||
4265 | agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); | 4257 | agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); |
4266 | 4258 | ||
4267 | // Let's get this out of the update loop | 4259 | // Let's get this out of the update loop |
@@ -4510,20 +4502,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
4510 | /// </summary> | 4502 | /// </summary> |
4511 | public void GrantGodlikePowers(UUID token, bool godStatus) | 4503 | public void GrantGodlikePowers(UUID token, bool godStatus) |
4512 | { | 4504 | { |
4513 | int oldgodlevel = GodLevel; | 4505 | if (isNPC) |
4514 | 4506 | return; | |
4515 | if (godStatus && !isNPC && m_scene.Permissions.IsGod(UUID)) | ||
4516 | { | ||
4517 | GodLevel = 200; | ||
4518 | if(GodLevel < UserLevel) | ||
4519 | GodLevel = UserLevel; | ||
4520 | } | ||
4521 | else | ||
4522 | GodLevel = 0; | ||
4523 | 4507 | ||
4524 | ControllingClient.SendAdminResponse(token, (uint)GodLevel); | 4508 | bool success = GodController.RequestGodMode(godStatus); |
4525 | if(oldgodlevel != GodLevel) | 4509 | if (success && godStatus) |
4526 | parcelGodCheck(m_currentParcelUUID, GodLevel >= 200); | 4510 | parcelGodCheck(m_currentParcelUUID, GodController.GodLevel >= 200); |
4527 | } | 4511 | } |
4528 | 4512 | ||
4529 | #region Child Agent Updates | 4513 | #region Child Agent Updates |
@@ -4554,6 +4538,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4554 | if (!IsChildAgent) | 4538 | if (!IsChildAgent) |
4555 | return; | 4539 | return; |
4556 | 4540 | ||
4541 | GodController.SetState(cAgentData.GodData); | ||
4542 | |||
4557 | RegionHandle = cAgentData.RegionHandle; | 4543 | RegionHandle = cAgentData.RegionHandle; |
4558 | 4544 | ||
4559 | //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); | 4545 | //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); |
@@ -4628,11 +4614,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4628 | cAgent.BodyRotation = Rotation; | 4614 | cAgent.BodyRotation = Rotation; |
4629 | cAgent.ControlFlags = (uint)m_AgentControlFlags; | 4615 | cAgent.ControlFlags = (uint)m_AgentControlFlags; |
4630 | 4616 | ||
4631 | if (GodLevel > 200 && m_scene.Permissions.IsGod(cAgent.AgentID)) | ||
4632 | cAgent.GodLevel = (byte)GodLevel; | ||
4633 | else | ||
4634 | cAgent.GodLevel = (byte) 0; | ||
4635 | |||
4636 | cAgent.AlwaysRun = SetAlwaysRun; | 4617 | cAgent.AlwaysRun = SetAlwaysRun; |
4637 | 4618 | ||
4638 | // make clear we want the all thing | 4619 | // make clear we want the all thing |
@@ -4693,6 +4674,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4693 | // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", | 4674 | // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", |
4694 | // Name, m_scene.RegionInfo.RegionName, m_callbackURI); | 4675 | // Name, m_scene.RegionInfo.RegionName, m_callbackURI); |
4695 | 4676 | ||
4677 | GodController.SetState(cAgent.GodData); | ||
4678 | |||
4696 | m_pos = cAgent.Position; | 4679 | m_pos = cAgent.Position; |
4697 | m_velocity = cAgent.Velocity; | 4680 | m_velocity = cAgent.Velocity; |
4698 | CameraPosition = cAgent.Center; | 4681 | CameraPosition = cAgent.Center; |
@@ -4729,11 +4712,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4729 | Rotation = cAgent.BodyRotation; | 4712 | Rotation = cAgent.BodyRotation; |
4730 | m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; | 4713 | m_AgentControlFlags = (AgentManager.ControlFlags)cAgent.ControlFlags; |
4731 | 4714 | ||
4732 | if (cAgent.GodLevel >200 && m_scene.Permissions.IsGod(cAgent.AgentID)) | ||
4733 | GodLevel = cAgent.GodLevel; | ||
4734 | else | ||
4735 | GodLevel = 0; | ||
4736 | |||
4737 | SetAlwaysRun = cAgent.AlwaysRun; | 4715 | SetAlwaysRun = cAgent.AlwaysRun; |
4738 | 4716 | ||
4739 | Appearance = new AvatarAppearance(cAgent.Appearance); | 4717 | Appearance = new AvatarAppearance(cAgent.Appearance); |
@@ -4963,7 +4941,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4963 | RaiseCollisionScriptEvents(coldata); | 4941 | RaiseCollisionScriptEvents(coldata); |
4964 | 4942 | ||
4965 | // Gods do not take damage and Invulnerable is set depending on parcel/region flags | 4943 | // Gods do not take damage and Invulnerable is set depending on parcel/region flags |
4966 | if (Invulnerable || GodLevel > 0) | 4944 | if (Invulnerable || GodController.GodLevel > 0) |
4967 | return; | 4945 | return; |
4968 | 4946 | ||
4969 | // The following may be better in the ICombatModule | 4947 | // The following may be better in the ICombatModule |
@@ -5248,7 +5226,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5248 | if (p != this && sog.HasPrivateAttachmentPoint) | 5226 | if (p != this && sog.HasPrivateAttachmentPoint) |
5249 | return; | 5227 | return; |
5250 | 5228 | ||
5251 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 5229 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
5252 | return; | 5230 | return; |
5253 | 5231 | ||
5254 | SendTerseUpdateToAgentNF(p); | 5232 | SendTerseUpdateToAgentNF(p); |
@@ -5362,7 +5340,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5362 | if (p == this) | 5340 | if (p == this) |
5363 | continue; | 5341 | continue; |
5364 | 5342 | ||
5365 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 5343 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
5366 | continue; | 5344 | continue; |
5367 | 5345 | ||
5368 | p.ControllingClient.SendEntityUpdate(rootpart, rootflag); | 5346 | p.ControllingClient.SendEntityUpdate(rootpart, rootflag); |
@@ -5421,7 +5399,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5421 | if (p == this) | 5399 | if (p == this) |
5422 | continue; | 5400 | continue; |
5423 | 5401 | ||
5424 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 5402 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
5425 | continue; | 5403 | continue; |
5426 | 5404 | ||
5427 | p.ControllingClient.SendEntityUpdate(rootpart, flag); | 5405 | p.ControllingClient.SendEntityUpdate(rootpart, flag); |
@@ -5471,7 +5449,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5471 | if (p == this) | 5449 | if (p == this) |
5472 | continue; | 5450 | continue; |
5473 | 5451 | ||
5474 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 5452 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
5475 | continue; | 5453 | continue; |
5476 | 5454 | ||
5477 | p.ControllingClient.SendEntityUpdate(part, flag); | 5455 | p.ControllingClient.SendEntityUpdate(part, flag); |
@@ -5512,7 +5490,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5512 | { | 5490 | { |
5513 | if (p == this) | 5491 | if (p == this) |
5514 | continue; | 5492 | continue; |
5515 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | 5493 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
5516 | continue; | 5494 | continue; |
5517 | 5495 | ||
5518 | p.ControllingClient.SendEntityUpdate(part, flag); | 5496 | p.ControllingClient.SendEntityUpdate(part, flag); |
@@ -6150,7 +6128,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
6150 | // the TP point. This behaviour mimics agni. | 6128 | // the TP point. This behaviour mimics agni. |
6151 | if (land.LandData.LandingType == (byte)LandingType.LandingPoint && | 6129 | if (land.LandData.LandingType == (byte)LandingType.LandingPoint && |
6152 | land.LandData.UserLocation != Vector3.Zero && | 6130 | land.LandData.UserLocation != Vector3.Zero && |
6153 | GodLevel < 200 && | 6131 | GodController.GodLevel < 200 && |
6154 | ((land.LandData.OwnerID != m_uuid && | 6132 | ((land.LandData.OwnerID != m_uuid && |
6155 | !m_scene.Permissions.IsGod(m_uuid) && | 6133 | !m_scene.Permissions.IsGod(m_uuid) && |
6156 | !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || | 6134 | !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || |
@@ -6175,7 +6153,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
6175 | string reason; | 6153 | string reason; |
6176 | 6154 | ||
6177 | // dont mess with gods | 6155 | // dont mess with gods |
6178 | if(GodLevel >= 200 || m_scene.Permissions.IsGod(m_uuid)) | 6156 | if(GodController.GodLevel >= 200 || m_scene.Permissions.IsGod(m_uuid)) |
6179 | return true; | 6157 | return true; |
6180 | 6158 | ||
6181 | // respect region owner and managers | 6159 | // respect region owner and managers |
@@ -6523,7 +6501,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
6523 | continue; | 6501 | continue; |
6524 | 6502 | ||
6525 | // those not on parcel dont see me | 6503 | // those not on parcel dont see me |
6526 | if (currentParcelID != p.currentParcelUUID && p.GodLevel < 200) | 6504 | if (currentParcelID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
6527 | { | 6505 | { |
6528 | killsToSendto.Add(p); // they dont see me | 6506 | killsToSendto.Add(p); // they dont see me |
6529 | } | 6507 | } |
@@ -6549,9 +6527,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
6549 | // only those on previus parcel need receive kills | 6527 | // only those on previus parcel need receive kills |
6550 | if (previusParcelID == p.currentParcelUUID) | 6528 | if (previusParcelID == p.currentParcelUUID) |
6551 | { | 6529 | { |
6552 | if(p.GodLevel < 200) | 6530 | if(p.GodController.GodLevel < 200) |
6553 | killsToSendto.Add(p); // they dont see me | 6531 | killsToSendto.Add(p); // they dont see me |
6554 | if(GodLevel < 200) | 6532 | if(GodController.GodLevel < 200) |
6555 | killsToSendme.Add(p); // i dont see them | 6533 | killsToSendme.Add(p); // i dont see them |
6556 | } | 6534 | } |
6557 | // only those on new parcel need see | 6535 | // only those on new parcel need see |
@@ -6573,7 +6551,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
6573 | continue; | 6551 | continue; |
6574 | 6552 | ||
6575 | // those not on new parcel dont see me | 6553 | // those not on new parcel dont see me |
6576 | if (currentParcelID != p.currentParcelUUID && p.GodLevel < 200) | 6554 | if (currentParcelID != p.currentParcelUUID && p.GodController.GodLevel < 200) |
6577 | { | 6555 | { |
6578 | killsToSendto.Add(p); // they dont see me | 6556 | killsToSendto.Add(p); // they dont see me |
6579 | } | 6557 | } |
@@ -6599,7 +6577,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
6599 | if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) | 6577 | if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) |
6600 | continue; | 6578 | continue; |
6601 | // only those old parcel need kills | 6579 | // only those old parcel need kills |
6602 | if (previusParcelID == p.currentParcelUUID && GodLevel < 200) | 6580 | if (previusParcelID == p.currentParcelUUID && GodController.GodLevel < 200) |
6603 | { | 6581 | { |
6604 | killsToSendme.Add(p); // i dont see them | 6582 | killsToSendme.Add(p); // i dont see them |
6605 | } | 6583 | } |
@@ -6662,7 +6640,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
6662 | if (Scene.AttachmentsModule != null) | 6640 | if (Scene.AttachmentsModule != null) |
6663 | Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); | 6641 | Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); |
6664 | 6642 | ||
6665 | if (!ParcelHideThisAvatar || GodLevel >= 200) | 6643 | if (!ParcelHideThisAvatar || GodController.GodLevel >= 200) |
6666 | return; | 6644 | return; |
6667 | 6645 | ||
6668 | List<ScenePresence> allpresences = m_scene.GetScenePresences(); | 6646 | List<ScenePresence> allpresences = m_scene.GetScenePresences(); |