lot of optimization

* config file is now read from worldfolder
* optimized the presents
* renamed files to be clear, what they are doing
* updated readme
* optimized textures
This commit is contained in:
adrido
2014-11-30 16:57:00 +01:00
parent 196bccb5a1
commit 0ec53cee18
68 changed files with 69 additions and 205 deletions

237
init.lua
View File

@ -1,33 +1,40 @@
--load configuration file from world folder
local MODPATH = minetest.get_modpath("christmas_craft")
local worldpath = minetest.get_worldpath()
christmas_craft = {};
christmas_craft.config = Settings(worldpath.."/christmas_craft.conf")
local config = Settings(worldpath.."/christmas_craft.conf")
local conf_table = christmas_craft.config:to_table()
local conf_table = config:to_table()
--look into readme.txt how to change settings
--look into readme.md how to change settings
local defaults = {
enable_4seasons = "false",
enable_crafts = "true",
enable_snowing = "true",
enable_crafts = "true",
}
--if not in conf file, create it.
for k, v in pairs(defaults) do
if conf_table[k] == nil then
christmas_craft.config:set(k, v)
config:set(k, v)
config:write();
end
end
if christmas_craft.config:get("enable_enable_4seasons") == "true" then
dofile(minetest.get_modpath("christmas_craft").."/4seasons.lua")--enable in christmas_craft.conf if you have 4 seasons installed
if minetest.get_modpath("4seasons") ~=nil then
minetest.log("info", "found 4seasons mod. execute 4seasons.lua")
dofile(MODPATH .."/4seasons.lua")--if the 4seasons mod is installed execute this file
end
if christmas_craft.config:get("enable_crafts") == "true" then
dofile(minetest.get_modpath("christmas_craft").."/crafts.lua") --enable this if you want craft rezieps
--if snow enabled, let it snow
if config:get("enable_snowing") == "true" then
minetest.log("info","let it snow, let it snow, let it snow.")
dofile(MODPATH .."/snow.lua")--if snow enabled, execute this file
end
if christmas_craft.config:get("enable_snow") == "true" then
dofile(minetest.get_modpath("christmas_craft").."/snow.lua") -- enable this if you want snow
--if crafts enabled, register the craft recieps
if config:get("enable_crafts") == "true" then
minetest.log("info","registering craft rezieps for snow mod")
dofile(MODPATH .."/crafts.lua")--if snow enabled, execute this file
end
@ -331,6 +338,29 @@ minetest.register_node("christmas_craft:silver_baubles", {
-- presents --
--store the drop in a variable
local presents_drop = {
max_items = 2, items = {
{items = {'default:bookshelf'}, rarity = 15,},
{items = {'default:pick_mese'}, rarity = 20,},
{items = {'default:shovel_steel'}, rarity = 15,},
{items = {'default:axe_steel'}, rarity = 15,},
{items = {'default:pick_steel'}, rarity = 15,},
{items = {'default:sign_wall'}, rarity = 20,},
{items = {'default:chest'}, rarity = 20,},
{items = {'default:furnace'}, rarity = 20,},
{items = {'default:steelblock'}, rarity = 25,},
{items = {'default:coal_lump'}, rarity = 25,},
{items = {'diamonds:pick'}, rarity = 30,},
{items = {'diamonds:shovel'}, rarity = 30,},
{items = {'diamonds:axe'}, rarity = 30,},
{items = {'diamonds:block'}, rarity = 30,},
{items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,},
}}
minetest.register_node("christmas_craft:present_box", {
description = "Present Box",
tiles = {"christmas_craft_present_box.png"},
@ -376,27 +406,7 @@ minetest.register_node("christmas_craft:silver_baubles", {
tiles = {"christmas_craft_present_gr.png^christmas_craft_bow_top.png", "christmas_craft_present_gr.png^christmas_craft_bow_bottom.png", "christmas_craft_present_gr.png^christmas_craft_bow_side.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = {
max_items = 2, items = {
{items = {'default:bookshelf'}, rarity = 15,},
{items = {'default:pick_mese'}, rarity = 20,},
{items = {'default:shovel_steel'}, rarity = 15,},
{items = {'default:axe_steel'}, rarity = 15,},
{items = {'default:pick_steel'}, rarity = 15,},
{items = {'default:sign_wall'}, rarity = 20,},
{items = {'default:chest'}, rarity = 20,},
{items = {'default:furnace'}, rarity = 20,},
{items = {'default:steelblock'}, rarity = 25,},
{items = {'default:coal_lump'}, rarity = 25,},
{items = {'diamonds:pick'}, rarity = 30,},
{items = {'diamonds:shovel'}, rarity = 30,},
{items = {'diamonds:axe'}, rarity = 30,},
{items = {'diamonds:block'}, rarity = 30,},
{items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,},
}},
drop = presents_drop,
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
@ -407,27 +417,7 @@ minetest.register_node("christmas_craft:silver_baubles", {
tiles = {"christmas_craft_present_re.png^christmas_craft_bow_top.png", "christmas_craft_present_re.png^christmas_craft_bow_bottom.png", "christmas_craft_present_re.png^christmas_craft_bow_side.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = {
max_items = 2, items = {
{items = {'default:bookshelf'}, rarity = 15,},
{items = {'default:pick_mese'}, rarity = 20,},
{items = {'default:shovel_steel'}, rarity = 15,},
{items = {'default:axe_steel'}, rarity = 15,},
{items = {'default:pick_steel'}, rarity = 15,},
{items = {'default:sign_wall'}, rarity = 20,},
{items = {'default:chest'}, rarity = 20,},
{items = {'default:furnace'}, rarity = 20,},
{items = {'default:steelblock'}, rarity = 25,},
{items = {'default:coal_lump'}, rarity = 25,},
{items = {'diamonds:pick'}, rarity = 30,},
{items = {'diamonds:shovel'}, rarity = 30,},
{items = {'diamonds:axe'}, rarity = 30,},
{items = {'diamonds:block'}, rarity = 30,},
{items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,},
}},
drop = presents_drop,
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
@ -438,27 +428,7 @@ minetest.register_node("christmas_craft:silver_baubles", {
tiles = {"christmas_craft_present_bl.png^christmas_craft_bow_top.png", "christmas_craft_present_bl.png^christmas_craft_bow_bottom.png", "christmas_craft_present_bl.png^christmas_craft_bow_side.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = {
max_items = 2, items = {
{items = {'default:bookshelf'}, rarity = 15,},
{items = {'default:pick_mese'}, rarity = 20,},
{items = {'default:shovel_steel'}, rarity = 15,},
{items = {'default:axe_steel'}, rarity = 15,},
{items = {'default:pick_steel'}, rarity = 15,},
{items = {'default:sign_wall'}, rarity = 20,},
{items = {'default:chest'}, rarity = 20,},
{items = {'default:furnace'}, rarity = 20,},
{items = {'default:steelblock'}, rarity = 25,},
{items = {'default:coal_lump'}, rarity = 25,},
{items = {'diamonds:pick'}, rarity = 30,},
{items = {'diamonds:shovel'}, rarity = 30,},
{items = {'diamonds:axe'}, rarity = 30,},
{items = {'diamonds:block'}, rarity = 30,},
{items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,},
}},
drop = presents_drop,
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
@ -469,27 +439,7 @@ minetest.register_node("christmas_craft:silver_baubles", {
tiles = {"christmas_craft_present_ye.png^christmas_craft_bow_top.png", "christmas_craft_present_ye.png^christmas_craft_bow_bottom.png", "christmas_craft_present_ye.png^christmas_craft_bow_side.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = {
max_items = 2, items = {
{items = {'default:bookshelf'}, rarity = 15,},
{items = {'default:pick_mese'}, rarity = 20,},
{items = {'default:shovel_steel'}, rarity = 15,},
{items = {'default:axe_steel'}, rarity = 15,},
{items = {'default:pick_steel'}, rarity = 15,},
{items = {'default:sign_wall'}, rarity = 20,},
{items = {'default:chest'}, rarity = 20,},
{items = {'default:furnace'}, rarity = 20,},
{items = {'default:steelblock'}, rarity = 25,},
{items = {'default:coal_lump'}, rarity = 25,},
{items = {'diamonds:pick'}, rarity = 30,},
{items = {'diamonds:shovel'}, rarity = 30,},
{items = {'diamonds:axe'}, rarity = 30,},
{items = {'diamonds:block'}, rarity = 30,},
{items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,},
}},
drop = presents_drop,
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
@ -500,27 +450,7 @@ minetest.register_node("christmas_craft:silver_baubles", {
tiles = {"christmas_craft_present_re.png^christmas_craft_bow_top.png", "christmas_craft_present_re.png^christmas_craft_bow_bottom.png", "christmas_craft_present_re.png^christmas_craft_bow_side.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = {
max_items = 2, items = {
{items = {'default:bookshelf'}, rarity = 15,},
{items = {'default:pick_mese'}, rarity = 20,},
{items = {'default:shovel_steel'}, rarity = 15,},
{items = {'default:axe_steel'}, rarity = 15,},
{items = {'default:pick_steel'}, rarity = 15,},
{items = {'default:sign_wall'}, rarity = 20,},
{items = {'default:chest'}, rarity = 20,},
{items = {'default:furnace'}, rarity = 20,},
{items = {'default:steelblock'}, rarity = 25,},
{items = {'default:coal_lump'}, rarity = 25,},
{items = {'diamonds:pick'}, rarity = 30,},
{items = {'diamonds:shovel'}, rarity = 30,},
{items = {'diamonds:axe'}, rarity = 30,},
{items = {'diamonds:block'}, rarity = 30,},
{items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,},
}},
drop = presents_drop,
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
@ -531,27 +461,7 @@ minetest.register_node("christmas_craft:silver_baubles", {
tiles = {"christmas_craft_present_vi.png^christmas_craft_bow_top.png", "christmas_craft_present_vi.png^christmas_craft_bow_bottom.png", "christmas_craft_present_vi.png^christmas_craft_bow_side.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = {
max_items = 2, items = {
{items = {'default:bookshelf'}, rarity = 15,},
{items = {'default:pick_mese'}, rarity = 20,},
{items = {'default:shovel_steel'}, rarity = 15,},
{items = {'default:axe_steel'}, rarity = 15,},
{items = {'default:pick_steel'}, rarity = 15,},
{items = {'default:sign_wall'}, rarity = 20,},
{items = {'default:chest'}, rarity = 20,},
{items = {'default:furnace'}, rarity = 20,},
{items = {'default:steelblock'}, rarity = 25,},
{items = {'default:coal_lump'}, rarity = 25,},
{items = {'diamonds:pick'}, rarity = 30,},
{items = {'diamonds:shovel'}, rarity = 30,},
{items = {'diamonds:axe'}, rarity = 30,},
{items = {'diamonds:block'}, rarity = 30,},
{items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,},
}},
presents_drop,
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
@ -562,27 +472,7 @@ minetest.register_node("christmas_craft:silver_baubles", {
tiles = {"christmas_craft_present_or.png^christmas_craft_bow_top.png", "christmas_craft_present_or.png^christmas_craft_bow_bottom.png", "christmas_craft_present_or.png^christmas_craft_bow_side.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = {
max_items = 2, items = {
{items = {'default:bookshelf'}, rarity = 15,},
{items = {'default:pick_mese'}, rarity = 20,},
{items = {'default:shovel_steel'}, rarity = 15,},
{items = {'default:axe_steel'}, rarity = 15,},
{items = {'default:pick_steel'}, rarity = 15,},
{items = {'default:sign_wall'}, rarity = 20,},
{items = {'default:chest'}, rarity = 20,},
{items = {'default:furnace'}, rarity = 20,},
{items = {'default:steelblock'}, rarity = 25,},
{items = {'default:coal_lump'}, rarity = 25,},
{items = {'diamonds:pick'}, rarity = 30,},
{items = {'diamonds:shovel'}, rarity = 30,},
{items = {'diamonds:axe'}, rarity = 30,},
{items = {'diamonds:block'}, rarity = 30,},
{items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,},
}},
drop = presents_drop,
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
@ -593,27 +483,7 @@ minetest.register_node("christmas_craft:silver_baubles", {
tiles = {"christmas_craft_present_pi.png^christmas_craft_bow_top.png", "christmas_craft_present_pi.png^christmas_craft_bow_bottom.png", "christmas_craft_present_pi.png^christmas_craft_bow_side.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = {
max_items = 2, items = {
{items = {'default:bookshelf'}, rarity = 15,},
{items = {'default:pick_mese'}, rarity = 20,},
{items = {'default:shovel_steel'}, rarity = 15,},
{items = {'default:axe_steel'}, rarity = 15,},
{items = {'default:pick_steel'}, rarity = 15,},
{items = {'default:sign_wall'}, rarity = 20,},
{items = {'default:chest'}, rarity = 20,},
{items = {'default:furnace'}, rarity = 20,},
{items = {'default:steelblock'}, rarity = 25,},
{items = {'default:coal_lump'}, rarity = 25,},
{items = {'diamonds:pick'}, rarity = 30,},
{items = {'diamonds:shovel'}, rarity = 30,},
{items = {'diamonds:axe'}, rarity = 30,},
{items = {'diamonds:block'}, rarity = 30,},
{items = {'fake_fire:flint_and_steel'}, rarity = 15,},
{items = {'default:chest_locked'}, rarity = 20,},
{items = {'default:brick'}, rarity = 25,},
{items = {'default:dirt_with_grass'}, rarity = 30,},
}},
drop = presents_drop,
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
@ -705,7 +575,7 @@ minetest.register_node("christmas_craft:silver_baubles", {
-- crafts --
--overwrite the default stick
minetest.register_node(":default:stick", {
description = "stick",
drawtype = "torchlike",
@ -725,7 +595,6 @@ minetest.register_node(":default:stick", {
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
})
-- complex node --
snowball_DAMAGE=0.5