aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs82
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs40
6 files changed, 149 insertions, 19 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 57db4d6..9fcd5fe 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -177,6 +177,9 @@ namespace OpenSim.Region.Framework.Scenes
177 public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); 177 public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID);
178 public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; 178 public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
179 179
180 public delegate void AvatarAppearanceChange(ScenePresence avatar);
181 public event AvatarAppearanceChange OnAvatarAppearanceChange;
182
180 public event Action<ScenePresence> OnSignificantClientMovement; 183 public event Action<ScenePresence> OnSignificantClientMovement;
181 184
182 public delegate void IncomingInstantMessage(GridInstantMessage message); 185 public delegate void IncomingInstantMessage(GridInstantMessage message);
@@ -188,10 +191,62 @@ namespace OpenSim.Region.Framework.Scenes
188 191
189 public event ClientClosed OnClientClosed; 192 public event ClientClosed OnClientClosed;
190 193
194 // Fired when a script is created
195 // The indication that a new script exists in this region.
196 public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID);
197 public event NewScript OnNewScript;
198 public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
199 {
200 NewScript handlerNewScript = OnNewScript;
201 if (handlerNewScript != null)
202 {
203 foreach (NewScript d in handlerNewScript.GetInvocationList())
204 {
205 try
206 {
207 d(clientID, part, itemID);
208 }
209 catch (Exception e)
210 {
211 m_log.ErrorFormat(
212 "[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing. {0} {1}",
213 e.Message, e.StackTrace);
214 }
215 }
216 }
217 }
218
219 //TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset
220 // An indication that the script has changed.
221 public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID);
222 public event UpdateScript OnUpdateScript;
223 public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
224 {
225 UpdateScript handlerUpdateScript = OnUpdateScript;
226 if (handlerUpdateScript != null)
227 {
228 foreach (UpdateScript d in handlerUpdateScript.GetInvocationList())
229 {
230 try
231 {
232 d(clientId, itemId, primId, isScriptRunning, newAssetID);
233 }
234 catch (Exception e)
235 {
236 m_log.ErrorFormat(
237 "[EVENT MANAGER]: Delegate for TriggerUpdateScript failed - continuing. {0} {1}",
238 e.Message, e.StackTrace);
239 }
240 }
241 }
242 }
243
191 /// <summary> 244 /// <summary>
192 /// This is fired when a scene object property that a script might be interested in (such as color, scale or 245 /// ScriptChangedEvent is fired when a scene object property that a script might be interested
193 /// inventory) changes. Only enough information is sent for the LSL changed event 246 /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event.
194 /// (see http://lslwiki.net/lslwiki/wakka.php?wakka=changed) 247 /// This is not an indication that the script has changed (see OnUpdateScript for that).
248 /// This event is sent to a script to tell it that some property changed on
249 /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed .
195 /// </summary> 250 /// </summary>
196 public event ScriptChangedEvent OnScriptChangedEvent; 251 public event ScriptChangedEvent OnScriptChangedEvent;
197 public delegate void ScriptChangedEvent(uint localID, uint change); 252 public delegate void ScriptChangedEvent(uint localID, uint change);
@@ -1262,6 +1317,27 @@ namespace OpenSim.Region.Framework.Scenes
1262 } 1317 }
1263 } 1318 }
1264 1319
1320 public void TriggerAvatarAppearanceChanged(ScenePresence avatar)
1321 {
1322 AvatarAppearanceChange handler = OnAvatarAppearanceChange;
1323 if (handler != null)
1324 {
1325 foreach (AvatarAppearanceChange d in handler.GetInvocationList())
1326 {
1327 try
1328 {
1329 d(avatar);
1330 }
1331 catch (Exception e)
1332 {
1333 m_log.ErrorFormat(
1334 "[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}",
1335 e.Message, e.StackTrace);
1336 }
1337 }
1338 }
1339 }
1340
1265 public void TriggerIncomingInstantMessage(GridInstantMessage message) 1341 public void TriggerIncomingInstantMessage(GridInstantMessage message)
1266 { 1342 {
1267 IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; 1343 IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index fff39fb..e7a3b42 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -265,6 +265,10 @@ namespace OpenSim.Region.Framework.Scenes
265 // 265 //
266 errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0); 266 errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0);
267 } 267 }
268
269 // Tell anyone managing scripts that a script has been reloaded/changed
270 EventManager.TriggerUpdateScript(remoteClient.AgentId, itemId, primId, isScriptRunning, item.AssetID);
271
268 part.ParentGroup.ResumeScripts(); 272 part.ParentGroup.ResumeScripts();
269 return errors; 273 return errors;
270 } 274 }
@@ -1643,9 +1647,13 @@ namespace OpenSim.Region.Framework.Scenes
1643 // have state in inventory 1647 // have state in inventory
1644 part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); 1648 part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
1645 1649
1650 // tell anyone watching that there is a new script in town
1651 EventManager.TriggerNewScript(agentID, part, copyID);
1652
1646 // m_log.InfoFormat("[PRIMINVENTORY]: " + 1653 // m_log.InfoFormat("[PRIMINVENTORY]: " +
1647 // "Rezzed script {0} into prim local ID {1} for user {2}", 1654 // "Rezzed script {0} into prim local ID {1} for user {2}",
1648 // item.inventoryName, localID, remoteClient.Name); 1655 // item.inventoryName, localID, remoteClient.Name);
1656
1649 part.ParentGroup.ResumeScripts(); 1657 part.ParentGroup.ResumeScripts();
1650 1658
1651 return part; 1659 return part;
@@ -1726,6 +1734,10 @@ namespace OpenSim.Region.Framework.Scenes
1726 1734
1727 part.Inventory.AddInventoryItem(taskItem, false); 1735 part.Inventory.AddInventoryItem(taskItem, false);
1728 part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); 1736 part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
1737
1738 // tell anyone managing scripts that a new script exists
1739 EventManager.TriggerNewScript(agentID, part, taskItem.ItemID);
1740
1729 part.ParentGroup.ResumeScripts(); 1741 part.ParentGroup.ResumeScripts();
1730 1742
1731 return part; 1743 return part;
@@ -1954,7 +1966,7 @@ namespace OpenSim.Region.Framework.Scenes
1954 permissionToTake = true; 1966 permissionToTake = true;
1955 permissionToDelete = true; 1967 permissionToDelete = true;
1956 1968
1957 AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); 1969 AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
1958 } 1970 }
1959 } 1971 }
1960 else // Auto return passes through here with null agent 1972 else // Auto return passes through here with null agent
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index bbdf35d..7b1ef40 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3397,6 +3397,9 @@ namespace OpenSim.Region.Framework.Scenes
3397 { 3397 {
3398 bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || 3398 bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
3399 (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); 3399 (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
3400 bool viahome = ((teleportFlags & (uint)Constants.TeleportFlags.ViaHome) != 0);
3401 bool godlike = ((teleportFlags & (uint)Constants.TeleportFlags.Godlike) != 0);
3402
3400 reason = String.Empty; 3403 reason = String.Empty;
3401 3404
3402 //Teleport flags: 3405 //Teleport flags:
@@ -3571,6 +3574,29 @@ namespace OpenSim.Region.Framework.Scenes
3571 agent.startpos.Z = 720; 3574 agent.startpos.Z = 720;
3572 } 3575 }
3573 } 3576 }
3577
3578 // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags
3579 if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero &&
3580 RegionInfo.EstateSettings.AllowDirectTeleport == false &&
3581 !viahome && !godlike)
3582 {
3583 SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject);
3584 // Can have multiple SpawnPoints
3585 List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints();
3586 if ( spawnpoints.Count > 1)
3587 {
3588 // We have multiple SpawnPoints, Route the agent to a random one
3589 agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count)].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
3590 }
3591 else
3592 {
3593 // We have a single SpawnPoint and will route the agent to it
3594 agent.startpos = spawnpoints[0].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
3595 }
3596
3597 return true;
3598 }
3599
3574 // Honor parcel landing type and position. 3600 // Honor parcel landing type and position.
3575 /* 3601 /*
3576 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); 3602 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 5405358..5a7f124 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1678,7 +1678,7 @@ namespace OpenSim.Region.Framework.Scenes
1678 1678
1679 if (group != null) 1679 if (group != null)
1680 { 1680 {
1681 if (m_parentScene.Permissions.CanEditObject(group.UUID,agentID)) 1681 if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID))
1682 { 1682 {
1683 group.UpdateExtraParam(primLocalID, type, inUse, data); 1683 group.UpdateExtraParam(primLocalID, type, inUse, data);
1684 } 1684 }
@@ -1695,7 +1695,7 @@ namespace OpenSim.Region.Framework.Scenes
1695 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1695 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1696 if (group != null) 1696 if (group != null)
1697 { 1697 {
1698 if (m_parentScene.Permissions.CanEditObject(group.GetPartsFullID(primLocalID), agentID)) 1698 if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID))
1699 { 1699 {
1700 ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock(); 1700 ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock();
1701 shapeData.ObjectLocalID = shapeBlock.ObjectLocalID; 1701 shapeData.ObjectLocalID = shapeBlock.ObjectLocalID;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index a4ca0fb..0d14b83 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1754,7 +1754,7 @@ namespace OpenSim.Region.Framework.Scenes
1754 m_log.DebugFormat( 1754 m_log.DebugFormat(
1755 "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn", 1755 "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn",
1756 RootPart.UUID); 1756 RootPart.UUID);
1757 m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel autoreturn"); 1757 m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn");
1758 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero, 1758 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero,
1759 DeRezAction.Return, UUID.Zero); 1759 DeRezAction.Return, UUID.Zero);
1760 1760
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 4b80e37..19cb9fb 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Drawing; 30using System.Drawing;
31using System.IO; 31using System.IO;
32using System.Linq;
32using System.Reflection; 33using System.Reflection;
33using System.Xml; 34using System.Xml;
34using log4net; 35using log4net;
@@ -573,13 +574,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
573 574
574 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) 575 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)
575 { 576 {
576 bool errors = false; 577 List<string> errorNodeNames;
577 obj.Shape = ReadShape(reader, "Shape", out errors); 578 obj.Shape = ReadShape(reader, "Shape", out errorNodeNames);
578 579
579 if (errors) 580 if (errorNodeNames != null)
581 {
580 m_log.DebugFormat( 582 m_log.DebugFormat(
581 "[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors. Please see earlier log entries.", 583 "[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors in properties {2}.",
582 obj.Name, obj.UUID); 584 obj.Name, obj.UUID, string.Join(", ", errorNodeNames.ToArray()));
585 }
583 } 586 }
584 587
585 private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) 588 private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader)
@@ -1529,31 +1532,44 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1529 /// </summary> 1532 /// </summary>
1530 /// <param name="reader"></param> 1533 /// <param name="reader"></param>
1531 /// <param name="name">The name of the xml element containing the shape</param> 1534 /// <param name="name">The name of the xml element containing the shape</param>
1532 /// <param name="errors">true if any errors were encountered during parsing, false otherwise</param> 1535 /// <param name="errors">a list containing the failing node names. If no failures then null.</param>
1533 /// <returns>The shape parsed</returns> 1536 /// <returns>The shape parsed</returns>
1534 public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out bool errors) 1537 public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out List<string> errorNodeNames)
1535 { 1538 {
1536 errors = false; 1539 List<string> internalErrorNodeNames = null;
1537 1540
1538 PrimitiveBaseShape shape = new PrimitiveBaseShape(); 1541 PrimitiveBaseShape shape = new PrimitiveBaseShape();
1539 1542
1543 if (reader.IsEmptyElement)
1544 {
1545 reader.Read();
1546 errorNodeNames = null;
1547 return shape;
1548 }
1549
1540 reader.ReadStartElement(name, String.Empty); // Shape 1550 reader.ReadStartElement(name, String.Empty); // Shape
1541 1551
1542 errors = ExternalRepresentationUtils.ExecuteReadProcessors( 1552 ExternalRepresentationUtils.ExecuteReadProcessors(
1543 shape, 1553 shape,
1544 m_ShapeXmlProcessors, 1554 m_ShapeXmlProcessors,
1545 reader, 1555 reader,
1546 (o, nodeName, e) 1556 (o, nodeName, e)
1547 => 1557 =>
1548 { 1558 {
1549 m_log.DebugFormat( 1559// m_log.DebugFormat(
1550 "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", 1560// "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}",
1551 nodeName, e.Message, e.StackTrace); 1561// nodeName, e.Message, e.StackTrace);
1562 if (internalErrorNodeNames == null)
1563 internalErrorNodeNames = new List<string>();
1564
1565 internalErrorNodeNames.Add(nodeName);
1552 } 1566 }
1553 ); 1567 );
1554 1568
1555 reader.ReadEndElement(); // Shape 1569 reader.ReadEndElement(); // Shape
1556 1570
1571 errorNodeNames = internalErrorNodeNames;
1572
1557 return shape; 1573 return shape;
1558 } 1574 }
1559 1575