mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-06-28 06:11:47 +02:00
MAJ plantlife_modpack
(garde les modifs antérieur sur les « mushrooms » et sur les bugfixs liés au mod « areas »)
This commit is contained in:
0
mods/plantlife_modpack/nature_classic/blossom.lua
Executable file → Normal file
0
mods/plantlife_modpack/nature_classic/blossom.lua
Executable file → Normal file
0
mods/plantlife_modpack/nature_classic/config.lua
Executable file → Normal file
0
mods/plantlife_modpack/nature_classic/config.lua
Executable file → Normal file
0
mods/plantlife_modpack/nature_classic/depends.txt
Executable file → Normal file
0
mods/plantlife_modpack/nature_classic/depends.txt
Executable file → Normal file
41
mods/plantlife_modpack/nature_classic/global_function.lua
Executable file → Normal file
41
mods/plantlife_modpack/nature_classic/global_function.lua
Executable file → Normal file
@ -1,16 +1,21 @@
|
||||
local NODE_YOUNG = "young"
|
||||
|
||||
local SETTING_TRUE = "true"
|
||||
local SETTING_FALSE = "false"
|
||||
|
||||
local YOUTH_DELAY = 5
|
||||
|
||||
nature = {}
|
||||
|
||||
local function set_young_node(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
meta:set_string(NODE_YOUNG, "true")
|
||||
minetest.after(5,
|
||||
function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string(NODE_YOUNG, "false")
|
||||
end,
|
||||
meta:set_string(NODE_YOUNG, SETTING_TRUE)
|
||||
minetest.after(YOUTH_DELAY,
|
||||
function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string(NODE_YOUNG, SETTING_FALSE)
|
||||
end,
|
||||
pos)
|
||||
end
|
||||
|
||||
@ -18,26 +23,26 @@ local function is_not_young(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
local young = meta:get_string(NODE_YOUNG)
|
||||
return young ~= "true"
|
||||
return young ~= SETTING_TRUE
|
||||
end
|
||||
|
||||
function nature:grow_node(pos, nodename)
|
||||
if pos ~= nil then
|
||||
local light_enough = minetest.get_node_light(pos, nil)
|
||||
>= MINIMUM_GROWTH_LIGHT
|
||||
local light_enough = minetest.get_node_light(pos, nil)
|
||||
>= MINIMUM_GROWTH_LIGHT
|
||||
|
||||
if is_not_young(pos) and light_enough then
|
||||
minetest.remove_node(pos)
|
||||
minetest.set_node(pos, { name = nodename })
|
||||
set_young_node(pos)
|
||||
if is_not_young(pos) and light_enough then
|
||||
minetest.remove_node(pos)
|
||||
minetest.set_node(pos, { name = nodename })
|
||||
set_young_node(pos)
|
||||
|
||||
minetest.log("info", nodename .. " has grown at " .. pos.x .. ","
|
||||
.. pos.y .. "," .. pos.z)
|
||||
end
|
||||
minetest.log("info", nodename .. " has grown at " .. pos.x .. ","
|
||||
.. pos.y .. "," .. pos.z)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function nature:is_near_water(pos)
|
||||
return minetest.find_node_near(pos, DISTANCE_FROM_WATER,
|
||||
{ "default:water_source" }) ~= nil or DISTANCE_FROM_WATER == -1
|
||||
return DISTANCE_FROM_WATER == -1 or minetest.find_node_near(pos, DISTANCE_FROM_WATER,
|
||||
{ "default:water_source" }) ~= nil
|
||||
end
|
||||
|
0
mods/plantlife_modpack/nature_classic/init.lua
Executable file → Normal file
0
mods/plantlife_modpack/nature_classic/init.lua
Executable file → Normal file
0
mods/plantlife_modpack/nature_classic/textures/nature_blossom.png
Executable file → Normal file
0
mods/plantlife_modpack/nature_classic/textures/nature_blossom.png
Executable file → Normal file
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 173 B |
Reference in New Issue
Block a user