CLEAR.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. namespace OpenVIII.Fields.Scripts.Instructions
  2. {
  3. /// <summary>
  4. /// Resets all variables and game data.
  5. /// Only used when starting a new game (and in debug rooms).
  6. /// </summary>
  7. internal sealed class CLEAR : JsmInstruction
  8. {
  9. #region Constructors
  10. public CLEAR()
  11. {
  12. }
  13. public CLEAR(int parameter, IStack<IJsmExpression> stack)
  14. : this()
  15. {
  16. }
  17. #endregion Constructors
  18. #region Methods
  19. public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services) => sw.Format(formatterContext, services)
  20. .StaticType(nameof(IGameplayService))
  21. .Method(nameof(IGameplayService.ResetAllData))
  22. .Comment(nameof(CLEAR));
  23. public override IAwaitable TestExecute(IServices services)
  24. {
  25. ServiceId.Gameplay[services].ResetAllData();
  26. return DummyAwaitable.Instance;
  27. }
  28. public override string ToString() => $"{nameof(CLEAR)}()";
  29. #endregion Methods
  30. }
  31. }