aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2017-01-07 16:02:52 +0000
committerUbitUmarov2017-01-07 16:02:52 +0000
commitd761a20ccebc0b20237c86bb55683155f0eeaf15 (patch)
tree61129c3353a437e4bdc8ebe69906d41677f7de15 /OpenSim/Region
parenttry to work around some broken viewers math on handles (diff)
downloadopensim-SC-d761a20ccebc0b20237c86bb55683155f0eeaf15.zip
opensim-SC-d761a20ccebc0b20237c86bb55683155f0eeaf15.tar.gz
opensim-SC-d761a20ccebc0b20237c86bb55683155f0eeaf15.tar.bz2
opensim-SC-d761a20ccebc0b20237c86bb55683155f0eeaf15.tar.xz
more changes to god level control. Not that this is work in progress, for now it still works mainly as with option implicit_gods = true. speed up some regions child updates, some cleanup
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/GodController.cs200
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs258
2 files changed, 234 insertions, 224 deletions
diff --git a/OpenSim/Region/Framework/Scenes/GodController.cs b/OpenSim/Region/Framework/Scenes/GodController.cs
index 36483fb..8035760 100644
--- a/OpenSim/Region/Framework/Scenes/GodController.cs
+++ b/OpenSim/Region/Framework/Scenes/GodController.cs
@@ -47,6 +47,12 @@ namespace OpenSim.Region.Framework.Scenes
47{ 47{
48 public class GodController 48 public class GodController
49 { 49 {
50 public enum ImplicitGodLevels : int
51 {
52 EstateManager = 210, // estate manager implicit god level
53 RegionOwner = 220 // region owner implicit god level should be >= than estate
54 }
55
50 ScenePresence m_scenePresence; 56 ScenePresence m_scenePresence;
51 Scene m_scene; 57 Scene m_scene;
52 protected bool m_allowGridGods; 58 protected bool m_allowGridGods;
@@ -56,14 +62,20 @@ namespace OpenSim.Region.Framework.Scenes
56 protected bool m_forceGodModeAlwaysOn; 62 protected bool m_forceGodModeAlwaysOn;
57 protected bool m_allowGodActionsWithoutGodMode; 63 protected bool m_allowGodActionsWithoutGodMode;
58 64
59 protected bool m_viewerUiIsGod = false;
60
61 protected int m_userLevel = 0; 65 protected int m_userLevel = 0;
62 66 // the god level from local or grid user rights
63 public GodController(Scene scene, ScenePresence sp) 67 protected int m_rightsGodLevel = 0;
68 // the level seen by viewers
69 protected int m_godlevel = 0;
70 // new level that can be fixed or equal to godlevel, acording to options
71 protected int m_effectivegodlevel = 0;
72 protected int m_lastLevelToViewer = 0;
73
74 public GodController(Scene scene, ScenePresence sp, int userlevel)
64 { 75 {
65 m_scene = scene; 76 m_scene = scene;
66 m_scenePresence = sp; 77 m_scenePresence = sp;
78 m_userLevel = userlevel;
67 79
68 IConfigSource config = scene.Config; 80 IConfigSource config = scene.Config;
69 81
@@ -81,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes
81 Util.GetConfigVarFromSections<bool>(config, 93 Util.GetConfigVarFromSections<bool>(config,
82 "force_grid_gods_only", sections, false); 94 "force_grid_gods_only", sections, false);
83 95
84 if(!m_forceGridGodsOnly) // damm redundant and error prone option 96 if(!m_forceGridGodsOnly)
85 { 97 {
86 // The owner of a region is a god in his region only. 98 // The owner of a region is a god in his region only.
87 m_regionOwnerIsGod = 99 m_regionOwnerIsGod =
@@ -95,7 +107,7 @@ namespace OpenSim.Region.Framework.Scenes
95 107
96 } 108 }
97 else 109 else
98 m_allowGridGods = true; // reduce user mistakes increased by this over complex options set 110 m_allowGridGods = true; // reduce potencial user mistakes
99 111
100 // God mode should be turned on in the viewer whenever 112 // God mode should be turned on in the viewer whenever
101 // the user has god rights somewhere. They may choose 113 // the user has god rights somewhere. They may choose
@@ -110,76 +122,122 @@ namespace OpenSim.Region.Framework.Scenes
110 m_allowGodActionsWithoutGodMode = 122 m_allowGodActionsWithoutGodMode =
111 Util.GetConfigVarFromSections<bool>(config, 123 Util.GetConfigVarFromSections<bool>(config,
112 "implicit_gods", sections, false); 124 "implicit_gods", sections, false);
113 }
114 125
115 protected int PotentialGodLevel() 126 m_rightsGodLevel = CalcRightsGodLevel();
116 { 127
117 int godLevel = m_allowGridGods ? m_userLevel : 200; 128 if(m_allowGodActionsWithoutGodMode)
118 if ((!m_forceGridGodsOnly) && m_userLevel < 200) 129 {
119 godLevel = 200; 130 m_effectivegodlevel = m_rightsGodLevel;
131
132 m_forceGodModeAlwaysOn = false;
133 }
134
135 else if(m_forceGodModeAlwaysOn)
136 {
137 m_godlevel = m_rightsGodLevel;
138 m_effectivegodlevel = m_rightsGodLevel;
139 }
120 140
121 return godLevel; 141 m_scenePresence.isGod = (m_effectivegodlevel >= 200);
142 m_scenePresence.isLegacyGod = (m_godlevel >= 200);
122 } 143 }
123 144
124 protected bool CanBeGod() 145 // calculates god level at sp creation from local and grid user god rights
146 // for now this is assumed static until user leaves region.
147 // later estate and gride level updates may update this
148 protected int CalcRightsGodLevel()
125 { 149 {
126 if (m_allowGridGods && m_userLevel > 0) 150 int level = 0;
127 return true; 151 if (m_allowGridGods && m_userLevel >= 200)
152 level = m_userLevel;
128 153
129 if(m_forceGridGodsOnly) 154 if(m_forceGridGodsOnly || level >= (int)ImplicitGodLevels.RegionOwner)
130 return false; 155 return level;
131 156
132 if (m_regionOwnerIsGod && m_scene.RegionInfo.EstateSettings.IsEstateOwner(m_scenePresence.UUID)) 157 if (m_regionOwnerIsGod && m_scene.RegionInfo.EstateSettings.IsEstateOwner(m_scenePresence.UUID))
133 return true; 158 level = (int)ImplicitGodLevels.RegionOwner;
159
160 if(level >= (int)ImplicitGodLevels.EstateManager)
161 return level;
134 162
135 if (m_regionManagerIsGod && m_scene.Permissions.IsEstateManager(m_scenePresence.UUID)) 163 if (m_regionManagerIsGod && m_scene.Permissions.IsEstateManager(m_scenePresence.UUID))
136 return true; 164 level = (int)ImplicitGodLevels.EstateManager;
137 165
138 return false; 166 return level;
139 } 167 }
140 168
141 public void SyncViewerState() 169 protected bool CanBeGod()
142 { 170 {
143 bool canBeGod = CanBeGod(); 171 return m_rightsGodLevel >= 200;
144 172 }
145 bool shoudBeGod = m_forceGodModeAlwaysOn ? canBeGod : (m_viewerUiIsGod && canBeGod);
146 173
147 int godLevel = PotentialGodLevel(); 174 protected void UpdateGodLevels(bool viewerState)
175 {
176 if(!CanBeGod())
177 {
178 m_godlevel = 0;
179 m_effectivegodlevel = 0;
180 m_scenePresence.isGod = false;
181 m_scenePresence.isLegacyGod = false;
182 return;
183 }
148 184
149 if (!shoudBeGod) 185 // legacy some are controled by viewer, others are static
150 godLevel = 0; 186 if(m_allowGodActionsWithoutGodMode)
187 {
188 if(viewerState)
189 m_godlevel = m_rightsGodLevel;
190 else
191 m_godlevel = 0;
151 192
152 if (m_viewerUiIsGod != shoudBeGod && (!m_scenePresence.IsChildAgent)) 193 m_effectivegodlevel = m_rightsGodLevel;
194 }
195 else
153 { 196 {
154 m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)godLevel); 197 // new all change with viewer
155 m_viewerUiIsGod = shoudBeGod; 198 if(viewerState)
199 {
200 m_godlevel = m_rightsGodLevel;
201 m_effectivegodlevel = m_rightsGodLevel;
202 }
203 else
204 {
205 m_godlevel = 0;
206 m_effectivegodlevel = 0;
207 }
156 } 208 }
209 m_scenePresence.isGod = (m_effectivegodlevel >= 200);
210 m_scenePresence.isLegacyGod = (m_godlevel >= 200);
157 } 211 }
158 212
159 public bool RequestGodMode(bool god) 213 public void SyncViewerState()
160 { 214 {
161 // this is used by viewer protocol 215 if(m_lastLevelToViewer == m_godlevel)
162 // and they may want a answer 216 return;
163 if (!god) 217
164 { 218 m_lastLevelToViewer = m_godlevel;
165 m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, 0);
166 m_viewerUiIsGod = false;
167 return true;
168 }
169 219
170 if (!CanBeGod()) 220 if(m_scenePresence.IsChildAgent)
171 return false; 221 return;
172 222
173 int godLevel = PotentialGodLevel(); 223 m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)m_godlevel);
174 m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)godLevel);
175 m_viewerUiIsGod = true;
176 return true;
177 } 224 }
178 225
179 public OSD State() 226 public void RequestGodMode(bool god)
180 { 227 {
181 OSDMap godMap = new OSDMap(2); 228 UpdateGodLevels(god);
182 229
230 if(m_lastLevelToViewer != m_godlevel)
231 {
232 m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)m_godlevel);
233 m_lastLevelToViewer = m_godlevel;
234 }
235 }
236
237 public OSD State()
238 {
239 OSDMap godMap = new OSDMap(2);
240 bool m_viewerUiIsGod = m_godlevel >= 200;
183 godMap.Add("ViewerUiIsGod", OSD.FromBoolean(m_viewerUiIsGod)); 241 godMap.Add("ViewerUiIsGod", OSD.FromBoolean(m_viewerUiIsGod));
184 242
185 return godMap; 243 return godMap;
@@ -187,13 +245,26 @@ namespace OpenSim.Region.Framework.Scenes
187 245
188 public void SetState(OSD state) 246 public void SetState(OSD state)
189 { 247 {
190 if(state == null) 248 bool newstate = false;
191 return; 249 if(m_forceGodModeAlwaysOn)
192 250 newstate = true;
193 OSDMap s = (OSDMap)state; 251 else
252 {
253 if(state != null)
254 {
255 OSDMap s = (OSDMap)state;
256
257 if (s.ContainsKey("ViewerUiIsGod"))
258 newstate = s["ViewerUiIsGod"].AsBoolean();
259 m_lastLevelToViewer = m_godlevel; // we are not changing viewer level by default
260 }
261 }
262 UpdateGodLevels(newstate);
263 }
194 264
195 if (s.ContainsKey("ViewerUiIsGod")) 265 public void HasMovedAway()
196 m_viewerUiIsGod = s["ViewerUiIsGod"].AsBoolean(); 266 {
267 m_lastLevelToViewer = 0;
197 } 268 }
198 269
199 public int UserLevel 270 public int UserLevel
@@ -204,29 +275,12 @@ namespace OpenSim.Region.Framework.Scenes
204 275
205 public int GodLevel 276 public int GodLevel
206 { 277 {
207 get 278 get { return m_godlevel; }
208 {
209 int godLevel = PotentialGodLevel();
210 if (!m_viewerUiIsGod)
211 godLevel = 0;
212
213 return godLevel;
214 }
215 } 279 }
216 280
217 public int EffectiveLevel 281 public int EffectiveLevel
218 { 282 {
219 get 283 get { return m_effectivegodlevel; }
220 {
221 int godLevel = PotentialGodLevel();
222 if (m_viewerUiIsGod)
223 return godLevel;
224
225 if (m_allowGodActionsWithoutGodMode && CanBeGod())
226 return godLevel;
227
228 return 0;
229 }
230 } 284 }
231 } 285 }
232} 286}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 15d1f50..dbca68b 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -92,6 +92,14 @@ namespace OpenSim.Region.Framework.Scenes
92 92
93 public bool isNPC { get; private set; } 93 public bool isNPC { get; private set; }
94 94
95 // simple yes or no isGOD from god level >= 200
96 // should only be set by GodController
97 // we have two to suport legacy behaviour
98 // isLegacyGod was controlled by viewer in older versions
99 // isGod may now be also controled by viewer acording to options
100 public bool isLegacyGod { get; set; }
101 public bool isGod { get; set; }
102
95 private PresenceType m_presenceType; 103 private PresenceType m_presenceType;
96 public PresenceType PresenceType { 104 public PresenceType PresenceType {
97 get {return m_presenceType;} 105 get {return m_presenceType;}
@@ -155,7 +163,7 @@ namespace OpenSim.Region.Framework.Scenes
155 public static readonly float MOVEMENT = .25f; 163 public static readonly float MOVEMENT = .25f;
156 public static readonly float SIGNIFICANT_MOVEMENT = 16.0f; 164 public static readonly float SIGNIFICANT_MOVEMENT = 16.0f;
157 public static readonly float CHILDUPDATES_MOVEMENT = 100.0f; 165 public static readonly float CHILDUPDATES_MOVEMENT = 100.0f;
158 public static readonly float CHILDUPDATES_TIME = 10000f; // min time between child updates (ms) 166 public static readonly float CHILDUPDATES_TIME = 2000f; // min time between child updates (ms)
159 167
160 private UUID m_previusParcelUUID = UUID.Zero; 168 private UUID m_previusParcelUUID = UUID.Zero;
161 private UUID m_currentParcelUUID = UUID.Zero; 169 private UUID m_currentParcelUUID = UUID.Zero;
@@ -186,7 +194,7 @@ namespace OpenSim.Region.Framework.Scenes
186 m_currentParcelHide = true; 194 m_currentParcelHide = true;
187 195
188 if (m_previusParcelUUID != UUID.Zero || checksame) 196 if (m_previusParcelUUID != UUID.Zero || checksame)
189 ParcelCrossCheck(m_currentParcelUUID,m_previusParcelUUID,m_currentParcelHide, m_previusParcelHide, oldhide,checksame); 197 ParcelCrossCheck(m_currentParcelUUID, m_previusParcelUUID, m_currentParcelHide, m_previusParcelHide, oldhide,checksame);
190 } 198 }
191 } 199 }
192 } 200 }
@@ -267,8 +275,6 @@ namespace OpenSim.Region.Framework.Scenes
267 private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; 275 private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO;
268 private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; 276 private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO;
269 private bool MouseDown = false; 277 private bool MouseDown = false;
270// private SceneObjectGroup proxyObjectGroup;
271 //private SceneObjectPart proxyObjectPart = null;
272 public Vector3 lastKnownAllowedPosition; 278 public Vector3 lastKnownAllowedPosition;
273 public bool sentMessageAboutRestrictedParcelFlyingDown; 279 public bool sentMessageAboutRestrictedParcelFlyingDown;
274 public Vector4 CollisionPlane = Vector4.UnitW; 280 public Vector4 CollisionPlane = Vector4.UnitW;
@@ -281,9 +287,6 @@ namespace OpenSim.Region.Framework.Scenes
281 287
282 private bool m_followCamAuto = false; 288 private bool m_followCamAuto = false;
283 289
284// private object m_forceToApplyLock = new object();
285// private bool m_forceToApplyValid;
286// private Vector3 m_forceToApply;
287 private int m_userFlags; 290 private int m_userFlags;
288 public int UserFlags 291 public int UserFlags
289 { 292 {
@@ -304,9 +307,6 @@ namespace OpenSim.Region.Framework.Scenes
304 set { PhysicsActor.IsColliding = value; } 307 set { PhysicsActor.IsColliding = value; }
305 } 308 }
306 309
307// private int m_lastColCount = -1; //KF: Look for Collision chnages
308// private int m_updateCount = 0; //KF: Update Anims for a while
309// private static readonly int UPDATE_COUNT = 10; // how many frames to update for
310 private List<uint> m_lastColliders = new List<uint>(); 310 private List<uint> m_lastColliders = new List<uint>();
311 311
312 private TeleportFlags m_teleportFlags; 312 private TeleportFlags m_teleportFlags;
@@ -332,8 +332,10 @@ namespace OpenSim.Region.Framework.Scenes
332 332
333 private float m_sitAvatarHeight = 2.0f; 333 private float m_sitAvatarHeight = 2.0f;
334 334
335 private bool childUpdatesBusy = false; 335 private bool m_childUpdatesBusy = false;
336 private int lastChildUpdatesTime; 336 private int m_lastChildUpdatesTime;
337 private int m_lastChildAgentUpdateGodLevel;
338 private float m_lastChildAgentUpdateDrawDistance;
337 private Vector3 m_lastChildAgentUpdatePosition; 339 private Vector3 m_lastChildAgentUpdatePosition;
338// private Vector3 m_lastChildAgentUpdateCamPosition; 340// private Vector3 m_lastChildAgentUpdateCamPosition;
339 341
@@ -348,8 +350,6 @@ namespace OpenSim.Region.Framework.Scenes
348 private float m_healRate = 1f; 350 private float m_healRate = 1f;
349 private float m_healRatePerFrame = 0.05f; 351 private float m_healRatePerFrame = 0.05f;
350 352
351// protected ulong crossingFromRegion;
352
353 private readonly Vector3[] Dir_Vectors = new Vector3[12]; 353 private readonly Vector3[] Dir_Vectors = new Vector3[12];
354 354
355 protected int m_reprioritizationLastTime; 355 protected int m_reprioritizationLastTime;
@@ -372,10 +372,7 @@ namespace OpenSim.Region.Framework.Scenes
372 private const int NumMovementsBetweenRayCast = 5; 372 private const int NumMovementsBetweenRayCast = 5;
373 373
374 private bool CameraConstraintActive; 374 private bool CameraConstraintActive;
375 //private int m_moveToPositionStateStatus;
376 //*****************************************************
377 375
378 //private bool m_collisionEventFlag = false;
379 private object m_collisionEventLock = new Object(); 376 private object m_collisionEventLock = new Object();
380 377
381 private int m_movementAnimationUpdateCounter = 0; 378 private int m_movementAnimationUpdateCounter = 0;
@@ -529,7 +526,6 @@ namespace OpenSim.Region.Framework.Scenes
529 private bool m_doingCamRayCast = false; 526 private bool m_doingCamRayCast = false;
530 527
531 public Vector3 CameraPosition { get; set; } 528 public Vector3 CameraPosition { get; set; }
532
533 public Quaternion CameraRotation { get; private set; } 529 public Quaternion CameraRotation { get; private set; }
534 530
535 // Use these three vectors to figure out what the agent is looking at 531 // Use these three vectors to figure out what the agent is looking at
@@ -589,7 +585,6 @@ namespace OpenSim.Region.Framework.Scenes
589 public bool AllowMovement { get; set; } 585 public bool AllowMovement { get; set; }
590 586
591 private bool m_setAlwaysRun; 587 private bool m_setAlwaysRun;
592
593 public bool SetAlwaysRun 588 public bool SetAlwaysRun
594 { 589 {
595 get 590 get
@@ -613,7 +608,6 @@ namespace OpenSim.Region.Framework.Scenes
613 } 608 }
614 } 609 }
615 610
616
617 public byte State { get; set; } 611 public byte State { get; set; }
618 612
619 private AgentManager.ControlFlags m_AgentControlFlags; 613 private AgentManager.ControlFlags m_AgentControlFlags;
@@ -935,27 +929,7 @@ namespace OpenSim.Region.Framework.Scenes
935 seeds = Scene.CapsModule.GetChildrenSeeds(UUID); 929 seeds = Scene.CapsModule.GetChildrenSeeds(UUID);
936 else 930 else
937 seeds = new Dictionary<ulong, string>(); 931 seeds = new Dictionary<ulong, string>();
938
939/* we can't do this anymore
940 List<ulong> old = new List<ulong>();
941 foreach (ulong handle in seeds.Keys)
942 {
943 uint x, y;
944 Util.RegionHandleToRegionLoc(handle, out x, out y);
945// if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY,))
946 {
947 old.Add(handle);
948 }
949 }
950
951 DropOldNeighbours(old);
952
953 if (Scene.CapsModule != null)
954 Scene.CapsModule.SetChildrenSeed(UUID, seeds);
955*/
956 KnownRegions = seeds; 932 KnownRegions = seeds;
957 //m_log.Debug(" ++++++++++AFTER+++++++++++++ ");
958 //DumpKnownRegions();
959 } 933 }
960 934
961 public void DumpKnownRegions() 935 public void DumpKnownRegions()
@@ -1045,7 +1019,6 @@ namespace OpenSim.Region.Framework.Scenes
1045 public ScenePresence( 1019 public ScenePresence(
1046 IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) 1020 IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type)
1047 { 1021 {
1048
1049 m_scene = world; 1022 m_scene = world;
1050 AttachmentsSyncLock = new Object(); 1023 AttachmentsSyncLock = new Object();
1051 AllowMovement = true; 1024 AllowMovement = true;
@@ -1075,9 +1048,7 @@ namespace OpenSim.Region.Framework.Scenes
1075 if (account != null) 1048 if (account != null)
1076 userlevel = account.UserLevel; 1049 userlevel = account.UserLevel;
1077 1050
1078// GodController = new GodController(world, this, userlevel); 1051 GodController = new GodController(world, this, userlevel);
1079 GodController = new GodController(world, this);
1080 GodController.UserLevel = userlevel;
1081 1052
1082 // IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); 1053 // IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
1083 // if (gm != null) 1054 // if (gm != null)
@@ -1091,7 +1062,7 @@ namespace OpenSim.Region.Framework.Scenes
1091 m_reprioritizationLastDrawDistance = DrawDistance; 1062 m_reprioritizationLastDrawDistance = DrawDistance;
1092 1063
1093 // disable updates workjobs for now 1064 // disable updates workjobs for now
1094 childUpdatesBusy = true; 1065 m_childUpdatesBusy = true;
1095 m_reprioritizationBusy = true; 1066 m_reprioritizationBusy = true;
1096 1067
1097 AdjustKnownSeeds(); 1068 AdjustKnownSeeds();
@@ -1293,8 +1264,7 @@ namespace OpenSim.Region.Framework.Scenes
1293 IsLoggingIn = false; 1264 IsLoggingIn = false;
1294 } 1265 }
1295 1266
1296 IsChildAgent = false; 1267 IsChildAgent = false;
1297
1298 } 1268 }
1299 1269
1300 m_log.DebugFormat("[MakeRootAgent] out lock: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1270 m_log.DebugFormat("[MakeRootAgent] out lock: {0}ms", Util.EnvironmentTickCountSubtract(ts));
@@ -1304,7 +1274,6 @@ namespace OpenSim.Region.Framework.Scenes
1304 // Should not be needed if we are not trying to tell this region to close 1274 // Should not be needed if we are not trying to tell this region to close
1305 // DoNotCloseAfterTeleport = false; 1275 // DoNotCloseAfterTeleport = false;
1306 1276
1307
1308 RegionHandle = m_scene.RegionInfo.RegionHandle; 1277 RegionHandle = m_scene.RegionInfo.RegionHandle;
1309 1278
1310 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); 1279 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene);
@@ -1447,7 +1416,6 @@ namespace OpenSim.Region.Framework.Scenes
1447 } 1416 }
1448 } 1417 }
1449 1418
1450
1451 m_log.DebugFormat("[MakeRootAgent] position and physical: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1419 m_log.DebugFormat("[MakeRootAgent] position and physical: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1452 m_scene.SwapRootAgentCount(false); 1420 m_scene.SwapRootAgentCount(false);
1453 1421
@@ -1782,17 +1750,14 @@ namespace OpenSim.Region.Framework.Scenes
1782 1750
1783 if (m_AngularVelocity.Z > 0) 1751 if (m_AngularVelocity.Z > 0)
1784 { 1752 {
1785
1786 float leftOverToMin = m_AngularVelocity.Z - rollMinRadians; 1753 float leftOverToMin = m_AngularVelocity.Z - rollMinRadians;
1787 if (amount > leftOverToMin) 1754 if (amount > leftOverToMin)
1788 return -leftOverToMin; 1755 return -leftOverToMin;
1789 else 1756 else
1790 return -amount; 1757 return -amount;
1791
1792 } 1758 }
1793 else 1759 else
1794 { 1760 {
1795
1796 float leftOverToMin = -m_AngularVelocity.Z - rollMinRadians; 1761 float leftOverToMin = -m_AngularVelocity.Z - rollMinRadians;
1797 if (amount > leftOverToMin) 1762 if (amount > leftOverToMin)
1798 return leftOverToMin; 1763 return leftOverToMin;
@@ -1801,8 +1766,6 @@ namespace OpenSim.Region.Framework.Scenes
1801 } 1766 }
1802 } 1767 }
1803 1768
1804
1805
1806 // neighbouring regions we have enabled a child agent in 1769 // neighbouring regions we have enabled a child agent in
1807 // holds the seed cap for the child agent in that region 1770 // holds the seed cap for the child agent in that region
1808 private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); 1771 private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>();
@@ -1815,7 +1778,6 @@ namespace OpenSim.Region.Framework.Scenes
1815 1778
1816 private Dictionary<ulong, spRegionSizeInfo> m_knownChildRegionsSizeInfo = new Dictionary<ulong, spRegionSizeInfo>(); 1779 private Dictionary<ulong, spRegionSizeInfo> m_knownChildRegionsSizeInfo = new Dictionary<ulong, spRegionSizeInfo>();
1817 1780
1818
1819 public void AddNeighbourRegionSizeInfo(GridRegion region) 1781 public void AddNeighbourRegionSizeInfo(GridRegion region)
1820 { 1782 {
1821 lock (m_knownChildRegions) 1783 lock (m_knownChildRegions)
@@ -1946,7 +1908,6 @@ namespace OpenSim.Region.Framework.Scenes
1946 lock (m_originRegionIDAccessLock) 1908 lock (m_originRegionIDAccessLock)
1947 originID = m_originRegionID; 1909 originID = m_originRegionID;
1948 1910
1949
1950 while (originID.Equals(UUID.Zero) && count-- > 0) 1911 while (originID.Equals(UUID.Zero) && count-- > 0)
1951 { 1912 {
1952 lock (m_originRegionIDAccessLock) 1913 lock (m_originRegionIDAccessLock)
@@ -2020,8 +1981,6 @@ namespace OpenSim.Region.Framework.Scenes
2020 if (!WaitForUpdateAgent(client)) 1981 if (!WaitForUpdateAgent(client))
2021 // The sending region never sent the UpdateAgent data, we have to refuse 1982 // The sending region never sent the UpdateAgent data, we have to refuse
2022 return; 1983 return;
2023
2024 GodController.SyncViewerState();
2025 } 1984 }
2026 1985
2027 m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1986 m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
@@ -2070,13 +2029,11 @@ namespace OpenSim.Region.Framework.Scenes
2070 m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); 2029 m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF);
2071 } 2030 }
2072 2031
2073
2074 // Tell the client that we're totally ready 2032 // Tell the client that we're totally ready
2075 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 2033 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
2076 2034
2077 m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2035 m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2078 2036
2079
2080 if (!string.IsNullOrEmpty(m_callbackURI)) 2037 if (!string.IsNullOrEmpty(m_callbackURI))
2081 { 2038 {
2082 // We cannot sleep here since this would hold up the inbound packet processing thread, as 2039 // We cannot sleep here since this would hold up the inbound packet processing thread, as
@@ -2105,7 +2062,6 @@ namespace OpenSim.Region.Framework.Scenes
2105// client.Name, client.AgentId, m_scene.RegionInfo.RegionName); 2062// client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
2106// } 2063// }
2107 2064
2108
2109 m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2065 m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2110 2066
2111 if(m_teleportFlags > 0) 2067 if(m_teleportFlags > 0)
@@ -2125,18 +2081,19 @@ namespace OpenSim.Region.Framework.Scenes
2125 m_log.DebugFormat("[CompleteMovement] HG"); 2081 m_log.DebugFormat("[CompleteMovement] HG");
2126 } 2082 }
2127 2083
2128 if(!IsChildAgent && !isNPC)
2129 GodController.SyncViewerState();
2130
2131// start sending terrain patchs
2132 if (!gotCrossUpdate && !isNPC)
2133 Scene.SendLayerData(ControllingClient);
2134
2135 m_previusParcelHide = false; 2084 m_previusParcelHide = false;
2136 m_previusParcelUUID = UUID.Zero; 2085 m_previusParcelUUID = UUID.Zero;
2137 m_currentParcelHide = false; 2086 m_currentParcelHide = false;
2138 m_currentParcelUUID = UUID.Zero; 2087 m_currentParcelUUID = UUID.Zero;
2139 2088
2089 if(!isNPC)
2090 {
2091 GodController.SyncViewerState();
2092
2093 // start sending terrain patchs
2094 if (!gotCrossUpdate)
2095 Scene.SendLayerData(ControllingClient);
2096 }
2140 // send initial land overlay and parcel 2097 // send initial land overlay and parcel
2141 ILandChannel landch = m_scene.LandChannel; 2098 ILandChannel landch = m_scene.LandChannel;
2142 if (landch != null) 2099 if (landch != null)
@@ -2185,7 +2142,6 @@ namespace OpenSim.Region.Framework.Scenes
2185 if (haveAnims) 2142 if (haveAnims)
2186 SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); 2143 SendAnimPackToAgent(this, animIDs, animseqs, animsobjs);
2187 2144
2188
2189 // we should be able to receive updates, etc 2145 // we should be able to receive updates, etc
2190 // so release them 2146 // so release them
2191 m_inTransit = false; 2147 m_inTransit = false;
@@ -2200,7 +2156,7 @@ namespace OpenSim.Region.Framework.Scenes
2200 if (p == this) 2156 if (p == this)
2201 continue; 2157 continue;
2202 2158
2203 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) 2159 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
2204 continue; 2160 continue;
2205 2161
2206 SendAppearanceToAgentNF(p); 2162 SendAppearanceToAgentNF(p);
@@ -2250,7 +2206,7 @@ namespace OpenSim.Region.Framework.Scenes
2250 continue; 2206 continue;
2251 } 2207 }
2252 2208
2253 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) 2209 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
2254 continue; 2210 continue;
2255 2211
2256 SendAttachmentsToAgentNF(p); 2212 SendAttachmentsToAgentNF(p);
@@ -2267,10 +2223,13 @@ namespace OpenSim.Region.Framework.Scenes
2267 { 2223 {
2268 m_agentTransfer.EnableChildAgents(this); 2224 m_agentTransfer.EnableChildAgents(this);
2269 } 2225 }
2270 // let updates be sent, with some delay
2271 lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000;
2272 childUpdatesBusy = false; // allow them
2273 } 2226 }
2227 // let updates be sent, with some delay
2228 m_lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000;
2229 m_lastChildAgentUpdateGodLevel = GodController.GodLevel;
2230 m_lastChildAgentUpdateDrawDistance = DrawDistance;
2231 m_lastChildAgentUpdatePosition = AbsolutePosition;
2232 m_childUpdatesBusy = false; // allow them
2274 } 2233 }
2275 2234
2276 m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2235 m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts));
@@ -2300,7 +2259,6 @@ namespace OpenSim.Region.Framework.Scenes
2300 m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2259 m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2301 2260
2302 } 2261 }
2303
2304 } 2262 }
2305 finally 2263 finally
2306 { 2264 {
@@ -2309,14 +2267,7 @@ namespace OpenSim.Region.Framework.Scenes
2309 crossingFlags = 0; 2267 crossingFlags = 0;
2310 m_inTransit = false; 2268 m_inTransit = false;
2311 } 2269 }
2312 // if hide force a check 2270
2313 // if (!IsChildAgent && newhide)
2314 // {
2315 // ParcelLoginCheck(m_currentParcelUUID);
2316 // m_currentParcelHide = newhide;
2317 // }
2318
2319
2320 m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd; 2271 m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd;
2321 2272
2322 m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2273 m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts));
@@ -3228,7 +3179,6 @@ namespace OpenSim.Region.Framework.Scenes
3228 if (part == null) 3179 if (part == null)
3229 return; 3180 return;
3230 3181
3231
3232 if (PhysicsActor != null) 3182 if (PhysicsActor != null)
3233 m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f; 3183 m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f;
3234 3184
@@ -3257,7 +3207,6 @@ namespace OpenSim.Region.Framework.Scenes
3257 3207
3258 if (canSit) 3208 if (canSit)
3259 { 3209 {
3260
3261 if (PhysicsActor != null) 3210 if (PhysicsActor != null)
3262 { 3211 {
3263 // We can remove the physicsActor until they stand up. 3212 // We can remove the physicsActor until they stand up.
@@ -3368,7 +3317,6 @@ namespace OpenSim.Region.Framework.Scenes
3368 return false; 3317 return false;
3369 } 3318 }
3370 3319
3371
3372 private bool CanEnterLandPosition(Vector3 testPos) 3320 private bool CanEnterLandPosition(Vector3 testPos)
3373 { 3321 {
3374 ILandObject land = m_scene.LandChannel.GetLandObject(testPos.X, testPos.Y); 3322 ILandObject land = m_scene.LandChannel.GetLandObject(testPos.X, testPos.Y);
@@ -3448,7 +3396,6 @@ namespace OpenSim.Region.Framework.Scenes
3448 ControllingClient.SendSitResponse( 3396 ControllingClient.SendSitResponse(
3449 part.ParentGroup.UUID, offset, Orientation, true, cameraAtOffset, cameraEyeOffset, forceMouselook); 3397 part.ParentGroup.UUID, offset, Orientation, true, cameraAtOffset, cameraEyeOffset, forceMouselook);
3450 3398
3451
3452 SendAvatarDataToAllAgents(); 3399 SendAvatarDataToAllAgents();
3453 3400
3454 if (status == 3) 3401 if (status == 3)
@@ -3658,8 +3605,6 @@ namespace OpenSim.Region.Framework.Scenes
3658 Animator.avnChangeAnim(animID, addRemove, sendPack); 3605 Animator.avnChangeAnim(animID, addRemove, sendPack);
3659 } 3606 }
3660 3607
3661
3662
3663 /// <summary> 3608 /// <summary>
3664 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector 3609 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector
3665 /// </summary> 3610 /// </summary>
@@ -3866,7 +3811,7 @@ namespace OpenSim.Region.Framework.Scenes
3866 if (!remoteClient.IsActive) 3811 if (!remoteClient.IsActive)
3867 return; 3812 return;
3868 3813
3869 if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID && p.GodController.GodLevel < 200) 3814 if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID && !p.isLegacyGod)
3870 return; 3815 return;
3871 3816
3872 //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); 3817 //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity);
@@ -3976,7 +3921,7 @@ namespace OpenSim.Region.Framework.Scenes
3976 // get the avatar, then a kill if can't see it 3921 // get the avatar, then a kill if can't see it
3977 p.SendInitialAvatarDataToAgent(this); 3922 p.SendInitialAvatarDataToAgent(this);
3978 3923
3979 if (p.ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && GodController.GodLevel < 200) 3924 if (p.ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !isLegacyGod)
3980 return; 3925 return;
3981 3926
3982 p.SendAppearanceToAgentNF(this); 3927 p.SendAppearanceToAgentNF(this);
@@ -4024,7 +3969,7 @@ namespace OpenSim.Region.Framework.Scenes
4024 foreach (ScenePresence p in presences) 3969 foreach (ScenePresence p in presences)
4025 { 3970 {
4026 p.ControllingClient.SendAvatarDataImmediate(this); 3971 p.ControllingClient.SendAvatarDataImmediate(this);
4027 if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) 3972 if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
4028 // either just kill the object 3973 // either just kill the object
4029 // p.ControllingClient.SendKillObject(new List<uint> {LocalId}); 3974 // p.ControllingClient.SendKillObject(new List<uint> {LocalId});
4030 // or also attachments viewer may still know about 3975 // or also attachments viewer may still know about
@@ -4037,7 +3982,7 @@ namespace OpenSim.Region.Framework.Scenes
4037 public void SendInitialAvatarDataToAgent(ScenePresence p) 3982 public void SendInitialAvatarDataToAgent(ScenePresence p)
4038 { 3983 {
4039 p.ControllingClient.SendAvatarDataImmediate(this); 3984 p.ControllingClient.SendAvatarDataImmediate(this);
4040 if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) 3985 if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
4041 // either just kill the object 3986 // either just kill the object
4042 // p.ControllingClient.SendKillObject(new List<uint> {LocalId}); 3987 // p.ControllingClient.SendKillObject(new List<uint> {LocalId});
4043 // or also attachments viewer may still know about 3988 // or also attachments viewer may still know about
@@ -4051,7 +3996,7 @@ namespace OpenSim.Region.Framework.Scenes
4051 public void SendAvatarDataToAgent(ScenePresence avatar) 3996 public void SendAvatarDataToAgent(ScenePresence avatar)
4052 { 3997 {
4053 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); 3998 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
4054 if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodController.GodLevel < 200) 3999 if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.isLegacyGod)
4055 return; 4000 return;
4056 avatar.ControllingClient.SendAvatarDataImmediate(this); 4001 avatar.ControllingClient.SendAvatarDataImmediate(this);
4057 } 4002 }
@@ -4096,7 +4041,7 @@ namespace OpenSim.Region.Framework.Scenes
4096 { 4041 {
4097 // m_log.DebugFormat( 4042 // m_log.DebugFormat(
4098 // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); 4043 // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
4099 if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodController.GodLevel < 200) 4044 if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.isLegacyGod)
4100 return; 4045 return;
4101 SendAppearanceToAgentNF(avatar); 4046 SendAppearanceToAgentNF(avatar);
4102 } 4047 }
@@ -4112,7 +4057,7 @@ namespace OpenSim.Region.Framework.Scenes
4112 if (IsChildAgent || Animator == null) 4057 if (IsChildAgent || Animator == null)
4113 return; 4058 return;
4114 4059
4115 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) 4060 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
4116 return; 4061 return;
4117 4062
4118 Animator.SendAnimPackToClient(p.ControllingClient); 4063 Animator.SendAnimPackToClient(p.ControllingClient);
@@ -4123,7 +4068,7 @@ namespace OpenSim.Region.Framework.Scenes
4123 if (IsChildAgent) 4068 if (IsChildAgent)
4124 return; 4069 return;
4125 4070
4126 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) 4071 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
4127 return; 4072 return;
4128 4073
4129 p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); 4074 p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs);
@@ -4148,7 +4093,7 @@ namespace OpenSim.Region.Framework.Scenes
4148 4093
4149 m_scene.ForEachScenePresence(delegate(ScenePresence p) 4094 m_scene.ForEachScenePresence(delegate(ScenePresence p)
4150 { 4095 {
4151 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) 4096 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
4152 return; 4097 return;
4153 p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); 4098 p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs);
4154 }); 4099 });
@@ -4183,7 +4128,7 @@ namespace OpenSim.Region.Framework.Scenes
4183 if(DrawDistance > minregionSize && m_reprioritizationLastDrawDistance > minregionSize) 4128 if(DrawDistance > minregionSize && m_reprioritizationLastDrawDistance > minregionSize)
4184 byDrawdistance = false; 4129 byDrawdistance = false;
4185 else 4130 else
4186 byDrawdistance = (Math.Abs(DrawDistance-m_reprioritizationLastDrawDistance) > 0.5f * limit); 4131 byDrawdistance = (Math.Abs(DrawDistance - m_reprioritizationLastDrawDistance) > 0.5f * limit);
4187 } 4132 }
4188 4133
4189 int tdiff = Util.EnvironmentTickCountSubtract(m_reprioritizationLastTime); 4134 int tdiff = Util.EnvironmentTickCountSubtract(m_reprioritizationLastTime);
@@ -4232,7 +4177,7 @@ namespace OpenSim.Region.Framework.Scenes
4232 // updates priority recalc 4177 // updates priority recalc
4233 checkRePrioritization(); 4178 checkRePrioritization();
4234 4179
4235 if(childUpdatesBusy) 4180 if(m_childUpdatesBusy)
4236 return; 4181 return;
4237 4182
4238 //possible KnownRegionHandles always contains current region and this check is not needed 4183 //possible KnownRegionHandles always contains current region and this check is not needed
@@ -4242,37 +4187,52 @@ namespace OpenSim.Region.Framework.Scenes
4242 4187
4243 if(KnownRegionHandles.Count > minhandles) 4188 if(KnownRegionHandles.Count > minhandles)
4244 { 4189 {
4245 int tdiff = Util.EnvironmentTickCountSubtract(lastChildUpdatesTime); 4190 int tdiff = Util.EnvironmentTickCountSubtract(m_lastChildUpdatesTime);
4246 if(tdiff > CHILDUPDATES_TIME) 4191 if(tdiff < CHILDUPDATES_TIME)
4192 return;
4193
4194 bool doUpdate = false;
4195 if(m_lastChildAgentUpdateGodLevel != GodController.GodLevel)
4196 doUpdate = true;
4197
4198 if(!doUpdate && Math.Abs(DrawDistance - m_lastChildAgentUpdateDrawDistance) > 32.0f)
4199 doUpdate = true;
4200
4201 if(!doUpdate)
4247 { 4202 {
4248 diff = pos - m_lastChildAgentUpdatePosition; 4203 diff = pos - m_lastChildAgentUpdatePosition;
4249 if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT) 4204 if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT)
4250 { 4205 doUpdate = true;
4251 childUpdatesBusy = true; 4206 }
4252 m_lastChildAgentUpdatePosition = pos; 4207
4208 if(doUpdate)
4209 {
4210 m_childUpdatesBusy = true;
4211 m_lastChildAgentUpdatePosition = pos;
4212 m_lastChildAgentUpdateGodLevel = GodController.GodLevel;
4213 m_lastChildAgentUpdateDrawDistance = DrawDistance;
4253// m_lastChildAgentUpdateCamPosition = CameraPosition; 4214// m_lastChildAgentUpdateCamPosition = CameraPosition;
4254 4215
4255 AgentPosition agentpos = new AgentPosition(); 4216 AgentPosition agentpos = new AgentPosition();
4256 agentpos.AgentID = new UUID(UUID.Guid); 4217 agentpos.AgentID = new UUID(UUID.Guid);
4257 agentpos.SessionID = ControllingClient.SessionId; 4218 agentpos.SessionID = ControllingClient.SessionId;
4258 agentpos.Size = Appearance.AvatarSize; 4219 agentpos.Size = Appearance.AvatarSize;
4259 agentpos.Center = CameraPosition; 4220 agentpos.Center = CameraPosition;
4260 agentpos.Far = DrawDistance; 4221 agentpos.Far = DrawDistance;
4261 agentpos.Position = AbsolutePosition; 4222 agentpos.Position = AbsolutePosition;
4262 agentpos.Velocity = Velocity; 4223 agentpos.Velocity = Velocity;
4263 agentpos.RegionHandle = RegionHandle; 4224 agentpos.RegionHandle = RegionHandle;
4264 agentpos.GodData = GodController.State(); 4225 agentpos.GodData = GodController.State();
4265 agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); 4226 agentpos.Throttles = ControllingClient.GetThrottlesPacked(1);
4266 4227
4267 // Let's get this out of the update loop 4228 // Let's get this out of the update loop
4268 Util.FireAndForget( 4229 Util.FireAndForget(
4269 o => 4230 o =>
4270 { 4231 {
4271 m_scene.SendOutChildAgentUpdates(agentpos, this); 4232 m_scene.SendOutChildAgentUpdates(agentpos, this);
4272 lastChildUpdatesTime = Util.EnvironmentTickCount(); 4233 m_lastChildUpdatesTime = Util.EnvironmentTickCount();
4273 childUpdatesBusy = false; 4234 m_childUpdatesBusy = false;
4274 }, null, "ScenePresence.SendOutChildAgentUpdates"); 4235 }, null, "ScenePresence.SendOutChildAgentUpdates");
4275 }
4276 } 4236 }
4277 } 4237 }
4278 } 4238 }
@@ -4513,11 +4473,10 @@ namespace OpenSim.Region.Framework.Scenes
4513 if (isNPC) 4473 if (isNPC)
4514 return; 4474 return;
4515 4475
4516 bool wasgod = (GodController.GodLevel >= 200); 4476 bool wasgod = isLegacyGod;
4517 GodController.RequestGodMode(godStatus); 4477 GodController.RequestGodMode(godStatus);
4518 bool isgod = GodController.GodLevel >= 200; 4478 if (wasgod != isLegacyGod)
4519 if (wasgod != isgod) 4479 parcelGodCheck(m_currentParcelUUID);
4520 parcelGodCheck(m_currentParcelUUID, isgod);
4521 } 4480 }
4522 4481
4523 #region Child Agent Updates 4482 #region Child Agent Updates
@@ -4697,7 +4656,6 @@ namespace OpenSim.Region.Framework.Scenes
4697 Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); 4656 Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis);
4698 CameraRotation = camRot; 4657 CameraRotation = camRot;
4699 4658
4700
4701 ParentUUID = cAgent.ParentPart; 4659 ParentUUID = cAgent.ParentPart;
4702 PrevSitOffset = cAgent.SitOffset; 4660 PrevSitOffset = cAgent.SitOffset;
4703 4661
@@ -4883,7 +4841,6 @@ namespace OpenSim.Region.Framework.Scenes
4883 ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); 4841 ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true);
4884 } 4842 }
4885 4843
4886
4887 /// <summary> 4844 /// <summary>
4888 /// Event called by the physics plugin to tell the avatar about a collision. 4845 /// Event called by the physics plugin to tell the avatar about a collision.
4889 /// </summary> 4846 /// </summary>
@@ -4952,7 +4909,7 @@ namespace OpenSim.Region.Framework.Scenes
4952 RaiseCollisionScriptEvents(coldata); 4909 RaiseCollisionScriptEvents(coldata);
4953 4910
4954 // Gods do not take damage and Invulnerable is set depending on parcel/region flags 4911 // Gods do not take damage and Invulnerable is set depending on parcel/region flags
4955 if (Invulnerable || GodController.GodLevel > 0) 4912 if (Invulnerable || isLegacyGod)
4956 return; 4913 return;
4957 4914
4958 // The following may be better in the ICombatModule 4915 // The following may be better in the ICombatModule
@@ -5237,7 +5194,7 @@ namespace OpenSim.Region.Framework.Scenes
5237 if (p != this && sog.HasPrivateAttachmentPoint) 5194 if (p != this && sog.HasPrivateAttachmentPoint)
5238 return; 5195 return;
5239 5196
5240 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) 5197 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
5241 return; 5198 return;
5242 5199
5243 SendTerseUpdateToAgentNF(p); 5200 SendTerseUpdateToAgentNF(p);
@@ -5351,7 +5308,7 @@ namespace OpenSim.Region.Framework.Scenes
5351 if (p == this) 5308 if (p == this)
5352 continue; 5309 continue;
5353 5310
5354 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) 5311 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
5355 continue; 5312 continue;
5356 5313
5357 p.ControllingClient.SendEntityUpdate(rootpart, rootflag); 5314 p.ControllingClient.SendEntityUpdate(rootpart, rootflag);
@@ -5403,14 +5360,13 @@ namespace OpenSim.Region.Framework.Scenes
5403 if (sog.HasPrivateAttachmentPoint) 5360 if (sog.HasPrivateAttachmentPoint)
5404 return; 5361 return;
5405 5362
5406
5407 List<ScenePresence> allPresences = m_scene.GetScenePresences(); 5363 List<ScenePresence> allPresences = m_scene.GetScenePresences();
5408 foreach (ScenePresence p in allPresences) 5364 foreach (ScenePresence p in allPresences)
5409 { 5365 {
5410 if (p == this) 5366 if (p == this)
5411 continue; 5367 continue;
5412 5368
5413 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) 5369 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
5414 continue; 5370 continue;
5415 5371
5416 p.ControllingClient.SendEntityUpdate(rootpart, flag); 5372 p.ControllingClient.SendEntityUpdate(rootpart, flag);
@@ -5460,7 +5416,7 @@ namespace OpenSim.Region.Framework.Scenes
5460 if (p == this) 5416 if (p == this)
5461 continue; 5417 continue;
5462 5418
5463 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) 5419 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
5464 continue; 5420 continue;
5465 5421
5466 p.ControllingClient.SendEntityUpdate(part, flag); 5422 p.ControllingClient.SendEntityUpdate(part, flag);
@@ -5501,7 +5457,7 @@ namespace OpenSim.Region.Framework.Scenes
5501 { 5457 {
5502 if (p == this) 5458 if (p == this)
5503 continue; 5459 continue;
5504 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodController.GodLevel < 200) 5460 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
5505 continue; 5461 continue;
5506 5462
5507 p.ControllingClient.SendEntityUpdate(part, flag); 5463 p.ControllingClient.SendEntityUpdate(part, flag);
@@ -6139,7 +6095,7 @@ namespace OpenSim.Region.Framework.Scenes
6139 // the TP point. This behaviour mimics agni. 6095 // the TP point. This behaviour mimics agni.
6140 if (land.LandData.LandingType == (byte)LandingType.LandingPoint && 6096 if (land.LandData.LandingType == (byte)LandingType.LandingPoint &&
6141 land.LandData.UserLocation != Vector3.Zero && 6097 land.LandData.UserLocation != Vector3.Zero &&
6142 GodController.GodLevel < 200 && 6098 !isLegacyGod &&
6143 ((land.LandData.OwnerID != m_uuid && 6099 ((land.LandData.OwnerID != m_uuid &&
6144 !m_scene.Permissions.IsGod(m_uuid) && 6100 !m_scene.Permissions.IsGod(m_uuid) &&
6145 !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || 6101 !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) ||
@@ -6164,7 +6120,7 @@ namespace OpenSim.Region.Framework.Scenes
6164 string reason; 6120 string reason;
6165 6121
6166 // dont mess with gods 6122 // dont mess with gods
6167 if(GodController.GodLevel >= 200 || m_scene.Permissions.IsGod(m_uuid)) 6123 if(isLegacyGod || m_scene.Permissions.IsGod(m_uuid))
6168 return true; 6124 return true;
6169 6125
6170 // respect region owner and managers 6126 // respect region owner and managers
@@ -6450,7 +6406,7 @@ namespace OpenSim.Region.Framework.Scenes
6450 6406
6451 } 6407 }
6452 6408
6453 private void parcelGodCheck(UUID currentParcelID, bool isGod) 6409 private void parcelGodCheck(UUID currentParcelID)
6454 { 6410 {
6455 List<ScenePresence> allpresences = m_scene.GetScenePresences(); 6411 List<ScenePresence> allpresences = m_scene.GetScenePresences();
6456 6412
@@ -6461,7 +6417,7 @@ namespace OpenSim.Region.Framework.Scenes
6461 6417
6462 if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelID) 6418 if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelID)
6463 { 6419 {
6464 if (isGod) 6420 if (isLegacyGod)
6465 p.SendViewTo(this); 6421 p.SendViewTo(this);
6466 else 6422 else
6467 p.SendKillTo(this); 6423 p.SendKillTo(this);
@@ -6470,7 +6426,7 @@ namespace OpenSim.Region.Framework.Scenes
6470 } 6426 }
6471 6427
6472 private void ParcelCrossCheck(UUID currentParcelID,UUID previusParcelID, 6428 private void ParcelCrossCheck(UUID currentParcelID,UUID previusParcelID,
6473 bool currentParcelHide, bool previusParcelHide, bool oldhide,bool check) 6429 bool currentParcelHide, bool previusParcelHide, bool oldhide, bool check)
6474 { 6430 {
6475 List<ScenePresence> killsToSendto = new List<ScenePresence>(); 6431 List<ScenePresence> killsToSendto = new List<ScenePresence>();
6476 List<ScenePresence> killsToSendme = new List<ScenePresence>(); 6432 List<ScenePresence> killsToSendme = new List<ScenePresence>();
@@ -6512,7 +6468,7 @@ namespace OpenSim.Region.Framework.Scenes
6512 continue; 6468 continue;
6513 6469
6514 // those not on parcel dont see me 6470 // those not on parcel dont see me
6515 if (currentParcelID != p.currentParcelUUID && p.GodController.GodLevel < 200) 6471 if (currentParcelID != p.currentParcelUUID && !p.isLegacyGod)
6516 { 6472 {
6517 killsToSendto.Add(p); // they dont see me 6473 killsToSendto.Add(p); // they dont see me
6518 } 6474 }
@@ -6538,9 +6494,9 @@ namespace OpenSim.Region.Framework.Scenes
6538 // only those on previus parcel need receive kills 6494 // only those on previus parcel need receive kills
6539 if (previusParcelID == p.currentParcelUUID) 6495 if (previusParcelID == p.currentParcelUUID)
6540 { 6496 {
6541 if(p.GodController.GodLevel < 200) 6497 if(!p.isLegacyGod)
6542 killsToSendto.Add(p); // they dont see me 6498 killsToSendto.Add(p); // they dont see me
6543 if(GodController.GodLevel < 200) 6499 if(!isLegacyGod)
6544 killsToSendme.Add(p); // i dont see them 6500 killsToSendme.Add(p); // i dont see them
6545 } 6501 }
6546 // only those on new parcel need see 6502 // only those on new parcel need see
@@ -6562,7 +6518,7 @@ namespace OpenSim.Region.Framework.Scenes
6562 continue; 6518 continue;
6563 6519
6564 // those not on new parcel dont see me 6520 // those not on new parcel dont see me
6565 if (currentParcelID != p.currentParcelUUID && p.GodController.GodLevel < 200) 6521 if (currentParcelID != p.currentParcelUUID && !p.isLegacyGod)
6566 { 6522 {
6567 killsToSendto.Add(p); // they dont see me 6523 killsToSendto.Add(p); // they dont see me
6568 } 6524 }
@@ -6588,7 +6544,7 @@ namespace OpenSim.Region.Framework.Scenes
6588 if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) 6544 if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
6589 continue; 6545 continue;
6590 // only those old parcel need kills 6546 // only those old parcel need kills
6591 if (previusParcelID == p.currentParcelUUID && GodController.GodLevel < 200) 6547 if (previusParcelID == p.currentParcelUUID && !isLegacyGod)
6592 { 6548 {
6593 killsToSendme.Add(p); // i dont see them 6549 killsToSendme.Add(p); // i dont see them
6594 } 6550 }
@@ -6645,13 +6601,12 @@ namespace OpenSim.Region.Framework.Scenes
6645 6601
6646 public void HasMovedAway(bool nearRegion) 6602 public void HasMovedAway(bool nearRegion)
6647 { 6603 {
6648
6649 if (nearRegion) 6604 if (nearRegion)
6650 { 6605 {
6651 if (Scene.AttachmentsModule != null) 6606 if (Scene.AttachmentsModule != null)
6652 Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); 6607 Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true);
6653 6608
6654 if (!ParcelHideThisAvatar || GodController.GodLevel >= 200) 6609 if (!ParcelHideThisAvatar || isLegacyGod)
6655 return; 6610 return;
6656 6611
6657 List<ScenePresence> allpresences = m_scene.GetScenePresences(); 6612 List<ScenePresence> allpresences = m_scene.GetScenePresences();
@@ -6668,6 +6623,7 @@ namespace OpenSim.Region.Framework.Scenes
6668 } 6623 }
6669 else 6624 else
6670 { 6625 {
6626 GodController.HasMovedAway();
6671 List<ScenePresence> allpresences = m_scene.GetScenePresences(); 6627 List<ScenePresence> allpresences = m_scene.GetScenePresences();
6672 foreach (ScenePresence p in allpresences) 6628 foreach (ScenePresence p in allpresences)
6673 { 6629 {