StructureLink

Remotely transfers energy to another Link in the same room.

Controller level
1-4
5 2 links
6 3 links
7 4 links
8 6 links
Cost 5,000
Hits 1,000
Capacity 800
Cooldown time 1 tick per tile of the linear distance to the target
Energy loss 3%

effects array

Applied effects, an array of objects with the following properties:

parameter type description
effect number

Effect ID of the applied effect. Can be either natural effect ID or Power ID.

level
optional
number

Power level of the applied effect. Absent if the effect is not a Power effect.

ticksRemaining number

How many ticks will the effect last.

Inherited from RoomObject
pos RoomPosition

An object representing the position of this object in the room.

Inherited from RoomObject
room Room

The link to the Room object. May be undefined in case if an object is a flag or a construction site and is placed in a room that is not visible to you.

Inherited from Structure
hits number

The current amount of hit points of the structure.

Inherited from Structure
hitsMax number

The total amount of hit points of the structure.

Inherited from Structure
id string

A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id .

Inherited from Structure
structureType string

One of the STRUCTURE_* constants.

Inherited from Structure
destroy ()

Destroy this structure immediately.

Return value

One of the following codes:
constant value description
OK 0

The operation has been scheduled successfully.

ERR_NOT_OWNER -1

You are not the owner of this structure.

ERR_BUSY -4

Hostile creeps are in the room.

Inherited from Structure
isActive ()

Check whether this structure can be used. If room controller level is insufficient, then this method will return false, and the structure will be highlighted with red in the game.

Return value

A boolean value.

Inherited from Structure
notifyWhenAttacked (enabled)

Toggle auto notification when the structure is under attack. The notification will be sent to your account email. Turned on by default.

parameter type description
enabled boolean

Whether to enable notification or disable.

Return value

One of the following codes:
constant value description
OK 0

The operation has been scheduled successfully.

ERR_NOT_OWNER -1

You are not the owner of this structure.

ERR_INVALID_ARGS -10

enable argument is not a boolean value.

Inherited from OwnedStructure
my boolean

Whether this is your own structure.

Inherited from OwnedStructure
owner object

An object with the structure’s owner info containing the following properties:

parameter type description
username string

The name of the owner user.

cooldown number

The amount of game ticks the link has to wait until the next transfer is possible.

energy number

This property is deprecated and will be removed soon.

An alias for .store[RESOURCE_ENERGY] .

energyCapacity number

This property is deprecated and will be removed soon.

An alias for .store.getCapacity(RESOURCE_ENERGY) .

store Store

if(structure.store.getFreeCapacity(RESOURCE_ENERGY) > 0) {
    creep.transfer(structure, RESOURCE_ENERGY);
}

A Store object that contains cargo of this structure.

transferEnergy (target, [amount])

const linkFrom = Game.rooms['W1N1'].lookForAt('structure', 10, 25)[0];

const linkTo = linkFrom.pos.findInRange(FIND_MY_STRUCTURES, 2,
    {filter: {structureType: STRUCTURE_LINK}})[0];

linkFrom.transferEnergy(linkTo);

Remotely transfer energy to another link at any location in the same room.

parameter type description
target StructureLink

The target object.

amount
optional
number

The amount of energy to be transferred. If omitted, all the available energy is used.

Return value

One of the following codes:
constant value description
OK 0

The operation has been scheduled successfully.

ERR_NOT_OWNER -1

You are not the owner of this link.

ERR_NOT_ENOUGH_RESOURCES -6

The structure does not have the given amount of energy.

ERR_INVALID_TARGET -7

The target is not a valid StructureLink object.

ERR_FULL -8

The target cannot receive any more energy.

ERR_NOT_IN_RANGE -9

The target is too far away.

ERR_INVALID_ARGS -10

The energy amount is incorrect.

ERR_TIRED -11

The link is still cooling down.

ERR_RCL_NOT_ENOUGH -14

Room Controller Level insufficient to use this link.