Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 1.54 KB

README.md

File metadata and controls

46 lines (31 loc) · 1.54 KB

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 {
    mavenCentral()
}
dependencies {
    implementation("io.github.exav: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
    })