Skip to content
Snippets Groups Projects
Select Git revision
  • 40f657951cd2f82401cc4ff4d48b8e9f8f1d663b
  • master default protected
2 results

spawn.lua

Blame
  • Peter Nerlich's avatar
    Peter Nerlich authored
    new structure, add many blocks to be ignored by trains, add /spawn command, warn if default password
    40f65795
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    spawn.lua 656 B
    -- stolen from pandorabox.io https://github.com/pandorabox-io/pandorabox_custom
    
    local spawn_command = {}
    spawn_command.pos = {x=-130, y=13, z=-62}
    
    if minetest.setting_get_pos("static_spawnpoint") then
        spawn_command.pos = minetest.setting_get_pos("static_spawnpoint")
    end
    
    local function teleport_to_spawn(name)
        local player = minetest.get_player_by_name(name)
        if player == nil then
            return false
        end
        player:setpos(spawn_command.pos)
        minetest.chat_send_player(name, "Teleported to spawn!")
    end
    
    minetest.register_chatcommand("spawn", {
        description = "Teleports you to the spawn point.",
        func = teleport_to_spawn,
    })