PUSHOFF.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. namespace OpenVIII.Fields.Scripts.Instructions
  2. {
  3. /// <summary>
  4. /// Disables this entity's "push" script. See PUSHON.
  5. /// </summary>
  6. internal sealed class PUSHOFF : JsmInstruction
  7. {
  8. #region Constructors
  9. public PUSHOFF()
  10. {
  11. }
  12. public PUSHOFF(int parameter, IStack<IJsmExpression> stack)
  13. : this()
  14. {
  15. }
  16. #endregion Constructors
  17. #region Methods
  18. public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services) => sw.Format(formatterContext, services)
  19. .Property(nameof(FieldObject.Model))
  20. .Property(nameof(FieldObjectInteraction.IsPushScriptActive))
  21. .Assign(false)
  22. .Comment(nameof(PUSHOFF));
  23. public override IAwaitable TestExecute(IServices services)
  24. {
  25. var currentObject = ServiceId.Field[services].Engine.CurrentObject;
  26. currentObject.Interaction.IsPushScriptActive = false;
  27. return DummyAwaitable.Instance;
  28. }
  29. public override string ToString() => $"{nameof(PUSHOFF)}()";
  30. #endregion Methods
  31. }
  32. }