TheFatController icon indicating copy to clipboard operation
TheFatController copied to clipboard

Enhancment - Replace fake train viewer with Camera gui element

Open Nexela opened this issue 8 years ago • 1 comments

Would allow you to get rid of the fake player and all bugs associated with it. Example code below,

local function get_or_create_camera(player, factory)
    local gui = player.gui.goal.factory_camera
    if not gui then
        gui = player.gui.goal.add{
            type = "camera",
            name = "factory_camera",
            position={x=factory.inside_x,y= factory.inside_y},
            surface_index = factory.inside_surface.index
        }
    else
        gui.position={x=factory.inside_x, y=factory.inside_y}
        gui.surface_index = factory.inside_surface.index
    end
    gui.style.minimal_width= 300
    gui.style.minimal_height = 300
    return gui
end

local function destroy_camera(player)
    local gui = player.gui.goal.factory_camera
    return gui and gui.destroy()
end

Nexela avatar Apr 29 '17 08:04 Nexela

I tested it quickly (27 days ago :D ) and i found you couldn't control the train, just watch it.

Choumiko avatar May 26 '17 07:05 Choumiko