Skip to content

Qinbeans/ccpiler

Repository files navigation

A Next.js tool for writing CC:Tweaked code visually

It turns Blockly code into Lua meant for CC:Tweaked.

void_dumby

Goal: To connect a CC:Tweaked computer or turtle to this website via websockets to edit code live.

Scrape CC:Tweaked

The first thing that needs to be done is scraping CC:Tweaked to get up to date code.

python ./scripts/cctweaked2json.py

You can test whether the script works or not via this command:

python ./scripts/cctweaked2json.py -t

Run python ./scripts/cctweaked2json.py -c Globals -o src/app/lib/blockly.json to generate and update the Blockly blocks.

script_run

Quirks

CC:Tweaked has a few quirks that need to be worked around, but it's no problem of Lua or CC:Tweaked, it's just the way Blockly works. Lua allows for multiple return values, but Blockly only allows for one. So to get around this, this assumes you want to use all values and puts them into a table.

script_run

As you can see turtle.craft creates {turtle.craft()}.

void_dumby

Here's a quirk that was introduced by no fault but my own. I find it more precise and easier to code with since it expects that you need to use the return values of each variable. You can create a dummy variable to get around this.

This does make the Lua harder to read to a degree, but the hope is that the Blockly code is easier to read and understand.

Credits

Inspired by ccblockly

Source CC:Tweaked

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors