Starmadepy - A python library for templates, blueprints, and maybe other data

    wat

    Joined
    Dec 25, 2014
    Messages
    19
    Reaction score
    13
    Starmadepy v0.1.5
    This project will really only be of use to Developers at the moment.

    I've got a couple python projects in the works (that will be posted shortly), but in the process of developing those I wanted a fairly easy library to handle a lot of the common functionality between my projects.

    Please see the Github page for a link to the project, and the documentation for more information.

    Github: https://github.com/DerekRies/starmadepy
    Documentation: http://starmadepy.readthedocs.org/en/latest/

    Overview of the project

    Starmadepy is a simple python library that makes parsing and manipulating Starmade game data easy. As this project is fairly new, the only file type that is currently supported is the .smtpl, or the Template file type. Implementing Blueprints is next on the list of things to do and should be done soon. As the project is only in it's v0.1.5 release the API is not considered stable.

    Features:

    • load Template files (blueprints soon to come)
    • transform Templates block by block or with batch operations for color, shape, armor-level, etc...
    • save as .smtpl template file (blueprints soon to come)

    Example

    Maybe you created a really nice component that utilizes blocks, wedges, corners, pentas, and tetras in a couple different colors and you'd like to generate some copies of this template in different colors.

    The following code will open a template file, select all the blocks with the color grey and then replace them with orange.
    Code:
    from starmadepy import starmade
    
    # Loads a template file named sometemplatefile.smtpl
    # Replaces all grey colored blocks, with orange equivalents
    
    template = starmade.Template.fromSMTPL('sometemplatefile.smtpl')
    template.replace({'color': 'grey'}, {'color': 'orange'})
    template.save('outtemplatefile.smtpl')


    Thanks for checking out the project, if you've got any questions you can ask them here. If you find any problems please file a new issue on the Github page if you can, if not a post here will suffice.

    Also, if any python developers are interested in collaborating on some projects please let me know.
     
    Joined
    Jan 25, 2014
    Messages
    386
    Reaction score
    27
    • Legacy Citizen
    • Legacy Citizen 2
    template.replace({'BlockTypeInput': 'ColorInput'}, {'BlockTypeOutput': 'ColorOutput'})
    Could you do that with a dropdown menu for inputs?
     

    wat

    Joined
    Dec 25, 2014
    Messages
    19
    Reaction score
    13