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
79
Empire.js
79
Empire.js
@ -39,58 +39,93 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
return 'Spawning initiated'
|
return 'Spawning initiated'
|
||||||
},
|
},
|
||||||
spawnnrworker: function(){
|
spawnnrworker: function(name){
|
||||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
if(name==null || name== undefined){
|
||||||
let name = myroom.name
|
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||||
|
let name = myroom.name
|
||||||
|
require('proc.spawning').spawnnrworker(name)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
require('proc.spawning').spawnnrworker(name)
|
require('proc.spawning').spawnnrworker(name)
|
||||||
}
|
}
|
||||||
return 'Spawning initiated'
|
return 'Spawning initiated'
|
||||||
},
|
},
|
||||||
spawnworker: function(){
|
spawnworker: function(name){
|
||||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
if(name!=null && name!= undefined){
|
||||||
let name = myroom.name
|
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||||
|
let name = myroom.name
|
||||||
|
require('proc.spawning').spawnworker(name)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
require('proc.spawning').spawnworker(name)
|
require('proc.spawning').spawnworker(name)
|
||||||
}
|
}
|
||||||
return 'Spawning initiated'
|
return 'Spawning initiated'
|
||||||
},
|
},
|
||||||
spawnminer: function(){
|
spawnminer: function(name){
|
||||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
if(name!=null && name!= undefined){
|
||||||
let name = myroom.name
|
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||||
|
let name = myroom.name
|
||||||
|
require('proc.spawning').spawnsourceminer(name)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
require('proc.spawning').spawnsourceminer(name)
|
require('proc.spawning').spawnsourceminer(name)
|
||||||
}
|
}
|
||||||
return 'Spawning initiated'
|
return 'Spawning initiated'
|
||||||
},
|
},
|
||||||
spawnmover: function(){
|
spawnmover: function(name){
|
||||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
if(name!=null && name!= undefined){
|
||||||
let name = myroom.name
|
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||||
|
let name = myroom.name
|
||||||
|
require('proc.spawning').spawnmover(name)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
require('proc.spawning').spawnmover(name)
|
require('proc.spawning').spawnmover(name)
|
||||||
}
|
}
|
||||||
return 'Spawning initiated'
|
return 'Spawning initiated'
|
||||||
},
|
},
|
||||||
spawnclaimer: function(){
|
spawnclaimer: function(name){
|
||||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
if(name!=null && name!= undefined){
|
||||||
let name = myroom.name
|
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||||
|
let name = myroom.name
|
||||||
|
require('proc.spawning').spawnclaimer(name)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
require('proc.spawning').spawnclaimer(name)
|
require('proc.spawning').spawnclaimer(name)
|
||||||
}
|
}
|
||||||
return 'Spawning initiated'
|
return 'Spawning initiated'
|
||||||
},
|
},
|
||||||
removeConstruction: function(roomname){
|
removeConstruction: function(name){
|
||||||
_.invoke(Game.rooms[roomname].find(FIND_MY_CONSTRUCTION_SITES), 'remove')
|
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(){
|
removeAllConstruction: function(){
|
||||||
_.invoke(_.map(Game.constructionSites, (x)=>x), 'remove')
|
_.invoke(_.map(Game.constructionSites, (x)=>x), 'remove')
|
||||||
},
|
},
|
||||||
removeWalls: function(roomname){
|
removeWalls: function(name){
|
||||||
Game.rooms[roomname].find(FIND_STRUCTURES, {filter: s => s.structureType === STRUCTURE_WALL}).forEach(s => s.destroy())
|
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){
|
removeRoads: function(name,hitsleft){
|
||||||
Game.rooms[roomname].find(FIND_STRUCTURES, {filter: s => (s.structureType === STRUCTURE_ROAD && s.hits < hitsleft)}).forEach(s => s.destroy())
|
Game.rooms[name].find(FIND_STRUCTURES, {filter: s => (s.structureType === STRUCTURE_ROAD && s.hits < hitsleft)}).forEach(s => s.destroy())
|
||||||
return "done"
|
return "done"
|
||||||
},
|
},
|
||||||
sellEnergy: function(roomname){
|
sellEnergy: function(name){
|
||||||
let myorders = Game.market.getAllOrders(order=>order.resourceType == RESOURCE_ENERGY && order.type == ORDER_SELL)
|
let myorders = Game.market.getAllOrders(order=>order.resourceType == RESOURCE_ENERGY && order.type == ORDER_SELL)
|
||||||
},
|
},
|
||||||
computeSourceAccess: function(){
|
computeSourceAccess: function(){
|
||||||
|
|
||||||
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
for(let myroom of _.filter(Game.rooms, 'controller.my')) {
|
||||||
let name = myroom.name
|
let name = myroom.name
|
||||||
let minablepositions = 0
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let newcreep = spawn.createCreep(tobuild,CreepName,{spawnedat: Game.time,role:"phase" + Game.rooms[roomname].memory.phase +"worker"})
|
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