Commit Graph

85 Commits (e506341fdb9f3b6996d3c97de007f2b142fcddd3)

Author SHA1 Message Date
Justin Clark-Casey (justincc) 5a6ad028e3 refactor: Rename Scene.AddNewClient() to AddNewAgent() to make it obvious in the code that this is symmetric with CloseAgent() 2013-09-27 22:29:16 +01:00
Justin Clark-Casey (justincc) e6c0267def refactor: rename Scene.IncomingCloseAgent() to CloseAgent() in order to make it clear that all non-clientstack callers should be using this rather than RemoveClient() in order to step through the ScenePresence state machine properly.
Adds IScene.CloseAgent() to replace RemoveClient()
2013-09-27 22:29:10 +01:00
Justin Clark-Casey (justincc) ff08f56937 minor: Stop debug logging whenever an npc is moved, other npc log related formatting cleanups 2013-09-26 20:07:07 +01:00
Justin Clark-Casey (justincc) de6ad380f6 Get rid of issue where removing NPCs would through an exception by routing close through Scene.IncomingCloseAgent() and NPCAvatar.Close() rather than directly to Scene.RemoveClient().
This exception was actually harmless since it occurred at the very last stage of the remove client process.
2013-08-12 19:31:45 +01:00
Dan Lake 9f129938c9 Attachments module only registers when enabled. This enables alternative attachments module implementations. All calls to Scene.AttachmentsModule are checking for null. Ideally, if we support disabling attachments then we need a null attachments module to register with the scene. 2013-07-16 17:43:36 -07:00
Diva Canto 86903f23dd Cleanup on region modules: gave short node id's to all of them. 2012-11-12 18:08:02 -08:00
SignpostMarv f560d581bb document & 80-character width terminal formatting
Signed-off-by: Diva Canto <diva@metaverseink.com>
2012-11-11 13:50:38 -08:00
SignpostMarv 23605cf93d converting NPC module to ISharedRegionModule
Signed-off-by: Diva Canto <diva@metaverseink.com>
2012-11-11 13:50:38 -08:00
Justin Clark-Casey (justincc) c42fe6c159 Prevent race conditions when one thread removes an NPC SP before another thread has retreived it after checking whether the NPC exists. 2012-08-14 21:44:06 +01:00
Talun 1b1f841c6a Mantis 6063 osNpcTouch.
Allow NPCS to touch obects.
2012-07-06 22:37:19 +01:00
dahlia 4186fa10f0 remove default values from prior commit since mono cant deal with them 2012-05-07 00:08:56 -07:00
dahlia b697d0e895 add OS_NPC_RUNNING option to osNpcMoveToTarget() to allow running speed for moving NPCs 2012-05-06 23:54:50 -07:00
BlueWall fba802bb03 Merge branch 'master' of /home/opensim/var/repo/opensim 2012-04-26 16:13:47 -04:00
Talun b8114d2b67 Add a version of osNpcSay that takes a channel number Mantis 5747
osNpcSay(UUID npc, string message) left untouched

New functions:-
osNpcSay(UUID npc, int channel, string message)
osNpcShout(UUID npc, int channel, string message)
osNpcWhisper(UUID npc, int channel, string message)

Signed-off-by: BlueWall <jamesh@bluewallgroup.com>
2012-04-26 16:13:29 -04:00
Oren Hurvitz 2f398231ac Minor improvements to logging
Eliminated an extra newline in the console if the log line doesn't contain a category (example of a category: "[ASSETS]").
2012-04-24 21:38:09 +01: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) c906128191 Fix some logic mistakes where firstly osNpcCreate() without options was creating npcs sensed as agents and secondly the OS_NPC_SENSE_AS_AGENT option was having the opposite effect.
Hopefully makes progress on addressing http://opensimulator.org/mantis/view.php?id=5872
2012-02-16 00:22:39 +00:00
Dan Lake 2ebb421331 Refactor appearance saving for NPC to use AvatarFactoryModule interface. 2012-02-14 17:20:34 -08:00
Justin Clark-Casey (justincc) 9c84a8162f If NPCModule.CreateNPC() fails to create the required ScenePresence (which should in theory never happen), don't add the NPC to the npc list but return UUID.Zero instead. 2012-02-09 01:17:59 +00:00
Justin Clark-Casey (justincc) dbe32a1f6d minor: put in commented out logging statements for future reuse 2012-02-09 00:10:45 +00:00
Justin Clark-Casey (justincc) ce34b359ad Extend m_avatars lock in NpcModule.CreateNPC over both creation of NPC scene presence and population of m_avatars.
This is required to stop a race where the SensorRepeat module can detect an NPC avatar before m_avatars is populated.
Extending the lock is the easiest to understand solution rather than getting complicated with null checks.
Hopefully resolves http://opensimulator.org/mantis/view.php?id=5872
2012-02-03 23:04:26 +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) ba3491c76e Add permissions checks for owned avatars to all other osNpc* functions.
This is being done outside the npc module since the check is meaningless for region module callers, who can fake any id that they like.
2012-01-12 19:06:46 +00:00
Justin Clark-Casey (justincc) b47c0d7e51 refactor: Move existing npc owner checks to NPCModule.CheckPermissions() methods and expose on interface for external calls. 2012-01-12 18:14: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
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
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
Justin Clark-Casey (justincc) d358125cac Reinstate option to land an npc when it reaches a target.
This is moved into ScenePresence for now as a general facility
2011-09-22 00:16:05 +01:00
Justin Clark-Casey (justincc) 241e07d006 Move code which handles NPC movement into Scene so that this can also be used by Autopilot coming from the client side.
I thought that I had implemented this but must have accidentally removed it.
Adds a regression test to detect if this happens again.
Temporarily disables automatic landing of NPC at a target.  Will be fixed presently.
2011-09-21 23:56:11 +01:00
Justin Clark-Casey (justincc) 7d58b5fa15 move common code into AttachmentsModule.DeleteAttachmentsFromScene() 2011-08-31 17:53:58 +01:00
Justin Clark-Casey (justincc) 32444d98cb Make SP.Attachments available as sp.GetAttachments() instead.
The approach here, as in other parts of OpenSim, is to return a copy of the list rather than the attachments list itself
This prevents callers from forgetting to lock the list when they read it, as was happening in various parts of the codebase.
It also improves liveness.
This might improve attachment anomolies when performing region crossings.
2011-08-31 16:29:51 +01:00
Justin Clark-Casey (justincc) 04bafd2122 refactor: Move ScenePresence.RezAttachments() into AttachmentsModule
This adds an incomplete IScenePresence to match ISceneEntity
2011-08-30 23:06:10 +01:00
Justin Clark-Casey (justincc) c1a34cd8da Don't try to save changed attachment states when an NPC with attachments is removed from the scene.
This is done by introducing a PresenceType enum into ScenePresence which currently has two values, User and Npc.
This seems better than a SaveAttachments flag in terms of code comprehension, though I'm still slightly uneasy about introducing these semantics to core objects
2011-08-18 00:53:05 +01:00
Justin Clark-Casey (justincc) acfdca34fd Fix issue where loading a new appearance onto an NPC would not remove the previous attachments from the scene.
Addresses http://opensimulator.org/mantis/view.php?id=5636
2011-08-17 01:35:33 +01:00
Justin Clark-Casey (justincc) 4b88f04c0a minor: On "login disable/enable" always tell the user the final login status, rather than remaining silent if it was already on/off 2011-08-12 22:46:42 +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) 1aa1711893 eliminate the rotation parameter from SP.HandleMoveToTargetUpdate(). This can just use the currently set Rotation
looks like I spoke to soon about eliminating jerkiness on "go here"/autopilot.  It's still there.
2011-08-11 03:06:38 +01:00
Justin Clark-Casey (justincc) 36f7d36fa1 instead of setting avatar rotation twice in SP.HandleAgentUpdate(), eliminate the second setting in AddNewMovement() 2011-08-11 02:54:15 +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) 4cb8d6379d Stop trying to deregister caps or close child agents when an NPC is removed 2011-08-10 00:59:31 +01:00
Justin Clark-Casey (justincc) 195c1dc9b8 implement osNpcStopMoveTo() to cancel any current move target 2011-08-10 00:26:38 +01:00
Justin Clark-Casey (justincc) cba54090c7 When an NPC appearance is loaded, rez the attachments too 2011-08-09 23:25:52 +01:00
Justin Clark-Casey (justincc) 92e96d394a When an NPC is created, stop telling neighbouring regions to expect a child agent 2011-08-09 23:11:07 +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) 1918402cb1 if an NPC target is set to a ground location, then automatically land them when they get there.
This doesn't help where the target is a prim surface.  In these situations, it might be better to provide manual overrides so the script can control whethre an avatar flys there/lands, etc.
2011-08-04 03:08:35 +01:00
Justin Clark-Casey (justincc) 54ce029342 if an NPC move to target is above the terrain then make it fly to destination 2011-08-04 02:31:40 +01:00