export function deref ( ref ) { return Game . getObjectById ( ref ) || Game . flags [ ref ] || Game . creeps [ ref ] || Game . spawns [ ref ] || null ; } export function derefRoomPosition ( protoPos ) { return new RoomPosition ( protoPos . x , protoPos . y , protoPos . roomName ) ; } export interface EnergyStructure extends Structure { energy : number ; energyCapacity : number ; } export interface StoreStructure extends Structure { store : StoreDefinition ; storeCapacity : number ; } export function isEnergyStructure ( structure ) { return ( < EnergyStructure > structure ) . energy != undefined && ( < EnergyStructure > structure ) . energyCapacity != undefined ; } export function isStoreStructure ( structure ) { return ( < StoreStructure > structure ) . store != undefined ; }