Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Nexela opened this issue Apr 29, 2017 · 1 comment
Open

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

Nexela opened this issue Apr 29, 2017 · 1 comment

Comments

@Nexela
Copy link

Nexela commented Apr 29, 2017

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
@Choumiko
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants