LuaItemStack.build_blueprint failing

Place to get help with not working mods / modding interface.
scruffyvoltherder
Burner Inserter
Burner Inserter
Posts: 9
Joined: Fri Jun 14, 2024 12:33 am
Contact:

LuaItemStack.build_blueprint failing

Post by scruffyvoltherder »

This function should create a surface, and then paste the blueprint from bp_string. It creates the surface just fine, but there aren't any ghosts on the created surface. surface.create_entity works, build_blueprint doesn't. Any ideas what's happening?

Code: Select all

function PLCbuilder.plc_surface(force)

   local surface_name='PLC-event-surface-'..force.name

    if game.surfaces[surface_name] then
        return game.surfaces[surface_name]
      end
    
      local surface = game.create_surface(surface_name)
      surface.generate_with_lab_tiles = true
      surface.always_day=true
    
      local bp_string="0eNrNVNtugzAM/Rc/TmGC9Mb4lamquLitJUhQEqp1Ff8+J0xdt9L18jCNB4Rj+xwfO/gARd1ha0g5yA5ApVYWstcDWNqovPZnbt8iZEAOGxCg8sZbWGPpDJURKjSbfcT5aNZ5idALIFXhG2RJL67i5IbctkHHSKVuClK50+YEQ/ZLAagcOcKhsGDsV6prCjRMcoRqsKKuiY6VtbpGJmq15WStfAkMGE2eZwL2wwfzKKTNttCd8ehSLJa+6B8c8k6O3ygSkY5RTG7o7BlPHFhipqjIcFbwzAUU3XqNZmXpnQGT+PiM8E6vTOK8f/GnOMm0fFuc0fWqwG2+Iw7nmC+cFburkGu9w6K3/aF1ub9uXL5u0eQDOjxBP0CqQUpISvxrYxDV6fCpCjpLMmVHLph8UThbXgyffQ9POLwf6cfs7n4k/6Qf0/N+jAmc3yvwb+ctb9V3aYCLR/fB7f9q+uA6uLRweMOFpZid7GIBOzQ2YMg0mS5e5CJN0/lLIvv+A5AQ76g="
      local inventory=game.create_inventory(1)
      local center_bp=inventory[1]
      center_bp.import_stack(bp_string)

      surface.request_to_generate_chunks({0,0},1)
      surface.force_generate_chunk_requests()
      
      local built=center_bp.build_blueprint{
        surface=surface, force=force.name, position={x=0,y=0}, 
        force_build=true, skip_fog_of_war=false,
      }

      local chunks=surface.get_chunks()

      local entities=center_bp.get_blueprint_entities()

     local test=1


     return surface

end

Post Reply

Return to “Modding help”