1
0

EventManager.cs 130 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279
  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. /// ChatBroadcastEvent is called via Scene when a broadcast chat message
  761. /// from world comes in
  762. /// </summary>
  763. public delegate void ChatBroadcastEvent(Object sender, OSChatMessage chat);
  764. public event ChatBroadcastEvent OnChatBroadcast;
  765. public delegate float SunLindenHour();
  766. public event SunLindenHour OnGetCurrentTimeAsLindenSunHour;
  767. /// <summary>
  768. /// Called when oar file has finished loading, although
  769. /// the scripts may not have started yet
  770. /// Message is non empty string if there were problems loading the oar file
  771. /// </summary>
  772. public delegate void OarFileLoaded(Guid guid, List<UUID> loadedScenes, string message);
  773. public event OarFileLoaded OnOarFileLoaded;
  774. /// <summary>
  775. /// Called when an oar file has finished saving
  776. /// Message is non empty string if there were problems saving the oar file
  777. /// If a guid was supplied on the original call to identify, the request, this is returned. Otherwise
  778. /// Guid.Empty is returned.
  779. /// </summary>
  780. public delegate void OarFileSaved(Guid guid, string message);
  781. public event OarFileSaved OnOarFileSaved;
  782. /// <summary>
  783. /// Called when the script compile queue becomes empty
  784. /// Returns the number of scripts which failed to start
  785. /// </summary>
  786. public delegate void EmptyScriptCompileQueue(int numScriptsFailed, string message);
  787. public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue;
  788. /// <summary>
  789. /// Called whenever an object is attached, or detached from an in-world presence.
  790. /// </summary>
  791. /// If the object is being attached, then the avatarID will be present. If the object is being detached then
  792. /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical).
  793. public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
  794. public event Attach OnAttach;
  795. /// <summary>
  796. /// Called immediately after an object is loaded from storage.
  797. /// </summary>
  798. public delegate void SceneObjectDelegate(SceneObjectGroup so);
  799. public event SceneObjectDelegate OnSceneObjectLoaded;
  800. /// <summary>
  801. /// Called immediately before an object is saved to storage.
  802. /// </summary>
  803. /// <param name="persistingSo">
  804. /// The scene object being persisted.
  805. /// 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.
  806. /// </param>
  807. /// <param name="originalSo">
  808. /// The original scene object being persisted. Changes here will stay in memory but will not be saved to storage on this save.
  809. /// </param>
  810. public delegate void SceneObjectPreSaveDelegate(SceneObjectGroup persistingSo, SceneObjectGroup originalSo);
  811. public event SceneObjectPreSaveDelegate OnSceneObjectPreSave;
  812. /// <summary>
  813. /// Called when a scene object part is cloned within the region.
  814. /// </summary>
  815. /// <param name="copy"></param>
  816. /// <param name="original"></param>
  817. /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
  818. /// <remarks>
  819. /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.SceneObjectPart.Copy"/>
  820. /// </remarks>
  821. public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
  822. public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy;
  823. public delegate void SceneObjectPartUpdated(SceneObjectPart sop, bool full);
  824. public event SceneObjectPartUpdated OnSceneObjectPartUpdated;
  825. public delegate void ScenePresenceUpdated(ScenePresence sp);
  826. public event ScenePresenceUpdated OnScenePresenceUpdated;
  827. public delegate void RegionUp(GridRegion region);
  828. public event RegionUp OnRegionUp;
  829. public delegate void RegionStarted(Scene scene);
  830. public event RegionStarted OnRegionStarted;
  831. public delegate void RegionHeartbeatStart(Scene scene);
  832. public event RegionHeartbeatStart OnRegionHeartbeatStart;
  833. public delegate void RegionHeartbeatEnd(Scene scene);
  834. public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
  835. /// <summary>
  836. /// Fired when logins to a region are enabled or disabled.
  837. /// </summary>
  838. /// <remarks>
  839. ///
  840. /// </remarks>
  841. /// Fired
  842. public delegate void RegionLoginsStatusChange(IScene scene);
  843. public event RegionLoginsStatusChange OnRegionLoginsStatusChange;
  844. /// <summary>
  845. /// Fired when a region is considered ready for use.
  846. /// </summary>
  847. /// <remarks>
  848. /// A region is considered ready when startup operations such as loading of scripts already on the region
  849. /// have been completed.
  850. /// </remarks>
  851. public Action<IScene> OnRegionReadyStatusChange;
  852. public delegate void PrimsLoaded(Scene s);
  853. public event PrimsLoaded OnPrimsLoaded;
  854. /// <summary>
  855. /// Triggered when a teleport starts
  856. /// </summary>
  857. /// <remarks>
  858. /// Triggered by <see cref="TriggerTeleportStart"/>
  859. /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.CreateAgent"/>
  860. /// and <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.HGEntityTransferModule.CreateAgent"/>
  861. /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>
  862. /// </remarks>
  863. public delegate void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout);
  864. public event TeleportStart OnTeleportStart;
  865. /// <summary>
  866. /// Trigered when a teleport fails.
  867. /// </summary>
  868. /// <remarks>
  869. /// Triggered by <see cref="TriggerTeleportFail"/>
  870. /// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.Fail"/>
  871. /// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>
  872. /// </remarks>
  873. public delegate void TeleportFail(IClientAPI client, bool gridLogout);
  874. public event TeleportFail OnTeleportFail;
  875. public class MoneyTransferArgs : EventArgs
  876. {
  877. public UUID sender;
  878. public UUID receiver;
  879. public bool authenticated = false; // Always false
  880. public int amount;
  881. public int transactiontype;
  882. public string description;
  883. public MoneyTransferArgs(UUID asender, UUID areceiver, int aamount, int atransactiontype, string adescription)
  884. {
  885. sender = asender;
  886. receiver = areceiver;
  887. amount = aamount;
  888. transactiontype = atransactiontype;
  889. description = adescription;
  890. }
  891. }
  892. /// <summary>
  893. /// Triggered when an attempt to transfer grid currency occurs
  894. /// </summary>
  895. /// <remarks>
  896. /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessMoneyTransferRequest"/>
  897. /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientGridEvents"/>
  898. /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientEvents"/>
  899. /// via <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewAgent"/>
  900. /// </remarks>
  901. public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e);
  902. public event MoneyTransferEvent OnMoneyTransfer;
  903. public class LandBuyArgs : EventArgs
  904. {
  905. public UUID agentId = UUID.Zero;
  906. public UUID groupId = UUID.Zero;
  907. public UUID parcelOwnerID = UUID.Zero;
  908. public bool final = false;
  909. public bool groupOwned = false;
  910. public bool removeContribution = false;
  911. public int parcelLocalID = 0;
  912. public int parcelArea = 0;
  913. public int parcelPrice = 0;
  914. public bool authenticated = false;
  915. public bool landValidated = false;
  916. public bool economyValidated = false;
  917. public int transactionID = 0;
  918. public int amountDebited = 0;
  919. public LandBuyArgs(UUID pagentId, UUID pgroupId, bool pfinal, bool pgroupOwned,
  920. bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice,
  921. bool pauthenticated)
  922. {
  923. agentId = pagentId;
  924. groupId = pgroupId;
  925. final = pfinal;
  926. groupOwned = pgroupOwned;
  927. removeContribution = premoveContribution;
  928. parcelLocalID = pparcelLocalID;
  929. parcelArea = pparcelArea;
  930. parcelPrice = pparcelPrice;
  931. authenticated = pauthenticated;
  932. }
  933. }
  934. /// <summary>
  935. /// Triggered after after <see cref="OnValidateLandBuy"/>
  936. /// </summary>
  937. public delegate void LandBuy(Object sender, LandBuyArgs e);
  938. public event LandBuy OnLandBuy;
  939. /// <summary>
  940. /// Triggered to allow or prevent a real estate transaction
  941. /// </summary>
  942. /// <remarks>
  943. /// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessParcelBuy"/>
  944. /// <seealso cref="OpenSim.Region.OptionalModules.World.MoneyModule.SampleMoneyModule.ValidateLandBuy"/>
  945. /// </remarks>
  946. public event LandBuy OnValidateLandBuy;
  947. public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
  948. {
  949. Attach handlerOnAttach = OnAttach;
  950. if (handlerOnAttach != null)
  951. {
  952. foreach (Attach d in handlerOnAttach.GetInvocationList())
  953. {
  954. try
  955. {
  956. d(localID, itemID, avatarID);
  957. }
  958. catch (Exception e)
  959. {
  960. m_log.ErrorFormat(
  961. "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
  962. e.Message, e.StackTrace);
  963. }
  964. }
  965. }
  966. }
  967. public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
  968. {
  969. GetScriptRunning handlerGetScriptRunning = OnGetScriptRunning;
  970. if (handlerGetScriptRunning != null)
  971. {
  972. foreach (GetScriptRunning d in handlerGetScriptRunning.GetInvocationList())
  973. {
  974. try
  975. {
  976. d(controllingClient, objectID, itemID);
  977. }
  978. catch (Exception e)
  979. {
  980. m_log.ErrorFormat(
  981. "[EVENT MANAGER]: Delegate for TriggerGetScriptRunning failed - continuing. {0} {1}",
  982. e.Message, e.StackTrace);
  983. }
  984. }
  985. }
  986. }
  987. public void TriggerOnScriptChangedEvent(uint localID, uint change, object parameter = null)
  988. {
  989. ScriptChangedEvent handlerScriptChangedEvent = OnScriptChangedEvent;
  990. if (handlerScriptChangedEvent != null)
  991. {
  992. foreach (ScriptChangedEvent d in handlerScriptChangedEvent.GetInvocationList())
  993. {
  994. try
  995. {
  996. d(localID, change, parameter);
  997. }
  998. catch (Exception e)
  999. {
  1000. m_log.ErrorFormat(
  1001. "[EVENT MANAGER]: Delegate for TriggerOnScriptChangedEvent failed - continuing. {0} {1}",
  1002. e.Message, e.StackTrace);
  1003. }
  1004. }
  1005. }
  1006. }
  1007. public void TriggerOnClientMovement(ScenePresence avatar)
  1008. {
  1009. ClientMovement handlerClientMovement = OnClientMovement;
  1010. if (handlerClientMovement != null)
  1011. {
  1012. foreach (ClientMovement d in handlerClientMovement.GetInvocationList())
  1013. {
  1014. try
  1015. {
  1016. d(avatar);
  1017. }
  1018. catch (Exception e)
  1019. {
  1020. m_log.ErrorFormat(
  1021. "[EVENT MANAGER]: Delegate for TriggerOnClientMovement failed - continuing. {0} {1}",
  1022. e.Message, e.StackTrace);
  1023. }
  1024. }
  1025. }
  1026. }
  1027. public void TriggerPermissionError(UUID user, string reason)
  1028. {
  1029. OnPermissionErrorDelegate handlerPermissionError = OnPermissionError;
  1030. if (handlerPermissionError != null)
  1031. {
  1032. foreach (OnPermissionErrorDelegate d in handlerPermissionError.GetInvocationList())
  1033. {
  1034. try
  1035. {
  1036. d(user, reason);
  1037. }
  1038. catch (Exception e)
  1039. {
  1040. m_log.ErrorFormat(
  1041. "[EVENT MANAGER]: Delegate for TriggerPermissionError failed - continuing. {0} {1}",
  1042. e.Message, e.StackTrace);
  1043. }
  1044. }
  1045. }
  1046. }
  1047. public void TriggerOnPluginConsole(string[] args)
  1048. {
  1049. OnPluginConsoleDelegate handlerPluginConsole = OnPluginConsole;
  1050. if (handlerPluginConsole != null)
  1051. {
  1052. foreach (OnPluginConsoleDelegate d in handlerPluginConsole.GetInvocationList())
  1053. {
  1054. try
  1055. {
  1056. d(args);
  1057. }
  1058. catch (Exception e)
  1059. {
  1060. m_log.ErrorFormat(
  1061. "[EVENT MANAGER]: Delegate for TriggerOnPluginConsole failed - continuing. {0} {1}",
  1062. e.Message, e.StackTrace);
  1063. }
  1064. }
  1065. }
  1066. }
  1067. public void TriggerOnFrame()
  1068. {
  1069. OnFrameDelegate handlerFrame = OnFrame;
  1070. if (handlerFrame != null)
  1071. {
  1072. foreach (OnFrameDelegate d in handlerFrame.GetInvocationList())
  1073. {
  1074. try
  1075. {
  1076. d();
  1077. }
  1078. catch (Exception e)
  1079. {
  1080. m_log.ErrorFormat(
  1081. "[EVENT MANAGER]: Delegate for TriggerOnFrame failed - continuing. {0} {1}",
  1082. e.Message, e.StackTrace);
  1083. }
  1084. }
  1085. }
  1086. }
  1087. public void TriggerOnNewClient(IClientAPI client)
  1088. {
  1089. OnNewClientDelegate handlerNewClient = OnNewClient;
  1090. if (handlerNewClient != null)
  1091. {
  1092. foreach (OnNewClientDelegate d in handlerNewClient.GetInvocationList())
  1093. {
  1094. try
  1095. {
  1096. d(client);
  1097. }
  1098. catch (Exception e)
  1099. {
  1100. m_log.ErrorFormat(
  1101. "[EVENT MANAGER]: Delegate for TriggerOnNewClient failed - continuing. {0} {1}",
  1102. e.Message, e.StackTrace);
  1103. }
  1104. }
  1105. }
  1106. // to be removed
  1107. if (client is IClientCore)
  1108. {
  1109. OnClientConnectCoreDelegate handlerClientConnect = OnClientConnect;
  1110. if (handlerClientConnect != null)
  1111. {
  1112. foreach (OnClientConnectCoreDelegate d in handlerClientConnect.GetInvocationList())
  1113. {
  1114. try
  1115. {
  1116. d((IClientCore)client);
  1117. }
  1118. catch (Exception e)
  1119. {
  1120. m_log.ErrorFormat(
  1121. "[EVENT MANAGER]: Delegate for TriggerOnNewClient (IClientCore) failed - continuing. {0} {1}",
  1122. e.Message, e.StackTrace);
  1123. }
  1124. }
  1125. }
  1126. }
  1127. }
  1128. public void TriggerOnClientLogin(IClientAPI client)
  1129. {
  1130. Action<IClientAPI> handlerClientLogin = OnClientLogin;
  1131. if (handlerClientLogin != null)
  1132. {
  1133. foreach (Action<IClientAPI> d in handlerClientLogin.GetInvocationList())
  1134. {
  1135. try
  1136. {
  1137. d(client);
  1138. }
  1139. catch (Exception e)
  1140. {
  1141. m_log.ErrorFormat(
  1142. "[EVENT MANAGER]: Delegate for TriggerOnClientLogin failed - continuing. {0} {1}",
  1143. e.Message, e.StackTrace);
  1144. }
  1145. }
  1146. }
  1147. }
  1148. public void TriggerOnNewPresence(ScenePresence presence)
  1149. {
  1150. OnNewPresenceDelegate handlerNewPresence = OnNewPresence;
  1151. if (handlerNewPresence != null)
  1152. {
  1153. foreach (OnNewPresenceDelegate d in handlerNewPresence.GetInvocationList())
  1154. {
  1155. try
  1156. {
  1157. d(presence);
  1158. }
  1159. catch (Exception e)
  1160. {
  1161. m_log.ErrorFormat(
  1162. "[EVENT MANAGER]: Delegate for TriggerOnNewPresence failed - continuing. {0} {1}",
  1163. e.Message, e.StackTrace);
  1164. }
  1165. }
  1166. }
  1167. }
  1168. public void TriggerOnRemovePresence(UUID agentId)
  1169. {
  1170. OnRemovePresenceDelegate handlerRemovePresence = OnRemovePresence;
  1171. if (handlerRemovePresence != null)
  1172. {
  1173. foreach (OnRemovePresenceDelegate d in handlerRemovePresence.GetInvocationList())
  1174. {
  1175. try
  1176. {
  1177. // m_log.ErrorFormat("[EVENT MANAGER]: OnRemovePresenceDelegate: {0}",d.Target.ToString());
  1178. d(agentId);
  1179. // m_log.ErrorFormat("[EVENT MANAGER]: OnRemovePresenceDelegate done ");
  1180. }
  1181. catch (Exception e)
  1182. {
  1183. m_log.ErrorFormat(
  1184. "[EVENT MANAGER]: Delegate for TriggerOnRemovePresence failed - continuing. {0} {1}",
  1185. e.Message, e.StackTrace);
  1186. }
  1187. }
  1188. }
  1189. }
  1190. public void TriggerOnBackup(ISimulationDataService dstore, bool forced)
  1191. {
  1192. OnBackupDelegate handlerOnAttach = OnBackup;
  1193. if (handlerOnAttach != null)
  1194. {
  1195. foreach (OnBackupDelegate d in handlerOnAttach.GetInvocationList())
  1196. {
  1197. try
  1198. {
  1199. d(dstore, forced);
  1200. }
  1201. catch (Exception e)
  1202. {
  1203. m_log.ErrorFormat(
  1204. "[EVENT MANAGER]: Delegate for TriggerOnBackup failed - continuing. {0} {1}",
  1205. e.Message, e.StackTrace);
  1206. }
  1207. }
  1208. }
  1209. }
  1210. public void TriggerParcelPrimCountUpdate()
  1211. {
  1212. OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = OnParcelPrimCountUpdate;
  1213. if (handlerParcelPrimCountUpdate != null)
  1214. {
  1215. foreach (OnParcelPrimCountUpdateDelegate d in handlerParcelPrimCountUpdate.GetInvocationList())
  1216. {
  1217. try
  1218. {
  1219. d();
  1220. }
  1221. catch (Exception e)
  1222. {
  1223. m_log.ErrorFormat(
  1224. "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountUpdate failed - continuing. {0} {1}",
  1225. e.Message, e.StackTrace);
  1226. }
  1227. }
  1228. }
  1229. }
  1230. public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs args)
  1231. {
  1232. MoneyTransferEvent handlerMoneyTransfer = OnMoneyTransfer;
  1233. if (handlerMoneyTransfer != null)
  1234. {
  1235. foreach (MoneyTransferEvent d in handlerMoneyTransfer.GetInvocationList())
  1236. {
  1237. try
  1238. {
  1239. d(sender, args);
  1240. }
  1241. catch (Exception e)
  1242. {
  1243. m_log.ErrorFormat(
  1244. "[EVENT MANAGER]: Delegate for TriggerMoneyTransfer failed - continuing. {0} {1}",
  1245. e.Message, e.StackTrace);
  1246. }
  1247. }
  1248. }
  1249. }
  1250. public void TriggerTerrainUpdate()
  1251. {
  1252. OnTerrainUpdateDelegate handlerTerrainUpdate = OnTerrainUpdate;
  1253. if (handlerTerrainUpdate != null)
  1254. {
  1255. foreach (OnTerrainUpdateDelegate d in handlerTerrainUpdate.GetInvocationList())
  1256. {
  1257. try
  1258. {
  1259. d();
  1260. }
  1261. catch (Exception e)
  1262. {
  1263. m_log.ErrorFormat(
  1264. "[EVENT MANAGER]: Delegate for TriggerTerrainUpdate failed - continuing. {0} {1}",
  1265. e.Message, e.StackTrace);
  1266. }
  1267. }
  1268. }
  1269. }
  1270. public void TriggerTerrainTick()
  1271. {
  1272. OnTerrainTickDelegate handlerTerrainTick = OnTerrainTick;
  1273. if (handlerTerrainTick != null)
  1274. {
  1275. foreach (OnTerrainTickDelegate d in handlerTerrainTick.GetInvocationList())
  1276. {
  1277. try
  1278. {
  1279. d();
  1280. }
  1281. catch (Exception e)
  1282. {
  1283. m_log.ErrorFormat(
  1284. "[EVENT MANAGER]: Delegate for TriggerTerrainTick failed - continuing. {0} {1}",
  1285. e.Message, e.StackTrace);
  1286. }
  1287. }
  1288. }
  1289. }
  1290. public void TriggerTerrainCheckUpdates()
  1291. {
  1292. OnTerrainCheckUpdatesDelegate TerrainCheckUpdates = OnTerrainCheckUpdates;
  1293. if (TerrainCheckUpdates != null)
  1294. {
  1295. foreach (OnTerrainCheckUpdatesDelegate d in TerrainCheckUpdates.GetInvocationList())
  1296. {
  1297. try
  1298. {
  1299. d();
  1300. }
  1301. catch (Exception e)
  1302. {
  1303. m_log.ErrorFormat(
  1304. "[EVENT MANAGER]: Delegate for TerrainCheckUpdates failed - continuing. {0} {1}",
  1305. e.Message, e.StackTrace);
  1306. }
  1307. }
  1308. }
  1309. }
  1310. public void TriggerTerrainTainted()
  1311. {
  1312. OnTerrainTaintedDelegate handlerTerrainTainted = OnTerrainTainted;
  1313. if (handlerTerrainTainted != null)
  1314. {
  1315. foreach (OnTerrainTaintedDelegate d in handlerTerrainTainted.GetInvocationList())
  1316. {
  1317. try
  1318. {
  1319. d();
  1320. }
  1321. catch (Exception e)
  1322. {
  1323. m_log.ErrorFormat(
  1324. "[EVENT MANAGER]: Delegate for TriggerTerrainTainted failed - continuing. {0} {1}",
  1325. e.Message, e.StackTrace);
  1326. }
  1327. }
  1328. }
  1329. }
  1330. public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
  1331. {
  1332. OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = OnParcelPrimCountAdd;
  1333. if (handlerParcelPrimCountAdd != null)
  1334. {
  1335. foreach (OnParcelPrimCountAddDelegate d in handlerParcelPrimCountAdd.GetInvocationList())
  1336. {
  1337. try
  1338. {
  1339. d(obj);
  1340. }
  1341. catch (Exception e)
  1342. {
  1343. m_log.ErrorFormat(
  1344. "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountAdd failed - continuing. {0} {1}",
  1345. e.Message, e.StackTrace);
  1346. }
  1347. }
  1348. }
  1349. }
  1350. public void TriggerObjectAddedToScene(SceneObjectGroup obj)
  1351. {
  1352. Action<SceneObjectGroup> handler = OnObjectAddedToScene;
  1353. if (handler != null)
  1354. {
  1355. foreach (Action<SceneObjectGroup> d in handler.GetInvocationList())
  1356. {
  1357. try
  1358. {
  1359. d(obj);
  1360. }
  1361. catch (Exception e)
  1362. {
  1363. m_log.ErrorFormat(
  1364. "[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing. {0} {1}",
  1365. e.Message, e.StackTrace);
  1366. }
  1367. }
  1368. }
  1369. }
  1370. public bool TriggerDeRezRequested(IClientAPI client, List<SceneObjectGroup> objs, DeRezAction action)
  1371. {
  1372. bool canDeRez = true;
  1373. DeRezRequested handlerDeRezRequested = OnDeRezRequested;
  1374. if (handlerDeRezRequested != null)
  1375. {
  1376. foreach (DeRezRequested d in handlerDeRezRequested.GetInvocationList())
  1377. {
  1378. try
  1379. {
  1380. canDeRez &= d(client, objs, action);
  1381. }
  1382. catch (Exception e)
  1383. {
  1384. m_log.ErrorFormat(
  1385. "[EVENT MANAGER]: Delegate for TriggerDeRezRequested failed - continuing. {0} {1}",
  1386. e.Message, e.StackTrace);
  1387. }
  1388. }
  1389. }
  1390. return canDeRez;
  1391. }
  1392. public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
  1393. {
  1394. ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
  1395. if (handlerObjectBeingRemovedFromScene != null)
  1396. {
  1397. foreach (ObjectBeingRemovedFromScene d in handlerObjectBeingRemovedFromScene.GetInvocationList())
  1398. {
  1399. try
  1400. {
  1401. d(obj);
  1402. }
  1403. catch (Exception e)
  1404. {
  1405. m_log.ErrorFormat(
  1406. "[EVENT MANAGER]: Delegate for TriggerObjectBeingRemovedFromScene failed - continuing. {0} {1}",
  1407. e.Message, e.StackTrace);
  1408. }
  1409. }
  1410. }
  1411. }
  1412. public void TriggerObjectAddedToPhysicalScene(SceneObjectPart obj)
  1413. {
  1414. Action<SceneObjectPart> handler = OnObjectAddedToPhysicalScene;
  1415. if (handler != null)
  1416. {
  1417. foreach (Action<SceneObjectPart> d in handler.GetInvocationList())
  1418. {
  1419. try
  1420. {
  1421. d(obj);
  1422. }
  1423. catch (Exception e)
  1424. {
  1425. m_log.ErrorFormat(
  1426. "[EVENT MANAGER]: Delegate for TriggerObjectAddedToPhysicalScene failed - continuing. {0} {1}",
  1427. e.Message, e.StackTrace);
  1428. }
  1429. }
  1430. }
  1431. }
  1432. public void TriggerObjectRemovedFromPhysicalScene(SceneObjectPart obj)
  1433. {
  1434. Action<SceneObjectPart> handler = OnObjectRemovedFromPhysicalScene;
  1435. if (handler != null)
  1436. {
  1437. foreach (Action<SceneObjectPart> d in handler.GetInvocationList())
  1438. {
  1439. try
  1440. {
  1441. d(obj);
  1442. }
  1443. catch (Exception e)
  1444. {
  1445. m_log.ErrorFormat(
  1446. "[EVENT MANAGER]: Delegate for TriggerObjectRemovedFromPhysicalScene failed - continuing. {0} {1}",
  1447. e.Message, e.StackTrace);
  1448. }
  1449. }
  1450. }
  1451. }
  1452. public void TriggerShutdown()
  1453. {
  1454. Action handlerShutdown = OnShutdown;
  1455. if (handlerShutdown != null)
  1456. {
  1457. foreach (Action d in handlerShutdown.GetInvocationList())
  1458. {
  1459. try
  1460. {
  1461. d();
  1462. }
  1463. catch (Exception e)
  1464. {
  1465. m_log.ErrorFormat(
  1466. "[EVENT MANAGER]: Delegate for TriggerShutdown failed - continuing. {0} {1}",
  1467. e.Message, e.StackTrace);
  1468. }
  1469. }
  1470. }
  1471. }
  1472. public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  1473. {
  1474. ObjectGrabDelegate handlerObjectGrab = OnObjectGrab;
  1475. if (handlerObjectGrab != null)
  1476. {
  1477. foreach (ObjectGrabDelegate d in handlerObjectGrab.GetInvocationList())
  1478. {
  1479. try
  1480. {
  1481. d(localID, originalID, offsetPos, remoteClient, surfaceArgs);
  1482. }
  1483. catch (Exception e)
  1484. {
  1485. m_log.ErrorFormat(
  1486. "[EVENT MANAGER]: Delegate for TriggerObjectGrab failed - continuing. {0} {1}",
  1487. e.Message, e.StackTrace);
  1488. }
  1489. }
  1490. }
  1491. }
  1492. public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  1493. {
  1494. ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing;
  1495. if (handlerObjectGrabbing != null)
  1496. {
  1497. foreach (ObjectGrabDelegate d in handlerObjectGrabbing.GetInvocationList())
  1498. {
  1499. try
  1500. {
  1501. d(localID, originalID, offsetPos, remoteClient, surfaceArgs);
  1502. }
  1503. catch (Exception e)
  1504. {
  1505. m_log.ErrorFormat(
  1506. "[EVENT MANAGER]: Delegate for TriggerObjectGrabbing failed - continuing. {0} {1}",
  1507. e.Message, e.StackTrace);
  1508. }
  1509. }
  1510. }
  1511. }
  1512. public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  1513. {
  1514. ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab;
  1515. if (handlerObjectDeGrab != null)
  1516. {
  1517. foreach (ObjectDeGrabDelegate d in handlerObjectDeGrab.GetInvocationList())
  1518. {
  1519. try
  1520. {
  1521. d(localID, originalID, remoteClient, surfaceArgs);
  1522. }
  1523. catch (Exception e)
  1524. {
  1525. m_log.ErrorFormat(
  1526. "[EVENT MANAGER]: Delegate for TriggerObjectDeGrab failed - continuing. {0} {1}",
  1527. e.Message, e.StackTrace);
  1528. }
  1529. }
  1530. }
  1531. }
  1532. public void TriggerScriptReset(uint localID, UUID itemID)
  1533. {
  1534. ScriptResetDelegate handlerScriptReset = OnScriptReset;
  1535. if (handlerScriptReset != null)
  1536. {
  1537. foreach (ScriptResetDelegate d in handlerScriptReset.GetInvocationList())
  1538. {
  1539. try
  1540. {
  1541. d(localID, itemID);
  1542. }
  1543. catch (Exception e)
  1544. {
  1545. m_log.ErrorFormat(
  1546. "[EVENT MANAGER]: Delegate for TriggerScriptReset failed - continuing. {0} {1}",
  1547. e.Message, e.StackTrace);
  1548. }
  1549. }
  1550. }
  1551. }
  1552. public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
  1553. {
  1554. NewRezScript handlerRezScript = OnRezScript;
  1555. if (handlerRezScript != null)
  1556. {
  1557. foreach (NewRezScript d in handlerRezScript.GetInvocationList())
  1558. {
  1559. try
  1560. {
  1561. d(localID, itemID, script, startParam, postOnRez, engine, stateSource);
  1562. }
  1563. catch (Exception e)
  1564. {
  1565. m_log.ErrorFormat(
  1566. "[EVENT MANAGER]: Delegate for TriggerRezScript failed - continuing. {0} {1}",
  1567. e.Message, e.StackTrace);
  1568. }
  1569. }
  1570. }
  1571. }
  1572. public void TriggerStartScript(uint localID, UUID itemID)
  1573. {
  1574. StartScript handlerStartScript = OnStartScript;
  1575. if (handlerStartScript != null)
  1576. {
  1577. foreach (StartScript d in handlerStartScript.GetInvocationList())
  1578. {
  1579. try
  1580. {
  1581. d(localID, itemID);
  1582. }
  1583. catch (Exception e)
  1584. {
  1585. m_log.ErrorFormat(
  1586. "[EVENT MANAGER]: Delegate for TriggerStartScript failed - continuing. {0} {1}",
  1587. e.Message, e.StackTrace);
  1588. }
  1589. }
  1590. }
  1591. }
  1592. public void TriggerStopScript(uint localID, UUID itemID)
  1593. {
  1594. StopScript handlerStopScript = OnStopScript;
  1595. if (handlerStopScript != null)
  1596. {
  1597. foreach (StopScript d in handlerStopScript.GetInvocationList())
  1598. {
  1599. try
  1600. {
  1601. d(localID, itemID);
  1602. }
  1603. catch (Exception e)
  1604. {
  1605. m_log.ErrorFormat(
  1606. "[EVENT MANAGER]: Delegate for TriggerStopScript failed - continuing. {0} {1}",
  1607. e.Message, e.StackTrace);
  1608. }
  1609. }
  1610. }
  1611. }
  1612. public void TriggerRemoveScript(uint localID, UUID itemID)
  1613. {
  1614. RemoveScript handlerRemoveScript = OnRemoveScript;
  1615. if (handlerRemoveScript != null)
  1616. {
  1617. foreach (RemoveScript d in handlerRemoveScript.GetInvocationList())
  1618. {
  1619. try
  1620. {
  1621. d(localID, itemID);
  1622. }
  1623. catch (Exception e)
  1624. {
  1625. m_log.ErrorFormat(
  1626. "[EVENT MANAGER]: Delegate for TriggerRemoveScript failed - continuing. {0} {1}",
  1627. e.Message, e.StackTrace);
  1628. m_log.ErrorFormat(Environment.StackTrace);
  1629. }
  1630. }
  1631. }
  1632. }
  1633. public bool TriggerGroupMove(UUID groupID, Vector3 delta)
  1634. {
  1635. bool result = true;
  1636. SceneGroupMoved handlerSceneGroupMove = OnSceneGroupMove;
  1637. if (handlerSceneGroupMove != null)
  1638. {
  1639. foreach (SceneGroupMoved d in handlerSceneGroupMove.GetInvocationList())
  1640. {
  1641. try
  1642. {
  1643. if (d(groupID, delta) == false)
  1644. result = false;
  1645. }
  1646. catch (Exception e)
  1647. {
  1648. m_log.ErrorFormat(
  1649. "[EVENT MANAGER]: Delegate for TriggerGroupMove failed - continuing. {0} {1}",
  1650. e.Message, e.StackTrace);
  1651. }
  1652. }
  1653. }
  1654. return result;
  1655. }
  1656. public bool TriggerGroupSpinStart(UUID groupID)
  1657. {
  1658. bool result = true;
  1659. SceneGroupSpinStarted handlerSceneGroupSpinStarted = OnSceneGroupSpinStart;
  1660. if (handlerSceneGroupSpinStarted != null)
  1661. {
  1662. foreach (SceneGroupSpinStarted d in handlerSceneGroupSpinStarted.GetInvocationList())
  1663. {
  1664. try
  1665. {
  1666. if (d(groupID) == false)
  1667. result = false;
  1668. }
  1669. catch (Exception e)
  1670. {
  1671. m_log.ErrorFormat(
  1672. "[EVENT MANAGER]: Delegate for TriggerGroupSpinStart failed - continuing. {0} {1}",
  1673. e.Message, e.StackTrace);
  1674. }
  1675. }
  1676. }
  1677. return result;
  1678. }
  1679. public bool TriggerGroupSpin(UUID groupID, Quaternion rotation)
  1680. {
  1681. bool result = true;
  1682. SceneGroupSpun handlerSceneGroupSpin = OnSceneGroupSpin;
  1683. if (handlerSceneGroupSpin != null)
  1684. {
  1685. foreach (SceneGroupSpun d in handlerSceneGroupSpin.GetInvocationList())
  1686. {
  1687. try
  1688. {
  1689. if (d(groupID, rotation) == false)
  1690. result = false;
  1691. }
  1692. catch (Exception e)
  1693. {
  1694. m_log.ErrorFormat(
  1695. "[EVENT MANAGER]: Delegate for TriggerGroupSpin failed - continuing. {0} {1}",
  1696. e.Message, e.StackTrace);
  1697. }
  1698. }
  1699. }
  1700. return result;
  1701. }
  1702. public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID)
  1703. {
  1704. SceneGroupGrabed handlerSceneGroupGrab = OnSceneGroupGrab;
  1705. if (handlerSceneGroupGrab != null)
  1706. {
  1707. foreach (SceneGroupGrabed d in handlerSceneGroupGrab.GetInvocationList())
  1708. {
  1709. try
  1710. {
  1711. d(groupID, offset, userID);
  1712. }
  1713. catch (Exception e)
  1714. {
  1715. m_log.ErrorFormat(
  1716. "[EVENT MANAGER]: Delegate for TriggerGroupGrab failed - continuing. {0} {1}",
  1717. e.Message, e.StackTrace);
  1718. }
  1719. }
  1720. }
  1721. }
  1722. public void TriggerLandObjectAdded(ILandObject newParcel)
  1723. {
  1724. LandObjectAdded handlerLandObjectAdded = OnLandObjectAdded;
  1725. if (handlerLandObjectAdded != null)
  1726. {
  1727. foreach (LandObjectAdded d in handlerLandObjectAdded.GetInvocationList())
  1728. {
  1729. try
  1730. {
  1731. d(newParcel);
  1732. }
  1733. catch (Exception e)
  1734. {
  1735. m_log.ErrorFormat(
  1736. "[EVENT MANAGER]: Delegate for TriggerLandObjectAdded failed - continuing. {0} {1}",
  1737. e.Message, e.StackTrace);
  1738. }
  1739. }
  1740. }
  1741. }
  1742. public void TriggerLandObjectRemoved(UUID globalID)
  1743. {
  1744. LandObjectRemoved handlerLandObjectRemoved = OnLandObjectRemoved;
  1745. if (handlerLandObjectRemoved != null)
  1746. {
  1747. foreach (LandObjectRemoved d in handlerLandObjectRemoved.GetInvocationList())
  1748. {
  1749. try
  1750. {
  1751. d(globalID);
  1752. }
  1753. catch (Exception e)
  1754. {
  1755. m_log.ErrorFormat(
  1756. "[EVENT MANAGER]: Delegate for TriggerLandObjectRemoved failed - continuing. {0} {1}",
  1757. e.Message, e.StackTrace);
  1758. }
  1759. }
  1760. }
  1761. }
  1762. public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel)
  1763. {
  1764. TriggerLandObjectAdded(newParcel);
  1765. }
  1766. public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
  1767. {
  1768. AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel;
  1769. if (handlerAvatarEnteringNewParcel != null)
  1770. {
  1771. foreach (AvatarEnteringNewParcel d in handlerAvatarEnteringNewParcel.GetInvocationList())
  1772. {
  1773. try
  1774. {
  1775. d(avatar, localLandID, regionID);
  1776. }
  1777. catch (Exception e)
  1778. {
  1779. m_log.ErrorFormat(
  1780. "[EVENT MANAGER]: Delegate for TriggerAvatarEnteringNewParcel failed - continuing. {0} {1}",
  1781. e.Message, e.StackTrace);
  1782. }
  1783. }
  1784. }
  1785. }
  1786. public void TriggerAvatarAppearanceChanged(ScenePresence avatar)
  1787. {
  1788. AvatarAppearanceChange handler = OnAvatarAppearanceChange;
  1789. if (handler != null)
  1790. {
  1791. foreach (AvatarAppearanceChange d in handler.GetInvocationList())
  1792. {
  1793. try
  1794. {
  1795. d(avatar);
  1796. }
  1797. catch (Exception e)
  1798. {
  1799. m_log.ErrorFormat(
  1800. "[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}",
  1801. e.Message, e.StackTrace);
  1802. }
  1803. }
  1804. }
  1805. }
  1806. public void TriggerCrossAgentToNewRegion(ScenePresence agent, bool isFlying, GridRegion newRegion)
  1807. {
  1808. CrossAgentToNewRegion handlerCrossAgentToNewRegion = OnCrossAgentToNewRegion;
  1809. if (handlerCrossAgentToNewRegion != null)
  1810. {
  1811. foreach (CrossAgentToNewRegion d in handlerCrossAgentToNewRegion.GetInvocationList())
  1812. {
  1813. try
  1814. {
  1815. d(agent, isFlying, newRegion);
  1816. }
  1817. catch (Exception e)
  1818. {
  1819. m_log.ErrorFormat(
  1820. "[EVENT MANAGER]: Delegate for TriggerCrossAgentToNewRegion failed - continuing. {0} {1}",
  1821. e.Message, e.StackTrace);
  1822. }
  1823. }
  1824. }
  1825. }
  1826. public void TriggerIncomingInstantMessage(GridInstantMessage message)
  1827. {
  1828. IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage;
  1829. if (handlerIncomingInstantMessage != null)
  1830. {
  1831. foreach (IncomingInstantMessage d in handlerIncomingInstantMessage.GetInvocationList())
  1832. {
  1833. try
  1834. {
  1835. d(message);
  1836. }
  1837. catch (Exception e)
  1838. {
  1839. m_log.ErrorFormat(
  1840. "[EVENT MANAGER]: Delegate for TriggerIncomingInstantMessage failed - continuing. {0} {1}",
  1841. e.Message, e.StackTrace);
  1842. }
  1843. }
  1844. }
  1845. }
  1846. public void TriggerUnhandledInstantMessage(GridInstantMessage message)
  1847. {
  1848. IncomingInstantMessage handlerUnhandledInstantMessage = OnUnhandledInstantMessage;
  1849. if (handlerUnhandledInstantMessage != null)
  1850. {
  1851. foreach (IncomingInstantMessage d in handlerUnhandledInstantMessage.GetInvocationList())
  1852. {
  1853. try
  1854. {
  1855. d(message);
  1856. }
  1857. catch (Exception e)
  1858. {
  1859. m_log.ErrorFormat(
  1860. "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
  1861. e.Message, e.StackTrace);
  1862. }
  1863. }
  1864. }
  1865. }
  1866. public void TriggerClientClosed(UUID ClientID, Scene scene)
  1867. {
  1868. ClientClosed handlerClientClosed = OnClientClosed;
  1869. if (handlerClientClosed != null)
  1870. {
  1871. foreach (ClientClosed d in handlerClientClosed.GetInvocationList())
  1872. {
  1873. try
  1874. {
  1875. // m_log.ErrorFormat("[EVENT MANAGER]: TriggerClientClosed: {0}", d.Target.ToString());
  1876. d(ClientID, scene);
  1877. // m_log.ErrorFormat("[EVENT MANAGER]: TriggerClientClosed done ");
  1878. }
  1879. catch (Exception e)
  1880. {
  1881. m_log.ErrorFormat(
  1882. "[EVENT MANAGER]: Delegate for TriggerClientClosed failed - continuing. {0} {1}",
  1883. e.Message, e.StackTrace);
  1884. }
  1885. }
  1886. }
  1887. }
  1888. public void TriggerOnMakeChildAgent(ScenePresence presence)
  1889. {
  1890. OnMakeChildAgentDelegate handlerMakeChildAgent = OnMakeChildAgent;
  1891. if (handlerMakeChildAgent != null)
  1892. {
  1893. foreach (OnMakeChildAgentDelegate d in handlerMakeChildAgent.GetInvocationList())
  1894. {
  1895. try
  1896. {
  1897. d(presence);
  1898. }
  1899. catch (Exception e)
  1900. {
  1901. m_log.ErrorFormat(
  1902. "[EVENT MANAGER]: Delegate for TriggerOnMakeChildAgent failed - continuing. {0} {1}",
  1903. e.Message, e.StackTrace);
  1904. }
  1905. }
  1906. }
  1907. }
  1908. public void TriggerOnMakeRootAgent(ScenePresence presence)
  1909. {
  1910. Action<ScenePresence> handlerMakeRootAgent = OnMakeRootAgent;
  1911. if (handlerMakeRootAgent != null)
  1912. {
  1913. foreach (Action<ScenePresence> d in handlerMakeRootAgent.GetInvocationList())
  1914. {
  1915. try
  1916. {
  1917. d(presence);
  1918. }
  1919. catch (Exception e)
  1920. {
  1921. m_log.ErrorFormat(
  1922. "[EVENT MANAGER]: Delegate for TriggerOnMakeRootAgent failed - continuing. {0} {1}",
  1923. e.Message, e.StackTrace);
  1924. }
  1925. }
  1926. }
  1927. }
  1928. public void TriggerOnIncomingSceneObject(SceneObjectGroup so)
  1929. {
  1930. OnIncomingSceneObjectDelegate handlerIncomingSceneObject = OnIncomingSceneObject;
  1931. if (handlerIncomingSceneObject != null)
  1932. {
  1933. foreach (OnIncomingSceneObjectDelegate d in handlerIncomingSceneObject.GetInvocationList())
  1934. {
  1935. try
  1936. {
  1937. d(so);
  1938. }
  1939. catch (Exception e)
  1940. {
  1941. m_log.ErrorFormat(
  1942. "[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}",
  1943. e.Message, e.StackTrace);
  1944. }
  1945. }
  1946. }
  1947. }
  1948. public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
  1949. {
  1950. RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps;
  1951. if (handlerRegisterCaps != null)
  1952. {
  1953. foreach (RegisterCapsEvent d in handlerRegisterCaps.GetInvocationList())
  1954. {
  1955. try
  1956. {
  1957. d(agentID, caps);
  1958. }
  1959. catch (Exception e)
  1960. {
  1961. m_log.ErrorFormat(
  1962. "[EVENT MANAGER]: Delegate for TriggerOnRegisterCaps failed - continuing. {0} {1}",
  1963. e.Message, e.StackTrace);
  1964. }
  1965. }
  1966. }
  1967. }
  1968. public void TriggerOnDeregisterCaps(UUID agentID, Caps caps)
  1969. {
  1970. DeregisterCapsEvent handlerDeregisterCaps = OnDeregisterCaps;
  1971. if (handlerDeregisterCaps != null)
  1972. {
  1973. foreach (DeregisterCapsEvent d in handlerDeregisterCaps.GetInvocationList())
  1974. {
  1975. try
  1976. {
  1977. d(agentID, caps);
  1978. }
  1979. catch (Exception e)
  1980. {
  1981. m_log.ErrorFormat(
  1982. "[EVENT MANAGER]: Delegate for TriggerOnDeregisterCaps failed - continuing. {0} {1}",
  1983. e.Message, e.StackTrace);
  1984. }
  1985. }
  1986. }
  1987. }
  1988. public void TriggerOnNewInventoryItemUploadComplete(InventoryItemBase item, int userlevel)
  1989. {
  1990. NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete;
  1991. if (handlerNewInventoryItemUpdateComplete != null)
  1992. {
  1993. foreach (NewInventoryItemUploadComplete d in handlerNewInventoryItemUpdateComplete.GetInvocationList())
  1994. {
  1995. try
  1996. {
  1997. d(item, userlevel);
  1998. }
  1999. catch (Exception e)
  2000. {
  2001. m_log.ErrorFormat(
  2002. "[EVENT MANAGER]: Delegate for TriggerOnNewInventoryItemUploadComplete failed - continuing. {0} {1}",
  2003. e.Message, e.StackTrace);
  2004. }
  2005. }
  2006. }
  2007. }
  2008. public void TriggerLandBuy(Object sender, LandBuyArgs args)
  2009. {
  2010. LandBuy handlerLandBuy = OnLandBuy;
  2011. if (handlerLandBuy != null)
  2012. {
  2013. foreach (LandBuy d in handlerLandBuy.GetInvocationList())
  2014. {
  2015. try
  2016. {
  2017. d(sender, args);
  2018. }
  2019. catch (Exception e)
  2020. {
  2021. m_log.ErrorFormat(
  2022. "[EVENT MANAGER]: Delegate for TriggerLandBuy failed - continuing. {0} {1}",
  2023. e.Message, e.StackTrace);
  2024. }
  2025. }
  2026. }
  2027. }
  2028. public void TriggerValidateLandBuy(Object sender, LandBuyArgs args)
  2029. {
  2030. LandBuy handlerValidateLandBuy = OnValidateLandBuy;
  2031. if (handlerValidateLandBuy != null)
  2032. {
  2033. foreach (LandBuy d in handlerValidateLandBuy.GetInvocationList())
  2034. {
  2035. try
  2036. {
  2037. d(sender, args);
  2038. }
  2039. catch (Exception e)
  2040. {
  2041. m_log.ErrorFormat(
  2042. "[EVENT MANAGER]: Delegate for TriggerValidateLandBuy failed - continuing. {0} {1}",
  2043. e.Message, e.StackTrace);
  2044. }
  2045. }
  2046. }
  2047. }
  2048. public void TriggerAtTargetEvent(UUID scriptID, uint handle, Vector3 targetpos, Vector3 currentpos)
  2049. {
  2050. ScriptAtTargetEvent handlerScriptAtTargetEvent = OnScriptAtTargetEvent;
  2051. if (handlerScriptAtTargetEvent != null)
  2052. {
  2053. foreach (ScriptAtTargetEvent d in handlerScriptAtTargetEvent.GetInvocationList())
  2054. {
  2055. try
  2056. {
  2057. d(scriptID, handle, targetpos, currentpos);
  2058. }
  2059. catch (Exception e)
  2060. {
  2061. m_log.ErrorFormat(
  2062. "[EVENT MANAGER]: Delegate for TriggerAtTargetEvent failed - continuing. {0} {1}",
  2063. e.Message, e.StackTrace);
  2064. }
  2065. }
  2066. }
  2067. }
  2068. public void TriggerNotAtTargetEvent(UUID scriptID)
  2069. {
  2070. ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent;
  2071. if (handlerScriptNotAtTargetEvent != null)
  2072. {
  2073. foreach (ScriptNotAtTargetEvent d in handlerScriptNotAtTargetEvent.GetInvocationList())
  2074. {
  2075. try
  2076. {
  2077. d(scriptID);
  2078. }
  2079. catch (Exception e)
  2080. {
  2081. m_log.ErrorFormat(
  2082. "[EVENT MANAGER]: Delegate for TriggerNotAtTargetEvent failed - continuing. {0} {1}",
  2083. e.Message, e.StackTrace);
  2084. }
  2085. }
  2086. }
  2087. }
  2088. public void TriggerAtRotTargetEvent(UUID scriptID, uint handle, Quaternion targetrot, Quaternion currentrot)
  2089. {
  2090. ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent;
  2091. if (handlerScriptAtRotTargetEvent != null)
  2092. {
  2093. foreach (ScriptAtRotTargetEvent d in handlerScriptAtRotTargetEvent.GetInvocationList())
  2094. {
  2095. try
  2096. {
  2097. d(scriptID, handle, targetrot, currentrot);
  2098. }
  2099. catch (Exception e)
  2100. {
  2101. m_log.ErrorFormat(
  2102. "[EVENT MANAGER]: Delegate for TriggerAtRotTargetEvent failed - continuing. {0} {1}",
  2103. e.Message, e.StackTrace);
  2104. }
  2105. }
  2106. }
  2107. }
  2108. public void TriggerNotAtRotTargetEvent(UUID scriptID)
  2109. {
  2110. ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent;
  2111. if (handlerScriptNotAtRotTargetEvent != null)
  2112. {
  2113. foreach (ScriptNotAtRotTargetEvent d in handlerScriptNotAtRotTargetEvent.GetInvocationList())
  2114. {
  2115. try
  2116. {
  2117. d(scriptID);
  2118. }
  2119. catch (Exception e)
  2120. {
  2121. m_log.ErrorFormat(
  2122. "[EVENT MANAGER]: Delegate for TriggerNotAtRotTargetEvent failed - continuing. {0} {1}",
  2123. e.Message, e.StackTrace);
  2124. }
  2125. }
  2126. }
  2127. }
  2128. public void TriggerMovingStartEvent(uint localID)
  2129. {
  2130. ScriptMovingStartEvent handlerScriptMovingStartEvent = OnScriptMovingStartEvent;
  2131. if (handlerScriptMovingStartEvent != null)
  2132. {
  2133. foreach (ScriptMovingStartEvent d in handlerScriptMovingStartEvent.GetInvocationList())
  2134. {
  2135. try
  2136. {
  2137. d(localID);
  2138. }
  2139. catch (Exception e)
  2140. {
  2141. m_log.ErrorFormat(
  2142. "[EVENT MANAGER]: Delegate for TriggerMovingStartEvent failed - continuing. {0} {1}",
  2143. e.Message, e.StackTrace);
  2144. }
  2145. }
  2146. }
  2147. }
  2148. public void TriggerMovingEndEvent(uint localID)
  2149. {
  2150. ScriptMovingEndEvent handlerScriptMovingEndEvent = OnScriptMovingEndEvent;
  2151. if (handlerScriptMovingEndEvent != null)
  2152. {
  2153. foreach (ScriptMovingEndEvent d in handlerScriptMovingEndEvent.GetInvocationList())
  2154. {
  2155. try
  2156. {
  2157. d(localID);
  2158. }
  2159. catch (Exception e)
  2160. {
  2161. m_log.ErrorFormat(
  2162. "[EVENT MANAGER]: Delegate for TriggerMovingEndEvent failed - continuing. {0} {1}",
  2163. e.Message, e.StackTrace);
  2164. }
  2165. }
  2166. }
  2167. }
  2168. public void TriggerRequestChangeWaterHeight(float height)
  2169. {
  2170. if (height < 0)
  2171. {
  2172. // ignore negative water height
  2173. return;
  2174. }
  2175. RequestChangeWaterHeight handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight;
  2176. if (handlerRequestChangeWaterHeight != null)
  2177. {
  2178. foreach (RequestChangeWaterHeight d in handlerRequestChangeWaterHeight.GetInvocationList())
  2179. {
  2180. try
  2181. {
  2182. d(height);
  2183. }
  2184. catch (Exception e)
  2185. {
  2186. m_log.ErrorFormat(
  2187. "[EVENT MANAGER]: Delegate for TriggerRequestChangeWaterHeight failed - continuing. {0} {1}",
  2188. e.Message, e.StackTrace);
  2189. }
  2190. }
  2191. }
  2192. }
  2193. public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar)
  2194. {
  2195. AvatarKillData handlerAvatarKill = OnAvatarKilled;
  2196. if (handlerAvatarKill != null)
  2197. {
  2198. foreach (AvatarKillData d in handlerAvatarKill.GetInvocationList())
  2199. {
  2200. try
  2201. {
  2202. d(KillerObjectLocalID, DeadAvatar);
  2203. }
  2204. catch (Exception e)
  2205. {
  2206. m_log.ErrorFormat(
  2207. "[EVENT MANAGER]: Delegate for TriggerAvatarKill failed - continuing. {0} {1}",
  2208. e.Message, e.StackTrace);
  2209. }
  2210. }
  2211. }
  2212. }
  2213. public void TriggerSignificantClientMovement(ScenePresence presence)
  2214. {
  2215. Action<ScenePresence> handlerSignificantClientMovement = OnSignificantClientMovement;
  2216. if (handlerSignificantClientMovement != null)
  2217. {
  2218. foreach (Action<ScenePresence> d in handlerSignificantClientMovement.GetInvocationList())
  2219. {
  2220. try
  2221. {
  2222. d(presence);
  2223. }
  2224. catch (Exception e)
  2225. {
  2226. m_log.ErrorFormat(
  2227. "[EVENT MANAGER]: Delegate for TriggerSignificantClientMovement failed - continuing. {0} {1}",
  2228. e.Message, e.StackTrace);
  2229. }
  2230. }
  2231. }
  2232. }
  2233. public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
  2234. {
  2235. ChatFromWorldEvent handlerChatFromWorld = OnChatFromWorld;
  2236. if (handlerChatFromWorld != null)
  2237. {
  2238. foreach (ChatFromWorldEvent d in handlerChatFromWorld.GetInvocationList())
  2239. {
  2240. try
  2241. {
  2242. d(sender, chat);
  2243. }
  2244. catch (Exception e)
  2245. {
  2246. m_log.ErrorFormat(
  2247. "[EVENT MANAGER]: Delegate for TriggerOnChatFromWorld failed - continuing. {0} {1}",
  2248. e.Message, e.StackTrace);
  2249. }
  2250. }
  2251. }
  2252. }
  2253. public void TriggerOnChatFromClient(Object sender, OSChatMessage chat)
  2254. {
  2255. ChatFromClientEvent handlerChatFromClient = OnChatFromClient;
  2256. if (handlerChatFromClient != null)
  2257. {
  2258. foreach (ChatFromClientEvent d in handlerChatFromClient.GetInvocationList())
  2259. {
  2260. try
  2261. {
  2262. d(sender, chat);
  2263. }
  2264. catch (Exception e)
  2265. {
  2266. m_log.ErrorFormat(
  2267. "[EVENT MANAGER]: Delegate for TriggerOnChatFromClient failed - continuing. {0} {1}",
  2268. e.Message, e.StackTrace);
  2269. }
  2270. }
  2271. }
  2272. }
  2273. public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
  2274. {
  2275. ChatBroadcastEvent handlerChatBroadcast = OnChatBroadcast;
  2276. if (handlerChatBroadcast != null)
  2277. {
  2278. foreach (ChatBroadcastEvent d in handlerChatBroadcast.GetInvocationList())
  2279. {
  2280. try
  2281. {
  2282. d(sender, chat);
  2283. }
  2284. catch (Exception e)
  2285. {
  2286. m_log.ErrorFormat(
  2287. "[EVENT MANAGER]: Delegate for TriggerOnChatBroadcast failed - continuing. {0} {1}",
  2288. e.Message, e.StackTrace);
  2289. }
  2290. }
  2291. }
  2292. }
  2293. internal void TriggerControlEvent(UUID scriptUUID, UUID avatarID, uint held, uint _changed)
  2294. {
  2295. ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent;
  2296. if (handlerScriptControlEvent != null)
  2297. {
  2298. foreach (ScriptControlEvent d in handlerScriptControlEvent.GetInvocationList())
  2299. {
  2300. try
  2301. {
  2302. d(scriptUUID, avatarID, held, _changed);
  2303. }
  2304. catch (Exception e)
  2305. {
  2306. m_log.ErrorFormat(
  2307. "[EVENT MANAGER]: Delegate for TriggerControlEvent failed - continuing. {0} {1}",
  2308. e.Message, e.StackTrace);
  2309. }
  2310. }
  2311. }
  2312. }
  2313. public void TriggerNoticeNoLandDataFromStorage()
  2314. {
  2315. NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage;
  2316. if (handlerNoticeNoLandDataFromStorage != null)
  2317. {
  2318. foreach (NoticeNoLandDataFromStorage d in handlerNoticeNoLandDataFromStorage.GetInvocationList())
  2319. {
  2320. try
  2321. {
  2322. d();
  2323. }
  2324. catch (Exception e)
  2325. {
  2326. m_log.ErrorFormat(
  2327. "[EVENT MANAGER]: Delegate for TriggerNoticeNoLandDataFromStorage failed - continuing. {0} {1}",
  2328. e.Message, e.StackTrace);
  2329. }
  2330. }
  2331. }
  2332. }
  2333. public void TriggerIncomingLandDataFromStorage(List<LandData> landData)
  2334. {
  2335. IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage;
  2336. if (handlerIncomingLandDataFromStorage != null)
  2337. {
  2338. foreach (IncomingLandDataFromStorage d in handlerIncomingLandDataFromStorage.GetInvocationList())
  2339. {
  2340. try
  2341. {
  2342. d(landData);
  2343. }
  2344. catch (Exception e)
  2345. {
  2346. m_log.ErrorFormat(
  2347. "[EVENT MANAGER]: Delegate for TriggerIncomingLandDataFromStorage failed - continuing. {0} {1}",
  2348. e.Message, e.StackTrace);
  2349. }
  2350. }
  2351. }
  2352. }
  2353. public void TriggerSetAllowForcefulBan(bool allow)
  2354. {
  2355. SetAllowForcefulBan handlerSetAllowForcefulBan = OnSetAllowForcefulBan;
  2356. if (handlerSetAllowForcefulBan != null)
  2357. {
  2358. foreach (SetAllowForcefulBan d in handlerSetAllowForcefulBan.GetInvocationList())
  2359. {
  2360. try
  2361. {
  2362. d(allow);
  2363. }
  2364. catch (Exception e)
  2365. {
  2366. m_log.ErrorFormat(
  2367. "[EVENT MANAGER]: Delegate for TriggerSetAllowForcefulBan failed - continuing. {0} {1}",
  2368. e.Message, e.StackTrace);
  2369. }
  2370. }
  2371. }
  2372. }
  2373. public void TriggerRequestParcelPrimCountUpdate()
  2374. {
  2375. RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate;
  2376. if (handlerRequestParcelPrimCountUpdate != null)
  2377. {
  2378. foreach (RequestParcelPrimCountUpdate d in handlerRequestParcelPrimCountUpdate.GetInvocationList())
  2379. {
  2380. try
  2381. {
  2382. d();
  2383. }
  2384. catch (Exception e)
  2385. {
  2386. m_log.ErrorFormat(
  2387. "[EVENT MANAGER]: Delegate for TriggerRequestParcelPrimCountUpdate failed - continuing. {0} {1}",
  2388. e.Message, e.StackTrace);
  2389. }
  2390. }
  2391. }
  2392. }
  2393. public void TriggerParcelPrimCountTainted()
  2394. {
  2395. ParcelPrimCountTainted handlerParcelPrimCountTainted = OnParcelPrimCountTainted;
  2396. if (handlerParcelPrimCountTainted != null)
  2397. {
  2398. foreach (ParcelPrimCountTainted d in handlerParcelPrimCountTainted.GetInvocationList())
  2399. {
  2400. try
  2401. {
  2402. d();
  2403. }
  2404. catch (Exception e)
  2405. {
  2406. m_log.ErrorFormat(
  2407. "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountTainted failed - continuing. {0} {1}",
  2408. e.Message, e.StackTrace);
  2409. }
  2410. }
  2411. }
  2412. }
  2413. /// <summary>
  2414. /// this lets us keep track of nasty script events like timer, etc.
  2415. /// </summary>
  2416. /// <param name="objLocalID"></param>
  2417. /// <param name="Interval"></param>
  2418. public void TriggerTimerEvent(uint objLocalID, double Interval)
  2419. {
  2420. 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");
  2421. //handlerScriptTimerEvent = OnScriptTimerEvent;
  2422. //if (handlerScriptTimerEvent != null)
  2423. //{
  2424. // handlerScriptTimerEvent(objLocalID, Interval);
  2425. //}
  2426. }
  2427. /// <summary>
  2428. /// Called when the sun's position parameters have changed in the Region and/or Estate
  2429. /// </summary>
  2430. /// <param name="regionHandle">The region that changed</param>
  2431. public void TriggerEstateToolsSunUpdate(ulong regionHandle)
  2432. {
  2433. EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate;
  2434. if (handlerEstateToolsSunUpdate != null)
  2435. {
  2436. foreach (EstateToolsSunUpdate d in handlerEstateToolsSunUpdate.GetInvocationList())
  2437. {
  2438. try
  2439. {
  2440. d(regionHandle);
  2441. }
  2442. catch (Exception e)
  2443. {
  2444. m_log.ErrorFormat(
  2445. "[EVENT MANAGER]: Delegate for TriggerEstateToolsSunUpdate failed - continuing. {0} {1}",
  2446. e.Message, e.StackTrace);
  2447. }
  2448. }
  2449. }
  2450. }
  2451. public float GetCurrentTimeAsSunLindenHour()
  2452. {
  2453. SunLindenHour handlerCurrentTimeAsLindenSunHour = OnGetCurrentTimeAsLindenSunHour;
  2454. if (handlerCurrentTimeAsLindenSunHour != null)
  2455. {
  2456. foreach (SunLindenHour d in handlerCurrentTimeAsLindenSunHour.GetInvocationList())
  2457. {
  2458. try
  2459. {
  2460. return d();
  2461. }
  2462. catch (Exception e)
  2463. {
  2464. m_log.ErrorFormat(
  2465. "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
  2466. e.Message, e.StackTrace);
  2467. }
  2468. }
  2469. }
  2470. return 6;
  2471. }
  2472. public void TriggerOarFileLoaded(Guid requestId, List<UUID> loadedScenes, string message)
  2473. {
  2474. OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded;
  2475. if (handlerOarFileLoaded != null)
  2476. {
  2477. foreach (OarFileLoaded d in handlerOarFileLoaded.GetInvocationList())
  2478. {
  2479. try
  2480. {
  2481. d(requestId, loadedScenes, message);
  2482. }
  2483. catch (Exception e)
  2484. {
  2485. m_log.ErrorFormat(
  2486. "[EVENT MANAGER]: Delegate for TriggerOarFileLoaded failed - continuing. {0} {1}",
  2487. e.Message, e.StackTrace);
  2488. }
  2489. }
  2490. }
  2491. }
  2492. public void TriggerOarFileSaved(Guid requestId, string message)
  2493. {
  2494. OarFileSaved handlerOarFileSaved = OnOarFileSaved;
  2495. if (handlerOarFileSaved != null)
  2496. {
  2497. foreach (OarFileSaved d in handlerOarFileSaved.GetInvocationList())
  2498. {
  2499. try
  2500. {
  2501. d(requestId, message);
  2502. }
  2503. catch (Exception e)
  2504. {
  2505. m_log.ErrorFormat(
  2506. "[EVENT MANAGER]: Delegate for TriggerOarFileSaved failed - continuing. {0} {1}",
  2507. e.Message, e.StackTrace);
  2508. }
  2509. }
  2510. }
  2511. }
  2512. public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message)
  2513. {
  2514. EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = OnEmptyScriptCompileQueue;
  2515. if (handlerEmptyScriptCompileQueue != null)
  2516. {
  2517. foreach (EmptyScriptCompileQueue d in handlerEmptyScriptCompileQueue.GetInvocationList())
  2518. {
  2519. try
  2520. {
  2521. d(numScriptsFailed, message);
  2522. }
  2523. catch (Exception e)
  2524. {
  2525. m_log.ErrorFormat(
  2526. "[EVENT MANAGER]: Delegate for TriggerEmptyScriptCompileQueue failed - continuing. {0} {1}",
  2527. e.Message, e.StackTrace);
  2528. }
  2529. }
  2530. }
  2531. }
  2532. public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders)
  2533. {
  2534. ScriptColliding handlerCollidingStart = OnScriptColliderStart;
  2535. if (handlerCollidingStart != null)
  2536. {
  2537. foreach (ScriptColliding d in handlerCollidingStart.GetInvocationList())
  2538. {
  2539. try
  2540. {
  2541. d(localId, colliders);
  2542. }
  2543. catch (Exception e)
  2544. {
  2545. m_log.ErrorFormat(
  2546. "[EVENT MANAGER]: Delegate for TriggerScriptCollidingStart failed - continuing. {0} {1}",
  2547. e.Message, e.StackTrace);
  2548. }
  2549. }
  2550. }
  2551. }
  2552. public void TriggerScriptColliding(uint localId, ColliderArgs colliders)
  2553. {
  2554. ScriptColliding handlerColliding = OnScriptColliding;
  2555. if (handlerColliding != null)
  2556. {
  2557. foreach (ScriptColliding d in handlerColliding.GetInvocationList())
  2558. {
  2559. try
  2560. {
  2561. d(localId, colliders);
  2562. }
  2563. catch (Exception e)
  2564. {
  2565. m_log.ErrorFormat(
  2566. "[EVENT MANAGER]: Delegate for TriggerScriptColliding failed - continuing. {0} {1}",
  2567. e.Message, e.StackTrace);
  2568. }
  2569. }
  2570. }
  2571. }
  2572. public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders)
  2573. {
  2574. ScriptColliding handlerCollidingEnd = OnScriptCollidingEnd;
  2575. if (handlerCollidingEnd != null)
  2576. {
  2577. foreach (ScriptColliding d in handlerCollidingEnd.GetInvocationList())
  2578. {
  2579. try
  2580. {
  2581. d(localId, colliders);
  2582. }
  2583. catch (Exception e)
  2584. {
  2585. m_log.ErrorFormat(
  2586. "[EVENT MANAGER]: Delegate for TriggerScriptCollidingEnd failed - continuing. {0} {1}",
  2587. e.Message, e.StackTrace);
  2588. }
  2589. }
  2590. }
  2591. }
  2592. public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders)
  2593. {
  2594. ScriptColliding handlerLandCollidingStart = OnScriptLandColliderStart;
  2595. if (handlerLandCollidingStart != null)
  2596. {
  2597. foreach (ScriptColliding d in handlerLandCollidingStart.GetInvocationList())
  2598. {
  2599. try
  2600. {
  2601. d(localId, colliders);
  2602. }
  2603. catch (Exception e)
  2604. {
  2605. m_log.ErrorFormat(
  2606. "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingStart failed - continuing. {0} {1}",
  2607. e.Message, e.StackTrace);
  2608. }
  2609. }
  2610. }
  2611. }
  2612. public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders)
  2613. {
  2614. ScriptColliding handlerLandColliding = OnScriptLandColliding;
  2615. if (handlerLandColliding != null)
  2616. {
  2617. foreach (ScriptColliding d in handlerLandColliding.GetInvocationList())
  2618. {
  2619. try
  2620. {
  2621. d(localId, colliders);
  2622. }
  2623. catch (Exception e)
  2624. {
  2625. m_log.ErrorFormat(
  2626. "[EVENT MANAGER]: Delegate for TriggerScriptLandColliding failed - continuing. {0} {1}",
  2627. e.Message, e.StackTrace);
  2628. }
  2629. }
  2630. }
  2631. }
  2632. public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders)
  2633. {
  2634. ScriptColliding handlerLandCollidingEnd = OnScriptLandColliderEnd;
  2635. if (handlerLandCollidingEnd != null)
  2636. {
  2637. foreach (ScriptColliding d in handlerLandCollidingEnd.GetInvocationList())
  2638. {
  2639. try
  2640. {
  2641. d(localId, colliders);
  2642. }
  2643. catch (Exception e)
  2644. {
  2645. m_log.ErrorFormat(
  2646. "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingEnd failed - continuing. {0} {1}",
  2647. e.Message, e.StackTrace);
  2648. }
  2649. }
  2650. }
  2651. }
  2652. public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
  2653. {
  2654. OnSetRootAgentSceneDelegate handlerSetRootAgentScene = OnSetRootAgentScene;
  2655. if (handlerSetRootAgentScene != null)
  2656. {
  2657. foreach (OnSetRootAgentSceneDelegate d in handlerSetRootAgentScene.GetInvocationList())
  2658. {
  2659. try
  2660. {
  2661. d(agentID, scene);
  2662. }
  2663. catch (Exception e)
  2664. {
  2665. m_log.ErrorFormat(
  2666. "[EVENT MANAGER]: Delegate for TriggerSetRootAgentScene failed - continuing. {0} {1}",
  2667. e.Message, e.StackTrace);
  2668. }
  2669. }
  2670. }
  2671. }
  2672. public void TriggerOnRegionUp(GridRegion otherRegion)
  2673. {
  2674. RegionUp handlerOnRegionUp = OnRegionUp;
  2675. if (handlerOnRegionUp != null)
  2676. {
  2677. foreach (RegionUp d in handlerOnRegionUp.GetInvocationList())
  2678. {
  2679. try
  2680. {
  2681. d(otherRegion);
  2682. }
  2683. catch (Exception e)
  2684. {
  2685. m_log.ErrorFormat(
  2686. "[EVENT MANAGER]: Delegate for TriggerOnRegionUp failed - continuing. {0} {1}",
  2687. e.Message, e.StackTrace);
  2688. }
  2689. }
  2690. }
  2691. }
  2692. public void TriggerOnSceneObjectLoaded(SceneObjectGroup so)
  2693. {
  2694. SceneObjectDelegate handler = OnSceneObjectLoaded;
  2695. if (handler != null)
  2696. {
  2697. foreach (SceneObjectDelegate d in handler.GetInvocationList())
  2698. {
  2699. try
  2700. {
  2701. d(so);
  2702. }
  2703. catch (Exception e)
  2704. {
  2705. m_log.ErrorFormat(
  2706. "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectLoaded failed - continuing. {0} {1}",
  2707. e.Message, e.StackTrace);
  2708. }
  2709. }
  2710. }
  2711. }
  2712. public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo)
  2713. {
  2714. SceneObjectPreSaveDelegate handler = OnSceneObjectPreSave;
  2715. if (handler != null)
  2716. {
  2717. foreach (SceneObjectPreSaveDelegate d in handler.GetInvocationList())
  2718. {
  2719. try
  2720. {
  2721. d(persistingSo, originalSo);
  2722. }
  2723. catch (Exception e)
  2724. {
  2725. m_log.ErrorFormat(
  2726. "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPreSave failed - continuing. {0} {1}",
  2727. e.Message, e.StackTrace);
  2728. }
  2729. }
  2730. }
  2731. }
  2732. public void TriggerOnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed)
  2733. {
  2734. SceneObjectPartCopyDelegate handler = OnSceneObjectPartCopy;
  2735. if (handler != null)
  2736. {
  2737. foreach (SceneObjectPartCopyDelegate d in handler.GetInvocationList())
  2738. {
  2739. try
  2740. {
  2741. d(copy, original, userExposed);
  2742. }
  2743. catch (Exception e)
  2744. {
  2745. m_log.ErrorFormat(
  2746. "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}",
  2747. e.Message, e.StackTrace);
  2748. }
  2749. }
  2750. }
  2751. }
  2752. public void TriggerSceneObjectPartUpdated(SceneObjectPart sop, bool full)
  2753. {
  2754. SceneObjectPartUpdated handler = OnSceneObjectPartUpdated;
  2755. if (handler != null)
  2756. {
  2757. foreach (SceneObjectPartUpdated d in handler.GetInvocationList())
  2758. {
  2759. try
  2760. {
  2761. d(sop, full);
  2762. }
  2763. catch (Exception e)
  2764. {
  2765. m_log.ErrorFormat(
  2766. "[EVENT MANAGER]: Delegate for TriggerSceneObjectPartUpdated failed - continuing. {0} {1}",
  2767. e.Message, e.StackTrace);
  2768. }
  2769. }
  2770. }
  2771. }
  2772. public void TriggerScenePresenceUpdated(ScenePresence sp)
  2773. {
  2774. ScenePresenceUpdated handler = OnScenePresenceUpdated;
  2775. if (handler != null)
  2776. {
  2777. foreach (ScenePresenceUpdated d in handler.GetInvocationList())
  2778. {
  2779. try
  2780. {
  2781. d(sp);
  2782. }
  2783. catch (Exception e)
  2784. {
  2785. m_log.ErrorFormat(
  2786. "[EVENT MANAGER]: Delegate for TriggerScenePresenceUpdated failed - continuing. {0} {1}",
  2787. e.Message, e.StackTrace);
  2788. }
  2789. }
  2790. }
  2791. }
  2792. public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
  2793. int local_id, IClientAPI remote_client)
  2794. {
  2795. ParcelPropertiesUpdateRequest handler = OnParcelPropertiesUpdateRequest;
  2796. if (handler != null)
  2797. {
  2798. foreach (ParcelPropertiesUpdateRequest d in handler.GetInvocationList())
  2799. {
  2800. try
  2801. {
  2802. d(args, local_id, remote_client);
  2803. }
  2804. catch (Exception e)
  2805. {
  2806. m_log.ErrorFormat(
  2807. "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}",
  2808. e.Message, e.StackTrace);
  2809. }
  2810. }
  2811. }
  2812. }
  2813. public void TriggerSceneShuttingDown(Scene s)
  2814. {
  2815. Action<Scene> handler = OnSceneShuttingDown;
  2816. if (handler != null)
  2817. {
  2818. foreach (Action<Scene> d in handler.GetInvocationList())
  2819. {
  2820. m_log.InfoFormat("[EVENT MANAGER]: TriggerSceneShuttingDown invoke {0}", d.Method.Name.ToString());
  2821. try
  2822. {
  2823. d(s);
  2824. }
  2825. catch (Exception e)
  2826. {
  2827. m_log.ErrorFormat(
  2828. "[EVENT MANAGER]: Delegate for TriggerSceneShuttingDown failed - continuing. {0} {1}",
  2829. e.Message, e.StackTrace);
  2830. }
  2831. }
  2832. }
  2833. m_log.Info("[EVENT MANAGER]: TriggerSceneShuttingDown done");
  2834. }
  2835. public void TriggerOnRegionStarted(Scene scene)
  2836. {
  2837. RegionStarted handler = OnRegionStarted;
  2838. if (handler != null)
  2839. {
  2840. foreach (RegionStarted d in handler.GetInvocationList())
  2841. {
  2842. try
  2843. {
  2844. d(scene);
  2845. }
  2846. catch (Exception e)
  2847. {
  2848. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for RegionStarted failed - continuing {0} - {1}",
  2849. e.Message, e.StackTrace);
  2850. }
  2851. }
  2852. }
  2853. }
  2854. public void TriggerRegionHeartbeatStart(Scene scene)
  2855. {
  2856. RegionHeartbeatStart handler = OnRegionHeartbeatStart;
  2857. if (handler != null)
  2858. {
  2859. foreach (RegionHeartbeatStart d in handler.GetInvocationList())
  2860. {
  2861. try
  2862. {
  2863. d(scene);
  2864. }
  2865. catch (Exception e)
  2866. {
  2867. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatStart failed - continuing {0} - {1}",
  2868. e.Message, e.StackTrace);
  2869. }
  2870. }
  2871. }
  2872. }
  2873. public void TriggerRegionHeartbeatEnd(Scene scene)
  2874. {
  2875. RegionHeartbeatEnd handler = OnRegionHeartbeatEnd;
  2876. if (handler != null)
  2877. {
  2878. foreach (RegionHeartbeatEnd d in handler.GetInvocationList())
  2879. {
  2880. try
  2881. {
  2882. d(scene);
  2883. }
  2884. catch (Exception e)
  2885. {
  2886. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatEnd failed - continuing {0} - {1}",
  2887. e.Message, e.StackTrace);
  2888. }
  2889. }
  2890. }
  2891. }
  2892. public void TriggerRegionLoginsStatusChange(IScene scene)
  2893. {
  2894. RegionLoginsStatusChange handler = OnRegionLoginsStatusChange;
  2895. if (handler != null)
  2896. {
  2897. foreach (RegionLoginsStatusChange d in handler.GetInvocationList())
  2898. {
  2899. try
  2900. {
  2901. d(scene);
  2902. }
  2903. catch (Exception e)
  2904. {
  2905. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionLoginsStatusChange failed - continuing {0} - {1}",
  2906. e.Message, e.StackTrace);
  2907. }
  2908. }
  2909. }
  2910. }
  2911. public void TriggerRegionReadyStatusChange(IScene scene)
  2912. {
  2913. Action<IScene> handler = OnRegionReadyStatusChange;
  2914. if (handler != null)
  2915. {
  2916. foreach (Action<IScene> d in handler.GetInvocationList())
  2917. {
  2918. try
  2919. {
  2920. d(scene);
  2921. }
  2922. catch (Exception e)
  2923. {
  2924. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReadyStatusChange failed - continuing {0} - {1}",
  2925. e.Message, e.StackTrace);
  2926. }
  2927. }
  2928. }
  2929. }
  2930. public void TriggerPrimsLoaded(Scene s)
  2931. {
  2932. PrimsLoaded handler = OnPrimsLoaded;
  2933. if (handler != null)
  2934. {
  2935. foreach (PrimsLoaded d in handler.GetInvocationList())
  2936. {
  2937. try
  2938. {
  2939. d(s);
  2940. }
  2941. catch (Exception e)
  2942. {
  2943. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for PrimsLoaded failed - continuing {0} - {1}",
  2944. e.Message, e.StackTrace);
  2945. }
  2946. }
  2947. }
  2948. }
  2949. public void TriggerTeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout)
  2950. {
  2951. TeleportStart handler = OnTeleportStart;
  2952. if (handler != null)
  2953. {
  2954. foreach (TeleportStart d in handler.GetInvocationList())
  2955. {
  2956. try
  2957. {
  2958. d(client, destination, finalDestination, teleportFlags, gridLogout);
  2959. }
  2960. catch (Exception e)
  2961. {
  2962. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TeleportStart failed - continuing {0} - {1}",
  2963. e.Message, e.StackTrace);
  2964. }
  2965. }
  2966. }
  2967. }
  2968. public void TriggerTeleportFail(IClientAPI client, bool gridLogout)
  2969. {
  2970. TeleportFail handler = OnTeleportFail;
  2971. if (handler != null)
  2972. {
  2973. foreach (TeleportFail d in handler.GetInvocationList())
  2974. {
  2975. try
  2976. {
  2977. d(client, gridLogout);
  2978. }
  2979. catch (Exception e)
  2980. {
  2981. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TeleportFail failed - continuing {0} - {1}",
  2982. e.Message, e.StackTrace);
  2983. }
  2984. }
  2985. }
  2986. }
  2987. public delegate void ExtraSettingChangedDelegate(Scene scene, string name, string value);
  2988. public event ExtraSettingChangedDelegate OnExtraSettingChanged;
  2989. public void TriggerExtraSettingChanged(Scene scene, string name, string val)
  2990. {
  2991. ExtraSettingChangedDelegate handler = OnExtraSettingChanged;
  2992. if (handler != null)
  2993. {
  2994. foreach (ExtraSettingChangedDelegate d in handler.GetInvocationList())
  2995. {
  2996. try
  2997. {
  2998. d(scene, name, val);
  2999. }
  3000. catch (Exception e)
  3001. {
  3002. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for ExtraSettingChanged failed - continuing {0} - {1}",
  3003. e.Message, e.StackTrace);
  3004. }
  3005. }
  3006. }
  3007. }
  3008. public void TriggerThrottleUpdate(ScenePresence scenePresence)
  3009. {
  3010. OnThrottleUpdate?.Invoke(scenePresence);
  3011. }
  3012. // public void TriggerGatherUuids(SceneObjectPart sop, IDictionary<UUID, AssetType> assetUuids)
  3013. // {
  3014. // GatherUuids handler = OnGatherUuids;
  3015. //
  3016. // if (handler != null)
  3017. // {
  3018. // foreach (GatherUuids d in handler.GetInvocationList())
  3019. // {
  3020. // try
  3021. // {
  3022. // d(sop, assetUuids);
  3023. // }
  3024. // catch (Exception e)
  3025. // {
  3026. // m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TriggerUuidGather failed - continuing {0} - {1}",
  3027. // e.Message, e.StackTrace);
  3028. // }
  3029. // }
  3030. // }
  3031. // }
  3032. public delegate void ScriptListen(UUID scriptID, int channel, string name, UUID id, string message);
  3033. public event ScriptListen OnScriptListenEvent;
  3034. public void TriggerScriptListen(UUID scriptID, int channel, string name, UUID id, string message)
  3035. {
  3036. OnScriptListenEvent?.Invoke(scriptID, channel, name, id, message);
  3037. }
  3038. }
  3039. }