Navigation

    forum

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

    inGe

    @inGe

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

    inGe Follow

    Posts made by inGe

    • RE: StructureLink.transferEnergy(...) shows deprecated warning message

      @postcrafter said in StructureLink.transferEnergy(...) shows deprecated warning message:

      receiver.withdraw(l)

      Hi PostCrafter, thank you for the reply,

      Sorry if I was not clear, in my example, both sender and receiver are Links.

      let receiver = Game.getObjectById("5a53c31cbba1f86d946a7a09") <<< StructureLink

      So transferEnergy should not be creating the warning message.

      posted in Technical Issues and Bugs
      inGe
    • StructureLink.transferEnergy(...) shows deprecated warning message

      Hi!

      • Shard2

      • Link structures working as expected but throwing an obsolete warning message that is not documented and no alternative implementation was provided in the docs.

      So I wrote this function

      function runLinks(room) { let receiver = Game.getObjectById("5a53c31cbba1f86d946a7a09");

      if (receiver) {
          receiver.memory.receiver = true;
      }
      else { return; }
      
      let senders = room.find(FIND_STRUCTURES, function (s) {
          s.structureType == STRUCTURE_LINK
              && !s.memory.receiver
      });
      for (let l of senders) {        
          if (l.energy > 0) {
              l.transferEnergy(receiver);
          }
      }
      

      }

      And the console is flooding with this warning message: Structure*.transferEnergy is considered deprecated and will be removed soon. Please use Creep.withdraw instead.

      The documentation uses the same implementation. I couldn't find any helpful info in google. http://docs.screeps.com/api/#StructureLink.transferEnergy

      Thanks

      posted in Technical Issues and Bugs
      inGe