From 2aabeb33db4c3c23b1f256bfe6c440bb7719ed26 Mon Sep 17 00:00:00 2001 From: ademant Date: Wed, 10 Oct 2018 13:18:29 +0200 Subject: [PATCH] use of minetest.get_current_modname instead of hard coding --- decorations.lua | 17 +++++++++-------- init.lua | 2 +- nodes.lua | 28 +++++++--------------------- 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/decorations.lua b/decorations.lua index e9f70d5..111a334 100644 --- a/decorations.lua +++ b/decorations.lua @@ -1,10 +1,11 @@ local path = minetest.get_modpath("30biomes") local defaultpath = minetest.get_modpath("default") +local modname = minetest.get_current_modname() -- Mud in swamps minetest.register_ore({ ore_type = "blob", - ore = "30biomes:mud", + ore = modname..":mud", wherein = {"default:dirt", "default:dirt_with_grass"}, clust_scarcity = 12*12*12, clust_size = 10, @@ -46,7 +47,7 @@ minetest.register_ore({ -- Jungle grass minetest.register_decoration({ deco_type = "simple", - place_on = {"default:dirt_with_grass", "30biomes:mud"}, + place_on = {"default:dirt_with_grass", modname..":mud"}, sidelen = 16, noise_params = { offset = 0.15, @@ -520,9 +521,9 @@ minetest.register_decoration({ {name = "air", prob = 0}, {name = "air", prob = 0}, {name = "air", prob = 0}, - {name = "30biomes:fir_tree", param2 = 12, prob = 191}, - {name = "30biomes:fir_tree", param2 = 12}, - {name = "30biomes:fir_tree", param2 = 12, prob = 127}, + {name = modname..":fir_tree", param2 = 12, prob = 191}, + {name = modname..":fir_tree", param2 = 12}, + {name = modname..":fir_tree", param2 = 12, prob = 127}, {name = "air", prob = 0}, {name = "flowers:mushroom_red", prob = 63}, {name = "air", prob = 0}, @@ -573,9 +574,9 @@ minetest.register_decoration({ {name = "air", prob = 0}, {name = "air", prob = 0}, {name = "air", prob = 0}, - {name = "30biomes:fir_tree", param2 = 12, prob = 191}, - {name = "30biomes:fir_tree", param2 = 12}, - {name = "30biomes:fir_tree", param2 = 12, prob = 127}, + {name = modname..":fir_tree", param2 = 12, prob = 191}, + {name = modname..":fir_tree", param2 = 12}, + {name = modname..":fir_tree", param2 = 12, prob = 127}, {name = "air", prob = 0}, {name = "flowers:mushroom_red", prob = 63}, {name = "air", prob = 0}, diff --git a/init.lua b/init.lua index b1dfe25..37c5dd2 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,5 @@ local path = minetest.get_modpath("30biomes") - +local modname = minetest.get_current_modname() minetest.clear_registered_decorations() minetest.clear_registered_biomes() diff --git a/nodes.lua b/nodes.lua index 6a078a6..e20f88a 100644 --- a/nodes.lua +++ b/nodes.lua @@ -1,12 +1,13 @@ +local modname = minetest.get_current_modname() -- Mud for swamps -minetest.register_node("30biomes:mud", { +minetest.register_node(modname..":mud", { description = "Mud", tiles = {"biomes_mud.png"}, liquid_viscosity = 8, liquidtype = "source", liquid_renewable = false, - liquid_alternative_source = "30biomes:mud", - liquid_alternative_flowing = "30biomes:mud", + liquid_alternative_source = modname..":mud", + liquid_alternative_flowing = modname..":mud", liquid_range = 0, post_effect_color = {r=115, g=61, b=31, a=255}, drowning = 1, @@ -16,7 +17,7 @@ minetest.register_node("30biomes:mud", { }) -- Fir tree -minetest.register_node("30biomes:fir_tree", { +minetest.register_node(modname..":fir_tree", { description = "Fir Tree", tiles = {"biomes_fir_tree_top.png", "biomes_fir_tree_top.png", "biomes_fir_tree.png"}, paramtype2 = "facedir", @@ -28,7 +29,7 @@ minetest.register_node("30biomes:fir_tree", { }) -- Fir needles -minetest.register_node("30biomes:fir_needles", { +minetest.register_node(modname..":fir_needles", { description = "Fir Needles", drawtype = "allfaces_optional", waving = 1, @@ -36,24 +37,9 @@ minetest.register_node("30biomes:fir_needles", { paramtype = "light", is_ground_content = false, groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, - --[[drop = { - max_items = 1, - items = { - { - -- player will get sapling with 1/20 chance - items = {'default:sapling'}, - rarity = 20, - }, - { - -- player will get leaves only if he get no saplings, - -- this is because max_items is 1 - items = {'default:leaves'}, - } - } - },]] sounds = default.node_sound_leaves_defaults(), after_place_node = default.after_place_leaves, }) -minetest.register_alias("30biomes:fir_needles", "fir_needles") +minetest.register_alias(modname..":fir_needles", "fir_needles")