diff --git a/init.lua b/init.lua index 03264e3..d9a9bc6 100644 --- a/init.lua +++ b/init.lua @@ -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 } diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..489a595 --- /dev/null +++ b/settingtypes.txt @@ -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