To reproduce, place this in control.lua. Confirm that when entering a tank the tank's GUI is automatically opened.
Code: Select all
script.on_event(defines.events.on_tick, function(e)
for index, player in pairs(game.connected_players) do
if player and player.driving and player.vehicle then
player.opened = player.vehicle
end
end
end)
Code: Select all
script.on_event(defines.events.on_tick, function(e)
for index, player in pairs(game.connected_players) do
if player and player.driving and player.vehicle then
assert(player.vehicle.grid)
player.opened = player.vehicle.grid
end
end
end)