EventManager.cs 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039
  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. /// Deprecated 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. /// <summary>
  204. /// Called whenever an object is attached, or detached
  205. /// from an in-world presence.
  206. /// </summary>
  207. public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
  208. public event Attach OnAttach;
  209. public class MoneyTransferArgs : EventArgs
  210. {
  211. public UUID sender;
  212. public UUID receiver;
  213. // Always false. The SL protocol sucks.
  214. public bool authenticated = false;
  215. public int amount;
  216. public int transactiontype;
  217. public string description;
  218. public MoneyTransferArgs(UUID asender, UUID areceiver, int aamount, int atransactiontype, string adescription)
  219. {
  220. sender = asender;
  221. receiver = areceiver;
  222. amount = aamount;
  223. transactiontype = atransactiontype;
  224. description = adescription;
  225. }
  226. }
  227. public class LandBuyArgs : EventArgs
  228. {
  229. public UUID agentId = UUID.Zero;
  230. public UUID groupId = UUID.Zero;
  231. public UUID parcelOwnerID = UUID.Zero;
  232. public bool final = false;
  233. public bool groupOwned = false;
  234. public bool removeContribution = false;
  235. public int parcelLocalID = 0;
  236. public int parcelArea = 0;
  237. public int parcelPrice = 0;
  238. public bool authenticated = false;
  239. public bool landValidated = false;
  240. public bool economyValidated = false;
  241. public int transactionID = 0;
  242. public int amountDebited = 0;
  243. public LandBuyArgs(UUID pagentId, UUID pgroupId, bool pfinal, bool pgroupOwned,
  244. bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice,
  245. bool pauthenticated)
  246. {
  247. agentId = pagentId;
  248. groupId = pgroupId;
  249. final = pfinal;
  250. groupOwned = pgroupOwned;
  251. removeContribution = premoveContribution;
  252. parcelLocalID = pparcelLocalID;
  253. parcelArea = pparcelArea;
  254. parcelPrice = pparcelPrice;
  255. authenticated = pauthenticated;
  256. }
  257. }
  258. public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e);
  259. public delegate void LandBuy(Object sender, LandBuyArgs e);
  260. public event MoneyTransferEvent OnMoneyTransfer;
  261. public event LandBuy OnLandBuy;
  262. public event LandBuy OnValidateLandBuy;
  263. /* Designated Event Deletage Instances */
  264. private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent;
  265. private ScriptAtTargetEvent handlerScriptAtTargetEvent = null;
  266. private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null;
  267. private ClientMovement handlerClientMovement = null; //OnClientMovement;
  268. private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError;
  269. private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole;
  270. private OnFrameDelegate handlerFrame = null; //OnFrame;
  271. private OnNewClientDelegate handlerNewClient = null; //OnNewClient;
  272. private OnClientConnectCoreDelegate handlerClientConnect = null; //OnClientConnect
  273. private OnNewPresenceDelegate handlerNewPresence = null; //OnNewPresence;
  274. private OnRemovePresenceDelegate handlerRemovePresence = null; //OnRemovePresence;
  275. private OnBackupDelegate handlerBackup = null; //OnBackup;
  276. private OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = null; //OnParcelPrimCountUpdate;
  277. private MoneyTransferEvent handlerMoneyTransfer = null; //OnMoneyTransfer;
  278. private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd;
  279. private OnShutdownDelegate handlerShutdown = null; //OnShutdown;
  280. private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab;
  281. private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab;
  282. private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset
  283. private NewRezScript handlerRezScript = null; //OnRezScript;
  284. private RemoveScript handlerRemoveScript = null; //OnRemoveScript;
  285. private StartScript handlerStartScript = null; //OnStartScript;
  286. private StopScript handlerStopScript = null; //OnStopScript;
  287. private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove;
  288. private SceneGroupGrabed handlerSceneGroupGrab = null; //OnSceneGroupGrab;
  289. private SceneGroupSpinStarted handlerSceneGroupSpinStarted = null; //OnSceneGroupSpinStart;
  290. private SceneGroupSpun handlerSceneGroupSpin = null; //OnSceneGroupSpin;
  291. private LandObjectAdded handlerLandObjectAdded = null; //OnLandObjectAdded;
  292. private LandObjectRemoved handlerLandObjectRemoved = null; //OnLandObjectRemoved;
  293. private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = null; //OnAvatarEnteringNewParcel;
  294. private IncomingInstantMessage handlerIncomingInstantMessage = null; //OnIncomingInstantMessage;
  295. private IncomingInstantMessage handlerUnhandledInstantMessage = null; //OnUnhandledInstantMessage;
  296. private ClientClosed handlerClientClosed = null; //OnClientClosed;
  297. private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent;
  298. private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent;
  299. private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick;
  300. private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps;
  301. private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps;
  302. private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld;
  303. private ChatFromClientEvent handlerChatFromClient = null; // OnChatFromClient;
  304. private ChatBroadcastEvent handlerChatBroadcast = null; // OnChatBroadcast;
  305. private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null;
  306. private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight
  307. private ScriptControlEvent handlerScriptControlEvent = null;
  308. private SignificantClientMovement handlerSignificantClientMovement = null;
  309. private LandBuy handlerLandBuy = null;
  310. private LandBuy handlerValidateLandBuy = null;
  311. private AvatarKillData handlerAvatarKill = null;
  312. private NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = null;
  313. private IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = null;
  314. private SetAllowForcefulBan handlerSetAllowForcefulBan = null;
  315. private RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = null;
  316. private ParcelPrimCountTainted handlerParcelPrimCountTainted = null;
  317. private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null;
  318. // TODO: unused: private ScriptTimerEvent handlerScriptTimerEvent = null;
  319. private EstateToolsSunUpdate handlerEstateToolsSunUpdate = null;
  320. private ScriptColliding handlerCollidingStart = null;
  321. private ScriptColliding handlerColliding = null;
  322. private ScriptColliding handlerCollidingEnd = null;
  323. private GetScriptRunning handlerGetScriptRunning = null;
  324. private SunLindenHour handlerCurrentTimeAsLindenSunHour = null;
  325. private OnSetRootAgentSceneDelegate handlerSetRootAgentScene = null;
  326. private OarFileLoaded handlerOarFileLoaded = null;
  327. private OarFileSaved handlerOarFileSaved = null;
  328. private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null;
  329. private Attach handlerOnAttach = null;
  330. public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
  331. {
  332. handlerOnAttach = OnAttach;
  333. if (handlerOnAttach != null)
  334. handlerOnAttach(localID, itemID, avatarID);
  335. }
  336. public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
  337. {
  338. handlerGetScriptRunning = OnGetScriptRunning;
  339. if (handlerGetScriptRunning != null)
  340. handlerGetScriptRunning(controllingClient, objectID, itemID);
  341. }
  342. public void TriggerOnScriptChangedEvent(uint localID, uint change)
  343. {
  344. handlerScriptChangedEvent = OnScriptChangedEvent;
  345. if (handlerScriptChangedEvent != null)
  346. handlerScriptChangedEvent(localID, change);
  347. }
  348. public void TriggerOnClientMovement(ScenePresence avatar)
  349. {
  350. handlerClientMovement = OnClientMovement;
  351. if (handlerClientMovement != null)
  352. handlerClientMovement(avatar);
  353. }
  354. public void TriggerPermissionError(UUID user, string reason)
  355. {
  356. handlerPermissionError = OnPermissionError;
  357. if (handlerPermissionError != null)
  358. handlerPermissionError(user, reason);
  359. }
  360. public void TriggerOnPluginConsole(string[] args)
  361. {
  362. handlerPluginConsole = OnPluginConsole;
  363. if (handlerPluginConsole != null)
  364. handlerPluginConsole(args);
  365. }
  366. public void TriggerOnFrame()
  367. {
  368. handlerFrame = OnFrame;
  369. if (handlerFrame != null)
  370. {
  371. handlerFrame();
  372. }
  373. }
  374. public void TriggerOnNewClient(IClientAPI client)
  375. {
  376. handlerNewClient = OnNewClient;
  377. if (handlerNewClient != null)
  378. handlerNewClient(client);
  379. if (client is IClientCore)
  380. {
  381. handlerClientConnect = OnClientConnect;
  382. if (handlerClientConnect != null)
  383. handlerClientConnect((IClientCore)client);
  384. }
  385. }
  386. public void TriggerOnNewPresence(ScenePresence presence)
  387. {
  388. handlerNewPresence = OnNewPresence;
  389. if (handlerNewPresence != null)
  390. handlerNewPresence(presence);
  391. }
  392. public void TriggerOnRemovePresence(UUID agentId)
  393. {
  394. handlerRemovePresence = OnRemovePresence;
  395. if (handlerRemovePresence != null)
  396. {
  397. handlerRemovePresence(agentId);
  398. }
  399. }
  400. public void TriggerOnBackup(IRegionDataStore dstore)
  401. {
  402. handlerBackup = OnBackup;
  403. if (handlerBackup != null)
  404. {
  405. handlerBackup(dstore, false);
  406. }
  407. }
  408. public void TriggerParcelPrimCountUpdate()
  409. {
  410. handlerParcelPrimCountUpdate = OnParcelPrimCountUpdate;
  411. if (handlerParcelPrimCountUpdate != null)
  412. {
  413. handlerParcelPrimCountUpdate();
  414. }
  415. }
  416. public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs e)
  417. {
  418. handlerMoneyTransfer = OnMoneyTransfer;
  419. if (handlerMoneyTransfer != null)
  420. {
  421. handlerMoneyTransfer(sender, e);
  422. }
  423. }
  424. public void TriggerTerrainTick()
  425. {
  426. handlerTerrainTick = OnTerrainTick;
  427. if (handlerTerrainTick != null)
  428. {
  429. handlerTerrainTick();
  430. }
  431. }
  432. public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
  433. {
  434. handlerParcelPrimCountAdd = OnParcelPrimCountAdd;
  435. if (handlerParcelPrimCountAdd != null)
  436. {
  437. handlerParcelPrimCountAdd(obj);
  438. }
  439. }
  440. public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
  441. {
  442. handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
  443. if (handlerObjectBeingRemovedFromScene != null)
  444. {
  445. handlerObjectBeingRemovedFromScene(obj);
  446. }
  447. }
  448. public void TriggerShutdown()
  449. {
  450. handlerShutdown = OnShutdown;
  451. if (handlerShutdown != null)
  452. handlerShutdown();
  453. }
  454. public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  455. {
  456. handlerObjectGrab = OnObjectGrab;
  457. if (handlerObjectGrab != null)
  458. {
  459. handlerObjectGrab(localID, originalID, offsetPos, remoteClient, surfaceArgs);
  460. }
  461. }
  462. public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  463. {
  464. handlerObjectDeGrab = OnObjectDeGrab;
  465. if (handlerObjectDeGrab != null)
  466. {
  467. handlerObjectDeGrab(localID, originalID, remoteClient, surfaceArgs);
  468. }
  469. }
  470. public void TriggerScriptReset(uint localID, UUID itemID)
  471. {
  472. handlerScriptReset = OnScriptReset;
  473. if (handlerScriptReset != null)
  474. {
  475. handlerScriptReset(localID, itemID);
  476. }
  477. }
  478. public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
  479. {
  480. handlerRezScript = OnRezScript;
  481. if (handlerRezScript != null)
  482. {
  483. handlerRezScript(localID, itemID, script, startParam,
  484. postOnRez, engine, stateSource);
  485. }
  486. }
  487. public void TriggerStartScript(uint localID, UUID itemID)
  488. {
  489. handlerStartScript = OnStartScript;
  490. if (handlerStartScript != null)
  491. {
  492. handlerStartScript(localID, itemID);
  493. }
  494. }
  495. public void TriggerStopScript(uint localID, UUID itemID)
  496. {
  497. handlerStopScript = OnStopScript;
  498. if (handlerStopScript != null)
  499. {
  500. handlerStopScript(localID, itemID);
  501. }
  502. }
  503. public void TriggerRemoveScript(uint localID, UUID itemID)
  504. {
  505. handlerRemoveScript = OnRemoveScript;
  506. if (handlerRemoveScript != null)
  507. {
  508. handlerRemoveScript(localID, itemID);
  509. }
  510. }
  511. public bool TriggerGroupMove(UUID groupID, Vector3 delta)
  512. {
  513. handlerSceneGroupMove = OnSceneGroupMove;
  514. if (handlerSceneGroupMove != null)
  515. {
  516. return handlerSceneGroupMove(groupID, delta);
  517. }
  518. return true;
  519. }
  520. public bool TriggerGroupSpinStart(UUID groupID)
  521. {
  522. handlerSceneGroupSpinStarted = OnSceneGroupSpinStart;
  523. if (handlerSceneGroupSpinStarted != null)
  524. {
  525. return handlerSceneGroupSpinStarted(groupID);
  526. }
  527. return true;
  528. }
  529. public bool TriggerGroupSpin(UUID groupID, Quaternion rotation)
  530. {
  531. handlerSceneGroupSpin = OnSceneGroupSpin;
  532. if (handlerSceneGroupSpin != null)
  533. {
  534. return handlerSceneGroupSpin(groupID, rotation);
  535. }
  536. return true;
  537. }
  538. public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID)
  539. {
  540. handlerSceneGroupGrab = OnSceneGroupGrab;
  541. if (handlerSceneGroupGrab != null)
  542. {
  543. handlerSceneGroupGrab(groupID, offset, userID);
  544. }
  545. }
  546. public void TriggerLandObjectAdded(ILandObject newParcel)
  547. {
  548. handlerLandObjectAdded = OnLandObjectAdded;
  549. if (handlerLandObjectAdded != null)
  550. {
  551. handlerLandObjectAdded(newParcel);
  552. }
  553. }
  554. public void TriggerLandObjectRemoved(UUID globalID)
  555. {
  556. handlerLandObjectRemoved = OnLandObjectRemoved;
  557. if (handlerLandObjectRemoved != null)
  558. {
  559. handlerLandObjectRemoved(globalID);
  560. }
  561. }
  562. public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel)
  563. {
  564. //triggerLandObjectRemoved(localParcelID);
  565. TriggerLandObjectAdded(newParcel);
  566. }
  567. public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
  568. {
  569. handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel;
  570. if (handlerAvatarEnteringNewParcel != null)
  571. {
  572. handlerAvatarEnteringNewParcel(avatar, localLandID, regionID);
  573. }
  574. }
  575. public void TriggerIncomingInstantMessage(GridInstantMessage message)
  576. {
  577. handlerIncomingInstantMessage = OnIncomingInstantMessage;
  578. if (handlerIncomingInstantMessage != null)
  579. {
  580. handlerIncomingInstantMessage(message);
  581. }
  582. }
  583. public void TriggerUnhandledInstantMessage(GridInstantMessage message)
  584. {
  585. handlerUnhandledInstantMessage = OnUnhandledInstantMessage;
  586. if (handlerUnhandledInstantMessage != null)
  587. {
  588. handlerUnhandledInstantMessage(message);
  589. }
  590. }
  591. public void TriggerClientClosed(UUID ClientID, Scene scene)
  592. {
  593. handlerClientClosed = OnClientClosed;
  594. if (handlerClientClosed != null)
  595. {
  596. handlerClientClosed(ClientID, scene);
  597. }
  598. }
  599. public void TriggerOnMakeChildAgent(ScenePresence presence)
  600. {
  601. handlerMakeChildAgent = OnMakeChildAgent;
  602. if (handlerMakeChildAgent != null)
  603. {
  604. handlerMakeChildAgent(presence);
  605. }
  606. }
  607. public void TriggerOnMakeRootAgent(ScenePresence presence)
  608. {
  609. handlerMakeRootAgent = OnMakeRootAgent;
  610. if (handlerMakeRootAgent != null)
  611. {
  612. handlerMakeRootAgent(presence);
  613. }
  614. }
  615. public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
  616. {
  617. handlerRegisterCaps = OnRegisterCaps;
  618. if (handlerRegisterCaps != null)
  619. {
  620. handlerRegisterCaps(agentID, caps);
  621. }
  622. }
  623. public void TriggerOnDeregisterCaps(UUID agentID, Caps caps)
  624. {
  625. handlerDeregisterCaps = OnDeregisterCaps;
  626. if (handlerDeregisterCaps != null)
  627. {
  628. handlerDeregisterCaps(agentID, caps);
  629. }
  630. }
  631. public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel)
  632. {
  633. handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete;
  634. if (handlerNewInventoryItemUpdateComplete != null)
  635. {
  636. handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel);
  637. }
  638. }
  639. public void TriggerLandBuy(Object sender, LandBuyArgs e)
  640. {
  641. handlerLandBuy = OnLandBuy;
  642. if (handlerLandBuy != null)
  643. {
  644. handlerLandBuy(sender, e);
  645. }
  646. }
  647. public void TriggerValidateLandBuy(Object sender, LandBuyArgs e)
  648. {
  649. handlerValidateLandBuy = OnValidateLandBuy;
  650. if (handlerValidateLandBuy != null)
  651. {
  652. handlerValidateLandBuy(sender, e);
  653. }
  654. }
  655. public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos)
  656. {
  657. handlerScriptAtTargetEvent = OnScriptAtTargetEvent;
  658. if (handlerScriptAtTargetEvent != null)
  659. {
  660. handlerScriptAtTargetEvent(localID, handle, targetpos, currentpos);
  661. }
  662. }
  663. public void TriggerNotAtTargetEvent(uint localID)
  664. {
  665. handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent;
  666. if (handlerScriptNotAtTargetEvent != null)
  667. {
  668. handlerScriptNotAtTargetEvent(localID);
  669. }
  670. }
  671. public void TriggerRequestChangeWaterHeight(float height)
  672. {
  673. handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight;
  674. if (handlerRequestChangeWaterHeight != null)
  675. {
  676. handlerRequestChangeWaterHeight(height);
  677. }
  678. }
  679. public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar)
  680. {
  681. handlerAvatarKill = OnAvatarKilled;
  682. if (handlerAvatarKill != null)
  683. {
  684. handlerAvatarKill(KillerObjectLocalID, DeadAvatar);
  685. }
  686. }
  687. public void TriggerSignificantClientMovement(IClientAPI client)
  688. {
  689. handlerSignificantClientMovement = OnSignificantClientMovement;
  690. if (handlerSignificantClientMovement != null)
  691. {
  692. handlerSignificantClientMovement(client);
  693. }
  694. }
  695. public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
  696. {
  697. handlerChatFromWorld = OnChatFromWorld;
  698. if (handlerChatFromWorld != null)
  699. {
  700. handlerChatFromWorld(sender, chat);
  701. }
  702. }
  703. public void TriggerOnChatFromClient(Object sender, OSChatMessage chat)
  704. {
  705. handlerChatFromClient = OnChatFromClient;
  706. if (handlerChatFromClient != null)
  707. {
  708. handlerChatFromClient(sender, chat);
  709. }
  710. }
  711. public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
  712. {
  713. handlerChatBroadcast = OnChatBroadcast;
  714. if (handlerChatBroadcast != null)
  715. {
  716. handlerChatBroadcast(sender, chat);
  717. }
  718. }
  719. internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed)
  720. {
  721. handlerScriptControlEvent = OnScriptControlEvent;
  722. if (handlerScriptControlEvent != null)
  723. {
  724. handlerScriptControlEvent(p, scriptUUID, avatarID, held, _changed);
  725. }
  726. }
  727. public void TriggerNoticeNoLandDataFromStorage()
  728. {
  729. handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage;
  730. if (handlerNoticeNoLandDataFromStorage != null)
  731. {
  732. handlerNoticeNoLandDataFromStorage();
  733. }
  734. }
  735. public void TriggerIncomingLandDataFromStorage(List<LandData> landData)
  736. {
  737. handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage;
  738. if (handlerIncomingLandDataFromStorage != null)
  739. {
  740. handlerIncomingLandDataFromStorage(landData);
  741. }
  742. }
  743. public void TriggerSetAllowForcefulBan(bool allow)
  744. {
  745. handlerSetAllowForcefulBan = OnSetAllowForcefulBan;
  746. if (handlerSetAllowForcefulBan != null)
  747. {
  748. handlerSetAllowForcefulBan(allow);
  749. }
  750. }
  751. public void TriggerRequestParcelPrimCountUpdate()
  752. {
  753. handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate;
  754. if (handlerRequestParcelPrimCountUpdate != null)
  755. {
  756. handlerRequestParcelPrimCountUpdate();
  757. }
  758. }
  759. public void TriggerParcelPrimCountTainted()
  760. {
  761. handlerParcelPrimCountTainted = OnParcelPrimCountTainted;
  762. if (handlerParcelPrimCountTainted != null)
  763. {
  764. handlerParcelPrimCountTainted();
  765. }
  766. }
  767. // this lets us keep track of nasty script events like timer, etc.
  768. public void TriggerTimerEvent(uint objLocalID, double Interval)
  769. {
  770. 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");
  771. //handlerScriptTimerEvent = OnScriptTimerEvent;
  772. //if (handlerScriptTimerEvent != null)
  773. //{
  774. // handlerScriptTimerEvent(objLocalID, Interval);
  775. //}
  776. }
  777. /// <summary>
  778. /// Updates the system as to how the position of the sun should be handled.
  779. /// </summary>
  780. /// <param name="regionHandle"></param>
  781. /// <param name="FixedTime">True if the Sun Position is fixed</param>
  782. /// <param name="useEstateTime">True if the Estate Settings should be used instead of region</param>
  783. /// <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>
  784. public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour)
  785. {
  786. handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate;
  787. if (handlerEstateToolsSunUpdate != null)
  788. {
  789. handlerEstateToolsSunUpdate(regionHandle, FixedTime, useEstateTime, FixedSunHour);
  790. }
  791. }
  792. public float GetCurrentTimeAsSunLindenHour()
  793. {
  794. handlerCurrentTimeAsLindenSunHour = OnGetCurrentTimeAsLindenSunHour;
  795. if (handlerCurrentTimeAsLindenSunHour != null)
  796. {
  797. return handlerCurrentTimeAsLindenSunHour();
  798. }
  799. return 6;
  800. }
  801. public void TriggerOarFileLoaded(Guid requestId, string message)
  802. {
  803. handlerOarFileLoaded = OnOarFileLoaded;
  804. if (handlerOarFileLoaded != null)
  805. handlerOarFileLoaded(requestId, message);
  806. }
  807. public void TriggerOarFileSaved(Guid requestId, string message)
  808. {
  809. handlerOarFileSaved = OnOarFileSaved;
  810. if (handlerOarFileSaved != null)
  811. handlerOarFileSaved(requestId, message);
  812. }
  813. public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message)
  814. {
  815. handlerEmptyScriptCompileQueue = OnEmptyScriptCompileQueue;
  816. if (handlerEmptyScriptCompileQueue != null)
  817. handlerEmptyScriptCompileQueue(numScriptsFailed, message);
  818. }
  819. public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders)
  820. {
  821. handlerCollidingStart = OnScriptColliderStart;
  822. if (handlerCollidingStart != null)
  823. handlerCollidingStart(localId, colliders);
  824. }
  825. public void TriggerScriptColliding(uint localId, ColliderArgs colliders)
  826. {
  827. handlerColliding = OnScriptColliding;
  828. if (handlerColliding != null)
  829. handlerColliding(localId, colliders);
  830. }
  831. public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders)
  832. {
  833. handlerCollidingEnd = OnScriptCollidingEnd;
  834. if (handlerCollidingEnd != null)
  835. handlerCollidingEnd(localId, colliders);
  836. }
  837. public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
  838. {
  839. handlerSetRootAgentScene = OnSetRootAgentScene;
  840. if (handlerSetRootAgentScene != null)
  841. handlerSetRootAgentScene(agentID, scene);
  842. }
  843. }
  844. }