forked from mtcontrib/christmas_craft
187 lines
5.6 KiB
Lua
187 lines
5.6 KiB
Lua
|
|
print (" ---- Overrider christmas_craft = true! ---- ")
|
|
|
|
local snowballdrop = {items = {'default:snow'}, rarity = 0}
|
|
|
|
local add_drop = function (def)
|
|
if type(def.drop) == "table" then
|
|
if def.drop.max_items then
|
|
def.drop.max_items = def.drop.max_items + 1
|
|
end
|
|
table.insert(def.drop.items, snowballdrop)
|
|
elseif type(def.drop) == "string" then
|
|
def.drop = {
|
|
items = {
|
|
{items = {def.drop}, rarity = 0},
|
|
snowballdrop
|
|
}
|
|
}
|
|
else
|
|
def.drop = {
|
|
items = {
|
|
snowballdrop
|
|
}
|
|
}
|
|
end
|
|
end
|
|
|
|
local data = minetest.registered_nodes["default:dirt_with_snow"]
|
|
minetest.override_item(
|
|
"default:dirt_with_grass", {
|
|
tiles = data.tiles,
|
|
sounds = data.sounds,
|
|
})
|
|
|
|
minetest.override_item(
|
|
"default:dirt_with_dry_grass", {
|
|
tiles = data.tiles,
|
|
sounds = data.sounds,
|
|
})
|
|
|
|
minetest.override_item(
|
|
"default:dry_dirt_with_dry_grass", {
|
|
tiles = {"default_snow.png", "default_dry_dirt.png",
|
|
{name = "default_dry_dirt.png^default_snow_side.png",
|
|
tileable_vertical = false}},
|
|
sounds = data.sounds,
|
|
})
|
|
|
|
minetest.override_item(
|
|
"default:dirt_with_rainforest_litter", {
|
|
tiles = data.tiles,
|
|
sounds = data.sounds,
|
|
})
|
|
|
|
minetest.override_item(
|
|
"default:dirt_with_coniferous_litter", {
|
|
tiles = data.tiles,
|
|
sounds = data.sounds,
|
|
})
|
|
|
|
-- Replace woodsoils
|
|
local woodsoils = {
|
|
"woodsoils:grass_with_leaves_1",
|
|
"woodsoils:grass_with_leaves_2",
|
|
"woodsoils:dirt_with_leaves_1",
|
|
"woodsoils:dirt_with_leaves_2"
|
|
}
|
|
|
|
for _,woodsoil in pairs(woodsoils) do
|
|
if minetest.registered_nodes[woodsoil] then
|
|
minetest.override_item(
|
|
woodsoil, {
|
|
tiles = { "default_snow.png", "default_dirt.png", "grass_w_snow_side.png" },
|
|
sounds = data.sounds
|
|
})
|
|
add_drop(minetest.registered_nodes[woodsoil])
|
|
end
|
|
end
|
|
|
|
-- Replace leaves
|
|
minetest.override_item("default:pine_needles", {
|
|
tiles = {"default_pine_needles.png^christmas_snow_leaves.png"}
|
|
})
|
|
minetest.override_item("default:pine_bush_needles", {
|
|
tiles = {"default_pine_needles.png^christmas_snow_leaves.png"}
|
|
})
|
|
minetest.override_item("default:bush_leaves", {
|
|
tiles = {"(default_leaves.png^[multiply:#c75000)^christmas_snow_leaves.png"}
|
|
})
|
|
|
|
for _, leaves in pairs({"leaves", "aspen_leaves", "jungleleaves"}) do
|
|
local tree_leaves = "default:"..leaves
|
|
minetest.override_item(tree_leaves, {
|
|
tiles = {
|
|
"(default_"..leaves..".png^[multiply:#c75000)^christmas_snow_leaves.png"
|
|
}})
|
|
end
|
|
|
|
if minetest.get_modpath("moretrees") then
|
|
-- replace moretrees leaves adding snow and brown mask
|
|
for _, leaves in pairs({"beech", "apple_tree", "oak", "birch", "poplar", "willow", "rubber_tree"}) do
|
|
local tree_leaves = "moretrees:"..leaves.."_leaves"
|
|
minetest.override_item(tree_leaves, {
|
|
tiles = {
|
|
"(moretrees_"..leaves.."_leaves.png^[multiply:#c75000)^christmas_snow_leaves.png"
|
|
}})
|
|
end
|
|
|
|
-- replace moretrees leaves adding snow
|
|
for _, leaves in pairs({"sequoia", "palm", "date_palm", "spruce", "cedar", "fir"}) do
|
|
local tree_leaves = "moretrees:"..leaves.."_leaves"
|
|
minetest.override_item(tree_leaves, {
|
|
tiles = {
|
|
"moretrees_"..leaves.."_leaves.png^christmas_snow_leaves.png"
|
|
}})
|
|
end
|
|
|
|
-- fir with bright needles
|
|
minetest.override_item("moretrees:fir_leaves_bright", {
|
|
tiles = {
|
|
"moretrees_fir_leaves_bright.png^christmas_snow_leaves.png"
|
|
}})
|
|
end
|
|
|
|
-- Replace apple by the snow version
|
|
minetest.override_item("default:apple", {
|
|
tiles = {"snow_apple.png"},
|
|
inventory_image = "snow_apple.png"
|
|
})
|
|
|
|
-- replace grass
|
|
for i=1,5 do
|
|
minetest.override_item("default:grass_" .. i, {tiles = {"christmas_grass_"..i..".png"}})
|
|
minetest.override_item("default:dry_grass_" .. i, {tiles = {"christmas_dry_grass_"..i..".png"}})
|
|
end
|
|
|
|
-- Replace junglegrass
|
|
minetest.override_item("default:junglegrass", {tiles = {"christmas_junglegrass.png"}})
|
|
|
|
-- Replace youngtrees
|
|
if minetest.registered_items["youngtrees:youngtree_top"] then
|
|
minetest.override_item("youngtrees:youngtree_top", {tiles = {"christmas_youngtree16xa.png"}})
|
|
minetest.override_item("youngtrees:youngtree_middle", {tiles = {"christmas_youngtree16xb.png"}})
|
|
end
|
|
|
|
-- Replace bushes
|
|
if minetest.registered_items["bushes:BushLeaves1"] then
|
|
minetest.override_item("bushes:BushLeaves1", {tiles = {"christmas_bushes_leaves.png"}})
|
|
minetest.override_item("bushes:BushLeaves2", {tiles = {"christmas_bushes_leaves.png"}})
|
|
minetest.override_item("bushes:bushbranches1",
|
|
{tiles = {"christmas_bushes_leaves.png", "christmas_bushes_branches_center.png"}})
|
|
minetest.override_item("bushes:bushbranches3",
|
|
{tiles = {"christmas_bushes_leaves.png", "christmas_bushes_branches_center.png"}})
|
|
minetest.override_item("bushes:bushbranches2", {
|
|
tiles = {
|
|
"christmas_bushes_leaves.png",
|
|
"christmas_bushes_branches_center.png",
|
|
"christmas_bushes_branches_left.png",
|
|
"christmas_bushes_branches_right.png",
|
|
"christmas_bushes_branches_center.png",
|
|
"christmas_bushes_branches_right.png"
|
|
}})
|
|
minetest.override_item("bushes:bushbranches4", {
|
|
tiles = {
|
|
"christmas_bushes_leaves.png",
|
|
"christmas_bushes_branches_center.png",
|
|
"christmas_bushes_branches_left.png",
|
|
"christmas_bushes_branches_right.png",
|
|
"christmas_bushes_branches_center.png",
|
|
"christmas_bushes_branches_right.png"
|
|
}})
|
|
minetest.override_item("bushes:youngtree2_bottom", {
|
|
tiles = {"christmas_bushes_youngtree2trunk.png"},
|
|
inventory_image = "christmas_bushes_youngtree2trunk_inv.png",
|
|
wield_image = "christmas_bushes_youngtree2trunk_inv.png"
|
|
})
|
|
end
|
|
|
|
-- replace flowers
|
|
for _,name in pairs({"dandelion_yellow", "geranium", "rose", "tulip", "dandelion_white", "viola", "chrysanthemum_green", "tulip_black"}) do
|
|
local flowername = "flowers:"..name
|
|
local tiles = { "snow_" .. name .. ".png" }
|
|
minetest.override_item(flowername, { tiles = tiles })
|
|
end
|
|
|
|
print (" ---- Overrider christmas_craft [OK] ---- ")
|