diff --git a/mods/creative/init.lua b/mods/creative/init.lua index a18140bb..ea9da60c 100644 --- a/mods/creative/init.lua +++ b/mods/creative/init.lua @@ -7,18 +7,10 @@ creative_inventory.creative_inventory_size = 0 minetest.after(0, function() local inv = minetest.create_detached_inventory("creative", { allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) - if minetest.setting_getbool("creative_mode") then - return count - else - return 0 - end + return 0 end, allow_put = function(inv, listname, index, stack, player) - if minetest.setting_getbool("creative_mode") then - return -1 - else - return 0 - end + return 0 end, allow_take = function(inv, listname, index, stack, player) if minetest.setting_getbool("creative_mode") then @@ -55,7 +47,7 @@ minetest.after(0, function() stack2 = ItemStack(stack:get_name()) else -- Insert half full so that a taken stack can be put back - stack2 = ItemStack(stack:get_name().." "..(stack:get_stack_max()/2)) + stack2 = ItemStack(stack:get_name().." "..(stack:get_stack_max())) end inv:add_item("main", stack2) end @@ -63,6 +55,17 @@ minetest.after(0, function() print("creative inventory size: "..dump(creative_inventory.creative_inventory_size)) end) +local trash = minetest.create_detached_inventory("trash", { + allow_put = function(inv, listname, index, stack, player) + if minetest.setting_getbool("creative_mode") then -- TODO check wether inv is creative + return -1 + else + return 0 + end + end +}) +trash:set_size("main", 1) + creative_inventory.set_creative_formspec = function(player, start_i, pagenum) pagenum = math.floor(pagenum) local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1) @@ -74,7 +77,9 @@ creative_inventory.set_creative_formspec = function(player, start_i, pagenum) "list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]".. "label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]".. "button[0.3,6.5;1.6,1;creative_prev;<<]".. - "button[2.7,6.5;1.6,1;creative_next;>>]") + "button[2.7,6.5;1.6,1;creative_next;>>]".. + "label[6,1.5;Trash:]".. + "list[detached:trash;main;6,2;1,1;]") end minetest.register_on_joinplayer(function(player) -- If in creative mode, modify player's inventory forms diff --git a/mods/default/init.lua b/mods/default/init.lua index 6ebda6a4..edf72583 100644 --- a/mods/default/init.lua +++ b/mods/default/init.lua @@ -924,6 +924,10 @@ minetest.register_node("default:fence_wood", { type = "fixed", fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, }, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 1, 0.5}, + }, groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2}, sounds = default.node_sound_wood_defaults(), }) diff --git a/mods/farming/README.txt b/mods/farming/README.txt new file mode 100644 index 00000000..cc5052e1 --- /dev/null +++ b/mods/farming/README.txt @@ -0,0 +1,48 @@ +===FARMING MOD for MINETEST-C55=== +by PilzAdam + +Version 4.dev + +Introduction: +This mod adds farming to Minetest. + +How to install: +Unzip the archive an place it in minetest-base-directory/mods/minetest/ +if you have a windows client or a linux run-in-place client. If you have +a linux system-wide instalation place it in ~/.minetest/mods/minetest/. +If you want to install this mod only in one world create the folder +worldmods/ in your worlddirectory. +For further information or help see: +http://wiki.minetest.com/wiki/Installing_Mods + +How to use the mod: +Craft a wood/stone/steel hoe: +material material + stick + stick +Dig dirt with it and turn it to soil. Water the soil and plant the seeds +you get by digging dirt with the hoe. Wait until the seeds are seasoned +and harvest them. When harvesting you will get the product and new seeds. +For further information or help see: +http://minetest.net/forum/viewtopic.php?id=2787 + +License: +Sourcecode: WTFPL (see below) +Graphics: WTFPL (see below) + +See also: +http://minetest.net/ + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/mods/farming/bananas.lua b/mods/farming/bananas.lua new file mode 100644 index 00000000..723be556 --- /dev/null +++ b/mods/farming/bananas.lua @@ -0,0 +1,63 @@ +minetest.register_node("farming:banana_sapling", { + description = "Banana Tree Sapling", + drawtype = "plantlike", + tiles = {"farming_banana_sapling.png"}, + inventory_image = "farming_banana_sapling.png", + wield_image = "farming_banana_sapling.png", + paramtype = "light", + walkable = false, + groups = {dig_immediate=3,flammable=2}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("farming:banana_leaves", { + drawtype = "allfaces_optional", + tiles = {"farming_banana_leaves.png"}, + paramtype = "light", + groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1}, + drop = { + max_items = 1, + items = { + { + items = {'farming:banana_sapling'}, + rarity = 20, + }, + } + }, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_abm({ + nodenames = {"farming:banana_sapling"}, + interval = 60, + chance = 20, + action = function(pos, node) + farming:generate_tree(pos, "default:tree", "farming:banana_leaves", {"default:dirt", "default:dirt_with_grass"}, {["farming:banana"]=20}) + end +}) + +minetest.register_on_generated(function(minp, maxp, blockseed) + if math.random(1, 100) > 5 then + return + end + local tmp = {x=(maxp.x-minp.x)/2+minp.x, y=(maxp.y-minp.y)/2+minp.y, z=(maxp.z-minp.z)/2+minp.z} + local pos = minetest.env:find_node_near(tmp, maxp.x-minp.x, {"default:dirt_with_grass"}) + if pos ~= nil then + farming:generate_tree({x=pos.x, y=pos.y+1, z=pos.z}, "default:tree", "farming:banana_leaves", {"default:dirt", "default:dirt_with_grass"}, {["farming:banana"]=10}) + end +end) + +minetest.register_node("farming:banana", { + description = "Banana", + tiles = {"farming_banana.png"}, + inventory_image = "farming_banana.png", + wield_image = "farming_banana.png", + drawtype = "torchlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + groups = {fleshy=3,dig_immediate=3,flammable=2}, + sounds = default.node_sound_defaults(), + + on_use = minetest.item_eat(6), +}) diff --git a/mods/farming/cactus.lua b/mods/farming/cactus.lua new file mode 100644 index 00000000..3723e702 --- /dev/null +++ b/mods/farming/cactus.lua @@ -0,0 +1,22 @@ +minetest.register_abm({ + nodenames = {"default:cactus"}, + interval = 50, + chance = 20, + action = function(pos, node) + pos.y = pos.y-1 + local name = minetest.env:get_node(pos).name + if name == "default:desert_sand" or name == "default:sand" then + pos.y = pos.y+1 + local height = 0 + while minetest.env:get_node(pos).name == "default:cactus" do + height = height+1 + pos.y = pos.y+1 + end + if height < 4 then + if minetest.env:get_node(pos).name == "air" then + minetest.env:set_node(pos, node) + end + end + end + end +}) diff --git a/mods/farming/carrots.lua b/mods/farming/carrots.lua new file mode 100644 index 00000000..0195525a --- /dev/null +++ b/mods/farming/carrots.lua @@ -0,0 +1,89 @@ +minetest.register_craftitem("farming:carrot_seed", { + description = "Carrot Seeds", + inventory_image = "farming_carrot_seed.png", + on_place = function(itemstack, placer, pointed_thing) + local above = minetest.env:get_node(pointed_thing.above) + if above.name == "air" then + above.name = "farming:carrot_1" + minetest.env:set_node(pointed_thing.above, above) + itemstack:take_item(1) + return itemstack + end + end +}) + +minetest.register_node("farming:carrot_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_carrot_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:carrot_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_carrot_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+5/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:carrot_3", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_carrot_3.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+12/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:carrot", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_carrot_4.png"}, + drop = { + max_items = 6, + items = { + { items = {'farming:carrot_seed'} }, + { items = {'farming:carrot_seed'}, rarity = 2}, + { items = {'farming:carrot_seed'}, rarity = 5}, + { items = {'farming:carrot_item'} }, + { items = {'farming:carrot_item'}, rarity = 2 }, + { items = {'farming:carrot_item'}, rarity = 5 } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_craftitem("farming:carrot_item", { + description = "Carrot", + inventory_image = "farming_carrot.png", + on_use = minetest.item_eat(3), +}) + +farming:add_plant("farming:carrot", {"farming:carrot_1", "farming:carrot_2", "farming:carrot_3"}, 50, 20) diff --git a/mods/farming/changelog.txt b/mods/farming/changelog.txt new file mode 100644 index 00000000..80138c54 --- /dev/null +++ b/mods/farming/changelog.txt @@ -0,0 +1,17 @@ +Version 3: +- make pumpkins with face not craftable but created by punching with a sword +- change groups of pumpkins to more wood like +- add big pumpkin +- add scarecrow +- make bread non stackable +- make saplings plantable everywhere (they still grow only with light and wet soil) +- add weed +- add fuel attributes to nearly everything +- add pumpkin bread +Version 2: +- soil dont turn to dirt when walking over it +- fix hoe bug +- rename corn to wheat +- new textures for harvested wheat +- make cotton drop strings when harvested +- add rubber diff --git a/mods/farming/cotton.lua b/mods/farming/cotton.lua new file mode 100644 index 00000000..3ea33905 --- /dev/null +++ b/mods/farming/cotton.lua @@ -0,0 +1,90 @@ +minetest.register_craftitem("farming:cotton_seed", { + description = "Cotton Seeds", + inventory_image = "farming_cotton_seed.png", + on_place = function(itemstack, placer, pointed_thing) + local above = minetest.env:get_node(pointed_thing.above) + if above.name == "air" then + above.name = "farming:cotton_1" + minetest.env:set_node(pointed_thing.above, above) + itemstack:take_item(1) + return itemstack + end + end +}) + +minetest.register_node("farming:cotton_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_cotton_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+6/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:cotton_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_cotton_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+12/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:cotton", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_cotton.png"}, + drop = { + max_items = 6, + items = { + { items = {'farming:cotton_seed'} }, + { items = {'farming:cotton_seed'}, rarity = 2}, + { items = {'farming:cotton_seed'}, rarity = 5}, + { items = {'farming:string'} }, + { items = {'farming:string'}, rarity = 2 }, + { items = {'farming:string'}, rarity = 5 } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +farming:add_plant("farming:cotton", {"farming:cotton_1", "farming:cotton_2"}, 50, 20) + +minetest.register_craftitem("farming:string", { + description = "String", + inventory_image = "farming_string.png", +}) + +minetest.register_craft({ + output = "wool:white", + recipe = {{"farming:string"}} +}) + +-- ========= FUEL ========= +minetest.register_craft({ + type = "fuel", + recipe = "farming:cotton_seed", + burntime = 1 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:string", + burntime = 1 +}) diff --git a/mods/farming/depends.txt b/mods/farming/depends.txt new file mode 100644 index 00000000..0b8ebe02 --- /dev/null +++ b/mods/farming/depends.txt @@ -0,0 +1,3 @@ +default +bucket +wool diff --git a/mods/farming/hoes.lua b/mods/farming/hoes.lua new file mode 100644 index 00000000..33cf462b --- /dev/null +++ b/mods/farming/hoes.lua @@ -0,0 +1,83 @@ +local function create_soil(pos, inv, p) + if pos == nil then + return false + end + local node = minetest.env:get_node(pos) + local name = node.name + local above = minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}) + if name == "default:dirt" or name == "default:dirt_with_grass" then + if above.name == "air" then + node.name = "farming:soil" + minetest.env:set_node(pos, node) + if inv and p and name == "default:dirt_with_grass" then + for name,rarity in pairs(farming.seeds) do + if math.random(1, rarity-p) == 1 then + inv:add_item("main", ItemStack(name)) + end + end + end + return true + end + end + return false +end + +minetest.register_tool("farming:hoe_wood", { + description = "Wood Hoe", + inventory_image = "farming_hoe_wood.png", + on_use = function(itemstack, user, pointed_thing) + if create_soil(pointed_thing.under, user:get_inventory(), 0) then + itemstack:add_wear(65535/30) + return itemstack + end + end +}) + +minetest.register_craft({ + output = "farming:hoe_wood", + recipe = { + {"default:wood", "default:wood"}, + {"", "default:stick"}, + {"", "default:stick"} + } +}) + +minetest.register_tool("farming:hoe_stone", { + description = "Stone Hoe", + inventory_image = "farming_hoe_stone.png", + on_use = function(itemstack, user, pointed_thing) + if create_soil(pointed_thing.under, user:get_inventory(), 5) then + itemstack:add_wear(65535/50) + return itemstack + end + end +}) + +minetest.register_craft({ + output = "farming:hoe_stone", + recipe = { + {"default:cobble", "default:cobble"}, + {"", "default:stick"}, + {"", "default:stick"} + } +}) + +minetest.register_tool("farming:hoe_steel", { + description = "Steel Hoe", + inventory_image = "farming_hoe_steel.png", + on_use = function(itemstack, user, pointed_thing) + if create_soil(pointed_thing.under, user:get_inventory(), 10) then + itemstack:add_wear(65535/80) + return itemstack + end + end +}) + +minetest.register_craft({ + output = "farming:hoe_steel", + recipe = { + {"default:steel_ingot", "default:steel_ingot"}, + {"", "default:stick"}, + {"", "default:stick"} + } +}) diff --git a/mods/farming/init.lua b/mods/farming/init.lua new file mode 100644 index 00000000..efc2959d --- /dev/null +++ b/mods/farming/init.lua @@ -0,0 +1,185 @@ +farming = {} + +function farming:add_plant(full_grown, names, interval, chance) + minetest.register_abm({ + nodenames = names, + interval = interval, + chance = chance, + action = function(pos, node) + pos.y = pos.y-1 + if minetest.env:get_node(pos).name ~= "farming:soil_wet" then + return + end + pos.y = pos.y+1 + if minetest.env:get_node_light(pos) < 8 then + return + end + local step = nil + for i,name in ipairs(names) do + if name == node.name then + step = i + break + end + end + if step == nil then + return + end + local new_node = {name=names[step+1]} + if new_node.name == nil then + new_node.name = full_grown + end + minetest.env:set_node(pos, new_node) + end +} ) +end + +function farming:generate_tree(pos, trunk, leaves, underground, replacements) + pos.y = pos.y-1 + local nodename = minetest.env:get_node(pos).name + local ret = true + for _,name in ipairs(underground) do + if nodename == name then + ret = false + break + end + end + pos.y = pos.y+1 + if ret or minetest.env:get_node_light(pos) < 8 then + return + end + + node = {name = ""} + for dy=1,4 do + pos.y = pos.y+dy + if minetest.env:get_node(pos).name ~= "air" then + return + end + pos.y = pos.y-dy + end + node.name = trunk + for dy=0,4 do + pos.y = pos.y+dy + minetest.env:set_node(pos, node) + pos.y = pos.y-dy + end + + if not replacements then + replacements = {} + end + + node.name = leaves + pos.y = pos.y+3 + for dx=-2,2 do + for dz=-2,2 do + for dy=0,3 do + pos.x = pos.x+dx + pos.y = pos.y+dy + pos.z = pos.z+dz + + if dx == 0 and dz == 0 and dy==3 then + if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then + minetest.env:set_node(pos, node) + for name,rarity in pairs(replacements) do + if math.random(1, rarity) == 1 then + minetest.env:set_node(pos, {name=name}) + end + end + end + elseif dx == 0 and dz == 0 and dy==4 then + if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then + minetest.env:set_node(pos, node) + for name,rarity in pairs(replacements) do + if math.random(1, rarity) == 1 then + minetest.env:set_node(pos, {name=name}) + end + end + end + elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then + if minetest.env:get_node(pos).name == "air" then + minetest.env:set_node(pos, node) + for name,rarity in pairs(replacements) do + if math.random(1, rarity) == 1 then + minetest.env:set_node(pos, {name=name}) + end + end + end + else + if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then + if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then + minetest.env:set_node(pos, node) + for name,rarity in pairs(replacements) do + if math.random(1, rarity) == 1 then + minetest.env:set_node(pos, {name=name}) + end + end + end + end + end + + pos.x = pos.x-dx + pos.y = pos.y-dy + pos.z = pos.z-dz + end + end + end +end + +farming.seeds = { + ["farming:wheat_seed"]=20, + ["farming:cotton_seed"]=30, + ["farming:pumpkin_seed"]=60, + ["farming:strawberry_seed"]=30, + ["farming:rhubarb_seed"]=30, + ["farming:potatoe_seed"]=30, + ["farming:tomato_seed"]=30, + ["farming:orange_seed"]=30, + ["farming:carrot_seed"]=30, +} + +-- ========= SOIL ========= +dofile(minetest.get_modpath("farming").."/soil.lua") + +-- ========= HOES ========= +dofile(minetest.get_modpath("farming").."/hoes.lua") + +-- ========= CORN ========= +dofile(minetest.get_modpath("farming").."/wheat.lua") + +-- ========= COTTON ========= +dofile(minetest.get_modpath("farming").."/cotton.lua") + +-- ========= PUMPKINS ========= +dofile(minetest.get_modpath("farming").."/pumpkin.lua") + +-- ========= RUBBER ========= +dofile(minetest.get_modpath("farming").."/rubber.lua") + +-- ========= WEED ========= +dofile(minetest.get_modpath("farming").."/weed.lua") + +-- ========= STRAWBERRIES ========= +dofile(minetest.get_modpath("farming").."/strawberries.lua") + +-- ========= RHUBARB ========= +dofile(minetest.get_modpath("farming").."/rhubarb.lua") + +-- ========= POTATOES ========= +dofile(minetest.get_modpath("farming").."/potatoes.lua") + +-- ========= TOMATOES ========= +dofile(minetest.get_modpath("farming").."/tomatoes.lua") + +-- ========= ORANGES ========= +dofile(minetest.get_modpath("farming").."/oranges.lua") + +-- ========= BANANAS ========= +dofile(minetest.get_modpath("farming").."/bananas.lua") + +-- ========= PAPYRUS ========= +dofile(minetest.get_modpath("farming").."/papyrus.lua") + +-- ========= CACTUS ========= +dofile(minetest.get_modpath("farming").."/cactus.lua") + +-- ========= CARROTS ========= +dofile(minetest.get_modpath("farming").."/carrots.lua") diff --git a/mods/farming/oranges.lua b/mods/farming/oranges.lua new file mode 100644 index 00000000..cebbcfd0 --- /dev/null +++ b/mods/farming/oranges.lua @@ -0,0 +1,89 @@ +minetest.register_craftitem("farming:orange_seed", { + description = "Orange Seeds", + inventory_image = "farming_orange_seed.png", + on_place = function(itemstack, placer, pointed_thing) + local above = minetest.env:get_node(pointed_thing.above) + if above.name == "air" then + above.name = "farming:orange_1" + minetest.env:set_node(pointed_thing.above, above) + itemstack:take_item(1) + return itemstack + end + end +}) + +minetest.register_node("farming:orange_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_orange_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:orange_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_orange_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+8/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:orange_3", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_orange_3.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+14/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:orange", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_orange_4.png"}, + drop = { + max_items = 6, + items = { + { items = {'farming:orange_seed'} }, + { items = {'farming:orange_seed'}, rarity = 2}, + { items = {'farming:orange_seed'}, rarity = 5}, + { items = {'farming:orange_item'} }, + { items = {'farming:orange_item'}, rarity = 2 }, + { items = {'farming:orange_item'}, rarity = 5 } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_craftitem("farming:orange_item", { + description = "Orange", + inventory_image = "farming_orange.png", + on_use = minetest.item_eat(4), +}) + +farming:add_plant("farming:orange", {"farming:orange_1", "farming:orange_2", "farming:orange_3"}, 50, 20) diff --git a/mods/farming/papyrus.lua b/mods/farming/papyrus.lua new file mode 100644 index 00000000..d33e072f --- /dev/null +++ b/mods/farming/papyrus.lua @@ -0,0 +1,25 @@ +minetest.register_abm({ + nodenames = {"default:papyrus"}, + interval = 50, + chance = 20, + action = function(pos, node) + pos.y = pos.y-1 + local name = minetest.env:get_node(pos).name + if name == "default:dirt" or name == "default:dirt_with_grass" then + if minetest.env:find_node_near(pos, 3, {"default:water_source", "default:water_flowing"}) == nil then + return + end + pos.y = pos.y+1 + local height = 0 + while minetest.env:get_node(pos).name == "default:papyrus" do + height = height+1 + pos.y = pos.y+1 + end + if height < 4 then + if minetest.env:get_node(pos).name == "air" then + minetest.env:set_node(pos, node) + end + end + end + end +}) diff --git a/mods/farming/potatoes.lua b/mods/farming/potatoes.lua new file mode 100644 index 00000000..6b886a43 --- /dev/null +++ b/mods/farming/potatoes.lua @@ -0,0 +1,72 @@ +minetest.register_craftitem("farming:potatoe_seed", { + description = "Potatoe Seeds", + inventory_image = "farming_potatoe_seed.png", + on_place = function(itemstack, placer, pointed_thing) + local above = minetest.env:get_node(pointed_thing.above) + if above.name == "air" then + above.name = "farming:potatoe_1" + minetest.env:set_node(pointed_thing.above, above) + itemstack:take_item(1) + return itemstack + end + end +}) + +minetest.register_node("farming:potatoe_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_potatoe_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+6/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:potatoe_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_potatoe_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+9/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:potatoe", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_potatoe_3.png"}, + drop = { + max_items = 6, + items = { + { items = {'farming:potatoe_seed'} }, + { items = {'farming:potatoe_seed'}, rarity = 2}, + { items = {'farming:potatoe_seed'}, rarity = 5}, + { items = {'farming:potatoe_item'} }, + { items = {'farming:potatoe_item'}, rarity = 2 }, + { items = {'farming:potatoe_item'}, rarity = 5 } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_craftitem("farming:potatoe_item", { + description = "Potatoe", + inventory_image = "farming_potatoe.png", +}) + +farming:add_plant("farming:potatoe", {"farming:potatoe_1", "farming:potatoe_2"}, 50, 20) diff --git a/mods/farming/pumpkin.lua b/mods/farming/pumpkin.lua new file mode 100644 index 00000000..73991ca7 --- /dev/null +++ b/mods/farming/pumpkin.lua @@ -0,0 +1,446 @@ +minetest.register_craftitem("farming:pumpkin_seed", { + description = "Pumpkin Seed", + inventory_image = "farming_pumpkin_seed.png", + on_place = function(itemstack, placer, pointed_thing) + local above = minetest.env:get_node(pointed_thing.above) + if above.name == "air" then + above.name = "farming:pumpkin_1" + minetest.env:set_node(pointed_thing.above, above) + itemstack:take_item(1) + return itemstack + end + end +}) + +minetest.register_node("farming:pumpkin_1", { + paramtype = "light", + drawtype = "nodebox", + drop = "", + tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"}, + node_box = { + type = "fixed", + fixed = { + {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2} + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2} + }, + }, + groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("farming:pumpkin_2", { + paramtype = "light", + drawtype = "nodebox", + drop = "", + tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"}, + node_box = { + type = "fixed", + fixed = { + {-0.35, -0.5, -0.35, 0.35, 0.2, 0.35} + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.35, -0.5, -0.35, 0.35, 0.2, 0.35} + }, + }, + groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("farming:pumpkin", { + description = "Pumpkin", + paramtype2 = "facedir", + tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"}, + groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2}, + sounds = default.node_sound_wood_defaults(), + + on_punch = function(pos, node, puncher) + local tool = puncher:get_wielded_item():get_name() + if tool and tool == "default:sword_wood" or tool == "default:sword_stone" or tool == "default:sword_steel" then + node.name = "farming:pumpkin_face" + minetest.env:set_node(pos, node) + puncher:get_inventory():add_item("main", ItemStack("farming:pumpkin_seed")) + if math.random(1, 5) == 1 then + puncher:get_inventory():add_item("main", ItemStack("farming:pumpkin_seed")) + end + end + end +}) + +farming:add_plant("farming:pumpkin", {"farming:pumpkin_1", "farming:pumpkin_2"}, 80, 20) + +minetest.register_node("farming:pumpkin_face", { + description = "Pumpkin", + paramtype2 = "facedir", + tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face.png"}, + groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("farming:pumpkin_face_light", { + description = "Pumpkin", + paramtype2 = "facedir", + light_source = LIGHT_MAX-2, + tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face_light.png"}, + groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:pumpkin_face_light", + recipe = {"farming:pumpkin_face", "default:torch"} +}) + +-- ========= BIG PUMPKIN ========= +minetest.register_node("farming:big_pumpkin", { + description = "Big Pumpkin", + paramtype2 = "facedir", + tiles = {"farming_pumpkin_big_side.png"}, + selection_box = { + type = "fixed", + fixed = { + {-1, -0.5, -1, 1, 1.5, 1} + } + }, + groups = {choppy=1, oddly_breakable_by_hand=1, flammable=2}, + sounds = default.node_sound_wood_defaults(), + + after_place_node = function(pos, placer) + for dx=-1,1 do + for dy=0,1 do + for dz=-1,1 do + pos.x = pos.x+dx + pos.y = pos.y+dy + pos.z = pos.z+dz + if dx ~= 0 or dy ~= 0 or dz ~= 0 then + if minetest.env:get_node(pos).name ~= "air" then + pos.x = pos.x-dx + pos.y = pos.y-dy + pos.z = pos.z-dz + minetest.env:remove_node(pos) + minetest.after(0.1, function(placer) + local inv = placer:get_inventory() + local index = placer:get_wield_index() + inv:set_stack("main", index, ItemStack("farming:big_pumpkin")) + end, placer) + return + end + end + pos.x = pos.x-dx + pos.y = pos.y-dy + pos.z = pos.z-dz + end + end + end + for dy=0,1 do + pos.y = pos.y+dy + pos.z = pos.z+1 + minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=2}) + pos.x = pos.x-1 + minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=2}) + pos.x = pos.x+1 + pos.z = pos.z-2 + minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=4}) + pos.x = pos.x+1 + minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=4}) + pos.z = pos.z+1 + minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=3}) + pos.z = pos.z+1 + minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=3}) + pos.z = pos.z-1 + pos.x = pos.x-2 + minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=1}) + pos.z = pos.z-1 + minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=1}) + pos.z = pos.z+1 + pos.x = pos.x+1 + pos.y = pos.y-dy + end + pos.y = pos.y+1 + minetest.env:set_node(pos, {name="farming:big_pumpkin_top"}) + end, + + after_destruct = function(pos, oldnode) + for dx=-1,1 do + for dy=0,1 do + for dz=-1,1 do + pos.x = pos.x+dx + pos.y = pos.y+dy + pos.z = pos.z+dz + local name = minetest.env:get_node(pos).name + if string.find(name, "farming:big_pumpkin") then + minetest.env:remove_node(pos) + end + pos.x = pos.x-dx + pos.y = pos.y-dy + pos.z = pos.z-dz + end + end + end + end +}) + +minetest.register_node("farming:big_pumpkin_side", { + paramtype = "light", + paramtype2 = "facedir", + tiles = {"farming_pumpkin_big_top_side.png", "farming_pumpkin_big_side.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0, 0.5, 0.5, 0.5} + } + }, + selection_box = { + type = "fixed", + fixed = { + {0, 0, 0, 0, 0, 0} + } + }, + groups = {not_in_creative_inventory=1}, +}) +minetest.register_node("farming:big_pumpkin_corner", { + paramtype = "light", + paramtype2 = "facedir", + tiles = {"farming_pumpkin_big_top_corner.png", "farming_pumpkin_big_side.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0, 0, 0.5, 0.5} + } + }, + selection_box = { + type = "fixed", + fixed = { + {0, 0, 0, 0, 0, 0} + } + }, + groups = {not_in_creative_inventory=1}, +}) + +minetest.register_node("farming:big_pumpkin_top", { + paramtype = "light", + tiles = {"farming_pumpkin_big_top.png"}, + selection_box = { + type = "fixed", + fixed = { + {0, 0, 0, 0, 0, 0} + } + }, + groups = {not_in_creative_inventory=1}, +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:big_pumpkin", + recipe = {"bucket:bucket_water", "farming:pumpkin"}, + replacements = { + {"bucket:bucket_water", "bucket:bucket_empty"} + } +}) + +-- ========= SCARECROW ========= +local box1 = { + {-1, -8, -1, 1, 8, 1}, +} + +local box2 = { + {-1, -8, -1, 1, 8, 1}, + {-12, -8, -1, 12, -7, 1}, + {-5, -2, -5, 5, 8, 5} +} + +for j,list in ipairs(box1) do + for i,int in ipairs(list) do + list[i] = int/16 + end + box1[j] = list +end + +for j,list in ipairs(box2) do + for i,int in ipairs(list) do + list[i] = int/16 + end + box2[j] = list +end + +minetest.register_node("farming:scarecrow", { + description = "Scarecrow", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"farming_scarecrow_top.png", "farming_scarecrow_top.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_front.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = box2 + }, + selection_box = { + type = "fixed", + fixed = { + {-12/16, -1.5, -0.5, 12/16, 0.5, 0.5} + } + }, + groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2}, + + after_place_node = function(pos, placer) + local node = minetest.env:get_node(pos) + local param2 = node.param2 + pos.y = pos.y+1 + if minetest.env:get_node(pos).name ~= "air" then + pos.y = pos.y-1 + minetest.env:remove_node(pos) + minetest.after(0.1, function(placer) + local inv = placer:get_inventory() + local index = placer:get_wield_index() + inv:set_stack("main", index, ItemStack("farming:scarecrow")) + end, placer) + return + end + minetest.env:set_node(pos, node) + pos.y = pos.y-1 + node.name = "farming:scarecrow_bottom" + minetest.env:set_node(pos, node) + end, + + after_destruct = function(pos, oldnode) + pos.y = pos.y-1 + if minetest.env:get_node(pos).name == "farming:scarecrow_bottom" then + minetest.env:remove_node(pos) + end + end +}) + +minetest.register_node("farming:scarecrow_bottom", { + paramtype = "light", + paramtype2 = "facedir", + tiles = {"default_wood.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = box1 + }, + groups = {not_in_creative_inventory=1}, + selection_box = { + type = "fixed", + fixed = { + {0, 0, 0, 0, 0, 0} + } + } +}) + +minetest.register_craft({ + output = "farming:scarecrow", + recipe = { + {"", "farming:pumpkin_face", "",}, + {"default:stick", "default:stick", "default:stick",}, + {"", "default:stick", "",} + } +}) + +minetest.register_node("farming:scarecrow_light", { + description = "Scarecrow", + paramtype = "light", + paramtype2 = "facedir", + light_source = LIGHT_MAX-2, + tiles = {"farming_scarecrow_top.png", "farming_scarecrow_top.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_front_light.png"}, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = box2 + }, + selection_box = { + type = "fixed", + fixed = { + {-12/16, -1.5, -0.5, 12/16, 0.5, 0.5} + } + }, + groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2}, + + after_place_node = function(pos, placer) + local node = minetest.env:get_node(pos) + local param2 = node.param2 + pos.y = pos.y+1 + if minetest.env:get_node(pos).name ~= "air" then + pos.y = pos.y-1 + minetest.env:remove_node(pos) + minetest.after(0.1, function(placer) + local inv = placer:get_inventory() + local index = placer:get_wield_index() + inv:set_stack("main", index, ItemStack("farming:scarecrow_light")) + end, placer) + return + end + minetest.env:set_node(pos, node) + pos.y = pos.y-1 + node.name = "farming:scarecrow_bottom" + minetest.env:set_node(pos, node) + end, + + after_destruct = function(pos, oldnode) + pos.y = pos.y-1 + if minetest.env:get_node(pos).name == "farming:scarecrow_bottom" then + minetest.env:remove_node(pos) + end + end +}) + +minetest.register_craft({ + output = "farming:scarecrow_light", + recipe = { + {"", "farming:pumpkin_face_light", "",}, + {"default:stick", "default:stick", "default:stick",}, + {"", "default:stick", "",} + } +}) + +-- ========= FUEL ========= +minetest.register_craft({ + type = "fuel", + recipe = "farming:pumpkin_seed", + burntime = 1 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:pumpkin", + burntime = 5 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:pumpkin_face", + burntime = 5 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:pumpkin_face_light", + burntime = 7 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:big_pumpkin", + burntime = 10 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:scarecrow", + burntime = 5 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:scarecrow_light", + burntime = 5 +}) diff --git a/mods/farming/rhubarb.lua b/mods/farming/rhubarb.lua new file mode 100644 index 00000000..e9dd59b6 --- /dev/null +++ b/mods/farming/rhubarb.lua @@ -0,0 +1,72 @@ +minetest.register_craftitem("farming:rhubarb_seed", { + description = "Rhubarb Seeds", + inventory_image = "farming_rhubarb_seed.png", + on_place = function(itemstack, placer, pointed_thing) + local above = minetest.env:get_node(pointed_thing.above) + if above.name == "air" then + above.name = "farming:rhubarb_1" + minetest.env:set_node(pointed_thing.above, above) + itemstack:take_item(1) + return itemstack + end + end +}) + +minetest.register_node("farming:rhubarb_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_rhubarb_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+5/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:rhubarb_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_rhubarb_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+11/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:rhubarb", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_rhubarb_3.png"}, + drop = { + max_items = 6, + items = { + { items = {'farming:rhubarb_seed'} }, + { items = {'farming:rhubarb_seed'}, rarity = 2}, + { items = {'farming:rhubarb_seed'}, rarity = 5}, + { items = {'farming:rhubarb_item'} }, + { items = {'farming:rhubarb_item'}, rarity = 2 }, + { items = {'farming:rhubarb_item'}, rarity = 5 } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_craftitem("farming:rhubarb_item", { + description = "Rhubarb", + inventory_image = "farming_rhubarb.png", +}) + +farming:add_plant("farming:rhubarb", {"farming:rhubarb_1", "farming:rhubarb_2"}, 50, 20) diff --git a/mods/farming/rubber.lua b/mods/farming/rubber.lua new file mode 100644 index 00000000..768466d3 --- /dev/null +++ b/mods/farming/rubber.lua @@ -0,0 +1,104 @@ +minetest.register_node("farming:rubber_sapling", { + description = "Rubber Tree Sapling", + drawtype = "plantlike", + tiles = {"farming_rubber_sapling.png"}, + inventory_image = "farming_rubber_sapling.png", + wield_image = "farming_rubber_sapling.png", + paramtype = "light", + walkable = false, + groups = {dig_immediate=3,flammable=2}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("farming:rubber_tree_full", { + description = "Rubber Tree", + tiles = {"default_tree_top.png", "default_tree_top.png", "farming_rubber_tree_full.png"}, + groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2}, + drop = "default:tree", + sounds = default.node_sound_wood_defaults(), + + on_dig = function(pos, node, digger) + minetest.node_dig(pos, node, digger) + minetest.env:remove_node(pos) + end, + + after_destruct = function(pos, oldnode) + oldnode.name = "farming:rubber_tree_empty" + minetest.env:set_node(pos, oldnode) + end +}) + + +minetest.register_node("farming:rubber_tree_empty", { + tiles = {"default_tree_top.png", "default_tree_top.png", "farming_rubber_tree_empty.png"}, + groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2, not_in_creative_inventory=1}, + drop = "default:tree", + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_abm({ + nodenames = {"farming:rubber_tree_empty"}, + interval = 60, + chance = 15, + action = function(pos, node) + node.name = "farming:rubber_tree_full" + minetest.env:set_node(pos, node) + end +}) + +minetest.register_node("farming:rubber_leaves", { + drawtype = "allfaces_optional", + visual_scale = 1.3, + tiles = {"default_leaves.png"}, + paramtype = "light", + groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1}, + drop = { + max_items = 1, + items = { + { + items = {'farming:rubber_sapling'}, + rarity = 20, + }, + } + }, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_abm({ + nodenames = {"farming:rubber_sapling"}, + interval = 60, + chance = 20, + action = function(pos, node) + farming:generate_tree(pos, "farming:rubber_tree_full", "farming:rubber_leaves", {"default:dirt", "default:dirt_with_grass"}) + end +}) + +minetest.register_on_generated(function(minp, maxp, blockseed) + if math.random(1, 100) > 5 then + return + end + local tmp = {x=(maxp.x-minp.x)/2+minp.x, y=(maxp.y-minp.y)/2+minp.y, z=(maxp.z-minp.z)/2+minp.z} + local pos = minetest.env:find_node_near(tmp, maxp.x-minp.x, {"default:dirt_with_grass"}) + if pos ~= nil then + farming:generate_tree({x=pos.x, y=pos.y+1, z=pos.z}, "farming:rubber_tree_full", "farming:rubber_leaves", {"default:dirt", "default:dirt_with_grass"}) + end +end) + +minetest.register_craftitem("farming:bucket_rubber", { + description = "Bucket with Caoutchouc", + inventory_image = "farming_bucket_rubber.png", + stack_max = 1, +}) + +local bucket_tmp = { + source = "farming:rubber_tree_full", + itemname = "farming:bucket_rubber" +} +bucket.liquids["farming:rubber_tree_full"] = bucket_tmp + +-- ========= FUEL ========= +minetest.register_craft({ + type = "fuel", + recipe = "farming:rubber_sapling", + burntime = 10 +}) diff --git a/mods/farming/soil.lua b/mods/farming/soil.lua new file mode 100644 index 00000000..f8003354 --- /dev/null +++ b/mods/farming/soil.lua @@ -0,0 +1,45 @@ +minetest.register_node("farming:soil", { + tiles = {"farming_soil.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png", "default_dirt.png"}, + drop = "default:dirt", + groups = {crumbly=3, not_in_creative_inventory=1}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_grass_footstep", gain=0.4}, + }), +}) + +minetest.register_node("farming:soil_wet", { + tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png", "farming_soil_wet_side.png", "farming_soil_wet_side.png", "farming_soil_wet_side.png", "farming_soil_wet_side.png"}, + drop = "default:dirt", + groups = {crumbly=3, not_in_creative_inventory=1}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_grass_footstep", gain=0.4}, + }), +}) + +minetest.register_abm({ + nodenames = {"farming:soil"}, + interval = 15, + chance = 3, + action = function(pos, node) + if minetest.env:find_node_near(pos, 4, {"default:water_source", "default:water_flowing"}) then + node.name = "farming:soil_wet" + minetest.env:set_node(pos, node) + end + end, +}) + +-- ========= EXPERIMENTAL ========= +-- This will turn soil to dirt when walking over it +--[[minetest.register_abm({ + nodenames = {"farming:soil", "farming:soil_wet"}, + interval = 2, + chance = 2, + action = function(pos, node) + pos.y = pos.y+1 + if #(minetest.env:get_objects_inside_radius(pos, 0.8)) > 0 then + pos.y = pos.y-1 + node.name = "default:dirt" + minetest.env:set_node(pos, node) + end + end, +})]] diff --git a/mods/farming/strawberries.lua b/mods/farming/strawberries.lua new file mode 100644 index 00000000..e2b21326 --- /dev/null +++ b/mods/farming/strawberries.lua @@ -0,0 +1,89 @@ +minetest.register_craftitem("farming:strawberry_seed", { + description = "Strawberry Seeds", + inventory_image = "farming_strawberry_seed.png", + on_place = function(itemstack, placer, pointed_thing) + local above = minetest.env:get_node(pointed_thing.above) + if above.name == "air" then + above.name = "farming:strawberry_1" + minetest.env:set_node(pointed_thing.above, above) + itemstack:take_item(1) + return itemstack + end + end +}) + +minetest.register_node("farming:strawberry_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_strawberry_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+9/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:strawberry_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_strawberry_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+12/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:strawberry_3", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_strawberry_3.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+14/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:strawberry", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_strawberry_4.png"}, + drop = { + max_items = 6, + items = { + { items = {'farming:strawberry_seed'} }, + { items = {'farming:strawberry_seed'}, rarity = 2}, + { items = {'farming:strawberry_seed'}, rarity = 5}, + { items = {'farming:strawberry_item'} }, + { items = {'farming:strawberry_item'}, rarity = 2 }, + { items = {'farming:strawberry_item'}, rarity = 5 } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_craftitem("farming:strawberry_item", { + description = "Strawberry", + inventory_image = "farming_strawberry.png", + on_use = minetest.item_eat(2), +}) + +farming:add_plant("farming:strawberry", {"farming:strawberry_1", "farming:strawberry_2", "farming:strawberry_3"}, 50, 20) diff --git a/mods/farming/textures/farming_banana.png b/mods/farming/textures/farming_banana.png new file mode 100644 index 00000000..f775e14c Binary files /dev/null and b/mods/farming/textures/farming_banana.png differ diff --git a/mods/farming/textures/farming_banana_leaves.png b/mods/farming/textures/farming_banana_leaves.png new file mode 100644 index 00000000..cf8eecbf Binary files /dev/null and b/mods/farming/textures/farming_banana_leaves.png differ diff --git a/mods/farming/textures/farming_banana_sapling.png b/mods/farming/textures/farming_banana_sapling.png new file mode 100644 index 00000000..821c64ff Binary files /dev/null and b/mods/farming/textures/farming_banana_sapling.png differ diff --git a/mods/farming/textures/farming_bread.png b/mods/farming/textures/farming_bread.png new file mode 100644 index 00000000..6dca9831 Binary files /dev/null and b/mods/farming/textures/farming_bread.png differ diff --git a/mods/farming/textures/farming_bread_pumpkin.png b/mods/farming/textures/farming_bread_pumpkin.png new file mode 100644 index 00000000..44db02e2 Binary files /dev/null and b/mods/farming/textures/farming_bread_pumpkin.png differ diff --git a/mods/farming/textures/farming_bucket_rubber.png b/mods/farming/textures/farming_bucket_rubber.png new file mode 100644 index 00000000..effdcac6 Binary files /dev/null and b/mods/farming/textures/farming_bucket_rubber.png differ diff --git a/mods/farming/textures/farming_cake_mix.png b/mods/farming/textures/farming_cake_mix.png new file mode 100644 index 00000000..5c4b1975 Binary files /dev/null and b/mods/farming/textures/farming_cake_mix.png differ diff --git a/mods/farming/textures/farming_cake_mix_pumpkin.png b/mods/farming/textures/farming_cake_mix_pumpkin.png new file mode 100644 index 00000000..171e4867 Binary files /dev/null and b/mods/farming/textures/farming_cake_mix_pumpkin.png differ diff --git a/mods/farming/textures/farming_carrot.png b/mods/farming/textures/farming_carrot.png new file mode 100644 index 00000000..5ed61ac9 Binary files /dev/null and b/mods/farming/textures/farming_carrot.png differ diff --git a/mods/farming/textures/farming_carrot_1.png b/mods/farming/textures/farming_carrot_1.png new file mode 100644 index 00000000..09cfe739 Binary files /dev/null and b/mods/farming/textures/farming_carrot_1.png differ diff --git a/mods/farming/textures/farming_carrot_2.png b/mods/farming/textures/farming_carrot_2.png new file mode 100644 index 00000000..cbb76ea2 Binary files /dev/null and b/mods/farming/textures/farming_carrot_2.png differ diff --git a/mods/farming/textures/farming_carrot_3.png b/mods/farming/textures/farming_carrot_3.png new file mode 100644 index 00000000..74e3dc89 Binary files /dev/null and b/mods/farming/textures/farming_carrot_3.png differ diff --git a/mods/farming/textures/farming_carrot_4.png b/mods/farming/textures/farming_carrot_4.png new file mode 100644 index 00000000..1c6445f3 Binary files /dev/null and b/mods/farming/textures/farming_carrot_4.png differ diff --git a/mods/farming/textures/farming_carrot_seed.png b/mods/farming/textures/farming_carrot_seed.png new file mode 100644 index 00000000..69bc4504 Binary files /dev/null and b/mods/farming/textures/farming_carrot_seed.png differ diff --git a/mods/farming/textures/farming_cotton.png b/mods/farming/textures/farming_cotton.png new file mode 100644 index 00000000..8b8d3670 Binary files /dev/null and b/mods/farming/textures/farming_cotton.png differ diff --git a/mods/farming/textures/farming_cotton_1.png b/mods/farming/textures/farming_cotton_1.png new file mode 100644 index 00000000..bc72c7e8 Binary files /dev/null and b/mods/farming/textures/farming_cotton_1.png differ diff --git a/mods/farming/textures/farming_cotton_2.png b/mods/farming/textures/farming_cotton_2.png new file mode 100644 index 00000000..70b6eef5 Binary files /dev/null and b/mods/farming/textures/farming_cotton_2.png differ diff --git a/mods/farming/textures/farming_cotton_seed.png b/mods/farming/textures/farming_cotton_seed.png new file mode 100644 index 00000000..4154062d Binary files /dev/null and b/mods/farming/textures/farming_cotton_seed.png differ diff --git a/mods/farming/textures/farming_flour.png b/mods/farming/textures/farming_flour.png new file mode 100644 index 00000000..7c302bfd Binary files /dev/null and b/mods/farming/textures/farming_flour.png differ diff --git a/mods/farming/textures/farming_hoe_steel.png b/mods/farming/textures/farming_hoe_steel.png new file mode 100644 index 00000000..0d892b4d Binary files /dev/null and b/mods/farming/textures/farming_hoe_steel.png differ diff --git a/mods/farming/textures/farming_hoe_stone.png b/mods/farming/textures/farming_hoe_stone.png new file mode 100644 index 00000000..6b2da0b1 Binary files /dev/null and b/mods/farming/textures/farming_hoe_stone.png differ diff --git a/mods/farming/textures/farming_hoe_wood.png b/mods/farming/textures/farming_hoe_wood.png new file mode 100644 index 00000000..6b33f6ec Binary files /dev/null and b/mods/farming/textures/farming_hoe_wood.png differ diff --git a/mods/farming/textures/farming_orange.png b/mods/farming/textures/farming_orange.png new file mode 100644 index 00000000..d9ae9e90 Binary files /dev/null and b/mods/farming/textures/farming_orange.png differ diff --git a/mods/farming/textures/farming_orange_1.png b/mods/farming/textures/farming_orange_1.png new file mode 100644 index 00000000..ab553c89 Binary files /dev/null and b/mods/farming/textures/farming_orange_1.png differ diff --git a/mods/farming/textures/farming_orange_2.png b/mods/farming/textures/farming_orange_2.png new file mode 100644 index 00000000..fb991fde Binary files /dev/null and b/mods/farming/textures/farming_orange_2.png differ diff --git a/mods/farming/textures/farming_orange_3.png b/mods/farming/textures/farming_orange_3.png new file mode 100644 index 00000000..af60f387 Binary files /dev/null and b/mods/farming/textures/farming_orange_3.png differ diff --git a/mods/farming/textures/farming_orange_4.png b/mods/farming/textures/farming_orange_4.png new file mode 100644 index 00000000..73e8715a Binary files /dev/null and b/mods/farming/textures/farming_orange_4.png differ diff --git a/mods/farming/textures/farming_orange_seed.png b/mods/farming/textures/farming_orange_seed.png new file mode 100644 index 00000000..3873bade Binary files /dev/null and b/mods/farming/textures/farming_orange_seed.png differ diff --git a/mods/farming/textures/farming_potatoe.png b/mods/farming/textures/farming_potatoe.png new file mode 100644 index 00000000..50411f83 Binary files /dev/null and b/mods/farming/textures/farming_potatoe.png differ diff --git a/mods/farming/textures/farming_potatoe_1.png b/mods/farming/textures/farming_potatoe_1.png new file mode 100644 index 00000000..75a36d92 Binary files /dev/null and b/mods/farming/textures/farming_potatoe_1.png differ diff --git a/mods/farming/textures/farming_potatoe_2.png b/mods/farming/textures/farming_potatoe_2.png new file mode 100644 index 00000000..6491d34d Binary files /dev/null and b/mods/farming/textures/farming_potatoe_2.png differ diff --git a/mods/farming/textures/farming_potatoe_3.png b/mods/farming/textures/farming_potatoe_3.png new file mode 100644 index 00000000..37a2c972 Binary files /dev/null and b/mods/farming/textures/farming_potatoe_3.png differ diff --git a/mods/farming/textures/farming_potatoe_seed.png b/mods/farming/textures/farming_potatoe_seed.png new file mode 100644 index 00000000..74e440df Binary files /dev/null and b/mods/farming/textures/farming_potatoe_seed.png differ diff --git a/mods/farming/textures/farming_pumpkin_big_side.png b/mods/farming/textures/farming_pumpkin_big_side.png new file mode 100644 index 00000000..2651380b Binary files /dev/null and b/mods/farming/textures/farming_pumpkin_big_side.png differ diff --git a/mods/farming/textures/farming_pumpkin_big_top.png b/mods/farming/textures/farming_pumpkin_big_top.png new file mode 100644 index 00000000..581acccd Binary files /dev/null and b/mods/farming/textures/farming_pumpkin_big_top.png differ diff --git a/mods/farming/textures/farming_pumpkin_big_top_corner.png b/mods/farming/textures/farming_pumpkin_big_top_corner.png new file mode 100644 index 00000000..ab1de284 Binary files /dev/null and b/mods/farming/textures/farming_pumpkin_big_top_corner.png differ diff --git a/mods/farming/textures/farming_pumpkin_big_top_side.png b/mods/farming/textures/farming_pumpkin_big_top_side.png new file mode 100644 index 00000000..e2eb1a75 Binary files /dev/null and b/mods/farming/textures/farming_pumpkin_big_top_side.png differ diff --git a/mods/farming/textures/farming_pumpkin_face.png b/mods/farming/textures/farming_pumpkin_face.png new file mode 100644 index 00000000..90c0f8a9 Binary files /dev/null and b/mods/farming/textures/farming_pumpkin_face.png differ diff --git a/mods/farming/textures/farming_pumpkin_face_light.png b/mods/farming/textures/farming_pumpkin_face_light.png new file mode 100644 index 00000000..cef48664 Binary files /dev/null and b/mods/farming/textures/farming_pumpkin_face_light.png differ diff --git a/mods/farming/textures/farming_pumpkin_seed.png b/mods/farming/textures/farming_pumpkin_seed.png new file mode 100644 index 00000000..6933bc38 Binary files /dev/null and b/mods/farming/textures/farming_pumpkin_seed.png differ diff --git a/mods/farming/textures/farming_pumpkin_side.png b/mods/farming/textures/farming_pumpkin_side.png new file mode 100644 index 00000000..3a3f9dae Binary files /dev/null and b/mods/farming/textures/farming_pumpkin_side.png differ diff --git a/mods/farming/textures/farming_pumpkin_top.png b/mods/farming/textures/farming_pumpkin_top.png new file mode 100644 index 00000000..edef2d94 Binary files /dev/null and b/mods/farming/textures/farming_pumpkin_top.png differ diff --git a/mods/farming/textures/farming_rhubarb.png b/mods/farming/textures/farming_rhubarb.png new file mode 100644 index 00000000..849f61bf Binary files /dev/null and b/mods/farming/textures/farming_rhubarb.png differ diff --git a/mods/farming/textures/farming_rhubarb_1.png b/mods/farming/textures/farming_rhubarb_1.png new file mode 100644 index 00000000..706d8cf6 Binary files /dev/null and b/mods/farming/textures/farming_rhubarb_1.png differ diff --git a/mods/farming/textures/farming_rhubarb_2.png b/mods/farming/textures/farming_rhubarb_2.png new file mode 100644 index 00000000..2aadf5fd Binary files /dev/null and b/mods/farming/textures/farming_rhubarb_2.png differ diff --git a/mods/farming/textures/farming_rhubarb_3.png b/mods/farming/textures/farming_rhubarb_3.png new file mode 100644 index 00000000..833f65b4 Binary files /dev/null and b/mods/farming/textures/farming_rhubarb_3.png differ diff --git a/mods/farming/textures/farming_rhubarb_seed.png b/mods/farming/textures/farming_rhubarb_seed.png new file mode 100644 index 00000000..c16527d9 Binary files /dev/null and b/mods/farming/textures/farming_rhubarb_seed.png differ diff --git a/mods/farming/textures/farming_rubber_sapling.png b/mods/farming/textures/farming_rubber_sapling.png new file mode 100644 index 00000000..e5c9f5de Binary files /dev/null and b/mods/farming/textures/farming_rubber_sapling.png differ diff --git a/mods/farming/textures/farming_rubber_tree_empty.png b/mods/farming/textures/farming_rubber_tree_empty.png new file mode 100755 index 00000000..1792951e Binary files /dev/null and b/mods/farming/textures/farming_rubber_tree_empty.png differ diff --git a/mods/farming/textures/farming_rubber_tree_full.png b/mods/farming/textures/farming_rubber_tree_full.png new file mode 100755 index 00000000..08067eff Binary files /dev/null and b/mods/farming/textures/farming_rubber_tree_full.png differ diff --git a/mods/farming/textures/farming_scarecrow_front.png b/mods/farming/textures/farming_scarecrow_front.png new file mode 100644 index 00000000..364738fd Binary files /dev/null and b/mods/farming/textures/farming_scarecrow_front.png differ diff --git a/mods/farming/textures/farming_scarecrow_front_light.png b/mods/farming/textures/farming_scarecrow_front_light.png new file mode 100644 index 00000000..b4b3cf28 Binary files /dev/null and b/mods/farming/textures/farming_scarecrow_front_light.png differ diff --git a/mods/farming/textures/farming_scarecrow_side.png b/mods/farming/textures/farming_scarecrow_side.png new file mode 100644 index 00000000..e22e84ba Binary files /dev/null and b/mods/farming/textures/farming_scarecrow_side.png differ diff --git a/mods/farming/textures/farming_scarecrow_top.png b/mods/farming/textures/farming_scarecrow_top.png new file mode 100644 index 00000000..3a4addcd Binary files /dev/null and b/mods/farming/textures/farming_scarecrow_top.png differ diff --git a/mods/farming/textures/farming_soil.png b/mods/farming/textures/farming_soil.png new file mode 100644 index 00000000..eac98439 Binary files /dev/null and b/mods/farming/textures/farming_soil.png differ diff --git a/mods/farming/textures/farming_soil_wet.png b/mods/farming/textures/farming_soil_wet.png new file mode 100644 index 00000000..398f7277 Binary files /dev/null and b/mods/farming/textures/farming_soil_wet.png differ diff --git a/mods/farming/textures/farming_soil_wet_side.png b/mods/farming/textures/farming_soil_wet_side.png new file mode 100755 index 00000000..dd7f9b6f Binary files /dev/null and b/mods/farming/textures/farming_soil_wet_side.png differ diff --git a/mods/farming/textures/farming_strawberry.png b/mods/farming/textures/farming_strawberry.png new file mode 100644 index 00000000..0a80f45d Binary files /dev/null and b/mods/farming/textures/farming_strawberry.png differ diff --git a/mods/farming/textures/farming_strawberry_1.png b/mods/farming/textures/farming_strawberry_1.png new file mode 100644 index 00000000..ff238f67 Binary files /dev/null and b/mods/farming/textures/farming_strawberry_1.png differ diff --git a/mods/farming/textures/farming_strawberry_2.png b/mods/farming/textures/farming_strawberry_2.png new file mode 100644 index 00000000..2912eb52 Binary files /dev/null and b/mods/farming/textures/farming_strawberry_2.png differ diff --git a/mods/farming/textures/farming_strawberry_3.png b/mods/farming/textures/farming_strawberry_3.png new file mode 100644 index 00000000..ca77389e Binary files /dev/null and b/mods/farming/textures/farming_strawberry_3.png differ diff --git a/mods/farming/textures/farming_strawberry_4.png b/mods/farming/textures/farming_strawberry_4.png new file mode 100644 index 00000000..12c6a49c Binary files /dev/null and b/mods/farming/textures/farming_strawberry_4.png differ diff --git a/mods/farming/textures/farming_strawberry_seed.png b/mods/farming/textures/farming_strawberry_seed.png new file mode 100644 index 00000000..08c958d9 Binary files /dev/null and b/mods/farming/textures/farming_strawberry_seed.png differ diff --git a/mods/farming/textures/farming_string.png b/mods/farming/textures/farming_string.png new file mode 100644 index 00000000..f417ec44 Binary files /dev/null and b/mods/farming/textures/farming_string.png differ diff --git a/mods/farming/textures/farming_tomato.png b/mods/farming/textures/farming_tomato.png new file mode 100644 index 00000000..b112d485 Binary files /dev/null and b/mods/farming/textures/farming_tomato.png differ diff --git a/mods/farming/textures/farming_tomato_1.png b/mods/farming/textures/farming_tomato_1.png new file mode 100644 index 00000000..2e7c425e Binary files /dev/null and b/mods/farming/textures/farming_tomato_1.png differ diff --git a/mods/farming/textures/farming_tomato_2.png b/mods/farming/textures/farming_tomato_2.png new file mode 100644 index 00000000..6f6a4518 Binary files /dev/null and b/mods/farming/textures/farming_tomato_2.png differ diff --git a/mods/farming/textures/farming_tomato_3.png b/mods/farming/textures/farming_tomato_3.png new file mode 100644 index 00000000..e01b60b9 Binary files /dev/null and b/mods/farming/textures/farming_tomato_3.png differ diff --git a/mods/farming/textures/farming_tomato_4.png b/mods/farming/textures/farming_tomato_4.png new file mode 100644 index 00000000..e2f5db4e Binary files /dev/null and b/mods/farming/textures/farming_tomato_4.png differ diff --git a/mods/farming/textures/farming_tomato_seed.png b/mods/farming/textures/farming_tomato_seed.png new file mode 100644 index 00000000..dbef76e7 Binary files /dev/null and b/mods/farming/textures/farming_tomato_seed.png differ diff --git a/mods/farming/textures/farming_weed.png b/mods/farming/textures/farming_weed.png new file mode 100644 index 00000000..46672870 Binary files /dev/null and b/mods/farming/textures/farming_weed.png differ diff --git a/mods/farming/textures/farming_wheat.png b/mods/farming/textures/farming_wheat.png new file mode 100644 index 00000000..a508318d Binary files /dev/null and b/mods/farming/textures/farming_wheat.png differ diff --git a/mods/farming/textures/farming_wheat_1.png b/mods/farming/textures/farming_wheat_1.png new file mode 100644 index 00000000..007ecf33 Binary files /dev/null and b/mods/farming/textures/farming_wheat_1.png differ diff --git a/mods/farming/textures/farming_wheat_2.png b/mods/farming/textures/farming_wheat_2.png new file mode 100644 index 00000000..40956a7b Binary files /dev/null and b/mods/farming/textures/farming_wheat_2.png differ diff --git a/mods/farming/textures/farming_wheat_3.png b/mods/farming/textures/farming_wheat_3.png new file mode 100644 index 00000000..7dc89a71 Binary files /dev/null and b/mods/farming/textures/farming_wheat_3.png differ diff --git a/mods/farming/textures/farming_wheat_harvested.png b/mods/farming/textures/farming_wheat_harvested.png new file mode 100644 index 00000000..5abde6d4 Binary files /dev/null and b/mods/farming/textures/farming_wheat_harvested.png differ diff --git a/mods/farming/textures/farming_wheat_seed.png b/mods/farming/textures/farming_wheat_seed.png new file mode 100644 index 00000000..bf2ac77e Binary files /dev/null and b/mods/farming/textures/farming_wheat_seed.png differ diff --git a/mods/farming/tomatoes.lua b/mods/farming/tomatoes.lua new file mode 100644 index 00000000..2ec040a0 --- /dev/null +++ b/mods/farming/tomatoes.lua @@ -0,0 +1,89 @@ +minetest.register_craftitem("farming:tomato_seed", { + description = "Tomato Seeds", + inventory_image = "farming_tomato_seed.png", + on_place = function(itemstack, placer, pointed_thing) + local above = minetest.env:get_node(pointed_thing.above) + if above.name == "air" then + above.name = "farming:tomato_1" + minetest.env:set_node(pointed_thing.above, above) + itemstack:take_item(1) + return itemstack + end + end +}) + +minetest.register_node("farming:tomato_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_tomato_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+5/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:tomato_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_tomato_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+8/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:tomato_3", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_tomato_3.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+13/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:tomato", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_tomato_4.png"}, + drop = { + max_items = 6, + items = { + { items = {'farming:tomato_seed'} }, + { items = {'farming:tomato_seed'}, rarity = 2}, + { items = {'farming:tomato_seed'}, rarity = 5}, + { items = {'farming:tomato_item'} }, + { items = {'farming:tomato_item'}, rarity = 2 }, + { items = {'farming:tomato_item'}, rarity = 5 } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_craftitem("farming:tomato_item", { + description = "Tomato", + inventory_image = "farming_tomato.png", + on_use = minetest.item_eat(4), +}) + +farming:add_plant("farming:tomato", {"farming:tomato_1", "farming:tomato_2", "farming:tomato_3"}, 50, 20) diff --git a/mods/farming/weed.lua b/mods/farming/weed.lua new file mode 100644 index 00000000..55ed3ae8 --- /dev/null +++ b/mods/farming/weed.lua @@ -0,0 +1,39 @@ +minetest.register_node("farming:weed", { + description = "Weed", + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_weed.png"}, + inventory_image = "farming_weed.png", + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+4/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2}, + sounds = default.node_sound_leaves_defaults() +}) + +minetest.register_abm({ + nodenames = {"farming:soil_wet", "farming:soil"}, + interval = 50, + chance = 10, + action = function(pos, node) + if minetest.env:find_node_near(pos, 4, {"farming:scarecrow", "farming:scarecrow_light"}) ~= nil then + return + end + pos.y = pos.y+1 + if minetest.env:get_node(pos).name == "air" then + node.name = "farming:weed" + minetest.env:set_node(pos, node) + end + end +}) + +-- ========= FUEL ========= +minetest.register_craft({ + type = "fuel", + recipe = "farming:weed", + burntime = 1 +}) \ No newline at end of file diff --git a/mods/farming/wheat.lua b/mods/farming/wheat.lua new file mode 100644 index 00000000..e34675de --- /dev/null +++ b/mods/farming/wheat.lua @@ -0,0 +1,169 @@ +minetest.register_craftitem("farming:wheat_seed", { + description = "Wheat Seeds", + inventory_image = "farming_wheat_seed.png", + on_place = function(itemstack, placer, pointed_thing) + local above = minetest.env:get_node(pointed_thing.above) + if above.name == "air" then + above.name = "farming:wheat_1" + minetest.env:set_node(pointed_thing.above, above) + itemstack:take_item(1) + return itemstack + end + end +}) + +minetest.register_node("farming:wheat_1", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_wheat_1.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+4/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:wheat_2", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_wheat_2.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+7/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:wheat_3", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + drop = "", + tiles = {"farming_wheat_3.png"}, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5+13/16, 0.5} + }, + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("farming:wheat", { + paramtype = "light", + walkable = false, + drawtype = "plantlike", + tiles = {"farming_wheat.png"}, + drop = { + max_items = 4, + items = { + { items = {'farming:wheat_seed'} }, + { items = {'farming:wheat_seed'}, rarity = 2}, + { items = {'farming:wheat_seed'}, rarity = 5}, + { items = {'farming:wheat_harvested'} } + } + }, + groups = {snappy=3, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), +}) + +farming:add_plant("farming:wheat", {"farming:wheat_1", "farming:wheat_2", "farming:wheat_3"}, 50, 20) + +minetest.register_craftitem("farming:wheat_harvested", { + description = "Harvested Wheat", + inventory_image = "farming_wheat_harvested.png", +}) + +minetest.register_craft({ + output = "farming:flour", + recipe = { + {"farming:wheat_harvested", } + } +}) + +minetest.register_craftitem("farming:flour", { + description = "Flour", + inventory_image = "farming_flour.png", +}) + +minetest.register_craft({ + output = "farming:cake_mix", + type = "shapeless", + recipe = {"farming:flour", "farming:flour", "farming:flour", "farming:flour", "bucket:bucket_water"}, + replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}} +}) + +minetest.register_craftitem("farming:cake_mix", { + description = "Cake Mix", + inventory_image = "farming_cake_mix.png", +}) + +minetest.register_craft({ + type = "cooking", + output = "farming:bread", + recipe = "farming:cake_mix", + cooktime = 10 +}) + +minetest.register_craftitem("farming:bread", { + description = "Bread", + inventory_image = "farming_bread.png", + stack_max = 1, + on_use = minetest.item_eat(10) +}) + +minetest.register_craftitem("farming:pumpkin_bread", { + description = "Pumpkin Bread", + inventory_image = "farming_bread_pumpkin.png", + stack_max = 1, + on_use = minetest.item_eat(20) +}) + +minetest.register_craftitem("farming:pumpkin_cake_mix", { + description = "Pumpkin Cake Mix", + inventory_image = "farming_cake_mix_pumpkin.png", +}) + +minetest.register_craft({ + output = "farming:pumpkin_cake_mix", + type = "shapeless", + recipe = {"farming:cake_mix", "farming:pumpkin"} +}) + +minetest.register_craft({ + type = "cooking", + output = "farming:pumpkin_bread", + recipe = "farming:pumpkin_cake_mix", + cooktime = 10 +}) + +minetest.register_alias("farming:corn_seed", "farming:wheat_seed") +minetest.register_alias("farming:corn_1", "farming:wheat_1") +minetest.register_alias("farming:corn_2", "farming:wheat_2") +minetest.register_alias("farming:corn_3", "farming:wheat_3") +minetest.register_alias("farming:corn", "farming:wheat") +minetest.register_alias("farming:corn_harvested", "farming:wheat_harvested") + +-- ========= FUEL ========= +minetest.register_craft({ + type = "fuel", + recipe = "farming:wheat_seed", + burntime = 1 +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:wheat_harvested", + burntime = 2 +}) diff --git a/mods/throwing/README b/mods/throwing/README new file mode 100644 index 00000000..826f470d --- /dev/null +++ b/mods/throwing/README @@ -0,0 +1,47 @@ +=== THROWING-MOD for MINETEST-C55 === +by PilzAdam + +Inroduction: +This mod adds bows and arrows to Minetest. + +How to install: +Unzip the archive an place it in minetest-base-directory/mods/minetest/ +if you have a windows client or a linux run-in-place client. If you have +a linux system-wide instalation place it in ~/.minetest/mods/minetest/. +If you want to install this mod only in one world create the folder +worldmods/ in your worlddirectory. +For further information or help see: +http://wiki.minetest.com/wiki/Installing_Mods + +How to use the mod: +Craft a bow with the strings from the farming mod: +string wood +string wood +string wood +Craft arrows with: +stick stick steel +Select the bow and shoot with left mouse click. Every shoot will take 1 +arrow from your inventory and wears out the bow (you have around 50 +shoots). + +License: +This mod was originally published by Jeija. +Sourcecode: WTFPL (see below) +Grahpics: WTFPL (see below) + +See also: +http://minetest.net/ + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/mods/throwing/arrow.lua b/mods/throwing/arrow.lua new file mode 100644 index 00000000..3e237fd4 --- /dev/null +++ b/mods/throwing/arrow.lua @@ -0,0 +1,81 @@ +minetest.register_craftitem("throwing:arrow", { + description = "Arrow", + inventory_image = "throwing_arrow.png", +}) + +minetest.register_node("throwing:arrow_box", { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + -- Shaft + {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, + --Spitze + {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, + {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, + --Federn + {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, + {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, + {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, + {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, + + {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, + {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, + {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, + {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, + } + }, + tiles = {"throwing_arrow.png", "throwing_arrow.png", "throwing_arrow_back.png", "throwing_arrow_front.png", "throwing_arrow_2.png", "throwing_arrow.png"}, + groups = {not_in_creative_inventory=1}, +}) + +local THROWING_ARROW_ENTITY={ + physical = false, + timer=0, + visual = "wielditem", + visual_size = {x=0.1, y=0.1}, + textures = {"throwing:arrow_box"}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, +} + +THROWING_ARROW_ENTITY.on_step = function(self, dtime) + self.timer=self.timer+dtime + local pos = self.object:getpos() + local node = minetest.env:get_node(pos) + + if self.timer>0.2 then + local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2) + for k, obj in pairs(objs) do + if obj:get_luaentity() ~= nil then + if obj:get_luaentity().name ~= "throwing:arrow_entity" and obj:get_luaentity().name ~= "__builtin:item" then + obj:set_hp(obj:get_hp()-2) + if obj:get_hp() <= 0 then + obj:remove() + end + self.object:remove() + end + else + obj:set_hp(obj:get_hp()-2) + self.object:remove() + end + end + end + + if self.lastpos.x~=nil then + if node.name ~= "air" then + minetest.env:add_item(self.lastpos, 'throwing:arrow') + self.object:remove() + end + end + self.lastpos={x=pos.x, y=pos.y, z=pos.z} +end + +minetest.register_entity("throwing:arrow_entity", THROWING_ARROW_ENTITY) + +minetest.register_craft({ + output = 'throwing:arrow 16', + recipe = { + {'default:stick', 'default:stick', 'default:steel_ingot'}, + } +}) diff --git a/mods/throwing/build_arrow.lua b/mods/throwing/build_arrow.lua new file mode 100644 index 00000000..2ea1bf6e --- /dev/null +++ b/mods/throwing/build_arrow.lua @@ -0,0 +1,85 @@ +minetest.register_craftitem("throwing:arrow_build", { + description = "Build Arrow", + inventory_image = "throwing_arrow_build.png", +}) + +minetest.register_node("throwing:arrow_build_box", { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + -- Shaft + {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, + --Spitze + {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, + {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, + --Federn + {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, + {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, + {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, + {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, + + {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, + {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, + {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, + {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, + } + }, + tiles = {"throwing_arrow_build.png", "throwing_arrow_build.png", "throwing_arrow_build_back.png", "throwing_arrow_build_front.png", "throwing_arrow_build_2.png", "throwing_arrow_build.png"}, + groups = {not_in_creative_inventory=1}, +}) + +local THROWING_ARROW_ENTITY={ + physical = false, + timer=0, + visual = "wielditem", + visual_size = {x=0.1, y=0.1}, + textures = {"throwing:arrow_build_box"}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, + node = "", +} + +THROWING_ARROW_ENTITY.on_step = function(self, dtime) + self.timer=self.timer+dtime + local pos = self.object:getpos() + local node = minetest.env:get_node(pos) + + if self.timer>0.2 then + local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1) + for k, obj in pairs(objs) do + if obj:get_luaentity() ~= nil then + if obj:get_luaentity().name ~= "throwing:arrow_build_entity" and obj:get_luaentity().name ~= "__builtin:item" then + if self.node ~= "" then + minetest.env:set_node(self.lastpos, {name=self.node}) + end + self.object:remove() + end + else + if self.node ~= "" then + minetest.env:set_node(self.lastpos, {name=self.node}) + end + self.object:remove() + end + end + end + + if self.lastpos.x~=nil then + if node.name ~= "air" then + if self.node ~= "" then + minetest.env:set_node(self.lastpos, {name=self.node}) + end + self.object:remove() + end + end + self.lastpos={x=pos.x, y=pos.y, z=pos.z} +end + +minetest.register_entity("throwing:arrow_build_entity", THROWING_ARROW_ENTITY) + +minetest.register_craft({ + output = 'throwing:arrow_build', + recipe = { + {'default:stick', 'default:stick', 'default:shovel_steel'}, + } +}) diff --git a/mods/throwing/depends.txt b/mods/throwing/depends.txt new file mode 100644 index 00000000..252d6655 --- /dev/null +++ b/mods/throwing/depends.txt @@ -0,0 +1,4 @@ +default +bucket +fire +farming diff --git a/mods/throwing/dig_arrow.lua b/mods/throwing/dig_arrow.lua new file mode 100644 index 00000000..e756a34d --- /dev/null +++ b/mods/throwing/dig_arrow.lua @@ -0,0 +1,81 @@ +minetest.register_craftitem("throwing:arrow_dig", { + description = "Dig Arrow", + inventory_image = "throwing_arrow_dig.png", +}) + +minetest.register_node("throwing:arrow_dig_box", { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + -- Shaft + {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, + --Spitze + {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, + {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, + --Federn + {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, + {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, + {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, + {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, + + {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, + {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, + {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, + {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, + } + }, + tiles = {"throwing_arrow_dig.png", "throwing_arrow_dig.png", "throwing_arrow_dig_back.png", "throwing_arrow_dig_front.png", "throwing_arrow_dig_2.png", "throwing_arrow_dig.png"}, + groups = {not_in_creative_inventory=1}, +}) + +local THROWING_ARROW_ENTITY={ + physical = false, + timer=0, + visual = "wielditem", + visual_size = {x=0.1, y=0.1}, + textures = {"throwing:arrow_dig_box"}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, +} + +THROWING_ARROW_ENTITY.on_step = function(self, dtime) + self.timer=self.timer+dtime + local pos = self.object:getpos() + local node = minetest.env:get_node(pos) + + if self.timer>0.2 then + local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1) + for k, obj in pairs(objs) do + if obj:get_luaentity() ~= nil then + if obj:get_luaentity().name ~= "throwing:arrow_dig_entity" and obj:get_luaentity().name ~= "__builtin:item" then + minetest.env:add_item(pos, 'throwing:arrow_dig') + minetest.env:remove_node(pos) + self.object:remove() + end + else + minetest.env:add_item(pos, 'throwing:arrow_dig') + minetest.env:remove_node(pos) + self.object:remove() + end + end + end + + if self.lastpos.x~=nil then + if node.name ~= "air" then + minetest.env:add_item(self.lastpos, 'throwing:arrow_dig') + minetest.env:remove_node(pos) + self.object:remove() + end + end + self.lastpos={x=pos.x, y=pos.y, z=pos.z} +end + +minetest.register_entity("throwing:arrow_dig_entity", THROWING_ARROW_ENTITY) + +minetest.register_craft({ + output = 'throwing:arrow_dig', + recipe = { + {'default:stick', 'default:stick', 'default:pick_steel'}, + } +}) diff --git a/mods/throwing/fire_arrow.lua b/mods/throwing/fire_arrow.lua new file mode 100644 index 00000000..e3b930d6 --- /dev/null +++ b/mods/throwing/fire_arrow.lua @@ -0,0 +1,114 @@ +minetest.register_craftitem("throwing:arrow_fire", { + description = "Fire Arrow", + inventory_image = "throwing_arrow_fire.png", +}) + +minetest.register_node("throwing:arrow_fire_box", { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + -- Shaft + {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, + --Spitze + {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, + {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, + --Federn + {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, + {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, + {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, + {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, + + {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, + {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, + {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, + {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, + } + }, + tiles = {"throwing_arrow_fire.png", "throwing_arrow_fire.png", "throwing_arrow_fire_back.png", "throwing_arrow_fire_front.png", "throwing_arrow_fire_2.png", "throwing_arrow_fire.png"}, + groups = {not_in_creative_inventory=1}, +}) + +local THROWING_ARROW_ENTITY={ + physical = false, + timer=0, + visual = "wielditem", + visual_size = {x=0.1, y=0.1}, + textures = {"throwing:arrow_fire_box"}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, +} + +THROWING_ARROW_ENTITY.on_step = function(self, dtime) + self.timer=self.timer+dtime + local pos = self.object:getpos() + local node = minetest.env:get_node(pos) + + if self.timer>0.2 then + local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2) + for k, obj in pairs(objs) do + if obj:get_luaentity() ~= nil then + if obj:get_luaentity().name ~= "throwing:arrow_fire_entity" and obj:get_luaentity().name ~= "__builtin:item" then + obj:set_hp(obj:get_hp()-3) + if obj:get_hp() <= 0 then + obj:remove() + end + self.object:remove() + end + else + obj:set_hp(obj:get_hp()-3) + self.object:remove() + end + end + end + + if self.lastpos.x~=nil then + if node.name ~= "air" and node.name ~= "throwing:light" then + minetest.env:set_node(self.lastpos, {name="fire:basic_flame"}) + self.object:remove() + end + if math.floor(self.lastpos.x+0.5) ~= math.floor(pos.x+0.5) or math.floor(self.lastpos.y+0.5) ~= math.floor(pos.y+0.5) or math.floor(self.lastpos.z+0.5) ~= math.floor(pos.z+0.5) then + if minetest.env:get_node(self.lastpos).name == "throwing:light" then + minetest.env:remove_node(self.lastpos) + end + if minetest.env:get_node(pos).name == "air" then + minetest.env:set_node(pos, {name="throwing:light"}) + end + end + end + self.lastpos={x=pos.x, y=pos.y, z=pos.z} +end + +minetest.register_entity("throwing:arrow_fire_entity", THROWING_ARROW_ENTITY) + +minetest.register_craft({ + output = 'throwing:arrow_fire 4', + recipe = { + {'default:stick', 'default:stick', 'bucket:bucket_lava'}, + }, + replacements = { + {"bucket:bucket_lava", "bucket:bucket_empty"} + } +}) + +minetest.register_node("throwing:light", { + drawtype = "glasslike", + tiles = {"throwing_empty.png"}, + light_source = LIGHT_MAX-4, + selection_box = { + type = "fixed", + fixed = { + {0,0,0,0,0,0} + } + }, + groups = {not_in_creative_inventory=1} +}) + +minetest.register_abm({ + nodenames = {"throwing:light"}, + interval = 10, + chance = 1, + action = function(pos, node) + minetest.env:remove_node(pos) + end +}) diff --git a/mods/throwing/init.lua b/mods/throwing/init.lua new file mode 100644 index 00000000..108eb45e --- /dev/null +++ b/mods/throwing/init.lua @@ -0,0 +1,99 @@ +arrows = { + {"throwing:arrow", "throwing:arrow_entity"}, + {"throwing:arrow_fire", "throwing:arrow_fire_entity"}, + {"throwing:arrow_teleport", "throwing:arrow_teleport_entity"}, + {"throwing:arrow_dig", "throwing:arrow_dig_entity"}, + {"throwing:arrow_build", "throwing:arrow_build_entity"} +} + +local throwing_shoot_arrow = function(itemstack, player) + for _,stack in ipairs(player:get_inventory():get_list("main")) do + for _,arrow in ipairs(arrows) do + if stack:get_name() == arrow[1] then + player:get_inventory():remove_item("main", arrow[1]) + local playerpos = player:getpos() + local obj = minetest.env:add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2]) + local dir = player:get_look_dir() + obj:setvelocity({x=dir.x*19, y=dir.y*19, z=dir.z*19}) + obj:setacceleration({x=dir.x*-3, y=-10, z=dir.z*-3}) + obj:setyaw(player:get_look_yaw()+math.pi) + minetest.sound_play("throwing_sound", {pos=playerpos}) + if obj:get_luaentity().player == "" then + obj:get_luaentity().player = player + end + obj:get_luaentity().node = player:get_inventory():get_stack("main", 1):get_name() + return true + end + end + end + return false +end + +minetest.register_tool("throwing:bow_wood", { + description = "Wood Bow", + inventory_image = "throwing_bow_wood.png", + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + if throwing_shoot_arrow(itemstack, user, pointed_thing) then + itemstack:add_wear(65535/50) + end + return itemstack + end, +}) + +minetest.register_craft({ + output = 'throwing:bow_wood', + recipe = { + {'farming:string', 'default:wood', ''}, + {'farming:string', '', 'default:wood'}, + {'farming:string', 'default:wood', ''}, + } +}) + +minetest.register_tool("throwing:bow_stone", { + description = "Stone Bow", + inventory_image = "throwing_bow_stone.png", + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + if throwing_shoot_arrow(item, user, pointed_thing) then + itemstack:add_wear(65535/100) + end + return itemstack + end, +}) + +minetest.register_craft({ + output = 'throwing:bow_stone', + recipe = { + {'farming:string', 'default:cobble', ''}, + {'farming:string', '', 'default:cobble'}, + {'farming:string', 'default:cobble', ''}, + } +}) + +minetest.register_tool("throwing:bow_steel", { + description = "Steel Bow", + inventory_image = "throwing_bow_steel.png", + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + if throwing_shoot_arrow(item, user, pointed_thing) then + itemstack:add_wear(65535/200) + end + return itemstack + end, +}) + +minetest.register_craft({ + output = 'throwing:bow_steel', + recipe = { + {'farming:string', 'default:steel_ingot', ''}, + {'farming:string', '', 'default:steel_ingot'}, + {'farming:string', 'default:steel_ingot', ''}, + } +}) + +dofile(minetest.get_modpath("throwing").."/arrow.lua") +dofile(minetest.get_modpath("throwing").."/fire_arrow.lua") +dofile(minetest.get_modpath("throwing").."/teleport_arrow.lua") +dofile(minetest.get_modpath("throwing").."/dig_arrow.lua") +dofile(minetest.get_modpath("throwing").."/build_arrow.lua") \ No newline at end of file diff --git a/mods/throwing/sounds/throwing_sound.ogg b/mods/throwing/sounds/throwing_sound.ogg new file mode 100644 index 00000000..c8911e5f Binary files /dev/null and b/mods/throwing/sounds/throwing_sound.ogg differ diff --git a/mods/throwing/teleport_arrow.lua b/mods/throwing/teleport_arrow.lua new file mode 100644 index 00000000..301cc5d6 --- /dev/null +++ b/mods/throwing/teleport_arrow.lua @@ -0,0 +1,88 @@ +minetest.register_craftitem("throwing:arrow_teleport", { + description = "Teleport Arrow", + inventory_image = "throwing_arrow_teleport.png", +}) + +minetest.register_node("throwing:arrow_teleport_box", { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + -- Shaft + {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, + --Spitze + {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, + {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, + --Federn + {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, + {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, + {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, + {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, + + {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, + {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, + {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, + {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, + } + }, + tiles = {"throwing_arrow_teleport.png", "throwing_arrow_teleport.png", "throwing_arrow_teleport_back.png", "throwing_arrow_teleport_front.png", "throwing_arrow_teleport_2.png", "throwing_arrow_teleport.png"}, + groups = {not_in_creative_inventory=1}, +}) + +local THROWING_ARROW_ENTITY={ + physical = false, + timer=0, + visual = "wielditem", + visual_size = {x=0.1, y=0.1}, + textures = {"throwing:arrow_teleport_box"}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, + player = "", +} + +THROWING_ARROW_ENTITY.on_step = function(self, dtime) + self.timer=self.timer+dtime + local pos = self.object:getpos() + local node = minetest.env:get_node(pos) + + if self.timer>0.2 then + local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2) + for k, obj in pairs(objs) do + if obj:get_luaentity() ~= nil then + if obj:get_luaentity().name ~= "throwing:arrow_teleport_entity" and obj:get_luaentity().name ~= "__builtin:item" then + if self.player ~= "" then + self.player:setpos(pos) + self.player:get_inventory():add_item("main", ItemStack("throwing:arrow_teleport")) + end + self.object:remove() + end + else + if self.player ~= "" then + self.player:setpos(pos) + self.player:get_inventory():add_item("main", ItemStack("throwing:arrow_teleport")) + end + self.object:remove() + end + end + end + + if self.lastpos.x~=nil then + if node.name ~= "air" then + if self.player ~= "" then + self.player:setpos(self.lastpos) + self.player:get_inventory():add_item("main", ItemStack("throwing:arrow_teleport")) + end + self.object:remove() + end + end + self.lastpos={x=pos.x, y=pos.y, z=pos.z} +end + +minetest.register_entity("throwing:arrow_teleport_entity", THROWING_ARROW_ENTITY) + +minetest.register_craft({ + output = 'throwing:arrow_teleport', + recipe = { + {'default:stick', 'default:stick', 'default:mese'}, + } +}) diff --git a/mods/throwing/textures/throwing_arrow.png b/mods/throwing/textures/throwing_arrow.png new file mode 100644 index 00000000..9b72ee98 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow.png differ diff --git a/mods/throwing/textures/throwing_arrow_2.png b/mods/throwing/textures/throwing_arrow_2.png new file mode 100644 index 00000000..b5980d02 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_back.png b/mods/throwing/textures/throwing_arrow_back.png new file mode 100644 index 00000000..d680d88f Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_build.png b/mods/throwing/textures/throwing_arrow_build.png new file mode 100644 index 00000000..02653e13 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_build.png differ diff --git a/mods/throwing/textures/throwing_arrow_build_2.png b/mods/throwing/textures/throwing_arrow_build_2.png new file mode 100644 index 00000000..fd576d40 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_build_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_build_back.png b/mods/throwing/textures/throwing_arrow_build_back.png new file mode 100644 index 00000000..18c2f02c Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_build_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_build_front.png b/mods/throwing/textures/throwing_arrow_build_front.png new file mode 100644 index 00000000..b6b69672 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_build_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_dig.png b/mods/throwing/textures/throwing_arrow_dig.png new file mode 100644 index 00000000..02f6a000 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_dig.png differ diff --git a/mods/throwing/textures/throwing_arrow_dig_2.png b/mods/throwing/textures/throwing_arrow_dig_2.png new file mode 100644 index 00000000..b514b5d2 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_dig_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_dig_back.png b/mods/throwing/textures/throwing_arrow_dig_back.png new file mode 100644 index 00000000..97422572 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_dig_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_dig_front.png b/mods/throwing/textures/throwing_arrow_dig_front.png new file mode 100644 index 00000000..6681c998 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_dig_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_fire.png b/mods/throwing/textures/throwing_arrow_fire.png new file mode 100644 index 00000000..8f5075a3 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_fire.png differ diff --git a/mods/throwing/textures/throwing_arrow_fire_2.png b/mods/throwing/textures/throwing_arrow_fire_2.png new file mode 100644 index 00000000..ed0aa5fb Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_fire_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_fire_back.png b/mods/throwing/textures/throwing_arrow_fire_back.png new file mode 100644 index 00000000..8a7d9930 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_fire_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_fire_front.png b/mods/throwing/textures/throwing_arrow_fire_front.png new file mode 100644 index 00000000..3994257d Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_fire_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_front.png b/mods/throwing/textures/throwing_arrow_front.png new file mode 100644 index 00000000..828a486f Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_teleport.png b/mods/throwing/textures/throwing_arrow_teleport.png new file mode 100644 index 00000000..f95d3e8b Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_teleport.png differ diff --git a/mods/throwing/textures/throwing_arrow_teleport_2.png b/mods/throwing/textures/throwing_arrow_teleport_2.png new file mode 100644 index 00000000..6e8eaa9b Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_teleport_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_teleport_back.png b/mods/throwing/textures/throwing_arrow_teleport_back.png new file mode 100644 index 00000000..e0bba027 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_teleport_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_teleport_front.png b/mods/throwing/textures/throwing_arrow_teleport_front.png new file mode 100644 index 00000000..80138c4c Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_teleport_front.png differ diff --git a/mods/throwing/textures/throwing_bow_steel.png b/mods/throwing/textures/throwing_bow_steel.png new file mode 100644 index 00000000..e14c45c4 Binary files /dev/null and b/mods/throwing/textures/throwing_bow_steel.png differ diff --git a/mods/throwing/textures/throwing_bow_stone.png b/mods/throwing/textures/throwing_bow_stone.png new file mode 100644 index 00000000..93b86dd2 Binary files /dev/null and b/mods/throwing/textures/throwing_bow_stone.png differ diff --git a/mods/throwing/textures/throwing_bow_wood.png b/mods/throwing/textures/throwing_bow_wood.png new file mode 100644 index 00000000..07f303a5 Binary files /dev/null and b/mods/throwing/textures/throwing_bow_wood.png differ diff --git a/mods/throwing/textures/throwing_empty.png b/mods/throwing/textures/throwing_empty.png new file mode 100644 index 00000000..6bbd5547 Binary files /dev/null and b/mods/throwing/textures/throwing_empty.png differ diff --git a/mods/tnt/README.txt b/mods/tnt/README.txt new file mode 100644 index 00000000..46d3fca1 --- /dev/null +++ b/mods/tnt/README.txt @@ -0,0 +1,45 @@ +=== TNT-MOD for MINETEST-C55 === +by PilzAdam + +Introduction: +This mod adds TNT to Minetest. TNT is a tool to help the player +in mining. + +How to install: +Unzip the archive an place it in minetest-base-directory/mods/minetest/ +if you have a windows client or a linux run-in-place client. If you have +a linux system-wide instalation place it in ~/.minetest/mods/minetest/. +If you want to install this mod only in one world create the folder +worldmods/ in your worlddirectory. +For further information or help see: +http://wiki.minetest.com/wiki/Installing_Mods + +How to use the mod: +Craft gunpowder by placing coal and gravel in the crafting area. The +gunpowder can be used to craft TNT or as fuze for TNT. To craft TNT +surround gunpowder with 4 wood in a + shape. +There are different ways to blow up TNT: +1. Hit it with a torch. +2. Hit a gunpowder fuze that leads to a TNT block with a torch. +3. Activate it with mesecons (fastest way) +Be aware of the damage radius of 7 blocks! + +License: +WTFPL (see below) + +See also: +http://minetest.net/ + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/mods/tnt/depends.txt b/mods/tnt/depends.txt new file mode 100644 index 00000000..70715c7b --- /dev/null +++ b/mods/tnt/depends.txt @@ -0,0 +1,2 @@ +default +fire diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua new file mode 100644 index 00000000..5f33cf8d --- /dev/null +++ b/mods/tnt/init.lua @@ -0,0 +1,280 @@ +local destroy = function(pos) + if math.random(1,5) <= 4 then + minetest.env:add_entity({x=pos.x+math.random(0,10)/10-0.5, y=pos.y, z=pos.z+math.random(0,10)/10-0.5}, "tnt:smoke") + end + local nodename = minetest.env:get_node(pos).name + if nodename ~= "air" then + minetest.env:remove_node(pos) + if minetest.registered_nodes[nodename].groups.flammable ~= nil then + minetest.env:set_node(pos, {name="fire:basic_flame"}) + return + end + local drop = minetest.get_node_drops(nodename, "") + for _,item in ipairs(drop) do + if type(item) == "string" then + local obj = minetest.env:add_item(pos, item) + if obj == nil then + return + end + obj:get_luaentity().collect = true + obj:setacceleration({x=0, y=-10, z=0}) + obj:setvelocity({x=math.random(0,6)-3, y=10, z=math.random(0,6)-3}) + else + for i=1,item:get_count() do + local obj = minetest.env:add_item(pos, item:get_name()) + if obj == nil then + return + end + obj:get_luaentity().collect = true + obj:setacceleration({x=0, y=-10, z=0}) + obj:setvelocity({x=math.random(0,6)-3, y=10, z=math.random(0,6)-3}) + end + end + end + end +end + +boom = function(pos, time) + minetest.after(time, function(pos) + if minetest.env:get_node(pos).name ~= "tnt:tnt_burning" then + return + end + minetest.sound_play("tnt_explode", {pos=pos, gain=1.5, max_hear_distance=2*64}) + minetest.env:set_node(pos, {name="tnt:boom"}) + minetest.after(0.5, function(pos) + minetest.env:remove_node(pos) + end, {x=pos.x, y=pos.y, z=pos.z}) + + local objects = minetest.env:get_objects_inside_radius(pos, 7) + for _,obj in ipairs(objects) do + if obj:is_player() or obj:get_luaentity().name ~= "__builtin:item" then + local obj_p = obj:getpos() + local vec = {x=obj_p.x-pos.x, y=obj_p.y-pos.y, z=obj_p.z-pos.z} + local dist = (vec.x^2+vec.y^2+vec.z^2)^0.5 + local damage = (80*0.5^dist)*2 + obj:set_hp(obj:get_hp()-damage) + --[[obj:punch(obj, 1.0, { FIXME + full_punch_interval=1.0, + groupcaps={ + fleshy={times={[1]=1/damage, [2]=1/damage, [3]=1/damage}}, + snappy={times={[1]=1/damage, [2]=1/damage, [3]=1/damage}}, + } + }, nil)]] + end + end + + for dx=-2,2 do + for dz=-2,2 do + for dy=-2,2 do + pos.x = pos.x+dx + pos.y = pos.y+dy + pos.z = pos.z+dz + + local node = minetest.env:get_node(pos) + if node.name == "tnt:tnt" or node.name == "tnt:tnt_burning" then + minetest.env:set_node(pos, {name="tnt:tnt_burning"}) + boom({x=pos.x, y=pos.y, z=pos.z}, 0) + elseif node.name == "fire:basic_flame" or string.find(node.name, "default:water_") or string.find(node.name, "default:lava_") or node.name == "tnt:boom" then + + else + if math.abs(dx)<2 and math.abs(dy)<2 and math.abs(dz)<2 then + destroy(pos) + else + if math.random(1,5) <= 4 then + destroy(pos) + end + end + end + + pos.x = pos.x-dx + pos.y = pos.y-dy + pos.z = pos.z-dz + end + end + end + end, pos) +end + +minetest.register_node("tnt:tnt", { + description = "TNT", + tiles = {"tnt_top.png", "tnt_bottom.png", "tnt_side.png"}, + groups = {dig_immediate=2, mesecon=2}, + sounds = default.node_sound_wood_defaults(), + + on_punch = function(pos, node, puncher) + if puncher:get_wielded_item():get_name() == "default:torch" then + minetest.sound_play("tnt_ignite", {pos=pos}) + minetest.env:set_node(pos, {name="tnt:tnt_burning"}) + boom(pos, 4) + end + end, +}) + +minetest.register_node("tnt:tnt_burning", { + --tiles = {"tnt_top_burning.png", "tnt_bottom.png", "tnt_side.png"}, + tiles = {{name="tnt_top_burning_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1}}, "tnt_bottom.png", "tnt_side.png"}, + light_source = 5, + drop = "", + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("tnt:boom", { + drawtype = "plantlike", + tiles = {"tnt_boom.png"}, + light_source = LIGHT_MAX, + walkable = false, +}) + +burn = function(pos) + if minetest.env:get_node(pos).name == "tnt:tnt" then + minetest.sound_play("tnt_ignite", {pos=pos}) + minetest.env:set_node(pos, {name="tnt:tnt_burning"}) + boom(pos, 1) + return + end + if minetest.env:get_node(pos).name ~= "tnt:gunpowder" then + return + end + minetest.sound_play("tnt_gunpowder_burning", {pos=pos, gain=2}) + minetest.env:set_node(pos, {name="tnt:gunpowder_burning"}) + + minetest.after(1, function(pos) + if minetest.env:get_node(pos).name ~= "tnt:gunpowder_burning" then + return + end + minetest.after(0.5, function(pos) + minetest.env:remove_node(pos) + end, {x=pos.x, y=pos.y, z=pos.z}) + for dx=-1,1 do + for dz=-1,1 do + for dy=-1,1 do + pos.x = pos.x+dx + pos.y = pos.y+dy + pos.z = pos.z+dz + + if not (math.abs(dx) == 1 and math.abs(dz) == 1) then + if dy == 0 then + burn({x=pos.x, y=pos.y, z=pos.z}) + else + if math.abs(dx) == 1 or math.abs(dz) == 1 then + burn({x=pos.x, y=pos.y, z=pos.z}) + end + end + end + + pos.x = pos.x-dx + pos.y = pos.y-dy + pos.z = pos.z-dz + end + end + end + end, pos) +end + +minetest.register_node("tnt:gunpowder", { + description = "Gun Powder", + drawtype = "raillike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + tiles = {"tnt_gunpowder.png",}, + inventory_image = "tnt_gunpowder_inventory.png", + wield_image = "tnt_gunpowder_inventory.png", + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + groups = {dig_immediate=2}, + sounds = default.node_sound_leaves_defaults(), + + on_punch = function(pos, node, puncher) + if puncher:get_wielded_item():get_name() == "default:torch" then + burn(pos) + end + end, +}) + +minetest.register_node("tnt:gunpowder_burning", { + drawtype = "raillike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + light_source = 5, + --tiles = {"tnt_gunpowder_burning.png"}, + tiles = {{name="tnt_gunpowder_burning_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1}}}, + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + drop = "", + groups = {dig_immediate=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_abm({ + nodenames = {"tnt:tnt", "tnt:gunpowder"}, + neighbors = {"fire:basic_flame"}, + interval = 2, + chance = 10, + action = function(pos, node) + if node.name == "tnt:tnt" then + minetest.env:set_node(pos, {name="tnt:tnt_burning"}) + boom({x=pos.x, y=pos.y, z=pos.z}, 0) + else + burn(pos) + end + end +}) + +minetest.register_craft({ + output = "tnt:gunpowder", + type = "shapeless", + recipe = {"default:coal_lump", "default:gravel"} +}) + +minetest.register_craft({ + output = "tnt:tnt", + recipe = { + {"", "default:wood", ""}, + {"default:wood", "tnt:gunpowder", "default:wood"}, + {"", "default:wood", ""} + } +}) + +minetest.register_entity("tnt:smoke", { + physical = true, + visual = "sprite", + textures = {"tnt_smoke.png"}, + collisionbox = {0,0,0,0,0,0}, + + timer = 0, + time = 5, + + on_activate = function(self, staticdata) + self.object:setacceleration({x=math.random(0,10)/10-0.5, y=5, z=math.random(0,10)/10-0.5}) + self.time = math.random(1, 10)/10 + end, + + on_step = function(self, dtime) + self.timer = self.timer+dtime + if self.timer > self.time then + self.object:remove() + end + end, +}) + +if minetest.get_modpath("mesecons") ~= nil then + minetest.after(0, function() + + --mesecon:add_rules("tnt_above", {{x=0,y=1,z=0}}) FIXME + mesecon:register_effector("tnt:tnt", "tnt:tnt") --, mesecon:get_rules("tnt_above")) + + mesecon:register_on_signal_on(function(pos, node) + if node.name == "tnt:tnt" then + minetest.env:set_node(pos, {name="tnt:tnt_burning"}) + boom(pos, 0) + end + end) + + end) +end diff --git a/mods/tnt/sounds/tnt_explode.ogg b/mods/tnt/sounds/tnt_explode.ogg new file mode 100644 index 00000000..a414ea04 Binary files /dev/null and b/mods/tnt/sounds/tnt_explode.ogg differ diff --git a/mods/tnt/sounds/tnt_gunpowder_burning.ogg b/mods/tnt/sounds/tnt_gunpowder_burning.ogg new file mode 100644 index 00000000..5c5bfaf2 Binary files /dev/null and b/mods/tnt/sounds/tnt_gunpowder_burning.ogg differ diff --git a/mods/tnt/sounds/tnt_ignite.ogg b/mods/tnt/sounds/tnt_ignite.ogg new file mode 100644 index 00000000..199f2067 Binary files /dev/null and b/mods/tnt/sounds/tnt_ignite.ogg differ diff --git a/mods/tnt/textures/tnt_boom.png b/mods/tnt/textures/tnt_boom.png new file mode 100644 index 00000000..55887233 Binary files /dev/null and b/mods/tnt/textures/tnt_boom.png differ diff --git a/mods/tnt/textures/tnt_bottom.png b/mods/tnt/textures/tnt_bottom.png new file mode 100644 index 00000000..68e1b1ca Binary files /dev/null and b/mods/tnt/textures/tnt_bottom.png differ diff --git a/mods/tnt/textures/tnt_gunpowder.png b/mods/tnt/textures/tnt_gunpowder.png new file mode 100644 index 00000000..53c28156 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning.png b/mods/tnt/textures/tnt_gunpowder_burning.png new file mode 100644 index 00000000..080a8a45 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_animated.png new file mode 100644 index 00000000..e5a3404c Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning_animated.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_inventory.png b/mods/tnt/textures/tnt_gunpowder_inventory.png new file mode 100644 index 00000000..4e593fca Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_inventory.png differ diff --git a/mods/tnt/textures/tnt_side.png b/mods/tnt/textures/tnt_side.png new file mode 100644 index 00000000..a243c9d8 Binary files /dev/null and b/mods/tnt/textures/tnt_side.png differ diff --git a/mods/tnt/textures/tnt_smoke.png b/mods/tnt/textures/tnt_smoke.png new file mode 100644 index 00000000..6c07c300 Binary files /dev/null and b/mods/tnt/textures/tnt_smoke.png differ diff --git a/mods/tnt/textures/tnt_top.png b/mods/tnt/textures/tnt_top.png new file mode 100644 index 00000000..e63de0eb Binary files /dev/null and b/mods/tnt/textures/tnt_top.png differ diff --git a/mods/tnt/textures/tnt_top_burning.png b/mods/tnt/textures/tnt_top_burning.png new file mode 100644 index 00000000..04e39a2c Binary files /dev/null and b/mods/tnt/textures/tnt_top_burning.png differ diff --git a/mods/tnt/textures/tnt_top_burning_animated.png b/mods/tnt/textures/tnt_top_burning_animated.png new file mode 100644 index 00000000..c8afd475 Binary files /dev/null and b/mods/tnt/textures/tnt_top_burning_animated.png differ