builder.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. class Builder {
  2. help(room, mobile, input) {
  3. if(input.join(" ").trim().length == 0) {
  4. libs.Output.toMobile(mobile.id, "Builder commands:");
  5. libs.Output.toMobile(mobile.id, "reload, spawn, locate, summon, derez, see, warp");
  6. return false;
  7. }
  8. var topic = input.join(" ").trim();
  9. switch(topic) {
  10. case "builder":
  11. libs.Output.toMobile(mobile.id, "As a builder, you have some tremendous access to the server instance. You can control what is spawned, you can see the exceptions thrown, and you can reload elements like rooms, mobiles and items.\r\n");
  12. libs.Output.toMobile(mobile.id, "But being a builder means more than that. It means your job is to provide a fun and rewarding experience for the players. Every thing you do should be considered with the welfare of the players in mind. \"Will this be fun?\" \"Will someone be upset by this?\" \"Who benefits and who loses by this change?\"\r\n");
  13. libs.Output.toMobile(mobile.id, "Your responsibilities as a builder are to the health and code-quality of the server, but also to the health and quality of play that the users here will experience. Use your power wisely to maximize fun, and your players will love you for it.");
  14. return true;
  15. case "reload":
  16. libs.Output.toMobile(mobile.id, "* reload room [RoomName] - reloads a specific room");
  17. libs.Output.toMobile(mobile.id, "* reload item [ItemName] - reloads a specific item");
  18. libs.Output.toMobile(mobile.id, "* reload mobile [MobileName] - reloads a specific mobile");
  19. return true;
  20. case "spawn":
  21. libs.Output.toMobile(mobile.id, "* spawn room [RoomName] - spawns a specific room");
  22. libs.Output.toMobile(mobile.id, "* spawn item [ItemName] - spawns instance of this item in your inventory");
  23. libs.Output.toMobile(mobile.id, "* spawn mobile [MobileName] - spawns instance of this mobile in the current room");
  24. return true;
  25. case "derez":
  26. libs.Output.toMobile(mobile.id, "* derez item [itemKeyword] - deletes instance of this item in your inventory");
  27. libs.Output.toMobile(mobile.id, "* derez mobile [itemKeyword] - deletes instance of this mobile in the current room");
  28. return true;
  29. case "see":
  30. libs.Output.toMobile(mobile.id, "* see room - displays the internal data of the current room");
  31. libs.Output.toMobile(mobile.id, "* see item [itemKeyword] - displays the internal data of an item");
  32. libs.Output.toMobile(mobile.id, "* see mobile [mobileKeyword]- displays the internal data of a mobile");
  33. return true;
  34. case "warp":
  35. libs.Output.toMobile(mobile.id, "* warp [RoomName] - warp your character to a specific room");
  36. return true;
  37. case "locate":
  38. libs.Output.toMobile(mobile.id, "* locate item [ItemName]- list out all item instances");
  39. libs.Output.toMobile(mobile.id, "* locate mobile [MobileName]- list out all mobile instances");
  40. libs.Output.toMobile(mobile.id, "* locate all- list out all instances and where they are");
  41. return true;
  42. case "locate":
  43. libs.Output.toMobile(mobile.id, "* summon item [ItemInstanceId]- remove the item from it's current location and place it in your inventory");
  44. libs.Output.toMobile(mobile.id, "* summon mobile [MobileInstanceId]- remove the mobile from it's current location and place it in your current room");
  45. return true;
  46. }
  47. }
  48. reload(room, mobile, input) {
  49. switch(input[0]) {
  50. case "room":
  51. return this.mud_reloadRoom(room, mobile, input);
  52. case "item":
  53. return this.mud_reloadItem(room, mobile, input);
  54. case "mobile":
  55. return this.mud_reloadMobile(room, mobile, input);
  56. default:
  57. return this.help(room, mobile, ["reload"]);
  58. }
  59. }
  60. mud_reloadRoom(room, mobile, input) {
  61. input.shift();
  62. var roomName = input.join(" ").trim();
  63. libs.Output.toMobile(mobile.id, "Preparing to reload room " + roomName);
  64. try {
  65. delete require.cache[require.resolve(config.worldDataPath +'/rooms')];
  66. rooms = require(config.worldDataPath +'/rooms');
  67. var targetRoom = world.mud_getRoom(roomName);
  68. var fileName = (new rooms[roomName]()).filename;
  69. delete require.cache[require.resolve(config.worldDataPath +'/rooms/' + fileName)];
  70. rooms[roomName] = require(config.worldDataPath +'/rooms/' + fileName);
  71. var tempRoom = new rooms[roomName]();
  72. if(targetRoom != null) {
  73. tempRoom.items = targetRoom.items;
  74. tempRoom.mobiles = targetRoom.mobiles;
  75. }
  76. session.rooms[roomName] = tempRoom;
  77. libs.Output.toMobile(mobile.id, "Room " + roomName + " reloaded.");
  78. libs.Output.toRoom(roomName, "The room briefly fades from reality and then snaps back to focus.", mobile);
  79. libs.Output.toServer("Room " + roomName + " reloaded.\n");
  80. } catch(error) {
  81. libs.Output.toMobile(mobile.id, "Error when attempting to reload room " + roomName + ".\n");
  82. libs.Output.toMobile(mobile.id, error.code + " " + error.stack +"\n");
  83. }
  84. return true;
  85. }
  86. mud_reloadItem(room, mobile, input) {
  87. input.shift();
  88. var itemName = input.join(" ").trim();
  89. libs.Output.toMobile(mobile.id, "Preparing to reload item " + itemName);
  90. try {
  91. delete require.cache[require.resolve(config.worldDataPath +'/items')];
  92. items = require(config.worldDataPath +'/items');
  93. var fileName = (new items[itemName]()).filename;
  94. delete require.cache[require.resolve(config.worldDataPath +'/items/' + fileName)];
  95. items[itemName] = require(config.worldDataPath +'/items/' + fileName);
  96. for(var itemIndex in session.items) {
  97. var itemInstance = session.items[itemIndex];
  98. if(itemInstance.constructor.name == itemName) {
  99. libs.Output.toMobile(mobile.id, "Replacing " + itemName + " instance " + itemInstance.id + ".");
  100. var tempItem = new items[itemName]();
  101. tempItem.id = itemInstance.id;
  102. session.items[tempItem.id] = tempItem;
  103. }
  104. }
  105. libs.Output.toMobile(mobile.id, "Item " + itemName + " reloaded.");
  106. libs.Output.toServer("Item " + itemName + " reloaded.\n");
  107. } catch (error) {
  108. libs.Output.toMobile(mobile.id, "Error when attempting to reload item "+itemName+".\n");
  109. libs.Output.toMobile(mobile.id, error.code + " " + error.stack +"\n");
  110. }
  111. return true;
  112. }
  113. mud_reloadMobile(room, mobile, input) {
  114. input.shift();
  115. var mobileName = input.join(" ").trim();
  116. libs.Output.toMobile(mobile.id, "Preparing to reload mobile " + mobileName);
  117. try {
  118. delete require.cache[require.resolve(config.worldDataPath +'/mobiles')];
  119. mobiles = require(config.worldDataPath +'/mobiles');
  120. var fileName = (new mobiles[mobileName]()).filename;
  121. delete require.cache[require.resolve(config.worldDataPath +'/mobiles/' + fileName)];
  122. mobiles[mobileName] = require(config.worldDataPath +'/mobiles/' + fileName);
  123. for(var index in session.mobiles) {
  124. var mobileInstance = session.mobiles[index];
  125. if(mobileInstance.constructor.name == mobileName) {
  126. var tempMobile = new mobiles[mobileName]();
  127. libs.Output.toMobile(mobile.id, "Replacing " + mobileName + " instance " + mobileInstance.id + ".");
  128. for (var property in mobileInstance) {
  129. if (mobileInstance.hasOwnProperty(property)) {
  130. tempMobile[property] = mobileInstance[property];
  131. }
  132. }
  133. if(tempMobile.hasOwnProperty('login')) {
  134. tempMobile.login.player = tempMobile;
  135. }
  136. session.mobiles[tempMobile.id] = tempMobile;
  137. libs.Output.toMobile(tempMobile.id, "You feel your whole body vibrate slightly as your reality changes.");
  138. }
  139. }
  140. libs.Output.toMobile(mobile.id, "Mobile " + mobileName + " reloaded.");
  141. libs.Output.toServer("Mobile " + mobileName + " reloaded.");
  142. } catch (error) {
  143. libs.Output.toMobile(mobile.id, "Error when attempting to reload mobile "+mobileName+".");
  144. libs.Output.toMobile(mobile.id, error.code + " " + error.stack +"\n");
  145. }
  146. return true;
  147. }
  148. spawn(room, mobile, input) {
  149. var type = input[0];
  150. switch(type) {
  151. case "room":
  152. input.shift();
  153. var roomName = input.join(" ").trim();
  154. libs.Output.toMobile(mobile.id, "Spawning room " + roomName + ".");
  155. this.mud_spawnRoom(roomName).id;
  156. return true;
  157. case "item":
  158. input.shift();
  159. var itemName = input.join(" ").trim();
  160. libs.Output.toMobile(mobile.id, "Spawning item " + itemName + " in inventory.");
  161. world.mud_addItemToMobile(mobile.id, this.mud_spawnItem(itemName).id);
  162. return true;
  163. case "mobile":
  164. input.shift();
  165. var mobileName = input.join(" ").trim();
  166. libs.Output.toMobile(mobile.id, "Spawning mobile " + mobileName + ".");
  167. world.mud_addMobileToRoom(mobile.roomId, this.mud_spawnMobile(mobileName).id);
  168. return true;
  169. default:
  170. this.help(room, mobile, ["spawn"]);
  171. return true;
  172. }
  173. }
  174. mud_spawnItem(itemName) {
  175. var tempItem = new items[itemName]();
  176. tempItem.id = session.itemIds++;
  177. session.items[tempItem.id] = tempItem;
  178. return tempItem;
  179. }
  180. mud_spawnMobile(mobileName) {
  181. var tempMobile = new mobiles[mobileName]();
  182. tempMobile.id = session.mobileIds++;
  183. session.mobiles[tempMobile.id] = tempMobile;
  184. return tempMobile;
  185. }
  186. mud_spawnRoom(roomName) {
  187. var tempRoom = new rooms[roomName]();
  188. session.rooms[tempRoom.id] = tempRoom;
  189. return tempRoom;
  190. }
  191. see(room, mobile, input) {
  192. switch(input.shift()) {
  193. case "room":
  194. this.mud_seeRoom(room, mobile, input);
  195. return true;
  196. case "item":
  197. this.mud_seeItem(room, mobile, input);
  198. return true;
  199. case "mobile":
  200. this.mud_seeMobile(room, mobile, input);
  201. return true;
  202. default:
  203. this.help(room, mobile, ["see"]);
  204. return true;
  205. }
  206. }
  207. mud_seeRoom(room, mobile, input) {
  208. libs.Output.toMobile(mobile.id, "Peering behind the veil:");
  209. libs.Output.toMobile(mobile.id, JSON.stringify(room, null, "\t").replace(/\n/g, "\r\n"));
  210. }
  211. mud_seeItem(room, mobile, input) {
  212. libs.Output.toMobile(mobile.id, "Peering behind the veil:");
  213. var inventoryItem = libs.Utilities.getSpecific(input.join(" "), mobile.items, session.items);
  214. if(inventoryItem != null) {
  215. libs.Output.toMobile(mobile.id, JSON.stringify(inventoryItem, null, "\t").replace(/\n/g, "\r\n"));
  216. return true;
  217. }
  218. var roomItem = libs.Utilities.getSpecific(input.join(" "), room.items, session.items);
  219. if(roomItem != null) {
  220. libs.Output.toMobile(mobile.id, JSON.stringify(roomItem, null, "\t").replace(/\n/g, "\r\n"));
  221. return true;
  222. }
  223. libs.Output.toMobile(mobile.id, "That is not a valid item.");
  224. return true;
  225. }
  226. mud_seeMobile(room, mobile, input) {
  227. libs.Output.toMobile(mobile.id, "Peering behind the veil:");
  228. var roomMobile = libs.Utilities.getSpecific(input.join(" "), room.mobiles, session.mobiles);
  229. if(roomMobile != null) {
  230. var tempRoomMobile = Object.assign({}, roomMobile);
  231. if(tempRoomMobile.hasOwnProperty('socket')) {
  232. tempRoomMobile.socket = "[socket]";
  233. }
  234. if(tempRoomMobile.hasOwnProperty('login')) {
  235. tempRoomMobile.login = "[login]";
  236. }
  237. libs.Output.toMobile(mobile.id, JSON.stringify(tempRoomMobile, null, "\t").replace(/\n/g, "\r\n"));
  238. return true;
  239. } else if (input.length == 0) {
  240. var tempRoomMobile = Object.assign({}, mobile);
  241. if(tempRoomMobile.hasOwnProperty('socket')) {
  242. tempRoomMobile.socket = "[socket]";
  243. }
  244. if(tempRoomMobile.hasOwnProperty('login')) {
  245. tempRoomMobile.login = "[login]";
  246. }
  247. libs.Output.toMobile(mobile.id, JSON.stringify(tempRoomMobile, null, "\t").replace(/\n/g, "\r\n"));
  248. return true;
  249. }
  250. libs.Output.toMobile(mobile.id, "That is not a valid mobile.");
  251. return true;
  252. }
  253. warp(room, mobile, input) {
  254. if(input.length == 0) {
  255. this.help(room, mobile, ["warp"]);
  256. return true;
  257. }
  258. var roomName = input.shift().trim();
  259. if(session.rooms[roomName] != null) {
  260. world.mud_moveMobileFromRoom(mobile.roomId, mobile.id);
  261. world.mud_moveMobileToRoom(roomName, mobile.id);
  262. return true;
  263. }
  264. libs.Output.toMobile(mobile.id, "That is not a valid room to warp to.");
  265. return true;
  266. }
  267. derez(room, mobile, input) {
  268. switch(input.shift()) {
  269. case "item":
  270. this.mud_derezItem(room, mobile, input);
  271. return true;
  272. case "mobile":
  273. this.mud_derezMobile(room, mobile, input);
  274. return true;
  275. default:
  276. this.help(room, mobile, ["derez"]);
  277. return true;
  278. }
  279. }
  280. mud_derezItem(room, mobile, input) {
  281. var roomItem = libs.Utilities.getSpecific(input.join(" "), room.items, session.items);
  282. if(roomItem != null) {
  283. libs.Output.toRoom(room.id, roomItem.mud_getName() + " dissolves into nothingness.");
  284. world.mud_removeItemFromRoom(room.id, roomItem.id);
  285. world.mud_destroyItem(roomItem.id);
  286. return true;
  287. }
  288. var mobileItem = libs.Utilities.getSpecific(input.join(" "), mobile.items, session.items);
  289. if(mobileItem != null) {
  290. libs.Output.toRoom(room.id, mobileItem.mud_getName() + " dissolves into nothingness.");
  291. world.mud_removeItemFromMobile(mobile.id, mobileItem.id);
  292. world.mud_destroyItem(mobileItem.id);
  293. return true;
  294. }
  295. libs.Output.toMobile(mobile.id, "That isn't here.");
  296. return true;
  297. }
  298. mud_derezMobile(room, mobile, input) {
  299. var roomMobile = libs.Utilities.getSpecific(input.join(" "), room.mobiles, session.mobiles);
  300. if(roomMobile != null) {
  301. for(var itemIdIndex in roomMobile.items) {
  302. var otherItem = world.mud_getItem(roomMobile.items[itemIdIndex]);
  303. libs.Output.toRoom(room.id, otherItem.mud_getName() + " dissolves into nothingness.");
  304. world.mud_removeItemFromMobile(roomMobile.id, otherItem.id);
  305. world.mud_destroyItem(otherItem.id);
  306. }
  307. libs.Output.toRoom(room.id, roomMobile.name + " dissolves into nothingness.");
  308. world.mud_removeMobileFromRoom(room.id, roomMobile.id);
  309. world.mud_destroyMobile(roomMobile.id);
  310. return true;
  311. }
  312. libs.Output.toMobile(mobile.id, "That isn't here.");
  313. return true;
  314. }
  315. locate(room, mobile, input) {
  316. switch(input.shift()) {
  317. case "item":
  318. this.mud_locateItem(room, mobile, input);
  319. return true;
  320. case "mobile":
  321. this.mud_locateMobile(room, mobile, input);
  322. return true;
  323. case "all":
  324. this.mud_listAll(room, mobile, input);
  325. return true;
  326. default:
  327. this.help(room, mobile, ["locate"]);
  328. return true;
  329. }
  330. }
  331. mud_locateItem(room, mobile, input) {
  332. var itemName = input.shift();
  333. var instances = [];
  334. for(var roomName in session.rooms) {
  335. var otherRoom = session.rooms[roomName];
  336. for(var itemIdIndex in otherRoom.items) {
  337. var otherItem = world.mud_getItem(otherRoom.items[itemIdIndex]);
  338. if(itemName == otherItem.constructor.name) {
  339. libs.Output.toMobile(mobile.id, "Instance " + otherItem.id + " in " + otherRoom.id);
  340. instances.push(otherItem.id);
  341. }
  342. }
  343. }
  344. for(var mobileId in session.mobiles) {
  345. var otherMobile = session.mobiles[mobileId];
  346. for(var itemIdIndex in otherMobile.items) {
  347. var otherItem = world.mud_getItem(otherMobile.items[itemIdIndex]);
  348. if(itemName == otherItem.constructor.name) {
  349. libs.Output.toMobile(mobile.id, "Instance " + otherItem.id + " held by " + otherMobile.constructor.name + ":" + otherMobile.id);
  350. instances.push(otherItem.id);
  351. }
  352. }
  353. }
  354. for(var itemId in session.items) {
  355. var otherItem = session.items[itemId];
  356. if(itemName == otherItem.constructor.name && instances.indexOf(otherItem.id) == -1) {
  357. libs.Output.toMobile(mobile.id, "Instance " + otherItem.id + " is lost.");
  358. instances.push(otherMobile.id);
  359. }
  360. }
  361. if(instances.length == 0) {
  362. libs.Output.toMobile(mobile.id, "There are no " + itemName + " item instances.");
  363. }
  364. }
  365. mud_locateMobile(room, mobile, input) {
  366. var mobileName = input.shift();
  367. var instances = [];
  368. for(var roomName in session.rooms) {
  369. var otherRoom = session.rooms[roomName];
  370. for(var mobileIdIndex in otherRoom.mobiles) {
  371. var otherMobile = world.mud_getMobile(otherRoom.mobiles[mobileIdIndex]);
  372. if(mobileName == otherMobile.constructor.name) {
  373. libs.Output.toMobile(mobile.id, "Instance " + otherMobile.id + " in " + otherRoom.id);
  374. instances.push(otherMobile.id);
  375. }
  376. }
  377. }
  378. for(var mobileId in session.mobiles) {
  379. var otherMobile = session.mobiles[mobileId];
  380. if(mobileName == otherMobile.constructor.name && instances.indexOf(otherMobile.id) == -1) {
  381. libs.Output.toMobile(mobile.id, "Instance " + otherMobile.id + " is lost.");
  382. instances.push(otherMobile.id);
  383. }
  384. }
  385. if(instances.length == 0) {
  386. libs.Output.toMobile(mobile.id, "There are no " + mobileName + " mobile instances.");
  387. }
  388. }
  389. mud_listAll(room, mobile, input) {
  390. var itemInstances = [];
  391. for(var roomName in session.rooms) {
  392. var otherRoom = session.rooms[roomName];
  393. for(var itemIdIndex in otherRoom.items) {
  394. var otherItem = world.mud_getItem(otherRoom.items[itemIdIndex]);
  395. libs.Output.toMobile(mobile.id, otherItem.constructor.name + ":" + otherItem.id + " in " + otherRoom.id);
  396. itemInstances.push(otherItem.id);
  397. }
  398. }
  399. for(var mobileId in session.mobiles) {
  400. var otherMobile = session.mobiles[mobileId];
  401. for(var itemIdIndex in otherMobile.items) {
  402. var otherItem = world.mud_getItem(otherMobile.items[itemIdIndex]);
  403. libs.Output.toMobile(mobile.id, otherItem.constructor.name + ":" + otherItem.id + " held by " + otherMobile.constructor.name + ":" + otherMobile.id);
  404. itemInstances.push(otherItem.id);
  405. }
  406. }
  407. for(var itemId in session.items) {
  408. var otherItem = session.items[itemId];
  409. if(itemInstances.indexOf(otherItem.id) == -1) {
  410. libs.Output.toMobile(mobile.id, otherItem.constructor.name + ":" + otherItem.id + " is lost.");
  411. itemInstances.push(otherMobile.id);
  412. }
  413. }
  414. var mobileInstances = [];
  415. for(var roomName in session.rooms) {
  416. var otherRoom = session.rooms[roomName];
  417. for(var mobileIdIndex in otherRoom.mobiles) {
  418. var otherMobile = world.mud_getMobile(otherRoom.mobiles[mobileIdIndex]);
  419. libs.Output.toMobile(mobile.id, otherMobile.constructor.name + ":" + otherMobile.id + " in " + otherRoom.id);
  420. mobileInstances.push(otherMobile.id);
  421. }
  422. }
  423. for(var mobileId in session.mobiles) {
  424. var otherMobile = session.mobiles[mobileId];
  425. if(mobileInstances.indexOf(otherMobile.id) == -1) {
  426. libs.Output.toMobile(mobile.id, otherMobile.constructor.name + ":" + otherMobile.id + " is lost.");
  427. mobileInstances.push(otherMobile.id);
  428. }
  429. }
  430. }
  431. summon(room, mobile, input) {
  432. switch(input.shift()) {
  433. case "item":
  434. this.mud_summonItem(room, mobile, input);
  435. return true;
  436. case "mobile":
  437. this.mud_summonMobile(room, mobile, input);
  438. return true;
  439. default:
  440. this.help(room, mobile, ["summon"]);
  441. return true;
  442. }
  443. }
  444. mud_summonItem(room, mobile, input) {
  445. var itemInstance = parseInt(input.shift());
  446. var item = world.mud_getItem(itemInstance);
  447. if(item == null) {
  448. libs.Output.toMobile(mobile.id, "That is not a valid item instance.");
  449. return;
  450. }
  451. for(var roomName in session.rooms) {
  452. var otherRoom = session.rooms[roomName];
  453. if(otherRoom.items.indexOf(itemInstance) != -1) {
  454. world.mud_removeItemFromRoom(otherRoom.id, itemInstance);
  455. libs.Output.toRoom(otherRoom.id, "A pocket dimension opens up and swallows " + item.mud_getName() + ".",);
  456. }
  457. }
  458. for(var mobileId in session.mobiles) {
  459. var otherMobile = session.mobiles[mobileId];
  460. if(otherMobile.items.indexOf(itemInstance) != -1) {
  461. world.mud_removeItemFromMobile(otherMobile.id, itemInstance);
  462. libs.Output.toMobile(otherMobile.id, "A portal to a pocket dimension opens briefly and swallows " + item.mud_getName() + ".");
  463. }
  464. }
  465. world.mud_addItemToMobile(mobile.id, itemInstance);
  466. libs.Output.toMobile(mobile.id, "A portal to a pocket dimension opens and you get " + item.mud_getName() + ".");
  467. }
  468. mud_summonMobile(room, mobile, input) {
  469. var mobileInstance = parseInt(input.shift());
  470. var targetMobile = world.mud_getMobile(mobileInstance);
  471. if(targetMobile == null) {
  472. libs.Output.toMobile(mobile.id, "That is not a valid mobile instance.");
  473. return;
  474. }
  475. for(var roomName in session.rooms) {
  476. var otherRoom = session.rooms[roomName];
  477. if(otherRoom.mobiles.indexOf(mobileInstance) != -1) {
  478. world.mud_removeMobileFromRoom(otherRoom.id, mobileInstance);
  479. libs.Output.toRoom(otherRoom.id, "A pocket dimension opens up and swallows " + targetMobile.mud_getName() + ".");
  480. }
  481. }
  482. world.mud_addMobileToRoom(room.id, mobileInstance);
  483. libs.Output.toRoom(room.id, "A pocket dimension opens up and dumps " + targetMobile.mud_getName() + " here.");
  484. }
  485. }
  486. module.exports = new Builder();