diff --git a/README.md b/README.md index f00ff83..5cac926 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,36 @@ A timer for CrossCode! It can also be used as an AutoSplitter for LiveSplit. -## Installation +# Installation 1. Install [CCLoader](https://github.com/CCDirectLink/CCLoader). -2. Download and extract [CCTimer](https://github.com/CCDirectLink/CCTimer/archive/master.zip). -3. Put the timer directory in the `assets/mods` directory. -4. To connect LiveSplit to CCTimer to LiveSplit add an AutoSplitter to your layout and set the script path to `/assets/mods/timer/CrossCode.asl`. +2. Download CCTimer through the mod manager. + +# Livesplit + +Livesplit is only available on Windows. +To connect LiveSplit to CCTimer to LiveSplit add an AutoSplitter to your layout and set the script path to `/assets/mods/timer/CrossCode.asl`. + +# Livesplit One + +Livesplit One is a web version of Livesplit and works on any platform. + +## Setup +1. Download [CCSpeedrunResources](https://github.com/CCDirectLink/CCSpeedrunResources), place it somewhere and unzip it +2. Copy all the contents of `CCSpeedrunResources/CATEGORY-OF-CHOISE/CCTimer Autosplitters` into `CrossCode/assets/mods/timer/` +4. Go to the [one.livesplit.org](https://one.livesplit.org) website +5. `Splits` -> `Import` -> `CCSpeedrunResources/CATEGORY-OF-CHOISE/Livesplit Blank Splits/CrossCode - CATEGORY` +6. Click the folder icon on the split after importing +7. `Back` + +## Things to do every time +1. Launch the game +2. Go to the [one.livesplit.org](https://one.livesplit.org) website +3. `Connect to Server` -> paste `ws://localhost:5000` +4. A message saying `Connected to server` should pop up in the bottom left corner +5. The timer should start when you click `New Game` in CrossCode + +# Creating splits ## Configuration @@ -270,4 +294,4 @@ Note: Time and State settings will be derived from the main `settings.json` auto A **Reset Splits** hotkey is also optionally included, which can be relevant in cases where you need a `"start"` condition to fire without relying on loading a preset or starting at New Game. -To make use of this, you'll need to install [input-api](https://github.com/CCDirectLink/input-api). \ No newline at end of file +To make use of this, you'll need to install [input-api](https://github.com/CCDirectLink/input-api). diff --git a/ccmod.json b/ccmod.json index 5eef8c0..2780da7 100644 --- a/ccmod.json +++ b/ccmod.json @@ -1,6 +1,6 @@ { "id": "timer", - "version": "3.0.2", + "version": "3.0.3", "title": "CCTimer", "description": "A speedrun timer for CrossCode.", "repository": "https://github.com/CCDirectLink/CCTimer", diff --git a/package.json b/package.json index e207edb..dafad2b 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "start": "esbuild --target=es2018 --format=esm --platform=node --bundle --sourcemap=inline --outfile=plugin.js src/plugin.js", "watch": "esbuild --target=es2018 --format=esm --platform=node --bundle --sourcemap=inline --watch --outfile=plugin.js src/plugin.js" }, - "version": "3.0.2", + "version": "3.0.3", "ccmodDependencies": { "ccloader": "^2.19.0" }, diff --git a/src/livesplitone.js b/src/livesplitone.js index d59bf03..8016be9 100644 --- a/src/livesplitone.js +++ b/src/livesplitone.js @@ -44,17 +44,17 @@ export class LiveSplitOneServer { }); } - _sendCommand(name) { + _sendCommand(command) { if (this.wsList) { for (const ws of Array.from(this.wsList)) { - ws.send(name); + ws.send(JSON.stringify(command)); } } } sendStart() { - this._sendCommand('reset'); - this._sendCommand('start') + this._sendCommand({ command: 'reset' }); + this._sendCommand({ command: 'start' }) Utils.log('Sent start'); } @@ -65,11 +65,11 @@ export class LiveSplitOneServer { */ sendIgt(value) { console.log('sendIgt:', value) - this._sendCommand(`setgametime ${value}`) + this._sendCommand({ command: 'setGameTime', time: value.toString() }) } sendSplit() { - this._sendCommand('split') + this._sendCommand({ command: 'split' }) Utils.log('Sent split'); } @@ -80,9 +80,9 @@ export class LiveSplitOneServer { */ sendPaused(paused) { if (paused) { - this._sendCommand('pausegametime') + this._sendCommand({ command: 'pauseGameTime' }) } else { - this._sendCommand('resumegametime') + this._sendCommand({ command: 'resumeGameTime' }) } } }