aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorUbitUmarov2014-08-02 18:32:28 +0100
committerUbitUmarov2014-08-02 18:32:28 +0100
commit74447d14cda441408419bc90828975cf4b751692 (patch)
tree5951b8f168cfbd3ff8591dfd909178ba3b98511c /OpenSim/Region/Framework
parentcrossing into a hide parcel may work now. Not nice fix.. need get back to (diff)
downloadopensim-SC_OLD-74447d14cda441408419bc90828975cf4b751692.zip
opensim-SC_OLD-74447d14cda441408419bc90828975cf4b751692.tar.gz
opensim-SC_OLD-74447d14cda441408419bc90828975cf4b751692.tar.bz2
opensim-SC_OLD-74447d14cda441408419bc90828975cf4b751692.tar.xz
add some filters for NPCs
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs61
1 files changed, 45 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 415dbcd..faaf74c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -88,7 +88,17 @@ namespace OpenSim.Region.Framework.Scenes
88 m_scene.EventManager.TriggerScenePresenceUpdated(this); 88 m_scene.EventManager.TriggerScenePresenceUpdated(this);
89 } 89 }
90 90
91 public PresenceType PresenceType { get; private set; } 91 public bool isNPC { get; private set; }
92
93 private PresenceType m_presenceType;
94 public PresenceType PresenceType {
95 get {return m_presenceType;}
96 private set
97 {
98 m_presenceType = value;
99 isNPC = (m_presenceType == PresenceType.Npc);
100 }
101 }
92 102
93 private ScenePresenceStateMachine m_stateMachine; 103 private ScenePresenceStateMachine m_stateMachine;
94 104
@@ -1258,6 +1268,7 @@ namespace OpenSim.Region.Framework.Scenes
1258 // and it has already rezzed the attachments and started their scripts. 1268 // and it has already rezzed the attachments and started their scripts.
1259 // We do the following only for non-login agents, because their scripts 1269 // We do the following only for non-login agents, because their scripts
1260 // haven't started yet. 1270 // haven't started yet.
1271/* moved down
1261 if (PresenceType == PresenceType.Npc || (TeleportFlags & TeleportFlags.ViaLogin) != 0) 1272 if (PresenceType == PresenceType.Npc || (TeleportFlags & TeleportFlags.ViaLogin) != 0)
1262 { 1273 {
1263 // Viewers which have a current outfit folder will actually rez their own attachments. However, 1274 // Viewers which have a current outfit folder will actually rez their own attachments. However,
@@ -1273,6 +1284,7 @@ namespace OpenSim.Region.Framework.Scenes
1273 }); 1284 });
1274 } 1285 }
1275 else 1286 else
1287
1276 { 1288 {
1277 // We need to restart scripts here so that they receive the correct changed events (CHANGED_TELEPORT 1289 // We need to restart scripts here so that they receive the correct changed events (CHANGED_TELEPORT
1278 // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently 1290 // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently
@@ -1314,7 +1326,7 @@ namespace OpenSim.Region.Framework.Scenes
1314 } 1326 }
1315 } 1327 }
1316 } 1328 }
1317 1329*/
1318/* 1330/*
1319 SendAvatarDataToAllAgents(); 1331 SendAvatarDataToAllAgents();
1320 1332
@@ -1741,7 +1753,7 @@ namespace OpenSim.Region.Framework.Scenes
1741 try 1753 try
1742 { 1754 {
1743 // Make sure it's not a login agent. We don't want to wait for updates during login 1755 // Make sure it's not a login agent. We don't want to wait for updates during login
1744 if (PresenceType != PresenceType.Npc && (m_teleportFlags & TeleportFlags.ViaLogin) == 0) 1756 if (!isNPC && (m_teleportFlags & TeleportFlags.ViaLogin) == 0)
1745 { 1757 {
1746 // Let's wait until UpdateAgent (called by departing region) is done 1758 // Let's wait until UpdateAgent (called by departing region) is done
1747 if (!WaitForUpdateAgent(client)) 1759 if (!WaitForUpdateAgent(client))
@@ -1820,7 +1832,6 @@ namespace OpenSim.Region.Framework.Scenes
1820 m_previusParcelUUID = UUID.Zero; 1832 m_previusParcelUUID = UUID.Zero;
1821 m_currentParcelHide = false; 1833 m_currentParcelHide = false;
1822 m_currentParcelUUID = UUID.Zero; 1834 m_currentParcelUUID = UUID.Zero;
1823
1824 1835
1825 // send initial land overlay and parcel 1836 // send initial land overlay and parcel
1826 if (!IsChildAgent) 1837 if (!IsChildAgent)
@@ -1842,28 +1853,48 @@ namespace OpenSim.Region.Framework.Scenes
1842 ValidateAndSendAppearanceAndAgentData(); 1853 ValidateAndSendAppearanceAndAgentData();
1843 1854
1844 // Create child agents in neighbouring regions 1855 // Create child agents in neighbouring regions
1845 if (openChildAgents && !IsChildAgent) 1856 if (openChildAgents && !IsChildAgent && !isNPC)
1846 { 1857 {
1847 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 1858 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1848 if (m_agentTransfer != null) 1859 if (m_agentTransfer != null)
1849 m_agentTransfer.EnableChildAgents(this); 1860 m_agentTransfer.EnableChildAgents(this);
1850 } 1861 }
1851 1862
1852 // XXX: If we force an update here, then multiple attachments do appear correctly on a destination region 1863
1853 // If we do it a little bit earlier (e.g. when converting the child to a root agent) then this does not work. 1864 // attachments
1854 // This may be due to viewer code or it may be something we're not doing properly simulator side. 1865 if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0)
1855 lock (m_attachments)
1856 { 1866 {
1857 foreach (SceneObjectGroup sog in m_attachments) 1867 if (Scene.AttachmentsModule != null)
1858 sog.ScheduleGroupForFullUpdate(); 1868 Util.FireAndForget(
1869 o =>
1870 {
1871 Scene.AttachmentsModule.RezAttachments(this);
1872 });
1859 } 1873 }
1874 else
1875 {
1876 List<SceneObjectGroup> attachments = GetAttachments();
1860 1877
1878 if (attachments.Count > 0)
1879 {
1880 m_log.DebugFormat(
1881 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
1882
1883 // Resume scripts this possible should also be moved down after sending the avatar to viewer ?
1884 foreach (SceneObjectGroup sog in attachments)
1885 {
1886 sog.ScheduleGroupForFullUpdate();
1887 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
1888 sog.ResumeScripts();
1889 }
1890 }
1891 }
1861 // m_log.DebugFormat( 1892 // m_log.DebugFormat(
1862 // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", 1893 // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1863 // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); 1894 // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
1864 1895
1865 // send the rest of the world 1896 // send the rest of the world
1866 if (m_teleportFlags > 0) 1897 if (m_teleportFlags > 0 && !isNPC)
1867 SendInitialDataToMe(); 1898 SendInitialDataToMe();
1868 1899
1869 if (!IsChildAgent) 1900 if (!IsChildAgent)
@@ -5488,7 +5519,7 @@ namespace OpenSim.Region.Framework.Scenes
5488 } 5519 }
5489 } 5520 }
5490 5521
5491 if (killsToSendme.Count > 0) 5522 if (killsToSendme.Count > 0 && PresenceType != PresenceType.Npc)
5492 { 5523 {
5493 foreach (ScenePresence p in killsToSendme) 5524 foreach (ScenePresence p in killsToSendme)
5494 { 5525 {
@@ -5509,7 +5540,7 @@ namespace OpenSim.Region.Framework.Scenes
5509 } 5540 }
5510 } 5541 }
5511 5542
5512 if (viewsToSendme.Count > 0) 5543 if (viewsToSendme.Count > 0 && PresenceType != PresenceType.Npc)
5513 { 5544 {
5514 foreach (ScenePresence p in viewsToSendme) 5545 foreach (ScenePresence p in viewsToSendme)
5515 { 5546 {
@@ -5520,8 +5551,6 @@ namespace OpenSim.Region.Framework.Scenes
5520 p.Animator.SendAnimPackToClient(ControllingClient); 5551 p.Animator.SendAnimPackToClient(ControllingClient);
5521 } 5552 }
5522 } 5553 }
5523
5524
5525 } 5554 }
5526 } 5555 }
5527} 5556}