Commit Graph

48 Commits (28e68329b688b34279c5ff403a6f2b23994b452e)

Author SHA1 Message Date
Justin Clark-Casey (justincc) c42e2c6906 minor: Call down to base OpenSimTestCase.SetUp() in NPCModuleTests to disable any enabled logging from previous tests 2013-01-26 00:33:19 +00:00
Justin Clark-Casey (justincc) 22d4c52ffc Consistenly make NUnit test cases inherit from OpenSimTestCase which automatically turns off any logging enabled between tests 2012-11-24 03:15:24 +00:00
Justin Clark-Casey (justincc) 09f4e72d6a Fix memory leak where removing an NPC did not remove its circuits.
This was because we were removing by circuitcode where NPCs have no code.
Now removing by agent ID instead.
This commit also fixes the "show circuits" console command to work properly where the circuit has no associated IP address.
2012-10-29 23:22:40 +00:00
Justin Clark-Casey (justincc) 951b45b80f Add OSSL function osForceAttachToAvatarFromInventory()
This works like osForceAttachToAvatar() but allows an object to be directly specified from the script object's inventory rather than forcing it to be rezzed in the scene first.
Still only attaches objects to the owner of the script.
This allows one to bypass the complicated co-ordination of first rezzing objects in the scene before attaching them.
Threat level high.
2012-07-05 00:05:06 +01:00
dahlia 4186fa10f0 remove default values from prior commit since mono cant deal with them 2012-05-07 00:08:56 -07:00
Justin Clark-Casey (justincc) 07e62df558 Add regression test for teleporting an agent between separated regions on the same simulator.
This involves a large amount of change in test scene setup code to allow test scenes to share shared modules
SetupScene is now an instance method that requires an instantiation of SceneHelpers, though other SceneHelpers methods are still static
May split these out into separate classes in the future.
2012-04-27 00:58:54 +01:00
Justin Clark-Casey (justincc) 30b2a8c778 Move frame loop entirely within Scene.Update() for better future performance analysis and stat accuracy.
Update() now accepts a frames parameter which can control the number of frames updated.
-1 will update until shutdown.
The watchdog updating moves above the maintc recalculation for any required sleep since it should be accounted for within the frame.
2012-03-20 23:12:21 +00:00
Justin Clark-Casey (justincc) 1dc03e5c4f Simplify NPCModuleTests code by putting the NPCModule in an instance variable rather than making each test fetch it seperately.
Also rename instance variables in the test to conform to naming standards and for understandability
2012-03-06 01:47:43 +00:00
Justin Clark-Casey (justincc) d44b7c486a Go back to setting appearance directly in NPCModule.SetAppearance() to fix mantis 5914
The part reverted is from commit 2ebb421.
Unfortunately, IAvatarFactoryModule.SetAppearance() does not transfer attachments.
I'm not sure how to do this separately, unfortunately I'll need to leave it to Dan :)
Regression test added for this case.
Mantis ref: http://opensimulator.org/mantis/view.php?id=5914
2012-03-06 01:27:30 +00:00
Justin Clark-Casey (justincc) 7837c611fb Add OS_NPC_SENSE_AS_AGENT option to osNpcCreate().
This allows NPCs to be sensed as agents by LSL sensors rather than as a specific NPC type (which is currently an OpenSimulator-only extension).
Wiki doc on this and other recent NPC functions will follow soon
2012-01-28 00:00:12 +00:00
Justin Clark-Casey (justincc) 1ac5aa6808 Add remove test for unowned avatars 2012-01-12 20:47:19 +00:00
Melanie 7518b075b7 Add osNpcCreateOwned to create an owned NPC. Those can be sensed only by the owner, can be destroyed only by the owner and only the owner can save their appearance. Added "NPC" as a flag to llSensor to sense NPCs and exclude them from "AGENT" results. 2012-01-06 22:35:06 +00:00
Dan Lake c34ab0ee66 Cleaned up ScenePresence parameters for Flying, WasFlying, FlyingOld and IsColliding 2011-12-12 02:43:38 -08:00
Justin Clark-Casey (justincc) 39b967e214 Correct test failure in sit position check of TestSitAndStandWithNoTarget()
Curiously, a Vector3.ToString() will not display the last two places of the float.  In this case, the failure of
the assertion would confusingly report Expected: <0, 0, 0.8454993> But was:  <0, 0, 0.8454993> when actual Z figure is 0.845499337
Should fully address http://opensimulator.org/mantis/view.php?id=5779
2011-11-07 22:53:52 +00:00
Melanie 6d92d65140 That such a trivial change can be so difficult to get right. Fix it this time. 2011-11-07 02:40:35 +00:00
Melanie e775b3fc47 Fix build break 2011-11-07 02:03:17 +00:00
Melanie 67780b00f0 Fix up failing test to compensate for changed sit target offset 2011-11-06 21:47:12 +00:00
Justin Clark-Casey (justincc) 28c4dc9be4 Fix NPC sitting for prims without a sit target.
This is to partially address http://opensimulator.org/mantis/view.php?id=5769
We don't need to call SP.HandleAgentSit() again if we are within 10m since the autopilot won't trigger.
By calling it twice, the position of the sitting NPC was wrongly adjusted, ending up near <0,0,0>.
However, this change does mean that NPCs further than 10m away will not attempt to autopilot to the prim, though this code was broken anyway (is actually a different mechanism to normal NPC movmeent).
Hopefully this can be addressed soon.
2011-11-05 01:38:42 +00:00
Justin Clark-Casey (justincc) 9b3bbedeea refactor: rename some AssetHelpers.CreateAsset() methods to CreateNotecardAsset() 2011-10-22 00:13:46 +01:00
Dan Lake da794f34a5 Renamed and rearranged AvatarFactoryModule to eliminate redundant lookups of scene presence by client ID. 2011-10-19 14:41:44 -07:00
Justin Clark-Casey (justincc) de161585c0 Implement osNpcStand(<npc-id>)
Allows you to stand an NPC that has sat.
2011-10-17 01:56:25 +01:00
Justin Clark-Casey (justincc) 0c041ce12f Implement osNpcSit(). This is still in development so don't trust it
Format is osNpcSit(<npc-uuid>, <target-uuid>, OS_NPC_SIT_IMMEDIATE)
e.g. osNpcSit(npc, llGetKey(), OS_NPC_SIT_IMMEDIATE);
At the moment, sit only succeeds if the part has a sit target set.
NPC immediately sits on the target even if miles away - they do not walk up to it.
This method is in development - it may change so please don't trust it yet.
Standing will follow shortly since that's kind of important once you're sitting :)
2011-10-17 01:42:31 +01:00
Dan Lake 460946ad62 Removed redundant code in AttachmentsModule and simplified interfaces which converted back and forth between ScenePresence and IClientAPI. More to be done still. 2011-10-03 16:44:32 -07:00
Justin Clark-Casey (justincc) 8159fd7110 When calling osNpcMoveTo(), rotate the avatar in the direction of travel.
This stops the npc walking backwards if the target is directly behind.
This means that the npc no longer returns to its original rotation once movement has finished.
If you want this behaviour, please store and reset the original rotation after movement.
This is somewhat to address http://opensimulator.org/mantis/view.php?id=5678
2011-09-21 19:28:41 +01:00
Justin Clark-Casey (justincc) f5eace6781 Fix test failure. Oversight in setting up the tests themselves. 2011-09-08 21:54:40 +01:00
Justin Clark-Casey (justincc) 9615292133 Centralize module setup for NPC tests.
This is overkill for some tests since they dont' need all the modules, but I think the gain in code readability is worth it
2011-09-08 21:06:10 +01:00
Justin Clark-Casey (justincc) 96a3b68086 Remember to set and unset the fire and forget method at the top of the attachment and npc tests 2011-09-08 20:59:52 +01:00
Justin Clark-Casey (justincc) bd5d2cb043 Use scene presence agent id for rezzed object ownership rather than item owner.
These should be identical.  However, the item isn't available when rezzing npc attachments.
2011-09-08 20:51:52 +01:00
Justin Clark-Casey (justincc) c9e6b7bd10 Stop NPC's getting hypergrid like names in some circumstances.
This meant punching in another AddUser() method in IUserManagement to do a direct name to UUID associated without the account check (since NPCs don't have accounts).
May address http://opensimulator.org/mantis/view.php?id=5645
2011-08-19 00:45:22 +01:00
Justin Clark-Casey (justincc) 50945dd560 add regression test for osNpcCreate when cloning an in-region avatar 2011-08-11 21:43:26 +01:00
Justin Clark-Casey (justincc) 4402851b08 Get NPCs to revert to the correct 'resting' animation (e.g. stand or hover) after finishing their movement. This also fixes judder after an avatar has finished "go here"/autopilot movement in a viewer.
This meant reseting the SP.AgentControlFlags since the Animator uses these to determine the correct default animation.
2011-08-11 01:56:42 +01:00
Justin Clark-Casey (justincc) 7f499ff3f3 Add a OS_NPC_LAND_AT_TARGET option to osMoveToTarget()
Default for this function is now not to automatically land.
This allows better control by scripts when an avatar is going to be landing on a prim rather than the ground.
Stopping the avatar involves faking a collision, to avoid the pid controller making it overshoot.
A better approach would be to gradually slow the avatar as we near the target
2011-08-10 23:56:19 +01:00
Justin Clark-Casey (justincc) 5d6c9644fa 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.
2011-08-10 01:47:37 +01:00
Justin Clark-Casey (justincc) e869eeb0bf Implement first draft functions for saving and loading NPC appearance from storage.
This works by serializing and deserializing NPC AvatarAppearance to a notecard in the prim inventory and making the required baked textures permanent.
By using notecards, we avoid lots of awkward, technical and user-unfriendly issues concerning retaining asset references and creating a new asset type.
Notecards also allow different appearances to be swapped and manipulated easily.
This also allows stored NPC appearances to work transparently with OARs/IARs since the UUID scan will pick up and store the necessary references from the notecard text.
This works in my basic test but is not at all ready for user use or bug reporting yet.
2011-08-09 03:51:34 +01:00
Justin Clark-Casey (justincc) 85e07c78fb refactor: Change SceneHelpers.AddClient() to AddScenePresence().
This seems to make more sense as we can get SP.ControllingClient
2011-08-06 02:17:41 +01:00
Justin Clark-Casey (justincc) dad1d6df18 rename TestHelper => TestHelpers for consistency 2011-08-06 00:31:03 +01:00
Justin Clark-Casey (justincc) bda1a4be45 rename test SceneSetupHelpers -> SceneHelpers for consistency 2011-08-06 00:26:37 +01:00
Justin Clark-Casey (justincc) 7f6f100c5a When the NPC reaches within the SIGNIFICANT_CLIENT_MOVEMENT distance of the target, move it directly to the target.
This makes the movement exact.  Regression test changed to check avatar reaches exact target.
Also has the nice side effect of making NPC animations continue to work after the first movement (which wasn't working).  However, avatar still pauses in mid-stride
2011-08-04 01:00:33 +01:00
Justin Clark-Casey (justincc) ba0c65e028 extend npc move test to check a second movement 2011-08-04 00:25:51 +01:00
Justin Clark-Casey (justincc) 31fb6b2d72 remove move to duck walk compensation - no longer required.
extends npc move to regression test to check stop after sufficient sim updates
2011-08-03 23:40:05 +01:00
Justin Clark-Casey (justincc) 61d49d4f63 rename NPC.Autopilot to NPC.MoveToTarget internally. Add method doc to INPCModule 2011-08-03 23:20:36 +01:00
Justin Clark-Casey (justincc) 31cea17f8e extend move test to check avatar is moving in the right direction after setting a move target 2011-08-03 23:13:52 +01:00
Justin Clark-Casey (justincc) 21d8a6b0e8 extend move test to check one beat of the simulator without actually asking the npc to move. 2011-08-03 23:06:18 +01:00
Justin Clark-Casey (justincc) d78fe44191 Add passing but incomplete NPC move regression test 2011-08-03 22:51:46 +01:00
Justin Clark-Casey (justincc) e0503d397c stop avatar service being set up in NPC TestCreate() - it's no longer used 2011-08-03 22:45:43 +01:00
Justin Clark-Casey (justincc) b7a3f36c65 enable the NPC module for its regression test 2011-08-03 04:48:47 +01:00
Justin Clark-Casey (justincc) 59f548cda8 Get osNpcCreate appearance working with avatars that are currently in the scene.
Had to stop using AvatarService for now since it doesn't store baked texture IDs (which is why this was failing).
Also failing because cloning appearance was also cloning the AvatarApperance.Owner field, which we weren't then changing.
Extended TestCreate() to check this.
2011-08-01 23:41:29 +01:00
Justin Clark-Casey (justincc) 513d63455e Create a very basic initial test which just creates an 'npc' and tests that the scene presence exists 2011-07-02 01:01:40 +01:00