aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs7
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs18
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs24
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs5
10 files changed, 75 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 5e5c4a1..9dd8c79 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -95,6 +95,15 @@ namespace OpenSim.Region.Framework.Interfaces
95 bool Say(UUID agentID, Scene scene, string text); 95 bool Say(UUID agentID, Scene scene, string text);
96 96
97 /// <summary> 97 /// <summary>
98 /// Sit the NPC.
99 /// </summary>
100 /// <param name="agentID"></param>
101 /// <param name="partID"></param>
102 /// <param name="scene"></param>
103 /// <returns>true if the sit succeeded, false if not</returns>
104 bool Sit(UUID agentID, UUID partID, Scene scene);
105
106 /// <summary>
98 /// Delete an NPC. 107 /// Delete an NPC.
99 /// </summary> 108 /// </summary>
100 /// <param name="agentID">The UUID of the NPC</param> 109 /// <param name="agentID">The UUID of the NPC</param>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 42cc1ce..703b986 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1220,14 +1220,12 @@ namespace OpenSim.Region.Framework.Scenes
1220 } 1220 }
1221 } 1221 }
1222 1222
1223
1224 public UUID SitTargetAvatar 1223 public UUID SitTargetAvatar
1225 { 1224 {
1226 get { return m_sitTargetAvatar; } 1225 get { return m_sitTargetAvatar; }
1227 set { m_sitTargetAvatar = value; } 1226 set { m_sitTargetAvatar = value; }
1228 } 1227 }
1229 1228
1230
1231 public virtual UUID RegionID 1229 public virtual UUID RegionID
1232 { 1230 {
1233 get 1231 get
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 972e7fc..dd1a29d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -615,13 +615,13 @@ namespace OpenSim.Region.Framework.Scenes
615 set { m_isChildAgent = value; } 615 set { m_isChildAgent = value; }
616 } 616 }
617 617
618 private uint m_parentID;
619
620 public uint ParentID 618 public uint ParentID
621 { 619 {
622 get { return m_parentID; } 620 get { return m_parentID; }
623 set { m_parentID = value; } 621 set { m_parentID = value; }
624 } 622 }
623 private uint m_parentID;
624
625 public float Health 625 public float Health
626 { 626 {
627 get { return m_health; } 627 get { return m_health; }
@@ -1962,6 +1962,8 @@ namespace OpenSim.Region.Framework.Scenes
1962 ) 1962 )
1963 )); 1963 ));
1964 1964
1965// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied);
1966
1965 if (SitTargetisSet && SitTargetUnOccupied) 1967 if (SitTargetisSet && SitTargetUnOccupied)
1966 { 1968 {
1967 part.SitTargetAvatar = UUID; 1969 part.SitTargetAvatar = UUID;
@@ -2256,7 +2258,6 @@ namespace OpenSim.Region.Framework.Scenes
2256 } 2258 }
2257 */ 2259 */
2258 2260
2259
2260 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) 2261 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID)
2261 { 2262 {
2262 if (!String.IsNullOrEmpty(m_nextSitAnimation)) 2263 if (!String.IsNullOrEmpty(m_nextSitAnimation))
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index bcd9e94..be73639 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -199,6 +199,24 @@ namespace OpenSim.Region.OptionalModules.World.NPC
199 return false; 199 return false;
200 } 200 }
201 201
202 public bool Sit(UUID agentID, UUID partID, Scene scene)
203 {
204 lock (m_avatars)
205 {
206 if (m_avatars.ContainsKey(agentID))
207 {
208 ScenePresence sp;
209 scene.TryGetScenePresence(agentID, out sp);
210 sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero);
211 sp.HandleAgentSit(m_avatars[agentID], agentID);
212
213 return true;
214 }
215 }
216
217 return false;
218 }
219
202 public bool DeleteNPC(UUID agentID, Scene scene) 220 public bool DeleteNPC(UUID agentID, Scene scene)
203 { 221 {
204 lock (m_avatars) 222 lock (m_avatars)
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 49c06bc..c5be0b6 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -229,5 +229,29 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
229 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); 229 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move");
230 Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); 230 Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos));
231 } 231 }
232
233 [Test]
234 public void TestSit()
235 {
236 TestHelpers.InMethod();
237// log4net.Config.XmlConfigurator.Configure();
238
239 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
240
241 Vector3 startPos = new Vector3(128, 128, 30);
242 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
243 UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, scene, sp.Appearance);
244
245 ScenePresence npc = scene.GetScenePresence(npcId);
246 SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
247
248 // We must have a non Vector3.Zero sit target position otherwise part.SitTargetAvatar doesn't get set!
249 part.SitTargetPosition = new Vector3(0, 0, 1);
250 npcModule.Sit(npc.UUID, part.UUID, scene);
251
252 // Assertions?
253 Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
254 Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
255 }
232 } 256 }
233} \ No newline at end of file 257} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index fc45b82..ffcb004 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -687,6 +687,7 @@ namespace OpenSim.Region.Physics.OdePlugin
687 /// <param name="g2">another geometry or space</param> 687 /// <param name="g2">another geometry or space</param>
688 private void near(IntPtr space, IntPtr g1, IntPtr g2) 688 private void near(IntPtr space, IntPtr g1, IntPtr g2)
689 { 689 {
690// m_log.DebugFormat("[PHYSICS]: Colliding {0} and {1} in {2}", g1, g2, space);
690 // no lock here! It's invoked from within Simulate(), which is thread-locked 691 // no lock here! It's invoked from within Simulate(), which is thread-locked
691 692
692 // Test if we're colliding a geom with a space. 693 // Test if we're colliding a geom with a space.
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 268a599..7cf6642 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2351,6 +2351,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2351 } 2351 }
2352 } 2352 }
2353 2353
2354 public void osNpcSit(LSL_Key npc, LSL_Key target, int options)
2355 {
2356 CheckThreatLevel(ThreatLevel.High, "osNpcSit");
2357
2358 INPCModule module = World.RequestModuleInterface<INPCModule>();
2359 if (module != null)
2360 {
2361 module.Sit(new UUID(npc.m_string), new UUID(target.m_string), World);
2362 }
2363 }
2364
2354 public void osNpcRemove(LSL_Key npc) 2365 public void osNpcRemove(LSL_Key npc)
2355 { 2366 {
2356 CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); 2367 CheckThreatLevel(ThreatLevel.High, "osNpcRemove");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 87cfe1a..bb0a870 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -178,6 +178,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
178 void osNpcSetRot(LSL_Key npc, rotation rot); 178 void osNpcSetRot(LSL_Key npc, rotation rot);
179 void osNpcStopMoveToTarget(LSL_Key npc); 179 void osNpcStopMoveToTarget(LSL_Key npc);
180 void osNpcSay(key npc, string message); 180 void osNpcSay(key npc, string message);
181 void osNpcSit(key npc, key target, int options);
181 void osNpcRemove(key npc); 182 void osNpcRemove(key npc);
182 183
183 LSL_Key osOwnerSaveAppearance(string notecard); 184 LSL_Key osOwnerSaveAppearance(string notecard);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 36c5f90..d36b550 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -600,6 +600,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
600 public const int OS_NPC_NO_FLY = 1; 600 public const int OS_NPC_NO_FLY = 1;
601 public const int OS_NPC_LAND_AT_TARGET = 2; 601 public const int OS_NPC_LAND_AT_TARGET = 2;
602 602
603 public const int OS_NPC_SIT_IMMEDIATE = 0;
604
603 public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; 605 public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED";
604 public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; 606 public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED";
605 607
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index bbc8cc6..38391df 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -528,6 +528,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
528 m_OSSL_Functions.osNpcSay(npc, message); 528 m_OSSL_Functions.osNpcSay(npc, message);
529 } 529 }
530 530
531 public void osNpcSit(LSL_Key npc, LSL_Key target, int options)
532 {
533 m_OSSL_Functions.osNpcSit(npc, target, options);
534 }
535
531 public void osNpcRemove(key npc) 536 public void osNpcRemove(key npc)
532 { 537 {
533 m_OSSL_Functions.osNpcRemove(npc); 538 m_OSSL_Functions.osNpcRemove(npc);