use of minetest.get_current_modname instead of hard coding

This commit is contained in:
ademant 2018-10-10 13:18:29 +02:00
parent 03967a9f1b
commit 2aabeb33db
3 changed files with 17 additions and 30 deletions

View File

@ -1,10 +1,11 @@
local path = minetest.get_modpath("30biomes") local path = minetest.get_modpath("30biomes")
local defaultpath = minetest.get_modpath("default") local defaultpath = minetest.get_modpath("default")
local modname = minetest.get_current_modname()
-- Mud in swamps -- Mud in swamps
minetest.register_ore({ minetest.register_ore({
ore_type = "blob", ore_type = "blob",
ore = "30biomes:mud", ore = modname..":mud",
wherein = {"default:dirt", "default:dirt_with_grass"}, wherein = {"default:dirt", "default:dirt_with_grass"},
clust_scarcity = 12*12*12, clust_scarcity = 12*12*12,
clust_size = 10, clust_size = 10,
@ -46,7 +47,7 @@ minetest.register_ore({
-- Jungle grass -- Jungle grass
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"default:dirt_with_grass", "30biomes:mud"}, place_on = {"default:dirt_with_grass", modname..":mud"},
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0.15, offset = 0.15,
@ -520,9 +521,9 @@ minetest.register_decoration({
{name = "air", prob = 0}, {name = "air", prob = 0},
{name = "air", prob = 0}, {name = "air", prob = 0},
{name = "air", prob = 0}, {name = "air", prob = 0},
{name = "30biomes:fir_tree", param2 = 12, prob = 191}, {name = modname..":fir_tree", param2 = 12, prob = 191},
{name = "30biomes:fir_tree", param2 = 12}, {name = modname..":fir_tree", param2 = 12},
{name = "30biomes:fir_tree", param2 = 12, prob = 127}, {name = modname..":fir_tree", param2 = 12, prob = 127},
{name = "air", prob = 0}, {name = "air", prob = 0},
{name = "flowers:mushroom_red", prob = 63}, {name = "flowers:mushroom_red", prob = 63},
{name = "air", prob = 0}, {name = "air", prob = 0},
@ -573,9 +574,9 @@ minetest.register_decoration({
{name = "air", prob = 0}, {name = "air", prob = 0},
{name = "air", prob = 0}, {name = "air", prob = 0},
{name = "air", prob = 0}, {name = "air", prob = 0},
{name = "30biomes:fir_tree", param2 = 12, prob = 191}, {name = modname..":fir_tree", param2 = 12, prob = 191},
{name = "30biomes:fir_tree", param2 = 12}, {name = modname..":fir_tree", param2 = 12},
{name = "30biomes:fir_tree", param2 = 12, prob = 127}, {name = modname..":fir_tree", param2 = 12, prob = 127},
{name = "air", prob = 0}, {name = "air", prob = 0},
{name = "flowers:mushroom_red", prob = 63}, {name = "flowers:mushroom_red", prob = 63},
{name = "air", prob = 0}, {name = "air", prob = 0},

View File

@ -1,5 +1,5 @@
local path = minetest.get_modpath("30biomes") local path = minetest.get_modpath("30biomes")
local modname = minetest.get_current_modname()
minetest.clear_registered_decorations() minetest.clear_registered_decorations()
minetest.clear_registered_biomes() minetest.clear_registered_biomes()

View File

@ -1,12 +1,13 @@
local modname = minetest.get_current_modname()
-- Mud for swamps -- Mud for swamps
minetest.register_node("30biomes:mud", { minetest.register_node(modname..":mud", {
description = "Mud", description = "Mud",
tiles = {"biomes_mud.png"}, tiles = {"biomes_mud.png"},
liquid_viscosity = 8, liquid_viscosity = 8,
liquidtype = "source", liquidtype = "source",
liquid_renewable = false, liquid_renewable = false,
liquid_alternative_source = "30biomes:mud", liquid_alternative_source = modname..":mud",
liquid_alternative_flowing = "30biomes:mud", liquid_alternative_flowing = modname..":mud",
liquid_range = 0, liquid_range = 0,
post_effect_color = {r=115, g=61, b=31, a=255}, post_effect_color = {r=115, g=61, b=31, a=255},
drowning = 1, drowning = 1,
@ -16,7 +17,7 @@ minetest.register_node("30biomes:mud", {
}) })
-- Fir tree -- Fir tree
minetest.register_node("30biomes:fir_tree", { minetest.register_node(modname..":fir_tree", {
description = "Fir Tree", description = "Fir Tree",
tiles = {"biomes_fir_tree_top.png", "biomes_fir_tree_top.png", "biomes_fir_tree.png"}, tiles = {"biomes_fir_tree_top.png", "biomes_fir_tree_top.png", "biomes_fir_tree.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
@ -28,7 +29,7 @@ minetest.register_node("30biomes:fir_tree", {
}) })
-- Fir needles -- Fir needles
minetest.register_node("30biomes:fir_needles", { minetest.register_node(modname..":fir_needles", {
description = "Fir Needles", description = "Fir Needles",
drawtype = "allfaces_optional", drawtype = "allfaces_optional",
waving = 1, waving = 1,
@ -36,24 +37,9 @@ minetest.register_node("30biomes:fir_needles", {
paramtype = "light", paramtype = "light",
is_ground_content = false, is_ground_content = false,
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, 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(), sounds = default.node_sound_leaves_defaults(),
after_place_node = default.after_place_leaves, after_place_node = default.after_place_leaves,
}) })
minetest.register_alias("30biomes:fir_needles", "fir_needles") minetest.register_alias(modname..":fir_needles", "fir_needles")