diff options
author | Justin Clark-Casey (justincc) | 2012-07-20 21:36:33 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-20 21:36:33 +0100 |
commit | ecf7bb268caaca809905accb4989b0baa467d3ce (patch) | |
tree | 6de81dd6addb425510c590936718ad4386e05d61 | |
parent | As per opensim-dev mailing list conversation, introduce OS_NPC constant for u... (diff) | |
download | opensim-SC_OLD-ecf7bb268caaca809905accb4989b0baa467d3ce.zip opensim-SC_OLD-ecf7bb268caaca809905accb4989b0baa467d3ce.tar.gz opensim-SC_OLD-ecf7bb268caaca809905accb4989b0baa467d3ce.tar.bz2 opensim-SC_OLD-ecf7bb268caaca809905accb4989b0baa467d3ce.tar.xz |
As per opensim-dev mailing list discussion, extend llGetDetectedType() to return OS_NPC if an OS npc is detected.
The detection will also return agent is the NPC has been created with the OS_NPC_SENSE_AS_AGENT option.
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Helpers.cs | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs index 8cebb4a..0108f44 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs | |||
@@ -35,6 +35,7 @@ using OpenMetaverse; | |||
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Region.CoreModules; | 36 | using OpenSim.Region.CoreModules; |
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Region.Framework.Interfaces; | ||
38 | 39 | ||
39 | namespace OpenSim.Region.ScriptEngine.Shared | 40 | namespace OpenSim.Region.ScriptEngine.Shared |
40 | { | 41 | { |
@@ -82,6 +83,12 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
82 | 83 | ||
83 | public class DetectParams | 84 | public class DetectParams |
84 | { | 85 | { |
86 | public const int AGENT = 1; | ||
87 | public const int ACTIVE = 2; | ||
88 | public const int PASSIVE = 4; | ||
89 | public const int SCRIPTED = 8; | ||
90 | public const int OS_NPC = 0x01000000; | ||
91 | |||
85 | public DetectParams() | 92 | public DetectParams() |
86 | { | 93 | { |
87 | Key = UUID.Zero; | 94 | Key = UUID.Zero; |
@@ -188,9 +195,25 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
188 | presence.Velocity.Y, | 195 | presence.Velocity.Y, |
189 | presence.Velocity.Z); | 196 | presence.Velocity.Z); |
190 | 197 | ||
191 | Type = 0x01; // Avatar | 198 | if (presence.PresenceType != PresenceType.Npc) |
199 | { | ||
200 | Type = AGENT; | ||
201 | } | ||
202 | else | ||
203 | { | ||
204 | Type = OS_NPC; | ||
205 | |||
206 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | ||
207 | INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); | ||
208 | |||
209 | if (npcData.SenseAsAgent) | ||
210 | { | ||
211 | Type |= AGENT; | ||
212 | } | ||
213 | } | ||
214 | |||
192 | if (presence.Velocity != Vector3.Zero) | 215 | if (presence.Velocity != Vector3.Zero) |
193 | Type |= 0x02; // Active | 216 | Type |= ACTIVE; |
194 | 217 | ||
195 | Group = presence.ControllingClient.ActiveGroupId; | 218 | Group = presence.ControllingClient.ActiveGroupId; |
196 | 219 | ||
@@ -205,15 +228,15 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
205 | Name = part.Name; | 228 | Name = part.Name; |
206 | Owner = part.OwnerID; | 229 | Owner = part.OwnerID; |
207 | if (part.Velocity == Vector3.Zero) | 230 | if (part.Velocity == Vector3.Zero) |
208 | Type = 0x04; // Passive | 231 | Type = PASSIVE; |
209 | else | 232 | else |
210 | Type = 0x02; // Passive | 233 | Type = ACTIVE; |
211 | 234 | ||
212 | foreach (SceneObjectPart p in part.ParentGroup.Parts) | 235 | foreach (SceneObjectPart p in part.ParentGroup.Parts) |
213 | { | 236 | { |
214 | if (p.Inventory.ContainsScripts()) | 237 | if (p.Inventory.ContainsScripts()) |
215 | { | 238 | { |
216 | Type |= 0x08; // Scripted | 239 | Type |= SCRIPTED; // Scripted |
217 | break; | 240 | break; |
218 | } | 241 | } |
219 | } | 242 | } |