IScriptEngine.cs 4.6 KB

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