Force singlenode mapgen, add option to disable it

master
Wuzzy 2016-08-05 17:13:01 +02:00
parent b8dd955fd2
commit b8da953ea7
2 changed files with 25 additions and 3 deletions

View File

@ -3,7 +3,16 @@ The Origin
version 1.2.0
]]
local S
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
origin = {}
origin.settings = {}
do
local filepath = minetest.get_worldpath().."/origin.mt"
@ -14,10 +23,15 @@ do
else
origin.exists = false
end
origin.settings.force_singlenode = minetest.setting_getbool("origin_force_singlenode")
if origin.settings.force_singlenode == nil then
origin.settings.force_singlenode = true
end
end
minetest.register_node("origin:origin",{
description = "The Origin",
description = S("The Origin"),
is_ground_content = true,
groups = { not_in_creative_inventory = 1, immortal = 1 },
tiles = {"origin_origin.png"},
@ -26,12 +40,14 @@ minetest.register_node("origin:origin",{
})
minetest.register_on_mapgen_init(function(mgparams)
origin.mgparams = mgparams
if origin.settings.force_singlenode == true then
minetest.set_mapgen_params({mgname = "singlenode"})
end
end)
minetest.register_on_generated(function(minp, maxp, seed)
local spawn = minetest.setting_get_pos("static_spawnpoint")
if origin.exists ~= true and origin.mgparams.mgname == "singlenode" then
if origin.exists ~= true then
local blockpos
if spawn ~= nil then
blockpos = { x=spawn.x, y=spawn.y-1, z=spawn.z }

6
settingtypes.txt Normal file
View File

@ -0,0 +1,6 @@
# If enabled (true by default), the Origin mod automatically sets the map
# generator to singlenode and ignores the player-selected map generator in
# order to create an nearly empty world with the Origin near the center.
# Disabling this setting will make this mod place the Origin without changing
# the map generator, so it could appear in the v6 map generator, for example.
origin_force_singlenode (Force singlenode map generator) bool true