mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 09:45:47 +08:00
cosmetics
This commit is contained in:
@@ -35,11 +35,6 @@ namespace OpenSim.Framework
|
||||
/// </summary>
|
||||
public class AgentUpdateArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Agent's unique ID
|
||||
/// </summary>
|
||||
public UUID AgentID;
|
||||
|
||||
/// <summary>
|
||||
/// Rotation of the avatar's body
|
||||
/// </summary>
|
||||
@@ -76,7 +71,6 @@ namespace OpenSim.Framework
|
||||
/// <summary>
|
||||
/// Session Id
|
||||
/// </summary>
|
||||
public UUID SessionID;
|
||||
public byte State;
|
||||
|
||||
public Vector3 ClientAgentPosition;
|
||||
|
||||
@@ -8231,7 +8231,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
)
|
||||
return true;
|
||||
|
||||
float qdelta = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation));
|
||||
float qdelta = Math.Abs(x.BodyRotation.Dot(m_thisAgentUpdateArgs.BodyRotation));
|
||||
return qdelta < QDELTABody; // significant if body rotation above(below cos) threshold
|
||||
}
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
// disabled. Registering only when enabled allows for other attachments module implementations.
|
||||
m_scene.RegisterModuleInterface<IAttachmentsModule>(this);
|
||||
m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
|
||||
m_scene.EventManager.OnStartScript += (localID, itemID) => OnScriptStateChange(localID, true);
|
||||
m_scene.EventManager.OnStopScript += (localID, itemID) => OnScriptStateChange(localID, false);
|
||||
m_scene.EventManager.OnStartScript += OnScriptStarted;
|
||||
m_scene.EventManager.OnStopScript += OnScriptStopped;
|
||||
|
||||
}
|
||||
|
||||
@@ -108,6 +108,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
|
||||
m_scene.UnregisterModuleInterface<IAttachmentsModule>(this);
|
||||
m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
|
||||
m_scene.EventManager.OnStartScript -= OnScriptStarted;
|
||||
m_scene.EventManager.OnStopScript -= OnScriptStopped;
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
@@ -286,24 +288,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
/// </summary>
|
||||
/// <param name='localID'></param>
|
||||
/// <param name='itemID'></param>
|
||||
private void OnScriptStateChange(uint localID, bool started)
|
||||
|
||||
private void OnScriptStarted(uint localID, UUID itemID)
|
||||
{
|
||||
SceneObjectGroup sog = m_scene.GetGroupByPrim(localID);
|
||||
if (sog != null && sog.IsAttachment)
|
||||
sog.HasGroupChanged = true;
|
||||
}
|
||||
|
||||
private void OnScriptStopped(uint localID, UUID itemID)
|
||||
{
|
||||
SceneObjectGroup sog = m_scene.GetGroupByPrim(localID);
|
||||
if (sog != null && sog.IsAttachment)
|
||||
{
|
||||
if (!started)
|
||||
{
|
||||
// FIXME: This is a convoluted way for working out whether the script state has changed to stop
|
||||
// because it has been manually stopped or because the stop was called in UpdateDetachedObject() below
|
||||
// This needs to be handled in a less tangled way.
|
||||
ScenePresence sp = m_scene.GetScenePresence(sog.AttachedAvatar);
|
||||
if (sp.ControllingClient.IsActive)
|
||||
sog.HasGroupChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME: This is a convoluted way for working out whether the script state has changed to stop
|
||||
// because it has been manually stopped or because the stop was called in UpdateDetachedObject() below
|
||||
// This needs to be handled in a less tangled way.
|
||||
ScenePresence sp = m_scene.GetScenePresence(sog.AttachedAvatar);
|
||||
if (sp.ControllingClient.IsActive)
|
||||
sog.HasGroupChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,21 +360,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
DeleteAttachmentsFromScene(isp, true); // delete
|
||||
}
|
||||
|
||||
List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(ad.AttachmentObjects.Count);
|
||||
int i = 0;
|
||||
for (int indx = 0; indx < ad.AttachmentObjects.Count; ++indx)
|
||||
{
|
||||
SceneObjectGroup sog = (SceneObjectGroup)ad.AttachmentObjects[indx];
|
||||
sog.LocalId = 0;
|
||||
sog.RootPart.ClearUpdateSchedule();
|
||||
SceneObjectGroup sog = ad.AttachmentObjects[indx] as SceneObjectGroup;
|
||||
if(sog != null)
|
||||
{
|
||||
sog.LocalId = 0;
|
||||
sog.RootPart.ClearUpdateSchedule();
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Copying script state with {0} bytes for object {1} for {2} in {3}",
|
||||
// ad.AttachmentObjectStates[i].Length, sog.Name, sp.Name, m_scene.Name);
|
||||
|
||||
sog.SetState(ad.AttachmentObjectStates[i++], m_scene);
|
||||
m_scene.IncomingCreateObject(Vector3.Zero, sog);
|
||||
sog.SetState(ad.AttachmentObjectStates[i++], m_scene);
|
||||
attachments.Add(sog);
|
||||
}
|
||||
}
|
||||
|
||||
ad.AttachmentObjects = null;
|
||||
ad.AttachmentObjectStates = null;
|
||||
|
||||
if (attachments.Count > 0)
|
||||
m_scene.IncomingAttechments(sp, attachments);
|
||||
else
|
||||
sp.GotAttachmentsData = true;
|
||||
}
|
||||
else
|
||||
sp.GotAttachmentsData = true;
|
||||
}
|
||||
|
||||
public void RezAttachments(IScenePresence sp)
|
||||
@@ -1198,8 +1211,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
// grid may use an incompatible script engine.
|
||||
bool saveChanged
|
||||
= sp.PresenceType != PresenceType.Npc
|
||||
&& (m_scene.UserManagementModule == null
|
||||
|| m_scene.UserManagementModule.IsLocalGridUser(sp.UUID));
|
||||
&& (m_scene.UserManagementModule == null || m_scene.UserManagementModule.IsLocalGridUser(sp.UUID));
|
||||
|
||||
// Remove the object from the scene so no more updates
|
||||
// are sent. Doing this before the below changes will ensure
|
||||
|
||||
@@ -132,14 +132,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
client.OnInstantMessage += OnInstantMessage;
|
||||
}
|
||||
|
||||
private Scene FindClientScene(UUID agentId)
|
||||
private Scene FindClientAndScene(UUID agentId, out ScenePresence presence)
|
||||
{
|
||||
presence = null;
|
||||
lock (m_Scenelist)
|
||||
{
|
||||
foreach (Scene scene in m_Scenelist)
|
||||
{
|
||||
ScenePresence presence = scene.GetScenePresence(agentId);
|
||||
if (presence != null)
|
||||
presence = scene.GetScenePresence(agentId);
|
||||
if (presence != null && !presence.IsDeleted)
|
||||
return scene;
|
||||
}
|
||||
}
|
||||
@@ -153,7 +154,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
// (InstantMessageDialog)im.dialog, client.Name,
|
||||
// im.fromAgentID, im.fromAgentName, im.toAgentID);
|
||||
|
||||
Scene scene = FindClientScene(client.AgentId);
|
||||
Scene scene = client.Scene as Scene;
|
||||
if (scene == null) // Something seriously wrong here.
|
||||
return;
|
||||
|
||||
@@ -416,15 +417,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
private void OnGridInstantMessage(GridInstantMessage im)
|
||||
{
|
||||
// Check if this is ours to handle
|
||||
//
|
||||
Scene scene = FindClientScene(new UUID(im.toAgentID));
|
||||
UUID recipientID = new UUID(im.toAgentID);
|
||||
Scene scene = FindClientAndScene(recipientID, out ScenePresence user);
|
||||
|
||||
if (scene == null)
|
||||
return;
|
||||
|
||||
// Find agent to deliver to
|
||||
//
|
||||
ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));
|
||||
if (user == null)
|
||||
return;
|
||||
|
||||
@@ -443,7 +440,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
if (assetType == AssetType.LinkFolder || assetType == AssetType.Link)
|
||||
return;
|
||||
|
||||
UUID recipientID = new UUID(im.toAgentID);
|
||||
UUID copyID;
|
||||
|
||||
if (AssetType.Folder == assetType)
|
||||
@@ -482,8 +478,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
if (im.binaryBucket.Length < 1) // Invalid
|
||||
return;
|
||||
|
||||
UUID recipientID = new UUID(im.toAgentID);
|
||||
|
||||
// Bucket is the asset type
|
||||
AssetType assetType = (AssetType)im.binaryBucket[0];
|
||||
|
||||
|
||||
@@ -5007,6 +5007,9 @@ Label_GroupsDone:
|
||||
|
||||
public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying)
|
||||
{
|
||||
if(!AllowAvatarCrossing)
|
||||
return false;
|
||||
|
||||
if (EntityTransferModule != null)
|
||||
{
|
||||
return EntityTransferModule.Cross(agent, isFlying);
|
||||
|
||||
@@ -2696,30 +2696,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
float agent_velocity = AgentControlNormalVel;
|
||||
|
||||
bool bAllowUpdateMoveToPosition = false;
|
||||
uint currflags = (uint)flags & (CONTROL_FLAG_NUDGE_MASK | CONTROL_FLAG_NORM_MASK);
|
||||
uint oldflags = MovementFlag & (CONTROL_FLAG_NUDGE_MASK | CONTROL_FLAG_NORM_MASK);
|
||||
MovementFlag &= ~(CONTROL_FLAG_NUDGE_MASK | CONTROL_FLAG_NORM_MASK);
|
||||
uint oldflags = MovementFlags & (CONTROL_FLAG_NUDGE_MASK | CONTROL_FLAG_NORM_MASK);
|
||||
MovementFlags = (uint)flags & (CONTROL_FLAG_NUDGE_MASK | CONTROL_FLAG_NORM_MASK);
|
||||
|
||||
if (currflags != 0)
|
||||
if (MovementFlags != 0)
|
||||
{
|
||||
DCFlagKeyPressed = true;
|
||||
mvToTarget = false;
|
||||
|
||||
MovementFlag |= currflags;
|
||||
//update_movementflag |= (currflags ^ oldflags) != 0;
|
||||
//update_movementflag |= (MovementFlags ^ oldflags) != 0;
|
||||
update_movementflag = true;
|
||||
|
||||
if (m_delayedStop < 0 && (flags & (ACFlags.AGENT_CONTROL_FAST_AT | ACFlags.AGENT_CONTROL_FAST_UP)) == 0)
|
||||
agent_velocity = AgentControlMidVel;
|
||||
|
||||
if ((currflags & CONTROL_FLAG_NUDGE_MASK) != 0)
|
||||
{
|
||||
currflags |= (currflags >>= 19);
|
||||
}
|
||||
if ((MovementFlags & CONTROL_FLAG_NUDGE_MASK) != 0)
|
||||
MovementFlags |= (MovementFlags >> 19);
|
||||
|
||||
for (int i = 0, mask = 1; i < 6; ++i, mask <<= 1)
|
||||
{
|
||||
if((currflags & mask) != 0)
|
||||
if((MovementFlags & mask) != 0)
|
||||
agent_control_v3 += Dir_Vectors[i];
|
||||
}
|
||||
}
|
||||
@@ -2816,7 +2812,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (AgentControlStopActive)
|
||||
{
|
||||
//if (MovementFlag == 0 && Animator.Falling)
|
||||
if (MovementFlag == 0 && Animator.currentControlState == ScenePresenceAnimator.motionControlStates.falling)
|
||||
if (MovementFlags == 0 && Animator.currentControlState == ScenePresenceAnimator.motionControlStates.falling)
|
||||
{
|
||||
AddNewMovement(agent_control_v3, AgentControlStopSlowVel, true);
|
||||
}
|
||||
@@ -2832,10 +2828,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
AddNewMovement(agent_control_v3, agent_velocity);
|
||||
else
|
||||
{
|
||||
if (MovementFlag != 0)
|
||||
if (MovementFlags != 0)
|
||||
AddNewMovement(agent_control_v3, agent_velocity);
|
||||
else
|
||||
m_delayedStop = Util.GetTimeStampMS() + 200.0;
|
||||
m_delayedStop = Util.GetTimeStampMS() + 250.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3004,8 +3000,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
const uint noMovFlagsMask = (uint)(~CONTROL_FLAG_NORM_MASK);
|
||||
|
||||
MovementFlag &= noMovFlagsMask;
|
||||
MovementFlag |= tmpAgentControlFlags;
|
||||
MovementFlags &= noMovFlagsMask;
|
||||
MovementFlags |= tmpAgentControlFlags;
|
||||
|
||||
m_AgentControlFlags &= unchecked((ACFlags)noMovFlagsMask);
|
||||
m_AgentControlFlags |= (ACFlags)tmpAgentControlFlags;
|
||||
@@ -3726,7 +3722,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}",
|
||||
// vec, Rotation, thisAddSpeedModifier, Name);
|
||||
m_delayedStop = -1;
|
||||
//m_delayedStop = -1;
|
||||
// rotate from avatar coord space to world
|
||||
Quaternion rot = Rotation;
|
||||
if (!Flying && !IsNPC)
|
||||
|
||||
Reference in New Issue
Block a user