1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-06-28 06:11:47 +02:00

initial commit

subgame + mods
This commit is contained in:
Ombridride
2014-10-28 18:01:32 +01:00
parent baab1b3f7c
commit 232b274c55
6451 changed files with 226156 additions and 0 deletions

View File

@ -0,0 +1,82 @@
-- Blossom
local BLOSSOM_NODE = "nature:blossom"
local BLOSSOM_LEAVES = "default:leaves"
local BLOSSOM_TEXTURES = { "default_leaves.png^nature_blossom.png" }
if minetest.get_modpath("moretrees") then
BLOSSOM_NODE = "moretrees:apple_blossoms"
BLOSSOM_LEAVES = "moretrees:apple_tree_leaves"
BLOSSOM_TEXTURES = { "moretrees_apple_tree_leaves.png^nature_blossom.png" }
minetest.register_alias("nature:blossom", "default:leaves")
end
local BLOSSOM_CHANCE = 15
local BLOSSOM_DELAY = 3600
local APPLE_CHANCE = 10
local APPLE_SPREAD = 2
local function spawn_apple_under(pos)
local below = {
x = pos.x,
y = pos.y - 1,
z = pos.z,
}
if minetest.get_node(below).name == "air" then
minetest.set_node(below, { name = "default:apple" })
end
end
minetest.register_node(":"..BLOSSOM_NODE, {
description = "Apple blossoms",
drawtype = "allfaces_optional",
tiles = BLOSSOM_TEXTURES,
paramtype = "light",
groups = { snappy = 3, leafdecay = 3, flammable = 2 },
sounds = default.node_sound_leaves_defaults(),
waving = 1
})
minetest.register_craft({
type = "fuel",
recipe = BLOSSOM_NODE,
burntime = 2,
})
-- Blossoming
minetest.register_abm({
nodenames = { BLOSSOM_LEAVES },
interval = BLOSSOM_DELAY,
chance = BLOSSOM_CHANCE,
action = function(pos, node, active_object_count, active_object_count_wider)
if nature:is_near_water(pos) then
nature:grow_node(pos, BLOSSOM_NODE)
end
end
})
-- Removing blossom
minetest.register_abm({
nodenames = { BLOSSOM_NODE },
interval = BLOSSOM_DELAY,
chance = BLOSSOM_CHANCE,
action = function(pos, node, active_object_count, active_object_count_wider)
nature:grow_node(pos, BLOSSOM_LEAVES)
end
})
-- Spawning apples
minetest.register_abm({
nodenames = { BLOSSOM_NODE },
interval = BLOSSOM_DELAY,
chance = APPLE_CHANCE,
action = function(pos, node, active_object_count, active_object_count_wider)
if not minetest.find_node_near(pos, APPLE_SPREAD, { "default:apple" }) then
spawn_apple_under(pos)
end
end
})

View File

@ -0,0 +1,6 @@
-- Set on which distance from water can the tree still grow.
-- Grows anywhere if set to -1.
DISTANCE_FROM_WATER = 20
-- Minimum light level needed to grow. Default is 8, which means daylight.
MINIMUM_GROWTH_LIGHT = 8

View File

@ -0,0 +1,2 @@
default
moretrees?

View File

@ -0,0 +1,43 @@
local NODE_YOUNG = "young"
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,
pos)
end
local function is_not_young(pos)
local meta = minetest.get_meta(pos)
local young = meta:get_string(NODE_YOUNG)
return young ~= "true"
end
function nature:grow_node(pos, nodename)
if pos ~= nil then
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)
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
end

View File

@ -0,0 +1,12 @@
-- Nature Classic mod
-- Originally by neko259
-- Nature is slowly capturing the world!
local current_mod_name = minetest.get_current_modname()
dofile(minetest.get_modpath(current_mod_name) .. "/config.lua")
dofile(minetest.get_modpath(current_mod_name) .. "/global_function.lua")
dofile(minetest.get_modpath(current_mod_name) .. "/blossom.lua")
minetest.log("info", "[Nature Classic] loaded!")

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B