1
0

IScriptEngine.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. /// <summary>
  53. /// Post an event to a single script
  54. /// </summary>
  55. bool PostScriptEvent(UUID itemID, EventParams parms);
  56. /// <summary>
  57. /// Post event to an entire prim
  58. /// </summary>
  59. bool PostObjectEvent(uint localID, EventParams parms);
  60. DetectParams GetDetectParams(UUID item, int number);
  61. void SetMinEventDelay(UUID itemID, double delay);
  62. int GetStartParameter(UUID itemID);
  63. void SetScriptState(UUID itemID, bool state);
  64. bool GetScriptState(UUID itemID);
  65. void SetState(UUID itemID, string newState);
  66. void ApiResetScript(UUID itemID);
  67. void ResetScript(UUID itemID);
  68. IConfig Config { get; }
  69. IConfigSource ConfigSource { get; }
  70. string ScriptEngineName { get; }
  71. string ScriptEnginePath { get; }
  72. /// <summary>
  73. /// Return the name of the class that will be used for all running scripts.
  74. /// </summary>
  75. /// <remarks>
  76. /// Each class goes in its own assembly so we don't need to otherwise distinguish the class name.
  77. /// </remarks>
  78. string ScriptClassName { get; }
  79. /// <summary>
  80. /// Return the name of the base class that will be used for all running scripts.
  81. /// </summary>
  82. string ScriptBaseClassName { get; }
  83. /// <summary>
  84. /// Assemblies that need to be referenced when compiling scripts.
  85. /// </summary>
  86. /// <remarks>
  87. /// These are currently additional to those always referenced by the compiler, BUT THIS MAY CHANGE IN THE
  88. /// FUTURE.
  89. /// This can be null if there are no additional assemblies.
  90. /// </remarks>
  91. string[] ScriptReferencedAssemblies { get; }
  92. /// <summary>
  93. /// Parameters for the generated script's constructor.
  94. /// </summary>
  95. /// <remarks>
  96. /// Can be null if there are no parameters
  97. /// </remarks>
  98. ParameterInfo[] ScriptBaseClassParameters { get; }
  99. IScriptApi GetApi(UUID itemID, string name);
  100. }
  101. }