From 58eeb5068595d8b616befac76237cc653569ba31 Mon Sep 17 00:00:00 2001 From: Nemo 08 Date: Thu, 5 Apr 2012 03:15:00 +0400 Subject: [PATCH] simple_grow preview added --- shit/simple_grow/init.lua | 52 ++++++++++++++++++++++++++ shit/simple_plant/depends.txt | 1 + shit/simple_plant/init.lua | 51 +++++++++++++++++++++++++ shit/simple_plant/textures/seed0.png | Bin 0 -> 184 bytes shit/simple_plant/textures/stage1.png | Bin 0 -> 117 bytes shit/simple_plant/textures/stage2.png | Bin 0 -> 118 bytes shit/simple_plant/textures/stage3.png | Bin 0 -> 135 bytes shit/simple_plant/textures/stage4.png | Bin 0 -> 188 bytes 8 files changed, 104 insertions(+) create mode 100644 shit/simple_grow/init.lua create mode 100644 shit/simple_plant/depends.txt create mode 100644 shit/simple_plant/init.lua create mode 100644 shit/simple_plant/textures/seed0.png create mode 100644 shit/simple_plant/textures/stage1.png create mode 100644 shit/simple_plant/textures/stage2.png create mode 100644 shit/simple_plant/textures/stage3.png create mode 100644 shit/simple_plant/textures/stage4.png diff --git a/shit/simple_grow/init.lua b/shit/simple_grow/init.lua new file mode 100644 index 0000000..d3b60a2 --- /dev/null +++ b/shit/simple_grow/init.lua @@ -0,0 +1,52 @@ +--[[ +{ + { + k_grow_time, -- k * STANDART_GROW_TIME + image, + drop, + groups, + chance + } +} + +-- +-- +-- +]]-- + +STANDART_SPGROW_TIME = 120 + +function register_simple_plant(grow_table) + + for stage in ipairs(grow_table) do + if grow_table[stage].chance > 1 then + grow_table[stage].chance = 1 + end + + minetest.register_node(grow_table[stage].name, { + description = grow_table[stage].name, + drawtype = "plantlike", + walkable = false, + tile_images = {grow_table[stage].image}, + inventory_image = grow_table[stage].image, + wield_image = grow_table[stage].image, + paramtype = "light", + drop = grow_table[stage].drop, + groups = grow_table[stage].groups, + sounds = default.node_sound_leaves_defaults(), + }) + + if (#(grow_table) > stage) then + minetest.register_abm({ + nodenames = { grow_table[stage].name }, + interval = grow_table[stage].time * STANDART_SPGROW_TIME, + chance = grow_table[stage].chance, + action = function (pos, node) + if math.random() < grow_table[stage].chance then + minetest.env:add_node(pos, {name = grow_table[stage + 1].name}) + end + end + }) + end + end +end diff --git a/shit/simple_plant/depends.txt b/shit/simple_plant/depends.txt new file mode 100644 index 0000000..3a4ca9b --- /dev/null +++ b/shit/simple_plant/depends.txt @@ -0,0 +1 @@ +simple_grow diff --git a/shit/simple_plant/init.lua b/shit/simple_plant/init.lua new file mode 100644 index 0000000..144b063 --- /dev/null +++ b/shit/simple_plant/init.lua @@ -0,0 +1,51 @@ +minetest.register_craftitem("simple_plant:seed0", { + inventory_image = "seed0.png", + stack_max = 99, + usable = true, + on_use = function(itemstack, user, pointed_thing) + -- Must be pointing to node + if pointed_thing.type == "node" then + n = minetest.env:get_node(pointed_thing.under) + if n.name == 'default:dirt_with_grass' then + minetest.env:add_node(pointed_thing.above, {name="simple_plant:splant1"}) + end + itemstack:take_item() + end + return itemstack + end, +}) + +register_simple_plant({ + { + name = 'simple_plant:splant1', + time = 0.5, + image = 'stage1.png', + drop = '', + groups = {snappy=3}, + chance = 0.7 + }, + { + name = 'simple_plant:splant2', + time = 0.5, + image = 'stage2.png', + drop = 'default:iron_lump', + groups = {snappy=3}, + chance = 0.7 + }, + { + name = 'simple_plant:splant3', + time = 0.5, + image = 'stage3.png', + drop = '', + groups = {snappy=3}, + chance = 0.7 + }, + { + name = 'simple_plant:splant4', + time = 0.5, + image = 'stage4.png', + drop = 'default:clay_brick 4', + groups = {snappy=3}, + chance = 0.4 + }, +}) diff --git a/shit/simple_plant/textures/seed0.png b/shit/simple_plant/textures/seed0.png new file mode 100644 index 0000000000000000000000000000000000000000..94e0b433099d01c1b4d63257306c6c543494e6e3 GIT binary patch literal 184 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vfa?2SFdgK3}Feun;C e*p$DHfk70Lmp89ZJ6T-G@yGywnvojmaX literal 0 HcmV?d00001 diff --git a/shit/simple_plant/textures/stage1.png b/shit/simple_plant/textures/stage1.png new file mode 100644 index 0000000000000000000000000000000000000000..d2dc3e4bb93ae1398fed4d1a5a5383ca1b07523d GIT binary patch literal 117 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf5_>JpVt>|Jr}Xe~vG2>kRUa_~4nB`Jj1|-NkdP%=ruqDf8H_US05d4^SV2 Mr>mdKI;Vst0H*mQRsaA1 literal 0 HcmV?d00001 diff --git a/shit/simple_plant/textures/stage2.png b/shit/simple_plant/textures/stage2.png new file mode 100644 index 0000000000000000000000000000000000000000..18a0cada88d64561cfc0c684f2667540079e4822 GIT binary patch literal 118 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf@bmnK`_JtU*Vkmt(Ae6-I{(QuHam^i!f#^?vKW||8SegMySbs1cOp+4KFY;!VpYpY{OfTVxX7Ks;SKp8M@3{KNl;y61 eiNPyYHZ}$ULt*w77Cu9uNerH@elF{r5}E*d94OTQ literal 0 HcmV?d00001 diff --git a/shit/simple_plant/textures/stage4.png b/shit/simple_plant/textures/stage4.png new file mode 100644 index 0000000000000000000000000000000000000000..fd0b4ceea0700f4d59a77e62d585d7eca8562b51 GIT binary patch literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#VfTJaN_W0!A~}A36y~)J|ITHVV%6=8){m z^tQcU-&SQ;ksu`6!2<-Z7Tq|yVJE}($qUR5J3dx_G^an2W0zwF!(r~MuRQ;+zB2sV g