aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Addons/Groups/GroupsModule.cs2
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs30
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs2
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/GodController.cs228
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs122
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs93
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs2
21 files changed, 334 insertions, 190 deletions
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs
index 1e9f2b5..aa5105e 100644
--- a/OpenSim/Addons/Groups/GroupsModule.cs
+++ b/OpenSim/Addons/Groups/GroupsModule.cs
@@ -756,7 +756,7 @@ namespace OpenSim.Groups
756 756
757 if (avatar != null) 757 if (avatar != null)
758 { 758 {
759 if (avatar.UserLevel < m_levelGroupCreate) 759 if (avatar.GodController.UserLevel < m_levelGroupCreate)
760 { 760 {
761 remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate)); 761 remoteClient.SendCreateGroupReply(UUID.Zero, false, String.Format("Insufficient permissions to create a group. Requires level {0}", m_levelGroupCreate));
762 return UUID.Zero; 762 return UUID.Zero;
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 0e5eaf2..b9d64b1 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -89,6 +89,8 @@ namespace OpenSim.Framework
89 public Vector3 AtAxis; 89 public Vector3 AtAxis;
90 public Vector3 LeftAxis; 90 public Vector3 LeftAxis;
91 public Vector3 UpAxis; 91 public Vector3 UpAxis;
92 //public int GodLevel;
93 public OSD GodData = new OSDMap();
92 public bool ChangedGrid; 94 public bool ChangedGrid;
93 95
94 // This probably shouldn't be here 96 // This probably shouldn't be here
@@ -116,6 +118,13 @@ namespace OpenSim.Framework
116 118
117 args["far"] = OSD.FromReal(Far); 119 args["far"] = OSD.FromReal(Far);
118 args["changed_grid"] = OSD.FromBoolean(ChangedGrid); 120 args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
121 //args["god_level"] = OSD.FromString(GodLevel.ToString());
122 args["god_data"] = GodData;
123 OSDMap g = (OSDMap)GodData;
124 // Set legacy value
125 // TODO: remove after 0.9 is superseded
126 if (g.ContainsKey("ViewerUiIsGod"))
127 args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;;
119 128
120 if ((Throttles != null) && (Throttles.Length > 0)) 129 if ((Throttles != null) && (Throttles.Length > 0))
121 args["throttles"] = OSD.FromBinary(Throttles); 130 args["throttles"] = OSD.FromBinary(Throttles);
@@ -174,6 +183,11 @@ namespace OpenSim.Framework
174 if (args["changed_grid"] != null) 183 if (args["changed_grid"] != null)
175 ChangedGrid = args["changed_grid"].AsBoolean(); 184 ChangedGrid = args["changed_grid"].AsBoolean();
176 185
186 //if (args["god_level"] != null)
187 // Int32.TryParse(args["god_level"].AsString(), out GodLevel);
188 if (args["god_data"] != null)
189 GodData = args["god_data"];
190
177 if (args["far"] != null) 191 if (args["far"] != null)
178 Far = (float)(args["far"].AsReal()); 192 Far = (float)(args["far"].AsReal());
179 193
@@ -348,7 +362,8 @@ namespace OpenSim.Framework
348 public Quaternion BodyRotation; 362 public Quaternion BodyRotation;
349 public uint ControlFlags; 363 public uint ControlFlags;
350 public float EnergyLevel; 364 public float EnergyLevel;
351 public Byte GodLevel; 365 public OSD GodData = new OSDMap();
366 //public Byte GodLevel;
352 public bool AlwaysRun; 367 public bool AlwaysRun;
353 public UUID PreyAgent; 368 public UUID PreyAgent;
354 public Byte AgentAccess; 369 public Byte AgentAccess;
@@ -422,7 +437,11 @@ namespace OpenSim.Framework
422 args["control_flags"] = OSD.FromString(ControlFlags.ToString()); 437 args["control_flags"] = OSD.FromString(ControlFlags.ToString());
423 438
424 args["energy_level"] = OSD.FromReal(EnergyLevel); 439 args["energy_level"] = OSD.FromReal(EnergyLevel);
425 args["god_level"] = OSD.FromString(GodLevel.ToString()); 440 //args["god_level"] = OSD.FromString(GodLevel.ToString());
441 args["god_data"] = GodData;
442 OSDMap g = (OSDMap)GodData;
443 if (g.ContainsKey("ViewerUiIsGod"))
444 args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;;
426 args["always_run"] = OSD.FromBoolean(AlwaysRun); 445 args["always_run"] = OSD.FromBoolean(AlwaysRun);
427 args["prey_agent"] = OSD.FromUUID(PreyAgent); 446 args["prey_agent"] = OSD.FromUUID(PreyAgent);
428 args["agent_access"] = OSD.FromString(AgentAccess.ToString()); 447 args["agent_access"] = OSD.FromString(AgentAccess.ToString());
@@ -600,8 +619,11 @@ namespace OpenSim.Framework
600 if (args["energy_level"] != null) 619 if (args["energy_level"] != null)
601 EnergyLevel = (float)(args["energy_level"].AsReal()); 620 EnergyLevel = (float)(args["energy_level"].AsReal());
602 621
603 if (args["god_level"] != null) 622 //if (args["god_level"] != null)
604 Byte.TryParse(args["god_level"].AsString(), out GodLevel); 623 // Byte.TryParse(args["god_level"].AsString(), out GodLevel);
624
625 if (args["god_data"] != null)
626 GodData = args["god_data"];
605 627
606 if (args["always_run"] != null) 628 if (args["always_run"] != null)
607 AlwaysRun = args["always_run"].AsBoolean(); 629 AlwaysRun = args["always_run"].AsBoolean();
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 8cb40e1..58b7b00 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -537,7 +537,7 @@ namespace OpenSim.Region.ClientStack.Linden
537 // check user level 537 // check user level
538 if (avatar != null) 538 if (avatar != null)
539 { 539 {
540 if (avatar.UserLevel < m_levelUpload) 540 if (avatar.GodController.UserLevel < m_levelUpload)
541 { 541 {
542 LLSDAssetUploadError resperror = new LLSDAssetUploadError(); 542 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
543 resperror.message = "Insufficient permissions to upload"; 543 resperror.message = "Insufficient permissions to upload";
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index dba2872..316956b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -11455,7 +11455,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11455 ScenePresence p; 11455 ScenePresence p;
11456 if (scene.TryGetScenePresence(sender.AgentId, out p)) 11456 if (scene.TryGetScenePresence(sender.AgentId, out p))
11457 { 11457 {
11458 if (p.GodLevel >= 200) 11458 if (p.GodController.GodLevel >= 200)
11459 { 11459 {
11460 groupProfileReply.GroupData.OpenEnrollment = true; 11460 groupProfileReply.GroupData.OpenEnrollment = true;
11461 groupProfileReply.GroupData.MembershipFee = 0; 11461 groupProfileReply.GroupData.MembershipFee = 0;
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
index 89fdf09..7d9f3b3 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -255,7 +255,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
255 // check user level 255 // check user level
256 if (avatar != null) 256 if (avatar != null)
257 { 257 {
258 if (avatar.UserLevel < m_levelUpload) 258 if (avatar.GodController.UserLevel < m_levelUpload)
259 { 259 {
260 remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); 260 remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false);
261 return; 261 return;
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index 53800bb..adf5c68 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -229,7 +229,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
229 fromPos = avatar.AbsolutePosition; 229 fromPos = avatar.AbsolutePosition;
230 fromName = avatar.Name; 230 fromName = avatar.Name;
231 fromID = c.Sender.AgentId; 231 fromID = c.Sender.AgentId;
232 if (avatar.GodLevel >= 200) 232 if (avatar.GodController.GodLevel >= 200)
233 { // let gods speak to outside or things may get confusing 233 { // let gods speak to outside or things may get confusing
234 fromNamePrefix = m_adminPrefix; 234 fromNamePrefix = m_adminPrefix;
235 checkParcelHide = false; 235 checkParcelHide = false;
@@ -305,7 +305,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
305 { 305 {
306 if (checkParcelHide) 306 if (checkParcelHide)
307 { 307 {
308 if (sourceParcelID != Presencecheck.LandData.GlobalID && presence.GodLevel < 200) 308 if (sourceParcelID != Presencecheck.LandData.GlobalID && presence.GodController.GodLevel < 200)
309 return; 309 return;
310 } 310 }
311 if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) 311 if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true)
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs
index e5bf919..9843f2e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
118 // If we're in god mode, we reverse the meaning. Offer 118 // If we're in god mode, we reverse the meaning. Offer
119 // calling card becomes "Take a calling card" for that 119 // calling card becomes "Take a calling card" for that
120 // person, no matter if they agree or not. 120 // person, no matter if they agree or not.
121 if (sp.GodLevel >= 200) 121 if (sp.GodController.GodLevel >= 200)
122 { 122 {
123 CreateCallingCard(client.AgentId, destID, UUID.Zero, true); 123 CreateCallingCard(client.AgentId, destID, UUID.Zero, true);
124 return; 124 return;
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index ac05a6e..82154bc 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
141 if (avatar == null) 141 if (avatar == null)
142 return; 142 return;
143 143
144 if (avatar.UserLevel < m_levelHGFriends) 144 if (avatar.GodController.UserLevel < m_levelHGFriends)
145 { 145 {
146 client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false); 146 client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false);
147 return; 147 return;
@@ -844,4 +844,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
844 return false; 844 return false;
845 } 845 }
846 } 846 }
847} \ No newline at end of file 847}
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index 8d3c10d..b7ae298 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
@@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
173 173
174 sp.GrantGodlikePowers(token, godLike); 174 sp.GrantGodlikePowers(token, godLike);
175 175
176 if (godLike && sp.GodLevel < 200 && DialogModule != null) 176 if (godLike && sp.GodController.GodLevel < 200 && DialogModule != null)
177 DialogModule.SendAlertToUser(agentID, "Request for god powers denied"); 177 DialogModule.SendAlertToUser(agentID, "Request for god powers denied");
178 } 178 }
179 179
@@ -194,14 +194,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
194 int godlevel = 200; 194 int godlevel = 200;
195 // update level so higher gods can kick lower ones 195 // update level so higher gods can kick lower ones
196 ScenePresence god = m_scene.GetScenePresence(godID); 196 ScenePresence god = m_scene.GetScenePresence(godID);
197 if(god != null && god.GodLevel > godlevel) 197 if(god != null && god.GodController.GodLevel > godlevel)
198 godlevel = god.GodLevel; 198 godlevel = god.GodController.GodLevel;
199 199
200 if(agentID == ALL_AGENTS) 200 if(agentID == ALL_AGENTS)
201 { 201 {
202 m_scene.ForEachRootScenePresence(delegate(ScenePresence p) 202 m_scene.ForEachRootScenePresence(delegate(ScenePresence p)
203 { 203 {
204 if (p.UUID != godID && godlevel > p.GodLevel) 204 if (p.UUID != godID && godlevel > p.GodController.GodLevel)
205 doKickmodes(godID, p, kickflags, reason); 205 doKickmodes(godID, p, kickflags, reason);
206 }); 206 });
207 return; 207 return;
@@ -224,7 +224,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
224 return; 224 return;
225 } 225 }
226 226
227 if (godlevel <= sp.GodLevel) // no god wars 227 if (godlevel <= sp.GodController.GodLevel) // no god wars
228 return; 228 return;
229 229
230 if(sp.UUID == godID) 230 if(sp.UUID == godID)
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
index c517a30..bd95ff0 100644
--- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
@@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
169 169
170 GridInstantMessage m; 170 GridInstantMessage m;
171 171
172 if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodLevel >= 200 && (!scene.Permissions.IsAdministrator(targetid))) 172 if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodController.GodLevel >= 200 && (!scene.Permissions.IsAdministrator(targetid)))
173 { 173 {
174 m = new GridInstantMessage(scene, client.AgentId, 174 m = new GridInstantMessage(scene, client.AgentId,
175 client.FirstName+" "+client.LastName, targetid, 175 client.FirstName+" "+client.LastName, targetid,
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 6b1eb54..d0e5d86 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -2077,6 +2077,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2077 agentpos.Position = sp.AbsolutePosition; 2077 agentpos.Position = sp.AbsolutePosition;
2078 agentpos.Velocity = sp.Velocity; 2078 agentpos.Velocity = sp.Velocity;
2079 agentpos.RegionHandle = currentRegionHandler; 2079 agentpos.RegionHandle = currentRegionHandler;
2080 //agentpos.GodLevel = sp.GodLevel;
2081 agentpos.GodData = sp.GodController.State();
2080 agentpos.Throttles = spClient.GetThrottlesPacked(1); 2082 agentpos.Throttles = spClient.GetThrottlesPacked(1);
2081 // agentpos.ChildrenCapSeeds = seeds; 2083 // agentpos.ChildrenCapSeeds = seeds;
2082 2084
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 4ad500a..1ce6927 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -272,7 +272,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
272 { 272 {
273 // this user is going to another grid 273 // this user is going to another grid
274 // for local users, check if HyperGrid teleport is allowed, based on user level 274 // for local users, check if HyperGrid teleport is allowed, based on user level
275 if (Scene.UserManagementModule.IsLocalGridUser(sp.UUID) && sp.UserLevel < m_levelHGTeleport) 275 if (Scene.UserManagementModule.IsLocalGridUser(sp.UUID) && sp.GodController.UserLevel < m_levelHGTeleport)
276 { 276 {
277 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel."); 277 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel.");
278 reason = "Hypergrid teleport not allowed"; 278 reason = "Hypergrid teleport not allowed";
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 63b8de0..3a8d6b7 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -1977,7 +1977,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1977 ScenePresence SP; 1977 ScenePresence SP;
1978 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); 1978 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP);
1979 List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); 1979 List<SceneObjectGroup> returns = new List<SceneObjectGroup>();
1980 if (SP.UserLevel != 0) 1980 if (SP.GodController.UserLevel != 0)
1981 { 1981 {
1982 if (flags == 0) //All parcels, scripted or not 1982 if (flags == 0) //All parcels, scripted or not
1983 { 1983 {
@@ -2043,7 +2043,7 @@ namespace OpenSim.Region.CoreModules.World.Land
2043 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); 2043 ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
2044 System.Threading.Timer Timer; 2044 System.Threading.Timer Timer;
2045 2045
2046 if (targetAvatar.UserLevel == 0) 2046 if (targetAvatar.GodController.UserLevel == 0)
2047 { 2047 {
2048 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); 2048 ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
2049 if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true)) 2049 if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true))
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 1a61771..02d0e02 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -547,7 +547,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
547 { 547 {
548 ScenePresence sp = m_scene.GetScenePresence(user); 548 ScenePresence sp = m_scene.GetScenePresence(user);
549 if (sp != null) 549 if (sp != null)
550 return (sp.UserLevel >= 200); 550 return (sp.GodController.UserLevel >= 200);
551 551
552 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); 552 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user);
553 if (account != null) 553 if (account != null)
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
28using System;
29using System.Xml;
30using System.Collections.Generic;
31using System.Reflection;
32using System.Threading;
33using System.Timers;
34using Timer = System.Timers.Timer;
35using OpenMetaverse;
36using OpenMetaverse.StructuredData;
37using log4net;
38using Nini.Config;
39using OpenSim.Framework;
40using OpenSim.Framework.Client;
41using OpenSim.Framework.Monitoring;
42using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes.Types;
44using OpenSim.Services.Interfaces;
45
46namespace 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();
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index f0de7d4..d52a1d5 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -877,7 +877,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
877 877
878 if (avatar != null) 878 if (avatar != null)
879 { 879 {
880 if (avatar.UserLevel < m_levelGroupCreate) 880 if (avatar.GodController.UserLevel < m_levelGroupCreate)
881 { 881 {
882 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient permissions to create a group."); 882 remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient permissions to create a group.");
883 return UUID.Zero; 883 return UUID.Zero;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 8f9ff03..92d6808 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4977,7 +4977,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4977 if (presence != null && presence.PresenceType != PresenceType.Npc) 4977 if (presence != null && presence.PresenceType != PresenceType.Npc)
4978 { 4978 {
4979 // agent must not be a god 4979 // agent must not be a god
4980 if (presence.UserLevel >= 200) return; 4980 if (presence.GodController.UserLevel >= 200) return;
4981 4981
4982 // agent must be over the owners land 4982 // agent must be over the owners land
4983 if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) 4983 if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)
@@ -5029,7 +5029,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5029 else 5029 else
5030 { 5030 {
5031 // agent must not be a god 5031 // agent must not be a god
5032 if (presence.GodLevel >= 200) return; 5032 if (presence.GodController.GodLevel >= 200) return;
5033 5033
5034 // agent must be over the owners land 5034 // agent must be over the owners land
5035 ILandObject agentLand = World.LandChannel.GetLandObject(presence.AbsolutePosition); 5035 ILandObject agentLand = World.LandChannel.GetLandObject(presence.AbsolutePosition);
@@ -5256,7 +5256,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5256 return; 5256 return;
5257 5257
5258 // Pushee is in GodMode this pushing object isn't owned by them 5258 // Pushee is in GodMode this pushing object isn't owned by them
5259 if (avatar.GodLevel > 0 && m_host.OwnerID != targetID) 5259 if (avatar.GodController.GodLevel > 0 && m_host.OwnerID != targetID)
5260 return; 5260 return;
5261 5261
5262 pusheeav = avatar; 5262 pusheeav = avatar;
@@ -6687,7 +6687,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6687 delegate (ScenePresence ssp) 6687 delegate (ScenePresence ssp)
6688 { 6688 {
6689 // Gods are not listed in SL 6689 // Gods are not listed in SL
6690 if (!ssp.IsDeleted && ssp.GodLevel == 0.0 && !ssp.IsChildAgent) 6690 if (!ssp.IsDeleted && ssp.GodController.GodLevel == 0.0 && !ssp.IsChildAgent)
6691 { 6691 {
6692 if (!regionWide) 6692 if (!regionWide)
6693 { 6693 {
@@ -14484,91 +14484,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14484 return contacts.ToArray(); 14484 return contacts.ToArray();
14485 } 14485 }
14486 14486
14487 private ContactResult? GroundIntersection2(Vector3 rayStart, Vector3 rayEnd)
14488 {
14489 // get work copies
14490 float sx = rayStart.X;
14491 float ex = rayEnd.X;
14492 float sy = rayStart.Y;
14493 float ey = rayEnd.Y;
14494
14495 float dx = ex - sx;
14496 float dy = ey - sy;
14497
14498 // region size info
14499 float rsx = World.RegionInfo.RegionSizeX;
14500
14501 float tmp;
14502
14503 // region bounds
14504 if(sx < 0)
14505 {
14506 if(ex < 0) // totally outside
14507 return null;
14508 if(dx <= 0) // out and going away
14509 return null;
14510 else if(ex >= rsx)
14511 ex = rsx - 0.001f;
14512 tmp = -sx / dx;
14513 sy += dy * dx;
14514 sx = 0;
14515 }
14516 else if(sx >= rsx)
14517 {
14518 if(ex >= rsx) // totally outside
14519 return null;
14520 if(dx >= 0) // out and going away
14521 return null;
14522 else if(ex < 0)
14523 ex = 0;
14524 tmp = (rsx - sx) / dx;
14525 sy += dy * dx;
14526 sx = rsx - 0.001f;
14527 }
14528
14529 float rsy = World.RegionInfo.RegionSizeY;
14530 if(sy < 0)
14531 {
14532 if(dy <= 0) // out and going away
14533 return null;
14534 else if(ey >= rsy)
14535 ey = rsy - 0.001f;
14536 tmp = -sy / dy;
14537 sx += dy * dx;
14538 sy = 0;
14539 }
14540 else if(sy >= rsy)
14541 {
14542 if(dy >= 0) // out and going away
14543 return null;
14544 else if(ey < 0)
14545 ey = 0;
14546 tmp = (rsy - sy) / dy;
14547 sx += dy * dx;
14548 sy = rsy - 0.001f;
14549 }
14550
14551 if(sx < 0 || sx >= rsx)
14552 return null;
14553
14554 float sz = rayStart.Z;
14555 float ez = rayEnd.Z;
14556 float dz = ez - sz;
14557
14558 float dist = dx * dx + dy * dy + dz * dz;
14559 if(dist < 0.001)
14560 return null;
14561 dist = (float)Math.Sqrt(dist);
14562 tmp = 1.0f / dist;
14563 Vector3 rayn = new Vector3(dx * tmp, dy * tmp, dz * tmp);
14564
14565 ContactResult? result = null;
14566
14567
14568
14569 return result;
14570 }
14571
14572 private ContactResult? GroundIntersection(Vector3 rayStart, Vector3 rayEnd) 14487 private ContactResult? GroundIntersection(Vector3 rayStart, Vector3 rayEnd)
14573 { 14488 {
14574 double[,] heightfield = World.Heightmap.GetDoubles(); 14489 double[,] heightfield = World.Heightmap.GetDoubles();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index cec595d..49e70bc 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -721,7 +721,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
721 { 721 {
722 ScenePresence sp = World.GetScenePresence(m_host.OwnerID); 722 ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
723 723
724 if (sp == null || sp.GodLevel < 200) 724 if (sp == null || sp.GodController.GodLevel < 200)
725 { 725 {
726 LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); 726 LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
727 return 0; 727 return 0;
@@ -768,7 +768,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
768 { 768 {
769 ScenePresence sp = World.GetScenePresence(m_host.OwnerID); 769 ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
770 770
771 if (sp == null || sp.GodLevel < 200) 771 if (sp == null || sp.GodController.GodLevel < 200)
772 { 772 {
773 LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); 773 LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
774 return; 774 return;
@@ -799,7 +799,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
799 { 799 {
800 ScenePresence sp = World.GetScenePresence(m_host.OwnerID); 800 ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
801 801
802 if (sp == null || sp.GodLevel < 200) 802 if (sp == null || sp.GodController.GodLevel < 200)
803 { 803 {
804 LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners."); 804 LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
805 return 0; 805 return 0;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index d401ed8..c7e7f89 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -540,7 +540,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
540 } 540 }
541 } 541 }
542 542
543 if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) 543 if (presence.IsDeleted || presence.IsChildAgent || presence.GodController.GodLevel > 0.0)
544 return; 544 return;
545 545
546 // if the object the script is in is attached and the avatar is the owner 546 // if the object the script is in is attached and the avatar is the owner