Navigation

    forum

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

    grey_blue

    @grey_blue

    1
    Posts
    776
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    grey_blue Follow

    Posts made by grey_blue

    • Creating a container and getting its id

      I'm trying to build a container and retrieve the id of the construction site.

      The constructing part works fine, i get an OK as result and see the site on the map.

      However, retrieving it directly after the Construction Line fails with different kind of approaches.

      With all the tests, i don't see the container. If I wait however one tick, it starts to appear. Why is that and is there any way to retrieve the id directly after creating it?

          testBuildContainer: function(room){
              var result = room.createConstructionSite(10,10, STRUCTURE_CONTAINER);
              console.log("result: " + result);
              
              // Test 1
              var room_find_c = room.find(FIND_CONSTRUCTION_SITES);
              console.log(JSON.stringify(room_find_c, null, 4));
              
              var room_find_s = room.find(FIND_STRUCTURES);
              console.log(JSON.stringify(room_find_s, null, 4));
              
              // Test 2
              var room_lookat = room.lookAt(10,10);
              console.log(JSON.stringify(room_lookat, null, 4));

              // Test 3
              console.log(JSON.stringify(room.find(FIND_CONSTRUCTION_SITES,{filter: (i)=> {return i.structureType==STRUCTURE_CONTAINER}}), null,4));
              
              // Test 4
              console.log(JSON.stringify(room.find(FIND_STRUCTURES,{filter: (i)=> {return i.structureType==STRUCTURE_CONTAINER}}), null,4));
          }

      posted in Help
      grey_blue