/cc-api

Primary LanguageLuaMozilla Public License 2.0MPL-2.0

Cc::Api

Work-in-progress project to generate LuaLS library files for CC: Tweaked (and some supported mods).

Currently (2024-04-12), all the library files are handwritten, sometimes with some help from generator tools.

Installation

TODO: Replace UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.

Install the gem and add to the application's Gemfile by executing:

$ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG

Usage

LuaLS

Add the path to the api folder in this repo to your Lua settings in VS Code:

{
  "Lua.workspace.library": [
    "/path/to/this/repo/api"
  ]
}

Mod support

  • CC APIs from Mekanism

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Generating Mekanism API files

In-game, in a CC computer, run the dump script in vendor/mekanism/dump.lua to generate the help files for all necessary Mekanism blocks.

Then extract the Lua files it generated by going into the world save folder, finding the folder for the computer you were using, and grabbing the files from the dump folder.

Place them into the vendor/mekanism folder in this repo to update them.

Run bundle exec exe/cc-api to generate new API files to out/mekanism.

Then check if any of the existing mekanism files in api/mekanism need updating.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Sharparam/cc-api.

License

Copyright © 2024 by Adam Hellberg.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.