Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/SquidDev-CC/copy-cat

A ComputerCraft emulator for the web
https://github.com/SquidDev-CC/copy-cat

computercraft emulator

Last synced: 3 days ago
JSON representation

A ComputerCraft emulator for the web

Awesome Lists containing this project

README

        

# Copy Cat

[Copy Cat][copycat] is a ComputerCraft emulator for the web, heavily inspired by
the a similar project [Mimic][mimic]. However, unlike Mimic, it's built from the
mod's source code - ensuring that it's always 1 as accurate as
possible.

The interface is essentially the same as [Cloud Catcher][cloud], but with the
computer running right in your browser rather than a server!

---

1. While we try to keep as close as we can, there are some elements
which are impossible to emulate due to the restricted environment of a browser.

For instance, the `http` API has been entirely recreated, and some functionality
(such as setting specific headers or requesting some sites) is not possible. As
with any emulator, there will be subtle differences in how input events (key
presses, mouse clicks, etc...) are handled, so do not rely on our behaviour.

And yes, this disclaimer was longer than the actual description.

## Screenshots
![The emulator in action](img/startup-url.png "The emulator in action")

![Editing a file](img/editor.png "Editing a file")

## Embedding
It's possible to embed copy-cat within another website. This may be useful if
you want to show off your programs on their own site.

```html

// Tell requirejs to load copycat/* from the website.
require.config({ paths: { copycat: "https://copy-cat.squiddev.cc/" } });
// Find our #embed-computer element and inject a computer terminal into it.
require(["copycat/embed"], setup => setup(document.getElementById("embed-computer")));

```

The setup function also accepts several arguments, which are demonstrated in
[this example](src/web/example/index.html).

## Build it yourself
Due to the nature of this project, Copy Cat has a rather strange build setup. We
take sources of [[CC: Tweaked][cct], modify them to work in a Javascript
environment, and then compile them to JS. Thankfully, this is all automated by
Gradle. However, it does require a bit of setup:

Before getting started, you will need the JDK (Java Development Kit), and NodeJS
installed and on the path.

- Clone Copy Cat with submodules: `git clone --recursive https://github.com/SquidDev-CC/copy-cat`
- Install NodeJS packages: `npm install`
- Build: `./gradlew assemble`. You can also automatically build everything when
a file changes using `./gradlew assemble --continuous`.

The resulting website should be in `build/web`.

Use `git submodule foreach git pull` in order to update all source repositories.
You will probably need to apply and then regenerate patches after doing so.

[copycat]: https://copy-cat.squiddev.cc "Try Copy Cat online"
[mimic]: https://gravlann.github.io/ "The Mimic ComputerCraft emulator"
[cloud]: https://github.com/SquidDev-CC/cloud-catcher "The Cloud Catcher repository"
[cct]: https://github.com/cc-tweaked/CC-Tweaked "The CC: Tweaked repository"