diff options
author | UbitUmarov | 2015-09-01 14:54:35 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-01 14:54:35 +0100 |
commit | 371c9dd2af01a2e7422ec901ee1f80757284a78c (patch) | |
tree | 058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |
parent | remove lixo (diff) | |
parent | dont change camera on crossings (diff) | |
download | opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2 opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz |
bad merge?
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 9232db9..2977195 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -167,10 +167,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
167 | npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, | 167 | npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, |
168 | int.MaxValue); | 168 | int.MaxValue); |
169 | 169 | ||
170 | m_log.DebugFormat( | 170 | // m_log.DebugFormat( |
171 | "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}", | 171 | // "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}", |
172 | firstname, lastname, npcAvatar.AgentId, owner, | 172 | // firstname, lastname, npcAvatar.AgentId, owner, senseAsAgent, position, scene.RegionInfo.RegionName); |
173 | senseAsAgent, position, scene.RegionInfo.RegionName); | ||
174 | 173 | ||
175 | AgentCircuitData acd = new AgentCircuitData(); | 174 | AgentCircuitData acd = new AgentCircuitData(); |
176 | acd.AgentID = npcAvatar.AgentId; | 175 | acd.AgentID = npcAvatar.AgentId; |
@@ -192,36 +191,31 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
192 | } | 191 | } |
193 | */ | 192 | */ |
194 | 193 | ||
195 | lock (m_avatars) | 194 | // ManualResetEvent ev = new ManualResetEvent(false); |
196 | { | ||
197 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, | ||
198 | acd); | ||
199 | scene.AddNewAgent(npcAvatar, PresenceType.Npc); | ||
200 | 195 | ||
201 | ScenePresence sp; | 196 | // Util.FireAndForget(delegate(object x) { |
202 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) | 197 | lock (m_avatars) |
203 | { | 198 | { |
204 | /* | 199 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); |
205 | m_log.DebugFormat( | 200 | scene.AddNewAgent(npcAvatar, PresenceType.Npc); |
206 | "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", | ||
207 | sp.Name, sp.UUID); | ||
208 | */ | ||
209 | 201 | ||
210 | sp.CompleteMovement(npcAvatar, false); | 202 | ScenePresence sp; |
211 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | 203 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) |
212 | m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); | 204 | { |
213 | 205 | ||
214 | return npcAvatar.AgentId; | 206 | sp.CompleteMovement(npcAvatar, false); |
207 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | ||
208 | // m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); | ||
209 | } | ||
215 | } | 210 | } |
216 | else | 211 | // ev.Set(); |
217 | { | 212 | // }); |
218 | m_log.WarnFormat( | ||
219 | "[NPC MODULE]: Could not find scene presence for NPC {0} {1}", | ||
220 | sp.Name, sp.UUID); | ||
221 | 213 | ||
222 | return UUID.Zero; | 214 | // ev.WaitOne(); |
223 | } | 215 | |
224 | } | 216 | // m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); |
217 | |||
218 | return npcAvatar.AgentId; | ||
225 | } | 219 | } |
226 | 220 | ||
227 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, | 221 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, |
@@ -436,9 +430,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
436 | { | 430 | { |
437 | NPCAvatar av; | 431 | NPCAvatar av; |
438 | if (m_avatars.TryGetValue(npcID, out av)) | 432 | if (m_avatars.TryGetValue(npcID, out av)) |
433 | { | ||
434 | if (npcID == callerID) | ||
435 | return true; | ||
439 | return CheckPermissions(av, callerID); | 436 | return CheckPermissions(av, callerID); |
437 | } | ||
440 | else | 438 | else |
439 | { | ||
441 | return false; | 440 | return false; |
441 | } | ||
442 | } | 442 | } |
443 | } | 443 | } |
444 | 444 | ||
@@ -457,8 +457,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
457 | /// <returns>true if they do, false if they don't.</returns> | 457 | /// <returns>true if they do, false if they don't.</returns> |
458 | private bool CheckPermissions(NPCAvatar av, UUID callerID) | 458 | private bool CheckPermissions(NPCAvatar av, UUID callerID) |
459 | { | 459 | { |
460 | <<<<<<< HEAD | ||
460 | return callerID == UUID.Zero || av.OwnerID == UUID.Zero || | 461 | return callerID == UUID.Zero || av.OwnerID == UUID.Zero || |
461 | av.OwnerID == callerID || av.AgentId == callerID; | 462 | av.OwnerID == callerID || av.AgentId == callerID; |
463 | ======= | ||
464 | return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID || av.AgentId == callerID; | ||
465 | >>>>>>> avn/ubitvar | ||
462 | } | 466 | } |
463 | } | 467 | } |
464 | } | 468 | } |