How to use the roads.shouldBuildAt function in roads

To help you get started, we’ve selected a few roads examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jerroydmoore / screeps-ai / creeps.js View on Github external
}

        code = creep.moveTo(target, opts);
        if (code === ERR_NO_PATH) {
            // ignore these. We can't cound blocked, because they re-path after 5 turns.
            creep.say(Errors.errorEmoji[ERR_NO_PATH]);
            return OK; 
        }
        Errors.check(creep, `moveTo ${target}`, code);
        if (code === OK || code === ERR_TIRED) {
            creep.busy = 1;
            if(code === OK && creep.memory.blocked && --creep.memory.blocked >= 0) {
                delete creep.memory.blocked;
            }
            if (! disableRoadCheck) {
                Roads.shouldBuildAt(creep);
            }
            return OK;
        } else if (code === ERR_NO_BODYPART) {
            // unable to move?
            this.suicide(creep);
        }
        return code;
    }

roads

An isomophic http framework

MIT
Latest version published 3 years ago

Package Health Score

36 / 100
Full package analysis