christmas_craft/snow.lua

105 lines
3.3 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,
})
local nodebox = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
}
}
local leavesoverride = {
drawtype = "nodebox",
visual_scale = 1,
tiles = {"snow.png", "christmas_craft_leaves_top.png", "christmas_craft_leaves_side.png"},
paramtype = "light",
node_box = nodebox,
selection_box = nodebox
}
-- replace leaves
minetest.override_item("default:leaves", leavesoverride)
minetest.override_item("default:aspen_leaves", leavesoverride)
minetest.override_item("default:jungleleaves", leavesoverride)
minetest.override_item("default:bush_leaves", leavesoverride)
-- replace grass
for i=1,5 do
minetest.override_item("default:grass_" .. i, {tiles = {"christmas_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 woodsoils
if minetest.registered_items["woodsoils:grass_with_leaves_1"] then
minetest.override_item("woodsoils:grass_with_leaves_1", {tiles = {"snow.png", "default_dirt.png", "default_dirt.png^grass_w_snow_side.png"}})
add_drop(minetest.registered_items["woodsoils:grass_with_leaves_1"])
end
if minetest.registered_items["woodsoils:grass_with_leaves_2"] then
minetest.override_item("woodsoils:grass_with_leaves_2", {tiles = {"snow.png", "default_dirt.png", "default_dirt.png^grass_w_snow_side.png"}})
add_drop(minetest.registered_items["woodsoils:grass_with_leaves_2"])
end
if minetest.registered_items["woodsoils:dirt_with_leaves_1"] then
minetest.override_item("woodsoils:dirt_with_leaves_1", {tiles = {"snow.png", "default_dirt.png", "default_dirt.png^grass_w_snow_side.png^woodsoils_ground_cover_side.png"}})
add_drop(minetest.registered_items["woodsoils:dirt_with_leaves_1"])
end
if minetest.registered_items["woodsoils:dirt_with_leaves_2"] then
minetest.override_item("woodsoils:dirt_with_leaves_2", {tiles = {"snow.png", "default_dirt.png", "default_dirt.png^grass_w_snow_side.png^woodsoils_ground_cover_side.png"}})
add_drop(minetest.registered_items["woodsoils:dirt_with_leaves_2"])
end
-- replace flowers
for _,name in pairs({"dandelion_yellow", "geranium", "rose", "tulip", "dandelion_white", "viola"}) do
local flowername = "flowers:"..name
local tiles = { "snow_" .. name .. ".png" }
minetest.override_item(flowername, { tiles = tiles })
end
print (" ---- Overrider christmas_craft [OK] ---- ")