eventPPStateScriptClear.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. const id = "PM_EVENT_PLATPLUS_STATE_SCRIPT_CLEAR";
  2. const groups = ["Platformer+"];
  3. const name = "Remove a Script from A Platformer+ State";
  4. const fields = [
  5. {
  6. key: "state",
  7. label: "Select Player State",
  8. type: "select",
  9. defaultValue: "0",
  10. options: [
  11. ["0", "Start Falling"],
  12. ["1", "Falling"],
  13. ["2", "End Falling"],
  14. ["3", "Start Grounded"],
  15. ["4", "Grounded"],
  16. ["5", "End Grounded"],
  17. ["6", "Start Jumping"],
  18. ["7", "Jumping"],
  19. ["8", "End Jumping"],
  20. ["9", "Start Dashing"],
  21. ["10", "Dashing"],
  22. ["11", "End Dashing"],
  23. ["12", "Start Climbing Ladder"],
  24. ["13", "Climbing Ladder"],
  25. ["14", "End Climbing Ladder"],
  26. ["15", "Start Wall Slide"],
  27. ["16", "Wall Sliding"],
  28. ["17", "End Wall Slide"],
  29. ["18", "Knockback State Start"],
  30. ["19", "Knockback State"],
  31. ["21", "Blank State Start"],
  32. ["22", "Blank State"]
  33. ],
  34. },
  35. ];
  36. const compile = (input, helpers) => {
  37. const {appendRaw, _addComment} = helpers;
  38. const stateNumber = `${input.state}`;
  39. _addComment("Remove Platformer State Script");
  40. appendRaw(`VM_PUSH_CONST ${stateNumber}`);
  41. appendRaw(`VM_CALL_NATIVE b_clear_state_script, _clear_state_script`);
  42. appendRaw(`VM_POP 1`);
  43. };
  44. module.exports = {
  45. id,
  46. name,
  47. groups,
  48. fields,
  49. compile,
  50. allowedBeforeInitFade: true,
  51. };