Skip to content

Enhancment - Replace fake train viewer with Camera gui element #23

@Nexela

Description

@Nexela

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions