diff --git a/init.lua b/init.lua index 62f16eb..a0b82bc 100644 --- a/init.lua +++ b/init.lua @@ -7,44 +7,50 @@ local DMAX = 20 local AREA_SIZE = 80 dofile(minetest.get_modpath(minetest.get_current_modname()).."/nodes.lua") -c_air = minetest.get_content_id("air") -c_ignore = minetest.get_content_id("ignore") -c_water = minetest.get_content_id("default:water_source") -c_grass = minetest.get_content_id("default:dirt_with_grass") -c_dry_grass = minetest.get_content_id("mg:dirt_with_dry_grass") -c_dirt_snow = minetest.get_content_id("default:dirt_with_snow") -c_snow = minetest.get_content_id("default:snow") -c_sapling = minetest.get_content_id("default:sapling") -c_tree = minetest.get_content_id("default:tree") -c_leaves = minetest.get_content_id("default:leaves") -c_junglesapling = minetest.get_content_id("default:junglesapling") -c_jungletree = minetest.get_content_id("default:jungletree") -c_jungleleaves = minetest.get_content_id("default:jungleleaves") -c_savannasapling = minetest.get_content_id("mg:savannasapling") -c_savannatree = minetest.get_content_id("mg:savannatree") -c_savannaleaves = minetest.get_content_id("mg:savannaleaves") -c_pinesapling = minetest.get_content_id("mg:pinesapling") -c_pinetree = minetest.get_content_id("mg:pinetree") -c_pineleaves = minetest.get_content_id("mg:pineleaves") -c_dirt = minetest.get_content_id("default:dirt") -c_stone = minetest.get_content_id("default:stone") -c_water = minetest.get_content_id("default:water_source") -c_ice = minetest.get_content_id("default:ice") -c_sand = minetest.get_content_id("default:sand") -c_sandstone = minetest.get_content_id("default:sandstone") -c_desert_sand = minetest.get_content_id("default:desert_sand") -c_desert_stone = minetest.get_content_id("default:desert_stone") -c_snowblock = minetest.get_content_id("default:snowblock") -c_cactus = minetest.get_content_id("default:cactus") -c_grass_1 = minetest.get_content_id("default:grass_1") -c_grass_2 = minetest.get_content_id("default:grass_2") -c_grass_3 = minetest.get_content_id("default:grass_3") -c_grass_4 = minetest.get_content_id("default:grass_4") -c_grass_5 = minetest.get_content_id("default:grass_5") + +local function get_content_id(name) + name = minetest.registered_aliases[name] or name + return minetest.get_content_id(name) +end + +c_air = get_content_id("air") +c_ignore = get_content_id("ignore") +c_water = get_content_id("default:water_source") +c_grass = get_content_id("default:dirt_with_grass") +c_dry_grass = get_content_id("mg:dirt_with_dry_grass") +c_dirt_snow = get_content_id("default:dirt_with_snow") +c_snow = get_content_id("default:snow") +c_sapling = get_content_id("default:sapling") +c_tree = get_content_id("default:tree") +c_leaves = get_content_id("default:leaves") +c_junglesapling = get_content_id("default:junglesapling") +c_jungletree = get_content_id("default:jungletree") +c_jungleleaves = get_content_id("default:jungleleaves") +c_savannasapling = get_content_id("mg:savannasapling") +c_savannatree = get_content_id("mg:savannatree") +c_savannaleaves = get_content_id("mg:savannaleaves") +c_pinesapling = get_content_id("mg:pinesapling") +c_pinetree = get_content_id("mg:pinetree") +c_pineleaves = get_content_id("mg:pineleaves") +c_dirt = get_content_id("default:dirt") +c_stone = get_content_id("default:stone") +c_water = get_content_id("default:water_source") +c_ice = get_content_id("default:ice") +c_sand = get_content_id("default:sand") +c_sandstone = get_content_id("default:sandstone") +c_desert_sand = get_content_id("default:desert_sand") +c_desert_stone = get_content_id("default:desert_stone") +c_snowblock = get_content_id("default:snowblock") +c_cactus = get_content_id("default:cactus") +c_grass_1 = get_content_id("default:grass_1") +c_grass_2 = get_content_id("default:grass_2") +c_grass_3 = get_content_id("default:grass_3") +c_grass_4 = get_content_id("default:grass_4") +c_grass_5 = get_content_id("default:grass_5") c_grasses = {c_grass_1, c_grass_2, c_grass_3, c_grass_4, c_grass_5} -c_jungle_grass = minetest.get_content_id("default:junglegrass") -c_dry_shrub = minetest.get_content_id("default:dry_shrub") -c_papyrus = minetest.get_content_id("default:papyrus") +c_jungle_grass = get_content_id("default:junglegrass") +c_dry_shrub = get_content_id("default:dry_shrub") +c_papyrus = get_content_id("default:papyrus") minetest.register_on_mapgen_init(function(mgparams) minetest.set_mapgen_params({mgname = "singlenode", flags = "nolight"}) diff --git a/nodes.lua b/nodes.lua index 24405ce..17b5744 100644 --- a/nodes.lua +++ b/nodes.lua @@ -84,6 +84,13 @@ minetest.register_abm({ -- Pine tree ------------------------- +if minetest.registered_nodes["default:pine_tree"] ~= nil then + minetest.register_alias("mg:pinetree", "default:pine_tree") + minetest.register_alias("mg:pineleaves", "default:pine_needles") + minetest.register_alias("mg:pinewood", "default:pine_wood") + minetest.register_alias("mg:pinesapling", "default:pine_sapling") +else + minetest.register_node("mg:pinetree", { description = "Pine Tree", tiles = {"mg_pine_tree_top.png", "mg_pine_tree_top.png", "mg_pine_tree.png"}, @@ -162,10 +169,16 @@ minetest.register_abm({ end }) +end + ------------------------- -- Other ------------------------- +if minetest.registered_nodes["default:dirt_with_dry_grass"] ~= nil then + minetest.register_alias("mg:dirt_with_dry_grass", "default:dirt_with_dry_grass") +else + minetest.register_node("mg:dirt_with_dry_grass", { description = "Dry Grass", tiles = {"mg_dry_grass.png", "default_dirt.png", "default_dirt.png^mg_dry_grass_side.png"}, @@ -177,6 +190,8 @@ minetest.register_node("mg:dirt_with_dry_grass", { }), }) +end + minetest.register_node("mg:ignore", { description = "MG Ignore", drawtype = "airlike",