IScriptEngine.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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.Reflection;
  29. using OpenSim.Framework;
  30. using OpenSim.Region.Framework.Scenes;
  31. using OpenSim.Region.Framework.Interfaces;
  32. using OpenSim.Region.ScriptEngine.Interfaces;
  33. using OpenSim.Region.ScriptEngine.Shared;
  34. using Amib.Threading;
  35. using log4net;
  36. using Nini.Config;
  37. using OpenMetaverse;
  38. namespace OpenSim.Region.ScriptEngine.Interfaces
  39. {
  40. /// <summary>
  41. /// An interface for a script API module to communicate with
  42. /// the engine it's running under
  43. /// </summary>
  44. public interface IScriptEngine
  45. {
  46. /// <summary>
  47. /// Queue an event for execution
  48. /// </summary>
  49. IScriptWorkItem QueueEventHandler(object parms);
  50. Scene World { get; }
  51. IScriptModule ScriptModule { get; }
  52. void CancelScriptEvent(UUID itemID, string eventName);
  53. /// <summary>
  54. /// Post an event to a single script
  55. /// </summary>
  56. bool PostScriptEvent(UUID itemID, EventParams parms);
  57. /// <summary>
  58. /// Post event to an entire prim
  59. /// </summary>
  60. bool PostObjectEvent(uint localID, EventParams parms);
  61. DetectParams GetDetectParams(UUID item, int number);
  62. void SetMinEventDelay(UUID itemID, double delay);
  63. int GetStartParameter(UUID itemID);
  64. void SetScriptState(UUID itemID, bool state, bool self);
  65. bool GetScriptState(UUID itemID);
  66. void SetState(UUID itemID, string newState);
  67. void ApiResetScript(UUID itemID);
  68. void ResetScript(UUID itemID);
  69. IConfig Config { get; }
  70. IConfigSource ConfigSource { get; }
  71. string ScriptEngineName { get; }
  72. string ScriptEnginePath { get; }
  73. /// <summary>
  74. /// Return the name of the class that will be used for all running scripts.
  75. /// </summary>
  76. /// <remarks>
  77. /// Each class goes in its own assembly so we don't need to otherwise distinguish the class name.
  78. /// </remarks>
  79. string ScriptClassName { get; }
  80. /// <summary>
  81. /// Return the name of the base class that will be used for all running scripts.
  82. /// </summary>
  83. string ScriptBaseClassName { get; }
  84. /// <summary>
  85. /// Assemblies that need to be referenced when compiling scripts.
  86. /// </summary>
  87. /// <remarks>
  88. /// These are currently additional to those always referenced by the compiler, BUT THIS MAY CHANGE IN THE
  89. /// FUTURE.
  90. /// This can be null if there are no additional assemblies.
  91. /// </remarks>
  92. string[] ScriptReferencedAssemblies { get; }
  93. /// <summary>
  94. /// Parameters for the generated script's constructor.
  95. /// </summary>
  96. /// <remarks>
  97. /// Can be null if there are no parameters
  98. /// </remarks>
  99. ParameterInfo[] ScriptBaseClassParameters { get; }
  100. IScriptApi GetApi(UUID itemID, string name);
  101. void SleepScript(UUID itemID, int delay);
  102. }
  103. }