mirror of
https://github.com/paradizelost/screeps.git
synced 2024-11-25 02:14:44 -06:00
adding ability to pass roomnames or not as appropriate
This commit is contained in:
parent
c0ec265a2d
commit
2a94fffaae
59
Empire.js
59
Empire.js
@ -39,58 +39,93 @@ module.exports = {
|
||||
}
|
||||
return 'Spawning initiated'
|
||||
},
|
||||
spawnnrworker: function(){
|
||||
spawnnrworker: function(name){
|
||||
if(name==null || name== undefined){
|
||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||
let name = myroom.name
|
||||
require('proc.spawning').spawnnrworker(name)
|
||||
}
|
||||
} else {
|
||||
require('proc.spawning').spawnnrworker(name)
|
||||
}
|
||||
return 'Spawning initiated'
|
||||
},
|
||||
spawnworker: function(){
|
||||
spawnworker: function(name){
|
||||
if(name!=null && name!= undefined){
|
||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||
let name = myroom.name
|
||||
require('proc.spawning').spawnworker(name)
|
||||
}
|
||||
} else {
|
||||
require('proc.spawning').spawnworker(name)
|
||||
}
|
||||
return 'Spawning initiated'
|
||||
},
|
||||
spawnminer: function(){
|
||||
spawnminer: function(name){
|
||||
if(name!=null && name!= undefined){
|
||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||
let name = myroom.name
|
||||
require('proc.spawning').spawnsourceminer(name)
|
||||
}
|
||||
} else {
|
||||
require('proc.spawning').spawnsourceminer(name)
|
||||
}
|
||||
return 'Spawning initiated'
|
||||
},
|
||||
spawnmover: function(){
|
||||
spawnmover: function(name){
|
||||
if(name!=null && name!= undefined){
|
||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||
let name = myroom.name
|
||||
require('proc.spawning').spawnmover(name)
|
||||
}
|
||||
} else {
|
||||
require('proc.spawning').spawnmover(name)
|
||||
}
|
||||
return 'Spawning initiated'
|
||||
},
|
||||
spawnclaimer: function(){
|
||||
spawnclaimer: function(name){
|
||||
if(name!=null && name!= undefined){
|
||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||
let name = myroom.name
|
||||
require('proc.spawning').spawnclaimer(name)
|
||||
}
|
||||
} else {
|
||||
require('proc.spawning').spawnclaimer(name)
|
||||
}
|
||||
return 'Spawning initiated'
|
||||
},
|
||||
removeConstruction: function(roomname){
|
||||
_.invoke(Game.rooms[roomname].find(FIND_MY_CONSTRUCTION_SITES), 'remove')
|
||||
removeConstruction: function(name){
|
||||
if(name==null || name== undefined){
|
||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||
let name = myroom.name
|
||||
_.invoke(Game.rooms[name].find(FIND_MY_CONSTRUCTION_SITES), 'remove')
|
||||
}
|
||||
} else {
|
||||
_.invoke(Game.rooms[name].find(FIND_MY_CONSTRUCTION_SITES), 'remove')
|
||||
}
|
||||
},
|
||||
removeAllConstruction: function(){
|
||||
_.invoke(_.map(Game.constructionSites, (x)=>x), 'remove')
|
||||
},
|
||||
removeWalls: function(roomname){
|
||||
Game.rooms[roomname].find(FIND_STRUCTURES, {filter: s => s.structureType === STRUCTURE_WALL}).forEach(s => s.destroy())
|
||||
removeWalls: function(name){
|
||||
if(name==null || name== undefined){
|
||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||
let name = myroom.name
|
||||
Game.rooms[name].find(FIND_STRUCTURES, {filter: s => s.structureType === STRUCTURE_WALL}).forEach(s => s.destroy())
|
||||
}
|
||||
} else {
|
||||
Game.rooms[name].find(FIND_STRUCTURES, {filter: s => s.structureType === STRUCTURE_WALL}).forEach(s => s.destroy())
|
||||
}
|
||||
},
|
||||
removeRoads: function(roomname,hitsleft){
|
||||
Game.rooms[roomname].find(FIND_STRUCTURES, {filter: s => (s.structureType === STRUCTURE_ROAD && s.hits < hitsleft)}).forEach(s => s.destroy())
|
||||
removeRoads: function(name,hitsleft){
|
||||
Game.rooms[name].find(FIND_STRUCTURES, {filter: s => (s.structureType === STRUCTURE_ROAD && s.hits < hitsleft)}).forEach(s => s.destroy())
|
||||
return "done"
|
||||
},
|
||||
sellEnergy: function(roomname){
|
||||
sellEnergy: function(name){
|
||||
let myorders = Game.market.getAllOrders(order=>order.resourceType == RESOURCE_ENERGY && order.type == ORDER_SELL)
|
||||
},
|
||||
computeSourceAccess: function(){
|
||||
|
||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||
let name = myroom.name
|
||||
let minablepositions = 0
|
||||
|
5
proc.creepfunctions.js
Normal file
5
proc.creepfunctions.js
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
spawnwarrior: function(){
|
||||
|
||||
}
|
||||
}
|
@ -94,7 +94,11 @@ let buildparts = {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tobuild != null && tobuild != undefined){
|
||||
let newcreep = spawn.createCreep(tobuild,CreepName,{spawnedat: Game.time,role:"phase" + Game.rooms[roomname].memory.phase +"worker"})
|
||||
} else {
|
||||
console.log("not enough e in " + roomname + " to spawn")
|
||||
}
|
||||
}}
|
||||
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user