Navigation

    forum

    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    1. Home
    2. TelEGraffoNy
    • Flag Profile
    • block_user
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Groups
    • Blog

    TelEGraffoNy

    @TelEGraffoNy

    2
    Posts
    1191
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    TelEGraffoNy Follow

    Posts made by TelEGraffoNy

    • RE: It's possible to dissappear resources from store object using withdraw.

      And what must i do?

      posted in Technical Issues and Bugs
      TelEGraffoNy
    • SOS!!!

      Why donot in work?: var roleMule = { run: function(creep) {

          if(creep.memory.mule && creep.store[RESOURCE_ENERGY] == 0) {
              creep.memory.muleing = false;
          }
          if(!creep.memory.mule && creep.store.getFreeCapacity() == 0) {
              creep.memory.muleing = true;
          }
          
          var targets = creep.room.find(FIND_STRUCTURES, {
              filter: (structure) => {
                  return (structure.structureType == STRUCTURE_EXTENSION || structure.structureType == STRUCTURE_SPAWN || structure.structureType == STRUCTURE_TOWER) &&
                  structure.store.getFreeCapacity() > 0;
              }
          }); 
          
          var containers = creep.room.find(STRUCTURE_CONTAINER, {
              filter: (structure) => {
                  return (structure.structureType == STRUCTURE_CONTAINER) &&
                  (structure.store[RESOURCE_ENERGY] > 0);
              }
          }); 
          
          if(creep.memory.muleing) 
          {
              if(targets.length > 0) {
                  if(creep.transfer(targets[0], RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                      creep.moveTo(targets[0]);
                  }   
              }  
          }
              else 
          { 
              if(containers.length > 0) {
                  if(creep.withdraw(containers[0], RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                      creep.moveTo(containers[0]);
                  }
              }
          }
      }    
      

      };

      module.exports = roleMule;

      posted in Help
      TelEGraffoNy