brs-cr

Crystal interface for reading/writing Brickadia BRS save files

brs-cr

brs-cr is a port of the Brickadia brs save (de)serializer.

Only supports versions 4+.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      brs-cr:
        github: voximity/brs-cr
    
  2. Run shards install

Usage

This will create the file out.brs with a 16x16 grid of randomly colored 1x1f bricks.

require "brs-cr"

me = BRS::User.new(username: "x", uuid: UUID.new("3f5108a0-c929-4e77-a115-21f65096887b"))

save = BRS::Save.new(
  author: me,
  description: "generated save file"
)

16.times do |y|
  16.times do |x|
    save.bricks << BRS::Brick.new(
      size: BRS::UVector3.new(5, 5, 2),
      position: BRS::Vector3.new(5 + x * 10, 5 + y * 10, 2),
      color_index: Random.rand(0...save.colors.size)
    )
  end
end

save.write(File.new("input/out.brs", mode: "w"))

Contributing

  1. Fork it (https://github.com/voximity/brs-cr/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Credits

Repository

brs-cr

Owner
Statistic
  • 0
  • 1
  • 1
  • 2
  • 0
  • about 4 years ago
  • May 11, 2020
License

MIT License

Links
Synced at

Fri, 22 Nov 2024 08:11:05 GMT

Languages