Merge branch 'ubitworkmaster'

avinationmerge
Melanie Thielker 2014-08-12 22:46:28 +02:00
commit 96d89c5906
3 changed files with 86 additions and 56 deletions

View File

@ -58,6 +58,15 @@ namespace OpenSim.Framework
public enum PermissionMask : uint public enum PermissionMask : uint
{ {
None = 0, None = 0,
// folded perms
foldedTransfer = 1,
foldedModify = 1 << 1,
foldedCopy = 1 << 2,
foldedMask = 0x07,
//
Transfer = 1 << 13, Transfer = 1 << 13,
Modify = 1 << 14, Modify = 1 << 14,
Copy = 1 << 15, Copy = 1 << 15,
@ -243,14 +252,12 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
/// <param name="a">A 3d vector</param> /// <param name="a">A 3d vector</param>
/// <returns>A new vector which is normalized form of the vector</returns> /// <returns>A new vector which is normalized form of the vector</returns>
/// <remarks>The vector paramater cannot be <0,0,0></remarks>
public static Vector3 GetNormalizedVector(Vector3 a) public static Vector3 GetNormalizedVector(Vector3 a)
{ {
if (IsZeroVector(a)) Vector3 v = new Vector3(a.X, a.Y, a.Z);
throw new ArgumentException("Vector paramater cannot be a zero vector."); v.Normalize();
return v;
float Mag = (float) GetMagnitude(a);
return new Vector3(a.X / Mag, a.Y / Mag, a.Z / Mag);
} }
/// <summary> /// <summary>

View File

@ -530,11 +530,8 @@ namespace OpenSim.Region.Framework.Scenes
get get
{ {
Vector3 a = new Vector3(CameraAtAxis.X, CameraAtAxis.Y, 0); Vector3 a = new Vector3(CameraAtAxis.X, CameraAtAxis.Y, 0);
a.Normalize();
if (a == Vector3.Zero) return a;
return a;
return Util.GetNormalizedVector(a);
} }
} }
#endregion #endregion
@ -1113,9 +1110,9 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count);
// m_log.InfoFormat( // m_log.InfoFormat(
// "[SCENE]: Upgrading child to root agent for {0} in {1}", // "[SCENE]: Upgrading child to root agent for {0} in {1}",
// Name, m_scene.RegionInfo.RegionName); // Name, m_scene.RegionInfo.RegionName);
if (ParentUUID != UUID.Zero) if (ParentUUID != UUID.Zero)
{ {
@ -1148,44 +1145,49 @@ namespace OpenSim.Region.Framework.Scenes
// Must reset this here so that a teleport to a region next to an existing region does not keep the flag // Must reset this here so that a teleport to a region next to an existing region does not keep the flag
// set and prevent the close of the connection on a subsequent re-teleport. // set and prevent the close of the connection on a subsequent re-teleport.
// Should not be needed if we are not trying to tell this region to close // Should not be needed if we are not trying to tell this region to close
// DoNotCloseAfterTeleport = false; // DoNotCloseAfterTeleport = false;
IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
if (gm != null) if (gm != null)
Grouptitle = gm.GetGroupTitle(m_uuid); Grouptitle = gm.GetGroupTitle(m_uuid);
RegionHandle = m_scene.RegionInfo.RegionHandle; RegionHandle = m_scene.RegionInfo.RegionHandle;
m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene);
/* this should be done by groups module on TriggerOnMakeRootAgent(this) below
at least XmlIRpcGroups
UUID groupUUID = UUID.Zero; UUID groupUUID = UUID.Zero;
string GroupName = string.Empty; string GroupName = string.Empty;
ulong groupPowers = 0; ulong groupPowers = 0;
// ----------------------------------
// Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status
try
{
if (gm != null)
{
groupUUID = ControllingClient.ActiveGroupId;
GroupRecord record = gm.GetGroupRecord(groupUUID);
if (record != null)
GroupName = record.GroupName;
GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid);
if (groupMembershipData != null)
groupPowers = groupMembershipData.GroupPowers;
}
ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName,
Grouptitle);
}
catch (Exception e)
{
m_log.Debug("[AGENTUPDATE]: " + e.ToString());
}
// ------------------------------------
// ----------------------------------
// Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status
try
{
if (gm != null)
{
groupUUID = ControllingClient.ActiveGroupId;
GroupRecord record = gm.GetGroupRecord(groupUUID);
if (record != null)
GroupName = record.GroupName;
GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid);
if (groupMembershipData != null)
groupPowers = groupMembershipData.GroupPowers;
}
ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName,
Grouptitle);
}
catch (Exception e)
{
m_log.Debug("[AGENTUPDATE]: " + e.ToString());
}
// ------------------------------------
*/
if (ParentID == 0) if (ParentID == 0)
{ {
// Moved this from SendInitialData to ensure that Appearance is initialized // Moved this from SendInitialData to ensure that Appearance is initialized
@ -1225,7 +1227,7 @@ namespace OpenSim.Region.Framework.Scenes
if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize) if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize)
posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
float newPosZ = posZLimit + localAVHeight / 2; float newPosZ = posZLimit + localAVHeight / 2;
if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
{ {
@ -1763,17 +1765,11 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
Vector3 look = Velocity;
// if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
if ((Math.Abs(look.X) < 0.1) && (Math.Abs(look.Y) < 0.1) && (Math.Abs(look.Z) < 0.1))
{
look = new Vector3(0.99f, 0.042f, 0);
}
// Prevent teleporting to an underground location // Prevent teleporting to an underground location
// (may crash client otherwise) // (may crash client otherwise)
// //
/* this is done in MakeRootAgent
Vector3 pos = AbsolutePosition; Vector3 pos = AbsolutePosition;
float ground = m_scene.GetGroundHeight(pos.X, pos.Y); float ground = m_scene.GetGroundHeight(pos.X, pos.Y);
if (pos.Z < ground + 1.5f) if (pos.Z < ground + 1.5f)
@ -1781,7 +1777,7 @@ namespace OpenSim.Region.Framework.Scenes
pos.Z = ground + 1.5f; pos.Z = ground + 1.5f;
AbsolutePosition = pos; AbsolutePosition = pos;
} }
*/
bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
if (!MakeRootAgent(AbsolutePosition, flying)) if (!MakeRootAgent(AbsolutePosition, flying))
{ {
@ -1792,6 +1788,16 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
Vector3 look = Lookat;
if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01))
{
look = Velocity;
look.Z = 0;
look.Normalize();
if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01) )
look = new Vector3(0.99f, 0.042f, 0);
}
// Tell the client that we're totally ready // Tell the client that we're totally ready
ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);

View File

@ -195,6 +195,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
} }
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnMakeRootAgent += OnMakeRoot;
scene.EventManager.OnMakeChildAgent += OnMakeChild;
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
// The InstantMessageModule itself doesn't do this, // The InstantMessageModule itself doesn't do this,
// so lets see if things explode if we don't do it // so lets see if things explode if we don't do it
@ -245,19 +247,34 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
#endregion #endregion
#region EventHandlers #region EventHandlers
private void OnMakeRoot(ScenePresence sp)
{
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
// Used for Notices and Group Invites/Accept/Reject
sp.ControllingClient.OnInstantMessage += OnInstantMessage;
// Send client their groups information.
// SendAgentGroupDataUpdate(sp.ControllingClient, sp.UUID);
// only send data viwer will ask rest later
OnAgentDataUpdateRequest(sp.ControllingClient, sp.UUID, sp.UUID);
}
private void OnMakeChild(ScenePresence sp)
{
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
sp.ControllingClient.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
}
private void OnNewClient(IClientAPI client) private void OnNewClient(IClientAPI client)
{ {
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
client.OnRequestAvatarProperties += OnRequestAvatarProperties; client.OnRequestAvatarProperties += OnRequestAvatarProperties;
// Used for Notices and Group Invites/Accept/Reject
client.OnInstantMessage += OnInstantMessage;
// Send client their groups information.
SendAgentGroupDataUpdate(client, client.AgentId);
} }
private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)