rename same variables to make their meaning more clear

melanie
UbitUmarov 2017-01-07 18:10:30 +00:00
parent ed526916b7
commit 5bcb1c0e72
2 changed files with 56 additions and 57 deletions

View File

@ -66,9 +66,9 @@ namespace OpenSim.Region.Framework.Scenes
// the god level from local or grid user rights // the god level from local or grid user rights
protected int m_rightsGodLevel = 0; protected int m_rightsGodLevel = 0;
// the level seen by viewers // the level seen by viewers
protected int m_godlevel = 0; protected int m_viewergodlevel = 0;
// new level that can be fixed or equal to godlevel, acording to options // new level that can be fixed or equal to godlevel, acording to options
protected int m_effectivegodlevel = 0; protected int m_godlevel = 0;
protected int m_lastLevelToViewer = 0; protected int m_lastLevelToViewer = 0;
public GodController(Scene scene, ScenePresence sp, int userlevel) public GodController(Scene scene, ScenePresence sp, int userlevel)
@ -127,19 +127,18 @@ namespace OpenSim.Region.Framework.Scenes
if(m_allowGodActionsWithoutGodMode) if(m_allowGodActionsWithoutGodMode)
{ {
m_effectivegodlevel = m_rightsGodLevel; m_godlevel = m_rightsGodLevel;
m_forceGodModeAlwaysOn = false; m_forceGodModeAlwaysOn = false;
} }
else if(m_forceGodModeAlwaysOn) else if(m_forceGodModeAlwaysOn)
{ {
m_viewergodlevel = m_rightsGodLevel;
m_godlevel = m_rightsGodLevel; m_godlevel = m_rightsGodLevel;
m_effectivegodlevel = m_rightsGodLevel;
} }
m_scenePresence.isGod = (m_effectivegodlevel >= 200); m_scenePresence.isGod = (m_godlevel >= 200);
m_scenePresence.isLegacyGod = (m_godlevel >= 200); m_scenePresence.isViewerUIGod = (m_viewergodlevel >= 200);
} }
// calculates god level at sp creation from local and grid user god rights // calculates god level at sp creation from local and grid user god rights
@ -175,10 +174,10 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if(!CanBeGod()) if(!CanBeGod())
{ {
m_viewergodlevel = 0;
m_godlevel = 0; m_godlevel = 0;
m_effectivegodlevel = 0;
m_scenePresence.isGod = false; m_scenePresence.isGod = false;
m_scenePresence.isLegacyGod = false; m_scenePresence.isViewerUIGod = false;
return; return;
} }
@ -186,58 +185,58 @@ namespace OpenSim.Region.Framework.Scenes
if(m_allowGodActionsWithoutGodMode) if(m_allowGodActionsWithoutGodMode)
{ {
if(viewerState) if(viewerState)
m_godlevel = m_rightsGodLevel; m_viewergodlevel = m_rightsGodLevel;
else else
m_godlevel = 0; m_viewergodlevel = 0;
m_effectivegodlevel = m_rightsGodLevel; m_godlevel = m_rightsGodLevel;
} }
else else
{ {
// new all change with viewer // new all change with viewer
if(viewerState) if(viewerState)
{ {
m_viewergodlevel = m_rightsGodLevel;
m_godlevel = m_rightsGodLevel; m_godlevel = m_rightsGodLevel;
m_effectivegodlevel = m_rightsGodLevel;
} }
else else
{ {
m_viewergodlevel = 0;
m_godlevel = 0; m_godlevel = 0;
m_effectivegodlevel = 0;
} }
} }
m_scenePresence.isGod = (m_effectivegodlevel >= 200); m_scenePresence.isGod = (m_godlevel >= 200);
m_scenePresence.isLegacyGod = (m_godlevel >= 200); m_scenePresence.isViewerUIGod = (m_viewergodlevel >= 200);
} }
public void SyncViewerState() public void SyncViewerState()
{ {
if(m_lastLevelToViewer == m_godlevel) if(m_lastLevelToViewer == m_viewergodlevel)
return; return;
m_lastLevelToViewer = m_godlevel; m_lastLevelToViewer = m_viewergodlevel;
if(m_scenePresence.IsChildAgent) if(m_scenePresence.IsChildAgent)
return; return;
m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)m_godlevel); m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)m_viewergodlevel);
} }
public void RequestGodMode(bool god) public void RequestGodMode(bool god)
{ {
UpdateGodLevels(god); UpdateGodLevels(god);
if(m_lastLevelToViewer != m_godlevel) if(m_lastLevelToViewer != m_viewergodlevel)
{ {
m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)m_godlevel); m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)m_viewergodlevel);
m_lastLevelToViewer = m_godlevel; m_lastLevelToViewer = m_viewergodlevel;
} }
} }
public OSD State() public OSD State()
{ {
OSDMap godMap = new OSDMap(2); OSDMap godMap = new OSDMap(2);
bool m_viewerUiIsGod = m_godlevel >= 200; bool m_viewerUiIsGod = m_viewergodlevel >= 200;
godMap.Add("ViewerUiIsGod", OSD.FromBoolean(m_viewerUiIsGod)); godMap.Add("ViewerUiIsGod", OSD.FromBoolean(m_viewerUiIsGod));
return godMap; return godMap;
@ -256,7 +255,7 @@ namespace OpenSim.Region.Framework.Scenes
if (s.ContainsKey("ViewerUiIsGod")) if (s.ContainsKey("ViewerUiIsGod"))
newstate = s["ViewerUiIsGod"].AsBoolean(); newstate = s["ViewerUiIsGod"].AsBoolean();
m_lastLevelToViewer = m_godlevel; // we are not changing viewer level by default m_lastLevelToViewer = m_viewergodlevel; // we are not changing viewer level by default
} }
} }
UpdateGodLevels(newstate); UpdateGodLevels(newstate);
@ -275,12 +274,12 @@ namespace OpenSim.Region.Framework.Scenes
public int GodLevel public int GodLevel
{ {
get { return m_godlevel; } get { return m_viewergodlevel; }
} }
public int EffectiveLevel public int EffectiveLevel
{ {
get { return m_effectivegodlevel; } get { return m_godlevel; }
} }
} }
} }

View File

@ -95,9 +95,9 @@ namespace OpenSim.Region.Framework.Scenes
// simple yes or no isGOD from god level >= 200 // simple yes or no isGOD from god level >= 200
// should only be set by GodController // should only be set by GodController
// we have two to suport legacy behaviour // we have two to suport legacy behaviour
// isLegacyGod was controlled by viewer in older versions // isViewerUIGod was controlled by viewer in older versions
// isGod may now be also controled by viewer acording to options // isGod may now be also controled by viewer acording to options
public bool isLegacyGod { get; set; } public bool isViewerUIGod { get; set; }
public bool isGod { get; set; } public bool isGod { get; set; }
private PresenceType m_presenceType; private PresenceType m_presenceType;
@ -1264,7 +1264,7 @@ namespace OpenSim.Region.Framework.Scenes
IsLoggingIn = false; IsLoggingIn = false;
} }
IsChildAgent = false; IsChildAgent = false;
} }
m_log.DebugFormat("[MakeRootAgent] out lock: {0}ms", Util.EnvironmentTickCountSubtract(ts)); m_log.DebugFormat("[MakeRootAgent] out lock: {0}ms", Util.EnvironmentTickCountSubtract(ts));
@ -2156,7 +2156,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p == this) if (p == this)
continue; continue;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
continue; continue;
SendAppearanceToAgentNF(p); SendAppearanceToAgentNF(p);
@ -2206,7 +2206,7 @@ namespace OpenSim.Region.Framework.Scenes
continue; continue;
} }
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
continue; continue;
SendAttachmentsToAgentNF(p); SendAttachmentsToAgentNF(p);
@ -3811,7 +3811,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!remoteClient.IsActive) if (!remoteClient.IsActive)
return; return;
if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID && !p.isLegacyGod) if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID && !p.isViewerUIGod)
return; return;
//m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity);
@ -3921,7 +3921,7 @@ namespace OpenSim.Region.Framework.Scenes
// get the avatar, then a kill if can't see it // get the avatar, then a kill if can't see it
p.SendInitialAvatarDataToAgent(this); p.SendInitialAvatarDataToAgent(this);
if (p.ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !isLegacyGod) if (p.ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !isViewerUIGod)
return; return;
p.SendAppearanceToAgentNF(this); p.SendAppearanceToAgentNF(this);
@ -3969,7 +3969,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (ScenePresence p in presences) foreach (ScenePresence p in presences)
{ {
p.ControllingClient.SendAvatarDataImmediate(this); p.ControllingClient.SendAvatarDataImmediate(this);
if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod) if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
// either just kill the object // either just kill the object
// p.ControllingClient.SendKillObject(new List<uint> {LocalId}); // p.ControllingClient.SendKillObject(new List<uint> {LocalId});
// or also attachments viewer may still know about // or also attachments viewer may still know about
@ -3982,7 +3982,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SendInitialAvatarDataToAgent(ScenePresence p) public void SendInitialAvatarDataToAgent(ScenePresence p)
{ {
p.ControllingClient.SendAvatarDataImmediate(this); p.ControllingClient.SendAvatarDataImmediate(this);
if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod) if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
// either just kill the object // either just kill the object
// p.ControllingClient.SendKillObject(new List<uint> {LocalId}); // p.ControllingClient.SendKillObject(new List<uint> {LocalId});
// or also attachments viewer may still know about // or also attachments viewer may still know about
@ -3996,7 +3996,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SendAvatarDataToAgent(ScenePresence avatar) public void SendAvatarDataToAgent(ScenePresence avatar)
{ {
//m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.isLegacyGod) if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.isViewerUIGod)
return; return;
avatar.ControllingClient.SendAvatarDataImmediate(this); avatar.ControllingClient.SendAvatarDataImmediate(this);
} }
@ -4041,7 +4041,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.isLegacyGod) if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.isViewerUIGod)
return; return;
SendAppearanceToAgentNF(avatar); SendAppearanceToAgentNF(avatar);
} }
@ -4057,7 +4057,7 @@ namespace OpenSim.Region.Framework.Scenes
if (IsChildAgent || Animator == null) if (IsChildAgent || Animator == null)
return; return;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
return; return;
Animator.SendAnimPackToClient(p.ControllingClient); Animator.SendAnimPackToClient(p.ControllingClient);
@ -4068,7 +4068,7 @@ namespace OpenSim.Region.Framework.Scenes
if (IsChildAgent) if (IsChildAgent)
return; return;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
return; return;
p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs);
@ -4093,7 +4093,7 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.ForEachScenePresence(delegate(ScenePresence p) m_scene.ForEachScenePresence(delegate(ScenePresence p)
{ {
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
return; return;
p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs);
}); });
@ -4473,9 +4473,9 @@ namespace OpenSim.Region.Framework.Scenes
if (isNPC) if (isNPC)
return; return;
bool wasgod = isLegacyGod; bool wasgod = isViewerUIGod;
GodController.RequestGodMode(godStatus); GodController.RequestGodMode(godStatus);
if (wasgod != isLegacyGod) if (wasgod != isViewerUIGod)
parcelGodCheck(m_currentParcelUUID); parcelGodCheck(m_currentParcelUUID);
} }
@ -4909,7 +4909,7 @@ namespace OpenSim.Region.Framework.Scenes
RaiseCollisionScriptEvents(coldata); RaiseCollisionScriptEvents(coldata);
// Gods do not take damage and Invulnerable is set depending on parcel/region flags // Gods do not take damage and Invulnerable is set depending on parcel/region flags
if (Invulnerable || isLegacyGod) if (Invulnerable || isViewerUIGod)
return; return;
// The following may be better in the ICombatModule // The following may be better in the ICombatModule
@ -5194,7 +5194,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p != this && sog.HasPrivateAttachmentPoint) if (p != this && sog.HasPrivateAttachmentPoint)
return; return;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
return; return;
SendTerseUpdateToAgentNF(p); SendTerseUpdateToAgentNF(p);
@ -5308,7 +5308,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p == this) if (p == this)
continue; continue;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
continue; continue;
p.ControllingClient.SendEntityUpdate(rootpart, rootflag); p.ControllingClient.SendEntityUpdate(rootpart, rootflag);
@ -5366,7 +5366,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p == this) if (p == this)
continue; continue;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
continue; continue;
p.ControllingClient.SendEntityUpdate(rootpart, flag); p.ControllingClient.SendEntityUpdate(rootpart, flag);
@ -5416,7 +5416,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p == this) if (p == this)
continue; continue;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
continue; continue;
p.ControllingClient.SendEntityUpdate(part, flag); p.ControllingClient.SendEntityUpdate(part, flag);
@ -5457,7 +5457,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (p == this) if (p == this)
continue; continue;
if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod) if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
continue; continue;
p.ControllingClient.SendEntityUpdate(part, flag); p.ControllingClient.SendEntityUpdate(part, flag);
@ -6095,7 +6095,7 @@ namespace OpenSim.Region.Framework.Scenes
// the TP point. This behaviour mimics agni. // the TP point. This behaviour mimics agni.
if (land.LandData.LandingType == (byte)LandingType.LandingPoint && if (land.LandData.LandingType == (byte)LandingType.LandingPoint &&
land.LandData.UserLocation != Vector3.Zero && land.LandData.UserLocation != Vector3.Zero &&
!isLegacyGod && !isViewerUIGod &&
((land.LandData.OwnerID != m_uuid && ((land.LandData.OwnerID != m_uuid &&
!m_scene.Permissions.IsGod(m_uuid) && !m_scene.Permissions.IsGod(m_uuid) &&
!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) ||
@ -6120,7 +6120,7 @@ namespace OpenSim.Region.Framework.Scenes
string reason; string reason;
// dont mess with gods // dont mess with gods
if(isLegacyGod || m_scene.Permissions.IsGod(m_uuid)) if(isViewerUIGod || m_scene.Permissions.IsGod(m_uuid))
return true; return true;
// respect region owner and managers // respect region owner and managers
@ -6417,7 +6417,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelID) if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelID)
{ {
if (isLegacyGod) if (isViewerUIGod)
p.SendViewTo(this); p.SendViewTo(this);
else else
p.SendKillTo(this); p.SendKillTo(this);
@ -6468,7 +6468,7 @@ namespace OpenSim.Region.Framework.Scenes
continue; continue;
// those not on parcel dont see me // those not on parcel dont see me
if (currentParcelID != p.currentParcelUUID && !p.isLegacyGod) if (currentParcelID != p.currentParcelUUID && !p.isViewerUIGod)
{ {
killsToSendto.Add(p); // they dont see me killsToSendto.Add(p); // they dont see me
} }
@ -6494,9 +6494,9 @@ namespace OpenSim.Region.Framework.Scenes
// only those on previus parcel need receive kills // only those on previus parcel need receive kills
if (previusParcelID == p.currentParcelUUID) if (previusParcelID == p.currentParcelUUID)
{ {
if(!p.isLegacyGod) if(!p.isViewerUIGod)
killsToSendto.Add(p); // they dont see me killsToSendto.Add(p); // they dont see me
if(!isLegacyGod) if(!isViewerUIGod)
killsToSendme.Add(p); // i dont see them killsToSendme.Add(p); // i dont see them
} }
// only those on new parcel need see // only those on new parcel need see
@ -6518,7 +6518,7 @@ namespace OpenSim.Region.Framework.Scenes
continue; continue;
// those not on new parcel dont see me // those not on new parcel dont see me
if (currentParcelID != p.currentParcelUUID && !p.isLegacyGod) if (currentParcelID != p.currentParcelUUID && !p.isViewerUIGod)
{ {
killsToSendto.Add(p); // they dont see me killsToSendto.Add(p); // they dont see me
} }
@ -6544,7 +6544,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
continue; continue;
// only those old parcel need kills // only those old parcel need kills
if (previusParcelID == p.currentParcelUUID && !isLegacyGod) if (previusParcelID == p.currentParcelUUID && !isViewerUIGod)
{ {
killsToSendme.Add(p); // i dont see them killsToSendme.Add(p); // i dont see them
} }
@ -6606,7 +6606,7 @@ namespace OpenSim.Region.Framework.Scenes
if (Scene.AttachmentsModule != null) if (Scene.AttachmentsModule != null)
Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true);
if (!ParcelHideThisAvatar || isLegacyGod) if (!ParcelHideThisAvatar || isViewerUIGod)
return; return;
List<ScenePresence> allpresences = m_scene.GetScenePresences(); List<ScenePresence> allpresences = m_scene.GetScenePresences();