EventManager.cs 130 KB

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