exaV / screeps-kotlin-types

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

Make a Controller's .owner be nullable (prettier diff) #23

Closed magnusesp closed 5 years ago

exaV commented 5 years ago

Hey thanks for the PR

from the documentation of OwnedStructure it is not clear in which cases the owner could be null. Since it can be null in StructureController I wonder whether it could be null in other cases too. If there are more cases we may consider making Owner nullable in general. If we did that, how would it affect your codebase?

Edit: I just saw the other PR that Jomik closed. So apparently there seem to be some things which always have an owner.

magnusesp commented 5 years ago

Hey,

Yes, I think creeps and other structures always has an owner. I haven't found anything besides the controller that has been null, so I think it's both safe and convenient to keep it like this.

Structures that have been abandoned are owned by Screeps, as far as I know. Invaders are owned by Invaders.

exaV commented 5 years ago

I was wondering what the case was for abandoned structures, thanks for clearing it up. And thanks for your contribution!