From 4d6ebf3ec963feb04872f98bbf6e2577a89e180e Mon Sep 17 00:00:00 2001 From: Adam Laycock Date: Tue, 21 Nov 2017 19:46:10 +0000 Subject: [PATCH] Basic readme and main.ts --- README.md | 20 ++++++++++++++++++++ src/main.ts | 8 ++++++++ 2 files changed, 28 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..24a8783 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# Screeps Typescript Starter + +Screeps Typescript Starter is a starting point for a Screeps AI written in Typescript. It provides everything you need to start writing your AI whilst leaving `main.ts` as empty as possible. + +## Usage + +You will need: + + - Node.JS (Latest LTS is recommended) + - A Package Manager (Yarn or NPM) + +Download the latest source [here](https://github.com/screepers/screeps-typescript-starter/archive/v3.0.zip) and extract it to a folder. + +Open the folder in your terminal and run `npm install` (or `yarn`) to install the dependencies. + +Fire up your preferred editor with typescript installed and you are good to go! + +## Typings + +The typings for Screeps comes from [typed-screeps](https://github.com/screepers/typed-screeps), if you have an issue with incorrect typings open an issue there. diff --git a/src/main.ts b/src/main.ts index 4ac5de3..67efd57 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,3 +1,11 @@ export function loop() { + + // Clear non-existing creep memory. + for(let name in Memory.creeps) { + if(!Game.creeps[name]) { + delete Memory[name]; + } + } + console.log(`Current tick is ${Game.time}`); }