mirror of
https://github.com/paradizelost/screeps.git
synced 2024-11-25 02:14:44 -06:00
Merge branch 'master' of https://github.com/paradizelost/screeps
This commit is contained in:
commit
6f6535faf1
14
Empire.js
14
Empire.js
@ -96,6 +96,20 @@ module.exports = {
|
|||||||
Game.rooms[name].memory.minablepositions = minablepositions
|
Game.rooms[name].memory.minablepositions = minablepositions
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computeMineralAccess: function(){
|
||||||
|
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||||
|
let name = myroom.name
|
||||||
|
let mineralminablepositions = 0
|
||||||
|
let minerals = Game.rooms[name].find(FIND_MINERALS);
|
||||||
|
for(let i = 0;i<minerals.length;i++)
|
||||||
|
{
|
||||||
|
mineralminablepositions = mineralminablepositions + this.computeSourceAccessPoints(Game.rooms[name],minerals[i])
|
||||||
|
//minablepositions = minablepositions + this.checkminablepositions(srcs[i])
|
||||||
|
}
|
||||||
|
//todo - create array of minable positions in the room and assign a screep to them, rather than having them constantly try to find the nearest one.
|
||||||
|
Game.rooms[name].memory.mineralminablepositions = mineralminablepositions
|
||||||
|
}
|
||||||
|
},
|
||||||
computeSourceAccessPoints: function(room, source){
|
computeSourceAccessPoints: function(room, source){
|
||||||
const roomTerrain = room.getTerrain();
|
const roomTerrain = room.getTerrain();
|
||||||
var accessPoints = 0;
|
var accessPoints = 0;
|
||||||
|
@ -43,8 +43,8 @@ let Phase1 = {
|
|||||||
console.log("Spawning Mover in " + room)
|
console.log("Spawning Mover in " + room)
|
||||||
require('proc.spawning').spawnmover(room)
|
require('proc.spawning').spawnmover(room)
|
||||||
}
|
}
|
||||||
if((Game.rooms[room].find(FIND_MY_STRUCTURES, {filter: {structureType: STRUCTURE_EXTRACTOR}}).length > 0)&&(creepcounts["miner"] < 1 || creepcounts["miner"]==undefined)&&(Game.rooms[room].energyAvailable >= Game.rooms[room].energyCapacityAvailable)){
|
if((Game.rooms[room].find(FIND_MY_STRUCTURES, {filter: {structureType: STRUCTURE_EXTRACTOR}}).length > 0)&&(creepcounts["miner"] < Game.rooms[room].memory.mineralminablepositions || creepcounts["miner"]==undefined)&&(Game.rooms[room].energyAvailable >= Game.rooms[room].energyCapacityAvailable)){
|
||||||
if(Game.rooms[room].find(FIND_MINERALS)[0].ticksToRegeneration < 1000){
|
if(Game.rooms[room].find(FIND_MINERALS)[0].ticksToRegeneration == undefined || Game.rooms[room].find(FIND_MINERALS)[0].ticksToRegeneration < 1000 ){
|
||||||
console.log("Spawning Miner in " + room)
|
console.log("Spawning Miner in " + room)
|
||||||
require('proc.spawning').spawnminer(room)
|
require('proc.spawning').spawnminer(room)
|
||||||
} else { if(Game.flags.debug && Game.flags.debug.room == Game.rooms[room]){console.log("Not spawning miner in " + room + ", waiting for regen")}}
|
} else { if(Game.flags.debug && Game.flags.debug.room == Game.rooms[room]){console.log("Not spawning miner in " + room + ", waiting for regen")}}
|
||||||
|
@ -10,6 +10,15 @@ let initroom = {
|
|||||||
Game.rooms[name].memory.tickssofar=0
|
Game.rooms[name].memory.tickssofar=0
|
||||||
Game.rooms[name].memory.maphits={}
|
Game.rooms[name].memory.maphits={}
|
||||||
//Game.rooms[name].memory.minablepositions= this.checkminablepositions(name)
|
//Game.rooms[name].memory.minablepositions= this.checkminablepositions(name)
|
||||||
|
let mineralminablepositions = 0
|
||||||
|
let minerals = Game.rooms[name].find(FIND_MINERALS);
|
||||||
|
for(let i = 0;i<minerals.length;i++)
|
||||||
|
{
|
||||||
|
mineralminablepositions = mineralminablepositions + this.computeSourceAccessPoints(Game.rooms[name],minerals[i])
|
||||||
|
//minablepositions = minablepositions + this.checkminablepositions(srcs[i])
|
||||||
|
}
|
||||||
|
//todo - create array of minable positions in the room and assign a screep to them, rather than having them constantly try to find the nearest one.
|
||||||
|
Game.rooms[name].memory.mineralminablepositions = mineralminablepositions
|
||||||
let minablepositions = 0
|
let minablepositions = 0
|
||||||
let srcs = Game.rooms[name].find(FIND_SOURCES);
|
let srcs = Game.rooms[name].find(FIND_SOURCES);
|
||||||
for(let i = 0;i<srcs.length;i++)
|
for(let i = 0;i<srcs.length;i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user