movement.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. module.exports = class Movement {
  2. north(room, mobile, input) {
  3. if(typeof room.north == 'function') {
  4. return room.north(room, mobile, input);
  5. }
  6. libs.Output.toMobile(mobile.id, "You can't go that way.");
  7. return true;
  8. }
  9. n(room, mobile, input) {
  10. return this.north(room, mobile, input);
  11. }
  12. south(room, mobile, input) {
  13. if(typeof room.south == 'function') {
  14. return room.south(room, mobile, input);
  15. }
  16. libs.Output.toMobile(mobile.id, "You can't go that way.");
  17. return true;
  18. }
  19. s(room, mobile, input) {
  20. return this.south(room, mobile, input);
  21. }
  22. east(room, mobile, input) {
  23. if(typeof room.east == 'function') {
  24. return room.east(room, mobile, input);
  25. }
  26. libs.Output.toMobile(mobile.id, "You can't go that way.");
  27. return true;
  28. }
  29. e(room, mobile, input) {
  30. return this.east(room, mobile, input);
  31. }
  32. west(room, mobile, input) {
  33. if(typeof room.west == 'function') {
  34. return room.west(room, mobile, input);
  35. }
  36. libs.Output.toMobile(mobile.id, "You can't go that way.");
  37. return true;
  38. }
  39. w(room, mobile, input) {
  40. return this.west(room, mobile, input);
  41. }
  42. northwest(room, mobile, input) {
  43. if(typeof room.northwest == 'function') {
  44. return room.northwest(room, mobile, input);
  45. }
  46. libs.Output.toMobile(mobile.id, "You can't go that way.");
  47. return true;
  48. }
  49. nw(room, mobile, input) {
  50. return this.northwest(room, mobile, input);
  51. }
  52. northeast(room, mobile, input) {
  53. if(typeof room.northeast == 'function') {
  54. return room.northeast(room, mobile, input);
  55. }
  56. libs.Output.toMobile(mobile.id, "You can't go that way.");
  57. return true;
  58. }
  59. ne(room, mobile, input) {
  60. return this.northeast(room, mobile, input);
  61. }
  62. southwest(room, mobile, input) {
  63. if(typeof room.southwest == 'function') {
  64. return room.southwest(room, mobile, input);
  65. }
  66. libs.Output.toMobile(mobile.id, "You can't go that way.");
  67. return true;
  68. }
  69. sw(room, mobile, input) {
  70. return this.southwest(room, mobile, input);
  71. }
  72. southeast(room, mobile, input) {
  73. if(typeof room.southeast == 'function') {
  74. return room.southeast(room, mobile, input);
  75. }
  76. libs.Output.toMobile(mobile.id, "You can't go that way.");
  77. return true;
  78. }
  79. se(room, mobile, input) {
  80. return this.southeast(room, mobile, input);
  81. }
  82. up(room, mobile, input) {
  83. if(typeof room.up == 'function') {
  84. return room.up(room, mobile, input);
  85. }
  86. libs.Output.toMobile(mobile.id, "You can't go that way.");
  87. return true;
  88. }
  89. u(room, mobile, input) {
  90. return this.up(room, mobile, input);
  91. }
  92. down(room, mobile, input) {
  93. if(typeof room.down == 'function') {
  94. return room.down(room, mobile, input);
  95. }
  96. libs.Output.toMobile(mobile.id, "You can't go that way.");
  97. return true;
  98. }
  99. d(room, mobile, input) {
  100. return this.down(room, mobile, input);
  101. }
  102. enter(room, mobile, input) {
  103. if(typeof room.enter == 'function') {
  104. return room.enter(room, mobile, input);
  105. }
  106. libs.Output.toMobile(mobile.id, "You can't go that way.");
  107. return true;
  108. }
  109. leave(room, mobile, input) {
  110. if(typeof room.leave == 'function') {
  111. return room.leave(room, mobile, input);
  112. }
  113. libs.Output.toMobile(mobile.id, "You can't go that way.");
  114. return true;
  115. }
  116. mud_getErrorMessage() {
  117. return "You stumble slightly as your legs vanish for a split-second and then reappear.";
  118. }
  119. };