EventManager.cs 131 KB

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