{"_id":"@brisberg/screeps-server-mockup","_rev":"8-45f8c262d94e3abf841a25a7ba10a7e1","name":"@brisberg/screeps-server-mockup","dist-tags":{"latest":"1.6.6","beta":"1.6.4"},"versions":{"1.6.0":{"name":"@brisberg/screeps-server-mockup","main":"./src/main.js","types":"./dist/src/main.d.ts","license":"MIT","repository":{"type":"git","url":"https://github.com/screepers/screeps-server-mockup"},"version":"1.6.0","scripts":{"build":"tsc","coverage":"tsc && nyc mocha dist/test --ui tdd --exit","lint":"eslint \"src/**/*.ts\" \"test/**/*.ts\" \"utils/**/*.ts\"","prepare":"yarn run build","prepublishOnly":"yarn test && yarn run lint","test":"tsc && mocha dist/test --ui tdd --exit"},"dependencies":{"@screeps/common":"github:brisberg/common#no-storage-restart","@types/fs-extra-promise":"^1.0.8","@types/lodash":"^4.14.149","@types/screeps":"^3.0.0","fs-extra-promise":"^1.0.1","lodash":"^4.17.15","screeps":"^4.1.5"},"peerDependencies":{"@screeps/common":"^2.13.2","@screeps/driver":"^5.1.0","@screeps/engine":"^4.1.2"},"devDependencies":{"@types/mocha":"^7.0.1","@types/node":"10.17.16","@typescript-eslint/eslint-plugin":"^2.21.0","@typescript-eslint/parser":"^2.21.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-airbnb-typescript":"^7.0.0","eslint-plugin-import":"^2.20.0","mocha":"^7.0.0","npm-cli-login":"^0.1.1","nyc":"^15.0.0","typescript":"^3.8.2"},"description":"_Based on https://github.com/screepers/screeps-server-test_","licenseText":"Copyright 2017-2020 screeps-server-mockup contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","_id":"@brisberg/screeps-server-mockup@1.6.0","dist":{"shasum":"b6b29c3e077e7fcd84c7ff9ce4853ce5f0c5e861","integrity":"sha512-KiZH5COLQAdzOwDIOMlc4xxmVTl+nsuXEebz5HFXZelJQKQL1SFKZrTDXZTEkSxXUixDHBbngkbY8O5qikOtHg==","tarball":"https://registry.npmjs.org/@brisberg/screeps-server-mockup/-/screeps-server-mockup-1.6.0.tgz","fileCount":35,"unpackedSize":394992,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe9UYxCRA9TVsSAnZWagAAm8QQAKQuuvznfN+X6FH2/fDb\n9ZDFkVgdsBCGv2IZyD04F/uwSqZd8IREA4bUk6WRYMXWJFAq0JSY33nCKXBQ\nv9V/RTUOPe5iQk6YvuiDIe/WKK9vL+hM+oz48UyyvVgssIEXnnlRln5PTXi8\nsOXey/1aH7epuYkxJYCyx1X+RILM7m3r6ezmvjoaacJDpGfyuW6/IpSxsrPy\nbP7mXu4r81G/Ywx9/cWx9T1BrEXas/Ondz6uQdo/3toiw6OleakvO6gx5gH1\n5cMj0wXEU7JDGAOf9T7nvpkfpmx67Y1G1cTN2ktjJf0v4Uhj52eNuUpIpXw0\n7vZ/5D+8An9qtawXNA2mgrGFbLmH8l/Z5JnQdZzhcS3ylxF8HwuUC77NCyy5\nNIu7jLVCNfeiUxgCOx54bN8q/rW3vkL1vpzFxRQaeO1HkEwi0yaA96G1Ij/7\nX1RBcpvQg0aJ9PV97oEYeKlNgNe24pOBSThfE77WnGxTphnSpmiPVSFEm+Qz\ntpMi0teWMoF+58OoRkZMmoWHnfWa/qYPi+l0bOlTbkwOFUO7NEM2cfzVlcID\n+fzsI+MOxt+uVWZTlWreQuHefpSYaPMG8TPCaNKBwCcpYGBoYOdqzKxUP58+\n4WoZ/YRx2WT5brEOasVYRVOPTdVeSDk1FE/aDwNl/Rk8v390NmKAxOvkO/tP\niDP6\r\n=JScX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDs5O232RPmC+skRyj54SMD0xovg+ATY2+50q54hX/rcQIgI6VQLwTYd6jdmB3TJkvBvExR3l0kDclAD2bVBV+Wc+s="}]},"maintainers":[{"name":"brisberg","email":"brandon.risberg@gmail.com"}],"_npmUser":{"name":"brisberg","email":"brandon.risberg@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/screeps-server-mockup_1.6.0_1593132593544_0.15526338403606355"},"_hasShrinkwrap":false},"1.6.1":{"name":"@brisberg/screeps-server-mockup","main":"./dist/src/main.js","types":"./dist/src/main.d.ts","license":"MIT","repository":{"type":"git","url":"https://github.com/screepers/screeps-server-mockup"},"version":"1.6.1","scripts":{"build":"tsc","coverage":"tsc && nyc mocha dist/test --ui tdd --exit","lint":"eslint \"src/**/*.ts\" \"test/**/*.ts\" \"utils/**/*.ts\"","prepare":"yarn run build","prepublishOnly":"yarn test && yarn run lint","test":"tsc && mocha dist/test --ui tdd --exit"},"dependencies":{"@screeps/common":"github:brisberg/common#no-storage-restart","@types/fs-extra-promise":"^1.0.8","@types/lodash":"^4.14.149","@types/screeps":"^3.0.0","fs-extra-promise":"^1.0.1","lodash":"^4.17.15","screeps":"^4.1.5"},"peerDependencies":{"@screeps/common":"^2.13.2","@screeps/driver":"^5.1.0","@screeps/engine":"^4.1.2"},"devDependencies":{"@types/mocha":"^7.0.1","@types/node":"10.17.16","@typescript-eslint/eslint-plugin":"^2.21.0","@typescript-eslint/parser":"^2.21.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-airbnb-typescript":"^7.0.0","eslint-plugin-import":"^2.20.0","mocha":"^7.0.0","npm-cli-login":"^0.1.1","nyc":"^15.0.0","typescript":"^3.8.2"},"readmeFilename":"README.md","readme":"# screeps-server-mockup\n\n_Based on https://github.com/screepers/screeps-server-test_\n\n\n## Private server package for unit tests\n\nThis is a project that runs the screeps private server one tick at a time, allowing to easily check\ndata in between ticks and opens the possibilities for automatic testings in a reproductible\nenvironment.\n\n\n## Requirements\n\nThese are necessary to build the internal [Screeps](https://github.com/screeps/screeps) server.\n\n * Node.js 10 LTS or higher\n * Python (for node-gyp)\n * Build tools (`apt install build-essential` for Ubuntu, [Visual Studio](https://www.visualstudio.com/vs/) for Windows, etc) \n\n## Usage\n\n1. Install via npm or yarn\n2. Write a test script (see `examples` and `tests` folders for details)\n3. Run the test script\n\n\n## Script example (simple)\n\n``` javascript\nconst _ = require('lodash');\nconst { ScreepsServer, TerrainMatrix } = require('screeps-server-mockup');\n\n// Initialize server\nconst server = new ScreepsServer();\nawait server.world.reset();     // reset world but add invaders and source keepers users\nawait server.world.stubWorld(); // create a tub world composed of 9 rooms with sources and controller\n\n// Add a bot in W0N0\nconst modules = {\n    main: `module.exports.loop = function() {\n        console.log('Tick!',Game.time);\n        const directions = [TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT];\n        _.sample(Game.spawns).createCreep([MOVE]);\n        _.each(Game.creeps, c => c.move(_.sample(directions)));\n    };`\n};\nconst bot = await server.world.addBot({ username: 'bot', room: 'W0N1', x: 15, y: 15, modules });\n\n// Start server and run a tick\nawait server.start();\nawait server.tick();\n```\n\n\n## Script example (complete)\n\n``` javascript\nconst _ = require('lodash');\nconst { ScreepsServer, TerrainMatrix } = require('screeps-server-mockup');\n\n// Initialize server\nconst server = new ScreepsServer();\nawait server.world.reset(); // reset world but add invaders and source keepers users\n\n// Prepare the terrain for a new room\nconst terrain = new TerrainMatrix();\nconst walls = [[10, 10], [10, 40], [40, 10], [40, 40]];\n_.each(walls, ([x, y]) => terrain.set(x, y, 'wall'));\n\n// Create a new room with terrain and basic objects\nawait server.world.addRoom('W0N1');\nawait server.world.setTerrain('W0N1', terrain);\nawait server.world.addRoomObject('W0N1', 'controller', 10, 10, { level: 0 });\nawait server.world.addRoomObject('W0N1', 'source', 10, 40, { energy: 1000, energyCapacity: 1000, ticksToRegeneration: 300 });\nawait server.world.addRoomObject('W0N1', 'mineral', 40, 40, { mineralType: 'H', density: 3, mineralAmount: 3000 });\n\n// Add a bot in W0N1\nconst modules = {\n    main: `module.exports.loop = function() {\n        console.log('Tick!',Game.time);\n        const directions = [TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT];\n        _.sample(Game.spawns).createCreep([MOVE]);\n        _.each(Game.creeps, c => c.move(_.sample(directions)));\n    };`\n};\nconst bot = await server.world.addBot({ username: 'bot', room: 'W0N1', x: 25, y: 25, modules });\n\n// Print console logs every tick\nbot.on('console', (logs, results, userid, username) => {\n    _.each(logs, line => console.log(`[console|${username}]`, line));\n});\n\n// Start server and run several ticks\nawait server.start();\nfor (let i = 0; i < 10; i++) {\n    console.log('[tick]', await server.world.gameTime);\n    await server.tick();\n    _.each(await bot.newNotifications, ({ message }) => console.log('[notification]', message));\n    console.log('[memory]', await bot.memory, '\\n');\n}\n\n// Stop server and disconnect storage\nserver.stop();\nprocess.exit(); // required as there is no way to properly shutdown storage :(\n```\n\nEach tick should output something like:\n\n>[tick] 1\n\n>[console|bot] Tick! 1\n\n>[memory] {\"creeps\":{\"Arianna\":{}}}\n\n\n## Tests\n\n```\nyarn lint // or npm run lint\nyarn test // or npm run test\n```\n","description":"_Based on https://github.com/screepers/screeps-server-test_","licenseText":"Copyright 2017-2020 screeps-server-mockup contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","_id":"@brisberg/screeps-server-mockup@1.6.1","dist":{"shasum":"afc687884d6ba4942c8c00501d3a124de7318b03","integrity":"sha512-FuEkd1LNBLZ4yc1TuC1r7bpTvcuTNLDdM2d8sJ4ya1IGgH+e2hIsLgNjujYMisyg2gW1SS1KZb970X5/Y+sU/g==","tarball":"https://registry.npmjs.org/@brisberg/screeps-server-mockup/-/screeps-server-mockup-1.6.1.tgz","fileCount":22,"unpackedSize":34674,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe9XjaCRA9TVsSAnZWagAAGcEP/2Vlm7ldq1rgDsIkAnzp\nAqUeBFS8b2ONhJTFlR0g61gjKimfri/+O/lgR2mvjI/Eaaa2YvTXUfWehaIp\nNVo8nhmhFL0pjw2Jph3kdCBYEakyN70ZLLrVZ0dbrHhJvuqE7LtJcw/NnxWZ\njCjr9d1cOZlm6zylcuYyDieis2Qbyql4gabMedIQlkKOuqecLvXyjLBz0Z1Y\nE3ePVbBHUVU+GrpXxVBko9N9vX0aK5zasp3j1+I3Hg2Basmm5LwxDCxvk2ZL\nybtBKuwQ7rknRrmtOvQZUhqKQXa6c1xTgnUHizfZ6noy1FRC1pwySJiITiJg\nnFHwoAtmUQy3VCcw8WdYdiLk9UvnwTqysQMNbfPoH3/xnDvtoPEP7/B0fJaV\nyLsziADiFHdHBivAs2Dcx0zunC1KXL7/JusyPZhJKQ3ncDQhLd2kBqbgJjb0\nIzTnGbtovTVLu/6rh6gYxid41kCocSKPHvmv+IgK8DB0WNSEg7ILbvQP3zOc\n81QaS3MAEyxzWj9Se7zLH6OaW0Wt275rSVVGrUdvKrBuwgnKmJbCojdNGN5A\nvKsqlfh73rZydqYlt3prXfFZFny/jmL9xuEoXfFk9XODA5hQkHB0uwIbKHcs\n9e/EYdVHxKgNG0gXodYrzvh9QBIZ0eTmdfJ31AZzs2AkBFABR3H4eRL6mTwO\nZiVy\r\n=+RlU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCXaEQdLdKoQ5cqK1bgm5l+z0B5alXZCuOyGoMeblk9HgIhALUy6yAYr1h024qZ3ZxxarRkOXemcEeLMch9ScHOtU2R"}]},"maintainers":[{"name":"brisberg","email":"brandon.risberg@gmail.com"}],"_npmUser":{"name":"brisberg","email":"brandon.risberg@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/screeps-server-mockup_1.6.1_1593145562301_0.10171627260978933"},"_hasShrinkwrap":false},"1.6.2":{"name":"@brisberg/screeps-server-mockup","main":"./dist/src/main.js","types":"./dist/src/main.d.ts","license":"MIT","repository":{"type":"git","url":"https://github.com/screepers/screeps-server-mockup"},"version":"1.6.2","scripts":{"build":"tsc","coverage":"tsc && nyc mocha dist/test --ui tdd --exit","lint":"eslint \"src/**/*.ts\" \"test/**/*.ts\" \"utils/**/*.ts\"","prepare":"yarn run build","prepublishOnly":"yarn test && yarn run lint","test":"tsc && mocha dist/test --ui tdd --exit"},"dependencies":{"@screeps/common":"github:brisberg/common#no-storage-restart","@types/fs-extra-promise":"^1.0.8","@types/lodash":"^4.14.149","@types/screeps":"^3.0.0","fs-extra-promise":"^1.0.1","lodash":"^4.17.15","screeps":"^4.1.5"},"peerDependencies":{"@screeps/common":"^2.13.2","@screeps/driver":"^5.1.0","@screeps/engine":"^4.1.2"},"devDependencies":{"@types/mocha":"^7.0.1","@types/node":"10.17.16","@typescript-eslint/eslint-plugin":"^2.21.0","@typescript-eslint/parser":"^2.21.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-airbnb-typescript":"^7.0.0","eslint-plugin-import":"^2.20.0","mocha":"^7.0.0","npm-cli-login":"^0.1.1","nyc":"^15.0.0","typescript":"^3.8.2"},"readmeFilename":"README.md","readme":"# screeps-server-mockup\n\n_Based on https://github.com/screepers/screeps-server-test_\n\n\n## Private server package for unit tests\n\nThis is a project that runs the screeps private server one tick at a time, allowing to easily check\ndata in between ticks and opens the possibilities for automatic testings in a reproductible\nenvironment.\n\n\n## Requirements\n\nThese are necessary to build the internal [Screeps](https://github.com/screeps/screeps) server.\n\n * Node.js 10 LTS or higher\n * Python (for node-gyp)\n * Build tools (`apt install build-essential` for Ubuntu, [Visual Studio](https://www.visualstudio.com/vs/) for Windows, etc) \n\n## Usage\n\n1. Install via npm or yarn\n2. Write a test script (see `examples` and `tests` folders for details)\n3. Run the test script\n\n\n## Script example (simple)\n\n``` javascript\nconst _ = require('lodash');\nconst { ScreepsServer, TerrainMatrix } = require('screeps-server-mockup');\n\n// Initialize server\nconst server = new ScreepsServer();\nawait server.world.reset();     // reset world but add invaders and source keepers users\nawait server.world.stubWorld(); // create a tub world composed of 9 rooms with sources and controller\n\n// Add a bot in W0N0\nconst modules = {\n    main: `module.exports.loop = function() {\n        console.log('Tick!',Game.time);\n        const directions = [TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT];\n        _.sample(Game.spawns).createCreep([MOVE]);\n        _.each(Game.creeps, c => c.move(_.sample(directions)));\n    };`\n};\nconst bot = await server.world.addBot({ username: 'bot', room: 'W0N1', x: 15, y: 15, modules });\n\n// Start server and run a tick\nawait server.start();\nawait server.tick();\n```\n\n\n## Script example (complete)\n\n``` javascript\nconst _ = require('lodash');\nconst { ScreepsServer, TerrainMatrix } = require('screeps-server-mockup');\n\n// Initialize server\nconst server = new ScreepsServer();\nawait server.world.reset(); // reset world but add invaders and source keepers users\n\n// Prepare the terrain for a new room\nconst terrain = new TerrainMatrix();\nconst walls = [[10, 10], [10, 40], [40, 10], [40, 40]];\n_.each(walls, ([x, y]) => terrain.set(x, y, 'wall'));\n\n// Create a new room with terrain and basic objects\nawait server.world.addRoom('W0N1');\nawait server.world.setTerrain('W0N1', terrain);\nawait server.world.addRoomObject('W0N1', 'controller', 10, 10, { level: 0 });\nawait server.world.addRoomObject('W0N1', 'source', 10, 40, { energy: 1000, energyCapacity: 1000, ticksToRegeneration: 300 });\nawait server.world.addRoomObject('W0N1', 'mineral', 40, 40, { mineralType: 'H', density: 3, mineralAmount: 3000 });\n\n// Add a bot in W0N1\nconst modules = {\n    main: `module.exports.loop = function() {\n        console.log('Tick!',Game.time);\n        const directions = [TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT];\n        _.sample(Game.spawns).createCreep([MOVE]);\n        _.each(Game.creeps, c => c.move(_.sample(directions)));\n    };`\n};\nconst bot = await server.world.addBot({ username: 'bot', room: 'W0N1', x: 25, y: 25, modules });\n\n// Print console logs every tick\nbot.on('console', (logs, results, userid, username) => {\n    _.each(logs, line => console.log(`[console|${username}]`, line));\n});\n\n// Start server and run several ticks\nawait server.start();\nfor (let i = 0; i < 10; i++) {\n    console.log('[tick]', await server.world.gameTime);\n    await server.tick();\n    _.each(await bot.newNotifications, ({ message }) => console.log('[notification]', message));\n    console.log('[memory]', await bot.memory, '\\n');\n}\n\n// Stop server and disconnect storage\nserver.stop();\nprocess.exit(); // required as there is no way to properly shutdown storage :(\n```\n\nEach tick should output something like:\n\n>[tick] 1\n\n>[console|bot] Tick! 1\n\n>[memory] {\"creeps\":{\"Arianna\":{}}}\n\n\n## Tests\n\n```\nyarn lint // or npm run lint\nyarn test // or npm run test\n```\n","description":"_Based on https://github.com/screepers/screeps-server-test_","licenseText":"Copyright 2017-2020 screeps-server-mockup contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","_id":"@brisberg/screeps-server-mockup@1.6.2","dist":{"shasum":"ca1a049c1ae2e51c23e9e4c021bb80b1732f3862","integrity":"sha512-v2FRZLXXNQqOrQQLuEc2epvsvBxK6ITdFXnmIiJuRKWlQ1ND9yo/ODr8uWp0AULpXYDKQ1T9ZUxyEBVzOeZ39A==","tarball":"https://registry.npmjs.org/@brisberg/screeps-server-mockup/-/screeps-server-mockup-1.6.2.tgz","fileCount":26,"unpackedSize":371322,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe9X1PCRA9TVsSAnZWagAA8ooP/1CR/0po1DuY/5qKnSUU\nJdE/Clbhj0AH3pyBju7nMCY+iZ1Ox8JpUcEGn/pPCV6cFBDgpvW1kdjz7oAx\nPv5xh99R0lw6ylwhzLRA5g72gJVHnBNMATyn+c0iHbMvOHepcRc59dzHLImK\n/ZUYOCnpVYmvgGNXF/onOWrg9X4Fch+Pjzzhf+wUMLKG7C3Ld4PZDj0IdKa/\nceljLapiR6MvWngBvoEaaBBh8XS4l5SzVuv3oqFkOeph7U8V2GtbjrwRHuAn\nitL1QJrenPRiA9JHD0BG6uNfX45x8twS+lwlYcjuPhl9edvJm4yM1s+JC9/K\nBNhjmL2F9XTIlORaJfYC759nFUEzqxJLjI/ePE/T0aeK3/yihQhhyvACc8M0\nmGNl1qvjeRMDC/7tqj43aQFSZ1/8sWNNrNwrhUUjEV0pZo3y2FeYlCBBcfxB\nw23S19dplqOuoc4RftpsjERkRHJyodsEEy86uFTccoDlfSFoE+WbBX0totbx\nWD/Jl4fU0KAo3oHlw5eCjuu0p0oVcvA7dVQf39dKgm8mcph5kpTqRTVBiWB5\n8Mxgg4L1bk0brUFJ5hor9eY0+O6NKaCvNC5IdQE20bFxFx3VEfz0GkNlLBfm\nUHMY4m33gptkDkjyhphzvt+mjsZEk8FGfXa+OtEONuXwxV2mlbuEdkAdkxb+\n50Gj\r\n=DJXs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDNCk/mBKiNDI54szt8tNL0/+9vnmtEg6mvpOtM8A2NpAiEA+56YFkzH7AVS/fj8aJuBg6lFSqMVjx9iyt3kI2wVijo="}]},"maintainers":[{"name":"brisberg","email":"brandon.risberg@gmail.com"}],"_npmUser":{"name":"brisberg","email":"brandon.risberg@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/screeps-server-mockup_1.6.2_1593146702982_0.5789426637714168"},"_hasShrinkwrap":false},"1.6.3":{"name":"@brisberg/screeps-server-mockup","main":"./dist/src/main.js","types":"./dist/src/main.d.ts","license":"MIT","repository":{"type":"git","url":"https://github.com/screepers/screeps-server-mockup"},"version":"1.6.3","scripts":{"build":"tsc","coverage":"tsc && nyc mocha dist/test --ui tdd --exit","lint":"eslint \"src/**/*.ts\" \"test/**/*.ts\" \"utils/**/*.ts\"","prepare":"yarn run build","prepublishOnly":"yarn test && yarn run lint","test":"tsc && mocha dist/test --ui tdd --exit"},"dependencies":{"@brisberg/common":"github:brisberg/common#no-storage-restart","@types/fs-extra-promise":"^1.0.8","@types/lodash":"^4.14.149","@types/screeps":"^3.0.0","fs-extra-promise":"^1.0.1","lodash":"^4.17.15","screeps":"^4.1.5"},"peerDependencies":{"@screeps/driver":"^5.1.0","@screeps/engine":"^4.1.2"},"devDependencies":{"@types/mocha":"^7.0.1","@types/node":"10.17.16","@typescript-eslint/eslint-plugin":"^2.21.0","@typescript-eslint/parser":"^2.21.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-airbnb-typescript":"^7.0.0","eslint-plugin-import":"^2.20.0","mocha":"^7.0.0","npm-cli-login":"^0.1.1","nyc":"^15.0.0","typescript":"^3.8.2"},"readmeFilename":"README.md","readme":"# screeps-server-mockup\n\n_Based on https://github.com/screepers/screeps-server-test_\n\n\n## Private server package for unit tests\n\nThis is a project that runs the screeps private server one tick at a time, allowing to easily check\ndata in between ticks and opens the possibilities for automatic testings in a reproductible\nenvironment.\n\n\n## Requirements\n\nThese are necessary to build the internal [Screeps](https://github.com/screeps/screeps) server.\n\n * Node.js 10 LTS or higher\n * Python (for node-gyp)\n * Build tools (`apt install build-essential` for Ubuntu, [Visual Studio](https://www.visualstudio.com/vs/) for Windows, etc) \n\n## Usage\n\n1. Install via npm or yarn\n2. Write a test script (see `examples` and `tests` folders for details)\n3. Run the test script\n\n\n## Script example (simple)\n\n``` javascript\nconst _ = require('lodash');\nconst { ScreepsServer, TerrainMatrix } = require('screeps-server-mockup');\n\n// Initialize server\nconst server = new ScreepsServer();\nawait server.world.reset();     // reset world but add invaders and source keepers users\nawait server.world.stubWorld(); // create a tub world composed of 9 rooms with sources and controller\n\n// Add a bot in W0N0\nconst modules = {\n    main: `module.exports.loop = function() {\n        console.log('Tick!',Game.time);\n        const directions = [TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT];\n        _.sample(Game.spawns).createCreep([MOVE]);\n        _.each(Game.creeps, c => c.move(_.sample(directions)));\n    };`\n};\nconst bot = await server.world.addBot({ username: 'bot', room: 'W0N1', x: 15, y: 15, modules });\n\n// Start server and run a tick\nawait server.start();\nawait server.tick();\n```\n\n\n## Script example (complete)\n\n``` javascript\nconst _ = require('lodash');\nconst { ScreepsServer, TerrainMatrix } = require('screeps-server-mockup');\n\n// Initialize server\nconst server = new ScreepsServer();\nawait server.world.reset(); // reset world but add invaders and source keepers users\n\n// Prepare the terrain for a new room\nconst terrain = new TerrainMatrix();\nconst walls = [[10, 10], [10, 40], [40, 10], [40, 40]];\n_.each(walls, ([x, y]) => terrain.set(x, y, 'wall'));\n\n// Create a new room with terrain and basic objects\nawait server.world.addRoom('W0N1');\nawait server.world.setTerrain('W0N1', terrain);\nawait server.world.addRoomObject('W0N1', 'controller', 10, 10, { level: 0 });\nawait server.world.addRoomObject('W0N1', 'source', 10, 40, { energy: 1000, energyCapacity: 1000, ticksToRegeneration: 300 });\nawait server.world.addRoomObject('W0N1', 'mineral', 40, 40, { mineralType: 'H', density: 3, mineralAmount: 3000 });\n\n// Add a bot in W0N1\nconst modules = {\n    main: `module.exports.loop = function() {\n        console.log('Tick!',Game.time);\n        const directions = [TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT];\n        _.sample(Game.spawns).createCreep([MOVE]);\n        _.each(Game.creeps, c => c.move(_.sample(directions)));\n    };`\n};\nconst bot = await server.world.addBot({ username: 'bot', room: 'W0N1', x: 25, y: 25, modules });\n\n// Print console logs every tick\nbot.on('console', (logs, results, userid, username) => {\n    _.each(logs, line => console.log(`[console|${username}]`, line));\n});\n\n// Start server and run several ticks\nawait server.start();\nfor (let i = 0; i < 10; i++) {\n    console.log('[tick]', await server.world.gameTime);\n    await server.tick();\n    _.each(await bot.newNotifications, ({ message }) => console.log('[notification]', message));\n    console.log('[memory]', await bot.memory, '\\n');\n}\n\n// Stop server and disconnect storage\nserver.stop();\nprocess.exit(); // required as there is no way to properly shutdown storage :(\n```\n\nEach tick should output something like:\n\n>[tick] 1\n\n>[console|bot] Tick! 1\n\n>[memory] {\"creeps\":{\"Arianna\":{}}}\n\n\n## Tests\n\n```\nyarn lint // or npm run lint\nyarn test // or npm run test\n```\n","description":"_Based on https://github.com/screepers/screeps-server-test_","licenseText":"Copyright 2017-2020 screeps-server-mockup contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","_id":"@brisberg/screeps-server-mockup@1.6.3","dist":{"shasum":"77d76505577ba52476cdcaff00ffafc8e2e06cdf","integrity":"sha512-4D8XGiJzmJ/aRjMvg4NZ+UjO/TeNf0uXghotxUZjPo8MS0zPZXx4r5Tijc3P0HFU16SGUMlyjOQ5HGGnC3SlfQ==","tarball":"https://registry.npmjs.org/@brisberg/screeps-server-mockup/-/screeps-server-mockup-1.6.3.tgz","fileCount":26,"unpackedSize":371335,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe9YQmCRA9TVsSAnZWagAAub4P/3cW6UWl2FGih6uaQ1AH\n6lib5/AlkljofqtOr6NHdWIIW0rrKwJxZEzjPKx9/7yEHTU6iOyumAJoZ0e8\nDAMq9YoaNAb++FIADJj3uyNBXRyYFR+kYXF5Ugq+ZwS+/sd2OSMgW9ssnFiZ\n9NShbHnMnU/UmTz4vVmC1cPFCGDiwx6Irh/GZXlfzCymaF3Zj3hl7138EylY\ngqnNOHwTyk8sBzHvjr311Bz2NA2XTaWUrIejEXOEX3rQG2QuZpnT1FgBQI96\n1o36DlE8vZ7GgvU2M5nG6kVr6qe6BZVeiG35aWdgEsNRi4jQ82Kd3RfLfZv2\nvqNxfuU5hjky3R0gLpNC9zRvh6OjgaIMeSA6xjRbFzMNB5Zi2+MRSuRVSNqM\nvbysmwcJOMa79NAvCNeQ9I0MCQyQG6xTPjdGif0F0vXdfmwA+2ZF6GgPehjD\nyuMsQOk4ePMfRNV/Q3JDPU7D7/9yjedArl4IaSrh4DtC9pUvfJ9Lpm7iZnE/\nQIeyUYD0SNRKxOA7s38/yNRbO7FN6ic9YNwQalo73yqe0VLufdYHGcxJDtP4\nO4ZZU/snIrd0vYTEGL4O4chG+QhlNgg7arrhBVwTfxC8Jmclpk5qNXJcSGrz\n8Xj308xdW4QbVEOm3293i0cQiIRd6y1hayllL2mnetbvWe/HFq7EI7j5XUuq\n8IBT\r\n=cZAu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC6R7HloWIScTSw1SA21QSv9IaROwHjI6dp51vo7h8q0wIgfzgdfDReTpAUlVv6JuZBihjXaE/LMLWsvz7t1LZ7WUE="}]},"maintainers":[{"name":"brisberg","email":"brandon.risberg@gmail.com"}],"_npmUser":{"name":"brisberg","email":"brandon.risberg@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/screeps-server-mockup_1.6.3_1593148454287_0.14326380362939517"},"_hasShrinkwrap":false},"1.5.1":{"name":"@brisberg/screeps-server-mockup","license":"MIT","repository":{"type":"git","url":"https://github.com/screepers/screeps-server-mockup"},"version":"1.5.1","main":"dist/src/main.js","types":"dist/src/main.d.ts","scripts":{"build":"tsc","coverage":"yarn run build && nyc mocha dist/test --ui tdd --exit","lint":"eslint \"src/**/*.ts\" \"test/**/*.ts\" \"utils/**/*.ts\"","prepare":"yarn run build","prepublishOnly":"yarn test && yarn run lint","test":"yarn run build && mocha dist/test --ui tdd --exit"},"dependencies":{"@types/fs-extra-promise":"^1.0.8","@types/lodash":"^4.14.149","@types/screeps":"^3.0.0","fs-extra-promise":"^1.0.1","lodash":"^4.17.15","screeps":"^4.1.5"},"peerDependencies":{"@screeps/common":"^2.13.2","@screeps/driver":"^5.1.0","@screeps/engine":"^4.1.2"},"devDependencies":{"@types/mocha":"^7.0.1","@types/node":"10.17.16","@typescript-eslint/eslint-plugin":"^2.21.0","@typescript-eslint/parser":"^2.21.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-airbnb-typescript":"^7.0.0","eslint-plugin-import":"^2.20.0","mocha":"^7.0.0","npm-cli-login":"^0.1.1","nyc":"^15.0.0","typescript":"^3.8.2"},"description":"_Based on https://github.com/screepers/screeps-server-test_","licenseText":"Copyright 2017-2020 screeps-server-mockup contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","_id":"@brisberg/screeps-server-mockup@1.5.1","dist":{"shasum":"9de9a44ba8490b1a15d1f77e1d59a29392a809fd","integrity":"sha512-Vdw3JYPOwCsR2IBCECsQZpwzr3ZuL++cWIHMCh2tst+bt9Zxpy+16L0KUefyb1M29htqGPGP3bgs9d1fjGC4/Q==","tarball":"https://registry.npmjs.org/@brisberg/screeps-server-mockup/-/screeps-server-mockup-1.5.1.tgz","fileCount":26,"unpackedSize":371384,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe9f9NCRA9TVsSAnZWagAA9OQP/0PP+ltyoJ1wBwyO4aZT\nUqTkZGqh56Yo1ZaYp1YFuiXl4fp1ocIN/QD5W2yv/y/u/J7vaTphyh98xKoy\nB3IQT/sE1MMzamBI4N3A4wTNLC4+gLr4PaBBmChs1b+xjWU5uVB48aGIMQIg\nPWC6EFafUOGvwSrfycoRCjXkPvHdZG0Q4o0AVWZpRTHf1V8B38GMhOVLiCpf\nW/GOn/mD0Vdws091OeJ98yjItMnafkD01zobSB4W6ERJhjY5rPqnD8QxaDhv\nngzYclnFNLoBKwDKarws2ZWbEwh6ow9EqpIsop+n3CtxhAWw4ipnwY1OcYxn\n66U/wVC6nF48jkhnbhZljX5nEh/mDB1CZ4eyeQcnNqqJC++ouy+A3J38CaUu\n1jiQonKu8pfSFD9doIg/QvPABAYlXbn3bpt0Gt5qLZW+e9lOpl9W4BQcUfot\nb2NJNVVocw2+YVdZJ7Ld15mI69zdDD27lDnZxbmJWcCDfCFVZPkHuLsfB1TG\nidYWandlU8UajHSrf5ocO7PCx1NINZBBgOwqWNDQn/7wPd5Jo57ryDvJLrc3\nX8OowOLgYaepv2FBYIsIkG5hQNSG7Jl6CSu86PXTuHn1viIrsvgmVjiQG98s\neyx4XrvqO2tx8egzK39X6tHmBcixcf2kn58oxBYUktvv1Nf6WkCTd6WFuBsq\nc9ET\r\n=zsA1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCCbCGJnfIypW9+QZsM/VNGQPpAhLM+ipOAkIcnAfQosgIhAK20vFmPtqr76ltYt6JDwY+0A6JQIeYbX+g2zICwvlw0"}]},"maintainers":[{"name":"brisberg","email":"brandon.risberg@gmail.com"}],"_npmUser":{"name":"brisberg","email":"brandon.risberg@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/screeps-server-mockup_1.5.1_1593179980569_0.40713882852582794"},"_hasShrinkwrap":false},"1.6.4":{"name":"@brisberg/screeps-server-mockup","main":"./dist/src/main.js","types":"./dist/src/main.d.ts","license":"MIT","repository":{"type":"git","url":"https://github.com/screepers/screeps-server-mockup"},"version":"1.6.4","scripts":{"build":"tsc","coverage":"yarn run build && nyc mocha dist/test --ui tdd --exit","lint":"eslint \"src/**/*.ts\" \"test/**/*.ts\" \"utils/**/*.ts\"","prepare":"yarn run build","prepublishOnly":"yarn test && yarn run lint","test":"yarn run build && mocha dist/test --ui tdd"},"dependencies":{"@screeps/common":"github:brisberg/common#no-storage-restart","@screeps/driver":"5.1.0","@screeps/engine":"4.1.3","@screeps/storage":"5.1.1","@types/fs-extra-promise":"^1.0.8","@types/lodash":"^4.14.149","@types/screeps":"^3.0.0","fs-extra-promise":"^1.0.1","lodash":"^4.17.15"},"devDependencies":{"@types/mocha":"^7.0.1","@types/node":"10.17.16","@typescript-eslint/eslint-plugin":"^2.21.0","@typescript-eslint/parser":"^2.21.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-airbnb-typescript":"^7.0.0","eslint-plugin-import":"^2.20.0","mocha":"^7.0.0","npm-cli-login":"^0.1.1","nyc":"^15.0.0","typescript":"^3.8.2"},"readmeFilename":"README.md","readme":"# screeps-server-mockup\n\n_Based on https://github.com/screepers/screeps-server-test_\n\n\n## Private server package for unit tests\n\nThis is a project that runs the screeps private server one tick at a time, allowing to easily check\ndata in between ticks and opens the possibilities for automatic testings in a reproductible\nenvironment.\n\n\n## Requirements\n\nThese are necessary to build the internal [Screeps](https://github.com/screeps/screeps) server.\n\n * Node.js 10 LTS or higher\n * Python (for node-gyp)\n * Build tools (`apt install build-essential` for Ubuntu, [Visual Studio](https://www.visualstudio.com/vs/) for Windows, etc) \n\n## Usage\n\n1. Install via npm or yarn\n2. Write a test script (see `examples` and `tests` folders for details)\n3. Run the test script\n\n\n## Script example (simple)\n\n``` javascript\nconst _ = require('lodash');\nconst { ScreepsServer, TerrainMatrix } = require('screeps-server-mockup');\n\n// Initialize server\nconst server = new ScreepsServer();\nawait server.world.reset();     // reset world but add invaders and source keepers users\nawait server.world.stubWorld(); // create a tub world composed of 9 rooms with sources and controller\n\n// Add a bot in W0N0\nconst modules = {\n    main: `module.exports.loop = function() {\n        console.log('Tick!',Game.time);\n        const directions = [TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT];\n        _.sample(Game.spawns).createCreep([MOVE]);\n        _.each(Game.creeps, c => c.move(_.sample(directions)));\n    };`\n};\nconst bot = await server.world.addBot({ username: 'bot', room: 'W0N1', x: 15, y: 15, modules });\n\n// Start server and run a tick\nawait server.start();\nawait server.tick();\n```\n\n\n## Script example (complete)\n\n``` javascript\nconst _ = require('lodash');\nconst { ScreepsServer, TerrainMatrix } = require('screeps-server-mockup');\n\n// Initialize server\nconst server = new ScreepsServer();\nawait server.world.reset(); // reset world but add invaders and source keepers users\n\n// Prepare the terrain for a new room\nconst terrain = new TerrainMatrix();\nconst walls = [[10, 10], [10, 40], [40, 10], [40, 40]];\n_.each(walls, ([x, y]) => terrain.set(x, y, 'wall'));\n\n// Create a new room with terrain and basic objects\nawait server.world.addRoom('W0N1');\nawait server.world.setTerrain('W0N1', terrain);\nawait server.world.addRoomObject('W0N1', 'controller', 10, 10, { level: 0 });\nawait server.world.addRoomObject('W0N1', 'source', 10, 40, { energy: 1000, energyCapacity: 1000, ticksToRegeneration: 300 });\nawait server.world.addRoomObject('W0N1', 'mineral', 40, 40, { mineralType: 'H', density: 3, mineralAmount: 3000 });\n\n// Add a bot in W0N1\nconst modules = {\n    main: `module.exports.loop = function() {\n        console.log('Tick!',Game.time);\n        const directions = [TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT];\n        _.sample(Game.spawns).createCreep([MOVE]);\n        _.each(Game.creeps, c => c.move(_.sample(directions)));\n    };`\n};\nconst bot = await server.world.addBot({ username: 'bot', room: 'W0N1', x: 25, y: 25, modules });\n\n// Print console logs every tick\nbot.on('console', (logs, results, userid, username) => {\n    _.each(logs, line => console.log(`[console|${username}]`, line));\n});\n\n// Start server and run several ticks\nawait server.start();\nfor (let i = 0; i < 10; i++) {\n    console.log('[tick]', await server.world.gameTime);\n    await server.tick();\n    _.each(await bot.newNotifications, ({ message }) => console.log('[notification]', message));\n    console.log('[memory]', await bot.memory, '\\n');\n}\n\n// Stop server and disconnect storage\nserver.stop();\nprocess.exit(); // required as there is no way to properly shutdown storage :(\n```\n\nEach tick should output something like:\n\n>[tick] 1\n\n>[console|bot] Tick! 1\n\n>[memory] {\"creeps\":{\"Arianna\":{}}}\n\n\n## Tests\n\n```\nyarn lint // or npm run lint\nyarn test // or npm run test\n```\n","description":"_Based on https://github.com/screepers/screeps-server-test_","licenseText":"Copyright 2017-2020 screeps-server-mockup contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","_id":"@brisberg/screeps-server-mockup@1.6.4","dist":{"shasum":"e4459304ab64b24001dd7c045c0cbb03455083c1","integrity":"sha512-eVdj5e3x2TUg/YBQfbiURKkqp2nLELSA0oEPj8If1U6G3p/XaNL7bb5hPQwAYNKGuupeaMzaFHKSX50ZETbBDw==","tarball":"https://registry.npmjs.org/@brisberg/screeps-server-mockup/-/screeps-server-mockup-1.6.4.tgz","fileCount":26,"unpackedSize":371441,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe9gkwCRA9TVsSAnZWagAASqkP/0HhE7n3v+7IS0FtJc/H\ngOZmtaVzksPVbpzi8S6XyHh+H3k1UP70KbITKhlu9/ObaLgjO4x2YOl/OzZD\nE2mzAqKv0uGLEE9IRXC+RnphX4CtfU4eBf90NEkTXTf4nGY0Nw1+oiY3d8hU\nnwZlu4luBn8VhXJF8I1K0+/xoa8FgaDw/KK3mYUEPjDNwOS7dkieaqZlVcfQ\ngaKuZSWo5oyFU/qbtIVxVgKsEn1BTkaJLErmUhweoHk2g3hitvR9I0TIgr2U\n8sOfTV8wx5ZRsfN4LF0AOyUuTpbzDkYWAb3Rfwg2Y0o4NQIkQMigJb0C4XEb\nFlQbZyMYmlQNZg2eVGDeVMSqUxA3gJu3t6AYuATyt9u/9MrFmTU53pXnsT9L\n6FKSRKFx56xzZ9WoSC0b51/FkClvRzWB+x02NtnYIPrGsKhecdphcxqajawG\naglEQsSu0Y7J83wcrCsglJ/oL7y1iDxqZVMvzUlTaDTd6miVoMD5pBnJ1yr5\npeg1CCqduUauEGcivM+Rd/vQqSSRY3+1LY9xGX25wHTW5lIsdVd+yiIOfwiZ\nuhr7gjr9YIDWhaFHYk6Zj6GxBsdu7dGYXnOsp2tqYssfddG29vvttFpoO75X\nce2NhVaZJucBof6ymLABoDnc9UyGYpACyWHb9SEXxFJylWPxEzY1NvxOKOlp\nQc+K\r\n=YXfh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGP2ZSyAJhMDAfv/VubUTcNQ5+ON+cSJvg73jqIadmZOAiADg10HIbWbyRn7OzN5eq8TvKKp91s5hkmXj9CEx1URxg=="}]},"maintainers":[{"name":"brisberg","email":"brandon.risberg@gmail.com"}],"_npmUser":{"name":"brisberg","email":"brandon.risberg@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/screeps-server-mockup_1.6.4_1593182511880_0.2521583960988014"},"_hasShrinkwrap":false},"1.6.5":{"name":"@brisberg/screeps-server-mockup","main":"./dist/src/main.js","types":"./dist/src/main.d.ts","license":"MIT","repository":{"type":"git","url":"https://github.com/screepers/screeps-server-mockup"},"version":"1.6.5","scripts":{"build":"tsc","coverage":"yarn run build && nyc mocha dist/test --ui tdd --exit","lint":"eslint \"src/**/*.ts\" \"test/**/*.ts\" \"utils/**/*.ts\"","prepare":"yarn run build","prepublishOnly":"yarn test && yarn run lint","test":"yarn run build && mocha dist/test --ui tdd --exit"},"dependencies":{"@screeps/common":"github:brisberg/common#no-storage-restart","@screeps/driver":"5.1.0","@screeps/engine":"4.1.3","@screeps/storage":"5.1.1","@types/fs-extra-promise":"^1.0.8","@types/lodash":"^4.14.149","@types/screeps":"^3.0.0","fs-extra-promise":"^1.0.1","lodash":"^4.17.15"},"devDependencies":{"@types/mocha":"^7.0.1","@types/node":"10.17.16","@typescript-eslint/eslint-plugin":"^2.21.0","@typescript-eslint/parser":"^2.21.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-airbnb-typescript":"^7.0.0","eslint-plugin-import":"^2.20.0","mocha":"^7.0.0","npm-cli-login":"^0.1.1","nyc":"^15.0.0","typescript":"^3.8.2"},"description":"_Based on https://github.com/screepers/screeps-server-test_","licenseText":"Copyright 2017-2020 screeps-server-mockup contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","_id":"@brisberg/screeps-server-mockup@1.6.5","dist":{"shasum":"fd48926f4106fa6540052a1e551a8a5dc8a16e48","integrity":"sha512-fJ/N6JTUJsit1mRN9dWBJVtl3LHh4Q6snRzY+2X2qLugYLVVSPJbGvPa1EaMDVITRVPD31pu+uFqc12k4agjBQ==","tarball":"https://registry.npmjs.org/@brisberg/screeps-server-mockup/-/screeps-server-mockup-1.6.5.tgz","fileCount":26,"unpackedSize":372574,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfLPXECRA9TVsSAnZWagAAmDgP/02+Zib46tnn087Sj14W\n5UUbSa81VRSpE0ZOkT+ue1+PaQh3RO62IZxJu0+Vmj1YL/Mh7Dt5mFKr1CSB\nmf/ygOnZZUc8YYumwQHsm3TB0MhtfVCF3M6YcyI6nMWV7io0hqnBZ7Jri2Mt\n3HM3maz1gj9Emc1T9kxUQ9qlEI9SIfui3naozqqwwqd0jYcRwTL/GirBiw6G\nnEJmzACussubHActF6Ji/YndaXNAfKM51AjMb/lPGiC0oiMskKtTAjHdC4S1\nVX9/g4BXDwwNlq9nSYjq4HKxYTiwpIvQTP0yQ42WWL88nhCsJo4GsUMwW2iC\nWcnxzmGcqaV5jWJ8vNJ38jJqcDUbX+OOsk+LTT1V3MRrL8JFyd+PVpSBxm2m\nbnSpLR6gXtjRcKttFvl6FUc0f5OhVFMwDWhmeiK8ztuohRxgwysh4/CXN4BM\nTGuw5JtVWlsV9hjul+yaCUmJNwWUdwINbjbbB0vK4nhsSxQp1eLWHfSpNspD\nLRC3/aGDfKjkviUuLNOXXTXRe6gSqU0J8xFevkv0y15TCTwJ5EJrSVFGnXZY\nDakG2UrLkpupRb/KNCnZY4tie3Ea6AxDB1rozpnWjWyR1GLICgcz326mPF7c\nH/HGknql+CTSE7MF2GqE4FtiAY0f4fJ+trqmktaNt3Tul3WhyOfN2tv65adv\ndhOk\r\n=FWlW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDeSX87fj4JAzrOSUZxqp34CLdioB6IMiueaHzzS/vE5QIgE+ULhWvIVKEVe/vaSxxr8I2+2sdaEFhYgr6ig//Y8Eo="}]},"maintainers":[{"name":"brisberg","email":"brandon.risberg@gmail.com"}],"_npmUser":{"name":"brisberg","email":"brandon.risberg@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/screeps-server-mockup_1.6.5_1596782020248_0.6661553018662882"},"_hasShrinkwrap":false},"1.6.6":{"name":"@brisberg/screeps-server-mockup","license":"MIT","repository":{"type":"git","url":"https://github.com/screepers/screeps-server-mockup"},"version":"1.6.6","main":"dist/src/main.js","types":"dist/src/main.d.ts","scripts":{"build":"tsc","coverage":"yarn run build && nyc mocha dist/test --ui tdd --exit","lint":"eslint \"src/**/*.ts\" \"test/**/*.ts\" \"utils/**/*.ts\"","prepare":"yarn run build","prepublishOnly":"yarn test && yarn run lint","test":"yarn run build && mocha dist/test --ui tdd --exit"},"dependencies":{"@types/fs-extra-promise":"^1.0.8","@types/lodash":"^4.14.149","@types/screeps":"^3.0.0","fs-extra-promise":"^1.0.1","lodash":"^4.17.15","screeps":"^4.1.5"},"peerDependencies":{"@screeps/common":"^2.13.2","@screeps/driver":"^5.1.0","@screeps/engine":"^4.1.2"},"devDependencies":{"@types/mocha":"^7.0.1","@types/node":"10.17.16","@typescript-eslint/eslint-plugin":"^2.21.0","@typescript-eslint/parser":"^2.21.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-airbnb-typescript":"^7.0.0","eslint-plugin-import":"^2.20.0","mocha":"^7.0.0","npm-cli-login":"^0.1.1","nyc":"^15.0.0","typescript":"^3.8.2"},"description":"_Based on https://github.com/screepers/screeps-server-test_","licenseText":"Copyright 2017-2020 screeps-server-mockup contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","_id":"@brisberg/screeps-server-mockup@1.6.6","dist":{"shasum":"9d9e0967a652c55a0e4f34ee57fb916feaa3b4b8","integrity":"sha512-Ttl01iot5JpiqmL0TLl6SHdqNsL08Q/AKbbtd+89tSFDrcACxdsnMXsSoFoWR+DT3fJ20TGPRx2Iew+b6gY0PQ==","tarball":"https://registry.npmjs.org/@brisberg/screeps-server-mockup/-/screeps-server-mockup-1.6.6.tgz","fileCount":26,"unpackedSize":372489,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfLPzUCRA9TVsSAnZWagAAI8gP/jf3tf5OLZA+ANK85l5x\nhvxjfPOBCrfze7SHMJiXDlc9Lvu6TJriwJooo7/6kMEMdutL3VGMLgI5R+da\nDB0M9D2sQDCUruc/jzNC8kDOFUfGi1edXExuDmYp9CtLB95nWBQ61jw1Qj8q\nlYbr8uOZCwzkWnXjKjiD8w1Aa5/c3/jIfCByPoSMZ+jTsP6VXWBIe2GIbsPm\nU+nzduFF5yHvV8THy7i6fTODjomXkdssseTfc09L6Sbw7ZwPAT4eV0+IkeJC\nAhPNMu0OWJKNnjZ1y8ScSWoHnPvnNpBnQKfl/86pohiev0JwWLozCsPxbuJJ\nC6GlsO2vhLcRrMAGqDJ3x1eM4wyYEfB483/5pmNAPTozOZnuVnWptSJUDQfr\nFOXGRs65SdfZAvrynrSitrr+UeP+qBWbDdhuPCGvnhoRCUyscUIwok2+HdUv\n368ghemihnmWdqfd0cjUxTqe0IbCkCqRzyNYRFF7Ghr6DkMRUuktGzBAAgvj\nL64ikUzNkv9SIw1Wi92k2hwPpZ5OHN7QbSu6xw5quLYpVGSMpxfTn8AuzEI0\nbKk18sF2Ow3UKCLV61FK4uCQbzOERD1VyWuJpEpMSVwoCZUo4Vw2N7cXr/h7\n06EfWj5Tkd2zrlZ/W6aAV5NnNmLIxZCSBheedGLY7Tv7gqk8vPCDCxB46Z9Z\n0E67\r\n=n9uz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIQDzpHxsbSFm88Gf7Pm+1A93S08NkBW4CRlWmsezGdcKsQIfBtXeQkg6yzcM8xmUmZ/VsIXpb6reppzqJDgKbGIt8A=="}]},"maintainers":[{"name":"brisberg","email":"brandon.risberg@gmail.com"}],"_npmUser":{"name":"brisberg","email":"brandon.risberg@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/screeps-server-mockup_1.6.6_1596783828491_0.7706397819434987"},"_hasShrinkwrap":false}},"time":{"created":"2020-06-26T00:49:53.488Z","1.6.0":"2020-06-26T00:49:53.669Z","modified":"2022-04-04T20:42:21.418Z","1.6.1":"2020-06-26T04:26:02.435Z","1.6.2":"2020-06-26T04:45:03.134Z","1.6.3":"2020-06-26T05:14:14.456Z","1.5.1":"2020-06-26T13:59:40.738Z","1.6.4":"2020-06-26T14:41:52.136Z","1.6.5":"2020-08-07T06:33:40.362Z","1.6.6":"2020-08-07T07:03:48.676Z"},"maintainers":[{"name":"brisberg","email":"brandon.risberg@gmail.com"}],"description":"_Based on https://github.com/screepers/screeps-server-test_","repository":{"type":"git","url":"https://github.com/screepers/screeps-server-mockup"},"license":"MIT","readme":"# screeps-server-mockup\n\n_Based on https://github.com/screepers/screeps-server-test_\n\n\n## Private server package for unit tests\n\nThis is a project that runs the screeps private server one tick at a time, allowing to easily check\ndata in between ticks and opens the possibilities for automatic testings in a reproductible\nenvironment.\n\n\n## Requirements\n\nThese are necessary to build the internal [Screeps](https://github.com/screeps/screeps) server.\n\n * Node.js 10 LTS or higher\n * Python (for node-gyp)\n * Build tools (`apt install build-essential` for Ubuntu, [Visual Studio](https://www.visualstudio.com/vs/) for Windows, etc)\n\n## Usage\n\n1. Install via npm or yarn\n2. Write a test script (see `examples` and `tests` folders for details)\n3. Run the test script\n\n\n## Script example (simple)\n\n``` javascript\nconst _ = require('lodash');\nconst { ScreepsServer, TerrainMatrix } = require('screeps-server-mockup');\n\n// Initialize server\nconst server = new ScreepsServer();\nawait server.world.reset();     // reset world but add invaders and source keepers users\nawait server.world.stubWorld(); // create a stub world composed of 9 rooms with sources and controller\n\n// Add a bot in W0N1\nconst modules = {\n    main: `module.exports.loop = function() {\n        console.log('Tick!',Game.time);\n        const directions = [TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT];\n        _.sample(Game.spawns).createCreep([MOVE]);\n        _.each(Game.creeps, c => c.move(_.sample(directions)));\n    };`\n};\nconst bot = await server.world.addBot({ username: 'bot', room: 'W0N1', x: 15, y: 15, modules });\n\n// Start server and run a tick\nawait server.start();\nawait server.tick();\n```\n\n\n## Script example (complete)\n\n``` javascript\nconst _ = require('lodash');\nconst { ScreepsServer, TerrainMatrix } = require('screeps-server-mockup');\n\n// Initialize server\nconst server = new ScreepsServer();\nawait server.world.reset(); // reset world but add invaders and source keepers users\n\n// Prepare the terrain for a new room\nconst terrain = new TerrainMatrix();\nconst walls = [[10, 10], [10, 40], [40, 10], [40, 40]];\n_.each(walls, ([x, y]) => terrain.set(x, y, 'wall'));\n\n// Create a new room with terrain and basic objects\nawait server.world.addRoom('W0N1');\nawait server.world.setTerrain('W0N1', terrain);\nawait server.world.addRoomObject('W0N1', 'controller', 10, 10, { level: 0 });\nawait server.world.addRoomObject('W0N1', 'source', 10, 40, { energy: 1000, energyCapacity: 1000, ticksToRegeneration: 300 });\nawait server.world.addRoomObject('W0N1', 'mineral', 40, 40, { mineralType: 'H', density: 3, mineralAmount: 3000 });\n\n// Add a bot in W0N1\nconst modules = {\n    main: `module.exports.loop = function() {\n        console.log('Tick!',Game.time);\n        const directions = [TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT];\n        _.sample(Game.spawns).createCreep([MOVE]);\n        _.each(Game.creeps, c => c.move(_.sample(directions)));\n    };`\n};\nconst bot = await server.world.addBot({ username: 'bot', room: 'W0N1', x: 25, y: 25, modules });\n\n// Print console logs every tick\nbot.on('console', (logs, results, userid, username) => {\n    _.each(logs, line => console.log(`[console|${username}]`, line));\n});\n\n// Start server and run several ticks\nawait server.start();\nfor (let i = 0; i < 10; i++) {\n    console.log('[tick]', await server.world.gameTime);\n    await server.tick();\n    _.each(await bot.newNotifications, ({ message }) => console.log('[notification]', message));\n    console.log('[memory]', await bot.memory, '\\n');\n}\n\n// Stop server and disconnect storage\nserver.stop();\nprocess.exit(); // required as there is no way to properly shutdown storage :(\n```\n\nEach tick should output something like:\n\n>[tick] 1\n\n>[console|bot] Tick! 1\n\n>[memory] {\"creeps\":{\"Arianna\":{}}}\n\n\n## Tests\n\n```\nyarn lint // or npm run lint\nyarn test // or npm run test\n```\n","readmeFilename":"README.md"}