Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

longDistanceHarvester struggles in rooms with more than one source #2

Open
rfsjim opened this issue Jul 17, 2021 · 0 comments
Open
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rfsjim
Copy link
Owner

rfsjim commented Jul 17, 2021

Long Distance Harvesters need a better way to be issued with source, as current sourceId using array index [0] seems to switch between sources in a multi source room, making the harvesters move between source objects. Suggest could simply use full sourceID as a saved memory item for the room.

var source = creep.room.find(FIND_SOURCES)[creep.memory.sourceIndex];

// if creep is supposed to harvest energy from source
else {
// if in target room
if (creep.room.name == creep.memory.target) {
// find source
var source = creep.room.find(FIND_SOURCES)[creep.memory.sourceIndex];
// try to harvest energy, if the source is not in range
if (creep.harvest(source) == ERR_NOT_IN_RANGE) {
// move towards the source
creep.moveTo(source);
}
}

@rfsjim rfsjim added the bug Something isn't working label Jul 17, 2021
@rfsjim rfsjim self-assigned this Jul 17, 2021
@rfsjim rfsjim added this to the Redesign milestone Jul 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant