exaV / screeps-kotlin-types

Screep's Kotlin type definitions
MIT License
17 stars 18 forks source link

Update Store.kt #61

Closed kboduch closed 4 years ago

kboduch commented 4 years ago

getCapacity returns null when used on a structure.

        val targets = toRoom.find(FIND_MY_STRUCTURES)
            .filter { (it.structureType == STRUCTURE_EXTENSION || it.structureType == STRUCTURE_SPAWN) }

        targets.map {
            console.log(it.structureType)
            console.log(it.unsafeCast<StoreOwner>().store[RESOURCE_ENERGY])
            console.log(it.unsafeCast<StoreOwner>().store.getCapacity())
        }

[01:41:28]spawn [01:41:28]300 [01:41:28]null [01:41:28]extension [01:41:28]50 [01:41:28]null [01:41:28]extension [01:41:28]50 [01:41:28]null [01:41:28]extension [01:41:28]50 [01:41:28]null

magnusesp commented 4 years ago

Seems like this is in line with the API. https://docs.screeps.com/api/#Store

exaV commented 4 years ago

Thanks for taking the time to submit the fix

exaV commented 4 years ago

Addendum: https://github.com/exaV/screeps-kotlin-types/commit/35a6fa43dfcb83a2bec1cc940dac01a8a9d1323e should be released as 1.9.1