EventManager.cs 129 KB

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