Open dev-bittlinger opened 3 years ago
according to export interface MoveOptions {
force?: boolean; // whether to ignore Zerg.blockMovement
so it is used to override blockMovement i.e if blockMomement is true, and you want to ignore it, then use force = true.
this is used correctly in goTo: static goTo(creep: AnyZerg, destination: HasPos | RoomPosition, opts: MoveOptions = {}): number { if (creep.blockMovement && !opts.force) { return ERR_BUSY; }
here, the default force is false, meaning, just accept blockMomement, but if blockMomevement is true and we want to ignore it, and move on, then we have to set force to true.
to use the same logic for .move(), then it should be move(direction: DirectionConstant, force = false) { if (creep.blockMovement && !force) { return ERR_BUSY; }
what do u think?
I mean, that's just another way of doing the same thing. We can check for the error first, of course.
Because:
if (!creep.blockMovement || force) {
// do it
} else {
return ERR_BUSY
}
is the same as:
if (creep.blockMovement && !opts.force) {
return ERR_BUSY
}
// do it
Bugfixes
Description:
There was a logic error in the AnyZerg move() method, causing the issue in Movement.vacatePos(). The method vacatePos() sets creep.blockMovement to true, but is meant to override it with force: true. The check in AnyZerg said "!this.blockMovement && !force" Therefore this method was not working, and the creep not moving. Swapped it to "!this.blockMovement || force".
Also fixed an issue where Zergs of a role would stop working if one of their kind was spawning, there was a return instead of an continue, aborting any Zerg actions after it.
Fixed:
Testing checklist:
tsconfig
configuration