EventManager.cs 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
  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 OpenMetaverse;
  30. using OpenSim.Framework;
  31. using OpenSim.Framework.Client;
  32. using OpenSim.Region.Framework.Interfaces;
  33. using Caps=OpenSim.Framework.Capabilities.Caps;
  34. namespace OpenSim.Region.Framework.Scenes
  35. {
  36. /// <summary>
  37. /// A class for triggering remote scene events.
  38. /// </summary>
  39. public class EventManager
  40. {
  41. public delegate void OnFrameDelegate();
  42. public event OnFrameDelegate OnFrame;
  43. public delegate void ClientMovement(ScenePresence client);
  44. public event ClientMovement OnClientMovement;
  45. public delegate void OnTerrainTickDelegate();
  46. public event OnTerrainTickDelegate OnTerrainTick;
  47. public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup);
  48. public event OnBackupDelegate OnBackup;
  49. public delegate void OnClientConnectCoreDelegate(IClientCore client);
  50. public event OnClientConnectCoreDelegate OnClientConnect;
  51. public delegate void OnNewClientDelegate(IClientAPI client);
  52. /// <summary>
  53. /// Depreciated in favour of OnClientConnect.
  54. /// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces.
  55. /// </summary>
  56. public event OnNewClientDelegate OnNewClient;
  57. public delegate void OnNewPresenceDelegate(ScenePresence presence);
  58. public event OnNewPresenceDelegate OnNewPresence;
  59. public delegate void OnRemovePresenceDelegate(UUID agentId);
  60. public event OnRemovePresenceDelegate OnRemovePresence;
  61. public delegate void OnParcelPrimCountUpdateDelegate();
  62. public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
  63. public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
  64. public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
  65. public delegate void OnPluginConsoleDelegate(string[] args);
  66. public event OnPluginConsoleDelegate OnPluginConsole;
  67. public delegate void OnShutdownDelegate();
  68. public event OnShutdownDelegate OnShutdown;
  69. public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
  70. public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
  71. public delegate void ScriptResetDelegate(uint localID, UUID itemID);
  72. public delegate void OnPermissionErrorDelegate(UUID user, string reason);
  73. public delegate void OnSetRootAgentSceneDelegate(UUID agentID, Scene scene);
  74. public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
  75. public event ObjectGrabDelegate OnObjectGrab;
  76. public event ObjectDeGrabDelegate OnObjectDeGrab;
  77. public event ScriptResetDelegate OnScriptReset;
  78. public event OnPermissionErrorDelegate OnPermissionError;
  79. public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
  80. public event NewRezScript OnRezScript;
  81. public delegate void RemoveScript(uint localID, UUID itemID);
  82. public event RemoveScript OnRemoveScript;
  83. public delegate void StartScript(uint localID, UUID itemID);
  84. public event StartScript OnStartScript;
  85. public delegate void StopScript(uint localID, UUID itemID);
  86. public event StopScript OnStopScript;
  87. public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta);
  88. public event SceneGroupMoved OnSceneGroupMove;
  89. public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID);
  90. public event SceneGroupGrabed OnSceneGroupGrab;
  91. public delegate bool SceneGroupSpinStarted(UUID groupID);
  92. public event SceneGroupSpinStarted OnSceneGroupSpinStart;
  93. public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation);
  94. public event SceneGroupSpun OnSceneGroupSpin;
  95. public delegate void LandObjectAdded(ILandObject newParcel);
  96. public event LandObjectAdded OnLandObjectAdded;
  97. public delegate void LandObjectRemoved(UUID globalID);
  98. public event LandObjectRemoved OnLandObjectRemoved;
  99. public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID);
  100. public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
  101. public delegate void SignificantClientMovement(IClientAPI remote_client);
  102. public event SignificantClientMovement OnSignificantClientMovement;
  103. public delegate void IncomingInstantMessage(GridInstantMessage message);
  104. public event IncomingInstantMessage OnIncomingInstantMessage;
  105. public event IncomingInstantMessage OnUnhandledInstantMessage;
  106. public delegate void ClientClosed(UUID clientID, Scene scene);
  107. public event ClientClosed OnClientClosed;
  108. public delegate void ScriptChangedEvent(uint localID, uint change);
  109. public event ScriptChangedEvent OnScriptChangedEvent;
  110. public delegate void ScriptControlEvent(uint localID, UUID item, UUID avatarID, uint held, uint changed);
  111. public event ScriptControlEvent OnScriptControlEvent;
  112. public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
  113. public event ScriptAtTargetEvent OnScriptAtTargetEvent;
  114. public delegate void ScriptNotAtTargetEvent(uint localID);
  115. public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
  116. public delegate void ScriptColliding(uint localID, ColliderArgs colliders);
  117. public event ScriptColliding OnScriptColliderStart;
  118. public event ScriptColliding OnScriptColliding;
  119. public event ScriptColliding OnScriptCollidingEnd;
  120. public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
  121. public event OnMakeChildAgentDelegate OnMakeChildAgent;
  122. public delegate void OnMakeRootAgentDelegate(ScenePresence presence);
  123. public event OnMakeRootAgentDelegate OnMakeRootAgent;
  124. public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel);
  125. public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete;
  126. public delegate void RequestChangeWaterHeight(float height);
  127. public event RequestChangeWaterHeight OnRequestChangeWaterHeight;
  128. public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar);
  129. public event AvatarKillData OnAvatarKilled;
  130. public delegate void ScriptTimerEvent(uint localID, double timerinterval);
  131. public event ScriptTimerEvent OnScriptTimerEvent;
  132. public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour);
  133. public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
  134. public event EstateToolsSunUpdate OnEstateToolsSunUpdate;
  135. public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
  136. public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
  137. public delegate void NoticeNoLandDataFromStorage();
  138. public event NoticeNoLandDataFromStorage OnNoticeNoLandDataFromStorage;
  139. public delegate void IncomingLandDataFromStorage(List<LandData> data);
  140. public event IncomingLandDataFromStorage OnIncomingLandDataFromStorage;
  141. public delegate void SetAllowForcefulBan(bool allow);
  142. public event SetAllowForcefulBan OnSetAllowForcefulBan;
  143. public delegate void RequestParcelPrimCountUpdate();
  144. public event RequestParcelPrimCountUpdate OnRequestParcelPrimCountUpdate;
  145. public delegate void ParcelPrimCountTainted();
  146. public event ParcelPrimCountTainted OnParcelPrimCountTainted;
  147. public event GetScriptRunning OnGetScriptRunning;
  148. /// <summary>
  149. /// RegisterCapsEvent is called by Scene after the Caps object
  150. /// has been instantiated and before it is return to the
  151. /// client and provides region modules to add their caps.
  152. /// </summary>
  153. public delegate void RegisterCapsEvent(UUID agentID, Caps caps);
  154. public event RegisterCapsEvent OnRegisterCaps;
  155. /// <summary>
  156. /// DeregisterCapsEvent is called by Scene when the caps
  157. /// handler for an agent are removed.
  158. /// </summary>
  159. public delegate void DeregisterCapsEvent(UUID agentID, Caps caps);
  160. public event DeregisterCapsEvent OnDeregisterCaps;
  161. /// <summary>
  162. /// ChatFromWorldEvent is called via Scene when a chat message
  163. /// from world comes in.
  164. /// </summary>
  165. public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat);
  166. public event ChatFromWorldEvent OnChatFromWorld;
  167. /// <summary>
  168. /// ChatFromClientEvent is triggered via ChatModule (or
  169. /// substitutes thereof) when a chat message
  170. /// from the client comes in.
  171. /// </summary>
  172. public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat);
  173. public event ChatFromClientEvent OnChatFromClient;
  174. /// <summary>
  175. /// ChatBroadcastEvent is called via Scene when a broadcast chat message
  176. /// from world comes in
  177. /// </summary>
  178. public delegate void ChatBroadcastEvent(Object sender, OSChatMessage chat);
  179. public event ChatBroadcastEvent OnChatBroadcast;
  180. public delegate float SunLindenHour();
  181. public event SunLindenHour OnGetCurrentTimeAsLindenSunHour;
  182. /// <summary>
  183. /// Called when oar file has finished loading, although
  184. /// the scripts may not have started yet
  185. /// Message is non empty string if there were problems loading the oar file
  186. /// </summary>
  187. public delegate void OarFileLoaded(Guid guid, string message);
  188. public event OarFileLoaded OnOarFileLoaded;
  189. /// <summary>
  190. /// Called when an oar file has finished saving
  191. /// Message is non empty string if there were problems saving the oar file
  192. /// If a guid was supplied on the original call to identify, the request, this is returned. Otherwise
  193. /// Guid.Empty is returned.
  194. /// </summary>
  195. public delegate void OarFileSaved(Guid guid, string message);
  196. public event OarFileSaved OnOarFileSaved;
  197. /// <summary>
  198. /// Called when the script compile queue becomes empty
  199. /// Returns the number of scripts which failed to start
  200. /// </summary>
  201. public delegate void EmptyScriptCompileQueue(int numScriptsFailed, string message);
  202. public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue;
  203. public class MoneyTransferArgs : EventArgs
  204. {
  205. public UUID sender;
  206. public UUID receiver;
  207. // Always false. The SL protocol sucks.
  208. public bool authenticated = false;
  209. public int amount;
  210. public int transactiontype;
  211. public string description;
  212. public MoneyTransferArgs(UUID asender, UUID areceiver, int aamount, int atransactiontype, string adescription)
  213. {
  214. sender = asender;
  215. receiver = areceiver;
  216. amount = aamount;
  217. transactiontype = atransactiontype;
  218. description = adescription;
  219. }
  220. }
  221. public class LandBuyArgs : EventArgs
  222. {
  223. public UUID agentId = UUID.Zero;
  224. public UUID groupId = UUID.Zero;
  225. public UUID parcelOwnerID = UUID.Zero;
  226. public bool final = false;
  227. public bool groupOwned = false;
  228. public bool removeContribution = false;
  229. public int parcelLocalID = 0;
  230. public int parcelArea = 0;
  231. public int parcelPrice = 0;
  232. public bool authenticated = false;
  233. public bool landValidated = false;
  234. public bool economyValidated = false;
  235. public int transactionID = 0;
  236. public int amountDebited = 0;
  237. public LandBuyArgs(UUID pagentId, UUID pgroupId, bool pfinal, bool pgroupOwned,
  238. bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice,
  239. bool pauthenticated)
  240. {
  241. agentId = pagentId;
  242. groupId = pgroupId;
  243. final = pfinal;
  244. groupOwned = pgroupOwned;
  245. removeContribution = premoveContribution;
  246. parcelLocalID = pparcelLocalID;
  247. parcelArea = pparcelArea;
  248. parcelPrice = pparcelPrice;
  249. authenticated = pauthenticated;
  250. }
  251. }
  252. public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e);
  253. public delegate void LandBuy(Object sender, LandBuyArgs e);
  254. public event MoneyTransferEvent OnMoneyTransfer;
  255. public event LandBuy OnLandBuy;
  256. public event LandBuy OnValidateLandBuy;
  257. /* Designated Event Deletage Instances */
  258. private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent;
  259. private ScriptAtTargetEvent handlerScriptAtTargetEvent = null;
  260. private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null;
  261. private ClientMovement handlerClientMovement = null; //OnClientMovement;
  262. private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError;
  263. private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole;
  264. private OnFrameDelegate handlerFrame = null; //OnFrame;
  265. private OnNewClientDelegate handlerNewClient = null; //OnNewClient;
  266. private OnClientConnectCoreDelegate handlerClientConnect = null; //OnClientConnect
  267. private OnNewPresenceDelegate handlerNewPresence = null; //OnNewPresence;
  268. private OnRemovePresenceDelegate handlerRemovePresence = null; //OnRemovePresence;
  269. private OnBackupDelegate handlerBackup = null; //OnBackup;
  270. private OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = null; //OnParcelPrimCountUpdate;
  271. private MoneyTransferEvent handlerMoneyTransfer = null; //OnMoneyTransfer;
  272. private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd;
  273. private OnShutdownDelegate handlerShutdown = null; //OnShutdown;
  274. private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab;
  275. private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab;
  276. private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset
  277. private NewRezScript handlerRezScript = null; //OnRezScript;
  278. private RemoveScript handlerRemoveScript = null; //OnRemoveScript;
  279. private StartScript handlerStartScript = null; //OnStartScript;
  280. private StopScript handlerStopScript = null; //OnStopScript;
  281. private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove;
  282. private SceneGroupGrabed handlerSceneGroupGrab = null; //OnSceneGroupGrab;
  283. private SceneGroupSpinStarted handlerSceneGroupSpinStarted = null; //OnSceneGroupSpinStart;
  284. private SceneGroupSpun handlerSceneGroupSpin = null; //OnSceneGroupSpin;
  285. private LandObjectAdded handlerLandObjectAdded = null; //OnLandObjectAdded;
  286. private LandObjectRemoved handlerLandObjectRemoved = null; //OnLandObjectRemoved;
  287. private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = null; //OnAvatarEnteringNewParcel;
  288. private IncomingInstantMessage handlerIncomingInstantMessage = null; //OnIncomingInstantMessage;
  289. private IncomingInstantMessage handlerUnhandledInstantMessage = null; //OnUnhandledInstantMessage;
  290. private ClientClosed handlerClientClosed = null; //OnClientClosed;
  291. private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent;
  292. private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent;
  293. private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick;
  294. private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps;
  295. private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps;
  296. private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld;
  297. private ChatFromClientEvent handlerChatFromClient = null; // OnChatFromClient;
  298. private ChatBroadcastEvent handlerChatBroadcast = null; // OnChatBroadcast;
  299. private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null;
  300. private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight
  301. private ScriptControlEvent handlerScriptControlEvent = null;
  302. private SignificantClientMovement handlerSignificantClientMovement = null;
  303. private LandBuy handlerLandBuy = null;
  304. private LandBuy handlerValidateLandBuy = null;
  305. private AvatarKillData handlerAvatarKill = null;
  306. private NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = null;
  307. private IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = null;
  308. private SetAllowForcefulBan handlerSetAllowForcefulBan = null;
  309. private RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = null;
  310. private ParcelPrimCountTainted handlerParcelPrimCountTainted = null;
  311. private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null;
  312. private ScriptTimerEvent handlerScriptTimerEvent = null;
  313. private EstateToolsSunUpdate handlerEstateToolsSunUpdate = null;
  314. private ScriptColliding handlerCollidingStart = null;
  315. private ScriptColliding handlerColliding = null;
  316. private ScriptColliding handlerCollidingEnd = null;
  317. private GetScriptRunning handlerGetScriptRunning = null;
  318. private SunLindenHour handlerCurrentTimeAsLindenSunHour = null;
  319. private OnSetRootAgentSceneDelegate handlerSetRootAgentScene = null;
  320. private OarFileLoaded handlerOarFileLoaded = null;
  321. private OarFileSaved handlerOarFileSaved = null;
  322. private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null;
  323. public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
  324. {
  325. handlerGetScriptRunning = OnGetScriptRunning;
  326. if (handlerGetScriptRunning != null)
  327. handlerGetScriptRunning(controllingClient, objectID, itemID);
  328. }
  329. public void TriggerOnScriptChangedEvent(uint localID, uint change)
  330. {
  331. handlerScriptChangedEvent = OnScriptChangedEvent;
  332. if (handlerScriptChangedEvent != null)
  333. handlerScriptChangedEvent(localID, change);
  334. }
  335. public void TriggerOnClientMovement(ScenePresence avatar)
  336. {
  337. handlerClientMovement = OnClientMovement;
  338. if (handlerClientMovement != null)
  339. handlerClientMovement(avatar);
  340. }
  341. public void TriggerPermissionError(UUID user, string reason)
  342. {
  343. handlerPermissionError = OnPermissionError;
  344. if (handlerPermissionError != null)
  345. handlerPermissionError(user, reason);
  346. }
  347. public void TriggerOnPluginConsole(string[] args)
  348. {
  349. handlerPluginConsole = OnPluginConsole;
  350. if (handlerPluginConsole != null)
  351. handlerPluginConsole(args);
  352. }
  353. public void TriggerOnFrame()
  354. {
  355. handlerFrame = OnFrame;
  356. if (handlerFrame != null)
  357. {
  358. handlerFrame();
  359. }
  360. }
  361. public void TriggerOnNewClient(IClientAPI client)
  362. {
  363. handlerNewClient = OnNewClient;
  364. if (handlerNewClient != null)
  365. handlerNewClient(client);
  366. if (client is IClientCore)
  367. {
  368. handlerClientConnect = OnClientConnect;
  369. if (handlerClientConnect != null)
  370. handlerClientConnect((IClientCore)client);
  371. }
  372. }
  373. public void TriggerOnNewPresence(ScenePresence presence)
  374. {
  375. handlerNewPresence = OnNewPresence;
  376. if (handlerNewPresence != null)
  377. handlerNewPresence(presence);
  378. }
  379. public void TriggerOnRemovePresence(UUID agentId)
  380. {
  381. handlerRemovePresence = OnRemovePresence;
  382. if (handlerRemovePresence != null)
  383. {
  384. handlerRemovePresence(agentId);
  385. }
  386. }
  387. public void TriggerOnBackup(IRegionDataStore dstore)
  388. {
  389. handlerBackup = OnBackup;
  390. if (handlerBackup != null)
  391. {
  392. handlerBackup(dstore, false);
  393. }
  394. }
  395. public void TriggerParcelPrimCountUpdate()
  396. {
  397. handlerParcelPrimCountUpdate = OnParcelPrimCountUpdate;
  398. if (handlerParcelPrimCountUpdate != null)
  399. {
  400. handlerParcelPrimCountUpdate();
  401. }
  402. }
  403. public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs e)
  404. {
  405. handlerMoneyTransfer = OnMoneyTransfer;
  406. if (handlerMoneyTransfer != null)
  407. {
  408. handlerMoneyTransfer(sender, e);
  409. }
  410. }
  411. public void TriggerTerrainTick()
  412. {
  413. handlerTerrainTick = OnTerrainTick;
  414. if (handlerTerrainTick != null)
  415. {
  416. handlerTerrainTick();
  417. }
  418. }
  419. public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
  420. {
  421. handlerParcelPrimCountAdd = OnParcelPrimCountAdd;
  422. if (handlerParcelPrimCountAdd != null)
  423. {
  424. handlerParcelPrimCountAdd(obj);
  425. }
  426. }
  427. public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
  428. {
  429. handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
  430. if (handlerObjectBeingRemovedFromScene != null)
  431. {
  432. handlerObjectBeingRemovedFromScene(obj);
  433. }
  434. }
  435. public void TriggerShutdown()
  436. {
  437. handlerShutdown = OnShutdown;
  438. if (handlerShutdown != null)
  439. handlerShutdown();
  440. }
  441. public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  442. {
  443. handlerObjectGrab = OnObjectGrab;
  444. if (handlerObjectGrab != null)
  445. {
  446. handlerObjectGrab(localID, originalID, offsetPos, remoteClient, surfaceArgs);
  447. }
  448. }
  449. public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  450. {
  451. handlerObjectDeGrab = OnObjectDeGrab;
  452. if (handlerObjectDeGrab != null)
  453. {
  454. handlerObjectDeGrab(localID, originalID, remoteClient, surfaceArgs);
  455. }
  456. }
  457. public void TriggerScriptReset(uint localID, UUID itemID)
  458. {
  459. handlerScriptReset = OnScriptReset;
  460. if (handlerScriptReset != null)
  461. {
  462. handlerScriptReset(localID, itemID);
  463. }
  464. }
  465. public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
  466. {
  467. handlerRezScript = OnRezScript;
  468. if (handlerRezScript != null)
  469. {
  470. handlerRezScript(localID, itemID, script, startParam,
  471. postOnRez, engine, stateSource);
  472. }
  473. }
  474. public void TriggerStartScript(uint localID, UUID itemID)
  475. {
  476. handlerStartScript = OnStartScript;
  477. if (handlerStartScript != null)
  478. {
  479. handlerStartScript(localID, itemID);
  480. }
  481. }
  482. public void TriggerStopScript(uint localID, UUID itemID)
  483. {
  484. handlerStopScript = OnStopScript;
  485. if (handlerStopScript != null)
  486. {
  487. handlerStopScript(localID, itemID);
  488. }
  489. }
  490. public void TriggerRemoveScript(uint localID, UUID itemID)
  491. {
  492. handlerRemoveScript = OnRemoveScript;
  493. if (handlerRemoveScript != null)
  494. {
  495. handlerRemoveScript(localID, itemID);
  496. }
  497. }
  498. public bool TriggerGroupMove(UUID groupID, Vector3 delta)
  499. {
  500. handlerSceneGroupMove = OnSceneGroupMove;
  501. if (handlerSceneGroupMove != null)
  502. {
  503. return handlerSceneGroupMove(groupID, delta);
  504. }
  505. return true;
  506. }
  507. public bool TriggerGroupSpinStart(UUID groupID)
  508. {
  509. handlerSceneGroupSpinStarted = OnSceneGroupSpinStart;
  510. if (handlerSceneGroupSpinStarted != null)
  511. {
  512. return handlerSceneGroupSpinStarted(groupID);
  513. }
  514. return true;
  515. }
  516. public bool TriggerGroupSpin(UUID groupID, Quaternion rotation)
  517. {
  518. handlerSceneGroupSpin = OnSceneGroupSpin;
  519. if (handlerSceneGroupSpin != null)
  520. {
  521. return handlerSceneGroupSpin(groupID, rotation);
  522. }
  523. return true;
  524. }
  525. public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID)
  526. {
  527. handlerSceneGroupGrab = OnSceneGroupGrab;
  528. if (handlerSceneGroupGrab != null)
  529. {
  530. handlerSceneGroupGrab(groupID, offset, userID);
  531. }
  532. }
  533. public void TriggerLandObjectAdded(ILandObject newParcel)
  534. {
  535. handlerLandObjectAdded = OnLandObjectAdded;
  536. if (handlerLandObjectAdded != null)
  537. {
  538. handlerLandObjectAdded(newParcel);
  539. }
  540. }
  541. public void TriggerLandObjectRemoved(UUID globalID)
  542. {
  543. handlerLandObjectRemoved = OnLandObjectRemoved;
  544. if (handlerLandObjectRemoved != null)
  545. {
  546. handlerLandObjectRemoved(globalID);
  547. }
  548. }
  549. public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel)
  550. {
  551. //triggerLandObjectRemoved(localParcelID);
  552. TriggerLandObjectAdded(newParcel);
  553. }
  554. public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
  555. {
  556. handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel;
  557. if (handlerAvatarEnteringNewParcel != null)
  558. {
  559. handlerAvatarEnteringNewParcel(avatar, localLandID, regionID);
  560. }
  561. }
  562. public void TriggerIncomingInstantMessage(GridInstantMessage message)
  563. {
  564. handlerIncomingInstantMessage = OnIncomingInstantMessage;
  565. if (handlerIncomingInstantMessage != null)
  566. {
  567. handlerIncomingInstantMessage(message);
  568. }
  569. }
  570. public void TriggerUnhandledInstantMessage(GridInstantMessage message)
  571. {
  572. handlerUnhandledInstantMessage = OnUnhandledInstantMessage;
  573. if (handlerUnhandledInstantMessage != null)
  574. {
  575. handlerUnhandledInstantMessage(message);
  576. }
  577. }
  578. public void TriggerClientClosed(UUID ClientID, Scene scene)
  579. {
  580. handlerClientClosed = OnClientClosed;
  581. if (handlerClientClosed != null)
  582. {
  583. handlerClientClosed(ClientID, scene);
  584. }
  585. }
  586. public void TriggerOnMakeChildAgent(ScenePresence presence)
  587. {
  588. handlerMakeChildAgent = OnMakeChildAgent;
  589. if (handlerMakeChildAgent != null)
  590. {
  591. handlerMakeChildAgent(presence);
  592. }
  593. }
  594. public void TriggerOnMakeRootAgent(ScenePresence presence)
  595. {
  596. handlerMakeRootAgent = OnMakeRootAgent;
  597. if (handlerMakeRootAgent != null)
  598. {
  599. handlerMakeRootAgent(presence);
  600. }
  601. }
  602. public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
  603. {
  604. handlerRegisterCaps = OnRegisterCaps;
  605. if (handlerRegisterCaps != null)
  606. {
  607. handlerRegisterCaps(agentID, caps);
  608. }
  609. }
  610. public void TriggerOnDeregisterCaps(UUID agentID, Caps caps)
  611. {
  612. handlerDeregisterCaps = OnDeregisterCaps;
  613. if (handlerDeregisterCaps != null)
  614. {
  615. handlerDeregisterCaps(agentID, caps);
  616. }
  617. }
  618. public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel)
  619. {
  620. handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete;
  621. if (handlerNewInventoryItemUpdateComplete != null)
  622. {
  623. handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel);
  624. }
  625. }
  626. public void TriggerLandBuy(Object sender, LandBuyArgs e)
  627. {
  628. handlerLandBuy = OnLandBuy;
  629. if (handlerLandBuy != null)
  630. {
  631. handlerLandBuy(sender, e);
  632. }
  633. }
  634. public void TriggerValidateLandBuy(Object sender, LandBuyArgs e)
  635. {
  636. handlerValidateLandBuy = OnValidateLandBuy;
  637. if (handlerValidateLandBuy != null)
  638. {
  639. handlerValidateLandBuy(sender, e);
  640. }
  641. }
  642. public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos)
  643. {
  644. handlerScriptAtTargetEvent = OnScriptAtTargetEvent;
  645. if (handlerScriptAtTargetEvent != null)
  646. {
  647. handlerScriptAtTargetEvent(localID, handle, targetpos, currentpos);
  648. }
  649. }
  650. public void TriggerNotAtTargetEvent(uint localID)
  651. {
  652. handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent;
  653. if (handlerScriptNotAtTargetEvent != null)
  654. {
  655. handlerScriptNotAtTargetEvent(localID);
  656. }
  657. }
  658. public void TriggerRequestChangeWaterHeight(float height)
  659. {
  660. handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight;
  661. if (handlerRequestChangeWaterHeight != null)
  662. {
  663. handlerRequestChangeWaterHeight(height);
  664. }
  665. }
  666. public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar)
  667. {
  668. handlerAvatarKill = OnAvatarKilled;
  669. if (handlerAvatarKill != null)
  670. {
  671. handlerAvatarKill(KillerObjectLocalID, DeadAvatar);
  672. }
  673. }
  674. public void TriggerSignificantClientMovement(IClientAPI client)
  675. {
  676. handlerSignificantClientMovement = OnSignificantClientMovement;
  677. if (handlerSignificantClientMovement != null)
  678. {
  679. handlerSignificantClientMovement(client);
  680. }
  681. }
  682. public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
  683. {
  684. handlerChatFromWorld = OnChatFromWorld;
  685. if (handlerChatFromWorld != null)
  686. {
  687. handlerChatFromWorld(sender, chat);
  688. }
  689. }
  690. public void TriggerOnChatFromClient(Object sender, OSChatMessage chat)
  691. {
  692. handlerChatFromClient = OnChatFromClient;
  693. if (handlerChatFromClient != null)
  694. {
  695. handlerChatFromClient(sender, chat);
  696. }
  697. }
  698. public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
  699. {
  700. handlerChatBroadcast = OnChatBroadcast;
  701. if (handlerChatBroadcast != null)
  702. {
  703. handlerChatBroadcast(sender, chat);
  704. }
  705. }
  706. internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed)
  707. {
  708. handlerScriptControlEvent = OnScriptControlEvent;
  709. if (handlerScriptControlEvent != null)
  710. {
  711. handlerScriptControlEvent(p, scriptUUID, avatarID, held, _changed);
  712. }
  713. }
  714. public void TriggerNoticeNoLandDataFromStorage()
  715. {
  716. handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage;
  717. if (handlerNoticeNoLandDataFromStorage != null)
  718. {
  719. handlerNoticeNoLandDataFromStorage();
  720. }
  721. }
  722. public void TriggerIncomingLandDataFromStorage(List<LandData> landData)
  723. {
  724. handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage;
  725. if (handlerIncomingLandDataFromStorage != null)
  726. {
  727. handlerIncomingLandDataFromStorage(landData);
  728. }
  729. }
  730. public void TriggerSetAllowForcefulBan(bool allow)
  731. {
  732. handlerSetAllowForcefulBan = OnSetAllowForcefulBan;
  733. if (handlerSetAllowForcefulBan != null)
  734. {
  735. handlerSetAllowForcefulBan(allow);
  736. }
  737. }
  738. public void TriggerRequestParcelPrimCountUpdate()
  739. {
  740. handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate;
  741. if (handlerRequestParcelPrimCountUpdate != null)
  742. {
  743. handlerRequestParcelPrimCountUpdate();
  744. }
  745. }
  746. public void TriggerParcelPrimCountTainted()
  747. {
  748. handlerParcelPrimCountTainted = OnParcelPrimCountTainted;
  749. if (handlerParcelPrimCountTainted != null)
  750. {
  751. handlerParcelPrimCountTainted();
  752. }
  753. }
  754. // this lets us keep track of nasty script events like timer, etc.
  755. public void TriggerTimerEvent(uint objLocalID, double Interval)
  756. {
  757. handlerScriptTimerEvent = OnScriptTimerEvent;
  758. if (handlerScriptTimerEvent != null)
  759. {
  760. handlerScriptTimerEvent(objLocalID, Interval);
  761. }
  762. }
  763. /// <summary>
  764. /// Updates the system as to how the position of the sun should be handled.
  765. /// </summary>
  766. /// <param name="regionHandle"></param>
  767. /// <param name="FixedTime">True if the Sun Position is fixed</param>
  768. /// <param name="useEstateTime">True if the Estate Settings should be used instead of region</param>
  769. /// <param name="FixedSunHour">The hour 0.0 <= FixedSunHour <= 24.0 at which the sun is fixed at. Sun Hour 0 is sun-rise, when Day/Night ratio is 1:1</param>
  770. public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour)
  771. {
  772. handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate;
  773. if (handlerEstateToolsSunUpdate != null)
  774. {
  775. handlerEstateToolsSunUpdate(regionHandle, FixedTime, useEstateTime, FixedSunHour);
  776. }
  777. }
  778. public float GetCurrentTimeAsSunLindenHour()
  779. {
  780. handlerCurrentTimeAsLindenSunHour = OnGetCurrentTimeAsLindenSunHour;
  781. if (handlerCurrentTimeAsLindenSunHour != null)
  782. {
  783. return handlerCurrentTimeAsLindenSunHour();
  784. }
  785. return 6;
  786. }
  787. public void TriggerOarFileLoaded(Guid requestId, string message)
  788. {
  789. handlerOarFileLoaded = OnOarFileLoaded;
  790. if (handlerOarFileLoaded != null)
  791. handlerOarFileLoaded(requestId, message);
  792. }
  793. public void TriggerOarFileSaved(Guid requestId, string message)
  794. {
  795. handlerOarFileSaved = OnOarFileSaved;
  796. if (handlerOarFileSaved != null)
  797. handlerOarFileSaved(requestId, message);
  798. }
  799. public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message)
  800. {
  801. handlerEmptyScriptCompileQueue = OnEmptyScriptCompileQueue;
  802. if (handlerEmptyScriptCompileQueue != null)
  803. handlerEmptyScriptCompileQueue(numScriptsFailed, message);
  804. }
  805. public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders)
  806. {
  807. handlerCollidingStart = OnScriptColliderStart;
  808. if (handlerCollidingStart != null)
  809. handlerCollidingStart(localId, colliders);
  810. }
  811. public void TriggerScriptColliding(uint localId, ColliderArgs colliders)
  812. {
  813. handlerColliding = OnScriptColliding;
  814. if (handlerColliding != null)
  815. handlerColliding(localId, colliders);
  816. }
  817. public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders)
  818. {
  819. handlerCollidingEnd = OnScriptCollidingEnd;
  820. if (handlerCollidingEnd != null)
  821. handlerCollidingEnd(localId, colliders);
  822. }
  823. public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
  824. {
  825. handlerSetRootAgentScene = OnSetRootAgentScene;
  826. if (handlerSetRootAgentScene != null)
  827. handlerSetRootAgentScene(agentID, scene);
  828. }
  829. }
  830. }