diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 21 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 47 |
2 files changed, 43 insertions, 25 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 5ea5af7..c3335f0 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
47 | private readonly string m_firstname; | 47 | private readonly string m_firstname; |
48 | private readonly string m_lastname; | 48 | private readonly string m_lastname; |
49 | private readonly Vector3 m_startPos; | 49 | private readonly Vector3 m_startPos; |
50 | private readonly UUID m_uuid = UUID.Random(); | 50 | private UUID m_uuid = UUID.Random(); |
51 | private readonly Scene m_scene; | 51 | private readonly Scene m_scene; |
52 | private readonly UUID m_ownerID; | 52 | private readonly UUID m_ownerID; |
53 | 53 | ||
@@ -169,7 +169,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
169 | #pragma warning disable 67 | 169 | #pragma warning disable 67 |
170 | public event Action<IClientAPI> OnLogout; | 170 | public event Action<IClientAPI> OnLogout; |
171 | public event ObjectPermissions OnObjectPermissions; | 171 | public event ObjectPermissions OnObjectPermissions; |
172 | 172 | public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | |
173 | public event MoneyTransferRequest OnMoneyTransferRequest; | 173 | public event MoneyTransferRequest OnMoneyTransferRequest; |
174 | public event ParcelBuy OnParcelBuy; | 174 | public event ParcelBuy OnParcelBuy; |
175 | public event Action<IClientAPI> OnConnectionClosed; | 175 | public event Action<IClientAPI> OnConnectionClosed; |
@@ -238,6 +238,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
238 | public event UpdatePrimTexture OnUpdatePrimTexture; | 238 | public event UpdatePrimTexture OnUpdatePrimTexture; |
239 | public event UpdateVector OnUpdatePrimGroupPosition; | 239 | public event UpdateVector OnUpdatePrimGroupPosition; |
240 | public event UpdateVector OnUpdatePrimSinglePosition; | 240 | public event UpdateVector OnUpdatePrimSinglePosition; |
241 | public event ClientChangeObject onClientChangeObject; | ||
241 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; | 242 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; |
242 | public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition; | 243 | public event UpdatePrimSingleRotationPosition OnUpdatePrimSingleRotationPosition; |
243 | public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; | 244 | public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; |
@@ -375,7 +376,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
375 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; | 376 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; |
376 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; | 377 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; |
377 | public event ClassifiedDelete OnClassifiedDelete; | 378 | public event ClassifiedDelete OnClassifiedDelete; |
378 | public event ClassifiedDelete OnClassifiedGodDelete; | 379 | public event ClassifiedGodDelete OnClassifiedGodDelete; |
379 | 380 | ||
380 | public event EventNotificationAddRequest OnEventNotificationAddRequest; | 381 | public event EventNotificationAddRequest OnEventNotificationAddRequest; |
381 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; | 382 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; |
@@ -414,6 +415,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
414 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; | 415 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; |
415 | public event SimWideDeletesDelegate OnSimWideDeletes; | 416 | public event SimWideDeletesDelegate OnSimWideDeletes; |
416 | public event SendPostcard OnSendPostcard; | 417 | public event SendPostcard OnSendPostcard; |
418 | public event ChangeInventoryItemFlags OnChangeInventoryItemFlags; | ||
417 | public event MuteListEntryUpdate OnUpdateMuteListEntry; | 419 | public event MuteListEntryUpdate OnUpdateMuteListEntry; |
418 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 420 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
419 | public event GodlikeMessage onGodlikeMessage; | 421 | public event GodlikeMessage onGodlikeMessage; |
@@ -441,6 +443,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
441 | public virtual UUID AgentId | 443 | public virtual UUID AgentId |
442 | { | 444 | { |
443 | get { return m_uuid; } | 445 | get { return m_uuid; } |
446 | set { m_uuid = value; } | ||
444 | } | 447 | } |
445 | 448 | ||
446 | public UUID SessionId | 449 | public UUID SessionId |
@@ -849,8 +852,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
849 | 852 | ||
850 | public void Close() | 853 | public void Close() |
851 | { | 854 | { |
852 | // Remove ourselves from the scene | 855 | Close(true); |
853 | m_scene.RemoveClient(AgentId, false); | 856 | } |
857 | |||
858 | public void Close(bool sendStop) | ||
859 | { | ||
854 | } | 860 | } |
855 | 861 | ||
856 | public void Start() | 862 | public void Start() |
@@ -1184,5 +1190,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
1184 | public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data) | 1190 | public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data) |
1185 | { | 1191 | { |
1186 | } | 1192 | } |
1193 | |||
1194 | public void SendPartPhysicsProprieties(ISceneEntity entity) | ||
1195 | { | ||
1196 | } | ||
1197 | |||
1187 | } | 1198 | } |
1188 | } | 1199 | } |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 435a683..4f80dea 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -144,29 +144,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
144 | // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); | 144 | // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); |
145 | // } | 145 | // } |
146 | 146 | ||
147 | lock (m_avatars) | 147 | ManualResetEvent ev = new ManualResetEvent(false); |
148 | { | ||
149 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); | ||
150 | scene.AddNewClient(npcAvatar, PresenceType.Npc); | ||
151 | 148 | ||
152 | ScenePresence sp; | 149 | Util.FireAndForget(delegate(object x) { |
153 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) | 150 | lock (m_avatars) |
154 | { | 151 | { |
155 | // m_log.DebugFormat( | 152 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); |
156 | // "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); | 153 | scene.AddNewClient(npcAvatar, PresenceType.Npc); |
157 | 154 | ||
158 | sp.CompleteMovement(npcAvatar, false); | 155 | ScenePresence sp; |
159 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | 156 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) |
160 | m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); | 157 | { |
161 | 158 | sp.CompleteMovement(npcAvatar, false); | |
162 | return npcAvatar.AgentId; | 159 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); |
163 | } | 160 | m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); |
164 | else | 161 | } |
165 | { | ||
166 | m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); | ||
167 | return UUID.Zero; | ||
168 | } | 162 | } |
169 | } | 163 | ev.Set(); |
164 | }); | ||
165 | |||
166 | ev.WaitOne(); | ||
167 | |||
168 | // m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); | ||
169 | |||
170 | return npcAvatar.AgentId; | ||
170 | } | 171 | } |
171 | 172 | ||
172 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget) | 173 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget) |
@@ -314,9 +315,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
314 | { | 315 | { |
315 | NPCAvatar av; | 316 | NPCAvatar av; |
316 | if (m_avatars.TryGetValue(npcID, out av)) | 317 | if (m_avatars.TryGetValue(npcID, out av)) |
318 | { | ||
319 | if (npcID == callerID) | ||
320 | return true; | ||
317 | return CheckPermissions(av, callerID); | 321 | return CheckPermissions(av, callerID); |
322 | } | ||
318 | else | 323 | else |
324 | { | ||
319 | return false; | 325 | return false; |
326 | } | ||
320 | } | 327 | } |
321 | } | 328 | } |
322 | 329 | ||
@@ -328,7 +335,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
328 | /// <returns>true if they do, false if they don't.</returns> | 335 | /// <returns>true if they do, false if they don't.</returns> |
329 | private bool CheckPermissions(NPCAvatar av, UUID callerID) | 336 | private bool CheckPermissions(NPCAvatar av, UUID callerID) |
330 | { | 337 | { |
331 | return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID; | 338 | return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID || av.AgentId == callerID; |
332 | } | 339 | } |
333 | } | 340 | } |
334 | } | 341 | } |