Giter Site home page Giter Site logo

mindustryio's Introduction

mindustryio

tools for interacting with mindustry files

this is a work in progress, do not expect everything to work

example

const fs = require("fs");
const { Schematic } = require("mindustryio");
const schem = new Schematic();

schem.resize(5, 5);
schem.tags.name = "example";
for (let x = 0; x < 5; x++) {
  for (let y = 0; y < 5; y++) {
    schem.block(x, y).setBlock("copper-wall");
  }
}
fs.writeFileSync("test.msch", schem.toBuffer());

documentation

creating schematics

new Schematic(buffer?) => Schematic

returns a Schematic object. if you use a buffer, it will load it automatically

schematic instances

Schematic.resize(height, width) => void

resize a schematic to the given height and width. Note: the parameter order is height, width, not width, height.

Schematic.block(x, y) => Block

returns the block at the given x and y, creating it if it doesn't exist

Schematic.delete(x, y) => void

deletes the block at the given x and y

Schematic.each(callback(block)) => void

loops through the blocks in the schematic and calls callback once for each block. callback will be called with the block that it found. Note: don't use this to fill a blank schematic, there won't be any blocks in it and won't do anything

Schematic.toBuffer() => Buffer

converts the schematic into a buffer

blocks

Block.position => Position

what's the block's position?

Block.block => string

what's the block? (eg. router)

Block.rotation => integer

what's the block's rotation?

Block.config => Config

what's the block's config?

all properties have a corresponding getQwerty and setQwerty function (getBlock(), setBlock("copper-wall"), etc..)

position

Position.x => integer and Position.y => integer

if i have to explain this i will hhhhhhhh.

config

config can be multiple things - blocks without config will have null as its config value. common values are numbers, Positions, or Content

content

Content.type => string

the content type

Content.name => string

the content's name

roadmap

  • currently, only a small subset of the features are supported.

  • version 1 will be released when all features are supported and there are no major bugs

  • version 2 will be released when i implement map io

  • more versions will be released when the schematic/map system changes signifigantly

mindustryio's People

Contributors

tezlm avatar

Stargazers

bendn avatar Phinner avatar Evelyn avatar Tom-- avatar andrew anciferoff avatar

Watchers

 avatar

mindustryio's Issues

a

a

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.