EventManager.cs 42 KB

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