diff --git a/README.md b/README.md index 6ce3f3df9..4573d1d98 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,11 @@ # ![CC: Tweaked](doc/logo.png) -[![Current build status](https://github.com/SquidDev-CC/CC-Tweaked/workflows/Build/badge.svg)](https://github.com/SquidDev-CC/CC-Tweaked/actions "Current build status") [![Download CC: Tweaked on CurseForge](http://cf.way2muchnoise.eu/title/cc-tweaked.svg)](https://minecraft.curseforge.com/projects/cc-tweaked "Download CC: Tweaked on CurseForge") +[![Current build status](https://github.com/SquidDev-CC/CC-Tweaked/workflows/Build/badge.svg)](https://github.com/SquidDev-CC/CC-Tweaked/actions "Current build status") [![Download CC: Tweaked on CurseForge](http://cf.way2muchnoise.eu/title/cc-tweaked.svg)][CurseForge] -CC: Tweaked is a fork of [ComputerCraft](https://github.com/dan200/ComputerCraft), adding programmable computers, -turtles and more to Minecraft. +CC: Tweaked is a mod for Minecraft which adds programmable computers, turtles and more to the game. A fork of the +much-beloved [ComputerCraft], it continues its legacy with better performance, stability, and a wealth of new features. -## What? -ComputerCraft has always held a fond place in my heart: it's the mod which really got me into Minecraft, and it's the -mod which has kept me playing it for many years. However, development of the original mod has slowed, as the original -developers have had less time to work on the mod, and moved onto other projects and commitments. - -CC: Tweaked (or CC:T for short) is an attempt to continue ComputerCraft's legacy. It's not intended to be a competitor -to CC, nor do I want to take it in a vastly different direction to the original mod. Instead, CC:T focuses on making the -ComputerCraft experience as _solid_ as possible, ironing out any wrinkles that may have developed over time. - -## Features -CC: Tweaked contains all the features of the latest version of ComputerCraft, as well as numerous fixes, performance -improvements and several nifty additions. I'd recommend checking out [the releases page](https://github.com/SquidDev-CC/CC-Tweaked/releases) -to see the full set of changes, but here's a couple of the more interesting additions: - - - Improvements to the `http` library, including websockets, support for other HTTP methods (`PUT`, `DELETE`, etc...) - and configurable limits on HTTP usage. - - Full-block wired modems, allowing one to wrap non-solid peripherals (such as turtles, or chests if Plethora is - installed). - - Pocket computers can be held like maps, allowing you to view the screen without entering a GUI. - - Printed pages and books can be placed in item frames and held like maps. - - Several profiling and administration tools for server owners, via the `/computercraft` command. This allows operators - to track which computers are hogging resources, turn on and shutdown multiple computers at once and interact with - computers remotely. - - Closer emulation of standard Lua, adding the `debug` and `io` libraries. This also enables seeking within binary - files, meaning you don't need to read large files into memory. - - Allow running multiple computers on multiple threads, reducing latency on worlds with many computers. - -## Relation to CCTweaks? -This mod has nothing to do with CCTweaks, though there is no denying the name is a throwback to it. That being said, -several features have been included, such as full block modems, the Cobalt runtime and map-like rendering for pocket -computers. +CC: Tweaked can be installed from [CurseForge] or [Modrinth]. It requires the [Minecraft Forge][forge] mod loader, but +[versions are available for Fabric][ccrestitched]. ## Contributing Any contribution is welcome, be that using the mod, reporting bugs or contributing code. If you want to get started @@ -46,8 +17,7 @@ ## Community There's also a fairly populated, albeit quiet [IRC channel](http://webchat.esper.net/?channels=computercraft), if that's more your cup of tea. -I'd generally recommend you don't contact me directly (email, DM, etc...) unless absolutely necessary (i.e. in order to -report exploits). You'll get a far quicker response if you ask the whole community! +We also host fairly comprehensive documentation at [tweaked.cc](https://tweaked.cc/ "The CC: Tweaked website"). ## Using CC: Tweaked is hosted on my maven repo, and so is relatively simple to depend on. You may wish to add a soft (or hard) @@ -70,3 +40,9 @@ ## Using We bundle the API sources with the jar, so documentation should be easily viewable within your editor. Alternatively, the generated documentation [can be browsed online](https://tweaked.cc/javadoc/). + +[computercraft]: https://github.com/dan200/ComputerCraft "ComputerCraft on GitHub" +[curseforge]: https://minecraft.curseforge.com/projects/cc-tweaked "Download CC: Tweaked from CurseForge" +[modrinth]: https://modrinth.com/mod/gu7yAYhd "Download CC: Tweaked from Modrinth" +[forge]: https://files.minecraftforge.net/ "Download Minecraft Forge." +[ccrestitched]: https://www.curseforge.com/minecraft/mc-mods/cc-restitched "Download CC: Restitched from CurseForge" diff --git a/doc/images/basic-terminal.png b/doc/images/basic-terminal.png new file mode 100644 index 000000000..782b850cd Binary files /dev/null and b/doc/images/basic-terminal.png differ diff --git a/doc/images/peripherals.png b/doc/images/peripherals.png new file mode 100644 index 000000000..16c2e807d Binary files /dev/null and b/doc/images/peripherals.png differ diff --git a/doc/images/turtle.png b/doc/images/turtle.png new file mode 100644 index 000000000..7c58553a0 Binary files /dev/null and b/doc/images/turtle.png differ diff --git a/doc/index.md b/doc/index.md index 9aca61855..ed7aa2848 100644 --- a/doc/index.md +++ b/doc/index.md @@ -1,11 +1,55 @@ -# ![CC: Tweaked](logo.png) [![Download CC: Tweaked on CurseForge](https://cf.way2muchnoise.eu/title/cc-tweaked.svg)](https://minecraft.curseforge.com/projects/cc-tweaked "Download CC: Tweaked on CurseForge") +# ![CC: Tweaked](logo.png) +CC: Tweaked is a mod for Minecraft which adds programmable computers, turtles and more to the game. A fork of the +much-beloved [ComputerCraft], it continues its legacy with better performance, stability, and a wealth of new features. -CC: Tweaked is a fork of [ComputerCraft], adding programmable computers, turtles and more to Minecraft. +CC: Tweaked can be installed from [CurseForge] or [Modrinth]. It requires the [Minecraft Forge][forge] mod loader, but +[versions are available for Fabric][ccrestitched]. -This website contains documentation for all Lua libraries and APIs from the latest version of CC: Tweaked. This -documentation is still in development, so will most likely be incomplete. If you've found something you think is wrong, -or would like to help out [please get in touch on GitHub][gh]. +## Features +Controlled using the [Lua programming language][lua], CC: Tweaked's computers provides all the tools you need to start +writing code and automating your Minecraft world. +![A ComputerCraft terminal open and ready to be programmed.](images/basic-terminal.png){.big-image} + +While computers are incredibly powerful, they're rather limited by their inability to move about. *Turtles* are the +solution here. They can move about the world, placing and breaking blocks, swinging a sword to protect you from zombies, +or whatever else you program them to! + +![A turtle tunneling in Minecraft.](images/turtle.png){.big-image} + +Not all problems can be solved with a pickaxe though, and so CC: Tweaked also provides a bunch of additional peripherals +for your computers. You can play a tune with speakers, display text or images on a monitor, connect all your +computers together with modems, and much more. + +Computers can now also interact with inventories such as chests, allowing you to build complex inventory and item +management systems. + +![A chest's contents being read by a computer and displayed on a monitor.](images/peripherals.png){.big-image} + +## Getting Started +While ComputerCraft is lovely for both experienced programmers and for people who have never coded before, it can be a +little daunting getting started. Thankfully, there's several fantastic tutorials out there: + + - [Direwolf20's ComputerCraft tutorials](https://www.youtube.com/watch?v=wrUHUhfCY5A "ComputerCraft Tutorial Episode 1 - HELP! and Hello World") + - [Sethbling's ComputerCraft series](https://www.youtube.com/watch?v=DSsx4VSe-Uk "Programming Tutorial with Minecraft Turtles -- Ep. 1: Intro to Turtles and If-Then-Else_End") + - [Lyqyd's Computer Basics 1](http://www.computercraft.info/forums2/index.php?/topic/15033-computer-basics-i/ "Computer Basics I") + +Once you're a little more familiar with the mod, the sidebar and links below provide more detailed documentation on the +various APIs and peripherals provided by the mod. + +If you get stuck, do pop in to the [Minecraft Computer Mod Discord guild][discord] or ComputerCraft's +[IRC channel][irc]. + +## Get Involved +CC: Tweaked lives on [GitHub]. If you've got any ideas, feedback or bugs please do [create an issue][bug]. + +[github]: https://github.com/SquidDev-CC/CC-Tweaked/ "CC: Tweaked on GitHub" [bug]: https://github.com/SquidDev-CC/CC-Tweaked/issues/new/choose [computercraft]: https://github.com/dan200/ComputerCraft "ComputerCraft on GitHub" -[gh]: https://github.com/SquidDev-CC/CC-Tweaked "CC:Tweaked on GitHub" +[curseforge]: https://minecraft.curseforge.com/projects/cc-tweaked "Download CC: Tweaked from CurseForge" +[modrinth]: https://modrinth.com/mod/gu7yAYhd "Download CC: Tweaked from Modrinth" +[forge]: https://files.minecraftforge.net/ "Download Minecraft Forge." +[ccrestitched]: https://www.curseforge.com/minecraft/mc-mods/cc-restitched "Download CC: Restitched from CurseForge" +[lua]: https://www.lua.org/ "Lua's main website" +[discord]: https://discord.computercraft.cc "The Minecraft Computer Mods Discord" +[irc]: http://webchat.esper.net/?channels=computercraft "IRC webchat on EsperNet" diff --git a/src/main/java/dan200/computercraft/core/apis/RedstoneAPI.java b/src/main/java/dan200/computercraft/core/apis/RedstoneAPI.java index 8437916bf..9cb04e9ea 100644 --- a/src/main/java/dan200/computercraft/core/apis/RedstoneAPI.java +++ b/src/main/java/dan200/computercraft/core/apis/RedstoneAPI.java @@ -30,15 +30,15 @@ * * @cc.usage Toggle the redstone signal above the computer every 0.5 seconds. * - *
+ * 
{@code
  * while true do
  *   redstone.setOutput("top", not redstone.getOutput("top"))
  *   sleep(0.5)
  * end
- * 
+ * }
* @cc.usage Mimic a redstone comparator in [subtraction mode][comparator]. * - *
+ * 
{@code
  * while true do
  *   local rear = rs.getAnalogueInput("back")
  *   local sides = math.max(rs.getAnalogueInput("left"), rs.getAnalogueInput("right"))
@@ -46,7 +46,7 @@
  *
  *   os.pullEvent("redstone") -- Wait for a change to inputs.
  * end
- * 
+ * }
* * [comparator]: https://minecraft.gamepedia.com/Redstone_Comparator#Subtract_signal_strength "Redstone Comparator on * the Minecraft wiki." @@ -205,9 +205,9 @@ public final int getBundledInput( ComputerSide side ) * @param mask The mask to test. * @return If the colours are on. * @cc.usage Check if @{colors.white} and @{colors.black} are on above the computer. - *
+     * 
{@code
      * print(redstone.testBundledInput("top", colors.combine(colors.white, colors.black)))
-     * 
+ * }
* @see #getBundledInput */ @LuaFunction diff --git a/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java b/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java index 16e2e839f..57164a2dd 100644 --- a/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java +++ b/src/main/java/dan200/computercraft/shared/computer/apis/CommandAPI.java @@ -91,9 +91,9 @@ private Object[] doCommand( String command ) * @cc.treturn number|nil The number of "affected" objects, or `nil` if the command failed. The definition of this * varies from command to command. * @cc.usage Set the block above the command computer to stone. - *
+     * 
{@code
      * commands.exec("setblock ~ ~1 ~ minecraft:stone")
-     * 
+ * }
*/ @LuaFunction( mainThread = true ) public final Object[] exec( String command ) @@ -117,9 +117,9 @@ public final Object[] exec( String command ) * @return The "task id". When this command has been executed, it will queue a `task_complete` event with a matching id. * @throws LuaException (hidden) If the task cannot be created. * @cc.usage Asynchronously sets the block above the computer to stone. - *
+     * 
{@code
      * commands.execAsync("~ ~1 ~ minecraft:stone")
-     * 
+ * }
* @cc.see parallel One may also use the parallel API to run multiple commands at once. */ @LuaFunction diff --git a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java b/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java index 7e02f1c28..fb9da8dda 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/monitor/MonitorPeripheral.java @@ -28,11 +28,11 @@ * @cc.module monitor * @cc.usage Write "Hello, world!" to an adjacent monitor: * - *
+ * 
{@code
  * local monitor = peripheral.find("monitor")
  * monitor.setCursorPos(1, 1)
  * monitor.write("Hello, world!")
- * 
+ * }
*/ public class MonitorPeripheral extends TermMethods implements IPeripheral { diff --git a/src/main/java/dan200/computercraft/shared/pocket/apis/PocketAPI.java b/src/main/java/dan200/computercraft/shared/pocket/apis/PocketAPI.java index 575f487d9..9acc14111 100644 --- a/src/main/java/dan200/computercraft/shared/pocket/apis/PocketAPI.java +++ b/src/main/java/dan200/computercraft/shared/pocket/apis/PocketAPI.java @@ -25,13 +25,13 @@ * This API is only available on pocket computers. As such, you may use its presence to determine what kind of computer * you are using: * - *
+ * 
{@code
  * if pocket then
  *   print("On a pocket computer")
  * else
  *   print("On something else")
  * end
- * 
+ * }
* * @cc.module pocket */ diff --git a/src/main/resources/data/computercraft/lua/rom/modules/main/cc/pretty.lua b/src/main/resources/data/computercraft/lua/rom/modules/main/cc/pretty.lua index 37b691505..874703a54 100644 --- a/src/main/resources/data/computercraft/lua/rom/modules/main/cc/pretty.lua +++ b/src/main/resources/data/computercraft/lua/rom/modules/main/cc/pretty.lua @@ -16,10 +16,12 @@ The structure of this module is based on [A Prettier Printer][prettier]. @module cc.pretty @usage Print a table to the terminal + local pretty = require "cc.pretty" pretty.print(pretty.pretty({ 1, 2, 3 })) @usage Build a custom document and display it + local pretty = require "cc.pretty" pretty.print(pretty.group(pretty.text("hello") .. pretty.space_line .. pretty.text("world"))) ]] @@ -74,6 +76,7 @@ end -- colour. -- @treturn Doc The document with the provided text. -- @usage Write some blue text. +-- -- local pretty = require "cc.pretty" -- pretty.print(pretty.text("Hello!", colours.blue)) local function text(text, colour) @@ -455,6 +458,7 @@ end -- `function: xxxxxxxx` (`false` by default). -- @treturn Doc The object formatted as a document. -- @usage Display a table on the screen +-- -- local pretty = require "cc.pretty" -- pretty.print(pretty.pretty({ 1, 2, 3 })) local function pretty(obj, options) diff --git a/src/main/resources/data/computercraft/lua/rom/programs/advanced/multishell.lua b/src/main/resources/data/computercraft/lua/rom/programs/advanced/multishell.lua index 1ff73ab9f..6465f9f7a 100644 --- a/src/main/resources/data/computercraft/lua/rom/programs/advanced/multishell.lua +++ b/src/main/resources/data/computercraft/lua/rom/programs/advanced/multishell.lua @@ -290,6 +290,7 @@ end -- @treturn number The index of the created process. -- @see os.run -- @usage Run the "hello" program, and set its title to "Hello!" +-- -- local id = multishell.launch({}, "/rom/programs/fun/hello.lua") -- multishell.setTitle(id, "Hello!") function multishell.launch(tProgramEnv, sProgramPath, ...) diff --git a/src/web/styles.css b/src/web/styles.css index 10c362d1d..a05a697f9 100644 --- a/src/web/styles.css +++ b/src/web/styles.css @@ -1,3 +1,11 @@ +/* Some misc styles */ + +.big-image { + display: block; + margin: 0 auto; + max-height: 400px; +} + /* Pretty tables, mostly inherited from table.definition-list */ table.pretty-table { border-collapse: collapse;