aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-10 01:47:37 +0100
committerJustin Clark-Casey (justincc)2011-08-10 01:47:37 +0100
commit5d6c9644faf6aeac38410af9cff97adfef88d7aa (patch)
tree4913309153fd8b55f7cd5cd27bd449f9eecd41f5 /OpenSim/Region
parentStop trying to deregister caps or close child agents when an NPC is removed (diff)
downloadopensim-SC-5d6c9644faf6aeac38410af9cff97adfef88d7aa.zip
opensim-SC-5d6c9644faf6aeac38410af9cff97adfef88d7aa.tar.gz
opensim-SC-5d6c9644faf6aeac38410af9cff97adfef88d7aa.tar.bz2
opensim-SC-5d6c9644faf6aeac38410af9cff97adfef88d7aa.tar.xz
early code to allow scripts to force npcs not to fly when moving to target
this is to allow walking on prims. it will be up to the script writer to be sure that there is a continuous path. currently implemented in osNpcMoveToTarget(), but none of this is final.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs6
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs9
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs5
12 files changed, 42 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 977918a..1d35973 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -231,7 +231,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
231 public event ScriptReset OnScriptReset; 231 public event ScriptReset OnScriptReset;
232 public event GetScriptRunning OnGetScriptRunning; 232 public event GetScriptRunning OnGetScriptRunning;
233 public event SetScriptRunning OnSetScriptRunning; 233 public event SetScriptRunning OnSetScriptRunning;
234 public event Action<Vector3> OnAutoPilotGo; 234 public event Action<Vector3, bool> OnAutoPilotGo;
235 public event TerrainUnacked OnUnackedTerrain; 235 public event TerrainUnacked OnUnackedTerrain;
236 public event ActivateGesture OnActivateGesture; 236 public event ActivateGesture OnActivateGesture;
237 public event DeactivateGesture OnDeactivateGesture; 237 public event DeactivateGesture OnDeactivateGesture;
@@ -11628,9 +11628,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11628 locy = Convert.ToSingle(args[1]) - (float)regionY; 11628 locy = Convert.ToSingle(args[1]) - (float)regionY;
11629 locz = Convert.ToSingle(args[2]); 11629 locz = Convert.ToSingle(args[2]);
11630 11630
11631 Action<Vector3> handlerAutoPilotGo = OnAutoPilotGo; 11631 Action<Vector3, bool> handlerAutoPilotGo = OnAutoPilotGo;
11632 if (handlerAutoPilotGo != null) 11632 if (handlerAutoPilotGo != null)
11633 handlerAutoPilotGo(new Vector3(locx, locy, locz)); 11633 handlerAutoPilotGo(new Vector3(locx, locy, locz), false);
11634 } 11634 }
11635 11635
11636 /// <summary> 11636 /// <summary>
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 08023b8..c87790f 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -222,7 +222,7 @@ namespace OpenSim.Region.Examples.SimpleModule
222 public event ScriptReset OnScriptReset; 222 public event ScriptReset OnScriptReset;
223 public event GetScriptRunning OnGetScriptRunning; 223 public event GetScriptRunning OnGetScriptRunning;
224 public event SetScriptRunning OnSetScriptRunning; 224 public event SetScriptRunning OnSetScriptRunning;
225 public event Action<Vector3> OnAutoPilotGo; 225 public event Action<Vector3, bool> OnAutoPilotGo;
226 226
227 public event TerrainUnacked OnUnackedTerrain; 227 public event TerrainUnacked OnUnackedTerrain;
228 228
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 763d2dc..06296c9 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -67,8 +67,12 @@ namespace OpenSim.Region.Framework.Interfaces
67 /// <param name="agentID">The UUID of the NPC</param> 67 /// <param name="agentID">The UUID of the NPC</param>
68 /// <param name="scene"></param> 68 /// <param name="scene"></param>
69 /// <param name="pos"></param> 69 /// <param name="pos"></param>
70 /// <param name="noFly">
71 /// If true, then the avatar will attempt to walk to the location even if it's up in the air.
72 /// This is to allow walking on prims.
73 /// </param>
70 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 74 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
71 bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos); 75 bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly);
72 76
73 /// <summary> 77 /// <summary>
74 /// Stop the NPC's current movement. 78 /// Stop the NPC's current movement.
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 3b6a458..fe96152 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Framework.Scenes
1650 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); 1650 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
1651 if (avatar != null) 1651 if (avatar != null)
1652 { 1652 {
1653 avatar.MoveToTarget(target); 1653 avatar.MoveToTarget(target, false);
1654 } 1654 }
1655 } 1655 }
1656 else 1656 else
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 2db83eb..b8e4e93 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1684,7 +1684,12 @@ namespace OpenSim.Region.Framework.Scenes
1684 /// Move to the given target over time. 1684 /// Move to the given target over time.
1685 /// </summary> 1685 /// </summary>
1686 /// <param name="pos"></param> 1686 /// <param name="pos"></param>
1687 public void MoveToTarget(Vector3 pos) 1687 /// <param name="noFly">
1688 /// If true, then don't allow the avatar to fly to the target, even if it's up in the air.
1689 /// This is to allow movement to targets that are known to be on an elevated platform with a continuous path
1690 /// from start to finish.
1691 /// </param>
1692 public void MoveToTarget(Vector3 pos, bool noFly)
1688 { 1693 {
1689// m_log.DebugFormat( 1694// m_log.DebugFormat(
1690// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", 1695// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
@@ -1718,7 +1723,7 @@ namespace OpenSim.Region.Framework.Scenes
1718 "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", 1723 "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
1719 Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); 1724 Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
1720 1725
1721 if (pos.Z > terrainHeight) 1726 if (!noFly && pos.Z > terrainHeight)
1722 PhysicsActor.Flying = true; 1727 PhysicsActor.Flying = true;
1723 1728
1724 MovingToTarget = true; 1729 MovingToTarget = true;
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 8ebf9cb..15201da 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -806,7 +806,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
806 public event ScriptReset OnScriptReset; 806 public event ScriptReset OnScriptReset;
807 public event GetScriptRunning OnGetScriptRunning; 807 public event GetScriptRunning OnGetScriptRunning;
808 public event SetScriptRunning OnSetScriptRunning; 808 public event SetScriptRunning OnSetScriptRunning;
809 public event Action<Vector3> OnAutoPilotGo; 809 public event Action<Vector3, bool> OnAutoPilotGo;
810 public event TerrainUnacked OnUnackedTerrain; 810 public event TerrainUnacked OnUnackedTerrain;
811 public event ActivateGesture OnActivateGesture; 811 public event ActivateGesture OnActivateGesture;
812 public event DeactivateGesture OnDeactivateGesture; 812 public event DeactivateGesture OnDeactivateGesture;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index b3e2495..cfd692d 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -328,7 +328,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
328 public event ScriptReset OnScriptReset; 328 public event ScriptReset OnScriptReset;
329 public event GetScriptRunning OnGetScriptRunning; 329 public event GetScriptRunning OnGetScriptRunning;
330 public event SetScriptRunning OnSetScriptRunning; 330 public event SetScriptRunning OnSetScriptRunning;
331 public event Action<Vector3> OnAutoPilotGo; 331 public event Action<Vector3, bool> OnAutoPilotGo;
332 332
333 public event TerrainUnacked OnUnackedTerrain; 333 public event TerrainUnacked OnUnackedTerrain;
334 334
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 7b9457a..d0b5a94 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -217,7 +217,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
217 return npcAvatar.AgentId; 217 return npcAvatar.AgentId;
218 } 218 }
219 219
220 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos) 220 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly)
221 { 221 {
222 lock (m_avatars) 222 lock (m_avatars)
223 { 223 {
@@ -229,7 +229,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
229 m_log.DebugFormat( 229 m_log.DebugFormat(
230 "[NPC MODULE]: Moving {0} to {1} in {2}", sp.Name, pos, scene.RegionInfo.RegionName); 230 "[NPC MODULE]: Moving {0} to {1} in {2}", sp.Name, pos, scene.RegionInfo.RegionName);
231 231
232 sp.MoveToTarget(pos); 232 sp.MoveToTarget(pos, noFly);
233 233
234 return true; 234 return true;
235 } 235 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 2ec354f..81497d5 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
113 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 113 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
114 114
115 Vector3 targetPos = startPos + new Vector3(0, 0, 10); 115 Vector3 targetPos = startPos + new Vector3(0, 0, 10);
116 npcModule.MoveToTarget(npc.UUID, scene, targetPos); 116 npcModule.MoveToTarget(npc.UUID, scene, targetPos, false);
117 117
118 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 118 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
119 119
@@ -135,7 +135,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
135 // Try a second movement 135 // Try a second movement
136 startPos = npc.AbsolutePosition; 136 startPos = npc.AbsolutePosition;
137 targetPos = startPos + new Vector3(10, 0, 0); 137 targetPos = startPos + new Vector3(10, 0, 0);
138 npcModule.MoveToTarget(npc.UUID, scene, targetPos); 138 npcModule.MoveToTarget(npc.UUID, scene, targetPos, false);
139 139
140 scene.Update(); 140 scene.Update();
141 141
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 9c32029..63c882d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2209,7 +2209,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2209 if (module != null) 2209 if (module != null)
2210 { 2210 {
2211 Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); 2211 Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z);
2212 module.MoveToTarget(new UUID(npc.m_string), World, pos); 2212 module.MoveToTarget(new UUID(npc.m_string), World, pos, false);
2213 }
2214 }
2215
2216 public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int noFly)
2217 {
2218 CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget");
2219
2220 INPCModule module = World.RequestModuleInterface<INPCModule>();
2221 if (module != null)
2222 {
2223 Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z);
2224 module.MoveToTarget(new UUID(npc.m_string), World, pos, noFly != 0);
2213 } 2225 }
2214 } 2226 }
2215 2227
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index ab0097a..56be9d9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -173,6 +173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
173 LSL_Key osNpcSaveAppearance(string avatar, string notecardName); 173 LSL_Key osNpcSaveAppearance(string avatar, string notecardName);
174 void osNpcLoadAppearance(string avatar, string notecardNameOrUuid); 174 void osNpcLoadAppearance(string avatar, string notecardNameOrUuid);
175 void osNpcMoveTo(key npc, vector position); 175 void osNpcMoveTo(key npc, vector position);
176 void osNpcMoveToTarget(key npc, vector position, int noFly);
176 void osNpcStopMoveTo(LSL_Key npc); 177 void osNpcStopMoveTo(LSL_Key npc);
177 void osNpcSay(key npc, string message); 178 void osNpcSay(key npc, string message);
178 void osNpcRemove(key npc); 179 void osNpcRemove(key npc);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index a7843dd..c745e5c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -498,6 +498,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
498 m_OSSL_Functions.osNpcMoveTo(npc, position); 498 m_OSSL_Functions.osNpcMoveTo(npc, position);
499 } 499 }
500 500
501 public void osNpcMoveToTarget(key npc, vector position, int noFly)
502 {
503 m_OSSL_Functions.osNpcMoveToTarget(npc, position, noFly);
504 }
505
501 public void osNpcStopMoveTo(LSL_Key npc) 506 public void osNpcStopMoveTo(LSL_Key npc)
502 { 507 {
503 m_OSSL_Functions.osNpcStopMoveTo(npc); 508 m_OSSL_Functions.osNpcStopMoveTo(npc);