Delete old func, fix two crash and add timer

This commit is contained in:
davedevils 2015-07-03 06:58:01 +02:00
parent 15256967eb
commit 4052da3116
3 changed files with 55 additions and 7 deletions

@ -1,3 +1,4 @@
local init = os.clock()
farming = {} farming = {}
function farming:add_plant(full_grown, names, interval, chance) function farming:add_plant(full_grown, names, interval, chance)
@ -90,4 +91,5 @@ dofile(minetest.get_modpath("farming").."/potatoes.lua")
-- ========= MUSHROOMS ========= -- ========= MUSHROOMS =========
dofile(minetest.get_modpath("farming").."/mushrooms.lua") dofile(minetest.get_modpath("farming").."/mushrooms.lua")
local time_to_load= os.clock() - init
print(string.format("[MOD] "..minetest.get_current_modname().." loaded in %.4f s", time_to_load))

@ -6,7 +6,7 @@ minetest.register_node("farming:soil", {
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.375, 0.5}, {-0.5, -0.5, -0.5, 0.5, 0.4, 0.5},
} }
}, },
groups = {crumbly=3, not_in_creative_inventory=1,soil=2}, groups = {crumbly=3, not_in_creative_inventory=1,soil=2},
@ -20,7 +20,7 @@ minetest.register_node("farming:soil_wet", {
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.375, 0.5}, {-0.5, -0.5, -0.5, 0.5, 0.4, 0.5},
} }
}, },
groups = {crumbly=3, not_in_creative_inventory=1,soil=3}, groups = {crumbly=3, not_in_creative_inventory=1,soil=3},

@ -10,7 +10,8 @@ minetest.register_node("farming:wheat_1", {
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
drawtype = "plantlike", drawtype = "nodebox",
paramtype = "light",
drop = "farming:wheat_seed", drop = "farming:wheat_seed",
tiles = {"farming_wheat_1.png"}, tiles = {"farming_wheat_1.png"},
selection_box = { selection_box = {
@ -20,13 +21,23 @@ minetest.register_node("farming:wheat_1", {
}, },
}, },
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1}, groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.5, -0.3125, 0.375, 0.5}, -- NodeBox1
{0.3125, -0.5, -0.5, 0.3125, 0.375, 0.5}, -- NodeBox2
{-0.5, -0.5, 0.375, 0.5, 0.375, 0.375}, -- NodeBox3
{-0.5, -0.5, -0.25, 0.5, 0.375, -0.25}, -- NodeBox4
}
},
}) })
minetest.register_node("farming:wheat_2", { minetest.register_node("farming:wheat_2", {
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
drawtype = "plantlike", drawtype = "nodebox",
paramtype = "light",
drop = "farming:wheat_seed", drop = "farming:wheat_seed",
tiles = {"farming_wheat_2.png"}, tiles = {"farming_wheat_2.png"},
selection_box = { selection_box = {
@ -36,13 +47,23 @@ minetest.register_node("farming:wheat_2", {
}, },
}, },
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1}, groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.5, -0.3125, 0.375, 0.5}, -- NodeBox1
{0.3125, -0.5, -0.5, 0.3125, 0.375, 0.5}, -- NodeBox2
{-0.5, -0.5, 0.375, 0.5, 0.375, 0.375}, -- NodeBox3
{-0.5, -0.5, -0.25, 0.5, 0.375, -0.25}, -- NodeBox4
}
},
}) })
minetest.register_node("farming:wheat_3", { minetest.register_node("farming:wheat_3", {
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
drawtype = "plantlike", drawtype = "nodebox",
paramtype = "light",
drop = "farming:wheat_seed", drop = "farming:wheat_seed",
tiles = {"farming_wheat_3.png"}, tiles = {"farming_wheat_3.png"},
selection_box = { selection_box = {
@ -52,13 +73,23 @@ minetest.register_node("farming:wheat_3", {
}, },
}, },
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1}, groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.5, -0.3125, 0.375, 0.5}, -- NodeBox1
{0.3125, -0.5, -0.5, 0.3125, 0.375, 0.5}, -- NodeBox2
{-0.5, -0.5, 0.375, 0.5, 0.375, 0.375}, -- NodeBox3
{-0.5, -0.5, -0.25, 0.5, 0.375, -0.25}, -- NodeBox4
}
},
}) })
minetest.register_node("farming:wheat", { minetest.register_node("farming:wheat", {
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
drawtype = "plantlike", drawtype = "nodebox",
paramtype = "light",
tiles = {"farming_wheat.png"}, tiles = {"farming_wheat.png"},
drop = { drop = {
max_items = 4, max_items = 4,
@ -69,7 +100,22 @@ minetest.register_node("farming:wheat", {
{ items = {'farming:wheat_harvested'} } { items = {'farming:wheat_harvested'} }
} }
}, },
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.35, 0.5}
},
},
groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1}, groups = {snappy=3, flammable=2, not_in_creative_inventory=1,dig_by_water=1},
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.5, -0.3125, 0.375, 0.5}, -- NodeBox1
{0.3125, -0.5, -0.5, 0.3125, 0.375, 0.5}, -- NodeBox2
{-0.5, -0.5, 0.375, 0.5, 0.375, 0.375}, -- NodeBox3
{-0.5, -0.5, -0.25, 0.5, 0.375, -0.25}, -- NodeBox4
}
},
}) })
farming:add_plant("farming:wheat", {"farming:wheat_1", "farming:wheat_2", "farming:wheat_3"}, 50, 20) farming:add_plant("farming:wheat", {"farming:wheat_1", "farming:wheat_2", "farming:wheat_3"}, 50, 20)