Screeps Wiki
Advertisement

Source Keepers are NPCs which are added to the game since February 2015 [1]. They are very lazy and will only shoot at creeps if they come near to the source they are resting at.

Writing AI's that can deal with Source Keepers[]

Detecting Source Keepers and separating them from other enemies[]

With the screeps API it's possible to fetch a list of enemy creeps.

Game.rooms.<insert room name>.find(FIND_HOSTILE_CREEPS);

But using this method would list all hostile creeps.

If an AI needs to know which enemy is an AI and which is a harmless Source Keeper (at least if you keep a safe distance), just pass a filter as second argument.

Game.rooms.<insert room name>.find(FIND_HOSTILE_CREEPS, {
    filter:function(enemy){enemy.owner.username !== 'Source Keeper'} // !== or ===, depending on use case
});

All we have to do is to check if Source Keeper is the owner of the creep with <creep>.owner.username.

References[]

Advertisement