minetest.register_on_newplayer(function(player)
    local name = player:get_player_name()
    minetest.show_formspec(name,"Presentation", 
        "size[10,10]"..
        "textarea[0.5,1;9.5,4;;;First i dont speak English,Hello,thanks for test Survivethedays(0.3),this is a little game still in WIP version(Work in progress),in this game you must survive during a determinated time,simple,theres some monsters in the " ..
        "world who will trie to kill the player,for the creation of this game i used Blender and Makehuman.Important change the time speed to 1440 in the game settings ]"..
        "label[1,5;Select the difficulty of the game]"..
        "label[3.5,6;The game will be easy.]"..
        "label[3.5,7;For casual players]"..
        "label[3.5,8;For tose wo want a challenge]"..
        "label[3.5,9;For tose .. i better don t say this]"..
        "button_exit[0.5,6;3,1;Easy;Easy]"..
        "button_exit[0.5,7;3,1;Mediun;Mediun]"..
        "button_exit[0.5,8;3,1;Hard;Hard]"..
        "button_exit[0.5,9;3,1;Nigthmare;Nightmare]")
        
end)

minetest.register_on_player_receive_fields(function(player, formname, fields)
    local name = player:get_player_name()
    local meta = player:get_meta()
    if formname ~= "Presentation" then
        return
    end

    if fields.Easy then
        minetest.kick_player(name, 'The player has win the game in easy difficulty,that was easy right?')
    elseif fields.Mediun then
        meta:set_int("difficulty",2)
        meta:set_int("days",14)
    elseif fields.Hard then
        meta:set_int("difficulty",3)
        meta:set_int("days",28)
    elseif fields.Nigthmare then
        meta:set_int("difficulty",4)
        meta:set_int("days",42)
    elseif fields.quit then
        meta:set_int("end",5)
        minetest.request_shutdown()
        
    end
   -- minetest.after(1,function(player)
    --    minetest.show_formspec(name,"Personaje", 
    --        "size[20,10]"..
    --        "model[0,0;10,10;'test';character2.obj;character2.png]")
    --end)
end)

sfinv.register_page("default:changelog", {
    title = "Changelog",
        get = function(self, player, context)
        return sfinv.make_formspec(player, context, [[
        size[10,10]
        textarea[0.1,0.1;8.5,4;;;
        V0.3
        Now the game can be win/Ahora se puede ganar el juego
        Change the text of the days pass for one of game win wo only shows wen the player win the game/Cambiado el texto de los dias pasados por uno de juego ganado que solo se muestra cuando el jugador gana el juego.
        Now the tall plants can slow the player movement./Ahora las plantas altas pueden desacelerar los movimientos del jugador.
        Added some test animations for the player./Annadidas algunas animaciones de prueba para el jugador
        Added the naturalslopeslib for change the aspect of the terrain./Annadido naturalslopeslib para cambiar el aspecto del terreno
        V0.2
        Now 'V6' is a disallowed mapgen./Ahora 'V6' es un generador de mapas no permitido.
        Code from survival and survivalconf mods combined whit default./Codigo de los mods survival y survivalconf combinado con default.
        Added a days pass text to the hud/Adicionado un texto de los dias pasados al hud.
        Change the player model for one of a wolfman/Se ha cambiado el modelo del jugador por uno de un hombre lobo.
        Now the player can only have 2 objects in the main inventory/Ahora el jugador solo puede llevar 2 objetos en el inventario principal.   
        Change the initial menu/cambiado el menu inicial.
            Now there is only a menu whit a litle explain of the game and the option for select the dificulty
            /Ahora solo hay un menu con una pequenna explicacion del juego y la opcion para seleccionar la dificultad.]
            ]], true)
    end
    
})
sfinv.register_page("survival:help", {
    title = "Help",
        get = function(self, player, context)
        return sfinv.make_formspec(player, context, [[
        size[10,10]
        textarea[0.1,0.1;8.5,4;;;Change the texture quality:
            For change te texture quality you must modify the file minetest.conf(not the example) in this file you will find a line who says this:texturequality = # just replace the #
            whit 1 or 10 or 25 or 50 or 75 or 100 depending of what you whant(1 is pixelate and 100 is ultra)
            Cambiar la calidad de las texturas:
                Para cambiar la calidad de las texturas debes modificar el archivo minetest.conf(no el ejemplo) en este archivo encontraras una linea que pone esto:texturequality = # solo cambia el #
                con 1 o 10 o 25 o 50 o 75 o 100 dependiendo de que quieras(1 es pixelado y 100 es ultra)]
            ]], true)
    end
    
})
sfinv.register_page("survival:Player", {
    title = "Player",
    get = function(self, player, context)
        return sfinv.make_formspec(player, context, [[
                --list[current_player;craft;1.75,0.5;3,3;]
                --list[current_player;craftpreview;5.75,1.5;1,1;]
                --image[4.75,1.5;1,1;sfinv_crafting_arrow.png]
                model[0,0;5,5;'';character2.obj;character2.png]
                listring[current_player;main]
                --listring[current_player;craft]
            ]], true)
    end
})