Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------Get worker moving
- Game.spawns.Spawn1.createCreep(
- [Game.WORK, Game.CARRY, Game.MOVE],
- 'Worker1'
- );
- --------HARVEST---Script Menu.
- var creep = Game.creeps.Worker1;
- var sources = creep.room.find(Game.SOURCES);
- creep.moveTo(sources[0]);
- creep.harvest(sources[0]);
- -----TRANFER Goes in script menu
- var creep = Game.creeps.Worker1;
- if(creep.energy < creep.energyCapacity) {
- var sources = creep.room.find(Game.SOURCES);
- creep.moveTo(sources[0]);
- creep.harvest(sources[0]);
- }
- else {
- creep.moveTo(Game.spawns.Spawn1);
- creep.transferEnergy(Game.spawns.Spawn1)
- }
- ------Create worker
- Game.spawns.Spawn1.createCreep(
- [Game.WORK, Game.CARRY, Game.MOVE],
- 'Worker2'
- );
- ----Dupe/Run for all workers
- for(var name in Game.creeps) {
- var creep = Game.creeps[name];
- if(creep.energy < creep.energyCapacity) {
- var sources = creep.room.find(Game.SOURCES);
- creep.moveTo(sources[0]);
- creep.harvest(sources[0]);
- }
- else {
- creep.moveTo(Game.spawns.Spawn1);
- creep.transferEnergy(Game.spawns.Spawn1)
- }
- }
- -----HARVEST Modules.
- module.exports = function (creep) {
- if(creep.energy < creep.energyCapacity) {
- var sources = creep.room.find(Game.SOURCES);
- creep.moveTo(sources[0]);
- creep.harvest(sources[0]);
- }
- else {
- creep.moveTo(Game.spawns.Spawn1);
- creep.transferEnergy(Game.spawns.Spawn1)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement