Screep's Kotlin type definitions
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
gradle/wrapper
src
.gitignore
.travis.yml
CONTRIBUTING.md
LICENSE
README.md
build.gradle.kts
gradlew
gradlew.bat
settings.gradle.kts

README.md

screeps-kotlin-types

Kotlin Build Status Download

The repository for Screep's Kotlin type definitions. https://screeps.com/

Start here: https://github.com/exaV/screeps-kotlin-starter

Gradle

repositories {
    jcenter()
}
dependencies {
    compile "ch.delconte.screeps-kotlin:screeps-kotlin-types:<version>"
}

Extensions

Besides the types, the package screeps.utils.* holds some useful functions for playing screeps with Kotlin. Some notable utilities are documented below:

Lazy properties adapted for Screeps:

val expensiveToCompute: Int by lazyPerTick { <code executed at most once per tick> }

Memory delegates:
The function memory() creates a delegated property that is saved to memory. Such properties can only be created on objects that have access to memory such as Creep.memory or Flag.memory. By convention all types that have access to memory inherit from the MemoryMarker interface.

var CreepMemory.priority: Int by memory { 0 }
// access later with creep.memory.priority

Optional arguments to api functions:

 PathFinder.search(origin,goal, options {
        flee = true
    })