mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
This commit is contained in:
@@ -45,6 +45,13 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
void Deactivate();
|
||||
void Activate();
|
||||
UUID GetID();
|
||||
|
||||
/// <summary>
|
||||
/// Bitfield indicating which strings should be processed as regex.
|
||||
/// 1 corresponds to IWorldCommListenerInfo::GetName()
|
||||
/// 2 corresponds to IWorldCommListenerInfo::GetMessage()
|
||||
/// </summary>
|
||||
int RegexBitfield { get; }
|
||||
}
|
||||
|
||||
public interface IWorldComm
|
||||
@@ -60,7 +67,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// the script during 'peek' time. Parameter hostID is needed to
|
||||
/// determine the position of the script.
|
||||
/// </summary>
|
||||
/// <param name="localID">localID of the script engine</param>
|
||||
/// <param name="LocalID">localID of the script engine</param>
|
||||
/// <param name="itemID">UUID of the script engine</param>
|
||||
/// <param name="hostID">UUID of the SceneObjectPart</param>
|
||||
/// <param name="channel">channel to listen on</param>
|
||||
@@ -70,6 +77,23 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <returns>number of the scripts handle</returns>
|
||||
int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg);
|
||||
|
||||
/// <summary>
|
||||
/// Create a listen event callback with the specified filters.
|
||||
/// The parameters localID,itemID are needed to uniquely identify
|
||||
/// the script during 'peek' time. Parameter hostID is needed to
|
||||
/// determine the position of the script.
|
||||
/// </summary>
|
||||
/// <param name="LocalID">localID of the script engine</param>
|
||||
/// <param name="itemID">UUID of the script engine</param>
|
||||
/// <param name="hostID">UUID of the SceneObjectPart</param>
|
||||
/// <param name="channel">channel to listen on</param>
|
||||
/// <param name="name">name to filter on</param>
|
||||
/// <param name="id">key to filter on (user given, could be totally faked)</param>
|
||||
/// <param name="msg">msg to filter on</param>
|
||||
/// <param name="regexBitfield">Bitfield indicating which strings should be processed as regex.</param>
|
||||
/// <returns>number of the scripts handle</returns>
|
||||
int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg, int regexBitfield);
|
||||
|
||||
/// <summary>
|
||||
/// This method scans over the objects which registered an interest in listen callbacks.
|
||||
/// For everyone it finds, it checks if it fits the given filter. If it does, then
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
{
|
||||
if (m_defaultAnimation.AnimID == animID)
|
||||
{
|
||||
m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero);
|
||||
m_defaultAnimation = new OpenSim.Framework.Animation(animID, 1, UUID.Zero);
|
||||
}
|
||||
else if (HasAnimation(animID))
|
||||
{
|
||||
|
||||
@@ -38,8 +38,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
public partial class Scene
|
||||
{
|
||||
/// <summary>
|
||||
/// Send chat to listeners.
|
||||
/// </summary>
|
||||
/// <param name='message'></param>
|
||||
/// <param name='type'>/param>
|
||||
/// <param name='channel'></param>
|
||||
/// <param name='fromPos'></param>
|
||||
/// <param name='fromName'></param>
|
||||
/// <param name='fromID'></param>
|
||||
/// <param name='targetID'></param>
|
||||
/// <param name='fromAgent'></param>
|
||||
/// <param name='broadcast'></param>
|
||||
public void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
|
||||
UUID fromID, bool fromAgent, bool broadcast, UUID destination)
|
||||
UUID fromID, UUID targetID, bool fromAgent, bool broadcast)
|
||||
{
|
||||
OSChatMessage args = new OSChatMessage();
|
||||
|
||||
@@ -49,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
args.Position = fromPos;
|
||||
args.SenderUUID = fromID;
|
||||
args.Scene = this;
|
||||
args.Destination = destination;
|
||||
args.Destination = targetID;
|
||||
|
||||
if (fromAgent)
|
||||
{
|
||||
@@ -66,6 +78,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
args.From = fromName;
|
||||
//args.
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE]: Sending message {0} on channel {1}, type {2} from {3}, broadcast {4}",
|
||||
// args.Message.Replace("\n", "\\n"), args.Channel, args.Type, fromName, broadcast);
|
||||
|
||||
if (broadcast)
|
||||
EventManager.TriggerOnChatBroadcast(this, args);
|
||||
else
|
||||
@@ -75,7 +91,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
|
||||
UUID fromID, bool fromAgent, bool broadcast)
|
||||
{
|
||||
SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, broadcast, UUID.Zero);
|
||||
SimChat(message, type, channel, fromPos, fromName, fromID, UUID.Zero, fromAgent, broadcast);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1300,6 +1300,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// This is the method that shuts down the scene.
|
||||
public override void Close()
|
||||
{
|
||||
if (m_shuttingDown)
|
||||
{
|
||||
m_log.WarnFormat("[SCENE]: Ignoring close request because already closing {0}", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName);
|
||||
|
||||
StatsReporter.Close();
|
||||
@@ -1343,6 +1349,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
m_sceneGraph.Close();
|
||||
|
||||
if (!GridService.DeregisterRegion(RegionInfo.RegionID))
|
||||
m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
|
||||
|
||||
base.Close();
|
||||
|
||||
// XEngine currently listens to the EventManager.OnShutdown event to trigger script stop and persistence.
|
||||
// Therefore. we must dispose of the PhysicsScene after this to prevent a window where script code can
|
||||
// attempt to reference a null or disposed physics scene.
|
||||
if (PhysicsScene != null)
|
||||
{
|
||||
PhysicsScene phys = PhysicsScene;
|
||||
@@ -1351,12 +1365,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
phys.Dispose();
|
||||
phys = null;
|
||||
}
|
||||
|
||||
if (!GridService.DeregisterRegion(RegionInfo.RegionID))
|
||||
m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
|
||||
|
||||
// call the base class Close method.
|
||||
base.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -3595,9 +3603,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (closeChildAgents && CapsModule != null)
|
||||
CapsModule.RemoveCaps(agentID);
|
||||
|
||||
// REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
|
||||
// this method is doing is HORRIBLE!!!
|
||||
avatar.Scene.NeedSceneCacheClear(avatar.UUID);
|
||||
// // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
|
||||
// // this method is doing is HORRIBLE!!!
|
||||
// Commented pending deletion since this method no longer appears to do anything at all
|
||||
// avatar.Scene.NeedSceneCacheClear(avatar.UUID);
|
||||
|
||||
if (closeChildAgents && !isChildAgent)
|
||||
{
|
||||
@@ -4899,12 +4908,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Get a group via its UUID
|
||||
/// </summary>
|
||||
/// <param name="fullID"></param>
|
||||
/// <returns>null if no group with that name exists</returns>
|
||||
/// <returns>null if no group with that id exists</returns>
|
||||
public SceneObjectGroup GetSceneObjectGroup(UUID fullID)
|
||||
{
|
||||
return m_sceneGraph.GetSceneObjectGroup(fullID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a group via its local ID
|
||||
/// </summary>
|
||||
/// <remarks>This will only return a group if the local ID matches a root part</remarks>
|
||||
/// <param name="localID"></param>
|
||||
/// <returns>null if no group with that id exists</returns>
|
||||
public SceneObjectGroup GetSceneObjectGroup(uint localID)
|
||||
{
|
||||
return m_sceneGraph.GetSceneObjectGroup(localID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a group by name from the scene (will return the first
|
||||
/// found, if there are more than one prim with the same name)
|
||||
@@ -5065,14 +5085,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
client.SendRegionHandle(regionID, handle);
|
||||
}
|
||||
|
||||
public bool NeedSceneCacheClear(UUID agentID)
|
||||
{
|
||||
IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>();
|
||||
if (inv == null)
|
||||
return true;
|
||||
|
||||
return inv.NeedSceneCacheClear(agentID, this);
|
||||
}
|
||||
// Commented pending deletion since this method no longer appears to do anything at all
|
||||
// public bool NeedSceneCacheClear(UUID agentID)
|
||||
// {
|
||||
// IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>();
|
||||
// if (inv == null)
|
||||
// return true;
|
||||
//
|
||||
// return inv.NeedSceneCacheClear(agentID, this);
|
||||
// }
|
||||
|
||||
public void CleanTempObjects()
|
||||
{
|
||||
|
||||
@@ -1062,6 +1062,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a group in the scene
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This will only return a group if the local ID matches the root part, not other parts.
|
||||
/// </remarks>
|
||||
/// <param name="localID">Local id of the root part of the group</param>
|
||||
/// <returns>null if no such group was found</returns>
|
||||
protected internal SceneObjectGroup GetSceneObjectGroup(uint localID)
|
||||
{
|
||||
lock (SceneObjectGroupsByLocalPartID)
|
||||
{
|
||||
if (SceneObjectGroupsByLocalPartID.ContainsKey(localID))
|
||||
{
|
||||
SceneObjectGroup so = SceneObjectGroupsByLocalPartID[localID];
|
||||
|
||||
if (so.LocalId == localID)
|
||||
return so;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a group by name from the scene (will return the first
|
||||
/// found, if there are more than one prim with the same name)
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public ScriptControlled eventControls;
|
||||
}
|
||||
|
||||
public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs);
|
||||
public delegate void SendCoarseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs);
|
||||
|
||||
public class ScenePresence : EntityBase, IScenePresence
|
||||
{
|
||||
@@ -188,7 +188,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
public bool SitGround { get; private set; }
|
||||
|
||||
private SendCourseLocationsMethod m_sendCourseLocationsMethod;
|
||||
private SendCoarseLocationsMethod m_sendCoarseLocationsMethod;
|
||||
|
||||
//private Vector3 m_requestedSitOffset = new Vector3();
|
||||
|
||||
@@ -711,7 +711,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
AttachmentsSyncLock = new Object();
|
||||
AllowMovement = true;
|
||||
IsChildAgent = true;
|
||||
m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
|
||||
m_sendCoarseLocationsMethod = SendCoarseLocationsDefault;
|
||||
Animator = new ScenePresenceAnimator(this);
|
||||
PresenceType = type;
|
||||
DrawDistance = world.DefaultDrawDistance;
|
||||
@@ -2629,17 +2629,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
|
||||
{
|
||||
SendCourseLocationsMethod d = m_sendCourseLocationsMethod;
|
||||
SendCoarseLocationsMethod d = m_sendCoarseLocationsMethod;
|
||||
if (d != null)
|
||||
{
|
||||
d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSendCourseLocationMethod(SendCourseLocationsMethod d)
|
||||
public void SetSendCoarseLocationMethod(SendCoarseLocationsMethod d)
|
||||
{
|
||||
if (d != null)
|
||||
m_sendCourseLocationsMethod = d;
|
||||
m_sendCoarseLocationsMethod = d;
|
||||
}
|
||||
|
||||
public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
|
||||
@@ -2843,7 +2843,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
#region Significant Movement Method
|
||||
|
||||
/// <summary>
|
||||
/// This checks for a significant movement and sends a courselocationchange update
|
||||
/// This checks for a significant movement and sends a coarselocationchange update
|
||||
/// </summary>
|
||||
protected void CheckForSignificantMovement()
|
||||
{
|
||||
|
||||
@@ -65,5 +65,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
|
||||
Assert.That(scene.Frame, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestShutdownScene()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
scene.Close();
|
||||
|
||||
Assert.That(scene.ShuttingDown, Is.True);
|
||||
Assert.That(scene.Active, Is.False);
|
||||
|
||||
// Trying to update a shutdown scene should result in no update
|
||||
scene.Update(1);
|
||||
|
||||
Assert.That(scene.Frame, Is.EqualTo(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user