gui example:
Code: Select all
game.oninit(function()
td_gui = game.player.gui.left.add{type='frame', name='statistics', caption='statistics', direction='vertical'}
td_gui.add{type='button', name='turret', caption="turret", colspan=2}
td_gui.add{type='button', name='laser', caption="laser", colspan=2}
end)
game.onevent(defines.events.onguiclick, function(event)
if event.element.name == "turret" then
game.player.insert({name="gun-turret", count="1"})
end
if event.element.name == "laser" then
game.player.insert({name="laser-turret", count="1"})
end
end)