EventManager.cs 133 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using System.Reflection;
  30. using log4net;
  31. using OpenMetaverse;
  32. using OpenSim.Framework;
  33. using OpenSim.Framework.Client;
  34. using OpenSim.Region.Framework.Interfaces;
  35. using Caps = OpenSim.Framework.Capabilities.Caps;
  36. using GridRegion = OpenSim.Services.Interfaces.GridRegion;
  37. namespace OpenSim.Region.Framework.Scenes
  38. {
  39. /// <summary>
  40. /// A class for triggering remote scene events.
  41. /// </summary>
  42. public class EventManager
  43. {
  44. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  45. public delegate void OnFrameDelegate();
  46. /// <summary>
  47. /// Triggered on each sim frame.
  48. /// </summary>
  49. /// <remarks>
  50. /// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.Update"/>
  51. /// Core uses it for things like Sun, Wind & Clouds
  52. /// The MRM module also uses it.
  53. /// </remarks>
  54. public event OnFrameDelegate OnFrame;
  55. public delegate void ClientMovement(ScenePresence client);
  56. /// <summary>
  57. /// Trigerred when an agent moves.
  58. /// </summary>
  59. /// <remarks>
  60. /// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.ScenePresence.HandleAgentUpdate"/>
  61. /// prior to <see cref="OpenSim.Region.Framework.Scenes.ScenePresence.TriggerScenePresenceUpdated"/>
  62. /// </remarks>
  63. public event ClientMovement OnClientMovement;
  64. public delegate void OnTerrainTaintedDelegate();
  65. /// <summary>
  66. /// Triggered if the terrain has been edited
  67. /// </summary>
  68. /// <remarks>
  69. /// This gets triggered in <see cref="OpenSim.Region.CoreModules.World.Terrain.CheckForTerrainUpdates"/>
  70. /// after it determines that an update has been made.
  71. /// </remarks>
  72. public event OnTerrainTaintedDelegate OnTerrainTainted;
  73. public delegate void OnTerrainTickDelegate();
  74. public delegate void OnTerrainCheckUpdatesDelegate();
  75. /// <summary>
  76. /// Triggered if the terrain has been edited
  77. /// </summary>
  78. /// <remarks>
  79. /// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.UpdateTerrain"/>
  80. /// but is used by core solely to update the physics engine.
  81. /// </remarks>
  82. public event OnTerrainTickDelegate OnTerrainTick;
  83. public event OnTerrainCheckUpdatesDelegate OnTerrainCheckUpdates;
  84. public delegate void OnTerrainUpdateDelegate();
  85. public event OnTerrainUpdateDelegate OnTerrainUpdate;
  86. public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup);
  87. /// <summary>
  88. /// Triggered when a region is backed up/persisted to storage
  89. /// </summary>
  90. /// <remarks>
  91. /// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.Backup"/>
  92. /// and is fired before the persistence occurs.
  93. /// </remarks>
  94. public event OnBackupDelegate OnBackup;
  95. public delegate void OnClientConnectCoreDelegate(IClientCore client);
  96. /// <summary>
  97. /// Triggered when a new client connects to the scene.
  98. /// </summary>
  99. /// <remarks>
  100. /// This gets triggered in <see cref="TriggerOnNewClient"/>,
  101. /// which checks if an instance of <see cref="OpenSim.Framework.IClientAPI"/>
  102. /// also implements <see cref="OpenSim.Framework.Client.IClientCore"/> and as such,
  103. /// is not triggered by <see cref="OpenSim.Region.OptionalModules.World.NPC">NPCs</see>.
  104. /// </remarks>
  105. public event OnClientConnectCoreDelegate OnClientConnect;
  106. public delegate void OnNewClientDelegate(IClientAPI client);
  107. /// <summary>
  108. /// Triggered when a new client is added to the scene.
  109. /// </summary>
  110. /// <remarks>
  111. /// This is triggered for both child and root agent client connections.
  112. ///
  113. /// Triggered before OnClientLogin.
  114. ///
  115. /// This is triggered under per-agent lock. So if you want to perform any long-running operations, please
  116. /// do this on a separate thread.
  117. /// </remarks>
  118. public event OnNewClientDelegate OnNewClient;
  119. /// <summary>
  120. /// Fired if the client entering this sim is doing so as a new login
  121. /// </summary>
  122. /// <remarks>
  123. /// This is triggered under per-agent lock. So if you want to perform any long-running operations, please
  124. /// do this on a separate thread.
  125. /// </remarks>
  126. public event Action<IClientAPI> OnClientLogin;
  127. public delegate void OnNewPresenceDelegate(ScenePresence presence);
  128. /// <summary>
  129. /// Triggered when a new presence is added to the scene
  130. /// </summary>
  131. /// <remarks>
  132. /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewAgent"/> which is used by both
  133. /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see>
  134. /// </remarks>
  135. public event OnNewPresenceDelegate OnNewPresence;
  136. public delegate void OnRemovePresenceDelegate(UUID agentId);
  137. /// <summary>
  138. /// Triggered when a presence is removed from the scene
  139. /// </summary>
  140. /// <remarks>
  141. /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewAgent"/> which is used by both
  142. /// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see>
  143. ///
  144. /// Triggered under per-agent lock. So if you want to perform any long-running operations, please
  145. /// do this on a separate thread.
  146. /// </remarks>
  147. public event OnRemovePresenceDelegate OnRemovePresence;
  148. public delegate void OnParcelPrimCountUpdateDelegate();
  149. /// <summary>
  150. /// Triggered whenever the prim count may have been altered, or prior
  151. /// to an action that requires the current prim count to be accurate.
  152. /// </summary>
  153. /// <remarks>
  154. /// Triggered by <see cref="TriggerParcelPrimCountUpdate"/> in
  155. /// <see cref="OpenSim.OpenSimBase.CreateRegion"/>,
  156. /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.EventManagerOnRequestParcelPrimCountUpdate"/>,
  157. /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ClientOnParcelObjectOwnerRequest"/>,
  158. /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.GetPrimsFree"/>,
  159. /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.UpdateLandSold"/>,
  160. /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.DeedToGroup"/>,
  161. /// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.SendLandUpdateToClient"/>
  162. /// </remarks>
  163. public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
  164. public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
  165. /// <summary>
  166. /// Triggered in response to <see cref="OnParcelPrimCountUpdate"/> for
  167. /// objects that actually contribute to parcel prim count.
  168. /// </summary>
  169. /// <remarks>
  170. /// Triggered by <see cref="TriggerParcelPrimCountAdd"/> in
  171. /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.EventManagerOnParcelPrimCountUpdate"/>
  172. /// </remarks>
  173. public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
  174. public delegate void OnPluginConsoleDelegate(string[] args);
  175. /// <summary>
  176. /// Triggered after <see cref="OpenSim.IApplicationPlugin.PostInitialise"/>
  177. /// has been called for all <see cref="OpenSim.IApplicationPlugin"/>
  178. /// loaded via <see cref="OpenSim.OpenSimBase.LoadPlugins"/>.
  179. /// Handlers for this event are typically used to parse the arguments
  180. /// from <see cref="OnPluginConsoleDelegate"/> in order to process or
  181. /// filter the arguments and pass them onto <see cref="OpenSim.Region.CoreModules.Framework.InterfaceCommander.Commander.ProcessConsoleCommand"/>
  182. /// </summary>
  183. /// <remarks>
  184. /// Triggered by <see cref="TriggerOnPluginConsole"/> in
  185. /// <see cref="Scene.SendCommandToPlugins"/> via
  186. /// <see cref="SceneManager.SendCommandToPluginModules"/> via
  187. /// <see cref="OpenSim.OpenSimBase.HandleCommanderCommand"/> via
  188. /// <see cref="OpenSim.OpenSimBase.AddPluginCommands"/> via
  189. /// <see cref="OpenSim.OpenSimBase.StartupSpecific"/>
  190. /// </remarks>
  191. public event OnPluginConsoleDelegate OnPluginConsole;
  192. /// <summary>
  193. /// Triggered when the entire simulator is shutdown.
  194. /// </summary>
  195. public event Action OnShutdown;
  196. public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
  197. public delegate void ScriptResetDelegate(uint localID, UUID itemID);
  198. public delegate void OnPermissionErrorDelegate(UUID user, string reason);
  199. public delegate void OnSetRootAgentSceneDelegate(UUID agentID, Scene scene);
  200. /// <summary>
  201. /// Triggered before the grunt work for adding a root agent to a
  202. /// scene has been performed (resuming attachment scripts, physics,
  203. /// animations etc.)
  204. /// </summary>
  205. /// <remarks>
  206. /// Triggered before <see cref="OnMakeRootAgent"/>
  207. /// by <see cref="TriggerSetRootAgentScene"/>
  208. /// in <see cref="ScenePresence.MakeRootAgent"/>
  209. /// via <see cref="Scene.AgentCrossing"/>
  210. /// and <see cref="ScenePresence.CompleteMovement"/>
  211. /// </remarks>
  212. public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
  213. /// <summary>
  214. /// Triggered after parcel properties have been updated.
  215. /// </summary>
  216. /// <remarks>
  217. /// Triggered by <see cref="TriggerOnParcelPropertiesUpdateRequest"/> in
  218. /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ClientOnParcelPropertiesUpdateRequest"/>,
  219. /// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ProcessPropertiesUpdate"/>
  220. /// </remarks>
  221. public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
  222. /// <summary>
  223. /// Triggered when an individual scene is shutdown.
  224. /// </summary>
  225. /// <remarks>
  226. /// This does not automatically mean that the entire simulator is shutting down. Listen to OnShutdown for that
  227. /// notification.
  228. /// </remarks>
  229. public event Action<Scene> OnSceneShuttingDown;
  230. /// <summary>
  231. /// Fired when an object is touched/grabbed.
  232. /// </summary>
  233. /// <remarks>
  234. /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of
  235. /// the root part.
  236. /// Triggerd in response to <see cref="OpenSim.Framework.IClientAPI.OnGrabObject"/>
  237. /// via <see cref="TriggerObjectGrab"/>
  238. /// in <see cref="Scene.ProcessObjectGrab"/>
  239. /// </remarks>
  240. public event ObjectGrabDelegate OnObjectGrab;
  241. public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
  242. /// <summary>
  243. /// Triggered when an object is being touched/grabbed continuously.
  244. /// </summary>
  245. /// <remarks>
  246. /// Triggered in response to <see cref="OpenSim.Framework.IClientAPI.OnGrabUpdate"/>
  247. /// via <see cref="TriggerObjectGrabbing"/>
  248. /// in <see cref="Scene.ProcessObjectGrabUpdate"/>
  249. /// </remarks>
  250. public event ObjectGrabDelegate OnObjectGrabbing;
  251. /// <summary>
  252. /// Triggered when an object stops being touched/grabbed.
  253. /// </summary>
  254. /// <remarks>
  255. /// Triggered in response to <see cref="OpenSim.Framework.IClientAPI.OnDeGrabObject"/>
  256. /// via <see cref="TriggerObjectDeGrab"/>
  257. /// in <see cref="Scene.ProcessObjectDeGrab"/>
  258. /// </remarks>
  259. public event ObjectDeGrabDelegate OnObjectDeGrab;
  260. /// <summary>
  261. /// Triggered when a script resets.
  262. /// </summary>
  263. /// <remarks>
  264. /// Triggered by <see cref="TriggerScriptReset"/>
  265. /// in <see cref="Scene.ProcessScriptReset"/>
  266. /// via <see cref="OpenSim.Framework.IClientAPI.OnScriptReset"/>
  267. /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleScriptReset"/>
  268. /// </remarks>
  269. public event ScriptResetDelegate OnScriptReset;
  270. public event OnPermissionErrorDelegate OnPermissionError;
  271. /// <summary>
  272. /// Fired when a script is run.
  273. /// </summary>
  274. /// <remarks>
  275. /// Occurs after OnNewScript.
  276. /// Triggered by <see cref="TriggerRezScript"/>
  277. /// in <see cref="SceneObjectPartInventory.CreateScriptInstance"/>
  278. /// </remarks>
  279. public event NewRezScript OnRezScript;
  280. public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
  281. public delegate void RemoveScript(uint localID, UUID itemID);
  282. /// <summary>
  283. /// Triggered when a script is removed from an object.
  284. /// </summary>
  285. /// <remarks>
  286. /// Triggered by <see cref="TriggerRemoveScript"/>
  287. /// in <see cref="Scene.RemoveTaskInventory"/>,
  288. /// <see cref="Scene.CreateAgentInventoryItemFromTask"/>,
  289. /// <see cref="SceneObjectPartInventory.RemoveScriptInstance"/>,
  290. /// <see cref="SceneObjectPartInventory.RemoveInventoryItem"/>
  291. /// </remarks>
  292. public event RemoveScript OnRemoveScript;
  293. public delegate void StartScript(uint localID, UUID itemID);
  294. /// <summary>
  295. /// Triggered when a script starts.
  296. /// </summary>
  297. /// <remarks>
  298. /// Triggered by <see cref="TriggerStartScript"/>
  299. /// in <see cref="Scene.SetScriptRunning"/>
  300. /// via <see cref="OpenSim.Framework.IClientAPI.OnSetScriptRunning"/>,
  301. /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.HandleSetScriptRunning"/>
  302. /// </remarks>
  303. public event StartScript OnStartScript;
  304. public delegate void StopScript(uint localID, UUID itemID);
  305. /// <summary>
  306. /// Triggered when a script stops.
  307. /// </summary>
  308. /// <remarks>
  309. /// Triggered by <see cref="TriggerStopScript"/>,
  310. /// in <see cref="SceneObjectPartInventory.CreateScriptInstance"/>,
  311. /// <see cref="SceneObjectPartInventory.StopScriptInstance"/>,
  312. /// <see cref="Scene.SetScriptRunning"/>
  313. /// </remarks>
  314. public event StopScript OnStopScript;
  315. public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta);
  316. /// <summary>
  317. /// Triggered when an object is moved.
  318. /// </summary>
  319. /// <remarks>
  320. /// Triggered by <see cref="TriggerGroupMove"/>
  321. /// in <see cref="SceneObjectGroup.UpdateGroupPosition"/>,
  322. /// <see cref="SceneObjectGroup.GrabMovement"/>
  323. /// </remarks>
  324. public event SceneGroupMoved OnSceneGroupMove;
  325. public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID);
  326. /// <summary>
  327. /// Triggered when an object is grabbed.
  328. /// </summary>
  329. /// <remarks>
  330. /// Triggered by <see cref="TriggerGroupGrab"/>
  331. /// in <see cref="SceneObjectGroup.OnGrabGroup"/>
  332. /// via <see cref="SceneObjectGroup.ObjectGrabHandler"/>
  333. /// via <see cref="Scene.ProcessObjectGrab"/>
  334. /// via <see cref="OpenSim.Framework.IClientAPI.OnGrabObject"/>
  335. /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectGrab"/>
  336. /// </remarks>
  337. public event SceneGroupGrabed OnSceneGroupGrab;
  338. public delegate bool SceneGroupSpinStarted(UUID groupID);
  339. /// <summary>
  340. /// Triggered when an object starts to spin.
  341. /// </summary>
  342. /// <remarks>
  343. /// Triggered by <see cref="TriggerGroupSpinStart"/>
  344. /// in <see cref="SceneObjectGroup.SpinStart"/>
  345. /// via <see cref="SceneGraph.SpinStart"/>
  346. /// via <see cref="OpenSim.Framework.IClientAPI.OnSpinStart"/>
  347. /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectSpinStart"/>
  348. /// </remarks>
  349. public event SceneGroupSpinStarted OnSceneGroupSpinStart;
  350. public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation);
  351. /// <summary>
  352. /// Triggered when an object is being spun.
  353. /// </summary>
  354. /// <remarks>
  355. /// Triggered by <see cref="TriggerGroupSpin"/>
  356. /// in <see cref="SceneObjectGroup.SpinMovement"/>
  357. /// via <see cref="SceneGraph.SpinObject"/>
  358. /// via <see cref="OpenSim.Framework.IClientAPI.OnSpinUpdate"/>
  359. /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectSpinUpdate"/>
  360. /// </remarks>
  361. public event SceneGroupSpun OnSceneGroupSpin;
  362. public delegate void LandObjectAdded(ILandObject newParcel);
  363. public event LandObjectAdded OnLandObjectAdded;
  364. public delegate void LandObjectRemoved(UUID globalID);
  365. public event LandObjectRemoved OnLandObjectRemoved;
  366. public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID);
  367. public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
  368. public delegate void AvatarAppearanceChange(ScenePresence avatar);
  369. public event AvatarAppearanceChange OnAvatarAppearanceChange;
  370. public event Action<ScenePresence> OnSignificantClientMovement;
  371. public delegate void IncomingInstantMessage(GridInstantMessage message);
  372. public event IncomingInstantMessage OnIncomingInstantMessage;
  373. public delegate void CrossAgentToNewRegion(ScenePresence sp, bool isFlying, GridRegion newRegion);
  374. public event CrossAgentToNewRegion OnCrossAgentToNewRegion;
  375. public event IncomingInstantMessage OnUnhandledInstantMessage;
  376. public delegate void ClientClosed(UUID clientID, Scene scene);
  377. /// <summary>
  378. /// Fired when a client is removed from a scene whether it's a child or a root agent.
  379. /// </summary>
  380. /// <remarks>
  381. /// At the point of firing, the scene still contains the client's scene presence.
  382. ///
  383. /// This is triggered under per-agent lock. So if you want to perform any long-running operations, please
  384. /// do this on a separate thread.
  385. /// </remarks>
  386. public event ClientClosed OnClientClosed;
  387. public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID);
  388. /// <summary>
  389. /// Fired when a script is created.
  390. /// </summary>
  391. /// <remarks>
  392. /// Occurs before OnRezScript
  393. /// Triggered by <see cref="TriggerNewScript"/>
  394. /// in <see cref="Scene.RezScriptFromAgentInventory"/>,
  395. /// <see cref="Scene.RezNewScript"/>
  396. /// </remarks>
  397. public event NewScript OnNewScript;
  398. public delegate void ExtraSettingChangedDelegate(Scene scene, string name, string value);
  399. public event ExtraSettingChangedDelegate OnExtraSettingChanged;
  400. public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
  401. {
  402. NewScript handlerNewScript = OnNewScript;
  403. if (handlerNewScript != null)
  404. {
  405. foreach (NewScript d in handlerNewScript.GetInvocationList())
  406. {
  407. try
  408. {
  409. d(clientID, part, itemID);
  410. }
  411. catch (Exception e)
  412. {
  413. m_log.ErrorFormat(
  414. "[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing. {0} {1}",
  415. e.Message, e.StackTrace);
  416. }
  417. }
  418. }
  419. }
  420. public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID);
  421. /// <summary>
  422. /// An indication that the script has changed.
  423. /// </summary>
  424. /// <remarks>
  425. /// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset.
  426. /// Triggered by <see cref="TriggerUpdateScript"/>
  427. /// in <see cref="Scene.CapsUpdateTaskInventoryScriptAsset"/>
  428. /// via <see cref="Scene.CapsUpdateTaskInventoryScriptAsset"/>
  429. /// via <see cref="OpenSim.Region.ClientStack.Linden.BunchOfCaps.TaskScriptUpdated"/>
  430. /// via <see cref="OpenSim.Region.ClientStack.Linden.TaskInventoryScriptUpdater.OnUpLoad"/>
  431. /// via <see cref="OpenSim.Region.ClientStack.Linden.TaskInventoryScriptUpdater.uploaderCaps"/>
  432. /// </remarks>
  433. public event UpdateScript OnUpdateScript;
  434. public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
  435. {
  436. UpdateScript handlerUpdateScript = OnUpdateScript;
  437. if (handlerUpdateScript != null)
  438. {
  439. foreach (UpdateScript d in handlerUpdateScript.GetInvocationList())
  440. {
  441. try
  442. {
  443. d(clientId, itemId, primId, isScriptRunning, newAssetID);
  444. }
  445. catch (Exception e)
  446. {
  447. m_log.ErrorFormat(
  448. "[EVENT MANAGER]: Delegate for TriggerUpdateScript failed - continuing. {0} {1}",
  449. e.Message, e.StackTrace);
  450. }
  451. }
  452. }
  453. }
  454. /// <summary>
  455. /// Triggered when some scene object properties change.
  456. /// </summary>
  457. /// <remarks>
  458. /// ScriptChangedEvent is fired when a scene object property that a script might be interested
  459. /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event.
  460. /// This is not an indication that the script has changed (see OnUpdateScript for that).
  461. /// This event is sent to a script to tell it that some property changed on
  462. /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed .
  463. /// Triggered by <see cref="TriggerOnScriptChangedEvent"/>
  464. /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.TeleportAgentWithinRegion"/>,
  465. /// <see cref="SceneObjectPart.TriggerScriptChangedEvent"/>
  466. /// </remarks>
  467. public event ScriptChangedEvent OnScriptChangedEvent;
  468. public delegate void ScriptChangedEvent(uint localID, uint change, object data);
  469. public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed);
  470. /// <summary>
  471. /// Triggered when a script receives control input from an agent.
  472. /// </summary>
  473. /// <remarks>
  474. /// Triggered by <see cref="TriggerControlEvent"/>
  475. /// in <see cref="ScenePresence.SendControlsToScripts"/>
  476. /// via <see cref="ScenePresence.HandleAgentUpdate"/>
  477. /// via <see cref="OpenSim.Framework.IClientAPI.OnAgentUpdate"/>
  478. /// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleAgentUpdate"/>
  479. /// </remarks>
  480. public event ScriptControlEvent OnScriptControlEvent;
  481. public delegate void ScriptMovingStartEvent(uint localID);
  482. /// <summary>
  483. /// TODO: Should be triggered when a physics object starts moving.
  484. /// </summary>
  485. public event ScriptMovingStartEvent OnScriptMovingStartEvent;
  486. public delegate void ScriptMovingEndEvent(uint localID);
  487. /// <summary>
  488. /// TODO: Should be triggered when a physics object stops moving.
  489. /// </summary>
  490. public event ScriptMovingEndEvent OnScriptMovingEndEvent;
  491. public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
  492. /// <summary>
  493. /// Triggered when an object has arrived within a tolerance distance
  494. /// of a motion target.
  495. /// </summary>
  496. /// <remarks>
  497. /// Triggered by <see cref="TriggerAtTargetEvent"/>
  498. /// in <see cref="SceneObjectGroup.checkAtTargets"/>
  499. /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
  500. /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
  501. /// </remarks>
  502. public event ScriptAtTargetEvent OnScriptAtTargetEvent;
  503. public delegate void ScriptNotAtTargetEvent(uint localID);
  504. /// <summary>
  505. /// Triggered when an object has a motion target but has not arrived
  506. /// within a tolerance distance.
  507. /// </summary>
  508. /// <remarks>
  509. /// Triggered by <see cref="TriggerNotAtTargetEvent"/>
  510. /// in <see cref="SceneObjectGroup.checkAtTargets"/>
  511. /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
  512. /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
  513. /// </remarks>
  514. public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
  515. public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot);
  516. /// <summary>
  517. /// Triggered when an object has arrived within a tolerance rotation
  518. /// of a rotation target.
  519. /// </summary>
  520. /// <remarks>
  521. /// Triggered by <see cref="TriggerAtRotTargetEvent"/>
  522. /// in <see cref="SceneObjectGroup.checkAtTargets"/>
  523. /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
  524. /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
  525. /// </remarks>
  526. public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent;
  527. public delegate void ScriptNotAtRotTargetEvent(uint localID);
  528. /// <summary>
  529. /// Triggered when an object has a rotation target but has not arrived
  530. /// within a tolerance rotation.
  531. /// </summary>
  532. /// <remarks>
  533. /// Triggered by <see cref="TriggerNotAtRotTargetEvent"/>
  534. /// in <see cref="SceneObjectGroup.checkAtTargets"/>
  535. /// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
  536. /// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
  537. /// </remarks>
  538. public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent;
  539. public delegate void ScriptColliding(uint localID, ColliderArgs colliders);
  540. /// <summary>
  541. /// Triggered when a physical collision has started between a prim
  542. /// and something other than the region terrain.
  543. /// </summary>
  544. /// <remarks>
  545. /// Triggered by <see cref="TriggerScriptCollidingStart"/>
  546. /// in <see cref="SceneObjectPart.SendCollisionEvent"/>
  547. /// via <see cref="SceneObjectPart.PhysicsCollision"/>
  548. /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.OnCollisionUpdate"/>
  549. /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.SendCollisionUpdate"/>
  550. /// </remarks>
  551. public event ScriptColliding OnScriptColliderStart;
  552. /// <summary>
  553. /// Triggered when something that previously collided with a prim has
  554. /// not stopped colliding with it.
  555. /// </summary>
  556. /// <remarks>
  557. /// <seealso cref="OnScriptColliderStart"/>
  558. /// Triggered by <see cref="TriggerScriptColliding"/>
  559. /// in <see cref="SceneObjectPart.SendCollisionEvent"/>
  560. /// via <see cref="SceneObjectPart.PhysicsCollision"/>
  561. /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.OnCollisionUpdate"/>
  562. /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.SendCollisionUpdate"/>
  563. /// </remarks>
  564. public event ScriptColliding OnScriptColliding;
  565. /// <summary>
  566. /// Triggered when something that previously collided with a prim has
  567. /// stopped colliding with it.
  568. /// </summary>
  569. /// <remarks>
  570. /// Triggered by <see cref="TriggerScriptCollidingEnd"/>
  571. /// in <see cref="SceneObjectPart.SendCollisionEvent"/>
  572. /// via <see cref="SceneObjectPart.PhysicsCollision"/>
  573. /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.OnCollisionUpdate"/>
  574. /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.SendCollisionUpdate"/>
  575. /// </remarks>
  576. public event ScriptColliding OnScriptCollidingEnd;
  577. /// <summary>
  578. /// Triggered when a physical collision has started between an object
  579. /// and the region terrain.
  580. /// </summary>
  581. /// <remarks>
  582. /// Triggered by <see cref="TriggerScriptLandCollidingStart"/>
  583. /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
  584. /// via <see cref="SceneObjectPart.PhysicsCollision"/>
  585. /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.OnCollisionUpdate"/>
  586. /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.SendCollisionUpdate"/>
  587. /// </remarks>
  588. public event ScriptColliding OnScriptLandColliderStart;
  589. /// <summary>
  590. /// Triggered when an object that previously collided with the region
  591. /// terrain has not yet stopped colliding with it.
  592. /// </summary>
  593. /// <remarks>
  594. /// Triggered by <see cref="TriggerScriptLandColliding"/>
  595. /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
  596. /// via <see cref="SceneObjectPart.PhysicsCollision"/>
  597. /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.OnCollisionUpdate"/>
  598. /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.SendCollisionUpdate"/>
  599. /// </remarks>
  600. public event ScriptColliding OnScriptLandColliding;
  601. /// <summary>
  602. /// Triggered when an object that previously collided with the region
  603. /// terrain has stopped colliding with it.
  604. /// </summary>
  605. /// <remarks>
  606. /// Triggered by <see cref="TriggerScriptLandCollidingEnd"/>
  607. /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
  608. /// via <see cref="SceneObjectPart.PhysicsCollision"/>
  609. /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.OnCollisionUpdate"/>
  610. /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.SendCollisionUpdate"/>
  611. /// </remarks>
  612. public event ScriptColliding OnScriptLandColliderEnd;
  613. public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
  614. /// <summary>
  615. /// Triggered when an agent has been made a child agent of a scene.
  616. /// </summary>
  617. /// <remarks>
  618. /// Triggered by <see cref="TriggerOnMakeChildAgent"/>
  619. /// in <see cref="ScenePresence.MakeChildAgent"/>
  620. /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.CrossAgentToNewRegionAsync"/>,
  621. /// <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>,
  622. /// <see cref="OpenSim.Region.CoreModules.InterGrid.KillAUser.ShutdownNoLogout"/>
  623. /// </remarks>
  624. public event OnMakeChildAgentDelegate OnMakeChildAgent;
  625. public delegate void OnSaveNewWindlightProfileDelegate();
  626. public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user);
  627. /// <summary>
  628. /// Triggered after the grunt work for adding a root agent to a
  629. /// scene has been performed (resuming attachment scripts, physics,
  630. /// animations etc.)
  631. /// </summary>
  632. /// <remarks>
  633. /// This event is on the critical path for transferring an avatar from one region to another. Try and do
  634. /// as little work on this event as possible, or do work asynchronously.
  635. /// Triggered after <see cref="OnSetRootAgentScene"/>
  636. /// by <see cref="TriggerOnMakeRootAgent"/>
  637. /// in <see cref="ScenePresence.MakeRootAgent"/>
  638. /// via <see cref="Scene.AgentCrossing"/>
  639. /// and <see cref="ScenePresence.CompleteMovement"/>
  640. /// </remarks>
  641. public event Action<ScenePresence> OnMakeRootAgent;
  642. public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted;
  643. public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile;
  644. /// <summary>
  645. /// Triggered when an object or attachment enters a scene
  646. /// </summary>
  647. public event OnIncomingSceneObjectDelegate OnIncomingSceneObject;
  648. public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so);
  649. public delegate void NewInventoryItemUploadComplete(InventoryItemBase item, int userlevel);
  650. public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete;
  651. public delegate void RequestChangeWaterHeight(float height);
  652. public event RequestChangeWaterHeight OnRequestChangeWaterHeight;
  653. /// <summary>
  654. /// Fired if any avatar is 'killed' due to its health falling to zero
  655. /// </summary>
  656. public event AvatarKillData OnAvatarKilled;
  657. public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar);
  658. /*
  659. public delegate void ScriptTimerEvent(uint localID, double timerinterval);
  660. /// <summary>
  661. /// Used to be triggered when the LSL timer event fires.
  662. /// </summary>
  663. /// <remarks>
  664. /// Triggered by <see cref="TriggerTimerEvent"/>
  665. /// via <see cref="SceneObjectPart.handleTimerAccounting"/>
  666. /// </remarks>
  667. public event ScriptTimerEvent OnScriptTimerEvent;
  668. */
  669. public delegate void EstateToolsSunUpdate(ulong regionHandle);
  670. public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
  671. public event EstateToolsSunUpdate OnEstateToolsSunUpdate;
  672. /// <summary>
  673. /// Triggered when an object is added to the scene.
  674. /// </summary>
  675. /// <remarks>
  676. /// Triggered by <see cref="TriggerObjectAddedToScene"/>
  677. /// in <see cref="Scene.AddNewSceneObject"/>,
  678. /// <see cref="Scene.DuplicateObject"/>,
  679. /// <see cref="Scene.doObjectDuplicateOnRay"/>
  680. /// </remarks>
  681. public event Action<SceneObjectGroup> OnObjectAddedToScene;
  682. /// <summary>
  683. /// When a client sends a derez request for an object inworld
  684. /// but before the object is deleted
  685. /// </summary>
  686. public event DeRezRequested OnDeRezRequested;
  687. /// <summary>
  688. /// Triggered when a client sends a derez request for an object inworld
  689. /// </summary>
  690. /// <param name="remoteClient">The client question (it can be null)</param>
  691. /// <param name="obj">The object in question</param>
  692. /// <param name="action">The exact derez action</param>
  693. /// <returns>Flag indicating whether the object should be deleted from the scene or not</returns>
  694. public delegate bool DeRezRequested(IClientAPI remoteClient, List<SceneObjectGroup> objs, DeRezAction action);
  695. /// <summary>
  696. /// Triggered when an object is removed from the scene.
  697. /// </summary>
  698. /// <remarks>
  699. /// Triggered by <see cref="TriggerObjectBeingRemovedFromScene"/>
  700. /// in <see cref="Scene.DeleteSceneObject"/>
  701. /// </remarks>
  702. public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
  703. /// <summary>
  704. /// Delegate for <see cref="OnObjectBeingRemovedFromScene"/>
  705. /// </summary>
  706. /// <param name="obj">The object being removed from the scene</param>
  707. public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
  708. /// <summary>
  709. /// Triggered when an object is placed into the physical scene (PhysicsActor created).
  710. /// </summary>
  711. public event Action<SceneObjectPart> OnObjectAddedToPhysicalScene;
  712. /// <summary>
  713. /// Triggered when an object is removed from the physical scene (PhysicsActor destroyed).
  714. /// </summary>
  715. /// <remarks>
  716. /// Note: this is triggered just before the PhysicsActor is removed from the
  717. /// physics engine so the receiver can do any necessary cleanup before its destruction.
  718. /// </remarks>
  719. public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene;
  720. public delegate void NoticeNoLandDataFromStorage();
  721. public event NoticeNoLandDataFromStorage OnNoticeNoLandDataFromStorage;
  722. public delegate void IncomingLandDataFromStorage(List<LandData> data);
  723. public event IncomingLandDataFromStorage OnIncomingLandDataFromStorage;
  724. public delegate void SetAllowForcefulBan(bool allow);
  725. public event SetAllowForcefulBan OnSetAllowForcefulBan;
  726. public delegate void RequestParcelPrimCountUpdate();
  727. public event RequestParcelPrimCountUpdate OnRequestParcelPrimCountUpdate;
  728. public delegate void ParcelPrimCountTainted();
  729. /// <summary>
  730. /// Triggered when the parcel prim count has been altered.
  731. /// </summary>
  732. /// <remarks>
  733. /// Triggered by <see cref="TriggerParcelPrimCountTainted"/> in
  734. /// <see cref="OpenSim.Region.CoreModules.Avatar.Attachments.AttachmentsModule.DetachSingleAttachmentToGround"/>,
  735. /// <see cref="OpenSim.Region.CoreModules.Avatar.Attachments.AttachmentsModule.AttachToAgent"/>,
  736. /// <see cref="Scene.DeleteSceneObject"/>,
  737. /// <see cref="Scene.SelectPrim"/>,
  738. /// <see cref="Scene.DeselectPrim"/>,
  739. /// <see cref="SceneObjectGroup.UpdateFlags"/>,
  740. /// <see cref="SceneObjectGroup.AbsolutePosition"/>
  741. /// </remarks>
  742. public event ParcelPrimCountTainted OnParcelPrimCountTainted;
  743. public event GetScriptRunning OnGetScriptRunning;
  744. public delegate void ThrottleUpdate(ScenePresence scenePresence);
  745. public event ThrottleUpdate OnThrottleUpdate;
  746. /// <summary>
  747. /// RegisterCapsEvent is called by Scene after the Caps object
  748. /// has been instantiated and before it is return to the
  749. /// client and provides region modules to add their caps.
  750. /// </summary>
  751. public delegate void RegisterCapsEvent(UUID agentID, Caps caps);
  752. public event RegisterCapsEvent OnRegisterCaps;
  753. /// <summary>
  754. /// DeregisterCapsEvent is called by Scene when the caps
  755. /// handler for an agent are removed.
  756. /// </summary>
  757. public delegate void DeregisterCapsEvent(UUID agentID, Caps caps);
  758. public event DeregisterCapsEvent OnDeregisterCaps;
  759. /// <summary>
  760. /// ChatFromWorldEvent is called via Scene when a chat message
  761. /// from world comes in.
  762. /// </summary>
  763. public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat);
  764. public event ChatFromWorldEvent OnChatFromWorld;
  765. /// <summary>
  766. /// ChatFromClientEvent is triggered via ChatModule (or
  767. /// substitutes thereof) when a chat message
  768. /// from the client comes in.
  769. /// </summary>
  770. public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat);
  771. public event ChatFromClientEvent OnChatFromClient;
  772. /// <summary>
  773. /// ChatToClientsEvent is triggered via ChatModule (or
  774. /// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a
  775. /// received chat message if they satisfy various conditions (within audible range, etc.)
  776. /// </summary>
  777. public delegate void ChatToClientsEvent(
  778. UUID senderID, HashSet<UUID> receiverIDs,
  779. string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
  780. ChatSourceType src, ChatAudibleLevel level);
  781. public event ChatToClientsEvent OnChatToClients;
  782. /// <summary>
  783. /// ChatBroadcastEvent is called via Scene when a broadcast chat message
  784. /// from world comes in
  785. /// </summary>
  786. public delegate void ChatBroadcastEvent(Object sender, OSChatMessage chat);
  787. public event ChatBroadcastEvent OnChatBroadcast;
  788. public delegate float SunLindenHour();
  789. public event SunLindenHour OnGetCurrentTimeAsLindenSunHour;
  790. /// <summary>
  791. /// Called when oar file has finished loading, although
  792. /// the scripts may not have started yet
  793. /// Message is non empty string if there were problems loading the oar file
  794. /// </summary>
  795. public delegate void OarFileLoaded(Guid guid, List<UUID> loadedScenes, string message);
  796. public event OarFileLoaded OnOarFileLoaded;
  797. /// <summary>
  798. /// Called when an oar file has finished saving
  799. /// Message is non empty string if there were problems saving the oar file
  800. /// If a guid was supplied on the original call to identify, the request, this is returned. Otherwise
  801. /// Guid.Empty is returned.
  802. /// </summary>
  803. public delegate void OarFileSaved(Guid guid, string message);
  804. public event OarFileSaved OnOarFileSaved;
  805. /// <summary>
  806. /// Called when the script compile queue becomes empty
  807. /// Returns the number of scripts which failed to start
  808. /// </summary>
  809. public delegate void EmptyScriptCompileQueue(int numScriptsFailed, string message);
  810. public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue;
  811. /// <summary>
  812. /// Called whenever an object is attached, or detached from an in-world presence.
  813. /// </summary>
  814. /// If the object is being attached, then the avatarID will be present. If the object is being detached then
  815. /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical).
  816. public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
  817. public event Attach OnAttach;
  818. /// <summary>
  819. /// Called immediately after an object is loaded from storage.
  820. /// </summary>
  821. public event SceneObjectDelegate OnSceneObjectLoaded;
  822. public delegate void SceneObjectDelegate(SceneObjectGroup so);
  823. /// <summary>
  824. /// Called immediately before an object is saved to storage.
  825. /// </summary>
  826. /// <param name="persistingSo">
  827. /// The scene object being persisted.
  828. /// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory.
  829. /// </param>
  830. /// <param name="originalSo">
  831. /// The original scene object being persisted. Changes here will stay in memory but will not be saved to storage on this save.
  832. /// </param>
  833. public event SceneObjectPreSaveDelegate OnSceneObjectPreSave;
  834. public delegate void SceneObjectPreSaveDelegate(SceneObjectGroup persistingSo, SceneObjectGroup originalSo);
  835. /// <summary>
  836. /// Called when a scene object part is cloned within the region.
  837. /// </summary>
  838. /// <param name="copy"></param>
  839. /// <param name="original"></param>
  840. /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
  841. /// <remarks>
  842. /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.SceneObjectPart.Copy"/>
  843. /// </remarks>
  844. public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy;
  845. public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
  846. public delegate void SceneObjectPartUpdated(SceneObjectPart sop, bool full);
  847. public event SceneObjectPartUpdated OnSceneObjectPartUpdated;
  848. public delegate void ScenePresenceUpdated(ScenePresence sp);
  849. public event ScenePresenceUpdated OnScenePresenceUpdated;
  850. public delegate void RegionUp(GridRegion region);
  851. public event RegionUp OnRegionUp;
  852. public delegate void RegionStarted(Scene scene);
  853. public event RegionStarted OnRegionStarted;
  854. public delegate void RegionHeartbeatStart(Scene scene);
  855. public event RegionHeartbeatStart OnRegionHeartbeatStart;
  856. public delegate void RegionHeartbeatEnd(Scene scene);
  857. public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
  858. /// <summary>
  859. /// Fired when logins to a region are enabled or disabled.
  860. /// </summary>
  861. /// <remarks>
  862. ///
  863. /// </remarks>
  864. /// Fired
  865. public event RegionLoginsStatusChange OnRegionLoginsStatusChange;
  866. public delegate void RegionLoginsStatusChange(IScene scene);
  867. /// <summary>
  868. /// Fired when a region is considered ready for use.
  869. /// </summary>
  870. /// <remarks>
  871. /// A region is considered ready when startup operations such as loading of scripts already on the region
  872. /// have been completed.
  873. /// </remarks>
  874. public event Action<IScene> OnRegionReadyStatusChange;
  875. public delegate void PrimsLoaded(Scene s);
  876. public event PrimsLoaded OnPrimsLoaded;
  877. public delegate void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout);
  878. /// <summary>
  879. /// Triggered when a teleport starts
  880. /// </summary>
  881. /// <remarks>
  882. /// Triggered by <see cref="TriggerTeleportStart"/>
  883. /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.CreateAgent"/>
  884. /// and <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.HGEntityTransferModule.CreateAgent"/>
  885. /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>
  886. /// </remarks>
  887. public event TeleportStart OnTeleportStart;
  888. public delegate void TeleportFail(IClientAPI client, bool gridLogout);
  889. /// <summary>
  890. /// Trigered when a teleport fails.
  891. /// </summary>
  892. /// <remarks>
  893. /// Triggered by <see cref="TriggerTeleportFail"/>
  894. /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.Fail"/>
  895. /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>
  896. /// </remarks>
  897. public event TeleportFail OnTeleportFail;
  898. // public delegate void GatherUuids(SceneObjectPart sop, IDictionary<UUID, AssetType> assetUuids);
  899. //
  900. // /// <summary>
  901. // /// Triggered when UUIDs referenced by a scene object are being gathered for archiving, hg transfer, etc.
  902. // /// </summary>
  903. // /// <remarks>
  904. // /// The listener should add references to the IDictionary<UUID, AssetType> as appropriate.
  905. // /// </remarks>
  906. // public event GatherUuids OnGatherUuids;
  907. public class MoneyTransferArgs : EventArgs
  908. {
  909. public UUID sender;
  910. public UUID receiver;
  911. /// <summary>
  912. /// Always false. The SL protocol sucks.
  913. /// </summary>
  914. public bool authenticated = false;
  915. public int amount;
  916. public int transactiontype;
  917. public string description;
  918. public MoneyTransferArgs(UUID asender, UUID areceiver, int aamount, int atransactiontype, string adescription)
  919. {
  920. sender = asender;
  921. receiver = areceiver;
  922. amount = aamount;
  923. transactiontype = atransactiontype;
  924. description = adescription;
  925. }
  926. }
  927. public class LandBuyArgs : EventArgs
  928. {
  929. public UUID agentId = UUID.Zero;
  930. public UUID groupId = UUID.Zero;
  931. public UUID parcelOwnerID = UUID.Zero;
  932. public bool final = false;
  933. public bool groupOwned = false;
  934. public bool removeContribution = false;
  935. public int parcelLocalID = 0;
  936. public int parcelArea = 0;
  937. public int parcelPrice = 0;
  938. public bool authenticated = false;
  939. public bool landValidated = false;
  940. public bool economyValidated = false;
  941. public int transactionID = 0;
  942. public int amountDebited = 0;
  943. public LandBuyArgs(UUID pagentId, UUID pgroupId, bool pfinal, bool pgroupOwned,
  944. bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice,
  945. bool pauthenticated)
  946. {
  947. agentId = pagentId;
  948. groupId = pgroupId;
  949. final = pfinal;
  950. groupOwned = pgroupOwned;
  951. removeContribution = premoveContribution;
  952. parcelLocalID = pparcelLocalID;
  953. parcelArea = pparcelArea;
  954. parcelPrice = pparcelPrice;
  955. authenticated = pauthenticated;
  956. }
  957. }
  958. public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e);
  959. public delegate void LandBuy(Object sender, LandBuyArgs e);
  960. /// <summary>
  961. /// Triggered when an attempt to transfer grid currency occurs
  962. /// </summary>
  963. /// <remarks>
  964. /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessMoneyTransferRequest"/>
  965. /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientGridEvents"/>
  966. /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientEvents"/>
  967. /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewAgent"/>
  968. /// </remarks>
  969. public event MoneyTransferEvent OnMoneyTransfer;
  970. /// <summary>
  971. /// Triggered after after <see cref="OnValidateLandBuy"/>
  972. /// </summary>
  973. public event LandBuy OnLandBuy;
  974. /// <summary>
  975. /// Triggered to allow or prevent a real estate transaction
  976. /// </summary>
  977. /// <remarks>
  978. /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessParcelBuy"/>
  979. /// <seealso cref="OpenSim.Region.OptionalModules.World.MoneyModule.SampleMoneyModule.ValidateLandBuy"/>
  980. /// </remarks>
  981. public event LandBuy OnValidateLandBuy;
  982. public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
  983. {
  984. Attach handlerOnAttach = OnAttach;
  985. if (handlerOnAttach != null)
  986. {
  987. foreach (Attach d in handlerOnAttach.GetInvocationList())
  988. {
  989. try
  990. {
  991. d(localID, itemID, avatarID);
  992. }
  993. catch (Exception e)
  994. {
  995. m_log.ErrorFormat(
  996. "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
  997. e.Message, e.StackTrace);
  998. }
  999. }
  1000. }
  1001. }
  1002. public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
  1003. {
  1004. GetScriptRunning handlerGetScriptRunning = OnGetScriptRunning;
  1005. if (handlerGetScriptRunning != null)
  1006. {
  1007. foreach (GetScriptRunning d in handlerGetScriptRunning.GetInvocationList())
  1008. {
  1009. try
  1010. {
  1011. d(controllingClient, objectID, itemID);
  1012. }
  1013. catch (Exception e)
  1014. {
  1015. m_log.ErrorFormat(
  1016. "[EVENT MANAGER]: Delegate for TriggerGetScriptRunning failed - continuing. {0} {1}",
  1017. e.Message, e.StackTrace);
  1018. }
  1019. }
  1020. }
  1021. }
  1022. public void TriggerOnScriptChangedEvent(uint localID, uint change, object parameter = null)
  1023. {
  1024. ScriptChangedEvent handlerScriptChangedEvent = OnScriptChangedEvent;
  1025. if (handlerScriptChangedEvent != null)
  1026. {
  1027. foreach (ScriptChangedEvent d in handlerScriptChangedEvent.GetInvocationList())
  1028. {
  1029. try
  1030. {
  1031. d(localID, change, parameter);
  1032. }
  1033. catch (Exception e)
  1034. {
  1035. m_log.ErrorFormat(
  1036. "[EVENT MANAGER]: Delegate for TriggerOnScriptChangedEvent failed - continuing. {0} {1}",
  1037. e.Message, e.StackTrace);
  1038. }
  1039. }
  1040. }
  1041. }
  1042. public void TriggerOnClientMovement(ScenePresence avatar)
  1043. {
  1044. ClientMovement handlerClientMovement = OnClientMovement;
  1045. if (handlerClientMovement != null)
  1046. {
  1047. foreach (ClientMovement d in handlerClientMovement.GetInvocationList())
  1048. {
  1049. try
  1050. {
  1051. d(avatar);
  1052. }
  1053. catch (Exception e)
  1054. {
  1055. m_log.ErrorFormat(
  1056. "[EVENT MANAGER]: Delegate for TriggerOnClientMovement failed - continuing. {0} {1}",
  1057. e.Message, e.StackTrace);
  1058. }
  1059. }
  1060. }
  1061. }
  1062. public void TriggerPermissionError(UUID user, string reason)
  1063. {
  1064. OnPermissionErrorDelegate handlerPermissionError = OnPermissionError;
  1065. if (handlerPermissionError != null)
  1066. {
  1067. foreach (OnPermissionErrorDelegate d in handlerPermissionError.GetInvocationList())
  1068. {
  1069. try
  1070. {
  1071. d(user, reason);
  1072. }
  1073. catch (Exception e)
  1074. {
  1075. m_log.ErrorFormat(
  1076. "[EVENT MANAGER]: Delegate for TriggerPermissionError failed - continuing. {0} {1}",
  1077. e.Message, e.StackTrace);
  1078. }
  1079. }
  1080. }
  1081. }
  1082. public void TriggerOnPluginConsole(string[] args)
  1083. {
  1084. OnPluginConsoleDelegate handlerPluginConsole = OnPluginConsole;
  1085. if (handlerPluginConsole != null)
  1086. {
  1087. foreach (OnPluginConsoleDelegate d in handlerPluginConsole.GetInvocationList())
  1088. {
  1089. try
  1090. {
  1091. d(args);
  1092. }
  1093. catch (Exception e)
  1094. {
  1095. m_log.ErrorFormat(
  1096. "[EVENT MANAGER]: Delegate for TriggerOnPluginConsole failed - continuing. {0} {1}",
  1097. e.Message, e.StackTrace);
  1098. }
  1099. }
  1100. }
  1101. }
  1102. public void TriggerOnFrame()
  1103. {
  1104. OnFrameDelegate handlerFrame = OnFrame;
  1105. if (handlerFrame != null)
  1106. {
  1107. foreach (OnFrameDelegate d in handlerFrame.GetInvocationList())
  1108. {
  1109. try
  1110. {
  1111. d();
  1112. }
  1113. catch (Exception e)
  1114. {
  1115. m_log.ErrorFormat(
  1116. "[EVENT MANAGER]: Delegate for TriggerOnFrame failed - continuing. {0} {1}",
  1117. e.Message, e.StackTrace);
  1118. }
  1119. }
  1120. }
  1121. }
  1122. public void TriggerOnNewClient(IClientAPI client)
  1123. {
  1124. OnNewClientDelegate handlerNewClient = OnNewClient;
  1125. if (handlerNewClient != null)
  1126. {
  1127. foreach (OnNewClientDelegate d in handlerNewClient.GetInvocationList())
  1128. {
  1129. try
  1130. {
  1131. d(client);
  1132. }
  1133. catch (Exception e)
  1134. {
  1135. m_log.ErrorFormat(
  1136. "[EVENT MANAGER]: Delegate for TriggerOnNewClient failed - continuing. {0} {1}",
  1137. e.Message, e.StackTrace);
  1138. }
  1139. }
  1140. }
  1141. if (client is IClientCore)
  1142. {
  1143. OnClientConnectCoreDelegate handlerClientConnect = OnClientConnect;
  1144. if (handlerClientConnect != null)
  1145. {
  1146. foreach (OnClientConnectCoreDelegate d in handlerClientConnect.GetInvocationList())
  1147. {
  1148. try
  1149. {
  1150. d((IClientCore)client);
  1151. }
  1152. catch (Exception e)
  1153. {
  1154. m_log.ErrorFormat(
  1155. "[EVENT MANAGER]: Delegate for TriggerOnNewClient (IClientCore) failed - continuing. {0} {1}",
  1156. e.Message, e.StackTrace);
  1157. }
  1158. }
  1159. }
  1160. }
  1161. }
  1162. public void TriggerOnClientLogin(IClientAPI client)
  1163. {
  1164. Action<IClientAPI> handlerClientLogin = OnClientLogin;
  1165. if (handlerClientLogin != null)
  1166. {
  1167. foreach (Action<IClientAPI> d in handlerClientLogin.GetInvocationList())
  1168. {
  1169. try
  1170. {
  1171. d(client);
  1172. }
  1173. catch (Exception e)
  1174. {
  1175. m_log.ErrorFormat(
  1176. "[EVENT MANAGER]: Delegate for TriggerOnClientLogin failed - continuing. {0} {1}",
  1177. e.Message, e.StackTrace);
  1178. }
  1179. }
  1180. }
  1181. }
  1182. public void TriggerOnNewPresence(ScenePresence presence)
  1183. {
  1184. OnNewPresenceDelegate handlerNewPresence = OnNewPresence;
  1185. if (handlerNewPresence != null)
  1186. {
  1187. foreach (OnNewPresenceDelegate d in handlerNewPresence.GetInvocationList())
  1188. {
  1189. try
  1190. {
  1191. d(presence);
  1192. }
  1193. catch (Exception e)
  1194. {
  1195. m_log.ErrorFormat(
  1196. "[EVENT MANAGER]: Delegate for TriggerOnNewPresence failed - continuing. {0} {1}",
  1197. e.Message, e.StackTrace);
  1198. }
  1199. }
  1200. }
  1201. }
  1202. public void TriggerOnRemovePresence(UUID agentId)
  1203. {
  1204. OnRemovePresenceDelegate handlerRemovePresence = OnRemovePresence;
  1205. if (handlerRemovePresence != null)
  1206. {
  1207. foreach (OnRemovePresenceDelegate d in handlerRemovePresence.GetInvocationList())
  1208. {
  1209. try
  1210. {
  1211. // m_log.ErrorFormat("[EVENT MANAGER]: OnRemovePresenceDelegate: {0}",d.Target.ToString());
  1212. d(agentId);
  1213. // m_log.ErrorFormat("[EVENT MANAGER]: OnRemovePresenceDelegate done ");
  1214. }
  1215. catch (Exception e)
  1216. {
  1217. m_log.ErrorFormat(
  1218. "[EVENT MANAGER]: Delegate for TriggerOnRemovePresence failed - continuing. {0} {1}",
  1219. e.Message, e.StackTrace);
  1220. }
  1221. }
  1222. }
  1223. }
  1224. public void TriggerOnBackup(ISimulationDataService dstore, bool forced)
  1225. {
  1226. OnBackupDelegate handlerOnAttach = OnBackup;
  1227. if (handlerOnAttach != null)
  1228. {
  1229. foreach (OnBackupDelegate d in handlerOnAttach.GetInvocationList())
  1230. {
  1231. try
  1232. {
  1233. d(dstore, forced);
  1234. }
  1235. catch (Exception e)
  1236. {
  1237. m_log.ErrorFormat(
  1238. "[EVENT MANAGER]: Delegate for TriggerOnBackup failed - continuing. {0} {1}",
  1239. e.Message, e.StackTrace);
  1240. }
  1241. }
  1242. }
  1243. }
  1244. public void TriggerParcelPrimCountUpdate()
  1245. {
  1246. OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = OnParcelPrimCountUpdate;
  1247. if (handlerParcelPrimCountUpdate != null)
  1248. {
  1249. foreach (OnParcelPrimCountUpdateDelegate d in handlerParcelPrimCountUpdate.GetInvocationList())
  1250. {
  1251. try
  1252. {
  1253. d();
  1254. }
  1255. catch (Exception e)
  1256. {
  1257. m_log.ErrorFormat(
  1258. "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountUpdate failed - continuing. {0} {1}",
  1259. e.Message, e.StackTrace);
  1260. }
  1261. }
  1262. }
  1263. }
  1264. public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs args)
  1265. {
  1266. MoneyTransferEvent handlerMoneyTransfer = OnMoneyTransfer;
  1267. if (handlerMoneyTransfer != null)
  1268. {
  1269. foreach (MoneyTransferEvent d in handlerMoneyTransfer.GetInvocationList())
  1270. {
  1271. try
  1272. {
  1273. d(sender, args);
  1274. }
  1275. catch (Exception e)
  1276. {
  1277. m_log.ErrorFormat(
  1278. "[EVENT MANAGER]: Delegate for TriggerMoneyTransfer failed - continuing. {0} {1}",
  1279. e.Message, e.StackTrace);
  1280. }
  1281. }
  1282. }
  1283. }
  1284. public void TriggerTerrainUpdate()
  1285. {
  1286. OnTerrainUpdateDelegate handlerTerrainUpdate = OnTerrainUpdate;
  1287. if (handlerTerrainUpdate != null)
  1288. {
  1289. foreach (OnTerrainUpdateDelegate d in handlerTerrainUpdate.GetInvocationList())
  1290. {
  1291. try
  1292. {
  1293. d();
  1294. }
  1295. catch (Exception e)
  1296. {
  1297. m_log.ErrorFormat(
  1298. "[EVENT MANAGER]: Delegate for TriggerTerrainUpdate failed - continuing. {0} {1}",
  1299. e.Message, e.StackTrace);
  1300. }
  1301. }
  1302. }
  1303. }
  1304. public void TriggerTerrainTick()
  1305. {
  1306. OnTerrainTickDelegate handlerTerrainTick = OnTerrainTick;
  1307. if (handlerTerrainTick != null)
  1308. {
  1309. foreach (OnTerrainTickDelegate d in handlerTerrainTick.GetInvocationList())
  1310. {
  1311. try
  1312. {
  1313. d();
  1314. }
  1315. catch (Exception e)
  1316. {
  1317. m_log.ErrorFormat(
  1318. "[EVENT MANAGER]: Delegate for TriggerTerrainTick failed - continuing. {0} {1}",
  1319. e.Message, e.StackTrace);
  1320. }
  1321. }
  1322. }
  1323. }
  1324. public void TriggerTerrainCheckUpdates()
  1325. {
  1326. OnTerrainCheckUpdatesDelegate TerrainCheckUpdates = OnTerrainCheckUpdates;
  1327. if (TerrainCheckUpdates != null)
  1328. {
  1329. foreach (OnTerrainCheckUpdatesDelegate d in TerrainCheckUpdates.GetInvocationList())
  1330. {
  1331. try
  1332. {
  1333. d();
  1334. }
  1335. catch (Exception e)
  1336. {
  1337. m_log.ErrorFormat(
  1338. "[EVENT MANAGER]: Delegate for TerrainCheckUpdates failed - continuing. {0} {1}",
  1339. e.Message, e.StackTrace);
  1340. }
  1341. }
  1342. }
  1343. }
  1344. public void TriggerTerrainTainted()
  1345. {
  1346. OnTerrainTaintedDelegate handlerTerrainTainted = OnTerrainTainted;
  1347. if (handlerTerrainTainted != null)
  1348. {
  1349. foreach (OnTerrainTaintedDelegate d in handlerTerrainTainted.GetInvocationList())
  1350. {
  1351. try
  1352. {
  1353. d();
  1354. }
  1355. catch (Exception e)
  1356. {
  1357. m_log.ErrorFormat(
  1358. "[EVENT MANAGER]: Delegate for TriggerTerrainTainted failed - continuing. {0} {1}",
  1359. e.Message, e.StackTrace);
  1360. }
  1361. }
  1362. }
  1363. }
  1364. public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
  1365. {
  1366. OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = OnParcelPrimCountAdd;
  1367. if (handlerParcelPrimCountAdd != null)
  1368. {
  1369. foreach (OnParcelPrimCountAddDelegate d in handlerParcelPrimCountAdd.GetInvocationList())
  1370. {
  1371. try
  1372. {
  1373. d(obj);
  1374. }
  1375. catch (Exception e)
  1376. {
  1377. m_log.ErrorFormat(
  1378. "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountAdd failed - continuing. {0} {1}",
  1379. e.Message, e.StackTrace);
  1380. }
  1381. }
  1382. }
  1383. }
  1384. public void TriggerObjectAddedToScene(SceneObjectGroup obj)
  1385. {
  1386. Action<SceneObjectGroup> handler = OnObjectAddedToScene;
  1387. if (handler != null)
  1388. {
  1389. foreach (Action<SceneObjectGroup> d in handler.GetInvocationList())
  1390. {
  1391. try
  1392. {
  1393. d(obj);
  1394. }
  1395. catch (Exception e)
  1396. {
  1397. m_log.ErrorFormat(
  1398. "[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing. {0} {1}",
  1399. e.Message, e.StackTrace);
  1400. }
  1401. }
  1402. }
  1403. }
  1404. public bool TriggerDeRezRequested(IClientAPI client, List<SceneObjectGroup> objs, DeRezAction action)
  1405. {
  1406. bool canDeRez = true;
  1407. DeRezRequested handlerDeRezRequested = OnDeRezRequested;
  1408. if (handlerDeRezRequested != null)
  1409. {
  1410. foreach (DeRezRequested d in handlerDeRezRequested.GetInvocationList())
  1411. {
  1412. try
  1413. {
  1414. canDeRez &= d(client, objs, action);
  1415. }
  1416. catch (Exception e)
  1417. {
  1418. m_log.ErrorFormat(
  1419. "[EVENT MANAGER]: Delegate for TriggerDeRezRequested failed - continuing. {0} {1}",
  1420. e.Message, e.StackTrace);
  1421. }
  1422. }
  1423. }
  1424. return canDeRez;
  1425. }
  1426. public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
  1427. {
  1428. ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
  1429. if (handlerObjectBeingRemovedFromScene != null)
  1430. {
  1431. foreach (ObjectBeingRemovedFromScene d in handlerObjectBeingRemovedFromScene.GetInvocationList())
  1432. {
  1433. try
  1434. {
  1435. d(obj);
  1436. }
  1437. catch (Exception e)
  1438. {
  1439. m_log.ErrorFormat(
  1440. "[EVENT MANAGER]: Delegate for TriggerObjectBeingRemovedFromScene failed - continuing. {0} {1}",
  1441. e.Message, e.StackTrace);
  1442. }
  1443. }
  1444. }
  1445. }
  1446. public void TriggerObjectAddedToPhysicalScene(SceneObjectPart obj)
  1447. {
  1448. Action<SceneObjectPart> handler = OnObjectAddedToPhysicalScene;
  1449. if (handler != null)
  1450. {
  1451. foreach (Action<SceneObjectPart> d in handler.GetInvocationList())
  1452. {
  1453. try
  1454. {
  1455. d(obj);
  1456. }
  1457. catch (Exception e)
  1458. {
  1459. m_log.ErrorFormat(
  1460. "[EVENT MANAGER]: Delegate for TriggerObjectAddedToPhysicalScene failed - continuing. {0} {1}",
  1461. e.Message, e.StackTrace);
  1462. }
  1463. }
  1464. }
  1465. }
  1466. public void TriggerObjectRemovedFromPhysicalScene(SceneObjectPart obj)
  1467. {
  1468. Action<SceneObjectPart> handler = OnObjectRemovedFromPhysicalScene;
  1469. if (handler != null)
  1470. {
  1471. foreach (Action<SceneObjectPart> d in handler.GetInvocationList())
  1472. {
  1473. try
  1474. {
  1475. d(obj);
  1476. }
  1477. catch (Exception e)
  1478. {
  1479. m_log.ErrorFormat(
  1480. "[EVENT MANAGER]: Delegate for TriggerObjectRemovedFromPhysicalScene failed - continuing. {0} {1}",
  1481. e.Message, e.StackTrace);
  1482. }
  1483. }
  1484. }
  1485. }
  1486. public void TriggerShutdown()
  1487. {
  1488. Action handlerShutdown = OnShutdown;
  1489. if (handlerShutdown != null)
  1490. {
  1491. foreach (Action d in handlerShutdown.GetInvocationList())
  1492. {
  1493. try
  1494. {
  1495. d();
  1496. }
  1497. catch (Exception e)
  1498. {
  1499. m_log.ErrorFormat(
  1500. "[EVENT MANAGER]: Delegate for TriggerShutdown failed - continuing. {0} {1}",
  1501. e.Message, e.StackTrace);
  1502. }
  1503. }
  1504. }
  1505. }
  1506. public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  1507. {
  1508. ObjectGrabDelegate handlerObjectGrab = OnObjectGrab;
  1509. if (handlerObjectGrab != null)
  1510. {
  1511. foreach (ObjectGrabDelegate d in handlerObjectGrab.GetInvocationList())
  1512. {
  1513. try
  1514. {
  1515. d(localID, originalID, offsetPos, remoteClient, surfaceArgs);
  1516. }
  1517. catch (Exception e)
  1518. {
  1519. m_log.ErrorFormat(
  1520. "[EVENT MANAGER]: Delegate for TriggerObjectGrab failed - continuing. {0} {1}",
  1521. e.Message, e.StackTrace);
  1522. }
  1523. }
  1524. }
  1525. }
  1526. public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  1527. {
  1528. ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing;
  1529. if (handlerObjectGrabbing != null)
  1530. {
  1531. foreach (ObjectGrabDelegate d in handlerObjectGrabbing.GetInvocationList())
  1532. {
  1533. try
  1534. {
  1535. d(localID, originalID, offsetPos, remoteClient, surfaceArgs);
  1536. }
  1537. catch (Exception e)
  1538. {
  1539. m_log.ErrorFormat(
  1540. "[EVENT MANAGER]: Delegate for TriggerObjectGrabbing failed - continuing. {0} {1}",
  1541. e.Message, e.StackTrace);
  1542. }
  1543. }
  1544. }
  1545. }
  1546. public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  1547. {
  1548. ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab;
  1549. if (handlerObjectDeGrab != null)
  1550. {
  1551. foreach (ObjectDeGrabDelegate d in handlerObjectDeGrab.GetInvocationList())
  1552. {
  1553. try
  1554. {
  1555. d(localID, originalID, remoteClient, surfaceArgs);
  1556. }
  1557. catch (Exception e)
  1558. {
  1559. m_log.ErrorFormat(
  1560. "[EVENT MANAGER]: Delegate for TriggerObjectDeGrab failed - continuing. {0} {1}",
  1561. e.Message, e.StackTrace);
  1562. }
  1563. }
  1564. }
  1565. }
  1566. public void TriggerScriptReset(uint localID, UUID itemID)
  1567. {
  1568. ScriptResetDelegate handlerScriptReset = OnScriptReset;
  1569. if (handlerScriptReset != null)
  1570. {
  1571. foreach (ScriptResetDelegate d in handlerScriptReset.GetInvocationList())
  1572. {
  1573. try
  1574. {
  1575. d(localID, itemID);
  1576. }
  1577. catch (Exception e)
  1578. {
  1579. m_log.ErrorFormat(
  1580. "[EVENT MANAGER]: Delegate for TriggerScriptReset failed - continuing. {0} {1}",
  1581. e.Message, e.StackTrace);
  1582. }
  1583. }
  1584. }
  1585. }
  1586. public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
  1587. {
  1588. NewRezScript handlerRezScript = OnRezScript;
  1589. if (handlerRezScript != null)
  1590. {
  1591. foreach (NewRezScript d in handlerRezScript.GetInvocationList())
  1592. {
  1593. try
  1594. {
  1595. d(localID, itemID, script, startParam, postOnRez, engine, stateSource);
  1596. }
  1597. catch (Exception e)
  1598. {
  1599. m_log.ErrorFormat(
  1600. "[EVENT MANAGER]: Delegate for TriggerRezScript failed - continuing. {0} {1}",
  1601. e.Message, e.StackTrace);
  1602. }
  1603. }
  1604. }
  1605. }
  1606. public void TriggerStartScript(uint localID, UUID itemID)
  1607. {
  1608. StartScript handlerStartScript = OnStartScript;
  1609. if (handlerStartScript != null)
  1610. {
  1611. foreach (StartScript d in handlerStartScript.GetInvocationList())
  1612. {
  1613. try
  1614. {
  1615. d(localID, itemID);
  1616. }
  1617. catch (Exception e)
  1618. {
  1619. m_log.ErrorFormat(
  1620. "[EVENT MANAGER]: Delegate for TriggerStartScript failed - continuing. {0} {1}",
  1621. e.Message, e.StackTrace);
  1622. }
  1623. }
  1624. }
  1625. }
  1626. public void TriggerStopScript(uint localID, UUID itemID)
  1627. {
  1628. StopScript handlerStopScript = OnStopScript;
  1629. if (handlerStopScript != null)
  1630. {
  1631. foreach (StopScript d in handlerStopScript.GetInvocationList())
  1632. {
  1633. try
  1634. {
  1635. d(localID, itemID);
  1636. }
  1637. catch (Exception e)
  1638. {
  1639. m_log.ErrorFormat(
  1640. "[EVENT MANAGER]: Delegate for TriggerStopScript failed - continuing. {0} {1}",
  1641. e.Message, e.StackTrace);
  1642. }
  1643. }
  1644. }
  1645. }
  1646. public void TriggerRemoveScript(uint localID, UUID itemID)
  1647. {
  1648. RemoveScript handlerRemoveScript = OnRemoveScript;
  1649. if (handlerRemoveScript != null)
  1650. {
  1651. foreach (RemoveScript d in handlerRemoveScript.GetInvocationList())
  1652. {
  1653. try
  1654. {
  1655. d(localID, itemID);
  1656. }
  1657. catch (Exception e)
  1658. {
  1659. m_log.ErrorFormat(
  1660. "[EVENT MANAGER]: Delegate for TriggerRemoveScript failed - continuing. {0} {1}",
  1661. e.Message, e.StackTrace);
  1662. m_log.ErrorFormat(Environment.StackTrace);
  1663. }
  1664. }
  1665. }
  1666. }
  1667. public bool TriggerGroupMove(UUID groupID, Vector3 delta)
  1668. {
  1669. bool result = true;
  1670. SceneGroupMoved handlerSceneGroupMove = OnSceneGroupMove;
  1671. if (handlerSceneGroupMove != null)
  1672. {
  1673. foreach (SceneGroupMoved d in handlerSceneGroupMove.GetInvocationList())
  1674. {
  1675. try
  1676. {
  1677. if (d(groupID, delta) == false)
  1678. result = false;
  1679. }
  1680. catch (Exception e)
  1681. {
  1682. m_log.ErrorFormat(
  1683. "[EVENT MANAGER]: Delegate for TriggerGroupMove failed - continuing. {0} {1}",
  1684. e.Message, e.StackTrace);
  1685. }
  1686. }
  1687. }
  1688. return result;
  1689. }
  1690. public bool TriggerGroupSpinStart(UUID groupID)
  1691. {
  1692. bool result = true;
  1693. SceneGroupSpinStarted handlerSceneGroupSpinStarted = OnSceneGroupSpinStart;
  1694. if (handlerSceneGroupSpinStarted != null)
  1695. {
  1696. foreach (SceneGroupSpinStarted d in handlerSceneGroupSpinStarted.GetInvocationList())
  1697. {
  1698. try
  1699. {
  1700. if (d(groupID) == false)
  1701. result = false;
  1702. }
  1703. catch (Exception e)
  1704. {
  1705. m_log.ErrorFormat(
  1706. "[EVENT MANAGER]: Delegate for TriggerGroupSpinStart failed - continuing. {0} {1}",
  1707. e.Message, e.StackTrace);
  1708. }
  1709. }
  1710. }
  1711. return result;
  1712. }
  1713. public bool TriggerGroupSpin(UUID groupID, Quaternion rotation)
  1714. {
  1715. bool result = true;
  1716. SceneGroupSpun handlerSceneGroupSpin = OnSceneGroupSpin;
  1717. if (handlerSceneGroupSpin != null)
  1718. {
  1719. foreach (SceneGroupSpun d in handlerSceneGroupSpin.GetInvocationList())
  1720. {
  1721. try
  1722. {
  1723. if (d(groupID, rotation) == false)
  1724. result = false;
  1725. }
  1726. catch (Exception e)
  1727. {
  1728. m_log.ErrorFormat(
  1729. "[EVENT MANAGER]: Delegate for TriggerGroupSpin failed - continuing. {0} {1}",
  1730. e.Message, e.StackTrace);
  1731. }
  1732. }
  1733. }
  1734. return result;
  1735. }
  1736. public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID)
  1737. {
  1738. SceneGroupGrabed handlerSceneGroupGrab = OnSceneGroupGrab;
  1739. if (handlerSceneGroupGrab != null)
  1740. {
  1741. foreach (SceneGroupGrabed d in handlerSceneGroupGrab.GetInvocationList())
  1742. {
  1743. try
  1744. {
  1745. d(groupID, offset, userID);
  1746. }
  1747. catch (Exception e)
  1748. {
  1749. m_log.ErrorFormat(
  1750. "[EVENT MANAGER]: Delegate for TriggerGroupGrab failed - continuing. {0} {1}",
  1751. e.Message, e.StackTrace);
  1752. }
  1753. }
  1754. }
  1755. }
  1756. public void TriggerLandObjectAdded(ILandObject newParcel)
  1757. {
  1758. LandObjectAdded handlerLandObjectAdded = OnLandObjectAdded;
  1759. if (handlerLandObjectAdded != null)
  1760. {
  1761. foreach (LandObjectAdded d in handlerLandObjectAdded.GetInvocationList())
  1762. {
  1763. try
  1764. {
  1765. d(newParcel);
  1766. }
  1767. catch (Exception e)
  1768. {
  1769. m_log.ErrorFormat(
  1770. "[EVENT MANAGER]: Delegate for TriggerLandObjectAdded failed - continuing. {0} {1}",
  1771. e.Message, e.StackTrace);
  1772. }
  1773. }
  1774. }
  1775. }
  1776. public void TriggerLandObjectRemoved(UUID globalID)
  1777. {
  1778. LandObjectRemoved handlerLandObjectRemoved = OnLandObjectRemoved;
  1779. if (handlerLandObjectRemoved != null)
  1780. {
  1781. foreach (LandObjectRemoved d in handlerLandObjectRemoved.GetInvocationList())
  1782. {
  1783. try
  1784. {
  1785. d(globalID);
  1786. }
  1787. catch (Exception e)
  1788. {
  1789. m_log.ErrorFormat(
  1790. "[EVENT MANAGER]: Delegate for TriggerLandObjectRemoved failed - continuing. {0} {1}",
  1791. e.Message, e.StackTrace);
  1792. }
  1793. }
  1794. }
  1795. }
  1796. public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel)
  1797. {
  1798. TriggerLandObjectAdded(newParcel);
  1799. }
  1800. public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
  1801. {
  1802. AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel;
  1803. if (handlerAvatarEnteringNewParcel != null)
  1804. {
  1805. foreach (AvatarEnteringNewParcel d in handlerAvatarEnteringNewParcel.GetInvocationList())
  1806. {
  1807. try
  1808. {
  1809. d(avatar, localLandID, regionID);
  1810. }
  1811. catch (Exception e)
  1812. {
  1813. m_log.ErrorFormat(
  1814. "[EVENT MANAGER]: Delegate for TriggerAvatarEnteringNewParcel failed - continuing. {0} {1}",
  1815. e.Message, e.StackTrace);
  1816. }
  1817. }
  1818. }
  1819. }
  1820. public void TriggerAvatarAppearanceChanged(ScenePresence avatar)
  1821. {
  1822. AvatarAppearanceChange handler = OnAvatarAppearanceChange;
  1823. if (handler != null)
  1824. {
  1825. foreach (AvatarAppearanceChange d in handler.GetInvocationList())
  1826. {
  1827. try
  1828. {
  1829. d(avatar);
  1830. }
  1831. catch (Exception e)
  1832. {
  1833. m_log.ErrorFormat(
  1834. "[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}",
  1835. e.Message, e.StackTrace);
  1836. }
  1837. }
  1838. }
  1839. }
  1840. public void TriggerCrossAgentToNewRegion(ScenePresence agent, bool isFlying, GridRegion newRegion)
  1841. {
  1842. CrossAgentToNewRegion handlerCrossAgentToNewRegion = OnCrossAgentToNewRegion;
  1843. if (handlerCrossAgentToNewRegion != null)
  1844. {
  1845. foreach (CrossAgentToNewRegion d in handlerCrossAgentToNewRegion.GetInvocationList())
  1846. {
  1847. try
  1848. {
  1849. d(agent, isFlying, newRegion);
  1850. }
  1851. catch (Exception e)
  1852. {
  1853. m_log.ErrorFormat(
  1854. "[EVENT MANAGER]: Delegate for TriggerCrossAgentToNewRegion failed - continuing. {0} {1}",
  1855. e.Message, e.StackTrace);
  1856. }
  1857. }
  1858. }
  1859. }
  1860. public void TriggerIncomingInstantMessage(GridInstantMessage message)
  1861. {
  1862. IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage;
  1863. if (handlerIncomingInstantMessage != null)
  1864. {
  1865. foreach (IncomingInstantMessage d in handlerIncomingInstantMessage.GetInvocationList())
  1866. {
  1867. try
  1868. {
  1869. d(message);
  1870. }
  1871. catch (Exception e)
  1872. {
  1873. m_log.ErrorFormat(
  1874. "[EVENT MANAGER]: Delegate for TriggerIncomingInstantMessage failed - continuing. {0} {1}",
  1875. e.Message, e.StackTrace);
  1876. }
  1877. }
  1878. }
  1879. }
  1880. public void TriggerUnhandledInstantMessage(GridInstantMessage message)
  1881. {
  1882. IncomingInstantMessage handlerUnhandledInstantMessage = OnUnhandledInstantMessage;
  1883. if (handlerUnhandledInstantMessage != null)
  1884. {
  1885. foreach (IncomingInstantMessage d in handlerUnhandledInstantMessage.GetInvocationList())
  1886. {
  1887. try
  1888. {
  1889. d(message);
  1890. }
  1891. catch (Exception e)
  1892. {
  1893. m_log.ErrorFormat(
  1894. "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
  1895. e.Message, e.StackTrace);
  1896. }
  1897. }
  1898. }
  1899. }
  1900. public void TriggerClientClosed(UUID ClientID, Scene scene)
  1901. {
  1902. ClientClosed handlerClientClosed = OnClientClosed;
  1903. if (handlerClientClosed != null)
  1904. {
  1905. foreach (ClientClosed d in handlerClientClosed.GetInvocationList())
  1906. {
  1907. try
  1908. {
  1909. // m_log.ErrorFormat("[EVENT MANAGER]: TriggerClientClosed: {0}", d.Target.ToString());
  1910. d(ClientID, scene);
  1911. // m_log.ErrorFormat("[EVENT MANAGER]: TriggerClientClosed done ");
  1912. }
  1913. catch (Exception e)
  1914. {
  1915. m_log.ErrorFormat(
  1916. "[EVENT MANAGER]: Delegate for TriggerClientClosed failed - continuing. {0} {1}",
  1917. e.Message, e.StackTrace);
  1918. }
  1919. }
  1920. }
  1921. }
  1922. public void TriggerOnMakeChildAgent(ScenePresence presence)
  1923. {
  1924. OnMakeChildAgentDelegate handlerMakeChildAgent = OnMakeChildAgent;
  1925. if (handlerMakeChildAgent != null)
  1926. {
  1927. foreach (OnMakeChildAgentDelegate d in handlerMakeChildAgent.GetInvocationList())
  1928. {
  1929. try
  1930. {
  1931. d(presence);
  1932. }
  1933. catch (Exception e)
  1934. {
  1935. m_log.ErrorFormat(
  1936. "[EVENT MANAGER]: Delegate for TriggerOnMakeChildAgent failed - continuing. {0} {1}",
  1937. e.Message, e.StackTrace);
  1938. }
  1939. }
  1940. }
  1941. }
  1942. public void TriggerOnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID user)
  1943. {
  1944. OnSendNewWindlightProfileTargetedDelegate handlerSendNewWindlightProfileTargeted = OnSendNewWindlightProfileTargeted;
  1945. if (handlerSendNewWindlightProfileTargeted != null)
  1946. {
  1947. handlerSendNewWindlightProfileTargeted(wl, user);
  1948. }
  1949. }
  1950. public void TriggerOnSaveNewWindlightProfile()
  1951. {
  1952. OnSaveNewWindlightProfileDelegate handlerSaveNewWindlightProfile = OnSaveNewWindlightProfile;
  1953. if (handlerSaveNewWindlightProfile != null)
  1954. {
  1955. handlerSaveNewWindlightProfile();
  1956. }
  1957. }
  1958. public void TriggerOnMakeRootAgent(ScenePresence presence)
  1959. {
  1960. Action<ScenePresence> handlerMakeRootAgent = OnMakeRootAgent;
  1961. if (handlerMakeRootAgent != null)
  1962. {
  1963. foreach (Action<ScenePresence> d in handlerMakeRootAgent.GetInvocationList())
  1964. {
  1965. try
  1966. {
  1967. d(presence);
  1968. }
  1969. catch (Exception e)
  1970. {
  1971. m_log.ErrorFormat(
  1972. "[EVENT MANAGER]: Delegate for TriggerOnMakeRootAgent failed - continuing. {0} {1}",
  1973. e.Message, e.StackTrace);
  1974. }
  1975. }
  1976. }
  1977. }
  1978. public void TriggerOnIncomingSceneObject(SceneObjectGroup so)
  1979. {
  1980. OnIncomingSceneObjectDelegate handlerIncomingSceneObject = OnIncomingSceneObject;
  1981. if (handlerIncomingSceneObject != null)
  1982. {
  1983. foreach (OnIncomingSceneObjectDelegate d in handlerIncomingSceneObject.GetInvocationList())
  1984. {
  1985. try
  1986. {
  1987. d(so);
  1988. }
  1989. catch (Exception e)
  1990. {
  1991. m_log.ErrorFormat(
  1992. "[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}",
  1993. e.Message, e.StackTrace);
  1994. }
  1995. }
  1996. }
  1997. }
  1998. public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
  1999. {
  2000. RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps;
  2001. if (handlerRegisterCaps != null)
  2002. {
  2003. foreach (RegisterCapsEvent d in handlerRegisterCaps.GetInvocationList())
  2004. {
  2005. try
  2006. {
  2007. d(agentID, caps);
  2008. }
  2009. catch (Exception e)
  2010. {
  2011. m_log.ErrorFormat(
  2012. "[EVENT MANAGER]: Delegate for TriggerOnRegisterCaps failed - continuing. {0} {1}",
  2013. e.Message, e.StackTrace);
  2014. }
  2015. }
  2016. }
  2017. }
  2018. public void TriggerOnDeregisterCaps(UUID agentID, Caps caps)
  2019. {
  2020. DeregisterCapsEvent handlerDeregisterCaps = OnDeregisterCaps;
  2021. if (handlerDeregisterCaps != null)
  2022. {
  2023. foreach (DeregisterCapsEvent d in handlerDeregisterCaps.GetInvocationList())
  2024. {
  2025. try
  2026. {
  2027. d(agentID, caps);
  2028. }
  2029. catch (Exception e)
  2030. {
  2031. m_log.ErrorFormat(
  2032. "[EVENT MANAGER]: Delegate for TriggerOnDeregisterCaps failed - continuing. {0} {1}",
  2033. e.Message, e.StackTrace);
  2034. }
  2035. }
  2036. }
  2037. }
  2038. public void TriggerOnNewInventoryItemUploadComplete(InventoryItemBase item, int userlevel)
  2039. {
  2040. NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete;
  2041. if (handlerNewInventoryItemUpdateComplete != null)
  2042. {
  2043. foreach (NewInventoryItemUploadComplete d in handlerNewInventoryItemUpdateComplete.GetInvocationList())
  2044. {
  2045. try
  2046. {
  2047. d(item, userlevel);
  2048. }
  2049. catch (Exception e)
  2050. {
  2051. m_log.ErrorFormat(
  2052. "[EVENT MANAGER]: Delegate for TriggerOnNewInventoryItemUploadComplete failed - continuing. {0} {1}",
  2053. e.Message, e.StackTrace);
  2054. }
  2055. }
  2056. }
  2057. }
  2058. public void TriggerLandBuy(Object sender, LandBuyArgs args)
  2059. {
  2060. LandBuy handlerLandBuy = OnLandBuy;
  2061. if (handlerLandBuy != null)
  2062. {
  2063. foreach (LandBuy d in handlerLandBuy.GetInvocationList())
  2064. {
  2065. try
  2066. {
  2067. d(sender, args);
  2068. }
  2069. catch (Exception e)
  2070. {
  2071. m_log.ErrorFormat(
  2072. "[EVENT MANAGER]: Delegate for TriggerLandBuy failed - continuing. {0} {1}",
  2073. e.Message, e.StackTrace);
  2074. }
  2075. }
  2076. }
  2077. }
  2078. public void TriggerValidateLandBuy(Object sender, LandBuyArgs args)
  2079. {
  2080. LandBuy handlerValidateLandBuy = OnValidateLandBuy;
  2081. if (handlerValidateLandBuy != null)
  2082. {
  2083. foreach (LandBuy d in handlerValidateLandBuy.GetInvocationList())
  2084. {
  2085. try
  2086. {
  2087. d(sender, args);
  2088. }
  2089. catch (Exception e)
  2090. {
  2091. m_log.ErrorFormat(
  2092. "[EVENT MANAGER]: Delegate for TriggerValidateLandBuy failed - continuing. {0} {1}",
  2093. e.Message, e.StackTrace);
  2094. }
  2095. }
  2096. }
  2097. }
  2098. public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos)
  2099. {
  2100. ScriptAtTargetEvent handlerScriptAtTargetEvent = OnScriptAtTargetEvent;
  2101. if (handlerScriptAtTargetEvent != null)
  2102. {
  2103. foreach (ScriptAtTargetEvent d in handlerScriptAtTargetEvent.GetInvocationList())
  2104. {
  2105. try
  2106. {
  2107. d(localID, handle, targetpos, currentpos);
  2108. }
  2109. catch (Exception e)
  2110. {
  2111. m_log.ErrorFormat(
  2112. "[EVENT MANAGER]: Delegate for TriggerAtTargetEvent failed - continuing. {0} {1}",
  2113. e.Message, e.StackTrace);
  2114. }
  2115. }
  2116. }
  2117. }
  2118. public void TriggerNotAtTargetEvent(uint localID)
  2119. {
  2120. ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent;
  2121. if (handlerScriptNotAtTargetEvent != null)
  2122. {
  2123. foreach (ScriptNotAtTargetEvent d in handlerScriptNotAtTargetEvent.GetInvocationList())
  2124. {
  2125. try
  2126. {
  2127. d(localID);
  2128. }
  2129. catch (Exception e)
  2130. {
  2131. m_log.ErrorFormat(
  2132. "[EVENT MANAGER]: Delegate for TriggerNotAtTargetEvent failed - continuing. {0} {1}",
  2133. e.Message, e.StackTrace);
  2134. }
  2135. }
  2136. }
  2137. }
  2138. public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot)
  2139. {
  2140. ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent;
  2141. if (handlerScriptAtRotTargetEvent != null)
  2142. {
  2143. foreach (ScriptAtRotTargetEvent d in handlerScriptAtRotTargetEvent.GetInvocationList())
  2144. {
  2145. try
  2146. {
  2147. d(localID, handle, targetrot, currentrot);
  2148. }
  2149. catch (Exception e)
  2150. {
  2151. m_log.ErrorFormat(
  2152. "[EVENT MANAGER]: Delegate for TriggerAtRotTargetEvent failed - continuing. {0} {1}",
  2153. e.Message, e.StackTrace);
  2154. }
  2155. }
  2156. }
  2157. }
  2158. public void TriggerNotAtRotTargetEvent(uint localID)
  2159. {
  2160. ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent;
  2161. if (handlerScriptNotAtRotTargetEvent != null)
  2162. {
  2163. foreach (ScriptNotAtRotTargetEvent d in handlerScriptNotAtRotTargetEvent.GetInvocationList())
  2164. {
  2165. try
  2166. {
  2167. d(localID);
  2168. }
  2169. catch (Exception e)
  2170. {
  2171. m_log.ErrorFormat(
  2172. "[EVENT MANAGER]: Delegate for TriggerNotAtRotTargetEvent failed - continuing. {0} {1}",
  2173. e.Message, e.StackTrace);
  2174. }
  2175. }
  2176. }
  2177. }
  2178. public void TriggerMovingStartEvent(uint localID)
  2179. {
  2180. ScriptMovingStartEvent handlerScriptMovingStartEvent = OnScriptMovingStartEvent;
  2181. if (handlerScriptMovingStartEvent != null)
  2182. {
  2183. foreach (ScriptMovingStartEvent d in handlerScriptMovingStartEvent.GetInvocationList())
  2184. {
  2185. try
  2186. {
  2187. d(localID);
  2188. }
  2189. catch (Exception e)
  2190. {
  2191. m_log.ErrorFormat(
  2192. "[EVENT MANAGER]: Delegate for TriggerMovingStartEvent failed - continuing. {0} {1}",
  2193. e.Message, e.StackTrace);
  2194. }
  2195. }
  2196. }
  2197. }
  2198. public void TriggerMovingEndEvent(uint localID)
  2199. {
  2200. ScriptMovingEndEvent handlerScriptMovingEndEvent = OnScriptMovingEndEvent;
  2201. if (handlerScriptMovingEndEvent != null)
  2202. {
  2203. foreach (ScriptMovingEndEvent d in handlerScriptMovingEndEvent.GetInvocationList())
  2204. {
  2205. try
  2206. {
  2207. d(localID);
  2208. }
  2209. catch (Exception e)
  2210. {
  2211. m_log.ErrorFormat(
  2212. "[EVENT MANAGER]: Delegate for TriggerMovingEndEvent failed - continuing. {0} {1}",
  2213. e.Message, e.StackTrace);
  2214. }
  2215. }
  2216. }
  2217. }
  2218. public void TriggerRequestChangeWaterHeight(float height)
  2219. {
  2220. if (height < 0)
  2221. {
  2222. // ignore negative water height
  2223. return;
  2224. }
  2225. RequestChangeWaterHeight handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight;
  2226. if (handlerRequestChangeWaterHeight != null)
  2227. {
  2228. foreach (RequestChangeWaterHeight d in handlerRequestChangeWaterHeight.GetInvocationList())
  2229. {
  2230. try
  2231. {
  2232. d(height);
  2233. }
  2234. catch (Exception e)
  2235. {
  2236. m_log.ErrorFormat(
  2237. "[EVENT MANAGER]: Delegate for TriggerRequestChangeWaterHeight failed - continuing. {0} {1}",
  2238. e.Message, e.StackTrace);
  2239. }
  2240. }
  2241. }
  2242. }
  2243. public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar)
  2244. {
  2245. AvatarKillData handlerAvatarKill = OnAvatarKilled;
  2246. if (handlerAvatarKill != null)
  2247. {
  2248. foreach (AvatarKillData d in handlerAvatarKill.GetInvocationList())
  2249. {
  2250. try
  2251. {
  2252. d(KillerObjectLocalID, DeadAvatar);
  2253. }
  2254. catch (Exception e)
  2255. {
  2256. m_log.ErrorFormat(
  2257. "[EVENT MANAGER]: Delegate for TriggerAvatarKill failed - continuing. {0} {1}",
  2258. e.Message, e.StackTrace);
  2259. }
  2260. }
  2261. }
  2262. }
  2263. public void TriggerSignificantClientMovement(ScenePresence presence)
  2264. {
  2265. Action<ScenePresence> handlerSignificantClientMovement = OnSignificantClientMovement;
  2266. if (handlerSignificantClientMovement != null)
  2267. {
  2268. foreach (Action<ScenePresence> d in handlerSignificantClientMovement.GetInvocationList())
  2269. {
  2270. try
  2271. {
  2272. d(presence);
  2273. }
  2274. catch (Exception e)
  2275. {
  2276. m_log.ErrorFormat(
  2277. "[EVENT MANAGER]: Delegate for TriggerSignificantClientMovement failed - continuing. {0} {1}",
  2278. e.Message, e.StackTrace);
  2279. }
  2280. }
  2281. }
  2282. }
  2283. public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
  2284. {
  2285. ChatFromWorldEvent handlerChatFromWorld = OnChatFromWorld;
  2286. if (handlerChatFromWorld != null)
  2287. {
  2288. foreach (ChatFromWorldEvent d in handlerChatFromWorld.GetInvocationList())
  2289. {
  2290. try
  2291. {
  2292. d(sender, chat);
  2293. }
  2294. catch (Exception e)
  2295. {
  2296. m_log.ErrorFormat(
  2297. "[EVENT MANAGER]: Delegate for TriggerOnChatFromWorld failed - continuing. {0} {1}",
  2298. e.Message, e.StackTrace);
  2299. }
  2300. }
  2301. }
  2302. }
  2303. public void TriggerOnChatFromClient(Object sender, OSChatMessage chat)
  2304. {
  2305. ChatFromClientEvent handlerChatFromClient = OnChatFromClient;
  2306. if (handlerChatFromClient != null)
  2307. {
  2308. foreach (ChatFromClientEvent d in handlerChatFromClient.GetInvocationList())
  2309. {
  2310. try
  2311. {
  2312. d(sender, chat);
  2313. }
  2314. catch (Exception e)
  2315. {
  2316. m_log.ErrorFormat(
  2317. "[EVENT MANAGER]: Delegate for TriggerOnChatFromClient failed - continuing. {0} {1}",
  2318. e.Message, e.StackTrace);
  2319. }
  2320. }
  2321. }
  2322. }
  2323. public void TriggerOnChatToClients(
  2324. UUID senderID, HashSet<UUID> receiverIDs,
  2325. string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
  2326. ChatSourceType src, ChatAudibleLevel level)
  2327. {
  2328. ChatToClientsEvent handler = OnChatToClients;
  2329. if (handler != null)
  2330. {
  2331. foreach (ChatToClientsEvent d in handler.GetInvocationList())
  2332. {
  2333. try
  2334. {
  2335. d(senderID, receiverIDs, message, type, fromPos, fromName, src, level);
  2336. }
  2337. catch (Exception e)
  2338. {
  2339. m_log.ErrorFormat(
  2340. "[EVENT MANAGER]: Delegate for TriggerOnChatToClients failed - continuing. {0} {1}",
  2341. e.Message, e.StackTrace);
  2342. }
  2343. }
  2344. }
  2345. }
  2346. public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
  2347. {
  2348. ChatBroadcastEvent handlerChatBroadcast = OnChatBroadcast;
  2349. if (handlerChatBroadcast != null)
  2350. {
  2351. foreach (ChatBroadcastEvent d in handlerChatBroadcast.GetInvocationList())
  2352. {
  2353. try
  2354. {
  2355. d(sender, chat);
  2356. }
  2357. catch (Exception e)
  2358. {
  2359. m_log.ErrorFormat(
  2360. "[EVENT MANAGER]: Delegate for TriggerOnChatBroadcast failed - continuing. {0} {1}",
  2361. e.Message, e.StackTrace);
  2362. }
  2363. }
  2364. }
  2365. }
  2366. internal void TriggerControlEvent(UUID scriptUUID, UUID avatarID, uint held, uint _changed)
  2367. {
  2368. ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent;
  2369. if (handlerScriptControlEvent != null)
  2370. {
  2371. foreach (ScriptControlEvent d in handlerScriptControlEvent.GetInvocationList())
  2372. {
  2373. try
  2374. {
  2375. d(scriptUUID, avatarID, held, _changed);
  2376. }
  2377. catch (Exception e)
  2378. {
  2379. m_log.ErrorFormat(
  2380. "[EVENT MANAGER]: Delegate for TriggerControlEvent failed - continuing. {0} {1}",
  2381. e.Message, e.StackTrace);
  2382. }
  2383. }
  2384. }
  2385. }
  2386. public void TriggerNoticeNoLandDataFromStorage()
  2387. {
  2388. NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage;
  2389. if (handlerNoticeNoLandDataFromStorage != null)
  2390. {
  2391. foreach (NoticeNoLandDataFromStorage d in handlerNoticeNoLandDataFromStorage.GetInvocationList())
  2392. {
  2393. try
  2394. {
  2395. d();
  2396. }
  2397. catch (Exception e)
  2398. {
  2399. m_log.ErrorFormat(
  2400. "[EVENT MANAGER]: Delegate for TriggerNoticeNoLandDataFromStorage failed - continuing. {0} {1}",
  2401. e.Message, e.StackTrace);
  2402. }
  2403. }
  2404. }
  2405. }
  2406. public void TriggerIncomingLandDataFromStorage(List<LandData> landData)
  2407. {
  2408. IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage;
  2409. if (handlerIncomingLandDataFromStorage != null)
  2410. {
  2411. foreach (IncomingLandDataFromStorage d in handlerIncomingLandDataFromStorage.GetInvocationList())
  2412. {
  2413. try
  2414. {
  2415. d(landData);
  2416. }
  2417. catch (Exception e)
  2418. {
  2419. m_log.ErrorFormat(
  2420. "[EVENT MANAGER]: Delegate for TriggerIncomingLandDataFromStorage failed - continuing. {0} {1}",
  2421. e.Message, e.StackTrace);
  2422. }
  2423. }
  2424. }
  2425. }
  2426. public void TriggerSetAllowForcefulBan(bool allow)
  2427. {
  2428. SetAllowForcefulBan handlerSetAllowForcefulBan = OnSetAllowForcefulBan;
  2429. if (handlerSetAllowForcefulBan != null)
  2430. {
  2431. foreach (SetAllowForcefulBan d in handlerSetAllowForcefulBan.GetInvocationList())
  2432. {
  2433. try
  2434. {
  2435. d(allow);
  2436. }
  2437. catch (Exception e)
  2438. {
  2439. m_log.ErrorFormat(
  2440. "[EVENT MANAGER]: Delegate for TriggerSetAllowForcefulBan failed - continuing. {0} {1}",
  2441. e.Message, e.StackTrace);
  2442. }
  2443. }
  2444. }
  2445. }
  2446. public void TriggerRequestParcelPrimCountUpdate()
  2447. {
  2448. RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate;
  2449. if (handlerRequestParcelPrimCountUpdate != null)
  2450. {
  2451. foreach (RequestParcelPrimCountUpdate d in handlerRequestParcelPrimCountUpdate.GetInvocationList())
  2452. {
  2453. try
  2454. {
  2455. d();
  2456. }
  2457. catch (Exception e)
  2458. {
  2459. m_log.ErrorFormat(
  2460. "[EVENT MANAGER]: Delegate for TriggerRequestParcelPrimCountUpdate failed - continuing. {0} {1}",
  2461. e.Message, e.StackTrace);
  2462. }
  2463. }
  2464. }
  2465. }
  2466. public void TriggerParcelPrimCountTainted()
  2467. {
  2468. ParcelPrimCountTainted handlerParcelPrimCountTainted = OnParcelPrimCountTainted;
  2469. if (handlerParcelPrimCountTainted != null)
  2470. {
  2471. foreach (ParcelPrimCountTainted d in handlerParcelPrimCountTainted.GetInvocationList())
  2472. {
  2473. try
  2474. {
  2475. d();
  2476. }
  2477. catch (Exception e)
  2478. {
  2479. m_log.ErrorFormat(
  2480. "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountTainted failed - continuing. {0} {1}",
  2481. e.Message, e.StackTrace);
  2482. }
  2483. }
  2484. }
  2485. }
  2486. /// <summary>
  2487. /// this lets us keep track of nasty script events like timer, etc.
  2488. /// </summary>
  2489. /// <param name="objLocalID"></param>
  2490. /// <param name="Interval"></param>
  2491. public void TriggerTimerEvent(uint objLocalID, double Interval)
  2492. {
  2493. throw new NotImplementedException("TriggerTimerEvent was thought to be not used anymore and the registration for the event from scene object part has been commented out due to a memory leak");
  2494. //handlerScriptTimerEvent = OnScriptTimerEvent;
  2495. //if (handlerScriptTimerEvent != null)
  2496. //{
  2497. // handlerScriptTimerEvent(objLocalID, Interval);
  2498. //}
  2499. }
  2500. /// <summary>
  2501. /// Called when the sun's position parameters have changed in the Region and/or Estate
  2502. /// </summary>
  2503. /// <param name="regionHandle">The region that changed</param>
  2504. public void TriggerEstateToolsSunUpdate(ulong regionHandle)
  2505. {
  2506. EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate;
  2507. if (handlerEstateToolsSunUpdate != null)
  2508. {
  2509. foreach (EstateToolsSunUpdate d in handlerEstateToolsSunUpdate.GetInvocationList())
  2510. {
  2511. try
  2512. {
  2513. d(regionHandle);
  2514. }
  2515. catch (Exception e)
  2516. {
  2517. m_log.ErrorFormat(
  2518. "[EVENT MANAGER]: Delegate for TriggerEstateToolsSunUpdate failed - continuing. {0} {1}",
  2519. e.Message, e.StackTrace);
  2520. }
  2521. }
  2522. }
  2523. }
  2524. public float GetCurrentTimeAsSunLindenHour()
  2525. {
  2526. SunLindenHour handlerCurrentTimeAsLindenSunHour = OnGetCurrentTimeAsLindenSunHour;
  2527. if (handlerCurrentTimeAsLindenSunHour != null)
  2528. {
  2529. foreach (SunLindenHour d in handlerCurrentTimeAsLindenSunHour.GetInvocationList())
  2530. {
  2531. try
  2532. {
  2533. return d();
  2534. }
  2535. catch (Exception e)
  2536. {
  2537. m_log.ErrorFormat(
  2538. "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
  2539. e.Message, e.StackTrace);
  2540. }
  2541. }
  2542. }
  2543. return 6;
  2544. }
  2545. public void TriggerOarFileLoaded(Guid requestId, List<UUID> loadedScenes, string message)
  2546. {
  2547. OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded;
  2548. if (handlerOarFileLoaded != null)
  2549. {
  2550. foreach (OarFileLoaded d in handlerOarFileLoaded.GetInvocationList())
  2551. {
  2552. try
  2553. {
  2554. d(requestId, loadedScenes, message);
  2555. }
  2556. catch (Exception e)
  2557. {
  2558. m_log.ErrorFormat(
  2559. "[EVENT MANAGER]: Delegate for TriggerOarFileLoaded failed - continuing. {0} {1}",
  2560. e.Message, e.StackTrace);
  2561. }
  2562. }
  2563. }
  2564. }
  2565. public void TriggerOarFileSaved(Guid requestId, string message)
  2566. {
  2567. OarFileSaved handlerOarFileSaved = OnOarFileSaved;
  2568. if (handlerOarFileSaved != null)
  2569. {
  2570. foreach (OarFileSaved d in handlerOarFileSaved.GetInvocationList())
  2571. {
  2572. try
  2573. {
  2574. d(requestId, message);
  2575. }
  2576. catch (Exception e)
  2577. {
  2578. m_log.ErrorFormat(
  2579. "[EVENT MANAGER]: Delegate for TriggerOarFileSaved failed - continuing. {0} {1}",
  2580. e.Message, e.StackTrace);
  2581. }
  2582. }
  2583. }
  2584. }
  2585. public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message)
  2586. {
  2587. EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = OnEmptyScriptCompileQueue;
  2588. if (handlerEmptyScriptCompileQueue != null)
  2589. {
  2590. foreach (EmptyScriptCompileQueue d in handlerEmptyScriptCompileQueue.GetInvocationList())
  2591. {
  2592. try
  2593. {
  2594. d(numScriptsFailed, message);
  2595. }
  2596. catch (Exception e)
  2597. {
  2598. m_log.ErrorFormat(
  2599. "[EVENT MANAGER]: Delegate for TriggerEmptyScriptCompileQueue failed - continuing. {0} {1}",
  2600. e.Message, e.StackTrace);
  2601. }
  2602. }
  2603. }
  2604. }
  2605. public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders)
  2606. {
  2607. ScriptColliding handlerCollidingStart = OnScriptColliderStart;
  2608. if (handlerCollidingStart != null)
  2609. {
  2610. foreach (ScriptColliding d in handlerCollidingStart.GetInvocationList())
  2611. {
  2612. try
  2613. {
  2614. d(localId, colliders);
  2615. }
  2616. catch (Exception e)
  2617. {
  2618. m_log.ErrorFormat(
  2619. "[EVENT MANAGER]: Delegate for TriggerScriptCollidingStart failed - continuing. {0} {1}",
  2620. e.Message, e.StackTrace);
  2621. }
  2622. }
  2623. }
  2624. }
  2625. public void TriggerScriptColliding(uint localId, ColliderArgs colliders)
  2626. {
  2627. ScriptColliding handlerColliding = OnScriptColliding;
  2628. if (handlerColliding != null)
  2629. {
  2630. foreach (ScriptColliding d in handlerColliding.GetInvocationList())
  2631. {
  2632. try
  2633. {
  2634. d(localId, colliders);
  2635. }
  2636. catch (Exception e)
  2637. {
  2638. m_log.ErrorFormat(
  2639. "[EVENT MANAGER]: Delegate for TriggerScriptColliding failed - continuing. {0} {1}",
  2640. e.Message, e.StackTrace);
  2641. }
  2642. }
  2643. }
  2644. }
  2645. public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders)
  2646. {
  2647. ScriptColliding handlerCollidingEnd = OnScriptCollidingEnd;
  2648. if (handlerCollidingEnd != null)
  2649. {
  2650. foreach (ScriptColliding d in handlerCollidingEnd.GetInvocationList())
  2651. {
  2652. try
  2653. {
  2654. d(localId, colliders);
  2655. }
  2656. catch (Exception e)
  2657. {
  2658. m_log.ErrorFormat(
  2659. "[EVENT MANAGER]: Delegate for TriggerScriptCollidingEnd failed - continuing. {0} {1}",
  2660. e.Message, e.StackTrace);
  2661. }
  2662. }
  2663. }
  2664. }
  2665. public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders)
  2666. {
  2667. ScriptColliding handlerLandCollidingStart = OnScriptLandColliderStart;
  2668. if (handlerLandCollidingStart != null)
  2669. {
  2670. foreach (ScriptColliding d in handlerLandCollidingStart.GetInvocationList())
  2671. {
  2672. try
  2673. {
  2674. d(localId, colliders);
  2675. }
  2676. catch (Exception e)
  2677. {
  2678. m_log.ErrorFormat(
  2679. "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingStart failed - continuing. {0} {1}",
  2680. e.Message, e.StackTrace);
  2681. }
  2682. }
  2683. }
  2684. }
  2685. public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders)
  2686. {
  2687. ScriptColliding handlerLandColliding = OnScriptLandColliding;
  2688. if (handlerLandColliding != null)
  2689. {
  2690. foreach (ScriptColliding d in handlerLandColliding.GetInvocationList())
  2691. {
  2692. try
  2693. {
  2694. d(localId, colliders);
  2695. }
  2696. catch (Exception e)
  2697. {
  2698. m_log.ErrorFormat(
  2699. "[EVENT MANAGER]: Delegate for TriggerScriptLandColliding failed - continuing. {0} {1}",
  2700. e.Message, e.StackTrace);
  2701. }
  2702. }
  2703. }
  2704. }
  2705. public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders)
  2706. {
  2707. ScriptColliding handlerLandCollidingEnd = OnScriptLandColliderEnd;
  2708. if (handlerLandCollidingEnd != null)
  2709. {
  2710. foreach (ScriptColliding d in handlerLandCollidingEnd.GetInvocationList())
  2711. {
  2712. try
  2713. {
  2714. d(localId, colliders);
  2715. }
  2716. catch (Exception e)
  2717. {
  2718. m_log.ErrorFormat(
  2719. "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingEnd failed - continuing. {0} {1}",
  2720. e.Message, e.StackTrace);
  2721. }
  2722. }
  2723. }
  2724. }
  2725. public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
  2726. {
  2727. OnSetRootAgentSceneDelegate handlerSetRootAgentScene = OnSetRootAgentScene;
  2728. if (handlerSetRootAgentScene != null)
  2729. {
  2730. foreach (OnSetRootAgentSceneDelegate d in handlerSetRootAgentScene.GetInvocationList())
  2731. {
  2732. try
  2733. {
  2734. d(agentID, scene);
  2735. }
  2736. catch (Exception e)
  2737. {
  2738. m_log.ErrorFormat(
  2739. "[EVENT MANAGER]: Delegate for TriggerSetRootAgentScene failed - continuing. {0} {1}",
  2740. e.Message, e.StackTrace);
  2741. }
  2742. }
  2743. }
  2744. }
  2745. public void TriggerOnRegionUp(GridRegion otherRegion)
  2746. {
  2747. RegionUp handlerOnRegionUp = OnRegionUp;
  2748. if (handlerOnRegionUp != null)
  2749. {
  2750. foreach (RegionUp d in handlerOnRegionUp.GetInvocationList())
  2751. {
  2752. try
  2753. {
  2754. d(otherRegion);
  2755. }
  2756. catch (Exception e)
  2757. {
  2758. m_log.ErrorFormat(
  2759. "[EVENT MANAGER]: Delegate for TriggerOnRegionUp failed - continuing. {0} {1}",
  2760. e.Message, e.StackTrace);
  2761. }
  2762. }
  2763. }
  2764. }
  2765. public void TriggerOnSceneObjectLoaded(SceneObjectGroup so)
  2766. {
  2767. SceneObjectDelegate handler = OnSceneObjectLoaded;
  2768. if (handler != null)
  2769. {
  2770. foreach (SceneObjectDelegate d in handler.GetInvocationList())
  2771. {
  2772. try
  2773. {
  2774. d(so);
  2775. }
  2776. catch (Exception e)
  2777. {
  2778. m_log.ErrorFormat(
  2779. "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectLoaded failed - continuing. {0} {1}",
  2780. e.Message, e.StackTrace);
  2781. }
  2782. }
  2783. }
  2784. }
  2785. public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo)
  2786. {
  2787. SceneObjectPreSaveDelegate handler = OnSceneObjectPreSave;
  2788. if (handler != null)
  2789. {
  2790. foreach (SceneObjectPreSaveDelegate d in handler.GetInvocationList())
  2791. {
  2792. try
  2793. {
  2794. d(persistingSo, originalSo);
  2795. }
  2796. catch (Exception e)
  2797. {
  2798. m_log.ErrorFormat(
  2799. "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPreSave failed - continuing. {0} {1}",
  2800. e.Message, e.StackTrace);
  2801. }
  2802. }
  2803. }
  2804. }
  2805. public void TriggerOnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed)
  2806. {
  2807. SceneObjectPartCopyDelegate handler = OnSceneObjectPartCopy;
  2808. if (handler != null)
  2809. {
  2810. foreach (SceneObjectPartCopyDelegate d in handler.GetInvocationList())
  2811. {
  2812. try
  2813. {
  2814. d(copy, original, userExposed);
  2815. }
  2816. catch (Exception e)
  2817. {
  2818. m_log.ErrorFormat(
  2819. "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}",
  2820. e.Message, e.StackTrace);
  2821. }
  2822. }
  2823. }
  2824. }
  2825. public void TriggerSceneObjectPartUpdated(SceneObjectPart sop, bool full)
  2826. {
  2827. SceneObjectPartUpdated handler = OnSceneObjectPartUpdated;
  2828. if (handler != null)
  2829. {
  2830. foreach (SceneObjectPartUpdated d in handler.GetInvocationList())
  2831. {
  2832. try
  2833. {
  2834. d(sop, full);
  2835. }
  2836. catch (Exception e)
  2837. {
  2838. m_log.ErrorFormat(
  2839. "[EVENT MANAGER]: Delegate for TriggerSceneObjectPartUpdated failed - continuing. {0} {1}",
  2840. e.Message, e.StackTrace);
  2841. }
  2842. }
  2843. }
  2844. }
  2845. public void TriggerScenePresenceUpdated(ScenePresence sp)
  2846. {
  2847. ScenePresenceUpdated handler = OnScenePresenceUpdated;
  2848. if (handler != null)
  2849. {
  2850. foreach (ScenePresenceUpdated d in handler.GetInvocationList())
  2851. {
  2852. try
  2853. {
  2854. d(sp);
  2855. }
  2856. catch (Exception e)
  2857. {
  2858. m_log.ErrorFormat(
  2859. "[EVENT MANAGER]: Delegate for TriggerScenePresenceUpdated failed - continuing. {0} {1}",
  2860. e.Message, e.StackTrace);
  2861. }
  2862. }
  2863. }
  2864. }
  2865. public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
  2866. int local_id, IClientAPI remote_client)
  2867. {
  2868. ParcelPropertiesUpdateRequest handler = OnParcelPropertiesUpdateRequest;
  2869. if (handler != null)
  2870. {
  2871. foreach (ParcelPropertiesUpdateRequest d in handler.GetInvocationList())
  2872. {
  2873. try
  2874. {
  2875. d(args, local_id, remote_client);
  2876. }
  2877. catch (Exception e)
  2878. {
  2879. m_log.ErrorFormat(
  2880. "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}",
  2881. e.Message, e.StackTrace);
  2882. }
  2883. }
  2884. }
  2885. }
  2886. public void TriggerSceneShuttingDown(Scene s)
  2887. {
  2888. Action<Scene> handler = OnSceneShuttingDown;
  2889. if (handler != null)
  2890. {
  2891. foreach (Action<Scene> d in handler.GetInvocationList())
  2892. {
  2893. m_log.InfoFormat("[EVENT MANAGER]: TriggerSceneShuttingDown invoke {0}", d.Method.Name.ToString());
  2894. try
  2895. {
  2896. d(s);
  2897. }
  2898. catch (Exception e)
  2899. {
  2900. m_log.ErrorFormat(
  2901. "[EVENT MANAGER]: Delegate for TriggerSceneShuttingDown failed - continuing. {0} {1}",
  2902. e.Message, e.StackTrace);
  2903. }
  2904. }
  2905. }
  2906. m_log.Info("[EVENT MANAGER]: TriggerSceneShuttingDown done");
  2907. }
  2908. public void TriggerOnRegionStarted(Scene scene)
  2909. {
  2910. RegionStarted handler = OnRegionStarted;
  2911. if (handler != null)
  2912. {
  2913. foreach (RegionStarted d in handler.GetInvocationList())
  2914. {
  2915. try
  2916. {
  2917. d(scene);
  2918. }
  2919. catch (Exception e)
  2920. {
  2921. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for RegionStarted failed - continuing {0} - {1}",
  2922. e.Message, e.StackTrace);
  2923. }
  2924. }
  2925. }
  2926. }
  2927. public void TriggerRegionHeartbeatStart(Scene scene)
  2928. {
  2929. RegionHeartbeatStart handler = OnRegionHeartbeatStart;
  2930. if (handler != null)
  2931. {
  2932. foreach (RegionHeartbeatStart d in handler.GetInvocationList())
  2933. {
  2934. try
  2935. {
  2936. d(scene);
  2937. }
  2938. catch (Exception e)
  2939. {
  2940. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatStart failed - continuing {0} - {1}",
  2941. e.Message, e.StackTrace);
  2942. }
  2943. }
  2944. }
  2945. }
  2946. public void TriggerRegionHeartbeatEnd(Scene scene)
  2947. {
  2948. RegionHeartbeatEnd handler = OnRegionHeartbeatEnd;
  2949. if (handler != null)
  2950. {
  2951. foreach (RegionHeartbeatEnd d in handler.GetInvocationList())
  2952. {
  2953. try
  2954. {
  2955. d(scene);
  2956. }
  2957. catch (Exception e)
  2958. {
  2959. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatEnd failed - continuing {0} - {1}",
  2960. e.Message, e.StackTrace);
  2961. }
  2962. }
  2963. }
  2964. }
  2965. public void TriggerRegionLoginsStatusChange(IScene scene)
  2966. {
  2967. RegionLoginsStatusChange handler = OnRegionLoginsStatusChange;
  2968. if (handler != null)
  2969. {
  2970. foreach (RegionLoginsStatusChange d in handler.GetInvocationList())
  2971. {
  2972. try
  2973. {
  2974. d(scene);
  2975. }
  2976. catch (Exception e)
  2977. {
  2978. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionLoginsStatusChange failed - continuing {0} - {1}",
  2979. e.Message, e.StackTrace);
  2980. }
  2981. }
  2982. }
  2983. }
  2984. public void TriggerRegionReadyStatusChange(IScene scene)
  2985. {
  2986. Action<IScene> handler = OnRegionReadyStatusChange;
  2987. if (handler != null)
  2988. {
  2989. foreach (Action<IScene> d in handler.GetInvocationList())
  2990. {
  2991. try
  2992. {
  2993. d(scene);
  2994. }
  2995. catch (Exception e)
  2996. {
  2997. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReadyStatusChange failed - continuing {0} - {1}",
  2998. e.Message, e.StackTrace);
  2999. }
  3000. }
  3001. }
  3002. }
  3003. public void TriggerPrimsLoaded(Scene s)
  3004. {
  3005. PrimsLoaded handler = OnPrimsLoaded;
  3006. if (handler != null)
  3007. {
  3008. foreach (PrimsLoaded d in handler.GetInvocationList())
  3009. {
  3010. try
  3011. {
  3012. d(s);
  3013. }
  3014. catch (Exception e)
  3015. {
  3016. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for PrimsLoaded failed - continuing {0} - {1}",
  3017. e.Message, e.StackTrace);
  3018. }
  3019. }
  3020. }
  3021. }
  3022. public void TriggerTeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout)
  3023. {
  3024. TeleportStart handler = OnTeleportStart;
  3025. if (handler != null)
  3026. {
  3027. foreach (TeleportStart d in handler.GetInvocationList())
  3028. {
  3029. try
  3030. {
  3031. d(client, destination, finalDestination, teleportFlags, gridLogout);
  3032. }
  3033. catch (Exception e)
  3034. {
  3035. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TeleportStart failed - continuing {0} - {1}",
  3036. e.Message, e.StackTrace);
  3037. }
  3038. }
  3039. }
  3040. }
  3041. public void TriggerTeleportFail(IClientAPI client, bool gridLogout)
  3042. {
  3043. TeleportFail handler = OnTeleportFail;
  3044. if (handler != null)
  3045. {
  3046. foreach (TeleportFail d in handler.GetInvocationList())
  3047. {
  3048. try
  3049. {
  3050. d(client, gridLogout);
  3051. }
  3052. catch (Exception e)
  3053. {
  3054. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TeleportFail failed - continuing {0} - {1}",
  3055. e.Message, e.StackTrace);
  3056. }
  3057. }
  3058. }
  3059. }
  3060. public void TriggerExtraSettingChanged(Scene scene, string name, string val)
  3061. {
  3062. ExtraSettingChangedDelegate handler = OnExtraSettingChanged;
  3063. if (handler != null)
  3064. {
  3065. foreach (ExtraSettingChangedDelegate d in handler.GetInvocationList())
  3066. {
  3067. try
  3068. {
  3069. d(scene, name, val);
  3070. }
  3071. catch (Exception e)
  3072. {
  3073. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for ExtraSettingChanged failed - continuing {0} - {1}",
  3074. e.Message, e.StackTrace);
  3075. }
  3076. }
  3077. }
  3078. }
  3079. public void TriggerThrottleUpdate(ScenePresence scenePresence)
  3080. {
  3081. ThrottleUpdate handler = OnThrottleUpdate;
  3082. if (handler != null)
  3083. {
  3084. handler(scenePresence);
  3085. }
  3086. }
  3087. // public void TriggerGatherUuids(SceneObjectPart sop, IDictionary<UUID, AssetType> assetUuids)
  3088. // {
  3089. // GatherUuids handler = OnGatherUuids;
  3090. //
  3091. // if (handler != null)
  3092. // {
  3093. // foreach (GatherUuids d in handler.GetInvocationList())
  3094. // {
  3095. // try
  3096. // {
  3097. // d(sop, assetUuids);
  3098. // }
  3099. // catch (Exception e)
  3100. // {
  3101. // m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TriggerUuidGather failed - continuing {0} - {1}",
  3102. // e.Message, e.StackTrace);
  3103. // }
  3104. // }
  3105. // }
  3106. // }
  3107. }
  3108. }