Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Farmingspots = []
- for(var number in Game.spawns['Spawn1'].room.memory.farmingspots)
- {
- var posinFarmingspots = Game.spawns['Spawn1'].room.memory.farmingspots[number];
- if(Game.spawns['Spawn1'].room.memory.farmingspots)
- {
- var neueRaumPosition = new RoomPosition(posinFarmingspots.x, posinFarmingspots.y, posinFarmingspots.roomName);
- Farmingspots.push(neueRaumPosition);
- }
- }
- var belegteFarmingspots = []
- for(var number in Game.creeps)
- {
- var creepMemoryFarmingspots = creep.memory.farmingspot
- if(creep.memory.farmingspot)
- {
- belegteFarmingspots.push(creepMemoryFarmingspots);
- }
- }
- if(creep.carry.energy < creep.carryCapacity)
- {
- if(creep.harvest(sources) == ERR_NOT_IN_RANGE)
- {
- if(!creep.memory.path && !creep.pos.isNearTo(sources) && !belegteFarmingspots)
- {
- creep.memory.Farmingspot = (creep.pos.findClosestByRange(Farmingspots)
- if(creep.memory.Farmingspot)
- {
- creep.memory.path = creep.pos.findPathTo(creep.memory.Farmingspot);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement