mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 12:25:42 +08:00
cosmetics
This commit is contained in:
@@ -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];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user