{ "info": { "author": "Blixt", "author_email": "me@blixt.nyc", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Games/Entertainment", "Topic :: Utilities" ], "description": "# Starbound utilities for Python\n\nThis is a library to parse Starbound's file formats which are used to\nstore worlds, player characters, assets, etc.\n\nFeel free to contribute either via submitting pull requests or writing\nup issues with suggestions and/or bugs.\n\n## File & data formats\n\nCheck out [FORMATS.md](./FORMATS.md) for technical information on\nStarbound's file and data formats.\n\n## Installation\n\npy-starbound can be installed (either to your system, user account, or\nvirtualenv) using the usual `setup.py` script:\n\n```bash\n$ python setup.py install\n```\n\nAfter installation, the commandline utilities (described below) should\nbe available in your `$PATH` can can be run like any other app:\n\n```bash\n$ pystarbound-export [args]\n$ pystarbound-region [args]\n```\n\nIf you wish to run these utilities from the git checkout itself (without\ninstalling first), the syntax is slightly more verbose:\n\n```bash\n$ python -m starbound.cliexport [args]\n$ python -m starbound.cliregion [args]\n```\n\n## Command line utilities\n\n### Extracting `.pak` files\n\nYou can use the `pystarbound-export` script to extract all the files in a `.pak`\n(or `.modpak`) file.\n\nExample:\n\n```bash\n$ pystarbound-export -d assets /Starbound/assets/packed.pak\n```\n\nOr from the git checkout directly:\n\n```bash\n$ python -m starbound.cliexport -d assets /Starbound/assets/packed.pak\n```\n\n### Getting world info\n\nIf you want information about a region in a world (planet or ship), you\ncan use the `region.py` script. For example, here's how to pretty print\nthe tiles in a region:\n\n```bash\n$ pystarbound-region /Starbound/storage/universe/-382912739_-582615456_-73870035_3.world\nWorld size: 3000\u00d72000\nSpawn point: (1224.0, 676.0)\nOutputting region: (37, 21)\nOutputting value: foreground_material\n```\n\nOr from the git checkout directly:\n\n```bash\n$ python -m starbound.cliregion /Starbound/storage/universe/-382912739_-582615456_-73870035_3.world\n```\n\nOutputs something like this:\n\n![](http://i.imgur.com/b4ZitYX.png)\n\nIf you don't provide X and Y coordinates after the path, it will\ndefault to the region that the spawn point is in.\n\nYou can also output specific tile values (instead of the foreground)\nusing `--value-index` (or `-v`):\n\n```bash\n$ pystarbound-region --value-index=12 /Starbound/storage/universe/-382912739_-582615456_-73870035_3.world 69 27\nWorld size: 3000\u00d72000\nSpawn point: (1224.0, 676.0)\nOutputting region: (69, 27)\nOutputting value: liquid_pressure\n```\n\nOutputs something like this:\n\n![](http://i.imgur.com/XZ3OYTO.png)\n\nAnd here's how to print the entities in a region:\n\n```bash\n$ pystarbound-region --entities /Starbound/storage/universe/-382912739_-582615456_-73870035_3.world 69 27\nWorld size: 3000\u00d72000\nSpawn point: (1224.0, 676.0)\nOutputting region: (69, 27)\n\n[\n [\n \"ObjectEntity\",\n 8,\n {\n \"direction\": \"left\",\n \"inputWireNodes\": [],\n \"interactive\": true,\n \"name\": \"wiringstation\",\n \"orientationIndex\": 0,\n \"outputWireNodes\": [],\n \"parameters\": {\n \"owner\": \"916d5878483e3a40d10467dc419982c2\"\n },\n \"scriptStorage\": {},\n...\n```\n\n## Using the Python package\n\nThe Python package lets you read data from Starbound's various file\nformats. The classes and functions expect file objects to read from.\n\nYou can use the `mmap` package to improve performance for large files,\nsuch as `packed.pak` and world files.\n\n### Example: Reading a player file\n\nHere's how to print the name of a player:\n\n```python\nimport starbound\n\nwith open('player/11475cedd80ead373c19a91de2e2c4d3.player', 'rb') as fh:\n player = starbound.read_sbvj01(fh)\n print('Hello, {}!'.format(player.data['identity']['name']))\n```\n\n### Example: World files\n\nIn the following example the `mmap` package is used for faster access:\n\n```python\nimport mmap, starbound\n\nwith open('universe/43619853_198908799_-9440367_6_3.world', 'rb') as fh:\n mm = mmap.mmap(fh.fileno(), 0, access=mmap.ACCESS_READ)\n\n world = starbound.World(mm)\n world.read_metadata()\n\n print('World size: {}\u00d7{}'.format(world.width, world.height))\n x, y = world.metadata['playerStart']\n print('Player spawns at ({}, {})'.format(x, y))\n\n # Regions consist of 32\u00d732 tiles.\n rx, ry = x // 32, y // 32\n print('An entity: {}'.format(world.get_entities(rx, ry)[0]))\n```\n\n### Example: Easy access to various world attributes\n\nA vast amount of information about loaded Worlds is available via the\n`metadata` attribute (as seen in the above section), but some\ninformation is also abstracted out into an `info` attribute. For instance:\n\n```python\nworld = starbound.World(fh)\nprint('World Name: {}'.format(world.info.name))\nprint('World Description: {}'.format(world.info.description))\nprint('World Coordinates: ({}, {})'.format(world.info.coords[0], world.info.coords[1]))\n```\n\nThe full list of attributes currently available are:\n\n| Attribute | Description |\n| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `biomes` | The full set of biomes found on the world. This should be a complete list, regardless of how much of the world has been explored. |\n| `coords` | World coordinates, as a tuple. The first two elements are the in-map coordinates of the system, the third is effectively random but describes the world itself. |\n| `description` | The internal description of the world. Will often include text describing the tier of the world. |\n| `dungeons` | The full set of dungeons found on the world. This should be a complete list, regardless of how much of the world has been explored. |\n| `name` | The name of the world. Will often include Starbound coloration markup. |\n| `size` | A tuple describing the width and height of the world. |\n| `world_biomes` | A set of the main biome IDs of the world, of the sort reported in the ingame navigation screen. |\n\n### Example: Finding an entity by UUID/ID\n\nMany entities in Starbound, such as bookmarked flags, mech beacons,\nquest markers, etc, have UUIDs or IDs which the game can use to find\nwhere they are in the map without having to have all regions loaded.\nPlayer bookmark UUIDs can be found in the `player.data['universeMap']`\ndict, underneath `teleportBookmarks`. One object type which does\n_not_ use UUIDs is a level's mech beacon, which instead uses the magic\nstring `mechbeacon`. To find the ingame coordinates for a level's\nbeacon (if one is present), this can be used:\n\n```python\nmechbeacon_coords = world.get_entity_uuid_coords('mechbeacon')\nif mechbeacon_coords:\n print('Mech beacon found at ({}, {})'.format(*mechbeacon_coords))\nelse:\n print('No mech beacon in level!')\n```\n\n### Example: Getting assets from `packed.pak`\n\nStarbound keeps most of the assets (images, configuration files,\ndungeons, etc.) in a file called `packed.pak`. This file uses a special\nformat which can be read by py-starbound, as you can see below.\n\n```python\nimport starbound\n\nwith open('assets/packed.pak', 'rb') as fh:\n package = starbound.SBAsset6(fh)\n\n # Print the contents of a file in the asset package.\n print(package.get('/lighting.config'))\n```\n\n### Example: Modifying Starbound files\n\nCurrently, only the SBVJ01 file format can be written by py-starbound.\nThis means player files, client context files, and the statistics file.\n\nHere's an example that renames a player (WARNING: Always back up files\nbefore writing to them!):\n\n```python\nimport starbound\n\nwith open('player/420ed511f83b3760dead42a173339b3e.player', 'r+b') as fh:\n player = starbound.read_sbvj01(fh)\n\n old_name = player.data['identity']['name']\n new_name = old_name.encode('rot13')\n player.data['identity']['name'] = new_name\n print('Updating name: {} -> {}'.format(old_name, new_name))\n\n # Go back to the beginning of the file and write the updated data.\n fh.seek(0)\n starbound.write_sbvj01(fh, player)\n # If the file got shorter, truncate away the remaining content.\n fh.truncate()\n```\n\n## License\n\n[MIT License](./LICENSE)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/blixt/py-starbound", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "py-starbound", "package_url": "https://pypi.org/project/py-starbound/", "platform": "", "project_url": "https://pypi.org/project/py-starbound/", "project_urls": { "Homepage": "https://github.com/blixt/py-starbound" }, "release_url": "https://pypi.org/project/py-starbound/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "Python package for working with Starbound files.", "version": "1.0.0" }, "last_serial": 4477915, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "a2ed66889b69198f945ca0fca210eb1a", "sha256": "8fa6afa34c74d6ae1e11d2b1411b1b89b34c4639407f1454456ba7eab8b89adb" }, "downloads": -1, "filename": "py-starbound-1.0.0.tar.gz", "has_sig": false, "md5_digest": "a2ed66889b69198f945ca0fca210eb1a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21380, "upload_time": "2018-11-12T15:53:25", "url": "https://files.pythonhosted.org/packages/b6/06/1e50530cf16eddfd7848bf5535e3fc5b8460ab898f1aceca083e8b956ec8/py-starbound-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a2ed66889b69198f945ca0fca210eb1a", "sha256": "8fa6afa34c74d6ae1e11d2b1411b1b89b34c4639407f1454456ba7eab8b89adb" }, "downloads": -1, "filename": "py-starbound-1.0.0.tar.gz", "has_sig": false, "md5_digest": "a2ed66889b69198f945ca0fca210eb1a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21380, "upload_time": "2018-11-12T15:53:25", "url": "https://files.pythonhosted.org/packages/b6/06/1e50530cf16eddfd7848bf5535e3fc5b8460ab898f1aceca083e8b956ec8/py-starbound-1.0.0.tar.gz" } ] }