EventManager.cs 131 KB

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