Skip to content

Instantly share code, notes, and snippets.

@ahkok

ahkok/init.lua Secret

Created January 18, 2017 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahkok/38e05e8f8208496fe317825ddb163c9a to your computer and use it in GitHub Desktop.
Save ahkok/38e05e8f8208496fe317825ddb163c9a to your computer and use it in GitHub Desktop.
simple mineteserver `make it do something` worldmod.
--[[
By default, minetestserver is idle until a player connects, so
we trigger it to generate some landscape for us which should
nicely cause it to do some actual work.
Afterwards, shut down the server gracefully.
--]]
local msgs = {
[core.EMERGE_CANCELLED] = "cancelled",
[core.EMERGE_ERRORED] = "error",
[core.EMERGE_FROM_MEMORY] = "loaded from memory",
[core.EMERGE_FROM_DISK] = "loaded from disk",
[core.EMERGE_GENERATED] = "generated"
}
minetest.after(0, function()
minetest.emerge_area({x = -100, y = -100, z = -100},
{x = 100, y = 100, z = 100},
function(blockpos, action, calls_remaining, param)
print("BBT: blockpos " .. minetest.pos_to_string(blockpos) .. ": " .. msgs[action])
end)
print("BBT: minetestserver running OK and executing tasks")
minetest.after(5, function()
print("BBT: minetestserver shutting down")
minetest.request_shutdown("Automatic shutdown")
end)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment