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

creep.moveTo calculates new Path when creep fatigued and reusePath and visualizePathStyle is used #130

Open
Xtrapat opened this issue Apr 14, 2020 · 1 comment

Comments

@Xtrapat
Copy link

Xtrapat commented Apr 14, 2020

I don't know if this is intended or not, but if a creep uses moveTo over multiple Ticks while using the Options reusePath and visualizePathStyle, then every Tick the creep is fatigued when calling moveTo, a new Path is generated instead of using the one already saved in memory.

Example call over multiple Ticks: creep.moveTo(target, {reusePath: 50, visualizePathStyle: {})

I think the issue lies here:

engine/src/game/creeps.js

Lines 173 to 175 in 92a3fff

if(data(this.id).fatigue > 0 && (!opts || !opts.visualizePathStyle)) {
return C.ERR_TIRED;
}

This gets skipped when visualizePathStyle is in use, regardless of the .fatigue value.
Then when getting to this Point, at the end of the reusePath Block:

engine/src/game/creeps.js

Lines 271 to 283 in 92a3fff

var result = this.moveByPath(path);
if(result == C.OK) {
return C.OK;
}
}
}
if(opts.noPathFinding) {
return C.ERR_NOT_FOUND;
}
var path = this.pos.findPathTo(targetPos, opts);

var result = this.moveByPath(path); results, down the line in creep.move(), with C.ERR_TIRED, but creep.moveTo only returns on OK, thus continuing further down and generating a new Path at this.pos.findPathTo(targetPos, opts);

@jorbascrumps
Copy link

I've been debugging this behaviour for the last few hours before I came across this issue. Can we get confirmation on whether or not this is intended? I can't imagine why it would be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants