From b8047a4985cf22326222087a090bf9ad98f4e20c Mon Sep 17 00:00:00 2001 From: HybridDog Date: Sun, 27 Oct 2013 20:39:19 +0100 Subject: [PATCH] add read me --- README.txt | 16 ++++++++++++++++ init.lua | 24 +++++++++--------------- c1.gif => rest/c1.gif | Bin c2.jpg => rest/c2.jpg | Bin init_old.lua => rest/init_old.lua | 0 5 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 README.txt rename c1.gif => rest/c1.gif (100%) rename c2.jpg => rest/c2.jpg (100%) rename init_old.lua => rest/init_old.lua (100%) diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..93195ed --- /dev/null +++ b/README.txt @@ -0,0 +1,16 @@ +-------------------------------------------------------------------------------- +-- +-- CONIFERS MOD +-- For Minetest +-- Created by Cisoun (cysoun[at]gmail.com). +-- +-- This mod adds some conifers randomly at a certain altitude. +-- There are two types of conifers: regular and narrow. +-- You can define the altitude at which they spawn and their structure and +-- choose if you want to keep normal trees above this altitude. +-- +-------------------------------------------------------------------------------- + + +TODO: +— add a TODO list diff --git a/init.lua b/init.lua index 799d30e..510e166 100644 --- a/init.lua +++ b/init.lua @@ -1,16 +1,3 @@ --------------------------------------------------------------------------------- --- --- CONIFERS MOD --- For Minetest --- Created by Cisoun (cysoun[at]gmail.com). --- --- This mod adds some conifers randomly at a certain altitude. --- There are two types of conifers: regular and narrow. --- You can define the altitude at which they spawn and their structure and --- choose if you want to keep normal trees above this altitude. --- --------------------------------------------------------------------------------- - -- Structure definitions. local TRUNK_MINHEIGHT = 7 @@ -30,6 +17,8 @@ local SAPLING_CHANCE = 100 -- 1/x chances to grow a sapling. local INTERVAL = 3600 +local conifers_seed = 1435 + -- End of structure definitions. @@ -223,14 +212,19 @@ minetest.register_craft({ -- ABM definitions -- -- Spawn random conifers. +local function get_conifers_random(pos) + return PseudoRandom(math.abs(pos.x+pos.y*3+pos.z*5)+conifers_seed) +end minetest.register_abm({ nodenames = "default:dirt_with_grass", interval = INTERVAL, - chance = 200.2, + chance = 9.1, action = function(pos) + local pr = get_conifers_random(pos) local p = {x=pos.x, y=pos.y+1, z=pos.z} - if minetest.get_node(p).name == "air" + if pr:next(1,23) == 1 + and minetest.get_node(p).name == "air" and pos.y >= CONIFERS_ALTITUDE and (not conifers:is_node_in_cube({"conifers:trunk"}, pos, CONIFERS_DISTANCE)) then conifers:make_conifer(p, math.random(0, 1)) diff --git a/c1.gif b/rest/c1.gif similarity index 100% rename from c1.gif rename to rest/c1.gif diff --git a/c2.jpg b/rest/c2.jpg similarity index 100% rename from c2.jpg rename to rest/c2.jpg diff --git a/init_old.lua b/rest/init_old.lua similarity index 100% rename from init_old.lua rename to rest/init_old.lua