mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2024-12-27 03:10:36 +01:00
switch from abm to node timer for plant growth
This commit is contained in:
parent
3cd7d74692
commit
72b72d2cc7
@ -52,11 +52,10 @@ end
|
|||||||
setting("int", "blood_thorn_growth_interval", 12, "blood_thorn growth ABM interval")
|
setting("int", "blood_thorn_growth_interval", 12, "blood_thorn growth ABM interval")
|
||||||
setting("int", "blood_thorn_growth_chance", 83, "blood_thorn growth ABM chance")
|
setting("int", "blood_thorn_growth_chance", 83, "blood_thorn growth ABM chance")
|
||||||
|
|
||||||
setting("int", "plant_growth_timer", 100, "Base plant growth timer interval")
|
setting("int", "plant_growth_time", 500, "Base plant growth time")
|
||||||
setting("int", "plant_growth_chance", 4, "Base plant growth chance")
|
|
||||||
|
|
||||||
for _, plant in pairs(plants) do
|
for _, plant in pairs(plants) do
|
||||||
setting("float", plant.name.."_timer_multiplier", plant.delay_multiplier, plant.name.." growth delay multiplier")
|
setting("float", plant.name.."_delay_multiplier", plant.delay_multiplier, plant.name.." growth delay multiplier")
|
||||||
end
|
end
|
||||||
|
|
||||||
setting("bool", "light_kills_fungus", true, "Light kills fungus")
|
setting("bool", "light_kills_fungus", true, "Light kills fungus")
|
||||||
|
81
plants.lua
81
plants.lua
@ -54,6 +54,25 @@ minetest.register_craft({
|
|||||||
|
|
||||||
-----------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
local marginal = {["default:dirt"] = true, ["dfcaverns:dirt_with_cave_moss"] = true, ["dfcaverns:cobble_with_floor_fungus"] = true}
|
||||||
|
local growable = {["farming:soil_wet"] = true, ["default:dirt"] = true, ["dfcaverns:dirt_with_cave_moss"] = true, ["dfcaverns:cobble_with_floor_fungus"] = true}
|
||||||
|
|
||||||
|
dfcaverns.plant_timer = function(pos, plantname, elapsed)
|
||||||
|
local next_stage_time = minetest.registered_nodes[plantname]._dfcaverns_next_stage_time
|
||||||
|
if not next_stage_time then return end
|
||||||
|
|
||||||
|
next_stage_time = next_stage_time + math.random(next_stage_time * -0.1, next_stage_time * 0.1)
|
||||||
|
local below = minetest.get_node(vector.add(pos, {x=0, y=-1, z=0}))
|
||||||
|
if marginal[below.name] then
|
||||||
|
next_stage_time = next_stage_time * 5
|
||||||
|
end
|
||||||
|
if elapsed ~= nil then
|
||||||
|
minetest.get_node_timer(pos):set(next_stage_time, elapsed-next_stage_time)
|
||||||
|
else
|
||||||
|
minetest.get_node_timer(pos):start(next_stage_time)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local place_seed = function(itemstack, placer, pointed_thing, plantname)
|
local place_seed = function(itemstack, placer, pointed_thing, plantname)
|
||||||
local pt = pointed_thing
|
local pt = pointed_thing
|
||||||
-- check if pointing at a node
|
-- check if pointing at a node
|
||||||
@ -96,13 +115,14 @@ local place_seed = function(itemstack, placer, pointed_thing, plantname)
|
|||||||
|
|
||||||
-- add the node and remove 1 item from the itemstack
|
-- add the node and remove 1 item from the itemstack
|
||||||
minetest.add_node(pt.above, {name = plantname, param2 = 1})
|
minetest.add_node(pt.above, {name = plantname, param2 = 1})
|
||||||
|
dfcaverns.plant_timer(pt.above, plantname)
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
dfcaverns.register_seed = function(name, description, image, stage_one)
|
dfcaverns.register_seed = function(name, description, image, stage_one, grow_time)
|
||||||
local def = {
|
local def = {
|
||||||
description = description,
|
description = description,
|
||||||
tiles = {image},
|
tiles = {image},
|
||||||
@ -112,6 +132,7 @@ dfcaverns.register_seed = function(name, description, image, stage_one)
|
|||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 2, dfcaverns_cookable = 1},
|
groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 2, dfcaverns_cookable = 1},
|
||||||
_dfcaverns_next_stage = stage_one,
|
_dfcaverns_next_stage = stage_one,
|
||||||
|
_dfcaverns_next_stage_time = grow_time,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
@ -119,9 +140,14 @@ dfcaverns.register_seed = function(name, description, image, stage_one)
|
|||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||||
},
|
},
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
return place_seed(itemstack, placer, pointed_thing, "dfcaverns:"..name)
|
return place_seed(itemstack, placer, pointed_thing, "dfcaverns:"..name)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
dfcaverns.grow_underground_plant(pos, "dfcaverns:"..name, elapsed)
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
minetest.register_node("dfcaverns:"..name, def)
|
minetest.register_node("dfcaverns:"..name, def)
|
||||||
@ -132,51 +158,20 @@ dfcaverns.register_seed = function(name, description, image, stage_one)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local grow_underground_plant = function(pos, node)
|
dfcaverns.grow_underground_plant = function(pos, plant_name, elapsed)
|
||||||
local node_def = minetest.registered_nodes[node.name]
|
local node_def = minetest.registered_nodes[plant_name]
|
||||||
local next_stage = node_def._dfcaverns_next_stage
|
local next_stage = node_def._dfcaverns_next_stage
|
||||||
if next_stage then
|
if next_stage then
|
||||||
local next_def = minetest.registered_nodes[next_stage]
|
local soil = minetest.get_node(vector.add(pos, {x=0, y=-1, z=0})).name
|
||||||
minetest.swap_node(pos, {name=next_stage, param2 = next_def.place_param2 or node.param2})
|
if growable[soil] then
|
||||||
end
|
local next_def = minetest.registered_nodes[next_stage]
|
||||||
end
|
local node = minetest.get_node(pos)
|
||||||
|
minetest.swap_node(pos, {name=next_stage, param2 = next_def.place_param2 or node.param2})
|
||||||
dfcaverns.register_grow_abm = function(names, interval, chance)
|
dfcaverns.plant_timer(pos, next_stage, elapsed)
|
||||||
|
else
|
||||||
if minetest.get_modpath("farming") then
|
dfcaverns.plant_timer(pos, plant_name) -- reset timer, check again later
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = names,
|
|
||||||
interval = interval,
|
|
||||||
chance = chance,
|
|
||||||
catch_up = true,
|
|
||||||
neighbors = {"farming:soil_wet"},
|
|
||||||
action = function(pos, node)
|
|
||||||
pos.y = pos.y-1
|
|
||||||
if minetest.get_node(pos).name ~= "farming:soil_wet" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
pos.y = pos.y+1
|
|
||||||
grow_underground_plant(pos, node)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = names,
|
|
||||||
interval = interval * 10,
|
|
||||||
chance = chance,
|
|
||||||
catch_up = true,
|
|
||||||
neighbors = {"default:dirt", "dfcaverns:dirt_with_cave_moss", "dfcaverns:cobble_with_floor_fungus"},
|
|
||||||
action = function(pos, node)
|
|
||||||
pos.y = pos.y-1
|
|
||||||
if minetest.get_node(pos).name == "default:dirt" or
|
|
||||||
minetest.get_node(pos).name == "dfcaverns:dirt_with_cave_moss" or
|
|
||||||
minetest.get_node(pos).name == "dfcaverns:cobble_with_floor_fungus" then
|
|
||||||
pos.y = pos.y+1
|
|
||||||
grow_underground_plant(pos, node)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
})
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if dfcaverns.config.light_kills_fungus then
|
if dfcaverns.config.light_kills_fungus then
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
local S, NS = dofile(MP.."/intllib.lua")
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
local wheat_names = {}
|
local wheat_grow_time = dfcaverns.config.plant_growth_time * dfcaverns.config.cave_wheat_delay_multiplier / 8
|
||||||
|
|
||||||
local register_cave_wheat = function(number)
|
local register_cave_wheat = function(number)
|
||||||
|
local name = "dfcaverns:cave_wheat_"..tostring(number)
|
||||||
local def = {
|
local def = {
|
||||||
description = S("Cave Wheat"),
|
description = S("Cave Wheat"),
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
@ -17,6 +18,11 @@ local register_cave_wheat = function(number)
|
|||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
|
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
dfcaverns.grow_underground_plant(pos, name, elapsed)
|
||||||
|
end,
|
||||||
|
|
||||||
drop = {
|
drop = {
|
||||||
max_items = 1,
|
max_items = 1,
|
||||||
items = {
|
items = {
|
||||||
@ -37,21 +43,18 @@ local register_cave_wheat = function(number)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if number < 8 then
|
if number < 8 then
|
||||||
|
def._dfcaverns_next_stage_time = wheat_grow_time
|
||||||
def._dfcaverns_next_stage = "dfcaverns:cave_wheat_"..tostring(number+1)
|
def._dfcaverns_next_stage = "dfcaverns:cave_wheat_"..tostring(number+1)
|
||||||
table.insert(wheat_names, "dfcaverns:cave_wheat_"..tostring(number))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("dfcaverns:cave_wheat_"..tostring(number), def)
|
minetest.register_node(name, def)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1,8 do
|
for i = 1,8 do
|
||||||
register_cave_wheat(i)
|
register_cave_wheat(i)
|
||||||
end
|
end
|
||||||
|
|
||||||
dfcaverns.register_seed("cave_wheat_seed", S("Cave Wheat Seed"), "dfcaverns_cave_wheat_seed.png", "dfcaverns:cave_wheat_1")
|
dfcaverns.register_seed("cave_wheat_seed", S("Cave Wheat Seed"), "dfcaverns_cave_wheat_seed.png", "dfcaverns:cave_wheat_1", wheat_grow_time)
|
||||||
table.insert(wheat_names, "dfcaverns:cave_wheat_seed")
|
|
||||||
|
|
||||||
dfcaverns.register_grow_abm(wheat_names, dfcaverns.config.plant_growth_timer * dfcaverns.config.cave_wheat_timer_multiplier, dfcaverns.config.plant_growth_chance)
|
|
||||||
|
|
||||||
minetest.register_craftitem("dfcaverns:cave_wheat", {
|
minetest.register_craftitem("dfcaverns:cave_wheat", {
|
||||||
description = S("Cave Wheat"),
|
description = S("Cave Wheat"),
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
local S, NS = dofile(MP.."/intllib.lua")
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
local dimple_names = {}
|
local dimple_grow_time = dfcaverns.config.plant_growth_time * dfcaverns.config.dimple_cup_delay_multiplier / 4
|
||||||
|
|
||||||
local register_dimple_cup = function(number)
|
local register_dimple_cup = function(number)
|
||||||
|
local name = "dfcaverns:dimple_cup_"..tostring(number)
|
||||||
local def = {
|
local def = {
|
||||||
description = S("Dimple Cup"),
|
description = S("Dimple Cup"),
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
@ -15,6 +16,11 @@ local register_dimple_cup = function(number)
|
|||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, color_blue = 1, light_sensitive_fungus = 11, flower = 1},
|
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, color_blue = 1, light_sensitive_fungus = 11, flower = 1},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
dfcaverns.grow_underground_plant(pos, name, elapsed)
|
||||||
|
end,
|
||||||
|
|
||||||
drop = {
|
drop = {
|
||||||
max_items = 1,
|
max_items = 1,
|
||||||
items = {
|
items = {
|
||||||
@ -31,18 +37,15 @@ local register_dimple_cup = function(number)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if number < 4 then
|
if number < 4 then
|
||||||
|
def._dfcaverns_next_stage_time = dimple_grow_time
|
||||||
def._dfcaverns_next_stage = "dfcaverns:dimple_cup_"..tostring(number+1)
|
def._dfcaverns_next_stage = "dfcaverns:dimple_cup_"..tostring(number+1)
|
||||||
table.insert(dimple_names, "dfcaverns:dimple_cup_"..tostring(number))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("dfcaverns:dimple_cup_"..tostring(number), def)
|
minetest.register_node(name, def)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1,4 do
|
for i = 1,4 do
|
||||||
register_dimple_cup(i)
|
register_dimple_cup(i)
|
||||||
end
|
end
|
||||||
|
|
||||||
dfcaverns.register_seed("dimple_cup_seed", S("Dimple Cup Spores"), "dfcaverns_dimple_cup_seed.png", "dfcaverns:dimple_cup_1")
|
dfcaverns.register_seed("dimple_cup_seed", S("Dimple Cup Spores"), "dfcaverns_dimple_cup_seed.png", "dfcaverns:dimple_cup_1", dimple_grow_time)
|
||||||
table.insert(dimple_names, "dfcaverns:dimple_cup_seed")
|
|
||||||
|
|
||||||
dfcaverns.register_grow_abm(dimple_names, dfcaverns.config.plant_growth_timer * dfcaverns.config.dimple_cup_timer_multiplier, dfcaverns.config.plant_growth_chance)
|
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
local S, NS = dofile(MP.."/intllib.lua")
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
local pig_tail_names = {}
|
local pig_tail_grow_time = dfcaverns.config.plant_growth_time * dfcaverns.config.pig_tail_delay_multiplier / 8
|
||||||
|
|
||||||
local register_pig_tail = function(number)
|
local register_pig_tail = function(number)
|
||||||
|
local name = "dfcaverns:pig_tail_"..tostring(number)
|
||||||
local def = {
|
local def = {
|
||||||
description = S("Pig Tail"),
|
description = S("Pig Tail"),
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
@ -17,6 +18,11 @@ local register_pig_tail = function(number)
|
|||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
|
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
dfcaverns.grow_underground_plant(pos, name, elapsed)
|
||||||
|
end,
|
||||||
|
|
||||||
drop = {
|
drop = {
|
||||||
max_items = 1,
|
max_items = 1,
|
||||||
items = {
|
items = {
|
||||||
@ -37,26 +43,23 @@ local register_pig_tail = function(number)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if number < 8 then
|
if number < 8 then
|
||||||
|
def._dfcaverns_next_stage_time = pig_tail_grow_time
|
||||||
def._dfcaverns_next_stage = "dfcaverns:pig_tail_"..tostring(number+1)
|
def._dfcaverns_next_stage = "dfcaverns:pig_tail_"..tostring(number+1)
|
||||||
table.insert(pig_tail_names, "dfcaverns:pig_tail_"..tostring(number))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("dfcaverns:pig_tail_"..tostring(number), def)
|
minetest.register_node(name, def)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1,8 do
|
for i = 1,8 do
|
||||||
register_pig_tail(i)
|
register_pig_tail(i)
|
||||||
end
|
end
|
||||||
|
|
||||||
dfcaverns.register_seed("pig_tail_seed", S("Pig Tail Spore"), "dfcaverns_pig_tail_seed.png", "dfcaverns:pig_tail_1")
|
dfcaverns.register_seed("pig_tail_seed", S("Pig Tail Spore"), "dfcaverns_pig_tail_seed.png", "dfcaverns:pig_tail_1", pig_tail_grow_time)
|
||||||
table.insert(pig_tail_names, "dfcaverns:pig_tail_seed")
|
|
||||||
|
|
||||||
dfcaverns.register_grow_abm(pig_tail_names, dfcaverns.config.plant_growth_timer * dfcaverns.config.pig_tail_timer_multiplier, dfcaverns.config.plant_growth_chance)
|
|
||||||
|
|
||||||
minetest.register_craftitem("dfcaverns:pig_tail_thread", {
|
minetest.register_craftitem("dfcaverns:pig_tail_thread", {
|
||||||
description = S("Pig tail thread"),
|
description = S("Pig tail thread"),
|
||||||
inventory_image = "dfcaverns_pig_tail_thread.png",
|
inventory_image = "dfcaverns_pig_tail_thread.png",
|
||||||
groups = {flammable = 1},
|
groups = {flammable = 1, thread = 1},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -5,6 +5,8 @@ local S, NS = dofile(MP.."/intllib.lua")
|
|||||||
local displace_x = 0.125
|
local displace_x = 0.125
|
||||||
local displace_z = 0.125
|
local displace_z = 0.125
|
||||||
|
|
||||||
|
local plump_helmet_grow_time = dfcaverns.config.plant_growth_time * dfcaverns.config.cave_wheat_delay_multiplier / 4
|
||||||
|
|
||||||
local plump_helmet_on_place = function(itemstack, placer, pointed_thing, plantname)
|
local plump_helmet_on_place = function(itemstack, placer, pointed_thing, plantname)
|
||||||
local pt = pointed_thing
|
local pt = pointed_thing
|
||||||
-- check if pointing at a node
|
-- check if pointing at a node
|
||||||
@ -47,6 +49,7 @@ local plump_helmet_on_place = function(itemstack, placer, pointed_thing, plantn
|
|||||||
|
|
||||||
-- add the node and remove 1 item from the itemstack
|
-- add the node and remove 1 item from the itemstack
|
||||||
minetest.add_node(pt.above, {name = plantname, param2 = math.random(0,3)})
|
minetest.add_node(pt.above, {name = plantname, param2 = math.random(0,3)})
|
||||||
|
dfcaverns.plant_timer(pt.above, plantname)
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
@ -59,8 +62,9 @@ minetest.register_node("dfcaverns:plump_helmet_spawn", {
|
|||||||
tiles = {
|
tiles = {
|
||||||
"dfcaverns_plump_helmet_cap.png",
|
"dfcaverns_plump_helmet_cap.png",
|
||||||
},
|
},
|
||||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1},
|
groups = {snappy = 3, flammable = 2, plant = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1},
|
||||||
_dfcaverns_next_stage = "dfcaverns:plump_helmet_1",
|
_dfcaverns_next_stage = "dfcaverns:plump_helmet_1",
|
||||||
|
_dfcaverns_next_stage_time = plump_helmet_grow_time,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -71,9 +75,14 @@ minetest.register_node("dfcaverns:plump_helmet_spawn", {
|
|||||||
{-0.0625 + displace_x, -0.5, -0.125 + displace_z, 0.125 + displace_x, -0.375, 0.0625 + displace_z},
|
{-0.0625 + displace_x, -0.5, -0.125 + displace_z, 0.125 + displace_x, -0.375, 0.0625 + displace_z},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
return plump_helmet_on_place(itemstack, placer, pointed_thing, "dfcaverns:plump_helmet_spawn")
|
return plump_helmet_on_place(itemstack, placer, pointed_thing, "dfcaverns:plump_helmet_spawn")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
dfcaverns.grow_underground_plant(pos, "dfcaverns:plump_helmet_spawn", elapsed)
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("dfcaverns:plump_helmet_1", {
|
minetest.register_node("dfcaverns:plump_helmet_1", {
|
||||||
@ -85,6 +94,7 @@ minetest.register_node("dfcaverns:plump_helmet_1", {
|
|||||||
},
|
},
|
||||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1, plump_helmet = 1},
|
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1, plump_helmet = 1},
|
||||||
_dfcaverns_next_stage = "dfcaverns:plump_helmet_2",
|
_dfcaverns_next_stage = "dfcaverns:plump_helmet_2",
|
||||||
|
_dfcaverns_next_stage_time = plump_helmet_grow_time,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -102,6 +112,10 @@ minetest.register_node("dfcaverns:plump_helmet_1", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_use = minetest.item_eat(1),
|
on_use = minetest.item_eat(1),
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
dfcaverns.grow_underground_plant(pos, "dfcaverns:plump_helmet_1", elapsed)
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -114,6 +128,7 @@ minetest.register_node("dfcaverns:plump_helmet_2", {
|
|||||||
},
|
},
|
||||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1, plump_helmet = 1},
|
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1, plump_helmet = 1},
|
||||||
_dfcaverns_next_stage = "dfcaverns:plump_helmet_3",
|
_dfcaverns_next_stage = "dfcaverns:plump_helmet_3",
|
||||||
|
_dfcaverns_next_stage_time = plump_helmet_grow_time,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -144,6 +159,10 @@ minetest.register_node("dfcaverns:plump_helmet_2", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_use = minetest.item_eat(2),
|
on_use = minetest.item_eat(2),
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
dfcaverns.grow_underground_plant(pos, "dfcaverns:plump_helmet_2", elapsed)
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("dfcaverns:plump_helmet_3", {
|
minetest.register_node("dfcaverns:plump_helmet_3", {
|
||||||
@ -155,6 +174,7 @@ minetest.register_node("dfcaverns:plump_helmet_3", {
|
|||||||
},
|
},
|
||||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1, plump_helmet = 1},
|
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1, plump_helmet = 1},
|
||||||
_dfcaverns_next_stage = "dfcaverns:plump_helmet_4",
|
_dfcaverns_next_stage = "dfcaverns:plump_helmet_4",
|
||||||
|
_dfcaverns_next_stage_time = plump_helmet_grow_time,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -184,6 +204,10 @@ minetest.register_node("dfcaverns:plump_helmet_3", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_use = minetest.item_eat(3),
|
on_use = minetest.item_eat(3),
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
dfcaverns.grow_underground_plant(pos, "dfcaverns:plump_helmet_3", elapsed)
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("dfcaverns:plump_helmet_4", {
|
minetest.register_node("dfcaverns:plump_helmet_4", {
|
||||||
@ -193,7 +217,7 @@ minetest.register_node("dfcaverns:plump_helmet_4", {
|
|||||||
"dfcaverns_plump_helmet_cap.png",
|
"dfcaverns_plump_helmet_cap.png",
|
||||||
"dfcaverns_plump_helmet_cap.png^[lowpart:40:dfcaverns_plump_helmet_stem.png",
|
"dfcaverns_plump_helmet_cap.png^[lowpart:40:dfcaverns_plump_helmet_stem.png",
|
||||||
},
|
},
|
||||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1, plump_helmet = 1},
|
groups = {snappy = 3, flammable = 2, plant = 1, attached_node = 1, light_sensitive_fungus = 11, dfcaverns_cookable = 1, plump_helmet = 1},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -234,10 +258,6 @@ minetest.register_node("dfcaverns:plump_helmet_4", {
|
|||||||
on_use = minetest.item_eat(4),
|
on_use = minetest.item_eat(4),
|
||||||
})
|
})
|
||||||
|
|
||||||
local plump_names = {"dfcaverns:plump_helmet_spawn", "dfcaverns:plump_helmet_1", "dfcaverns:plump_helmet_2", "dfcaverns:plump_helmet_3"}
|
|
||||||
|
|
||||||
dfcaverns.register_grow_abm(plump_names, dfcaverns.config.plant_growth_timer * dfcaverns.config.plump_helmet_timer_multiplier, dfcaverns.config.plant_growth_chance)
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "dfcaverns:plump_helmet_spawn",
|
recipe = "dfcaverns:plump_helmet_spawn",
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
local S, NS = dofile(MP.."/intllib.lua")
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
local quarry_names = {}
|
local quarry_grow_time = dfcaverns.config.plant_growth_time * dfcaverns.config.quarry_bush_delay_multiplier / 5
|
||||||
|
|
||||||
local register_quarry_bush = function(number)
|
local register_quarry_bush = function(number)
|
||||||
|
local name = "dfcaverns:quarry_bush_"..tostring(number)
|
||||||
local def = {
|
local def = {
|
||||||
description = S("Quarry Bush"),
|
description = S("Quarry Bush"),
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
@ -18,6 +19,10 @@ local register_quarry_bush = function(number)
|
|||||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
|
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
dfcaverns.grow_underground_plant(pos, name, elapsed)
|
||||||
|
end,
|
||||||
|
|
||||||
drop = {
|
drop = {
|
||||||
max_items = 2,
|
max_items = 2,
|
||||||
items = {
|
items = {
|
||||||
@ -38,21 +43,18 @@ local register_quarry_bush = function(number)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if number < 5 then
|
if number < 5 then
|
||||||
|
def._dfcaverns_next_stage_time = quarry_grow_time
|
||||||
def._dfcaverns_next_stage = "dfcaverns:quarry_bush_"..tostring(number+1)
|
def._dfcaverns_next_stage = "dfcaverns:quarry_bush_"..tostring(number+1)
|
||||||
table.insert(quarry_names, "dfcaverns:quarry_bush_"..tostring(number))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("dfcaverns:quarry_bush_"..tostring(number), def)
|
minetest.register_node(name, def)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1,5 do
|
for i = 1,5 do
|
||||||
register_quarry_bush(i)
|
register_quarry_bush(i)
|
||||||
end
|
end
|
||||||
|
|
||||||
dfcaverns.register_seed("quarry_bush_seed", S("Rock Nuts"), "dfcaverns_rock_nuts.png", "dfcaverns:quarry_bush_1")
|
dfcaverns.register_seed("quarry_bush_seed", S("Rock Nuts"), "dfcaverns_rock_nuts.png", "dfcaverns:quarry_bush_1", quarry_grow_time)
|
||||||
table.insert(quarry_names, "dfcaverns:quarry_bush_seed")
|
|
||||||
|
|
||||||
dfcaverns.register_grow_abm(quarry_names, dfcaverns.config.plant_growth_timer * dfcaverns.config.quarry_bush_timer_multiplier, dfcaverns.config.plant_growth_chance)
|
|
||||||
|
|
||||||
minetest.register_craftitem("dfcaverns:quarry_bush_leaves", {
|
minetest.register_craftitem("dfcaverns:quarry_bush_leaves", {
|
||||||
description = S("Quarry Bush Leaves"),
|
description = S("Quarry Bush Leaves"),
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
local S, NS = dofile(MP.."/intllib.lua")
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
local sweet_names = {}
|
local sweet_pod_grow_time = dfcaverns.config.plant_growth_time * dfcaverns.config.sweet_pod_delay_multiplier / 6
|
||||||
|
|
||||||
local register_sweet_pod = function(number)
|
local register_sweet_pod = function(number)
|
||||||
|
local name = "dfcaverns:sweet_pod_"..tostring(number)
|
||||||
local def = {
|
local def = {
|
||||||
description = S("Sweet Pod"),
|
description = S("Sweet Pod"),
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
@ -16,6 +17,10 @@ local register_sweet_pod = function(number)
|
|||||||
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
|
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
dfcaverns.grow_underground_plant(pos, name, elapsed)
|
||||||
|
end,
|
||||||
|
|
||||||
drop = {
|
drop = {
|
||||||
max_items = 2,
|
max_items = 2,
|
||||||
items = {
|
items = {
|
||||||
@ -37,20 +42,17 @@ local register_sweet_pod = function(number)
|
|||||||
|
|
||||||
if number < 6 then
|
if number < 6 then
|
||||||
def._dfcaverns_next_stage = "dfcaverns:sweet_pod_"..tostring(number+1)
|
def._dfcaverns_next_stage = "dfcaverns:sweet_pod_"..tostring(number+1)
|
||||||
table.insert(sweet_names, "dfcaverns:sweet_pod_"..tostring(number))
|
def._dfcaverns_next_stage_time = sweet_pod_grow_time
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("dfcaverns:sweet_pod_"..tostring(number), def)
|
minetest.register_node(name, def)
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1,6 do
|
for i = 1,6 do
|
||||||
register_sweet_pod(i)
|
register_sweet_pod(i)
|
||||||
end
|
end
|
||||||
|
|
||||||
dfcaverns.register_seed("sweet_pod_seed", S("Sweet Pod Spores"), "dfcaverns_sweet_pod_seed.png", "dfcaverns:sweet_pod_1")
|
dfcaverns.register_seed("sweet_pod_seed", S("Sweet Pod Spores"), "dfcaverns_sweet_pod_seed.png", "dfcaverns:sweet_pod_1", sweet_pod_grow_time)
|
||||||
table.insert(sweet_names, "dfcaverns:sweet_pod_seed")
|
|
||||||
|
|
||||||
dfcaverns.register_grow_abm(sweet_names, dfcaverns.config.plant_growth_timer * dfcaverns.config.sweet_pod_timer_multiplier, dfcaverns.config.plant_growth_chance)
|
|
||||||
|
|
||||||
minetest.register_craftitem("dfcaverns:sweet_pods", {
|
minetest.register_craftitem("dfcaverns:sweet_pods", {
|
||||||
description = S("Sweet Pods"),
|
description = S("Sweet Pods"),
|
||||||
|
@ -13,13 +13,12 @@ dfcaverns_blood_thorn_growth_chance (blood_thorn growth ABM chance) int 83
|
|||||||
|
|
||||||
[Plant growth]
|
[Plant growth]
|
||||||
dfcaverns_plant_growth_timer (Base plant growth timer interval) int 100
|
dfcaverns_plant_growth_timer (Base plant growth timer interval) int 100
|
||||||
dfcaverns_plant_growth_chance (Base plant growth chance) int 4
|
dfcaverns_cave_wheat_delay_multiplier (cave_wheat growth delay multiplier) float 1
|
||||||
dfcaverns_cave_wheat_timer_multiplier (cave_wheat growth delay multiplier) float 1
|
dfcaverns_dimple_cup_delay_multiplier (dimple_cup growth delay multiplier) float 3
|
||||||
dfcaverns_dimple_cup_timer_multiplier (dimple_cup growth delay multiplier) float 3
|
dfcaverns_pig_tail_delay_multiplier (pig_tail growth delay multiplier) float 1
|
||||||
dfcaverns_pig_tail_timer_multiplier (pig_tail growth delay multiplier) float 1
|
dfcaverns_plump_helmet_delay_multiplier (plump_helmet growth delay multiplier) float 3
|
||||||
dfcaverns_plump_helmet_timer_multiplier (plump_helmet growth delay multiplier) float 3
|
dfcaverns_quarry_bush_delay_multiplier (quarry_bush growth delay multiplier) float 2
|
||||||
dfcaverns_quarry_bush_timer_multiplier (quarry_bush growth delay multiplier) float 2
|
dfcaverns_sweet_pod_delay_multiplier (sweet_pod growth delay multiplier) float 2
|
||||||
dfcaverns_sweet_pod_timer_multiplier (sweet_pod growth delay multiplier) float 2
|
|
||||||
dfcaverns_light_kills_fungus (Light kills fungus) bool true
|
dfcaverns_light_kills_fungus (Light kills fungus) bool true
|
||||||
|
|
||||||
[Cavern dimensions]
|
[Cavern dimensions]
|
||||||
|
Loading…
Reference in New Issue
Block a user