diff options
author | Melanie | 2010-02-08 15:53:20 +0000 |
---|---|---|
committer | Melanie | 2010-02-08 15:53:38 +0000 |
commit | baaf660511214e52ea4ed20b8e80ec8e1ff06a3a (patch) | |
tree | 1e90c7a22ea3354d6bfd5d2b3f8f64f199dbd477 /OpenSim/Region/Framework | |
parent | Added missing configs to Standalone.ini (diff) | |
parent | Adding the Careminster "Configger" tool to OpenSim. The tool will, when launched (diff) | |
download | opensim-SC_OLD-baaf660511214e52ea4ed20b8e80ec8e1ff06a3a.zip opensim-SC_OLD-baaf660511214e52ea4ed20b8e80ec8e1ff06a3a.tar.gz opensim-SC_OLD-baaf660511214e52ea4ed20b8e80ec8e1ff06a3a.tar.bz2 opensim-SC_OLD-baaf660511214e52ea4ed20b8e80ec8e1ff06a3a.tar.xz |
Merge branch 'master' into presence-refactor
This was a large, heavily conflicted merge and things MAY have got broken.
Please check!
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | 25 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IWorldComm.cs | 39 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 1511 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 56 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 234 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 265 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 61 |
12 files changed, 1780 insertions, 493 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 67395fa..fa9bf19 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -71,13 +71,18 @@ namespace OpenSim.Region.Framework.Interfaces | |||
71 | /// <summary> | 71 | /// <summary> |
72 | /// Start all the scripts contained in this entity's inventory | 72 | /// Start all the scripts contained in this entity's inventory |
73 | /// </summary> | 73 | /// </summary> |
74 | void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); | 74 | void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); |
75 | |||
75 | ArrayList GetScriptErrors(UUID itemID); | 76 | ArrayList GetScriptErrors(UUID itemID); |
76 | 77 | ||
77 | /// <summary> | 78 | /// <summary> |
78 | /// Stop all the scripts in this entity. | 79 | /// Stop all the scripts in this entity. |
79 | /// </summary> | 80 | /// </summary> |
80 | void RemoveScriptInstances(); | 81 | /// <param name="sceneObjectBeingDeleted"> |
82 | /// Should be true if these scripts are being removed because the scene | ||
83 | /// object is being deleted. This will prevent spurious updates to the client. | ||
84 | /// </param> | ||
85 | void RemoveScriptInstances(bool sceneObjectBeingDeleted); | ||
81 | 86 | ||
82 | /// <summary> | 87 | /// <summary> |
83 | /// Start a script which is in this entity's inventory. | 88 | /// Start a script which is in this entity's inventory. |
@@ -103,7 +108,11 @@ namespace OpenSim.Region.Framework.Interfaces | |||
103 | /// Stop a script which is in this prim's inventory. | 108 | /// Stop a script which is in this prim's inventory. |
104 | /// </summary> | 109 | /// </summary> |
105 | /// <param name="itemId"></param> | 110 | /// <param name="itemId"></param> |
106 | void RemoveScriptInstance(UUID itemId); | 111 | /// <param name="sceneObjectBeingDeleted"> |
112 | /// Should be true if these scripts are being removed because the scene | ||
113 | /// object is being deleted. This will prevent spurious updates to the client. | ||
114 | /// </param> | ||
115 | void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted); | ||
107 | 116 | ||
108 | /// <summary> | 117 | /// <summary> |
109 | /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative | 118 | /// Add an item to this entity's inventory. If an item with the same name already exists, then an alternative |
@@ -135,6 +144,16 @@ namespace OpenSim.Region.Framework.Interfaces | |||
135 | TaskInventoryItem GetInventoryItem(UUID itemId); | 144 | TaskInventoryItem GetInventoryItem(UUID itemId); |
136 | 145 | ||
137 | /// <summary> | 146 | /// <summary> |
147 | /// Get inventory items by name. | ||
148 | /// </summary> | ||
149 | /// <param name="name"></param> | ||
150 | /// <returns> | ||
151 | /// A list of inventory items with that name. | ||
152 | /// If no inventory item has that name then an empty list is returned. | ||
153 | /// </returns> | ||
154 | IList<TaskInventoryItem> GetInventoryItems(string name); | ||
155 | |||
156 | /// <summary> | ||
138 | /// Update an existing inventory item. | 157 | /// Update an existing inventory item. |
139 | /// </summary> | 158 | /// </summary> |
140 | /// <param name="item">The updated item. An item with the same id must already exist | 159 | /// <param name="item">The updated item. An item with the same id must already exist |
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs index 74526c4..948b9dc 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs | |||
@@ -49,10 +49,49 @@ namespace OpenSim.Region.Framework.Interfaces | |||
49 | 49 | ||
50 | public interface IWorldComm | 50 | public interface IWorldComm |
51 | { | 51 | { |
52 | /// <summary> | ||
53 | /// Create a listen event callback with the specified filters. | ||
54 | /// The parameters localID,itemID are needed to uniquely identify | ||
55 | /// the script during 'peek' time. Parameter hostID is needed to | ||
56 | /// determine the position of the script. | ||
57 | /// </summary> | ||
58 | /// <param name="localID">localID of the script engine</param> | ||
59 | /// <param name="itemID">UUID of the script engine</param> | ||
60 | /// <param name="hostID">UUID of the SceneObjectPart</param> | ||
61 | /// <param name="channel">channel to listen on</param> | ||
62 | /// <param name="name">name to filter on</param> | ||
63 | /// <param name="id">key to filter on (user given, could be totally faked)</param> | ||
64 | /// <param name="msg">msg to filter on</param> | ||
65 | /// <returns>number of the scripts handle</returns> | ||
52 | int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg); | 66 | int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg); |
67 | |||
68 | /// <summary> | ||
69 | /// This method scans over the objects which registered an interest in listen callbacks. | ||
70 | /// For everyone it finds, it checks if it fits the given filter. If it does, then | ||
71 | /// enqueue the message for delivery to the objects listen event handler. | ||
72 | /// The enqueued ListenerInfo no longer has filter values, but the actually trigged values. | ||
73 | /// Objects that do an llSay have their messages delivered here and for nearby avatars, | ||
74 | /// the OnChatFromClient event is used. | ||
75 | /// </summary> | ||
76 | /// <param name="type">type of delvery (whisper,say,shout or regionwide)</param> | ||
77 | /// <param name="channel">channel to sent on</param> | ||
78 | /// <param name="name">name of sender (object or avatar)</param> | ||
79 | /// <param name="id">key of sender (object or avatar)</param> | ||
80 | /// <param name="msg">msg to sent</param> | ||
53 | void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg); | 81 | void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg); |
82 | |||
83 | /// <summary> | ||
84 | /// Are there any listen events ready to be dispatched? | ||
85 | /// </summary> | ||
86 | /// <returns>boolean indication</returns> | ||
54 | bool HasMessages(); | 87 | bool HasMessages(); |
88 | |||
89 | /// <summary> | ||
90 | /// Pop the first availlable listen event from the queue | ||
91 | /// </summary> | ||
92 | /// <returns>ListenerInfo with filter filled in</returns> | ||
55 | IWorldCommListenerInfo GetNextMessage(); | 93 | IWorldCommListenerInfo GetNextMessage(); |
94 | |||
56 | void ListenControl(UUID itemID, int handle, int active); | 95 | void ListenControl(UUID itemID, int handle, int active); |
57 | void ListenRemove(UUID itemID, int handle); | 96 | void ListenRemove(UUID itemID, int handle); |
58 | void DeleteListener(UUID itemID); | 97 | void DeleteListener(UUID itemID); |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 399379e..473920e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -27,11 +27,13 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | ||
31 | using log4net; | ||
30 | using OpenMetaverse; | 32 | using OpenMetaverse; |
31 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
32 | using OpenSim.Framework.Client; | 34 | using OpenSim.Framework.Client; |
33 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
34 | using Caps=OpenSim.Framework.Capabilities.Caps; | 36 | using Caps = OpenSim.Framework.Capabilities.Caps; |
35 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
36 | 38 | ||
37 | namespace OpenSim.Region.Framework.Scenes | 39 | namespace OpenSim.Region.Framework.Scenes |
@@ -41,6 +43,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
41 | /// </summary> | 43 | /// </summary> |
42 | public class EventManager | 44 | public class EventManager |
43 | { | 45 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
44 | public delegate void OnFrameDelegate(); | 48 | public delegate void OnFrameDelegate(); |
45 | 49 | ||
46 | public event OnFrameDelegate OnFrame; | 50 | public event OnFrameDelegate OnFrame; |
@@ -92,8 +96,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
92 | public delegate void OnShutdownDelegate(); | 96 | public delegate void OnShutdownDelegate(); |
93 | 97 | ||
94 | public event OnShutdownDelegate OnShutdown; | 98 | public event OnShutdownDelegate OnShutdown; |
95 | 99 | ||
96 | public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); | ||
97 | public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); | 100 | public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); |
98 | public delegate void ScriptResetDelegate(uint localID, UUID itemID); | 101 | public delegate void ScriptResetDelegate(uint localID, UUID itemID); |
99 | 102 | ||
@@ -103,62 +106,57 @@ namespace OpenSim.Region.Framework.Scenes | |||
103 | 106 | ||
104 | public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; | 107 | public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; |
105 | 108 | ||
109 | /// <summary> | ||
110 | /// Called when an object is touched/grabbed. | ||
111 | /// </summary> | ||
112 | /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of | ||
113 | /// the root part. | ||
114 | public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); | ||
106 | public event ObjectGrabDelegate OnObjectGrab; | 115 | public event ObjectGrabDelegate OnObjectGrab; |
116 | |||
117 | public event ObjectGrabDelegate OnObjectGrabbing; | ||
107 | public event ObjectDeGrabDelegate OnObjectDeGrab; | 118 | public event ObjectDeGrabDelegate OnObjectDeGrab; |
108 | public event ScriptResetDelegate OnScriptReset; | 119 | public event ScriptResetDelegate OnScriptReset; |
109 | 120 | ||
110 | public event OnPermissionErrorDelegate OnPermissionError; | 121 | public event OnPermissionErrorDelegate OnPermissionError; |
111 | 122 | ||
112 | public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); | 123 | public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); |
113 | |||
114 | public event NewRezScript OnRezScript; | 124 | public event NewRezScript OnRezScript; |
115 | 125 | ||
116 | public delegate void RemoveScript(uint localID, UUID itemID); | 126 | public delegate void RemoveScript(uint localID, UUID itemID); |
117 | |||
118 | public event RemoveScript OnRemoveScript; | 127 | public event RemoveScript OnRemoveScript; |
119 | 128 | ||
120 | public delegate void StartScript(uint localID, UUID itemID); | 129 | public delegate void StartScript(uint localID, UUID itemID); |
121 | |||
122 | public event StartScript OnStartScript; | 130 | public event StartScript OnStartScript; |
123 | 131 | ||
124 | public delegate void StopScript(uint localID, UUID itemID); | 132 | public delegate void StopScript(uint localID, UUID itemID); |
125 | |||
126 | public event StopScript OnStopScript; | 133 | public event StopScript OnStopScript; |
127 | 134 | ||
128 | public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta); | 135 | public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta); |
129 | |||
130 | public event SceneGroupMoved OnSceneGroupMove; | 136 | public event SceneGroupMoved OnSceneGroupMove; |
131 | 137 | ||
132 | public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID); | 138 | public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID); |
133 | |||
134 | public event SceneGroupGrabed OnSceneGroupGrab; | 139 | public event SceneGroupGrabed OnSceneGroupGrab; |
135 | 140 | ||
136 | public delegate bool SceneGroupSpinStarted(UUID groupID); | 141 | public delegate bool SceneGroupSpinStarted(UUID groupID); |
137 | |||
138 | public event SceneGroupSpinStarted OnSceneGroupSpinStart; | 142 | public event SceneGroupSpinStarted OnSceneGroupSpinStart; |
139 | 143 | ||
140 | public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation); | 144 | public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation); |
141 | |||
142 | public event SceneGroupSpun OnSceneGroupSpin; | 145 | public event SceneGroupSpun OnSceneGroupSpin; |
143 | 146 | ||
144 | public delegate void LandObjectAdded(ILandObject newParcel); | 147 | public delegate void LandObjectAdded(ILandObject newParcel); |
145 | |||
146 | public event LandObjectAdded OnLandObjectAdded; | 148 | public event LandObjectAdded OnLandObjectAdded; |
147 | 149 | ||
148 | public delegate void LandObjectRemoved(UUID globalID); | 150 | public delegate void LandObjectRemoved(UUID globalID); |
149 | |||
150 | public event LandObjectRemoved OnLandObjectRemoved; | 151 | public event LandObjectRemoved OnLandObjectRemoved; |
151 | 152 | ||
152 | public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); | 153 | public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); |
153 | |||
154 | public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; | 154 | public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; |
155 | 155 | ||
156 | public delegate void SignificantClientMovement(IClientAPI remote_client); | 156 | public delegate void SignificantClientMovement(IClientAPI remote_client); |
157 | |||
158 | public event SignificantClientMovement OnSignificantClientMovement; | 157 | public event SignificantClientMovement OnSignificantClientMovement; |
159 | 158 | ||
160 | public delegate void IncomingInstantMessage(GridInstantMessage message); | 159 | public delegate void IncomingInstantMessage(GridInstantMessage message); |
161 | |||
162 | public event IncomingInstantMessage OnIncomingInstantMessage; | 160 | public event IncomingInstantMessage OnIncomingInstantMessage; |
163 | 161 | ||
164 | public event IncomingInstantMessage OnUnhandledInstantMessage; | 162 | public event IncomingInstantMessage OnUnhandledInstantMessage; |
@@ -214,14 +212,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
214 | public delegate void RequestChangeWaterHeight(float height); | 212 | public delegate void RequestChangeWaterHeight(float height); |
215 | 213 | ||
216 | public event RequestChangeWaterHeight OnRequestChangeWaterHeight; | 214 | public event RequestChangeWaterHeight OnRequestChangeWaterHeight; |
217 | 215 | ||
218 | public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar); | 216 | /// <summary> |
219 | 217 | /// Fired if any avatar is 'killed' due to its health falling to zero | |
218 | /// </summary> | ||
220 | public event AvatarKillData OnAvatarKilled; | 219 | public event AvatarKillData OnAvatarKilled; |
220 | public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar); | ||
221 | 221 | ||
222 | public delegate void ScriptTimerEvent(uint localID, double timerinterval); | 222 | // public delegate void ScriptTimerEvent(uint localID, double timerinterval); |
223 | 223 | ||
224 | public event ScriptTimerEvent OnScriptTimerEvent; | 224 | // public event ScriptTimerEvent OnScriptTimerEvent; |
225 | 225 | ||
226 | public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); | 226 | public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour); |
227 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); | 227 | public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); |
@@ -312,9 +312,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
312 | public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue; | 312 | public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue; |
313 | 313 | ||
314 | /// <summary> | 314 | /// <summary> |
315 | /// Called whenever an object is attached, or detached | 315 | /// Called whenever an object is attached, or detached from an in-world presence. |
316 | /// from an in-world presence. | ||
317 | /// </summary> | 316 | /// </summary> |
317 | /// If the object is being attached, then the avatarID will be present. If the object is being detached then | ||
318 | /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). | ||
318 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); | 319 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); |
319 | public event Attach OnAttach; | 320 | public event Attach OnAttach; |
320 | 321 | ||
@@ -387,607 +388,1263 @@ namespace OpenSim.Region.Framework.Scenes | |||
387 | public event LandBuy OnLandBuy; | 388 | public event LandBuy OnLandBuy; |
388 | public event LandBuy OnValidateLandBuy; | 389 | public event LandBuy OnValidateLandBuy; |
389 | 390 | ||
390 | /* Designated Event Deletage Instances */ | ||
391 | |||
392 | private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent; | ||
393 | private ScriptAtTargetEvent handlerScriptAtTargetEvent = null; | ||
394 | private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null; | ||
395 | private ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = null; | ||
396 | private ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = null; | ||
397 | private ClientMovement handlerClientMovement = null; //OnClientMovement; | ||
398 | private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError; | ||
399 | private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole; | ||
400 | private OnFrameDelegate handlerFrame = null; //OnFrame; | ||
401 | private OnNewClientDelegate handlerNewClient = null; //OnNewClient; | ||
402 | private OnClientConnectCoreDelegate handlerClientConnect = null; //OnClientConnect | ||
403 | private OnNewPresenceDelegate handlerNewPresence = null; //OnNewPresence; | ||
404 | private OnRemovePresenceDelegate handlerRemovePresence = null; //OnRemovePresence; | ||
405 | private OnBackupDelegate handlerBackup = null; //OnBackup; | ||
406 | private OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = null; //OnParcelPrimCountUpdate; | ||
407 | private MoneyTransferEvent handlerMoneyTransfer = null; //OnMoneyTransfer; | ||
408 | private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd; | ||
409 | private OnShutdownDelegate handlerShutdown = null; //OnShutdown; | ||
410 | private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab; | ||
411 | private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab; | ||
412 | private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset | ||
413 | private NewRezScript handlerRezScript = null; //OnRezScript; | ||
414 | private RemoveScript handlerRemoveScript = null; //OnRemoveScript; | ||
415 | private StartScript handlerStartScript = null; //OnStartScript; | ||
416 | private StopScript handlerStopScript = null; //OnStopScript; | ||
417 | private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove; | ||
418 | private SceneGroupGrabed handlerSceneGroupGrab = null; //OnSceneGroupGrab; | ||
419 | private SceneGroupSpinStarted handlerSceneGroupSpinStarted = null; //OnSceneGroupSpinStart; | ||
420 | private SceneGroupSpun handlerSceneGroupSpin = null; //OnSceneGroupSpin; | ||
421 | private LandObjectAdded handlerLandObjectAdded = null; //OnLandObjectAdded; | ||
422 | private LandObjectRemoved handlerLandObjectRemoved = null; //OnLandObjectRemoved; | ||
423 | private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = null; //OnAvatarEnteringNewParcel; | ||
424 | private IncomingInstantMessage handlerIncomingInstantMessage = null; //OnIncomingInstantMessage; | ||
425 | private IncomingInstantMessage handlerUnhandledInstantMessage = null; //OnUnhandledInstantMessage; | ||
426 | private ClientClosed handlerClientClosed = null; //OnClientClosed; | ||
427 | private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent; | ||
428 | private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent; | ||
429 | private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick; | ||
430 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; | ||
431 | private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps; | ||
432 | private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld; | ||
433 | private ChatFromClientEvent handlerChatFromClient = null; // OnChatFromClient; | ||
434 | private ChatBroadcastEvent handlerChatBroadcast = null; // OnChatBroadcast; | ||
435 | private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null; | ||
436 | private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight | ||
437 | private ScriptControlEvent handlerScriptControlEvent = null; | ||
438 | private SignificantClientMovement handlerSignificantClientMovement = null; | ||
439 | |||
440 | private LandBuy handlerLandBuy = null; | ||
441 | private LandBuy handlerValidateLandBuy = null; | ||
442 | private AvatarKillData handlerAvatarKill = null; | ||
443 | |||
444 | private NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = null; | ||
445 | private IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = null; | ||
446 | private SetAllowForcefulBan handlerSetAllowForcefulBan = null; | ||
447 | private RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = null; | ||
448 | private ParcelPrimCountTainted handlerParcelPrimCountTainted = null; | ||
449 | private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null; | ||
450 | // TODO: unused: private ScriptTimerEvent handlerScriptTimerEvent = null; | ||
451 | private EstateToolsSunUpdate handlerEstateToolsSunUpdate = null; | ||
452 | |||
453 | private ScriptColliding handlerCollidingStart = null; | ||
454 | private ScriptColliding handlerColliding = null; | ||
455 | private ScriptColliding handlerCollidingEnd = null; | ||
456 | private ScriptColliding handlerLandCollidingStart = null; | ||
457 | private ScriptColliding handlerLandColliding = null; | ||
458 | private ScriptColliding handlerLandCollidingEnd = null; | ||
459 | private GetScriptRunning handlerGetScriptRunning = null; | ||
460 | |||
461 | private SunLindenHour handlerCurrentTimeAsLindenSunHour = null; | ||
462 | private OnSetRootAgentSceneDelegate handlerSetRootAgentScene = null; | ||
463 | |||
464 | private OarFileLoaded handlerOarFileLoaded = null; | ||
465 | private OarFileSaved handlerOarFileSaved = null; | ||
466 | |||
467 | private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null; | ||
468 | |||
469 | private Attach handlerOnAttach = null; | ||
470 | private RegionUp handlerOnRegionUp = null; | ||
471 | |||
472 | public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID) | 391 | public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID) |
473 | { | 392 | { |
474 | handlerOnAttach = OnAttach; | 393 | Attach handlerOnAttach = OnAttach; |
475 | if (handlerOnAttach != null) | 394 | if (handlerOnAttach != null) |
476 | handlerOnAttach(localID, itemID, avatarID); | 395 | { |
396 | foreach (Attach d in handlerOnAttach.GetInvocationList()) | ||
397 | { | ||
398 | try | ||
399 | { | ||
400 | d(localID, itemID, avatarID); | ||
401 | } | ||
402 | catch (Exception e) | ||
403 | { | ||
404 | m_log.ErrorFormat( | ||
405 | "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", | ||
406 | e.Message, e.StackTrace); | ||
407 | } | ||
408 | } | ||
409 | } | ||
477 | } | 410 | } |
478 | 411 | ||
479 | public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) | 412 | public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) |
480 | { | 413 | { |
481 | handlerGetScriptRunning = OnGetScriptRunning; | 414 | GetScriptRunning handlerGetScriptRunning = OnGetScriptRunning; |
482 | if (handlerGetScriptRunning != null) | 415 | if (handlerGetScriptRunning != null) |
483 | handlerGetScriptRunning(controllingClient, objectID, itemID); | 416 | { |
417 | foreach (GetScriptRunning d in handlerGetScriptRunning.GetInvocationList()) | ||
418 | { | ||
419 | try | ||
420 | { | ||
421 | d(controllingClient, objectID, itemID); | ||
422 | } | ||
423 | catch (Exception e) | ||
424 | { | ||
425 | m_log.ErrorFormat( | ||
426 | "[EVENT MANAGER]: Delegate for TriggerGetScriptRunning failed - continuing. {0} {1}", | ||
427 | e.Message, e.StackTrace); | ||
428 | } | ||
429 | } | ||
430 | } | ||
484 | } | 431 | } |
485 | 432 | ||
486 | public void TriggerOnScriptChangedEvent(uint localID, uint change) | 433 | public void TriggerOnScriptChangedEvent(uint localID, uint change) |
487 | { | 434 | { |
488 | handlerScriptChangedEvent = OnScriptChangedEvent; | 435 | ScriptChangedEvent handlerScriptChangedEvent = OnScriptChangedEvent; |
489 | if (handlerScriptChangedEvent != null) | 436 | if (handlerScriptChangedEvent != null) |
490 | handlerScriptChangedEvent(localID, change); | 437 | { |
438 | foreach (ScriptChangedEvent d in handlerScriptChangedEvent.GetInvocationList()) | ||
439 | { | ||
440 | try | ||
441 | { | ||
442 | d(localID, change); | ||
443 | } | ||
444 | catch (Exception e) | ||
445 | { | ||
446 | m_log.ErrorFormat( | ||
447 | "[EVENT MANAGER]: Delegate for TriggerOnScriptChangedEvent failed - continuing. {0} {1}", | ||
448 | e.Message, e.StackTrace); | ||
449 | } | ||
450 | } | ||
451 | } | ||
491 | } | 452 | } |
492 | 453 | ||
493 | public void TriggerOnClientMovement(ScenePresence avatar) | 454 | public void TriggerOnClientMovement(ScenePresence avatar) |
494 | { | 455 | { |
495 | handlerClientMovement = OnClientMovement; | 456 | ClientMovement handlerClientMovement = OnClientMovement; |
496 | if (handlerClientMovement != null) | 457 | if (handlerClientMovement != null) |
497 | handlerClientMovement(avatar); | 458 | { |
459 | foreach (ClientMovement d in handlerClientMovement.GetInvocationList()) | ||
460 | { | ||
461 | try | ||
462 | { | ||
463 | d(avatar); | ||
464 | } | ||
465 | catch (Exception e) | ||
466 | { | ||
467 | m_log.ErrorFormat( | ||
468 | "[EVENT MANAGER]: Delegate for TriggerOnClientMovement failed - continuing. {0} {1}", | ||
469 | e.Message, e.StackTrace); | ||
470 | } | ||
471 | } | ||
472 | } | ||
498 | } | 473 | } |
499 | 474 | ||
500 | public void TriggerPermissionError(UUID user, string reason) | 475 | public void TriggerPermissionError(UUID user, string reason) |
501 | { | 476 | { |
502 | handlerPermissionError = OnPermissionError; | 477 | OnPermissionErrorDelegate handlerPermissionError = OnPermissionError; |
503 | if (handlerPermissionError != null) | 478 | if (handlerPermissionError != null) |
504 | handlerPermissionError(user, reason); | 479 | { |
480 | foreach (OnPermissionErrorDelegate d in handlerPermissionError.GetInvocationList()) | ||
481 | { | ||
482 | try | ||
483 | { | ||
484 | d(user, reason); | ||
485 | } | ||
486 | catch (Exception e) | ||
487 | { | ||
488 | m_log.ErrorFormat( | ||
489 | "[EVENT MANAGER]: Delegate for TriggerPermissionError failed - continuing. {0} {1}", | ||
490 | e.Message, e.StackTrace); | ||
491 | } | ||
492 | } | ||
493 | } | ||
505 | } | 494 | } |
506 | 495 | ||
507 | public void TriggerOnPluginConsole(string[] args) | 496 | public void TriggerOnPluginConsole(string[] args) |
508 | { | 497 | { |
509 | handlerPluginConsole = OnPluginConsole; | 498 | OnPluginConsoleDelegate handlerPluginConsole = OnPluginConsole; |
510 | if (handlerPluginConsole != null) | 499 | if (handlerPluginConsole != null) |
511 | handlerPluginConsole(args); | 500 | { |
501 | foreach (OnPluginConsoleDelegate d in handlerPluginConsole.GetInvocationList()) | ||
502 | { | ||
503 | try | ||
504 | { | ||
505 | d(args); | ||
506 | } | ||
507 | catch (Exception e) | ||
508 | { | ||
509 | m_log.ErrorFormat( | ||
510 | "[EVENT MANAGER]: Delegate for TriggerOnPluginConsole failed - continuing. {0} {1}", | ||
511 | e.Message, e.StackTrace); | ||
512 | } | ||
513 | } | ||
514 | } | ||
512 | } | 515 | } |
513 | 516 | ||
514 | public void TriggerOnFrame() | 517 | public void TriggerOnFrame() |
515 | { | 518 | { |
516 | handlerFrame = OnFrame; | 519 | OnFrameDelegate handlerFrame = OnFrame; |
517 | if (handlerFrame != null) | 520 | if (handlerFrame != null) |
518 | { | 521 | { |
519 | handlerFrame(); | 522 | foreach (OnFrameDelegate d in handlerFrame.GetInvocationList()) |
520 | } | 523 | { |
524 | try | ||
525 | { | ||
526 | d(); | ||
527 | } | ||
528 | catch (Exception e) | ||
529 | { | ||
530 | m_log.ErrorFormat( | ||
531 | "[EVENT MANAGER]: Delegate for TriggerOnFrame failed - continuing. {0} {1}", | ||
532 | e.Message, e.StackTrace); | ||
533 | } | ||
534 | } | ||
535 | } | ||
521 | } | 536 | } |
522 | 537 | ||
523 | public void TriggerOnNewClient(IClientAPI client) | 538 | public void TriggerOnNewClient(IClientAPI client) |
524 | { | 539 | { |
525 | handlerNewClient = OnNewClient; | 540 | OnNewClientDelegate handlerNewClient = OnNewClient; |
526 | if (handlerNewClient != null) | 541 | if (handlerNewClient != null) |
527 | handlerNewClient(client); | 542 | { |
543 | foreach (OnNewClientDelegate d in handlerNewClient.GetInvocationList()) | ||
544 | { | ||
545 | try | ||
546 | { | ||
547 | d(client); | ||
548 | } | ||
549 | catch (Exception e) | ||
550 | { | ||
551 | m_log.ErrorFormat( | ||
552 | "[EVENT MANAGER]: Delegate for TriggerOnNewClient failed - continuing. {0} {1}", | ||
553 | e.Message, e.StackTrace); | ||
554 | } | ||
555 | } | ||
556 | } | ||
528 | 557 | ||
529 | if (client is IClientCore) | 558 | if (client is IClientCore) |
530 | { | 559 | { |
531 | handlerClientConnect = OnClientConnect; | 560 | OnClientConnectCoreDelegate handlerClientConnect = OnClientConnect; |
532 | if (handlerClientConnect != null) | 561 | if (handlerClientConnect != null) |
533 | handlerClientConnect((IClientCore)client); | 562 | { |
563 | foreach (OnClientConnectCoreDelegate d in handlerClientConnect.GetInvocationList()) | ||
564 | { | ||
565 | try | ||
566 | { | ||
567 | d((IClientCore)client); | ||
568 | } | ||
569 | catch (Exception e) | ||
570 | { | ||
571 | m_log.ErrorFormat( | ||
572 | "[EVENT MANAGER]: Delegate for TriggerOnNewClient (IClientCore) failed - continuing. {0} {1}", | ||
573 | e.Message, e.StackTrace); | ||
574 | } | ||
575 | } | ||
576 | } | ||
534 | } | 577 | } |
535 | } | 578 | } |
536 | 579 | ||
537 | public void TriggerOnNewPresence(ScenePresence presence) | 580 | public void TriggerOnNewPresence(ScenePresence presence) |
538 | { | 581 | { |
539 | handlerNewPresence = OnNewPresence; | 582 | OnNewPresenceDelegate handlerNewPresence = OnNewPresence; |
540 | if (handlerNewPresence != null) | 583 | if (handlerNewPresence != null) |
541 | handlerNewPresence(presence); | 584 | { |
585 | foreach (OnNewPresenceDelegate d in handlerNewPresence.GetInvocationList()) | ||
586 | { | ||
587 | try | ||
588 | { | ||
589 | d(presence); | ||
590 | } | ||
591 | catch (Exception e) | ||
592 | { | ||
593 | m_log.ErrorFormat( | ||
594 | "[EVENT MANAGER]: Delegate for TriggerOnNewPresence failed - continuing. {0} {1}", | ||
595 | e.Message, e.StackTrace); | ||
596 | } | ||
597 | } | ||
598 | } | ||
542 | } | 599 | } |
543 | 600 | ||
544 | public void TriggerOnRemovePresence(UUID agentId) | 601 | public void TriggerOnRemovePresence(UUID agentId) |
545 | { | 602 | { |
546 | handlerRemovePresence = OnRemovePresence; | 603 | OnRemovePresenceDelegate handlerRemovePresence = OnRemovePresence; |
547 | if (handlerRemovePresence != null) | 604 | if (handlerRemovePresence != null) |
548 | { | 605 | { |
549 | handlerRemovePresence(agentId); | 606 | foreach (OnRemovePresenceDelegate d in handlerRemovePresence.GetInvocationList()) |
550 | } | 607 | { |
608 | try | ||
609 | { | ||
610 | d(agentId); | ||
611 | } | ||
612 | catch (Exception e) | ||
613 | { | ||
614 | m_log.ErrorFormat( | ||
615 | "[EVENT MANAGER]: Delegate for TriggerOnRemovePresence failed - continuing. {0} {1}", | ||
616 | e.Message, e.StackTrace); | ||
617 | } | ||
618 | } | ||
619 | } | ||
551 | } | 620 | } |
552 | 621 | ||
553 | public void TriggerOnBackup(IRegionDataStore dstore) | 622 | public void TriggerOnBackup(IRegionDataStore dstore) |
554 | { | 623 | { |
555 | handlerBackup = OnBackup; | 624 | OnBackupDelegate handlerOnAttach = OnBackup; |
556 | if (handlerBackup != null) | 625 | if (handlerOnAttach != null) |
557 | { | 626 | { |
558 | handlerBackup(dstore, false); | 627 | foreach (OnBackupDelegate d in handlerOnAttach.GetInvocationList()) |
559 | } | 628 | { |
629 | try | ||
630 | { | ||
631 | d(dstore, false); | ||
632 | } | ||
633 | catch (Exception e) | ||
634 | { | ||
635 | m_log.ErrorFormat( | ||
636 | "[EVENT MANAGER]: Delegate for TriggerOnBackup failed - continuing. {0} {1}", | ||
637 | e.Message, e.StackTrace); | ||
638 | } | ||
639 | } | ||
640 | } | ||
560 | } | 641 | } |
561 | 642 | ||
562 | public void TriggerParcelPrimCountUpdate() | 643 | public void TriggerParcelPrimCountUpdate() |
563 | { | 644 | { |
564 | handlerParcelPrimCountUpdate = OnParcelPrimCountUpdate; | 645 | OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = OnParcelPrimCountUpdate; |
565 | if (handlerParcelPrimCountUpdate != null) | 646 | if (handlerParcelPrimCountUpdate != null) |
566 | { | 647 | { |
567 | handlerParcelPrimCountUpdate(); | 648 | foreach (OnParcelPrimCountUpdateDelegate d in handlerParcelPrimCountUpdate.GetInvocationList()) |
568 | } | 649 | { |
569 | } | 650 | try |
570 | 651 | { | |
571 | public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs e) | 652 | d(); |
572 | { | 653 | } |
573 | handlerMoneyTransfer = OnMoneyTransfer; | 654 | catch (Exception e) |
655 | { | ||
656 | m_log.ErrorFormat( | ||
657 | "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountUpdate failed - continuing. {0} {1}", | ||
658 | e.Message, e.StackTrace); | ||
659 | } | ||
660 | } | ||
661 | } | ||
662 | } | ||
663 | |||
664 | public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs args) | ||
665 | { | ||
666 | MoneyTransferEvent handlerMoneyTransfer = OnMoneyTransfer; | ||
574 | if (handlerMoneyTransfer != null) | 667 | if (handlerMoneyTransfer != null) |
575 | { | 668 | { |
576 | handlerMoneyTransfer(sender, e); | 669 | foreach (MoneyTransferEvent d in handlerMoneyTransfer.GetInvocationList()) |
577 | } | 670 | { |
671 | try | ||
672 | { | ||
673 | d(sender, args); | ||
674 | } | ||
675 | catch (Exception e) | ||
676 | { | ||
677 | m_log.ErrorFormat( | ||
678 | "[EVENT MANAGER]: Delegate for TriggerMoneyTransfer failed - continuing. {0} {1}", | ||
679 | e.Message, e.StackTrace); | ||
680 | } | ||
681 | } | ||
682 | } | ||
578 | } | 683 | } |
579 | 684 | ||
580 | public void TriggerTerrainTick() | 685 | public void TriggerTerrainTick() |
581 | { | 686 | { |
582 | handlerTerrainTick = OnTerrainTick; | 687 | OnTerrainTickDelegate handlerTerrainTick = OnTerrainTick; |
583 | if (handlerTerrainTick != null) | 688 | if (handlerTerrainTick != null) |
584 | { | 689 | { |
585 | handlerTerrainTick(); | 690 | foreach (OnTerrainTickDelegate d in handlerTerrainTick.GetInvocationList()) |
586 | } | 691 | { |
692 | try | ||
693 | { | ||
694 | d(); | ||
695 | } | ||
696 | catch (Exception e) | ||
697 | { | ||
698 | m_log.ErrorFormat( | ||
699 | "[EVENT MANAGER]: Delegate for TriggerTerrainTick failed - continuing. {0} {1}", | ||
700 | e.Message, e.StackTrace); | ||
701 | } | ||
702 | } | ||
703 | } | ||
587 | } | 704 | } |
588 | 705 | ||
589 | public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) | 706 | public void TriggerParcelPrimCountAdd(SceneObjectGroup obj) |
590 | { | 707 | { |
591 | handlerParcelPrimCountAdd = OnParcelPrimCountAdd; | 708 | OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = OnParcelPrimCountAdd; |
592 | if (handlerParcelPrimCountAdd != null) | 709 | if (handlerParcelPrimCountAdd != null) |
593 | { | 710 | { |
594 | handlerParcelPrimCountAdd(obj); | 711 | foreach (OnParcelPrimCountAddDelegate d in handlerParcelPrimCountAdd.GetInvocationList()) |
595 | } | 712 | { |
713 | try | ||
714 | { | ||
715 | d(obj); | ||
716 | } | ||
717 | catch (Exception e) | ||
718 | { | ||
719 | m_log.ErrorFormat( | ||
720 | "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountAdd failed - continuing. {0} {1}", | ||
721 | e.Message, e.StackTrace); | ||
722 | } | ||
723 | } | ||
724 | } | ||
596 | } | 725 | } |
597 | 726 | ||
598 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) | 727 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) |
599 | { | 728 | { |
600 | handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; | 729 | ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; |
601 | if (handlerObjectBeingRemovedFromScene != null) | 730 | if (handlerObjectBeingRemovedFromScene != null) |
602 | { | 731 | { |
603 | handlerObjectBeingRemovedFromScene(obj); | 732 | foreach (ObjectBeingRemovedFromScene d in handlerObjectBeingRemovedFromScene.GetInvocationList()) |
604 | } | 733 | { |
734 | try | ||
735 | { | ||
736 | d(obj); | ||
737 | } | ||
738 | catch (Exception e) | ||
739 | { | ||
740 | m_log.ErrorFormat( | ||
741 | "[EVENT MANAGER]: Delegate for TriggerObjectBeingRemovedFromScene failed - continuing. {0} {1}", | ||
742 | e.Message, e.StackTrace); | ||
743 | } | ||
744 | } | ||
745 | } | ||
605 | } | 746 | } |
606 | 747 | ||
607 | public void TriggerShutdown() | 748 | public void TriggerShutdown() |
608 | { | 749 | { |
609 | handlerShutdown = OnShutdown; | 750 | OnShutdownDelegate handlerShutdown = OnShutdown; |
610 | if (handlerShutdown != null) | 751 | if (handlerShutdown != null) |
611 | handlerShutdown(); | 752 | { |
753 | foreach (OnShutdownDelegate d in handlerShutdown.GetInvocationList()) | ||
754 | { | ||
755 | try | ||
756 | { | ||
757 | d(); | ||
758 | } | ||
759 | catch (Exception e) | ||
760 | { | ||
761 | m_log.ErrorFormat( | ||
762 | "[EVENT MANAGER]: Delegate for TriggerShutdown failed - continuing. {0} {1}", | ||
763 | e.Message, e.StackTrace); | ||
764 | } | ||
765 | } | ||
766 | } | ||
612 | } | 767 | } |
613 | 768 | ||
614 | public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) | 769 | public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) |
615 | { | 770 | { |
616 | handlerObjectGrab = OnObjectGrab; | 771 | ObjectGrabDelegate handlerObjectGrab = OnObjectGrab; |
617 | if (handlerObjectGrab != null) | 772 | if (handlerObjectGrab != null) |
618 | { | 773 | { |
619 | handlerObjectGrab(localID, originalID, offsetPos, remoteClient, surfaceArgs); | 774 | foreach (ObjectGrabDelegate d in handlerObjectGrab.GetInvocationList()) |
620 | } | 775 | { |
621 | } | 776 | try |
777 | { | ||
778 | d(localID, originalID, offsetPos, remoteClient, surfaceArgs); | ||
779 | } | ||
780 | catch (Exception e) | ||
781 | { | ||
782 | m_log.ErrorFormat( | ||
783 | "[EVENT MANAGER]: Delegate for TriggerObjectGrab failed - continuing. {0} {1}", | ||
784 | e.Message, e.StackTrace); | ||
785 | } | ||
786 | } | ||
787 | } | ||
788 | } | ||
789 | |||
790 | public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) | ||
791 | { | ||
792 | ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing; | ||
793 | if (handlerObjectGrabbing != null) | ||
794 | { | ||
795 | foreach (ObjectGrabDelegate d in handlerObjectGrabbing.GetInvocationList()) | ||
796 | { | ||
797 | try | ||
798 | { | ||
799 | d(localID, originalID, offsetPos, remoteClient, surfaceArgs); | ||
800 | } | ||
801 | catch (Exception e) | ||
802 | { | ||
803 | m_log.ErrorFormat( | ||
804 | "[EVENT MANAGER]: Delegate for TriggerObjectGrabbing failed - continuing. {0} {1}", | ||
805 | e.Message, e.StackTrace); | ||
806 | } | ||
807 | } | ||
808 | } | ||
809 | } | ||
622 | 810 | ||
623 | public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) | 811 | public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) |
624 | { | 812 | { |
625 | handlerObjectDeGrab = OnObjectDeGrab; | 813 | ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab; |
626 | if (handlerObjectDeGrab != null) | 814 | if (handlerObjectDeGrab != null) |
627 | { | 815 | { |
628 | handlerObjectDeGrab(localID, originalID, remoteClient, surfaceArgs); | 816 | foreach (ObjectDeGrabDelegate d in handlerObjectDeGrab.GetInvocationList()) |
629 | } | 817 | { |
818 | try | ||
819 | { | ||
820 | d(localID, originalID, remoteClient, surfaceArgs); | ||
821 | } | ||
822 | catch (Exception e) | ||
823 | { | ||
824 | m_log.ErrorFormat( | ||
825 | "[EVENT MANAGER]: Delegate for TriggerObjectDeGrab failed - continuing. {0} {1}", | ||
826 | e.Message, e.StackTrace); | ||
827 | } | ||
828 | } | ||
829 | } | ||
630 | } | 830 | } |
631 | 831 | ||
632 | public void TriggerScriptReset(uint localID, UUID itemID) | 832 | public void TriggerScriptReset(uint localID, UUID itemID) |
633 | { | 833 | { |
634 | handlerScriptReset = OnScriptReset; | 834 | ScriptResetDelegate handlerScriptReset = OnScriptReset; |
635 | if (handlerScriptReset != null) | 835 | if (handlerScriptReset != null) |
636 | { | 836 | { |
637 | handlerScriptReset(localID, itemID); | 837 | foreach (ScriptResetDelegate d in handlerScriptReset.GetInvocationList()) |
638 | } | 838 | { |
839 | try | ||
840 | { | ||
841 | d(localID, itemID); | ||
842 | } | ||
843 | catch (Exception e) | ||
844 | { | ||
845 | m_log.ErrorFormat( | ||
846 | "[EVENT MANAGER]: Delegate for TriggerScriptReset failed - continuing. {0} {1}", | ||
847 | e.Message, e.StackTrace); | ||
848 | } | ||
849 | } | ||
850 | } | ||
639 | } | 851 | } |
640 | 852 | ||
641 | public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) | 853 | public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) |
642 | { | 854 | { |
643 | handlerRezScript = OnRezScript; | 855 | NewRezScript handlerRezScript = OnRezScript; |
644 | if (handlerRezScript != null) | 856 | if (handlerRezScript != null) |
645 | { | 857 | { |
646 | handlerRezScript(localID, itemID, script, startParam, | 858 | foreach (NewRezScript d in handlerRezScript.GetInvocationList()) |
647 | postOnRez, engine, stateSource); | 859 | { |
648 | } | 860 | try |
861 | { | ||
862 | d(localID, itemID, script, startParam, postOnRez, engine, stateSource); | ||
863 | } | ||
864 | catch (Exception e) | ||
865 | { | ||
866 | m_log.ErrorFormat( | ||
867 | "[EVENT MANAGER]: Delegate for TriggerRezScript failed - continuing. {0} {1}", | ||
868 | e.Message, e.StackTrace); | ||
869 | } | ||
870 | } | ||
871 | } | ||
649 | } | 872 | } |
650 | 873 | ||
651 | public void TriggerStartScript(uint localID, UUID itemID) | 874 | public void TriggerStartScript(uint localID, UUID itemID) |
652 | { | 875 | { |
653 | handlerStartScript = OnStartScript; | 876 | StartScript handlerStartScript = OnStartScript; |
654 | if (handlerStartScript != null) | 877 | if (handlerStartScript != null) |
655 | { | 878 | { |
656 | handlerStartScript(localID, itemID); | 879 | foreach (StartScript d in handlerStartScript.GetInvocationList()) |
657 | } | 880 | { |
881 | try | ||
882 | { | ||
883 | d(localID, itemID); | ||
884 | } | ||
885 | catch (Exception e) | ||
886 | { | ||
887 | m_log.ErrorFormat( | ||
888 | "[EVENT MANAGER]: Delegate for TriggerStartScript failed - continuing. {0} {1}", | ||
889 | e.Message, e.StackTrace); | ||
890 | } | ||
891 | } | ||
892 | } | ||
658 | } | 893 | } |
659 | 894 | ||
660 | public void TriggerStopScript(uint localID, UUID itemID) | 895 | public void TriggerStopScript(uint localID, UUID itemID) |
661 | { | 896 | { |
662 | handlerStopScript = OnStopScript; | 897 | StopScript handlerStopScript = OnStopScript; |
663 | if (handlerStopScript != null) | 898 | if (handlerStopScript != null) |
664 | { | 899 | { |
665 | handlerStopScript(localID, itemID); | 900 | foreach (StopScript d in handlerStopScript.GetInvocationList()) |
666 | } | 901 | { |
902 | try | ||
903 | { | ||
904 | d(localID, itemID); | ||
905 | } | ||
906 | catch (Exception e) | ||
907 | { | ||
908 | m_log.ErrorFormat( | ||
909 | "[EVENT MANAGER]: Delegate for TriggerStopScript failed - continuing. {0} {1}", | ||
910 | e.Message, e.StackTrace); | ||
911 | } | ||
912 | } | ||
913 | } | ||
667 | } | 914 | } |
668 | 915 | ||
669 | public void TriggerRemoveScript(uint localID, UUID itemID) | 916 | public void TriggerRemoveScript(uint localID, UUID itemID) |
670 | { | 917 | { |
671 | handlerRemoveScript = OnRemoveScript; | 918 | RemoveScript handlerRemoveScript = OnRemoveScript; |
672 | if (handlerRemoveScript != null) | 919 | if (handlerRemoveScript != null) |
673 | { | 920 | { |
674 | handlerRemoveScript(localID, itemID); | 921 | foreach (RemoveScript d in handlerRemoveScript.GetInvocationList()) |
675 | } | 922 | { |
923 | try | ||
924 | { | ||
925 | d(localID, itemID); | ||
926 | } | ||
927 | catch (Exception e) | ||
928 | { | ||
929 | m_log.ErrorFormat( | ||
930 | "[EVENT MANAGER]: Delegate for TriggerRemoveScript failed - continuing. {0} {1}", | ||
931 | e.Message, e.StackTrace); | ||
932 | } | ||
933 | } | ||
934 | } | ||
676 | } | 935 | } |
677 | 936 | ||
678 | public bool TriggerGroupMove(UUID groupID, Vector3 delta) | 937 | public bool TriggerGroupMove(UUID groupID, Vector3 delta) |
679 | { | 938 | { |
680 | handlerSceneGroupMove = OnSceneGroupMove; | 939 | bool result = true; |
681 | 940 | ||
941 | SceneGroupMoved handlerSceneGroupMove = OnSceneGroupMove; | ||
682 | if (handlerSceneGroupMove != null) | 942 | if (handlerSceneGroupMove != null) |
683 | { | 943 | { |
684 | return handlerSceneGroupMove(groupID, delta); | 944 | foreach (SceneGroupMoved d in handlerSceneGroupMove.GetInvocationList()) |
945 | { | ||
946 | try | ||
947 | { | ||
948 | if (d(groupID, delta) == false) | ||
949 | result = false; | ||
950 | } | ||
951 | catch (Exception e) | ||
952 | { | ||
953 | m_log.ErrorFormat( | ||
954 | "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", | ||
955 | e.Message, e.StackTrace); | ||
956 | } | ||
957 | } | ||
685 | } | 958 | } |
686 | return true; | 959 | |
960 | return result; | ||
687 | } | 961 | } |
688 | 962 | ||
689 | public bool TriggerGroupSpinStart(UUID groupID) | 963 | public bool TriggerGroupSpinStart(UUID groupID) |
690 | { | 964 | { |
691 | handlerSceneGroupSpinStarted = OnSceneGroupSpinStart; | 965 | bool result = true; |
692 | 966 | ||
967 | SceneGroupSpinStarted handlerSceneGroupSpinStarted = OnSceneGroupSpinStart; | ||
693 | if (handlerSceneGroupSpinStarted != null) | 968 | if (handlerSceneGroupSpinStarted != null) |
694 | { | 969 | { |
695 | return handlerSceneGroupSpinStarted(groupID); | 970 | foreach (SceneGroupSpinStarted d in handlerSceneGroupSpinStarted.GetInvocationList()) |
971 | { | ||
972 | try | ||
973 | { | ||
974 | if (d(groupID) == false) | ||
975 | result = false; | ||
976 | } | ||
977 | catch (Exception e) | ||
978 | { | ||
979 | m_log.ErrorFormat( | ||
980 | "[EVENT MANAGER]: Delegate for TriggerGroupSpinStart failed - continuing. {0} {1}", | ||
981 | e.Message, e.StackTrace); | ||
982 | } | ||
983 | } | ||
696 | } | 984 | } |
697 | return true; | 985 | |
986 | return result; | ||
698 | } | 987 | } |
699 | 988 | ||
700 | public bool TriggerGroupSpin(UUID groupID, Quaternion rotation) | 989 | public bool TriggerGroupSpin(UUID groupID, Quaternion rotation) |
701 | { | 990 | { |
702 | handlerSceneGroupSpin = OnSceneGroupSpin; | 991 | bool result = true; |
703 | 992 | ||
993 | SceneGroupSpun handlerSceneGroupSpin = OnSceneGroupSpin; | ||
704 | if (handlerSceneGroupSpin != null) | 994 | if (handlerSceneGroupSpin != null) |
705 | { | 995 | { |
706 | return handlerSceneGroupSpin(groupID, rotation); | 996 | foreach (SceneGroupSpun d in handlerSceneGroupSpin.GetInvocationList()) |
997 | { | ||
998 | try | ||
999 | { | ||
1000 | if (d(groupID, rotation) == false) | ||
1001 | result = false; | ||
1002 | } | ||
1003 | catch (Exception e) | ||
1004 | { | ||
1005 | m_log.ErrorFormat( | ||
1006 | "[EVENT MANAGER]: Delegate for TriggerGroupSpin failed - continuing. {0} {1}", | ||
1007 | e.Message, e.StackTrace); | ||
1008 | } | ||
1009 | } | ||
707 | } | 1010 | } |
708 | return true; | 1011 | |
1012 | return result; | ||
709 | } | 1013 | } |
710 | 1014 | ||
711 | public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID) | 1015 | public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID) |
712 | { | 1016 | { |
713 | handlerSceneGroupGrab = OnSceneGroupGrab; | 1017 | SceneGroupGrabed handlerSceneGroupGrab = OnSceneGroupGrab; |
714 | if (handlerSceneGroupGrab != null) | 1018 | if (handlerSceneGroupGrab != null) |
715 | { | 1019 | { |
716 | handlerSceneGroupGrab(groupID, offset, userID); | 1020 | foreach (SceneGroupGrabed d in handlerSceneGroupGrab.GetInvocationList()) |
717 | } | 1021 | { |
1022 | try | ||
1023 | { | ||
1024 | d(groupID, offset, userID); | ||
1025 | } | ||
1026 | catch (Exception e) | ||
1027 | { | ||
1028 | m_log.ErrorFormat( | ||
1029 | "[EVENT MANAGER]: Delegate for TriggerGroupGrab failed - continuing. {0} {1}", | ||
1030 | e.Message, e.StackTrace); | ||
1031 | } | ||
1032 | } | ||
1033 | } | ||
718 | } | 1034 | } |
719 | 1035 | ||
720 | public void TriggerLandObjectAdded(ILandObject newParcel) | 1036 | public void TriggerLandObjectAdded(ILandObject newParcel) |
721 | { | 1037 | { |
722 | handlerLandObjectAdded = OnLandObjectAdded; | 1038 | LandObjectAdded handlerLandObjectAdded = OnLandObjectAdded; |
723 | |||
724 | if (handlerLandObjectAdded != null) | 1039 | if (handlerLandObjectAdded != null) |
725 | { | 1040 | { |
726 | handlerLandObjectAdded(newParcel); | 1041 | foreach (LandObjectAdded d in handlerLandObjectAdded.GetInvocationList()) |
727 | } | 1042 | { |
1043 | try | ||
1044 | { | ||
1045 | d(newParcel); | ||
1046 | } | ||
1047 | catch (Exception e) | ||
1048 | { | ||
1049 | m_log.ErrorFormat( | ||
1050 | "[EVENT MANAGER]: Delegate for TriggerLandObjectAdded failed - continuing. {0} {1}", | ||
1051 | e.Message, e.StackTrace); | ||
1052 | } | ||
1053 | } | ||
1054 | } | ||
728 | } | 1055 | } |
729 | 1056 | ||
730 | public void TriggerLandObjectRemoved(UUID globalID) | 1057 | public void TriggerLandObjectRemoved(UUID globalID) |
731 | { | 1058 | { |
732 | handlerLandObjectRemoved = OnLandObjectRemoved; | 1059 | LandObjectRemoved handlerLandObjectRemoved = OnLandObjectRemoved; |
733 | if (handlerLandObjectRemoved != null) | 1060 | if (handlerLandObjectRemoved != null) |
734 | { | 1061 | { |
735 | handlerLandObjectRemoved(globalID); | 1062 | foreach (LandObjectRemoved d in handlerLandObjectRemoved.GetInvocationList()) |
736 | } | 1063 | { |
1064 | try | ||
1065 | { | ||
1066 | d(globalID); | ||
1067 | } | ||
1068 | catch (Exception e) | ||
1069 | { | ||
1070 | m_log.ErrorFormat( | ||
1071 | "[EVENT MANAGER]: Delegate for TriggerLandObjectRemoved failed - continuing. {0} {1}", | ||
1072 | e.Message, e.StackTrace); | ||
1073 | } | ||
1074 | } | ||
1075 | } | ||
737 | } | 1076 | } |
738 | 1077 | ||
739 | public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel) | 1078 | public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel) |
740 | { | 1079 | { |
741 | //triggerLandObjectRemoved(localParcelID); | ||
742 | |||
743 | TriggerLandObjectAdded(newParcel); | 1080 | TriggerLandObjectAdded(newParcel); |
744 | } | 1081 | } |
745 | 1082 | ||
746 | public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) | 1083 | public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) |
747 | { | 1084 | { |
748 | handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel; | 1085 | AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel; |
749 | |||
750 | if (handlerAvatarEnteringNewParcel != null) | 1086 | if (handlerAvatarEnteringNewParcel != null) |
751 | { | 1087 | { |
752 | handlerAvatarEnteringNewParcel(avatar, localLandID, regionID); | 1088 | foreach (AvatarEnteringNewParcel d in handlerAvatarEnteringNewParcel.GetInvocationList()) |
753 | } | 1089 | { |
1090 | try | ||
1091 | { | ||
1092 | d(avatar, localLandID, regionID); | ||
1093 | } | ||
1094 | catch (Exception e) | ||
1095 | { | ||
1096 | m_log.ErrorFormat( | ||
1097 | "[EVENT MANAGER]: Delegate for TriggerAvatarEnteringNewParcel failed - continuing. {0} {1}", | ||
1098 | e.Message, e.StackTrace); | ||
1099 | } | ||
1100 | } | ||
1101 | } | ||
754 | } | 1102 | } |
755 | 1103 | ||
756 | public void TriggerIncomingInstantMessage(GridInstantMessage message) | 1104 | public void TriggerIncomingInstantMessage(GridInstantMessage message) |
757 | { | 1105 | { |
758 | handlerIncomingInstantMessage = OnIncomingInstantMessage; | 1106 | IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; |
759 | if (handlerIncomingInstantMessage != null) | 1107 | if (handlerIncomingInstantMessage != null) |
760 | { | 1108 | { |
761 | handlerIncomingInstantMessage(message); | 1109 | foreach (IncomingInstantMessage d in handlerIncomingInstantMessage.GetInvocationList()) |
762 | } | 1110 | { |
1111 | try | ||
1112 | { | ||
1113 | d(message); | ||
1114 | } | ||
1115 | catch (Exception e) | ||
1116 | { | ||
1117 | m_log.ErrorFormat( | ||
1118 | "[EVENT MANAGER]: Delegate for TriggerIncomingInstantMessage failed - continuing. {0} {1}", | ||
1119 | e.Message, e.StackTrace); | ||
1120 | } | ||
1121 | } | ||
1122 | } | ||
763 | } | 1123 | } |
764 | 1124 | ||
765 | public void TriggerUnhandledInstantMessage(GridInstantMessage message) | 1125 | public void TriggerUnhandledInstantMessage(GridInstantMessage message) |
766 | { | 1126 | { |
767 | handlerUnhandledInstantMessage = OnUnhandledInstantMessage; | 1127 | IncomingInstantMessage handlerUnhandledInstantMessage = OnUnhandledInstantMessage; |
768 | if (handlerUnhandledInstantMessage != null) | 1128 | if (handlerUnhandledInstantMessage != null) |
769 | { | 1129 | { |
770 | handlerUnhandledInstantMessage(message); | 1130 | foreach (IncomingInstantMessage d in handlerUnhandledInstantMessage.GetInvocationList()) |
771 | } | 1131 | { |
1132 | try | ||
1133 | { | ||
1134 | d(message); | ||
1135 | } | ||
1136 | catch (Exception e) | ||
1137 | { | ||
1138 | m_log.ErrorFormat( | ||
1139 | "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", | ||
1140 | e.Message, e.StackTrace); | ||
1141 | } | ||
1142 | } | ||
1143 | } | ||
772 | } | 1144 | } |
773 | 1145 | ||
774 | public void TriggerClientClosed(UUID ClientID, Scene scene) | 1146 | public void TriggerClientClosed(UUID ClientID, Scene scene) |
775 | { | 1147 | { |
776 | handlerClientClosed = OnClientClosed; | 1148 | ClientClosed handlerClientClosed = OnClientClosed; |
777 | if (handlerClientClosed != null) | 1149 | if (handlerClientClosed != null) |
778 | { | 1150 | { |
779 | handlerClientClosed(ClientID, scene); | 1151 | foreach (ClientClosed d in handlerClientClosed.GetInvocationList()) |
780 | } | 1152 | { |
1153 | try | ||
1154 | { | ||
1155 | d(ClientID, scene); | ||
1156 | } | ||
1157 | catch (Exception e) | ||
1158 | { | ||
1159 | m_log.ErrorFormat( | ||
1160 | "[EVENT MANAGER]: Delegate for TriggerClientClosed failed - continuing. {0} {1}", | ||
1161 | e.Message, e.StackTrace); | ||
1162 | } | ||
1163 | } | ||
1164 | } | ||
781 | } | 1165 | } |
782 | 1166 | ||
783 | public void TriggerOnMakeChildAgent(ScenePresence presence) | 1167 | public void TriggerOnMakeChildAgent(ScenePresence presence) |
784 | { | 1168 | { |
785 | handlerMakeChildAgent = OnMakeChildAgent; | 1169 | OnMakeChildAgentDelegate handlerMakeChildAgent = OnMakeChildAgent; |
786 | if (handlerMakeChildAgent != null) | 1170 | if (handlerMakeChildAgent != null) |
787 | { | 1171 | { |
788 | handlerMakeChildAgent(presence); | 1172 | foreach (OnMakeChildAgentDelegate d in handlerMakeChildAgent.GetInvocationList()) |
789 | } | 1173 | { |
1174 | try | ||
1175 | { | ||
1176 | d(presence); | ||
1177 | } | ||
1178 | catch (Exception e) | ||
1179 | { | ||
1180 | m_log.ErrorFormat( | ||
1181 | "[EVENT MANAGER]: Delegate for TriggerOnMakeChildAgent failed - continuing. {0} {1}", | ||
1182 | e.Message, e.StackTrace); | ||
1183 | } | ||
1184 | } | ||
1185 | } | ||
790 | } | 1186 | } |
791 | 1187 | ||
792 | public void TriggerOnMakeRootAgent(ScenePresence presence) | 1188 | public void TriggerOnMakeRootAgent(ScenePresence presence) |
793 | { | 1189 | { |
794 | handlerMakeRootAgent = OnMakeRootAgent; | 1190 | OnMakeRootAgentDelegate handlerMakeRootAgent = OnMakeRootAgent; |
795 | if (handlerMakeRootAgent != null) | 1191 | if (handlerMakeRootAgent != null) |
796 | { | 1192 | { |
797 | handlerMakeRootAgent(presence); | 1193 | foreach (OnMakeRootAgentDelegate d in handlerMakeRootAgent.GetInvocationList()) |
798 | } | 1194 | { |
1195 | try | ||
1196 | { | ||
1197 | d(presence); | ||
1198 | } | ||
1199 | catch (Exception e) | ||
1200 | { | ||
1201 | m_log.ErrorFormat( | ||
1202 | "[EVENT MANAGER]: Delegate for TriggerOnMakeRootAgent failed - continuing. {0} {1}", | ||
1203 | e.Message, e.StackTrace); | ||
1204 | } | ||
1205 | } | ||
1206 | } | ||
799 | } | 1207 | } |
800 | 1208 | ||
801 | public void TriggerOnRegisterCaps(UUID agentID, Caps caps) | 1209 | public void TriggerOnRegisterCaps(UUID agentID, Caps caps) |
802 | { | 1210 | { |
803 | handlerRegisterCaps = OnRegisterCaps; | 1211 | RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps; |
804 | if (handlerRegisterCaps != null) | 1212 | if (handlerRegisterCaps != null) |
805 | { | 1213 | { |
806 | handlerRegisterCaps(agentID, caps); | 1214 | foreach (RegisterCapsEvent d in handlerRegisterCaps.GetInvocationList()) |
807 | } | 1215 | { |
1216 | try | ||
1217 | { | ||
1218 | d(agentID, caps); | ||
1219 | } | ||
1220 | catch (Exception e) | ||
1221 | { | ||
1222 | m_log.ErrorFormat( | ||
1223 | "[EVENT MANAGER]: Delegate for TriggerOnRegisterCaps failed - continuing. {0} {1}", | ||
1224 | e.Message, e.StackTrace); | ||
1225 | } | ||
1226 | } | ||
1227 | } | ||
808 | } | 1228 | } |
809 | 1229 | ||
810 | public void TriggerOnDeregisterCaps(UUID agentID, Caps caps) | 1230 | public void TriggerOnDeregisterCaps(UUID agentID, Caps caps) |
811 | { | 1231 | { |
812 | handlerDeregisterCaps = OnDeregisterCaps; | 1232 | DeregisterCapsEvent handlerDeregisterCaps = OnDeregisterCaps; |
813 | if (handlerDeregisterCaps != null) | 1233 | if (handlerDeregisterCaps != null) |
814 | { | 1234 | { |
815 | handlerDeregisterCaps(agentID, caps); | 1235 | foreach (DeregisterCapsEvent d in handlerDeregisterCaps.GetInvocationList()) |
816 | } | 1236 | { |
1237 | try | ||
1238 | { | ||
1239 | d(agentID, caps); | ||
1240 | } | ||
1241 | catch (Exception e) | ||
1242 | { | ||
1243 | m_log.ErrorFormat( | ||
1244 | "[EVENT MANAGER]: Delegate for TriggerOnDeregisterCaps failed - continuing. {0} {1}", | ||
1245 | e.Message, e.StackTrace); | ||
1246 | } | ||
1247 | } | ||
1248 | } | ||
817 | } | 1249 | } |
818 | 1250 | ||
819 | public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel) | 1251 | public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel) |
820 | { | 1252 | { |
821 | handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete; | 1253 | NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete; |
822 | if (handlerNewInventoryItemUpdateComplete != null) | 1254 | if (handlerNewInventoryItemUpdateComplete != null) |
823 | { | 1255 | { |
824 | handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel); | 1256 | foreach (NewInventoryItemUploadComplete d in handlerNewInventoryItemUpdateComplete.GetInvocationList()) |
825 | } | 1257 | { |
826 | } | 1258 | try |
827 | 1259 | { | |
828 | public void TriggerLandBuy(Object sender, LandBuyArgs e) | 1260 | d(agentID, AssetID, AssetName, userlevel); |
829 | { | 1261 | } |
830 | handlerLandBuy = OnLandBuy; | 1262 | catch (Exception e) |
1263 | { | ||
1264 | m_log.ErrorFormat( | ||
1265 | "[EVENT MANAGER]: Delegate for TriggerOnNewInventoryItemUploadComplete failed - continuing. {0} {1}", | ||
1266 | e.Message, e.StackTrace); | ||
1267 | } | ||
1268 | } | ||
1269 | } | ||
1270 | } | ||
1271 | |||
1272 | public void TriggerLandBuy(Object sender, LandBuyArgs args) | ||
1273 | { | ||
1274 | LandBuy handlerLandBuy = OnLandBuy; | ||
831 | if (handlerLandBuy != null) | 1275 | if (handlerLandBuy != null) |
832 | { | 1276 | { |
833 | handlerLandBuy(sender, e); | 1277 | foreach (LandBuy d in handlerLandBuy.GetInvocationList()) |
834 | } | 1278 | { |
835 | } | 1279 | try |
836 | 1280 | { | |
837 | public void TriggerValidateLandBuy(Object sender, LandBuyArgs e) | 1281 | d(sender, args); |
838 | { | 1282 | } |
839 | handlerValidateLandBuy = OnValidateLandBuy; | 1283 | catch (Exception e) |
1284 | { | ||
1285 | m_log.ErrorFormat( | ||
1286 | "[EVENT MANAGER]: Delegate for TriggerLandBuy failed - continuing. {0} {1}", | ||
1287 | e.Message, e.StackTrace); | ||
1288 | } | ||
1289 | } | ||
1290 | } | ||
1291 | } | ||
1292 | |||
1293 | public void TriggerValidateLandBuy(Object sender, LandBuyArgs args) | ||
1294 | { | ||
1295 | LandBuy handlerValidateLandBuy = OnValidateLandBuy; | ||
840 | if (handlerValidateLandBuy != null) | 1296 | if (handlerValidateLandBuy != null) |
841 | { | 1297 | { |
842 | handlerValidateLandBuy(sender, e); | 1298 | foreach (LandBuy d in handlerValidateLandBuy.GetInvocationList()) |
843 | } | 1299 | { |
1300 | try | ||
1301 | { | ||
1302 | d(sender, args); | ||
1303 | } | ||
1304 | catch (Exception e) | ||
1305 | { | ||
1306 | m_log.ErrorFormat( | ||
1307 | "[EVENT MANAGER]: Delegate for TriggerValidateLandBuy failed - continuing. {0} {1}", | ||
1308 | e.Message, e.StackTrace); | ||
1309 | } | ||
1310 | } | ||
1311 | } | ||
844 | } | 1312 | } |
845 | 1313 | ||
846 | public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos) | 1314 | public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos) |
847 | { | 1315 | { |
848 | handlerScriptAtTargetEvent = OnScriptAtTargetEvent; | 1316 | ScriptAtTargetEvent handlerScriptAtTargetEvent = OnScriptAtTargetEvent; |
849 | if (handlerScriptAtTargetEvent != null) | 1317 | if (handlerScriptAtTargetEvent != null) |
850 | { | 1318 | { |
851 | handlerScriptAtTargetEvent(localID, handle, targetpos, currentpos); | 1319 | foreach (ScriptAtTargetEvent d in handlerScriptAtTargetEvent.GetInvocationList()) |
852 | } | 1320 | { |
1321 | try | ||
1322 | { | ||
1323 | d(localID, handle, targetpos, currentpos); | ||
1324 | } | ||
1325 | catch (Exception e) | ||
1326 | { | ||
1327 | m_log.ErrorFormat( | ||
1328 | "[EVENT MANAGER]: Delegate for TriggerAtTargetEvent failed - continuing. {0} {1}", | ||
1329 | e.Message, e.StackTrace); | ||
1330 | } | ||
1331 | } | ||
1332 | } | ||
853 | } | 1333 | } |
854 | 1334 | ||
855 | public void TriggerNotAtTargetEvent(uint localID) | 1335 | public void TriggerNotAtTargetEvent(uint localID) |
856 | { | 1336 | { |
857 | handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent; | 1337 | ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent; |
858 | if (handlerScriptNotAtTargetEvent != null) | 1338 | if (handlerScriptNotAtTargetEvent != null) |
859 | { | 1339 | { |
860 | handlerScriptNotAtTargetEvent(localID); | 1340 | foreach (ScriptNotAtTargetEvent d in handlerScriptNotAtTargetEvent.GetInvocationList()) |
861 | } | 1341 | { |
1342 | try | ||
1343 | { | ||
1344 | d(localID); | ||
1345 | } | ||
1346 | catch (Exception e) | ||
1347 | { | ||
1348 | m_log.ErrorFormat( | ||
1349 | "[EVENT MANAGER]: Delegate for TriggerNotAtTargetEvent failed - continuing. {0} {1}", | ||
1350 | e.Message, e.StackTrace); | ||
1351 | } | ||
1352 | } | ||
1353 | } | ||
862 | } | 1354 | } |
863 | 1355 | ||
864 | public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) | 1356 | public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot) |
865 | { | 1357 | { |
866 | handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; | 1358 | ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent; |
867 | if (handlerScriptAtRotTargetEvent != null) | 1359 | if (handlerScriptAtRotTargetEvent != null) |
868 | { | 1360 | { |
869 | handlerScriptAtRotTargetEvent(localID, handle, targetrot, currentrot); | 1361 | foreach (ScriptAtRotTargetEvent d in handlerScriptAtRotTargetEvent.GetInvocationList()) |
870 | } | 1362 | { |
1363 | try | ||
1364 | { | ||
1365 | d(localID, handle, targetrot, currentrot); | ||
1366 | } | ||
1367 | catch (Exception e) | ||
1368 | { | ||
1369 | m_log.ErrorFormat( | ||
1370 | "[EVENT MANAGER]: Delegate for TriggerAtRotTargetEvent failed - continuing. {0} {1}", | ||
1371 | e.Message, e.StackTrace); | ||
1372 | } | ||
1373 | } | ||
1374 | } | ||
871 | } | 1375 | } |
872 | 1376 | ||
873 | public void TriggerNotAtRotTargetEvent(uint localID) | 1377 | public void TriggerNotAtRotTargetEvent(uint localID) |
874 | { | 1378 | { |
875 | handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; | 1379 | ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent; |
876 | if (handlerScriptNotAtRotTargetEvent != null) | 1380 | if (handlerScriptNotAtRotTargetEvent != null) |
877 | { | 1381 | { |
878 | handlerScriptNotAtRotTargetEvent(localID); | 1382 | foreach (ScriptNotAtRotTargetEvent d in handlerScriptNotAtRotTargetEvent.GetInvocationList()) |
879 | } | 1383 | { |
1384 | try | ||
1385 | { | ||
1386 | d(localID); | ||
1387 | } | ||
1388 | catch (Exception e) | ||
1389 | { | ||
1390 | m_log.ErrorFormat( | ||
1391 | "[EVENT MANAGER]: Delegate for TriggerNotAtRotTargetEvent failed - continuing. {0} {1}", | ||
1392 | e.Message, e.StackTrace); | ||
1393 | } | ||
1394 | } | ||
1395 | } | ||
880 | } | 1396 | } |
881 | 1397 | ||
882 | public void TriggerRequestChangeWaterHeight(float height) | 1398 | public void TriggerRequestChangeWaterHeight(float height) |
883 | { | 1399 | { |
884 | handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight; | 1400 | RequestChangeWaterHeight handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight; |
885 | if (handlerRequestChangeWaterHeight != null) | 1401 | if (handlerRequestChangeWaterHeight != null) |
886 | { | 1402 | { |
887 | handlerRequestChangeWaterHeight(height); | 1403 | foreach (RequestChangeWaterHeight d in handlerRequestChangeWaterHeight.GetInvocationList()) |
888 | } | 1404 | { |
1405 | try | ||
1406 | { | ||
1407 | d(height); | ||
1408 | } | ||
1409 | catch (Exception e) | ||
1410 | { | ||
1411 | m_log.ErrorFormat( | ||
1412 | "[EVENT MANAGER]: Delegate for TriggerRequestChangeWaterHeight failed - continuing. {0} {1}", | ||
1413 | e.Message, e.StackTrace); | ||
1414 | } | ||
1415 | } | ||
1416 | } | ||
889 | } | 1417 | } |
890 | 1418 | ||
891 | public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar) | 1419 | public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar) |
892 | { | 1420 | { |
893 | handlerAvatarKill = OnAvatarKilled; | 1421 | AvatarKillData handlerAvatarKill = OnAvatarKilled; |
894 | if (handlerAvatarKill != null) | 1422 | if (handlerAvatarKill != null) |
895 | { | 1423 | { |
896 | handlerAvatarKill(KillerObjectLocalID, DeadAvatar); | 1424 | foreach (AvatarKillData d in handlerAvatarKill.GetInvocationList()) |
897 | } | 1425 | { |
1426 | try | ||
1427 | { | ||
1428 | d(KillerObjectLocalID, DeadAvatar); | ||
1429 | } | ||
1430 | catch (Exception e) | ||
1431 | { | ||
1432 | m_log.ErrorFormat( | ||
1433 | "[EVENT MANAGER]: Delegate for TriggerAvatarKill failed - continuing. {0} {1}", | ||
1434 | e.Message, e.StackTrace); | ||
1435 | } | ||
1436 | } | ||
1437 | } | ||
898 | } | 1438 | } |
899 | 1439 | ||
900 | public void TriggerSignificantClientMovement(IClientAPI client) | 1440 | public void TriggerSignificantClientMovement(IClientAPI client) |
901 | { | 1441 | { |
902 | handlerSignificantClientMovement = OnSignificantClientMovement; | 1442 | SignificantClientMovement handlerSignificantClientMovement = OnSignificantClientMovement; |
903 | if (handlerSignificantClientMovement != null) | 1443 | if (handlerSignificantClientMovement != null) |
904 | { | 1444 | { |
905 | handlerSignificantClientMovement(client); | 1445 | foreach (SignificantClientMovement d in handlerSignificantClientMovement.GetInvocationList()) |
906 | } | 1446 | { |
1447 | try | ||
1448 | { | ||
1449 | d(client); | ||
1450 | } | ||
1451 | catch (Exception e) | ||
1452 | { | ||
1453 | m_log.ErrorFormat( | ||
1454 | "[EVENT MANAGER]: Delegate for TriggerSignificantClientMovement failed - continuing. {0} {1}", | ||
1455 | e.Message, e.StackTrace); | ||
1456 | } | ||
1457 | } | ||
1458 | } | ||
907 | } | 1459 | } |
908 | 1460 | ||
909 | public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat) | 1461 | public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat) |
910 | { | 1462 | { |
911 | handlerChatFromWorld = OnChatFromWorld; | 1463 | ChatFromWorldEvent handlerChatFromWorld = OnChatFromWorld; |
912 | if (handlerChatFromWorld != null) | 1464 | if (handlerChatFromWorld != null) |
913 | { | 1465 | { |
914 | handlerChatFromWorld(sender, chat); | 1466 | foreach (ChatFromWorldEvent d in handlerChatFromWorld.GetInvocationList()) |
915 | } | 1467 | { |
1468 | try | ||
1469 | { | ||
1470 | d(sender, chat); | ||
1471 | } | ||
1472 | catch (Exception e) | ||
1473 | { | ||
1474 | m_log.ErrorFormat( | ||
1475 | "[EVENT MANAGER]: Delegate for TriggerOnChatFromWorld failed - continuing. {0} {1}", | ||
1476 | e.Message, e.StackTrace); | ||
1477 | } | ||
1478 | } | ||
1479 | } | ||
916 | } | 1480 | } |
917 | 1481 | ||
918 | public void TriggerOnChatFromClient(Object sender, OSChatMessage chat) | 1482 | public void TriggerOnChatFromClient(Object sender, OSChatMessage chat) |
919 | { | 1483 | { |
920 | handlerChatFromClient = OnChatFromClient; | 1484 | ChatFromClientEvent handlerChatFromClient = OnChatFromClient; |
921 | if (handlerChatFromClient != null) | 1485 | if (handlerChatFromClient != null) |
922 | { | 1486 | { |
923 | handlerChatFromClient(sender, chat); | 1487 | foreach (ChatFromClientEvent d in handlerChatFromClient.GetInvocationList()) |
924 | } | 1488 | { |
1489 | try | ||
1490 | { | ||
1491 | d(sender, chat); | ||
1492 | } | ||
1493 | catch (Exception e) | ||
1494 | { | ||
1495 | m_log.ErrorFormat( | ||
1496 | "[EVENT MANAGER]: Delegate for TriggerOnChatFromClient failed - continuing. {0} {1}", | ||
1497 | e.Message, e.StackTrace); | ||
1498 | } | ||
1499 | } | ||
1500 | } | ||
925 | } | 1501 | } |
926 | 1502 | ||
927 | public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) | 1503 | public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat) |
928 | { | 1504 | { |
929 | handlerChatBroadcast = OnChatBroadcast; | 1505 | ChatBroadcastEvent handlerChatBroadcast = OnChatBroadcast; |
930 | if (handlerChatBroadcast != null) | 1506 | if (handlerChatBroadcast != null) |
931 | { | 1507 | { |
932 | handlerChatBroadcast(sender, chat); | 1508 | foreach (ChatBroadcastEvent d in handlerChatBroadcast.GetInvocationList()) |
933 | } | 1509 | { |
1510 | try | ||
1511 | { | ||
1512 | d(sender, chat); | ||
1513 | } | ||
1514 | catch (Exception e) | ||
1515 | { | ||
1516 | m_log.ErrorFormat( | ||
1517 | "[EVENT MANAGER]: Delegate for TriggerOnChatBroadcast failed - continuing. {0} {1}", | ||
1518 | e.Message, e.StackTrace); | ||
1519 | } | ||
1520 | } | ||
1521 | } | ||
934 | } | 1522 | } |
935 | 1523 | ||
936 | internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed) | 1524 | internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed) |
937 | { | 1525 | { |
938 | handlerScriptControlEvent = OnScriptControlEvent; | 1526 | ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent; |
939 | if (handlerScriptControlEvent != null) | 1527 | if (handlerScriptControlEvent != null) |
940 | { | 1528 | { |
941 | handlerScriptControlEvent(p, scriptUUID, avatarID, held, _changed); | 1529 | foreach (ScriptControlEvent d in handlerScriptControlEvent.GetInvocationList()) |
942 | } | 1530 | { |
1531 | try | ||
1532 | { | ||
1533 | d(p, scriptUUID, avatarID, held, _changed); | ||
1534 | } | ||
1535 | catch (Exception e) | ||
1536 | { | ||
1537 | m_log.ErrorFormat( | ||
1538 | "[EVENT MANAGER]: Delegate for TriggerControlEvent failed - continuing. {0} {1}", | ||
1539 | e.Message, e.StackTrace); | ||
1540 | } | ||
1541 | } | ||
1542 | } | ||
943 | } | 1543 | } |
944 | 1544 | ||
945 | public void TriggerNoticeNoLandDataFromStorage() | 1545 | public void TriggerNoticeNoLandDataFromStorage() |
946 | { | 1546 | { |
947 | handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage; | 1547 | NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage; |
948 | if (handlerNoticeNoLandDataFromStorage != null) | 1548 | if (handlerNoticeNoLandDataFromStorage != null) |
949 | { | 1549 | { |
950 | handlerNoticeNoLandDataFromStorage(); | 1550 | foreach (NoticeNoLandDataFromStorage d in handlerNoticeNoLandDataFromStorage.GetInvocationList()) |
951 | 1551 | { | |
952 | } | 1552 | try |
1553 | { | ||
1554 | d(); | ||
1555 | } | ||
1556 | catch (Exception e) | ||
1557 | { | ||
1558 | m_log.ErrorFormat( | ||
1559 | "[EVENT MANAGER]: Delegate for TriggerNoticeNoLandDataFromStorage failed - continuing. {0} {1}", | ||
1560 | e.Message, e.StackTrace); | ||
1561 | } | ||
1562 | } | ||
1563 | } | ||
953 | } | 1564 | } |
954 | 1565 | ||
955 | public void TriggerIncomingLandDataFromStorage(List<LandData> landData) | 1566 | public void TriggerIncomingLandDataFromStorage(List<LandData> landData) |
956 | { | 1567 | { |
957 | handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage; | 1568 | IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage; |
958 | if (handlerIncomingLandDataFromStorage != null) | 1569 | if (handlerIncomingLandDataFromStorage != null) |
959 | { | 1570 | { |
960 | handlerIncomingLandDataFromStorage(landData); | 1571 | foreach (IncomingLandDataFromStorage d in handlerIncomingLandDataFromStorage.GetInvocationList()) |
961 | 1572 | { | |
962 | } | 1573 | try |
1574 | { | ||
1575 | d(landData); | ||
1576 | } | ||
1577 | catch (Exception e) | ||
1578 | { | ||
1579 | m_log.ErrorFormat( | ||
1580 | "[EVENT MANAGER]: Delegate for TriggerIncomingLandDataFromStorage failed - continuing. {0} {1}", | ||
1581 | e.Message, e.StackTrace); | ||
1582 | } | ||
1583 | } | ||
1584 | } | ||
963 | } | 1585 | } |
964 | 1586 | ||
965 | public void TriggerSetAllowForcefulBan(bool allow) | 1587 | public void TriggerSetAllowForcefulBan(bool allow) |
966 | { | 1588 | { |
967 | handlerSetAllowForcefulBan = OnSetAllowForcefulBan; | 1589 | SetAllowForcefulBan handlerSetAllowForcefulBan = OnSetAllowForcefulBan; |
968 | if (handlerSetAllowForcefulBan != null) | 1590 | if (handlerSetAllowForcefulBan != null) |
969 | { | 1591 | { |
970 | handlerSetAllowForcefulBan(allow); | 1592 | foreach (SetAllowForcefulBan d in handlerSetAllowForcefulBan.GetInvocationList()) |
971 | 1593 | { | |
972 | } | 1594 | try |
1595 | { | ||
1596 | d(allow); | ||
1597 | } | ||
1598 | catch (Exception e) | ||
1599 | { | ||
1600 | m_log.ErrorFormat( | ||
1601 | "[EVENT MANAGER]: Delegate for TriggerSetAllowForcefulBan failed - continuing. {0} {1}", | ||
1602 | e.Message, e.StackTrace); | ||
1603 | } | ||
1604 | } | ||
1605 | } | ||
973 | } | 1606 | } |
974 | 1607 | ||
975 | public void TriggerRequestParcelPrimCountUpdate() | 1608 | public void TriggerRequestParcelPrimCountUpdate() |
976 | { | 1609 | { |
977 | handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate; | 1610 | RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate; |
978 | if (handlerRequestParcelPrimCountUpdate != null) | 1611 | if (handlerRequestParcelPrimCountUpdate != null) |
979 | { | 1612 | { |
980 | handlerRequestParcelPrimCountUpdate(); | 1613 | foreach (RequestParcelPrimCountUpdate d in handlerRequestParcelPrimCountUpdate.GetInvocationList()) |
981 | } | 1614 | { |
1615 | try | ||
1616 | { | ||
1617 | d(); | ||
1618 | } | ||
1619 | catch (Exception e) | ||
1620 | { | ||
1621 | m_log.ErrorFormat( | ||
1622 | "[EVENT MANAGER]: Delegate for TriggerRequestParcelPrimCountUpdate failed - continuing. {0} {1}", | ||
1623 | e.Message, e.StackTrace); | ||
1624 | } | ||
1625 | } | ||
1626 | } | ||
982 | } | 1627 | } |
983 | 1628 | ||
984 | public void TriggerParcelPrimCountTainted() | 1629 | public void TriggerParcelPrimCountTainted() |
985 | { | 1630 | { |
986 | handlerParcelPrimCountTainted = OnParcelPrimCountTainted; | 1631 | ParcelPrimCountTainted handlerParcelPrimCountTainted = OnParcelPrimCountTainted; |
987 | if (handlerParcelPrimCountTainted != null) | 1632 | if (handlerParcelPrimCountTainted != null) |
988 | { | 1633 | { |
989 | handlerParcelPrimCountTainted(); | 1634 | foreach (ParcelPrimCountTainted d in handlerParcelPrimCountTainted.GetInvocationList()) |
990 | } | 1635 | { |
1636 | try | ||
1637 | { | ||
1638 | d(); | ||
1639 | } | ||
1640 | catch (Exception e) | ||
1641 | { | ||
1642 | m_log.ErrorFormat( | ||
1643 | "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountTainted failed - continuing. {0} {1}", | ||
1644 | e.Message, e.StackTrace); | ||
1645 | } | ||
1646 | } | ||
1647 | } | ||
991 | } | 1648 | } |
992 | 1649 | ||
993 | // this lets us keep track of nasty script events like timer, etc. | 1650 | // this lets us keep track of nasty script events like timer, etc. |
@@ -1010,99 +1667,277 @@ namespace OpenSim.Region.Framework.Scenes | |||
1010 | /// <param name="FixedSunHour">The hour 0.0 <= FixedSunHour <= 24.0 at which the sun is fixed at. Sun Hour 0 is sun-rise, when Day/Night ratio is 1:1</param> | 1667 | /// <param name="FixedSunHour">The hour 0.0 <= FixedSunHour <= 24.0 at which the sun is fixed at. Sun Hour 0 is sun-rise, when Day/Night ratio is 1:1</param> |
1011 | public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour) | 1668 | public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour) |
1012 | { | 1669 | { |
1013 | handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; | 1670 | EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate; |
1014 | if (handlerEstateToolsSunUpdate != null) | 1671 | if (handlerEstateToolsSunUpdate != null) |
1015 | { | 1672 | { |
1016 | handlerEstateToolsSunUpdate(regionHandle, FixedTime, useEstateTime, FixedSunHour); | 1673 | foreach (EstateToolsSunUpdate d in handlerEstateToolsSunUpdate.GetInvocationList()) |
1017 | } | 1674 | { |
1675 | try | ||
1676 | { | ||
1677 | d(regionHandle, FixedTime, useEstateTime, FixedSunHour); | ||
1678 | } | ||
1679 | catch (Exception e) | ||
1680 | { | ||
1681 | m_log.ErrorFormat( | ||
1682 | "[EVENT MANAGER]: Delegate for TriggerEstateToolsSunUpdate failed - continuing. {0} {1}", | ||
1683 | e.Message, e.StackTrace); | ||
1684 | } | ||
1685 | } | ||
1686 | } | ||
1018 | } | 1687 | } |
1019 | 1688 | ||
1020 | public float GetCurrentTimeAsSunLindenHour() | 1689 | public float GetCurrentTimeAsSunLindenHour() |
1021 | { | 1690 | { |
1022 | handlerCurrentTimeAsLindenSunHour = OnGetCurrentTimeAsLindenSunHour; | 1691 | SunLindenHour handlerCurrentTimeAsLindenSunHour = OnGetCurrentTimeAsLindenSunHour; |
1023 | if (handlerCurrentTimeAsLindenSunHour != null) | 1692 | if (handlerCurrentTimeAsLindenSunHour != null) |
1024 | { | 1693 | { |
1025 | return handlerCurrentTimeAsLindenSunHour(); | 1694 | foreach (SunLindenHour d in handlerCurrentTimeAsLindenSunHour.GetInvocationList()) |
1695 | { | ||
1696 | try | ||
1697 | { | ||
1698 | return d(); | ||
1699 | } | ||
1700 | catch (Exception e) | ||
1701 | { | ||
1702 | m_log.ErrorFormat( | ||
1703 | "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}", | ||
1704 | e.Message, e.StackTrace); | ||
1705 | } | ||
1706 | } | ||
1026 | } | 1707 | } |
1708 | |||
1027 | return 6; | 1709 | return 6; |
1028 | } | 1710 | } |
1029 | 1711 | ||
1030 | public void TriggerOarFileLoaded(Guid requestId, string message) | 1712 | public void TriggerOarFileLoaded(Guid requestId, string message) |
1031 | { | 1713 | { |
1032 | handlerOarFileLoaded = OnOarFileLoaded; | 1714 | OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded; |
1033 | if (handlerOarFileLoaded != null) | 1715 | if (handlerOarFileLoaded != null) |
1034 | handlerOarFileLoaded(requestId, message); | 1716 | { |
1717 | foreach (OarFileLoaded d in handlerOarFileLoaded.GetInvocationList()) | ||
1718 | { | ||
1719 | try | ||
1720 | { | ||
1721 | d(requestId, message); | ||
1722 | } | ||
1723 | catch (Exception e) | ||
1724 | { | ||
1725 | m_log.ErrorFormat( | ||
1726 | "[EVENT MANAGER]: Delegate for TriggerOarFileLoaded failed - continuing. {0} {1}", | ||
1727 | e.Message, e.StackTrace); | ||
1728 | } | ||
1729 | } | ||
1730 | } | ||
1035 | } | 1731 | } |
1036 | 1732 | ||
1037 | public void TriggerOarFileSaved(Guid requestId, string message) | 1733 | public void TriggerOarFileSaved(Guid requestId, string message) |
1038 | { | 1734 | { |
1039 | handlerOarFileSaved = OnOarFileSaved; | 1735 | OarFileSaved handlerOarFileSaved = OnOarFileSaved; |
1040 | if (handlerOarFileSaved != null) | 1736 | if (handlerOarFileSaved != null) |
1041 | handlerOarFileSaved(requestId, message); | 1737 | { |
1738 | foreach (OarFileSaved d in handlerOarFileSaved.GetInvocationList()) | ||
1739 | { | ||
1740 | try | ||
1741 | { | ||
1742 | d(requestId, message); | ||
1743 | } | ||
1744 | catch (Exception e) | ||
1745 | { | ||
1746 | m_log.ErrorFormat( | ||
1747 | "[EVENT MANAGER]: Delegate for TriggerOarFileSaved failed - continuing. {0} {1}", | ||
1748 | e.Message, e.StackTrace); | ||
1749 | } | ||
1750 | } | ||
1751 | } | ||
1042 | } | 1752 | } |
1043 | 1753 | ||
1044 | public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message) | 1754 | public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message) |
1045 | { | 1755 | { |
1046 | handlerEmptyScriptCompileQueue = OnEmptyScriptCompileQueue; | 1756 | EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = OnEmptyScriptCompileQueue; |
1047 | if (handlerEmptyScriptCompileQueue != null) | 1757 | if (handlerEmptyScriptCompileQueue != null) |
1048 | handlerEmptyScriptCompileQueue(numScriptsFailed, message); | 1758 | { |
1759 | foreach (EmptyScriptCompileQueue d in handlerEmptyScriptCompileQueue.GetInvocationList()) | ||
1760 | { | ||
1761 | try | ||
1762 | { | ||
1763 | d(numScriptsFailed, message); | ||
1764 | } | ||
1765 | catch (Exception e) | ||
1766 | { | ||
1767 | m_log.ErrorFormat( | ||
1768 | "[EVENT MANAGER]: Delegate for TriggerEmptyScriptCompileQueue failed - continuing. {0} {1}", | ||
1769 | e.Message, e.StackTrace); | ||
1770 | } | ||
1771 | } | ||
1772 | } | ||
1049 | } | 1773 | } |
1050 | 1774 | ||
1051 | public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders) | 1775 | public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders) |
1052 | { | 1776 | { |
1053 | handlerCollidingStart = OnScriptColliderStart; | 1777 | ScriptColliding handlerCollidingStart = OnScriptColliderStart; |
1054 | if (handlerCollidingStart != null) | 1778 | if (handlerCollidingStart != null) |
1055 | handlerCollidingStart(localId, colliders); | 1779 | { |
1780 | foreach (ScriptColliding d in handlerCollidingStart.GetInvocationList()) | ||
1781 | { | ||
1782 | try | ||
1783 | { | ||
1784 | d(localId, colliders); | ||
1785 | } | ||
1786 | catch (Exception e) | ||
1787 | { | ||
1788 | m_log.ErrorFormat( | ||
1789 | "[EVENT MANAGER]: Delegate for TriggerScriptCollidingStart failed - continuing. {0} {1}", | ||
1790 | e.Message, e.StackTrace); | ||
1791 | } | ||
1792 | } | ||
1793 | } | ||
1056 | } | 1794 | } |
1057 | 1795 | ||
1058 | public void TriggerScriptColliding(uint localId, ColliderArgs colliders) | 1796 | public void TriggerScriptColliding(uint localId, ColliderArgs colliders) |
1059 | { | 1797 | { |
1060 | handlerColliding = OnScriptColliding; | 1798 | ScriptColliding handlerColliding = OnScriptColliding; |
1061 | if (handlerColliding != null) | 1799 | if (handlerColliding != null) |
1062 | handlerColliding(localId, colliders); | 1800 | { |
1801 | foreach (ScriptColliding d in handlerColliding.GetInvocationList()) | ||
1802 | { | ||
1803 | try | ||
1804 | { | ||
1805 | d(localId, colliders); | ||
1806 | } | ||
1807 | catch (Exception e) | ||
1808 | { | ||
1809 | m_log.ErrorFormat( | ||
1810 | "[EVENT MANAGER]: Delegate for TriggerScriptColliding failed - continuing. {0} {1}", | ||
1811 | e.Message, e.StackTrace); | ||
1812 | } | ||
1813 | } | ||
1814 | } | ||
1063 | } | 1815 | } |
1064 | 1816 | ||
1065 | public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders) | 1817 | public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders) |
1066 | { | 1818 | { |
1067 | handlerCollidingEnd = OnScriptCollidingEnd; | 1819 | ScriptColliding handlerCollidingEnd = OnScriptCollidingEnd; |
1068 | if (handlerCollidingEnd != null) | 1820 | if (handlerCollidingEnd != null) |
1069 | handlerCollidingEnd(localId, colliders); | 1821 | { |
1822 | foreach (ScriptColliding d in handlerCollidingEnd.GetInvocationList()) | ||
1823 | { | ||
1824 | try | ||
1825 | { | ||
1826 | d(localId, colliders); | ||
1827 | } | ||
1828 | catch (Exception e) | ||
1829 | { | ||
1830 | m_log.ErrorFormat( | ||
1831 | "[EVENT MANAGER]: Delegate for TriggerScriptCollidingEnd failed - continuing. {0} {1}", | ||
1832 | e.Message, e.StackTrace); | ||
1833 | } | ||
1834 | } | ||
1835 | } | ||
1070 | } | 1836 | } |
1071 | 1837 | ||
1072 | public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders) | 1838 | public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders) |
1073 | { | 1839 | { |
1074 | handlerLandCollidingStart = OnScriptLandColliderStart; | 1840 | ScriptColliding handlerLandCollidingStart = OnScriptLandColliderStart; |
1075 | if (handlerLandCollidingStart != null) | 1841 | if (handlerLandCollidingStart != null) |
1076 | handlerLandCollidingStart(localId, colliders); | 1842 | { |
1843 | foreach (ScriptColliding d in handlerLandCollidingStart.GetInvocationList()) | ||
1844 | { | ||
1845 | try | ||
1846 | { | ||
1847 | d(localId, colliders); | ||
1848 | } | ||
1849 | catch (Exception e) | ||
1850 | { | ||
1851 | m_log.ErrorFormat( | ||
1852 | "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingStart failed - continuing. {0} {1}", | ||
1853 | e.Message, e.StackTrace); | ||
1854 | } | ||
1855 | } | ||
1856 | } | ||
1077 | } | 1857 | } |
1078 | 1858 | ||
1079 | public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders) | 1859 | public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders) |
1080 | { | 1860 | { |
1081 | handlerLandColliding = OnScriptLandColliding; | 1861 | ScriptColliding handlerLandColliding = OnScriptLandColliding; |
1082 | if (handlerLandColliding != null) | 1862 | if (handlerLandColliding != null) |
1083 | handlerLandColliding(localId, colliders); | 1863 | { |
1864 | foreach (ScriptColliding d in handlerLandColliding.GetInvocationList()) | ||
1865 | { | ||
1866 | try | ||
1867 | { | ||
1868 | d(localId, colliders); | ||
1869 | } | ||
1870 | catch (Exception e) | ||
1871 | { | ||
1872 | m_log.ErrorFormat( | ||
1873 | "[EVENT MANAGER]: Delegate for TriggerScriptLandColliding failed - continuing. {0} {1}", | ||
1874 | e.Message, e.StackTrace); | ||
1875 | } | ||
1876 | } | ||
1877 | } | ||
1084 | } | 1878 | } |
1085 | 1879 | ||
1086 | public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders) | 1880 | public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders) |
1087 | { | 1881 | { |
1088 | handlerLandCollidingEnd = OnScriptLandColliderEnd; | 1882 | ScriptColliding handlerLandCollidingEnd = OnScriptLandColliderEnd; |
1089 | if (handlerLandCollidingEnd != null) | 1883 | if (handlerLandCollidingEnd != null) |
1090 | handlerLandCollidingEnd(localId, colliders); | 1884 | { |
1885 | foreach (ScriptColliding d in handlerLandCollidingEnd.GetInvocationList()) | ||
1886 | { | ||
1887 | try | ||
1888 | { | ||
1889 | d(localId, colliders); | ||
1890 | } | ||
1891 | catch (Exception e) | ||
1892 | { | ||
1893 | m_log.ErrorFormat( | ||
1894 | "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingEnd failed - continuing. {0} {1}", | ||
1895 | e.Message, e.StackTrace); | ||
1896 | } | ||
1897 | } | ||
1898 | } | ||
1091 | } | 1899 | } |
1092 | 1900 | ||
1093 | public void TriggerSetRootAgentScene(UUID agentID, Scene scene) | 1901 | public void TriggerSetRootAgentScene(UUID agentID, Scene scene) |
1094 | { | 1902 | { |
1095 | handlerSetRootAgentScene = OnSetRootAgentScene; | 1903 | OnSetRootAgentSceneDelegate handlerSetRootAgentScene = OnSetRootAgentScene; |
1096 | if (handlerSetRootAgentScene != null) | 1904 | if (handlerSetRootAgentScene != null) |
1097 | handlerSetRootAgentScene(agentID, scene); | 1905 | { |
1906 | foreach (OnSetRootAgentSceneDelegate d in handlerSetRootAgentScene.GetInvocationList()) | ||
1907 | { | ||
1908 | try | ||
1909 | { | ||
1910 | d(agentID, scene); | ||
1911 | } | ||
1912 | catch (Exception e) | ||
1913 | { | ||
1914 | m_log.ErrorFormat( | ||
1915 | "[EVENT MANAGER]: Delegate for TriggerSetRootAgentScene failed - continuing. {0} {1}", | ||
1916 | e.Message, e.StackTrace); | ||
1917 | } | ||
1918 | } | ||
1919 | } | ||
1098 | } | 1920 | } |
1099 | 1921 | ||
1100 | public void TriggerOnRegionUp(GridRegion otherRegion) | 1922 | public void TriggerOnRegionUp(GridRegion otherRegion) |
1101 | { | 1923 | { |
1102 | handlerOnRegionUp = OnRegionUp; | 1924 | RegionUp handlerOnRegionUp = OnRegionUp; |
1103 | if (handlerOnRegionUp != null) | 1925 | if (handlerOnRegionUp != null) |
1104 | handlerOnRegionUp(otherRegion); | 1926 | { |
1927 | foreach (RegionUp d in handlerOnRegionUp.GetInvocationList()) | ||
1928 | { | ||
1929 | try | ||
1930 | { | ||
1931 | d(otherRegion); | ||
1932 | } | ||
1933 | catch (Exception e) | ||
1934 | { | ||
1935 | m_log.ErrorFormat( | ||
1936 | "[EVENT MANAGER]: Delegate for TriggerOnRegionUp failed - continuing. {0} {1}", | ||
1937 | e.Message, e.StackTrace); | ||
1938 | } | ||
1939 | } | ||
1940 | } | ||
1105 | } | 1941 | } |
1106 | |||
1107 | } | 1942 | } |
1108 | } | 1943 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 45806dd..e032a07 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -197,7 +197,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
197 | 197 | ||
198 | if (isScriptRunning) | 198 | if (isScriptRunning) |
199 | { | 199 | { |
200 | part.Inventory.RemoveScriptInstance(item.ItemID); | 200 | part.Inventory.RemoveScriptInstance(item.ItemID, false); |
201 | } | 201 | } |
202 | 202 | ||
203 | // Update item with new asset | 203 | // Update item with new asset |
@@ -794,8 +794,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
794 | 794 | ||
795 | if (item.Type == 10) | 795 | if (item.Type == 10) |
796 | { | 796 | { |
797 | part.RemoveScriptEvents(itemID); | ||
797 | EventManager.TriggerRemoveScript(localID, itemID); | 798 | EventManager.TriggerRemoveScript(localID, itemID); |
798 | } | 799 | } |
800 | |||
799 | group.RemoveInventoryItem(localID, itemID); | 801 | group.RemoveInventoryItem(localID, itemID); |
800 | part.GetProperties(remoteClient); | 802 | part.GetProperties(remoteClient); |
801 | } | 803 | } |
@@ -1879,9 +1881,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1879 | } | 1881 | } |
1880 | } | 1882 | } |
1881 | 1883 | ||
1882 | public void AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent) | 1884 | /// <summary> |
1885 | /// Attach an object. | ||
1886 | /// </summary> | ||
1887 | /// <param name="controllingClient"></param> | ||
1888 | /// <param name="localID"></param> | ||
1889 | /// <param name="attachPoint"></param> | ||
1890 | /// <param name="rot"></param> | ||
1891 | /// <param name="pos"></param> | ||
1892 | /// <param name="silent"></param> | ||
1893 | /// <returns>true if the object was successfully attached, false otherwise</returns> | ||
1894 | public bool AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent) | ||
1883 | { | 1895 | { |
1884 | m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent); | 1896 | return m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent); |
1885 | } | 1897 | } |
1886 | 1898 | ||
1887 | public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) | 1899 | public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 342b3c5..bc10230 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -292,6 +292,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
292 | } | 292 | } |
293 | } | 293 | } |
294 | 294 | ||
295 | public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | ||
296 | { | ||
297 | List<EntityBase> EntityList = GetEntities(); | ||
298 | |||
299 | SurfaceTouchEventArgs surfaceArg = null; | ||
300 | if (surfaceArgs != null && surfaceArgs.Count > 0) | ||
301 | surfaceArg = surfaceArgs[0]; | ||
302 | |||
303 | foreach (EntityBase ent in EntityList) | ||
304 | { | ||
305 | if (ent is SceneObjectGroup) | ||
306 | { | ||
307 | SceneObjectGroup obj = ent as SceneObjectGroup; | ||
308 | if (obj != null) | ||
309 | { | ||
310 | // Is this prim part of the group | ||
311 | if (obj.HasChildPrim(objectID)) | ||
312 | { | ||
313 | SceneObjectPart part = obj.GetChildPart(objectID); | ||
314 | |||
315 | // If the touched prim handles touches, deliver it | ||
316 | // If not, deliver to root prim | ||
317 | if ((part.ScriptEvents & scriptEvents.touch) != 0) | ||
318 | EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); | ||
319 | // Deliver to the root prim if the touched prim doesn't handle touches | ||
320 | // or if we're meant to pass on touches anyway. Don't send to root prim | ||
321 | // if prim touched is the root prim as we just did it | ||
322 | if (((part.ScriptEvents & scriptEvents.touch) == 0) || | ||
323 | (part.PassTouches && (part.LocalId != obj.RootPart.LocalId))) | ||
324 | { | ||
325 | EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg); | ||
326 | } | ||
327 | |||
328 | return; | ||
329 | } | ||
330 | } | ||
331 | } | ||
332 | } | ||
333 | } | ||
334 | |||
295 | public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | 335 | public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) |
296 | { | 336 | { |
297 | List<EntityBase> EntityList = GetEntities(); | 337 | List<EntityBase> EntityList = GetEntities(); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f800d5f..f109589 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1102,7 +1102,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1102 | { | 1102 | { |
1103 | if (ent is SceneObjectGroup) | 1103 | if (ent is SceneObjectGroup) |
1104 | { | 1104 | { |
1105 | ((SceneObjectGroup) ent).RemoveScriptInstances(); | 1105 | ((SceneObjectGroup) ent).RemoveScriptInstances(false); |
1106 | } | 1106 | } |
1107 | } | 1107 | } |
1108 | } | 1108 | } |
@@ -1977,13 +1977,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1977 | /// <param name="silent">Suppress broadcasting changes to other clients.</param> | 1977 | /// <param name="silent">Suppress broadcasting changes to other clients.</param> |
1978 | public void DeleteSceneObject(SceneObjectGroup group, bool silent) | 1978 | public void DeleteSceneObject(SceneObjectGroup group, bool silent) |
1979 | { | 1979 | { |
1980 | // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); | ||
1981 | |||
1980 | //SceneObjectPart rootPart = group.GetChildPart(group.UUID); | 1982 | //SceneObjectPart rootPart = group.GetChildPart(group.UUID); |
1981 | 1983 | ||
1982 | // Serialise calls to RemoveScriptInstances to avoid | 1984 | // Serialise calls to RemoveScriptInstances to avoid |
1983 | // deadlocking on m_parts inside SceneObjectGroup | 1985 | // deadlocking on m_parts inside SceneObjectGroup |
1984 | lock (m_deleting_scene_object) | 1986 | lock (m_deleting_scene_object) |
1985 | { | 1987 | { |
1986 | group.RemoveScriptInstances(); | 1988 | group.RemoveScriptInstances(true); |
1987 | } | 1989 | } |
1988 | 1990 | ||
1989 | foreach (SceneObjectPart part in group.Children.Values) | 1991 | foreach (SceneObjectPart part in group.Children.Values) |
@@ -2011,6 +2013,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2011 | } | 2013 | } |
2012 | 2014 | ||
2013 | group.DeleteGroup(silent); | 2015 | group.DeleteGroup(silent); |
2016 | |||
2017 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | ||
2014 | } | 2018 | } |
2015 | 2019 | ||
2016 | /// <summary> | 2020 | /// <summary> |
@@ -2539,6 +2543,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2539 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; | 2543 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; |
2540 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; | 2544 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; |
2541 | client.OnGrabObject += ProcessObjectGrab; | 2545 | client.OnGrabObject += ProcessObjectGrab; |
2546 | client.OnGrabUpdate += ProcessObjectGrabUpdate; | ||
2542 | client.OnDeGrabObject += ProcessObjectDeGrab; | 2547 | client.OnDeGrabObject += ProcessObjectDeGrab; |
2543 | client.OnUndo += m_sceneGraph.HandleUndo; | 2548 | client.OnUndo += m_sceneGraph.HandleUndo; |
2544 | client.OnObjectDescription += m_sceneGraph.PrimDescription; | 2549 | client.OnObjectDescription += m_sceneGraph.PrimDescription; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index fbd11c6..7bd4329 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -479,25 +479,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
479 | if (part == null) | 479 | if (part == null) |
480 | return; | 480 | return; |
481 | 481 | ||
482 | if (!m_parentScene.Permissions.CanTakeObject( | 482 | if (!m_parentScene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId)) |
483 | part.UUID, remoteClient.AgentId)) | ||
484 | return; | 483 | return; |
485 | 484 | ||
486 | // Calls attach with a Zero position | 485 | // Calls attach with a Zero position |
487 | AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false); | 486 | if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false)) |
488 | m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); | ||
489 | |||
490 | // Save avatar attachment information | ||
491 | ScenePresence presence; | ||
492 | if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence)) | ||
493 | { | 487 | { |
494 | m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", AttachmentPoint: " + AttachmentPt); | 488 | m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); |
495 | m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 489 | |
490 | // Save avatar attachment information | ||
491 | ScenePresence presence; | ||
492 | if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence)) | ||
493 | { | ||
494 | m_log.Info( | ||
495 | "[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | ||
496 | + ", AttachmentPoint: " + AttachmentPt); | ||
497 | |||
498 | m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
499 | } | ||
496 | } | 500 | } |
497 | } | 501 | } |
498 | 502 | ||
499 | public SceneObjectGroup RezSingleAttachment( | 503 | /// <summary> |
500 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 504 | /// Rez an attachment |
505 | /// </summary> | ||
506 | /// <param name="remoteClient"></param> | ||
507 | /// <param name="itemID"></param> | ||
508 | /// <param name="AttachmentPt"></param> | ||
509 | /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> | ||
510 | public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
501 | { | 511 | { |
502 | IInventoryAccessModule invAccess = m_parentScene.RequestModuleInterface<IInventoryAccessModule>(); | 512 | IInventoryAccessModule invAccess = m_parentScene.RequestModuleInterface<IInventoryAccessModule>(); |
503 | if (invAccess != null) | 513 | if (invAccess != null) |
@@ -560,7 +570,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
560 | } | 570 | } |
561 | } | 571 | } |
562 | 572 | ||
563 | protected internal void AttachObject( | 573 | /// <summary> |
574 | /// Attach a scene object to an avatar. | ||
575 | /// </summary> | ||
576 | /// <param name="remoteClient"></param> | ||
577 | /// <param name="objectLocalID"></param> | ||
578 | /// <param name="AttachmentPt"></param> | ||
579 | /// <param name="rot"></param> | ||
580 | /// <param name="attachPos"></param> | ||
581 | /// <param name="silent"></param> | ||
582 | /// <returns>true if the attachment was successful, false otherwise</returns> | ||
583 | protected internal bool AttachObject( | ||
564 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) | 584 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) |
565 | { | 585 | { |
566 | SceneObjectGroup group = GetGroupByPrim(objectLocalID); | 586 | SceneObjectGroup group = GetGroupByPrim(objectLocalID); |
@@ -589,10 +609,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
589 | // Stick it on left hand with Zero Offset from the attachment point. | 609 | // Stick it on left hand with Zero Offset from the attachment point. |
590 | AttachmentPt = (uint)AttachmentPoint.LeftHand; | 610 | AttachmentPt = (uint)AttachmentPoint.LeftHand; |
591 | attachPos = Vector3.Zero; | 611 | attachPos = Vector3.Zero; |
592 | |||
593 | } | 612 | } |
594 | 613 | ||
595 | |||
596 | group.SetAttachmentPoint((byte)AttachmentPt); | 614 | group.SetAttachmentPoint((byte)AttachmentPt); |
597 | group.AbsolutePosition = attachPos; | 615 | group.AbsolutePosition = attachPos; |
598 | 616 | ||
@@ -615,15 +633,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
615 | // it get cleaned up | 633 | // it get cleaned up |
616 | // | 634 | // |
617 | group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); | 635 | group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); |
618 | group.HasGroupChanged = false; | 636 | group.HasGroupChanged = false; |
619 | } | 637 | } |
620 | else | 638 | else |
621 | { | 639 | { |
622 | remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false); | 640 | remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false); |
641 | return false; | ||
623 | } | 642 | } |
624 | } | 643 | } |
625 | else | 644 | else |
645 | { | ||
626 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID); | 646 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID); |
647 | return false; | ||
648 | } | ||
649 | |||
650 | return true; | ||
627 | } | 651 | } |
628 | 652 | ||
629 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) | 653 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 5a06bdb..71354b4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -74,13 +74,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
74 | /// <summary> | 74 | /// <summary> |
75 | /// Stop the scripts contained in all the prims in this group | 75 | /// Stop the scripts contained in all the prims in this group |
76 | /// </summary> | 76 | /// </summary> |
77 | public void RemoveScriptInstances() | 77 | /// <param name="sceneObjectBeingDeleted"> |
78 | /// Should be true if these scripts are being removed because the scene | ||
79 | /// object is being deleted. This will prevent spurious updates to the client. | ||
80 | /// </param> | ||
81 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) | ||
78 | { | 82 | { |
79 | lock (m_parts) | 83 | lock (m_parts) |
80 | { | 84 | { |
81 | foreach (SceneObjectPart part in m_parts.Values) | 85 | foreach (SceneObjectPart part in m_parts.Values) |
82 | { | 86 | { |
83 | part.Inventory.RemoveScriptInstances(); | 87 | part.Inventory.RemoveScriptInstances(sceneObjectBeingDeleted); |
84 | } | 88 | } |
85 | } | 89 | } |
86 | } | 90 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ec41ac7..8c56870 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -235,6 +235,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
235 | set { m_rootPart.GroupID = value; } | 235 | set { m_rootPart.GroupID = value; } |
236 | } | 236 | } |
237 | 237 | ||
238 | /// <value> | ||
239 | /// The parts of this scene object group. You must lock this property before using it. | ||
240 | /// </value> | ||
238 | public Dictionary<UUID, SceneObjectPart> Children | 241 | public Dictionary<UUID, SceneObjectPart> Children |
239 | { | 242 | { |
240 | get { return m_parts; } | 243 | get { return m_parts; } |
@@ -2097,7 +2100,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2097 | } | 2100 | } |
2098 | 2101 | ||
2099 | /// <summary> | 2102 | /// <summary> |
2100 | /// Get a child part with a given UUID | 2103 | /// Get a part with a given UUID |
2101 | /// </summary> | 2104 | /// </summary> |
2102 | /// <param name="primID"></param> | 2105 | /// <param name="primID"></param> |
2103 | /// <returns>null if a child part with the primID was not found</returns> | 2106 | /// <returns>null if a child part with the primID was not found</returns> |
@@ -2112,7 +2115,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2112 | } | 2115 | } |
2113 | 2116 | ||
2114 | /// <summary> | 2117 | /// <summary> |
2115 | /// Get a child part with a given local ID | 2118 | /// Get a part with a given local ID |
2116 | /// </summary> | 2119 | /// </summary> |
2117 | /// <param name="localID"></param> | 2120 | /// <param name="localID"></param> |
2118 | /// <returns>null if a child part with the local ID was not found</returns> | 2121 | /// <returns>null if a child part with the local ID was not found</returns> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 56b2f13..dd797fc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -90,12 +90,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
90 | SCALE = 0x40 | 90 | SCALE = 0x40 |
91 | } | 91 | } |
92 | 92 | ||
93 | public enum PrimType : int | ||
94 | { | ||
95 | BOX = 0, | ||
96 | CYLINDER = 1, | ||
97 | PRISM = 2, | ||
98 | SPHERE = 3, | ||
99 | TORUS = 4, | ||
100 | TUBE = 5, | ||
101 | RING = 6, | ||
102 | SCULPT = 7 | ||
103 | } | ||
104 | |||
93 | #endregion Enumerations | 105 | #endregion Enumerations |
94 | 106 | ||
95 | public class SceneObjectPart : IScriptHost | 107 | public class SceneObjectPart : IScriptHost |
96 | { | 108 | { |
109 | /// <value> | ||
110 | /// Denote all sides of the prim | ||
111 | /// </value> | ||
112 | public const int ALL_SIDES = -1; | ||
113 | |||
97 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 114 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
98 | 115 | ||
116 | /// <value> | ||
117 | /// Is this sop a root part? | ||
118 | /// </value> | ||
119 | [XmlIgnore] | ||
120 | public bool IsRoot | ||
121 | { | ||
122 | get { return ParentGroup.RootPart == this; } | ||
123 | } | ||
124 | |||
99 | // use only one serializer to give the runtime a chance to optimize it (it won't do that if you | 125 | // use only one serializer to give the runtime a chance to optimize it (it won't do that if you |
100 | // use a new instance every time) | 126 | // use a new instance every time) |
101 | private static XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); | 127 | private static XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); |
@@ -737,6 +763,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
737 | } | 763 | } |
738 | } | 764 | } |
739 | 765 | ||
766 | /// <value> | ||
767 | /// Text color. | ||
768 | /// </value> | ||
740 | public Color Color | 769 | public Color Color |
741 | { | 770 | { |
742 | get { return m_color; } | 771 | get { return m_color; } |
@@ -1901,7 +1930,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1901 | foreach (uint localId in startedColliders) | 1930 | foreach (uint localId in startedColliders) |
1902 | { | 1931 | { |
1903 | if (localId == 0) | 1932 | if (localId == 0) |
1904 | return; | 1933 | continue; |
1905 | // always running this check because if the user deletes the object it would return a null reference. | 1934 | // always running this check because if the user deletes the object it would return a null reference. |
1906 | if (m_parentGroup == null) | 1935 | if (m_parentGroup == null) |
1907 | return; | 1936 | return; |
@@ -2037,7 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2037 | { | 2066 | { |
2038 | // always running this check because if the user deletes the object it would return a null reference. | 2067 | // always running this check because if the user deletes the object it would return a null reference. |
2039 | if (localId == 0) | 2068 | if (localId == 0) |
2040 | return; | 2069 | continue; |
2041 | 2070 | ||
2042 | if (m_parentGroup == null) | 2071 | if (m_parentGroup == null) |
2043 | return; | 2072 | return; |
@@ -2169,7 +2198,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2169 | foreach (uint localId in endedColliders) | 2198 | foreach (uint localId in endedColliders) |
2170 | { | 2199 | { |
2171 | if (localId == 0) | 2200 | if (localId == 0) |
2172 | return; | 2201 | continue; |
2173 | 2202 | ||
2174 | // always running this check because if the user deletes the object it would return a null reference. | 2203 | // always running this check because if the user deletes the object it would return a null reference. |
2175 | if (m_parentGroup == null) | 2204 | if (m_parentGroup == null) |
@@ -2479,7 +2508,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2479 | //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString()); | 2508 | //m_log.Debug("prev: " + prevflag.ToString() + " curr: " + Flags.ToString()); |
2480 | //ScheduleFullUpdate(); | 2509 | //ScheduleFullUpdate(); |
2481 | } | 2510 | } |
2482 | 2511 | ||
2483 | public void RemoveScriptEvents(UUID scriptid) | 2512 | public void RemoveScriptEvents(UUID scriptid) |
2484 | { | 2513 | { |
2485 | lock (m_scriptEvents) | 2514 | lock (m_scriptEvents) |
@@ -2533,6 +2562,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2533 | /// </summary> | 2562 | /// </summary> |
2534 | public void ScheduleFullUpdate() | 2563 | public void ScheduleFullUpdate() |
2535 | { | 2564 | { |
2565 | // m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); | ||
2566 | |||
2536 | if (m_parentGroup != null) | 2567 | if (m_parentGroup != null) |
2537 | { | 2568 | { |
2538 | m_parentGroup.QueueForUpdateCheck(); | 2569 | m_parentGroup.QueueForUpdateCheck(); |
@@ -2953,6 +2984,178 @@ namespace OpenSim.Region.Framework.Scenes | |||
2953 | } | 2984 | } |
2954 | } | 2985 | } |
2955 | 2986 | ||
2987 | /// <summary> | ||
2988 | /// Set the color of prim faces | ||
2989 | /// </summary> | ||
2990 | /// <param name="color"></param> | ||
2991 | /// <param name="face"></param> | ||
2992 | public void SetFaceColor(Vector3 color, int face) | ||
2993 | { | ||
2994 | Primitive.TextureEntry tex = Shape.Textures; | ||
2995 | Color4 texcolor; | ||
2996 | if (face >= 0 && face < GetNumberOfSides()) | ||
2997 | { | ||
2998 | texcolor = tex.CreateFace((uint)face).RGBA; | ||
2999 | texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); | ||
3000 | texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); | ||
3001 | texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); | ||
3002 | tex.FaceTextures[face].RGBA = texcolor; | ||
3003 | UpdateTexture(tex); | ||
3004 | return; | ||
3005 | } | ||
3006 | else if (face == ALL_SIDES) | ||
3007 | { | ||
3008 | for (uint i = 0; i < GetNumberOfSides(); i++) | ||
3009 | { | ||
3010 | if (tex.FaceTextures[i] != null) | ||
3011 | { | ||
3012 | texcolor = tex.FaceTextures[i].RGBA; | ||
3013 | texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); | ||
3014 | texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); | ||
3015 | texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); | ||
3016 | tex.FaceTextures[i].RGBA = texcolor; | ||
3017 | } | ||
3018 | texcolor = tex.DefaultTexture.RGBA; | ||
3019 | texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); | ||
3020 | texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); | ||
3021 | texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); | ||
3022 | tex.DefaultTexture.RGBA = texcolor; | ||
3023 | } | ||
3024 | UpdateTexture(tex); | ||
3025 | return; | ||
3026 | } | ||
3027 | } | ||
3028 | |||
3029 | /// <summary> | ||
3030 | /// Get the number of sides that this part has. | ||
3031 | /// </summary> | ||
3032 | /// <returns></returns> | ||
3033 | public int GetNumberOfSides() | ||
3034 | { | ||
3035 | int ret = 0; | ||
3036 | bool hasCut; | ||
3037 | bool hasHollow; | ||
3038 | bool hasDimple; | ||
3039 | bool hasProfileCut; | ||
3040 | |||
3041 | PrimType primType = GetPrimType(); | ||
3042 | HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); | ||
3043 | |||
3044 | switch (primType) | ||
3045 | { | ||
3046 | case PrimType.BOX: | ||
3047 | ret = 6; | ||
3048 | if (hasCut) ret += 2; | ||
3049 | if (hasHollow) ret += 1; | ||
3050 | break; | ||
3051 | case PrimType.CYLINDER: | ||
3052 | ret = 3; | ||
3053 | if (hasCut) ret += 2; | ||
3054 | if (hasHollow) ret += 1; | ||
3055 | break; | ||
3056 | case PrimType.PRISM: | ||
3057 | ret = 5; | ||
3058 | if (hasCut) ret += 2; | ||
3059 | if (hasHollow) ret += 1; | ||
3060 | break; | ||
3061 | case PrimType.SPHERE: | ||
3062 | ret = 1; | ||
3063 | if (hasCut) ret += 2; | ||
3064 | if (hasDimple) ret += 2; | ||
3065 | if (hasHollow) ret += 1; | ||
3066 | break; | ||
3067 | case PrimType.TORUS: | ||
3068 | ret = 1; | ||
3069 | if (hasCut) ret += 2; | ||
3070 | if (hasProfileCut) ret += 2; | ||
3071 | if (hasHollow) ret += 1; | ||
3072 | break; | ||
3073 | case PrimType.TUBE: | ||
3074 | ret = 4; | ||
3075 | if (hasCut) ret += 2; | ||
3076 | if (hasProfileCut) ret += 2; | ||
3077 | if (hasHollow) ret += 1; | ||
3078 | break; | ||
3079 | case PrimType.RING: | ||
3080 | ret = 3; | ||
3081 | if (hasCut) ret += 2; | ||
3082 | if (hasProfileCut) ret += 2; | ||
3083 | if (hasHollow) ret += 1; | ||
3084 | break; | ||
3085 | case PrimType.SCULPT: | ||
3086 | ret = 1; | ||
3087 | break; | ||
3088 | } | ||
3089 | return ret; | ||
3090 | } | ||
3091 | |||
3092 | /// <summary> | ||
3093 | /// Tell us what type this prim is | ||
3094 | /// </summary> | ||
3095 | /// <param name="primShape"></param> | ||
3096 | /// <returns></returns> | ||
3097 | public PrimType GetPrimType() | ||
3098 | { | ||
3099 | if (Shape.SculptEntry) | ||
3100 | return PrimType.SCULPT; | ||
3101 | if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) | ||
3102 | { | ||
3103 | if (Shape.PathCurve == (byte)Extrusion.Straight) | ||
3104 | return PrimType.BOX; | ||
3105 | else if (Shape.PathCurve == (byte)Extrusion.Curve1) | ||
3106 | return PrimType.TUBE; | ||
3107 | } | ||
3108 | else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) | ||
3109 | { | ||
3110 | if (Shape.PathCurve == (byte)Extrusion.Straight) | ||
3111 | return PrimType.CYLINDER; | ||
3112 | // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits | ||
3113 | else if (Shape.PathCurve == (byte)Extrusion.Curve1) | ||
3114 | return PrimType.TORUS; | ||
3115 | } | ||
3116 | else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) | ||
3117 | { | ||
3118 | if (Shape.PathCurve == (byte)Extrusion.Curve1 || Shape.PathCurve == (byte)Extrusion.Curve2) | ||
3119 | return PrimType.SPHERE; | ||
3120 | } | ||
3121 | else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) | ||
3122 | { | ||
3123 | if (Shape.PathCurve == (byte)Extrusion.Straight) | ||
3124 | return PrimType.PRISM; | ||
3125 | else if (Shape.PathCurve == (byte)Extrusion.Curve1) | ||
3126 | return PrimType.RING; | ||
3127 | } | ||
3128 | |||
3129 | return PrimType.BOX; | ||
3130 | } | ||
3131 | |||
3132 | /// <summary> | ||
3133 | /// Tell us if this object has cut, hollow, dimple, and other factors affecting the number of faces | ||
3134 | /// </summary> | ||
3135 | /// <param name="primType"></param> | ||
3136 | /// <param name="shape"></param> | ||
3137 | /// <param name="hasCut"></param> | ||
3138 | /// <param name="hasHollow"></param> | ||
3139 | /// <param name="hasDimple"></param> | ||
3140 | /// <param name="hasProfileCut"></param> | ||
3141 | protected static void HasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, | ||
3142 | out bool hasDimple, out bool hasProfileCut) | ||
3143 | { | ||
3144 | if (primType == PrimType.BOX | ||
3145 | || | ||
3146 | primType == PrimType.CYLINDER | ||
3147 | || | ||
3148 | primType == PrimType.PRISM) | ||
3149 | |||
3150 | hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); | ||
3151 | else | ||
3152 | hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0); | ||
3153 | |||
3154 | hasHollow = shape.ProfileHollow > 0; | ||
3155 | hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms | ||
3156 | hasProfileCut = hasDimple; // is it the same thing? | ||
3157 | } | ||
3158 | |||
2956 | public void SetGroup(UUID groupID, IClientAPI client) | 3159 | public void SetGroup(UUID groupID, IClientAPI client) |
2957 | { | 3160 | { |
2958 | _groupID = groupID; | 3161 | _groupID = groupID; |
@@ -2984,6 +3187,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2984 | } | 3187 | } |
2985 | } | 3188 | } |
2986 | 3189 | ||
3190 | /// <summary> | ||
3191 | /// Set the events that this part will pass on to listeners. | ||
3192 | /// </summary> | ||
3193 | /// <param name="scriptid"></param> | ||
3194 | /// <param name="events"></param> | ||
2987 | public void SetScriptEvents(UUID scriptid, int events) | 3195 | public void SetScriptEvents(UUID scriptid, int events) |
2988 | { | 3196 | { |
2989 | // scriptEvents oldparts; | 3197 | // scriptEvents oldparts; |
@@ -3936,9 +4144,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3936 | ScheduleFullUpdate(); | 4144 | ScheduleFullUpdate(); |
3937 | } | 4145 | } |
3938 | 4146 | ||
3939 | // Added to handle bug in libsecondlife's TextureEntry.ToBytes() | 4147 | /// <summary> |
3940 | // not handling RGBA properly. Cycles through, and "fixes" the color | 4148 | /// Update the textures on the part. |
3941 | // info | 4149 | /// </summary> |
4150 | /// Added to handle bug in libsecondlife's TextureEntry.ToBytes() | ||
4151 | /// not handling RGBA properly. Cycles through, and "fixes" the color | ||
4152 | /// info | ||
4153 | /// <param name="tex"></param> | ||
3942 | public void UpdateTexture(Primitive.TextureEntry tex) | 4154 | public void UpdateTexture(Primitive.TextureEntry tex) |
3943 | { | 4155 | { |
3944 | //Color4 tmpcolor; | 4156 | //Color4 tmpcolor; |
@@ -4042,6 +4254,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4042 | 4254 | ||
4043 | if (m_parentGroup == null) | 4255 | if (m_parentGroup == null) |
4044 | { | 4256 | { |
4257 | // m_log.DebugFormat( | ||
4258 | // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents() since m_parentGroup == null", Name, LocalId); | ||
4045 | ScheduleFullUpdate(); | 4259 | ScheduleFullUpdate(); |
4046 | return; | 4260 | return; |
4047 | } | 4261 | } |
@@ -4058,9 +4272,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4058 | LocalFlags=(PrimFlags)objectflagupdate; | 4272 | LocalFlags=(PrimFlags)objectflagupdate; |
4059 | 4273 | ||
4060 | if (m_parentGroup != null && m_parentGroup.RootPart == this) | 4274 | if (m_parentGroup != null && m_parentGroup.RootPart == this) |
4275 | { | ||
4061 | m_parentGroup.aggregateScriptEvents(); | 4276 | m_parentGroup.aggregateScriptEvents(); |
4277 | } | ||
4062 | else | 4278 | else |
4279 | { | ||
4280 | // m_log.DebugFormat( | ||
4281 | // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); | ||
4063 | ScheduleFullUpdate(); | 4282 | ScheduleFullUpdate(); |
4283 | } | ||
4064 | } | 4284 | } |
4065 | 4285 | ||
4066 | public int registerTargetWaypoint(Vector3 target, float tolerance) | 4286 | public int registerTargetWaypoint(Vector3 target, float tolerance) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 168912e..d0de513 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -229,7 +229,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
229 | /// <summary> | 229 | /// <summary> |
230 | /// Stop all the scripts in this prim. | 230 | /// Stop all the scripts in this prim. |
231 | /// </summary> | 231 | /// </summary> |
232 | public void RemoveScriptInstances() | 232 | /// <param name="sceneObjectBeingDeleted"> |
233 | /// Should be true if these scripts are being removed because the scene | ||
234 | /// object is being deleted. This will prevent spurious updates to the client. | ||
235 | /// </param> | ||
236 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) | ||
233 | { | 237 | { |
234 | lock (Items) | 238 | lock (Items) |
235 | { | 239 | { |
@@ -237,8 +241,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
237 | { | 241 | { |
238 | if ((int)InventoryType.LSL == item.InvType) | 242 | if ((int)InventoryType.LSL == item.InvType) |
239 | { | 243 | { |
240 | RemoveScriptInstance(item.ItemID); | 244 | RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted); |
241 | m_part.RemoveScriptEvents(item.ItemID); | ||
242 | } | 245 | } |
243 | } | 246 | } |
244 | } | 247 | } |
@@ -266,8 +269,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
266 | if (stateSource == 1 && // Prim crossing | 269 | if (stateSource == 1 && // Prim crossing |
267 | m_part.ParentGroup.Scene.m_trustBinaries) | 270 | m_part.ParentGroup.Scene.m_trustBinaries) |
268 | { | 271 | { |
269 | m_items[item.ItemID].PermsMask = 0; | 272 | lock (m_items) |
270 | m_items[item.ItemID].PermsGranter = UUID.Zero; | 273 | { |
274 | m_items[item.ItemID].PermsMask = 0; | ||
275 | m_items[item.ItemID].PermsGranter = UUID.Zero; | ||
276 | } | ||
277 | |||
271 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | 278 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( |
272 | m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); | 279 | m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); |
273 | m_part.ParentGroup.AddActiveScriptCount(1); | 280 | m_part.ParentGroup.AddActiveScriptCount(1); |
@@ -275,33 +282,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
275 | return; | 282 | return; |
276 | } | 283 | } |
277 | 284 | ||
278 | m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset) | 285 | m_part.ParentGroup.Scene.AssetService.Get( |
279 | { | 286 | item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset) |
280 | if (null == asset) | 287 | { |
281 | { | 288 | if (null == asset) |
282 | m_log.ErrorFormat( | 289 | { |
283 | "[PRIM INVENTORY]: " + | 290 | m_log.ErrorFormat( |
284 | "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", | 291 | "[PRIM INVENTORY]: " + |
285 | item.Name, item.ItemID, m_part.AbsolutePosition, | 292 | "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", |
286 | m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); | 293 | item.Name, item.ItemID, m_part.AbsolutePosition, |
287 | } | 294 | m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); |
288 | else | 295 | } |
289 | { | 296 | else |
290 | if (m_part.ParentGroup.m_savedScriptState != null) | 297 | { |
291 | RestoreSavedScriptState(item.OldItemID, item.ItemID); | 298 | if (m_part.ParentGroup.m_savedScriptState != null) |
292 | m_items[item.ItemID].PermsMask = 0; | 299 | RestoreSavedScriptState(item.OldItemID, item.ItemID); |
293 | m_items[item.ItemID].PermsGranter = UUID.Zero; | 300 | |
294 | string script = Utils.BytesToString(asset.Data); | 301 | lock (m_items) |
295 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | 302 | { |
296 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); | 303 | m_items[item.ItemID].PermsMask = 0; |
297 | m_part.ParentGroup.AddActiveScriptCount(1); | 304 | m_items[item.ItemID].PermsGranter = UUID.Zero; |
298 | m_part.ScheduleFullUpdate(); | 305 | } |
299 | } | 306 | |
300 | }); | 307 | string script = Utils.BytesToString(asset.Data); |
301 | } | 308 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( |
302 | } | 309 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); |
303 | 310 | m_part.ParentGroup.AddActiveScriptCount(1); | |
304 | static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | 311 | m_part.ScheduleFullUpdate(); |
312 | } | ||
313 | } | ||
314 | ); | ||
315 | } | ||
316 | } | ||
305 | 317 | ||
306 | private void RestoreSavedScriptState(UUID oldID, UUID newID) | 318 | private void RestoreSavedScriptState(UUID oldID, UUID newID) |
307 | { | 319 | { |
@@ -387,10 +399,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
387 | /// Stop a script which is in this prim's inventory. | 399 | /// Stop a script which is in this prim's inventory. |
388 | /// </summary> | 400 | /// </summary> |
389 | /// <param name="itemId"></param> | 401 | /// <param name="itemId"></param> |
390 | public void RemoveScriptInstance(UUID itemId) | 402 | /// <param name="sceneObjectBeingDeleted"> |
403 | /// Should be true if this script is being removed because the scene | ||
404 | /// object is being deleted. This will prevent spurious updates to the client. | ||
405 | /// </param> | ||
406 | public void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted) | ||
391 | { | 407 | { |
392 | if (m_items.ContainsKey(itemId)) | 408 | bool scriptPresent = false; |
409 | |||
410 | lock (m_items) | ||
411 | { | ||
412 | if (m_items.ContainsKey(itemId)) | ||
413 | scriptPresent = true; | ||
414 | } | ||
415 | |||
416 | if (scriptPresent) | ||
393 | { | 417 | { |
418 | if (!sceneObjectBeingDeleted) | ||
419 | m_part.RemoveScriptEvents(itemId); | ||
420 | |||
394 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemId); | 421 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemId); |
395 | m_part.ParentGroup.AddActiveScriptCount(-1); | 422 | m_part.ParentGroup.AddActiveScriptCount(-1); |
396 | } | 423 | } |
@@ -458,13 +485,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
458 | /// <param name="item"></param> | 485 | /// <param name="item"></param> |
459 | public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) | 486 | public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) |
460 | { | 487 | { |
461 | List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_items.Values); | 488 | List<TaskInventoryItem> il; |
489 | |||
490 | lock (m_items) | ||
491 | { | ||
492 | il = new List<TaskInventoryItem>(m_items.Values); | ||
493 | } | ||
494 | |||
462 | foreach (TaskInventoryItem i in il) | 495 | foreach (TaskInventoryItem i in il) |
463 | { | 496 | { |
464 | if (i.Name == item.Name) | 497 | if (i.Name == item.Name) |
465 | { | 498 | { |
466 | if (i.InvType == (int)InventoryType.LSL) | 499 | if (i.InvType == (int)InventoryType.LSL) |
467 | RemoveScriptInstance(i.ItemID); | 500 | RemoveScriptInstance(i.ItemID, false); |
468 | 501 | ||
469 | RemoveInventoryItem(i.ItemID); | 502 | RemoveInventoryItem(i.ItemID); |
470 | break; | 503 | break; |
@@ -540,11 +573,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
540 | public TaskInventoryItem GetInventoryItem(UUID itemId) | 573 | public TaskInventoryItem GetInventoryItem(UUID itemId) |
541 | { | 574 | { |
542 | TaskInventoryItem item; | 575 | TaskInventoryItem item; |
543 | m_items.TryGetValue(itemId, out item); | 576 | |
577 | lock (m_items) | ||
578 | m_items.TryGetValue(itemId, out item); | ||
544 | 579 | ||
545 | return item; | 580 | return item; |
546 | } | 581 | } |
582 | |||
583 | /// <summary> | ||
584 | /// Get inventory items by name. | ||
585 | /// </summary> | ||
586 | /// <param name="name"></param> | ||
587 | /// <returns> | ||
588 | /// A list of inventory items with that name. | ||
589 | /// If no inventory item has that name then an empty list is returned. | ||
590 | /// </returns> | ||
591 | public IList<TaskInventoryItem> GetInventoryItems(string name) | ||
592 | { | ||
593 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(); | ||
594 | |||
595 | lock (m_items) | ||
596 | { | ||
597 | foreach (TaskInventoryItem item in m_items.Values) | ||
598 | { | ||
599 | if (item.Name == name) | ||
600 | items.Add(item); | ||
601 | } | ||
602 | } | ||
547 | 603 | ||
604 | return items; | ||
605 | } | ||
606 | |||
548 | /// <summary> | 607 | /// <summary> |
549 | /// Update an existing inventory item. | 608 | /// Update an existing inventory item. |
550 | /// </summary> | 609 | /// </summary> |
@@ -612,6 +671,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
612 | int type = m_items[itemID].InvType; | 671 | int type = m_items[itemID].InvType; |
613 | if (type == 10) // Script | 672 | if (type == 10) // Script |
614 | { | 673 | { |
674 | m_part.RemoveScriptEvents(itemID); | ||
615 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); | 675 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); |
616 | } | 676 | } |
617 | m_items.Remove(itemID); | 677 | m_items.Remove(itemID); |
@@ -841,54 +901,61 @@ namespace OpenSim.Region.Framework.Scenes | |||
841 | { | 901 | { |
842 | uint mask=0x7fffffff; | 902 | uint mask=0x7fffffff; |
843 | 903 | ||
844 | foreach (TaskInventoryItem item in m_items.Values) | 904 | lock (m_items) |
845 | { | 905 | { |
846 | if (item.InvType != (int)InventoryType.Object) | 906 | foreach (TaskInventoryItem item in m_items.Values) |
847 | { | ||
848 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) | ||
849 | mask &= ~((uint)PermissionMask.Copy >> 13); | ||
850 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) | ||
851 | mask &= ~((uint)PermissionMask.Transfer >> 13); | ||
852 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) | ||
853 | mask &= ~((uint)PermissionMask.Modify >> 13); | ||
854 | } | ||
855 | else | ||
856 | { | 907 | { |
857 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | 908 | if (item.InvType != (int)InventoryType.Object) |
858 | mask &= ~((uint)PermissionMask.Copy >> 13); | 909 | { |
859 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | 910 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) |
860 | mask &= ~((uint)PermissionMask.Transfer >> 13); | 911 | mask &= ~((uint)PermissionMask.Copy >> 13); |
861 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | 912 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) |
862 | mask &= ~((uint)PermissionMask.Modify >> 13); | 913 | mask &= ~((uint)PermissionMask.Transfer >> 13); |
914 | if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) | ||
915 | mask &= ~((uint)PermissionMask.Modify >> 13); | ||
916 | } | ||
917 | else | ||
918 | { | ||
919 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | ||
920 | mask &= ~((uint)PermissionMask.Copy >> 13); | ||
921 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | ||
922 | mask &= ~((uint)PermissionMask.Transfer >> 13); | ||
923 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | ||
924 | mask &= ~((uint)PermissionMask.Modify >> 13); | ||
925 | } | ||
926 | |||
927 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | ||
928 | mask &= ~(uint)PermissionMask.Copy; | ||
929 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
930 | mask &= ~(uint)PermissionMask.Transfer; | ||
931 | if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) | ||
932 | mask &= ~(uint)PermissionMask.Modify; | ||
863 | } | 933 | } |
864 | |||
865 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | ||
866 | mask &= ~(uint)PermissionMask.Copy; | ||
867 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | ||
868 | mask &= ~(uint)PermissionMask.Transfer; | ||
869 | if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) | ||
870 | mask &= ~(uint)PermissionMask.Modify; | ||
871 | } | 934 | } |
935 | |||
872 | return mask; | 936 | return mask; |
873 | } | 937 | } |
874 | 938 | ||
875 | public void ApplyNextOwnerPermissions() | 939 | public void ApplyNextOwnerPermissions() |
876 | { | 940 | { |
877 | foreach (TaskInventoryItem item in m_items.Values) | 941 | lock (m_items) |
878 | { | 942 | { |
879 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) | 943 | foreach (TaskInventoryItem item in m_items.Values) |
880 | { | 944 | { |
881 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) | 945 | if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) |
882 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; | 946 | { |
883 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) | 947 | if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) |
884 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; | 948 | item.CurrentPermissions &= ~(uint)PermissionMask.Copy; |
885 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | 949 | if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) |
886 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | 950 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; |
887 | item.CurrentPermissions |= 8; | 951 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) |
952 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | ||
953 | item.CurrentPermissions |= 8; | ||
954 | } | ||
955 | item.CurrentPermissions &= item.NextPermissions; | ||
956 | item.BasePermissions &= item.NextPermissions; | ||
957 | item.EveryonePermissions &= item.NextPermissions; | ||
888 | } | 958 | } |
889 | item.CurrentPermissions &= item.NextPermissions; | ||
890 | item.BasePermissions &= item.NextPermissions; | ||
891 | item.EveryonePermissions &= item.NextPermissions; | ||
892 | } | 959 | } |
893 | 960 | ||
894 | m_part.TriggerScriptChangedEvent(Changed.OWNER); | 961 | m_part.TriggerScriptChangedEvent(Changed.OWNER); |
@@ -896,22 +963,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
896 | 963 | ||
897 | public void ApplyGodPermissions(uint perms) | 964 | public void ApplyGodPermissions(uint perms) |
898 | { | 965 | { |
899 | foreach (TaskInventoryItem item in m_items.Values) | 966 | lock (m_items) |
900 | { | 967 | { |
901 | item.CurrentPermissions = perms; | 968 | foreach (TaskInventoryItem item in m_items.Values) |
902 | item.BasePermissions = perms; | 969 | { |
970 | item.CurrentPermissions = perms; | ||
971 | item.BasePermissions = perms; | ||
972 | } | ||
903 | } | 973 | } |
904 | } | 974 | } |
905 | 975 | ||
906 | public bool ContainsScripts() | 976 | public bool ContainsScripts() |
907 | { | 977 | { |
908 | foreach (TaskInventoryItem item in m_items.Values) | 978 | lock (m_items) |
909 | { | 979 | { |
910 | if (item.InvType == (int)InventoryType.LSL) | 980 | foreach (TaskInventoryItem item in m_items.Values) |
911 | { | 981 | { |
912 | return true; | 982 | if (item.InvType == (int)InventoryType.LSL) |
983 | { | ||
984 | return true; | ||
985 | } | ||
913 | } | 986 | } |
914 | } | 987 | } |
988 | |||
915 | return false; | 989 | return false; |
916 | } | 990 | } |
917 | 991 | ||
@@ -919,8 +993,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
919 | { | 993 | { |
920 | List<UUID> ret = new List<UUID>(); | 994 | List<UUID> ret = new List<UUID>(); |
921 | 995 | ||
922 | foreach (TaskInventoryItem item in m_items.Values) | 996 | lock (m_items) |
923 | ret.Add(item.ItemID); | 997 | { |
998 | foreach (TaskInventoryItem item in m_items.Values) | ||
999 | ret.Add(item.ItemID); | ||
1000 | } | ||
924 | 1001 | ||
925 | return ret; | 1002 | return ret; |
926 | } | 1003 | } |
@@ -933,26 +1010,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
933 | if (engines == null) // No engine at all | 1010 | if (engines == null) // No engine at all |
934 | return ret; | 1011 | return ret; |
935 | 1012 | ||
936 | foreach (TaskInventoryItem item in m_items.Values) | 1013 | lock (m_items) |
937 | { | 1014 | { |
938 | if (item.InvType == (int)InventoryType.LSL) | 1015 | foreach (TaskInventoryItem item in m_items.Values) |
939 | { | 1016 | { |
940 | foreach (IScriptModule e in engines) | 1017 | if (item.InvType == (int)InventoryType.LSL) |
941 | { | 1018 | { |
942 | if (e != null) | 1019 | foreach (IScriptModule e in engines) |
943 | { | 1020 | { |
944 | string n = e.GetXMLState(item.ItemID); | 1021 | if (e != null) |
945 | if (n != String.Empty) | ||
946 | { | 1022 | { |
947 | if (!ret.ContainsKey(item.ItemID)) | 1023 | string n = e.GetXMLState(item.ItemID); |
948 | ret[item.ItemID] = n; | 1024 | if (n != String.Empty) |
949 | break; | 1025 | { |
1026 | if (!ret.ContainsKey(item.ItemID)) | ||
1027 | ret[item.ItemID] = n; | ||
1028 | break; | ||
1029 | } | ||
950 | } | 1030 | } |
951 | } | 1031 | } |
952 | } | 1032 | } |
953 | } | 1033 | } |
954 | } | 1034 | } |
1035 | |||
955 | return ret; | 1036 | return ret; |
956 | } | 1037 | } |
957 | } | 1038 | } |
958 | } | 1039 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index afb5b9a..29f607b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -104,6 +104,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
104 | } | 104 | } |
105 | protected ScenePresenceAnimator m_animator; | 105 | protected ScenePresenceAnimator m_animator; |
106 | 106 | ||
107 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); | ||
108 | |||
107 | private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>(); | 109 | private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>(); |
108 | private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; | 110 | private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; |
109 | private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; | 111 | private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; |
@@ -217,7 +219,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
217 | 219 | ||
218 | protected AvatarAppearance m_appearance; | 220 | protected AvatarAppearance m_appearance; |
219 | 221 | ||
220 | protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>(); | ||
221 | public List<SceneObjectGroup> Attachments | 222 | public List<SceneObjectGroup> Attachments |
222 | { | 223 | { |
223 | get { return m_attachments; } | 224 | get { return m_attachments; } |
@@ -636,12 +637,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
636 | #endregion | 637 | #endregion |
637 | 638 | ||
638 | #region Constructor(s) | 639 | #region Constructor(s) |
639 | 640 | ||
640 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) | 641 | public ScenePresence() |
641 | { | 642 | { |
642 | m_animator = new ScenePresenceAnimator(this); | ||
643 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; | 643 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; |
644 | CreateSceneViewer(); | 644 | CreateSceneViewer(); |
645 | m_animator = new ScenePresenceAnimator(this); | ||
646 | } | ||
647 | |||
648 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() | ||
649 | { | ||
645 | m_rootRegionHandle = reginfo.RegionHandle; | 650 | m_rootRegionHandle = reginfo.RegionHandle; |
646 | m_controllingClient = client; | 651 | m_controllingClient = client; |
647 | m_firstname = m_controllingClient.FirstName; | 652 | m_firstname = m_controllingClient.FirstName; |
@@ -665,7 +670,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
665 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); | 670 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); |
666 | m_reprioritization_timer.AutoReset = false; | 671 | m_reprioritization_timer.AutoReset = false; |
667 | 672 | ||
668 | |||
669 | AdjustKnownSeeds(); | 673 | AdjustKnownSeeds(); |
670 | 674 | ||
671 | // TODO: I think, this won't send anything, as we are still a child here... | 675 | // TODO: I think, this won't send anything, as we are still a child here... |
@@ -1294,6 +1298,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1294 | 1298 | ||
1295 | if (m_allowMovement) | 1299 | if (m_allowMovement) |
1296 | { | 1300 | { |
1301 | if (agentData.UseClientAgentPosition) | ||
1302 | { | ||
1303 | m_moveToPositionInProgress = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; | ||
1304 | m_moveToPositionTarget = agentData.ClientAgentPosition; | ||
1305 | } | ||
1306 | |||
1297 | int i = 0; | 1307 | int i = 0; |
1298 | 1308 | ||
1299 | bool update_rotation = false; | 1309 | bool update_rotation = false; |
@@ -1400,7 +1410,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1400 | if (bAllowUpdateMoveToPosition && (m_moveToPositionInProgress && !m_autopilotMoving)) | 1410 | if (bAllowUpdateMoveToPosition && (m_moveToPositionInProgress && !m_autopilotMoving)) |
1401 | { | 1411 | { |
1402 | //Check the error term of the current position in relation to the target position | 1412 | //Check the error term of the current position in relation to the target position |
1403 | if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 1.5f) | 1413 | if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 0.5f) |
1404 | { | 1414 | { |
1405 | // we are close enough to the target | 1415 | // we are close enough to the target |
1406 | m_moveToPositionTarget = Vector3.Zero; | 1416 | m_moveToPositionTarget = Vector3.Zero; |
@@ -2795,7 +2805,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2795 | protected void CrossToNewRegion() | 2805 | protected void CrossToNewRegion() |
2796 | { | 2806 | { |
2797 | InTransit(); | 2807 | InTransit(); |
2798 | m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); | 2808 | try |
2809 | { | ||
2810 | m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); | ||
2811 | } | ||
2812 | catch | ||
2813 | { | ||
2814 | m_scene.CrossAgentToNewRegion(this, false); | ||
2815 | } | ||
2799 | } | 2816 | } |
2800 | 2817 | ||
2801 | public void InTransit() | 2818 | public void InTransit() |
@@ -2873,7 +2890,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2873 | { | 2890 | { |
2874 | RemoveNeighbourRegion(handle); | 2891 | RemoveNeighbourRegion(handle); |
2875 | } | 2892 | } |
2876 | |||
2877 | } | 2893 | } |
2878 | 2894 | ||
2879 | #endregion | 2895 | #endregion |
@@ -3037,7 +3053,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3037 | List<int> attPoints = m_appearance.GetAttachedPoints(); | 3053 | List<int> attPoints = m_appearance.GetAttachedPoints(); |
3038 | if (attPoints != null) | 3054 | if (attPoints != null) |
3039 | { | 3055 | { |
3040 | m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); | 3056 | //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); |
3041 | int i = 0; | 3057 | int i = 0; |
3042 | AttachmentData[] attachs = new AttachmentData[attPoints.Count]; | 3058 | AttachmentData[] attachs = new AttachmentData[attPoints.Count]; |
3043 | foreach (int point in attPoints) | 3059 | foreach (int point in attPoints) |
@@ -3261,17 +3277,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3261 | uint killerObj = 0; | 3277 | uint killerObj = 0; |
3262 | foreach (uint localid in coldata.Keys) | 3278 | foreach (uint localid in coldata.Keys) |
3263 | { | 3279 | { |
3264 | if (coldata[localid].PenetrationDepth <= 0.10f || m_invulnerable) | 3280 | SceneObjectPart part = Scene.GetSceneObjectPart(localid); |
3265 | continue; | ||
3266 | //if (localid == 0) | ||
3267 | //continue; | ||
3268 | |||
3269 | SceneObjectPart part = m_scene.GetSceneObjectPart(localid); | ||
3270 | 3281 | ||
3271 | if (part != null && part.ParentGroup.Damage != -1.0f) | 3282 | if (part != null && part.ParentGroup.Damage != -1.0f) |
3272 | Health -= part.ParentGroup.Damage; | 3283 | Health -= part.ParentGroup.Damage; |
3273 | else | 3284 | else |
3274 | Health -= coldata[localid].PenetrationDepth * 5.0f; | 3285 | { |
3286 | if (coldata[localid].PenetrationDepth >= 0.10f) | ||
3287 | Health -= coldata[localid].PenetrationDepth * 5.0f; | ||
3288 | } | ||
3275 | 3289 | ||
3276 | if (Health <= 0.0f) | 3290 | if (Health <= 0.0f) |
3277 | { | 3291 | { |
@@ -3289,9 +3303,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3289 | } | 3303 | } |
3290 | if (m_health <= 0) | 3304 | if (m_health <= 0) |
3291 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); | 3305 | m_scene.EventManager.TriggerAvatarKill(killerObj, this); |
3292 | } | 3306 | } |
3293 | |||
3294 | |||
3295 | } | 3307 | } |
3296 | 3308 | ||
3297 | public void setHealthWithUpdate(float health) | 3309 | public void setHealthWithUpdate(float health) |
@@ -3338,13 +3350,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3338 | m_animator = null; | 3350 | m_animator = null; |
3339 | } | 3351 | } |
3340 | 3352 | ||
3341 | public ScenePresence() | ||
3342 | { | ||
3343 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; | ||
3344 | CreateSceneViewer(); | ||
3345 | m_animator = new ScenePresenceAnimator(this); | ||
3346 | } | ||
3347 | |||
3348 | public void AddAttachment(SceneObjectGroup gobj) | 3353 | public void AddAttachment(SceneObjectGroup gobj) |
3349 | { | 3354 | { |
3350 | lock (m_attachments) | 3355 | lock (m_attachments) |
@@ -3843,4 +3848,4 @@ namespace OpenSim.Region.Framework.Scenes | |||
3843 | } | 3848 | } |
3844 | } | 3849 | } |
3845 | } | 3850 | } |
3846 | } \ No newline at end of file | 3851 | } |