Restructure default; migrate farming and wool

master
BlockMen 2014-01-06 13:41:34 +01:00
parent 55d39942b1
commit 84056a4118
83 changed files with 1045 additions and 1206 deletions

View File

@ -12,9 +12,12 @@ the Free Software Foundation; either version 2.1 of the License, or
http://www.gnu.org/licenses/lgpl-2.1.html
PilzAdam (WTFPL):
most parts of farming code
- intweak.lua
- torches.lua
BlockMen (WTFPL):
torches.lua
intweak.lua
Copyright (C) 2013 BlockMen, WTFPL
@ -34,99 +37,47 @@ Originating from work by kddekadenz/Dogers:
default_dig_crumbly.{1,2}.ogg
Cisoun's WTFPL texture pack:
default_chest_front.png
default_chest_lock.png
default_chest_side.png
default_chest_top.png
default_stone_brick.png
default_dirt.png
default_grass.png
default_grass_side.png
default_jungletree.png
default_jungletree_top.png
default_lava.png
default_leaves.png
default_sapling.png
default_sign_wall.png
default_stone.png
default_tool_mesepick.png
default_tool_steelpick.png
default_tool_steelshovel.png
default_tool_stonepick.png
default_tool_stoneshovel.png
default_tool_woodpick.png
default_tool_woodshovel.png
default_tree.png
default_tree_top.png
default_water.png, modified by BlockMen
Originating from G4JC's Almost MC Texture Pack:
default_wood.png
default_torch_on_ceiling.png
default_torch_on_floor.png
default_cobble.png
VanessaE's animated torches (WTFPL):
default_torch_animated.png
default_torch_on_ceiling_animated.png
default_torch_on_floor_animated.png
default_torch_on_floor.png
RealBadAngel's animated water (WTFPL):
default_water_source_animated.png, modified by BlockMen
default_water_flowing_animated.png, modified by BlockMen
default_wool_*.png
VanessaE (WTFPL):
default_nc_back.png
default_nc_front.png
default_nc_rb.png
default_nc_side.png
default_grass_*.png, modified by BlockMen
default_desert_sand.png
default_desert_stone.png
default_desert_stone_brick.png
default_sand.png
default_sandstone_brick.png
default_flour.png
default_cotton_1.png
default_cotton_2.png
default_cotton_3.png
default_cotton_4.png
default_cotton_5.png
default_cotton_6.png
default_cotton_7.png
default_cotton_8.png
Calinou (CC BY-SA):
default_brick.png
default_clay_brick.png
default_papyrus.png, modified by BlockMen
default_tool_steelsword.png
default_bronze_ingot.png
default_copper_ingot.png
default_copper_lump.png
default_mineral_copper.png
philipbenr (GPLv3):
default_brick.png
MirceaKitsune (WTFPL):
character.x
Jordach (CC BY-SA 3.0):
character.png, modified by BlockMen
PilzAdam (WTFPL):
default_jungleleaves.png
default_junglesapling.png
default_junglewood.png
default_obsidian_glass.png
default_obsidian_shard.png
default_mossycobble.png
default_gold_ingot.png
default_gold_lump.png
default_mineral_gold.png
default_diamond.png
default_tool_diamondpick.png
default_tool_diamondsword.png
default_tool_diamondshovel.png
default_tool_diamondaxe.png
default_tool_meseaxe.png
default_tool_meseshovel.png
default_tool_mesesword.png
default_tool_bronzeaxe.png
default_tool_bronzepick.png
default_tool_bronzeshovel.png
default_tool_bronzesword.png
default_snowball.png
default_string.png
default_bread.png
jojoa1997 (WTFPL):
default_obsidian.png
@ -136,40 +87,80 @@ InfinityProject (WTFPL):
Splizard (CC BY-SA 3.0):
default_snow.png
default_snow_side.png
Zeg9 (CC BY-SA 3.0):
default_coal_block.png
default_steel_block.png
default_copper_block.png
default_bronze_block.png
default_gold_block.png
default_diamond_block.png
BlockMen (CC-BY 3.0):
character.png (based on Jordach's texture)
character.png (based on Jordach's texture)[CC-BY-SA 3.0]
default_tool_*.png
door_steel_*.png
default_cobble.png
default_mossycobble.png
default_charcoal.png
default_hardened_clay.png
default_cactus_side.png (based on default texture)
default_cactus_top.png (based on default texture)
default_fire1.png
default_fire2.png
default_ice.png
default_glass.png
default_chest_front.png
default_chest_lock.png
default_chest_side.png
default_chest_top.png
default_mese_crystal.png
default_mese_mineral.png
default_lava_particle.png
default_torch.png
default_side.png
default_water.png (based on default texture)
default_water_flowing_animated.png (based on default texture)
default_water_source_animated.png (based on default texture)
default_papyrus.png (based on Calinou's texture)
default_grass.png (based on default texture)
default_grass_1.png (based on default texture)
default_grass_2.png (based on default texture)
default_grass_3.png (based on default texture)
default_grass_4.png (based on default texture)
default_grass_5.png (based on default texture)
default_grass_side.png (based on default texture)
default_fire1.png
default_fire2.png
default_ice.png
default_stone_brick.png
default_cobble.png
default_desert_stone.png
default_desert_stone_brick.png
default_sand.png
default_sandstone.png
default_sandstone_brick.png
default_jungleleaves.png
default_steel_ingot.png
default_gold_ingot.png
default_bronze_ingot.png
default_copper_ingot.png
default_mossycobble.png
default_gold_lump.png
default_diamond.png
default_diamond_block.png
default_soil.png
default_soil_wet.png
default_soil_wet_side.png
default_wheat*.png
default_cotton_seed.png
default_papyrus.png (based on Calinou's texture)[CC-BY-SA]
default_cactus_side.png (based on default texture)
default_cactus_top.png (based on default texture)
default_water_flowing_animated.png (based on RealBadAngel's texture)
default_water_source_animated.png (based on RealBadAngel's texture)
default_mineral_diamond.png (based on InfinityProject's texture)
default_clay_brick.png (based on Cisoun's texture)[CC-BY-SA]
default_gold_block.png (based on Zeg9's texture)[CC-BY-SA 3.0]
default_steel_block.png (based on Zeg9's texture)[CC-BY-SA 3.0]
default_copper_block.png (based on Zeg9's texture)[CC-BY-SA 3.0]
default_bronze_block.png (based on Zeg9's texture)[CC-BY-SA 3.0]
default_wood.png (based on G4JC's texture)
default_stick.png (based on celeron55's texture) [CC BY-SA 3.0]
default_gravel.png (based on celeron55's texture) [CC BY-SA 3.0]
default_glass.png (based on celeron55's texture) [CC BY-SA 3.0]
default_sapling.png (based on Gambit's texture)
default_dirt.png (unknown author)
default_grass.png (based on Cisoun's texture)
default_grass_side.png (based on Cisoun's texture)
default_snow_side.png
default_jungletree.png (based on Cisoun's texture)
default_jungletree_top.png
default_leaves.png (based on Cisoun's texture)
default_tree.png (based on Cisoun's texture)
default_grass_*.png (based VanessaE's texture)
default_lava_flowing_animated.png (based on Cisoun's texture)
default_lava_source_animated.png (based on Cisoun's texture)
default_water.png (based on Cisoun's texture)
default_lava.png (based on Cisoun's texture)
default_copper_lump.png (based on Calinou's texture)
License of sounds
---------------------

View File

@ -46,6 +46,10 @@ minetest.register_craft({
}
})
--
-- Tools
--
minetest.register_craft({
output = 'default:pick_wood',
recipe = {
@ -262,6 +266,62 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = "default:hoe_wood",
recipe = {
{"group:wood", "group:wood"},
{"", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft({
output = "default:hoe_stone",
recipe = {
{"group:stone", "group:stone"},
{"", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft({
output = "default:hoe_steel",
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft({
output = "default:hoe_bronze",
recipe = {
{"default:bronze_ingot", "default:bronze_ingot"},
{"", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft({
output = "default:hoe_mese",
recipe = {
{"default:mese_crystal", "default:mese_crystal"},
{"", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft({
output = "default:hoe_diamond",
recipe = {
{"default:diamond", "default:diamond"},
{"", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft({
output = 'default:rail 15',
recipe = {
@ -551,6 +611,20 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = "wool:white",
recipe = {
{"default:string", "default:string"},
{"default:string", "default:string"},
}
})
minetest.register_craft({
type = "shapeless",
output = "default:flour",
recipe = {"default:wheat", "default:wheat", "default:wheat", "default:wheat"}
})
--
-- Crafting (tool repair)
--
@ -611,6 +685,13 @@ minetest.register_craft({
recipe = "default:clay_lump",
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "default:bread",
recipe = "default:flour"
})
--
-- Fuels
--

View File

@ -97,3 +97,35 @@ minetest.register_craftitem("default:obsidian_shard", {
description = "Obsidian Shard",
inventory_image = "default_obsidian_shard.png",
})
minetest.register_craftitem("default:seed_wheat", {
description = "Wheat Seed",
inventory_image = "default_wheat_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return default.place_seed(itemstack, placer, pointed_thing, "default:wheat_1")
end,
})
minetest.register_craftitem("default:wheat", {
description = "Wheat",
inventory_image = "default_wheat.png",
})
minetest.register_craftitem("default:flour", {
description = "Flour",
inventory_image = "default_flour.png",
})
minetest.register_craftitem("default:seed_cotton", {
description = "Cotton Seed",
inventory_image = "default_cotton_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return default.place_seed(itemstack, placer, pointed_thing, "default:cotton_1")
end,
})
minetest.register_craftitem("default:string", {
description = "String",
inventory_image = "default_string.png",
})

28
mods/default/food.lua Normal file
View File

@ -0,0 +1,28 @@
minetest.register_node("default:apple", {
description = "Apple",
drawtype = "plantlike",
visual_scale = 0.8,
tiles = {"default_apple.png"},
inventory_image = "default_apple.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
on_use = minetest.item_eat(1),
sounds = default.node_sound_defaults(),
after_place_node = function(pos, placer, itemstack)
if placer:is_player() then
minetest.set_node(pos, {name="default:apple", param2=1})
end
end,
})
minetest.register_craftitem("default:bread", {
description = "Bread",
inventory_image = "default_bread.png",
on_use = minetest.item_eat(4),
})

View File

@ -1,80 +1,5 @@
-- mods/default/functions.lua
--
-- Sounds
--
function default.node_sound_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="", gain=1.0}
table.dug = table.dug or
{name="default_dug_node", gain=1.0}
table.place = table.place or
{name="default_place_node", gain=0.5}
return table
end
function default.node_sound_stone_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="default_hard_footstep", gain=0.2}
default.node_sound_defaults(table)
return table
end
function default.node_sound_dirt_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="", gain=0.5}
--table.dug = table.dug or
-- {name="default_dirt_break", gain=0.5}
default.node_sound_defaults(table)
return table
end
function default.node_sound_sand_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="default_grass_footstep", gain=0.25}
--table.dug = table.dug or
-- {name="default_dirt_break", gain=0.25}
table.dug = table.dug or
{name="default_grass_footstep.2", gain=0.25}
default.node_sound_defaults(table)
return table
end
function default.node_sound_wood_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="default_hard_footstep", gain=0.3}
default.node_sound_defaults(table)
return table
end
function default.node_sound_leaves_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="default_grass_footstep", gain=0.25}
table.dig = table.dig or
{name="default_dig_crumbly", gain=0.4}
table.dug = table.dug or
{name="", gain=1.0}
default.node_sound_defaults(table)
return table
end
function default.node_sound_glass_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="default_hard_footstep", gain=0.25}
table.dug = table.dug or
{name="default_break_glass", gain=1.0}
default.node_sound_defaults(table)
return table
end
--
-- Legacy
--
@ -118,29 +43,10 @@ function on_punchnode(p, node)
end
minetest.register_on_punchnode(on_punchnode)
--
-- Default grass+dirt abms
--
minetest.register_abm({
nodenames = {"default:dirt"},
interval = 2,
chance = 200,
action = function(pos, node)
local above = {x=pos.x, y=pos.y+1, z=pos.z}
local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name]
if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light")
and nodedef.liquidtype == "none"
and ((minetest.get_node_light(above) or 0) >= 13) then
if name == "default:snow" or name == "default:snowblock" then
minetest.set_node(pos, {name = "default:dirt_with_snow"})
else
minetest.set_node(pos, {name = "default:dirt_with_grass"})
end
end
end
})
--
-- Remove grass
--
minetest.register_abm({
nodenames = {"default:dirt_with_grass"},
@ -158,47 +64,7 @@ minetest.register_abm({
end
})
--
-- Grow trees
--
minetest.register_abm({
nodenames = {"default:sapling"},
interval = 10,
chance = 50,
action = function(pos, node)
local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil
if is_soil == nil or is_soil == 0 then return end
print("A sapling grows into a tree at "..minetest.pos_to_string(pos))
local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
local data = vm:get_data()
default.grow_tree(data, a, pos, math.random(1, 4) == 1, math.random(1,100000))
vm:set_data(data)
vm:write_to_map(data)
vm:update_map()
end
})
minetest.register_abm({
nodenames = {"default:junglesapling"},
interval = 10,
chance = 50,
action = function(pos, node)
local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil
if is_soil == nil or is_soil == 0 then return end
print("A jungle sapling grows into a tree at "..minetest.pos_to_string(pos))
local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y-1, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
local data = vm:get_data()
default.grow_jungletree(data, a, pos, math.random(1,100000))
vm:set_data(data)
vm:write_to_map(data)
vm:update_map()
end
})
--
-- Lavacooling
@ -234,60 +100,6 @@ minetest.register_abm({
end,
})
--
-- Papyrus and cactus growing
--
minetest.register_abm({
nodenames = {"default:cactus"},
neighbors = {"group:sand"},
interval = 50,
chance = 20,
action = function(pos, node)
pos.y = pos.y-1
local name = minetest.get_node(pos).name
if minetest.get_item_group(name, "sand") ~= 0 then
pos.y = pos.y+1
local height = 0
while minetest.get_node(pos).name == "default:cactus" and height < 4 do
height = height+1
pos.y = pos.y+1
end
if height < 4 then
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, {name="default:cactus"})
end
end
end
end,
})
minetest.register_abm({
nodenames = {"default:papyrus"},
neighbors = {"default:dirt", "default:dirt_with_grass"},
interval = 50,
chance = 20,
action = function(pos, node)
pos.y = pos.y-1
local name = minetest.get_node(pos).name
if name == "default:dirt" or name == "default:dirt_with_grass" then
if minetest.find_node_near(pos, 3, {"group:water"}) == nil then
return
end
pos.y = pos.y+1
local height = 0
while minetest.get_node(pos).name == "default:papyrus" and height < 4 do
height = height+1
pos.y = pos.y+1
end
if height < 4 then
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, {name="default:papyrus"})
end
end
end
end,
})
--
-- Leafdecay
@ -402,34 +214,6 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode)
end
end)
--
-- Lava particles and Lava sound
--
minetest.register_abm({
nodenames = {"default:lava_source"},
interval = 2,
chance = 2,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.sound_play("default_lava", {pos = pos, gain = 0.05, max_hear_distance = 1.5})
if math.random(1,13) == 8 then
local rnd = math.random(0,1)*-1
minetest.add_particle(pos, {x=0.1*rnd, y=0.8, z=-0.1*rnd}, {x=-0.5*rnd, y=0.2, z=0.5*rnd}, 1.7,
1.2, true, "default_lava_particle.png")
end
end})
--
-- Flowing water sound
--
minetest.register_abm({
nodenames = {"default:water_flowing"},
interval = 1.8,
chance = 1.5,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.sound_play("default_water", {pos = pos, gain = 0.025, max_hear_distance = 2})
end})
--
-- Cactus damage players
@ -452,6 +236,7 @@ end})
local null = {x=0, y=0, z=0}
--fire_particles
function default.add_fire(pos, scale)
if scale == nil then scale = 1 end
@ -476,3 +261,134 @@ function default.facedir_to_dir(int)
return nil
end
end
--
-- Place seeds
--
function default.place_seed(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
-- check if pointing at a node
if not pt then
return
end
if pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
local above = minetest.get_node(pt.above)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[above.name] then
return
end
-- check if pointing at the top of the node
if pt.above.y ~= pt.under.y+1 then
return
end
-- check if you can replace the node above the pointed node
if not minetest.registered_nodes[above.name].buildable_to then
return
end
-- check if pointing at soil
if minetest.get_item_group(under.name, "soil") <= 1 then
return
end
-- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name=plantname})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
-- turns nodes with group soil=1 into soil
function default.hoe_on_use(itemstack, user, pointed_thing, uses)
local pt = pointed_thing
-- check if pointing at a node
if not pt then
return
end
if pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
local above = minetest.get_node(p)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[above.name] then
return
end
-- check if the node above the pointed thing is air
if above.name ~= "air" then
return
end
-- check if pointing at dirt
if minetest.get_item_group(under.name, "soil") ~= 1 then
return
end
-- turn the node into soil, wear out item and play sound
minetest.set_node(pt.under, {name="default:soil"})
minetest.sound_play("default_dig_crumbly", {
pos = pt.under,
gain = 0.5,
})
itemstack:add_wear(65535/(uses-1))
return itemstack
end
--
-- Soil
--
minetest.register_abm({
nodenames = {"default:soil", "default:soil_wet"},
interval = 15,
chance = 4,
action = function(pos, node)
pos.y = pos.y+1
local nn = minetest.get_node(pos).name
pos.y = pos.y-1
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].walkable and
minetest.get_item_group(nn, "plant") == 0
then
minetest.set_node(pos, {name="default:dirt"})
end
-- check if there is water nearby
if minetest.find_node_near(pos, 3, {"group:water"}) then
-- if it is dry soil turn it into wet soil
if node.name == "default:soil" then
minetest.set_node(pos, {name="default:soil_wet"})
end
else
-- turn it back into dirt if it is already dry
if node.name == "default:soil" then
-- only turn it back if there is no plant on top of it
if minetest.get_item_group(nn, "plant") == 0 then
minetest.set_node(pos, {name="default:dirt"})
end
-- if its wet turn it back into dry soil
elseif node.name == "default:soil_wet" then
minetest.set_node(pos, {name="default:soil"})
end
end
end,
})

194
mods/default/growing.lua Normal file
View File

@ -0,0 +1,194 @@
--
-- Grow grass
--
minetest.register_abm({
nodenames = {"default:dirt"},
interval = 2,
chance = 200,
action = function(pos, node)
local above = {x=pos.x, y=pos.y+1, z=pos.z}
local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name]
if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light")
and nodedef.liquidtype == "none"
and ((minetest.get_node_light(above) or 0) >= 13) then
if name == "default:snow" or name == "default:snowblock" then
minetest.set_node(pos, {name = "default:dirt_with_snow"})
else
minetest.set_node(pos, {name = "default:dirt_with_grass"})
end
end
end
})
--
-- Grow trees
--
minetest.register_abm({
nodenames = {"default:sapling"},
interval = 10,
chance = 50,
action = function(pos, node)
local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil
if is_soil == nil or is_soil == 0 then return end
print("A sapling grows into a tree at "..minetest.pos_to_string(pos))
local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
local data = vm:get_data()
default.grow_tree(data, a, pos, math.random(1, 4) == 1, math.random(1,100000))
vm:set_data(data)
vm:write_to_map(data)
vm:update_map()
end
})
minetest.register_abm({
nodenames = {"default:junglesapling"},
interval = 10,
chance = 50,
action = function(pos, node)
local is_soil = minetest.registered_nodes[minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name].groups.soil
if is_soil == nil or is_soil == 0 then return end
print("A jungle sapling grows into a tree at "..minetest.pos_to_string(pos))
local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y-1, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
local data = vm:get_data()
default.grow_jungletree(data, a, pos, math.random(1,100000))
vm:set_data(data)
vm:write_to_map(data)
vm:update_map()
end
})
--
-- Papyrus and cactus growing
--
minetest.register_abm({
nodenames = {"default:cactus"},
neighbors = {"group:sand"},
interval = 50,
chance = 20,
action = function(pos, node)
pos.y = pos.y-1
local name = minetest.get_node(pos).name
if minetest.get_item_group(name, "sand") ~= 0 then
pos.y = pos.y+1
local height = 0
while minetest.get_node(pos).name == "default:cactus" and height < 4 do
height = height+1
pos.y = pos.y+1
end
if height < 4 then
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, {name="default:cactus"})
end
end
end
end,
})
minetest.register_abm({
nodenames = {"default:papyrus"},
neighbors = {"default:dirt", "default:dirt_with_grass"},
interval = 50,
chance = 20,
action = function(pos, node)
pos.y = pos.y-1
local name = minetest.get_node(pos).name
if name == "default:dirt" or name == "default:dirt_with_grass" then
if minetest.find_node_near(pos, 3, {"group:water"}) == nil then
return
end
pos.y = pos.y+1
local height = 0
while minetest.get_node(pos).name == "default:papyrus" and height < 4 do
height = height+1
pos.y = pos.y+1
end
if height < 4 then
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, {name="default:papyrus"})
end
end
end
end,
})
--
-- Wheat
--
minetest.register_abm({
nodenames = {"group:wheat"},
neighbors = {"group:soil"},
interval = 90,
chance = 2,
action = function(pos, node)
-- return if already full grown
if minetest.get_item_group(node.name, "wheat") == 8 then
return
end
-- check if on wet soil
pos.y = pos.y-1
local n = minetest.get_node(pos)
if minetest.get_item_group(n.name, "soil") < 3 then
return
end
pos.y = pos.y+1
-- check light
if not minetest.get_node_light(pos) then
return
end
if minetest.get_node_light(pos) < 13 then
return
end
-- grow
local height = minetest.get_item_group(node.name, "wheat") + 1
minetest.set_node(pos, {name="default:wheat_"..height})
end
})
--
-- Cotton
--
minetest.register_abm({
nodenames = {"group:cotton"},
neighbors = {"group:soil"},
interval = 80,
chance = 2,
action = function(pos, node)
-- return if already full grown
if minetest.get_item_group(node.name, "cotton") == 8 then
return
end
-- check if on wet soil
pos.y = pos.y-1
local n = minetest.get_node(pos)
if minetest.get_item_group(n.name, "soil") < 3 then
return
end
pos.y = pos.y+1
-- check light
if not minetest.get_node_light(pos) then
return
end
if minetest.get_node_light(pos) < 13 then
return
end
-- grow
local height = minetest.get_item_group(node.name, "cotton") + 1
minetest.set_node(pos, {name="default:cotton_"..height})
end
})

View File

@ -13,8 +13,12 @@ default = {}
-- Load files
dofile(minetest.get_modpath("default").."/functions.lua")
dofile(minetest.get_modpath("default").."/sounds.lua")
dofile(minetest.get_modpath("default").."/nodes.lua")
dofile(minetest.get_modpath("default").."/plants.lua")
dofile(minetest.get_modpath("default").."/tools.lua")
dofile(minetest.get_modpath("default").."/food.lua")
dofile(minetest.get_modpath("default").."/growing.lua")
dofile(minetest.get_modpath("default").."/intweak.lua")
dofile(minetest.get_modpath("default").."/craftitems.lua")
dofile(minetest.get_modpath("default").."/crafting.lua")

View File

@ -131,6 +131,24 @@ minetest.register_node("default:dirt", {
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_node("default:soil", {
description = "Soil",
tiles = {"default_soil.png", "default_dirt.png"},
drop = "default:dirt",
is_ground_content = true,
groups = {crumbly=3, not_in_creative_inventory=1, soil=2},
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_node("default:soil_wet", {
description = "Wet Soil",
tiles = {"default_soil_wet.png", "default_soil_wet_side.png"},
drop = "default:dirt",
is_ground_content = true,
groups = {crumbly=3, not_in_creative_inventory=1, soil=3},
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_node("default:sand", {
description = "Sand",
tiles = {"default_sand.png"},
@ -302,51 +320,6 @@ minetest.register_node("default:leaves", {
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("default:cactus", {
description = "Cactus",
tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
is_ground_content = true,
groups = {snappy=1,choppy=3,flammable=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
drawtype = "nodebox",
paramtype = "light",
damage_per_second = 1,
node_box = {
type = "fixed",
fixed = {{-7/16, -0.5, -7/16, 7/16, 0.5, 7/16}, {-8/16, -0.5, -7/16, -7/16, 0.5, -7/16},
{7/16, -0.5, -7/16, 7/16, 0.5, -8/16},{-7/16, -0.5, 7/16, -7/16, 0.5, 8/16},{7/16, -0.5, 7/16, 8/16, 0.5, 7/16}}--
},
selection_box = {
type = "fixed",
fixed = {-7/16, -0.5, -7/16, 7/16, 0.5, 7/16},
},
on_punch = function(pos, node, puncher)
if not puncher then return end
if puncher:get_wielded_item():get_name() == "" then
minetest.sound_play("player_damage", {pos = pos, gain = 0.3, max_hear_distance = 10})
end
end,
})
minetest.register_node("default:papyrus", {
description = "Papyrus",
drawtype = "plantlike",
tiles = {"default_papyrus.png"},
inventory_image = "default_papyrus.png",
wield_image = "default_papyrus.png",
paramtype = "light",
walkable = false,
is_ground_content = true,
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {snappy=3,flammable=2},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("default:bookshelf", {
description = "Bookshelf",
tiles = {"default_wood.png", "default_wood.png", "default_bookshelf.png"},
@ -562,33 +535,6 @@ minetest.register_node("default:lava_source", {
groups = {lava=3, liquid=2, hot=3, igniter=1},
})
--[[minetest.register_node("default:torch", {
description = "Torch",
drawtype = "torchlike",
--tiles = {"default_torch_on_floor.png", "default_torch_on_ceiling.png", "default_torch.png"},
tiles = {
{name="default_torch_on_floor_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
{name="default_torch_on_ceiling_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
{name="default_torch_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
},
inventory_image = "default_torch_on_floor.png",
wield_image = "default_torch_on_floor.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
light_source = LIGHT_MAX-1,
selection_box = {
type = "wallmounted",
wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1},
wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
},
groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1},
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
})]]
minetest.register_node("default:sign_wall", {
description = "Sign",
drawtype = "signlike",
@ -947,18 +893,13 @@ minetest.register_node("default:furnace_active", {
end,
})
function hacky_swap_node(pos,name)
local function swap_node(pos,name)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local meta0 = meta:to_table()
if node.name == name then
return
end
node.name = name
local meta0 = meta:to_table()
minetest.set_node(pos,node)
meta = minetest.get_meta(pos)
meta:from_table(meta0)
minetest.swap_node(pos,node)
end
minetest.register_abm({
@ -1017,7 +958,7 @@ minetest.register_abm({
default.add_fire({x=pos.x+dpos.x, y=pos.y-0.52, z=pos.z+dpos.z}, 2-percent*0.01)--facedir auslesen
end
meta:set_string("infotext","Furnace active: "..percent.."%")
hacky_swap_node(pos,"default:furnace_active")
swap_node(pos,"default:furnace_active")
item_percent = meta:get_float("src_time")/cooked.time
meta:set_string("formspec",default.get_furnace_active_formspec(pos, percent, item_percent))
return
@ -1038,7 +979,7 @@ minetest.register_abm({
if fuel.time <= 0 then
meta:set_string("infotext","Furnace out of fuel")
hacky_swap_node(pos,"default:furnace")
swap_node(pos,"default:furnace")
meta:set_string("formspec", default.furnace_inactive_formspec)
return
end
@ -1046,7 +987,7 @@ minetest.register_abm({
if cooked.item:is_empty() then
if was_active then
meta:set_string("infotext","Furnace is empty")
hacky_swap_node(pos,"default:furnace")
swap_node(pos,"default:furnace")
meta:set_string("formspec", default.furnace_inactive_formspec)
end
return
@ -1185,157 +1126,16 @@ minetest.register_node("default:sapling", {
sounds = default.node_sound_defaults(),
})
minetest.register_node("default:apple", {
description = "Apple",
drawtype = "plantlike",
visual_scale = 0.8,
tiles = {"default_apple.png"},
inventory_image = "default_apple.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
on_use = minetest.item_eat(1),
sounds = default.node_sound_defaults(),
after_place_node = function(pos, placer, itemstack)
if placer:is_player() then
minetest.set_node(pos, {name="default:apple", param2=1})
end
end,
})
minetest.register_node("default:dry_shrub", {
description = "Dry Shrub",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"default_dry_shrub.png"},
inventory_image = "default_dry_shrub.png",
wield_image = "default_dry_shrub.png",
paramtype = "light",
walkable = false,
buildable_to = true,
drop = "",
groups = {snappy=3,flammable=3,attached_node=1,dig_immediate=3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
minetest.register_node("default:grass_1", {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_1.png"},
-- use a bigger inventory image
inventory_image = "default_grass_3.png",
wield_image = "default_grass_3.png",
paramtype = "light",
walkable = false,
buildable_to = true,
drop = "",
groups = {snappy=3,flammable=3,flora=1,attached_node=1,dig_immediate=3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
on_place = function(itemstack, placer, pointed_thing)
-- place a random grass node
local stack = ItemStack("default:grass_"..math.random(1,5))
local ret = minetest.item_place(stack, placer, pointed_thing)
return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count()))
end,
})
minetest.register_node("default:grass_2", {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_2.png"},
inventory_image = "default_grass_2.png",
wield_image = "default_grass_2.png",
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "",
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1,dig_immediate=3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
minetest.register_node("default:grass_3", {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_3.png"},
inventory_image = "default_grass_3.png",
wield_image = "default_grass_3.png",
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "",
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1,dig_immediate=3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
minetest.register_node("default:grass_4", {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_4.png"},
inventory_image = "default_grass_4.png",
wield_image = "default_grass_4.png",
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "",
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1,dig_immediate=3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
minetest.register_node("default:grass_5", {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_5.png"},
inventory_image = "default_grass_5.png",
wield_image = "default_grass_5.png",
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = "",
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1,dig_immediate=3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
minetest.register_node("default:ice", {
description = "Ice",
tiles = {"default_ice.png"},
is_ground_content = true,
use_texture_alpha = true,
--use_texture_alpha = true,
inventory_image = minetest.inventorycube("default_ice.png"),
drawtype = "glasslike",
paramtype = "light",
groups = {cracky=3},
--alpha = WATER_ALPHA,
sounds = default.node_sound_glass_defaults(),
})
@ -1384,3 +1184,43 @@ minetest.register_node("default:snowblock", {
footstep = {name="default_grass_footstep", gain=0.4},
}),
})
local dyes = {
{"white", "White", nil},
{"grey", "Grey", "basecolor_grey"},
{"black", "Black", "basecolor_black"},
{"red", "Red", "basecolor_red"},
{"yellow", "Yellow", "basecolor_yellow"},
{"green", "Green", "basecolor_green"},
{"cyan", "Cyan", "basecolor_cyan"},
{"blue", "Blue", "basecolor_blue"},
{"magenta", "Magenta", "basecolor_magenta"},
{"orange", "Orange", "excolor_orange"},
{"violet", "Violet", "excolor_violet"},
{"brown", "Brown", "unicolor_dark_orange"},
{"pink", "Pink", "unicolor_light_red"},
{"dark_grey", "Dark Grey", "unicolor_darkgrey"},
{"dark_green", "Dark Green", "unicolor_dark_green"},
}
for _, row in ipairs(dyes) do
local name = row[1]
local desc = row[2]
local craft_color_group = row[3]
-- Node Definition
minetest.register_node("default:wool_"..name, {
description = desc.." Wool",
tiles = {"default_wool_"..name..".png"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3,wool=1},
sounds = default.node_sound_defaults(),
})
minetest.register_alias("wool:"..name, "default:wool_"..name)
if craft_color_group then
-- Crafting from dye and white wool
minetest.register_craft({
type = "shapeless",
output = 'default:wool_'..name,
recipe = {'group:dye,'..craft_color_group, 'group:wool'},
})
end
end

228
mods/default/plants.lua Normal file
View File

@ -0,0 +1,228 @@
--
-- Papyrus and Cactus
--
minetest.register_node("default:cactus", {
description = "Cactus",
tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
is_ground_content = true,
groups = {snappy=1,choppy=3,flammable=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
drawtype = "nodebox",
paramtype = "light",
damage_per_second = 1,
node_box = {
type = "fixed",
fixed = {{-7/16, -0.5, -7/16, 7/16, 0.5, 7/16}, {-8/16, -0.5, -7/16, -7/16, 0.5, -7/16},
{7/16, -0.5, -7/16, 7/16, 0.5, -8/16},{-7/16, -0.5, 7/16, -7/16, 0.5, 8/16},{7/16, -0.5, 7/16, 8/16, 0.5, 7/16}}--
},
selection_box = {
type = "fixed",
fixed = {-7/16, -0.5, -7/16, 7/16, 0.5, 7/16},
},
on_punch = function(pos, node, puncher)
if not puncher then return end
if puncher:get_wielded_item():get_name() == "" then
minetest.sound_play("player_damage", {pos = pos, gain = 0.3, max_hear_distance = 10})
end
end,
})
minetest.register_node("default:papyrus", {
description = "Papyrus",
drawtype = "plantlike",
tiles = {"default_papyrus.png"},
inventory_image = "default_papyrus.png",
wield_image = "default_papyrus.png",
paramtype = "light",
walkable = false,
is_ground_content = true,
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {snappy=3,flammable=2},
sounds = default.node_sound_leaves_defaults(),
})
--
-- Grass
--
minetest.register_node("default:grass_1", {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_1.png"},
-- use a bigger inventory image
inventory_image = "default_grass_3.png",
wield_image = "default_grass_3.png",
paramtype = "light",
walkable = false,
buildable_to = true,
drop = {
max_items = 1,
items = {
{items = {'default:seed_wheat'},rarity = 5},
}
},
groups = {snappy=3,flammable=3,flora=1,attached_node=1,dig_immediate=3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
on_place = function(itemstack, placer, pointed_thing)
-- place a random grass node
local stack = ItemStack("default:grass_"..math.random(1,5))
local ret = minetest.item_place(stack, placer, pointed_thing)
return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count()))
end,
})
local wav = 0
for i=2,5 do
if i>2 then wav=1 end
minetest.register_node("default:grass_"..i, {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_"..i..".png"},
inventory_image = "default_grass_"..i..".png",
wield_image = "default_grass_"..i..".png",
paramtype = "light",
walkable = false,
buildable_to = true,
waving = wav,
is_ground_content = true,
drop = {
max_items = 1,
items = {
{items = {'default:seed_wheat'},rarity = 5},
}
},
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1,dig_immediate=3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.4, -0.5, -0.4, 0.4, -0.5+(2.5*i)/16, 0.4},
},
})
end
--
-- Junglegrass
--
minetest.register_node("default:junglegrass", {
description = "Jungle Grass",
drawtype = "plantlike",
visual_scale = 1.3,
tiles = {"default_junglegrass.png"},
inventory_image = "default_junglegrass.png",
wield_image = "default_junglegrass.png",
paramtype = "light",
walkable = false,
buildable_to = true,
waving = 1,
is_ground_content = true,
drop = {
max_items = 1,
items = {
{items = {'default:seed_cotton'},rarity = 8},
}
},
groups = {snappy=3,flammable=2,flora=1,attached_node=1,dig_immediate=3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
minetest.register_node("default:dry_shrub", {
description = "Dry Shrub",
drawtype = "plantlike",
visual_scale = 1.0,
tiles = {"default_dry_shrub.png"},
inventory_image = "default_dry_shrub.png",
wield_image = "default_dry_shrub.png",
paramtype = "light",
walkable = false,
buildable_to = true,
drop = "",
groups = {snappy=3,flammable=3,attached_node=1,dig_immediate=3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
--
-- Wheat
--
wav = 0
for i=1,8 do
if i>5 then wav=1 end
local drop = {
items = {
{items = {'default:wheat'},rarity=9-i},
{items = {'default:wheat'},rarity=18-i*2},
{items = {'default:seed_wheat'},rarity=9-i},
{items = {'default:seed_wheat'},rarity=18-i*2},
}
}
minetest.register_node("default:wheat_"..i, {
drawtype = "nodebox",
tiles = {"default_wheat_"..i..".png"},
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
waving = wav,
drop = drop,
node_box = {
type = "fixed",
fixed = {{-0.5, -0.5, 0.25, 0.5, -0.5+13/16, 0.25}, {-0.5, -0.5, -0.25, 0.5, -0.5+13/16, -0.25},
{0.25, -0.5, -0.5, 0.25, -0.5+13/16, 0.5}, {-0.25, -0.5, -0.5, -0.25, -0.5+13/16, 0.5}} --2 pro richtung
},
selection_box = {
type = "fixed",
fixed = {-0.4, -0.5, -0.4, 0.4, -0.5+(2*i)/16, 0.4},
},
groups = {snappy=3,flammable=2,plant=1,wheat=i,not_in_creative_inventory=1,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
})
end
--
-- Cotton
--
for i=1,8 do
local drop = {
items = {
{items = {'default:string'},rarity=9-i},
{items = {'default:string'},rarity=18-i*2},
{items = {'default:string'},rarity=27-i*3},
{items = {'default:seed_cotton'},rarity=9-i},
{items = {'default:seed_cotton'},rarity=18-i*2},
{items = {'default:seed_cotton'},rarity=27-i*3},
}
}
minetest.register_node("default:cotton_"..i, {
drawtype = "plantlike",
tiles = {"default_cotton_"..i..".png"},
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = drop,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
groups = {snappy=3,flammable=2,plant=1,cotton=i,not_in_creative_inventory=1,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
})
end

103
mods/default/sounds.lua Normal file
View File

@ -0,0 +1,103 @@
--
-- Sound tables
--
function default.node_sound_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="", gain=1.0}
table.dug = table.dug or
{name="default_dug_node", gain=1.0}
table.place = table.place or
{name="default_place_node", gain=0.5}
return table
end
function default.node_sound_stone_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="default_hard_footstep", gain=0.2}
default.node_sound_defaults(table)
return table
end
function default.node_sound_dirt_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="", gain=0.5}
--table.dug = table.dug or
-- {name="default_dirt_break", gain=0.5}
default.node_sound_defaults(table)
return table
end
function default.node_sound_sand_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="default_grass_footstep", gain=0.25}
--table.dug = table.dug or
-- {name="default_dirt_break", gain=0.25}
table.dug = table.dug or
{name="default_grass_footstep.2", gain=0.25}
default.node_sound_defaults(table)
return table
end
function default.node_sound_wood_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="default_hard_footstep", gain=0.3}
default.node_sound_defaults(table)
return table
end
function default.node_sound_leaves_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="default_grass_footstep", gain=0.25}
table.dig = table.dig or
{name="default_dig_crumbly", gain=0.4}
table.dug = table.dug or
{name="", gain=1.0}
default.node_sound_defaults(table)
return table
end
function default.node_sound_glass_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name="default_hard_footstep", gain=0.25}
table.dug = table.dug or
{name="default_break_glass", gain=1.0}
default.node_sound_defaults(table)
return table
end
--
-- Lava particles and Lava sound
--
minetest.register_abm({
nodenames = {"default:lava_source"},
interval = 2,
chance = 2,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.sound_play("default_lava", {pos = pos, gain = 0.05, max_hear_distance = 1.5})
if math.random(1,13) == 8 then
local rnd = math.random(0,1)*-1
minetest.add_particle(pos, {x=0.1*rnd, y=0.8, z=-0.1*rnd}, {x=-0.5*rnd, y=0.2, z=0.5*rnd}, 1.7,
1.2, true, "default_lava_particle.png")
end
end})
--
-- Flowing water sound
--
minetest.register_abm({
nodenames = {"default:water_flowing"},
interval = 1.8,
chance = 1.5,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.sound_play("default_water", {pos = pos, gain = 0.025, max_hear_distance = 2})
end})

View File

Before

Width:  |  Height:  |  Size: 552 B

After

Width:  |  Height:  |  Size: 552 B

View File

Before

Width:  |  Height:  |  Size: 136 B

After

Width:  |  Height:  |  Size: 136 B

View File

Before

Width:  |  Height:  |  Size: 161 B

After

Width:  |  Height:  |  Size: 161 B

View File

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 189 B

View File

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 220 B

View File

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 263 B

View File

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 342 B

View File

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 359 B

View File

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

View File

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

View File

Before

Width:  |  Height:  |  Size: 341 B

After

Width:  |  Height:  |  Size: 341 B

View File

Before

Width:  |  Height:  |  Size: 308 B

After

Width:  |  Height:  |  Size: 308 B

View File

Before

Width:  |  Height:  |  Size: 299 B

After

Width:  |  Height:  |  Size: 299 B

View File

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 277 B

View File

Before

Width:  |  Height:  |  Size: 278 B

After

Width:  |  Height:  |  Size: 278 B

View File

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 296 B

View File

Before

Width:  |  Height:  |  Size: 270 B

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -330,3 +330,61 @@ minetest.register_tool("default:sword_diamond", {
damage_groups = {fleshy=8},
}
})
--
-- Hoes
--
minetest.register_tool("default:hoe_wood", {
description = "Wooden Hoe",
inventory_image = "default_tool_woodhoe.png",
on_use = function(itemstack, user, pointed_thing)
return default.hoe_on_use(itemstack, user, pointed_thing, 30)
end,
})
minetest.register_tool("default:hoe_stone", {
description = "Stone Hoe",
inventory_image = "default_tool_stonehoe.png",
on_use = function(itemstack, user, pointed_thing)
return default.hoe_on_use(itemstack, user, pointed_thing, 90)
end,
})
minetest.register_tool("default:hoe_steel", {
description = "Steel Hoe",
inventory_image = "default_tool_steelhoe.png",
on_use = function(itemstack, user, pointed_thing)
return default.hoe_on_use(itemstack, user, pointed_thing, 200)
end,
})
minetest.register_tool("default:hoe_bronze", {
description = "Bronze Hoe",
inventory_image = "default_tool_bronzehoe.png",
on_use = function(itemstack, user, pointed_thing)
return default.hoe_on_use(itemstack, user, pointed_thing, 220)
end,
})
minetest.register_tool("default:hoe_mese", {
description = "Mese Hoe",
inventory_image = "default_tool_mesehoe.png",
on_use = function(itemstack, user, pointed_thing)
return default.hoe_on_use(itemstack, user, pointed_thing, 350)
end,
})
minetest.register_tool("default:hoe_diamond", {
description = "Diamond Hoe",
inventory_image = "default_tool_diamondhoe.png",
on_use = function(itemstack, user, pointed_thing)
return default.hoe_on_use(itemstack, user, pointed_thing, 500)
end,
})

View File

@ -22,3 +22,35 @@ minetest.register_alias("diamonds:shovel", "default:shovel_diamond")
minetest.register_alias("diamonds:axe", "default:axe_diamond")
minetest.register_alias("diamonds:diamond", "default:diamond")
minetest.register_alias("diamonds:ingot", "default:diamond")
-- Aliases for the farming mod by PilzAdam
minetest.register_alias("farming:soil", "default:soil")
minetest.register_alias("farming:soil_wet", "default:soil_wet")
minetest.register_alias("farming:wheat_1", "default:wheat_1")
minetest.register_alias("farming:wheat_2", "default:wheat_2")
minetest.register_alias("farming:wheat_3", "default:wheat_3")
minetest.register_alias("farming:wheat_4", "default:wheat_4")
minetest.register_alias("farming:wheat_5", "default:wheat_5")
minetest.register_alias("farming:wheat_6", "default:wheat_6")
minetest.register_alias("farming:wheat_7", "default:wheat_7")
minetest.register_alias("farming:wheat_8", "default:wheat_8")
minetest.register_alias("farming:cotton_1", "default:cotton_1")
minetest.register_alias("farming:cotton_2", "default:cotton_2")
minetest.register_alias("farming:cotton_3", "default:cotton_3")
minetest.register_alias("farming:cotton_4", "default:cotton_4")
minetest.register_alias("farming:cotton_5", "default:cotton_5")
minetest.register_alias("farming:cotton_6", "default:cotton_6")
minetest.register_alias("farming:cotton_7", "default:cotton_7")
minetest.register_alias("farming:cotton_8", "default:cotton_8")
minetest.register_alias("farming:seed_wheat", "default:seed_wheat")
minetest.register_alias("farming:wheat", "default:wheat")
minetest.register_alias("farming:flour", "default:flour")
minetest.register_alias("farming:bread", "default:bread")
minetest.register_alias("farming:seed_cotton", "default:seed_cotton")
minetest.register_alias("farming:string", "default:string")
minetest.register_alias("farming:hoe_wood", "default:hoe_wood")
minetest.register_alias("farming:hoe_stone", "default:hoe_stone")
minetest.register_alias("farming:hoe_steel", "default:hoe_steel")
minetest.register_alias("farming:hoe_bronze", "default:hoe_bronze")
minetest.register_alias("farming:hoe_mese", "default:hoe_mese")
minetest.register_alias("farming:hoe_diamond", "default:hoe_diamond")

View File

@ -1,57 +0,0 @@
Minetest 0.4 mod: farming
=========================
License of source code:
-----------------------
Copyright (C) 2012-2013 PilzAdam
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
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.
License of media (textures):
----------------------------
Created by PilzAdam (License: WTFPL):
farming_bread.png
farming_soil.png
farming_soil_wet.png
farming_soil_wet_side.png
farming_string.png
Created by Calinou (License: CC BY-SA):
farming_tool_bronzehoe.png
farming_tool_steelhoe.png
farming_tool_stonehoe.png
farming_tool_woodhoe.png
Created by VanessaE (License: WTFPL):
farming_cotton_seed.png
farming_wheat_seed.png
farming_flour.png
farming_wheat.png
farming_wheat_1.png
farming_wheat_2.png
farming_wheat_3.png
farming_wheat_4.png
farming_wheat_5.png
farming_wheat_5.png
farming_wheat_7.png
farming_wheat_8.png
farming_cotton_1.png
farming_cotton_2.png
farming_cotton_3.png
farming_cotton_4.png
farming_cotton_5.png
farming_cotton_6.png
farming_cotton_7.png
farming_cotton_8.png

View File

@ -1,2 +0,0 @@
default
wool

View File

@ -1,531 +0,0 @@
-- Minetest 0.4 mod: farming
-- See README.txt for licensing and other information.
--
-- Soil
--
minetest.register_node("farming:soil", {
description = "Soil",
tiles = {"farming_soil.png", "default_dirt.png"},
drop = "default:dirt",
is_ground_content = true,
groups = {crumbly=3, not_in_creative_inventory=1, soil=2},
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_node("farming:soil_wet", {
description = "Wet Soil",
tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png"},
drop = "default:dirt",
is_ground_content = true,
groups = {crumbly=3, not_in_creative_inventory=1, soil=3},
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_abm({
nodenames = {"farming:soil", "farming:soil_wet"},
interval = 15,
chance = 4,
action = function(pos, node)
pos.y = pos.y+1
local nn = minetest.get_node(pos).name
pos.y = pos.y-1
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].walkable and
minetest.get_item_group(nn, "plant") == 0
then
minetest.set_node(pos, {name="default:dirt"})
end
-- check if there is water nearby
if minetest.find_node_near(pos, 3, {"group:water"}) then
-- if it is dry soil turn it into wet soil
if node.name == "farming:soil" then
minetest.set_node(pos, {name="farming:soil_wet"})
end
else
-- turn it back into dirt if it is already dry
if node.name == "farming:soil" then
-- only turn it back if there is no plant on top of it
if minetest.get_item_group(nn, "plant") == 0 then
minetest.set_node(pos, {name="default:dirt"})
end
-- if its wet turn it back into dry soil
elseif node.name == "farming:soil_wet" then
minetest.set_node(pos, {name="farming:soil"})
end
end
end,
})
--
-- Hoes
--
-- turns nodes with group soil=1 into soil
local function hoe_on_use(itemstack, user, pointed_thing, uses)
local pt = pointed_thing
-- check if pointing at a node
if not pt then
return
end
if pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
local above = minetest.get_node(p)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[above.name] then
return
end
-- check if the node above the pointed thing is air
if above.name ~= "air" then
return
end
-- check if pointing at dirt
if minetest.get_item_group(under.name, "soil") ~= 1 then
return
end
-- turn the node into soil, wear out item and play sound
minetest.set_node(pt.under, {name="farming:soil"})
minetest.sound_play("default_dig_crumbly", {
pos = pt.under,
gain = 0.5,
})
itemstack:add_wear(65535/(uses-1))
return itemstack
end
minetest.register_tool("farming:hoe_wood", {
description = "Wooden Hoe",
inventory_image = "farming_tool_woodhoe.png",
on_use = function(itemstack, user, pointed_thing)
return hoe_on_use(itemstack, user, pointed_thing, 30)
end,
})
minetest.register_tool("farming:hoe_stone", {
description = "Stone Hoe",
inventory_image = "farming_tool_stonehoe.png",
on_use = function(itemstack, user, pointed_thing)
return hoe_on_use(itemstack, user, pointed_thing, 90)
end,
})
minetest.register_tool("farming:hoe_steel", {
description = "Steel Hoe",
inventory_image = "farming_tool_steelhoe.png",
on_use = function(itemstack, user, pointed_thing)
return hoe_on_use(itemstack, user, pointed_thing, 200)
end,
})
minetest.register_tool("farming:hoe_bronze", {
description = "Bronze Hoe",
inventory_image = "farming_tool_bronzehoe.png",
on_use = function(itemstack, user, pointed_thing)
return hoe_on_use(itemstack, user, pointed_thing, 220)
end,
})
minetest.register_tool("farming:hoe_mese", {
description = "Mese Hoe",
inventory_image = "farming_tool_mesehoe.png",
on_use = function(itemstack, user, pointed_thing)
return hoe_on_use(itemstack, user, pointed_thing, 350)
end,
})
minetest.register_tool("farming:hoe_diamond", {
description = "Diamond Hoe",
inventory_image = "farming_tool_diamondhoe.png",
on_use = function(itemstack, user, pointed_thing)
return hoe_on_use(itemstack, user, pointed_thing, 500)
end,
})
minetest.register_craft({
output = "farming:hoe_wood",
recipe = {
{"group:wood", "group:wood"},
{"", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft({
output = "farming:hoe_stone",
recipe = {
{"group:stone", "group:stone"},
{"", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft({
output = "farming:hoe_steel",
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft({
output = "farming:hoe_bronze",
recipe = {
{"default:bronze_ingot", "default:bronze_ingot"},
{"", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft({
output = "farming:hoe_mese",
recipe = {
{"default:mese_crystal", "default:mese_crystal"},
{"", "default:stick"},
{"", "default:stick"},
}
})
minetest.register_craft({
output = "farming:hoe_diamond",
recipe = {
{"default:diamond", "default:diamond"},
{"", "default:stick"},
{"", "default:stick"},
}
})
--
-- Override grass for drops
--
minetest.register_node(":default:grass_1", {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_1.png"},
-- use a bigger inventory image
inventory_image = "default_grass_3.png",
wield_image = "default_grass_3.png",
paramtype = "light",
walkable = false,
buildable_to = true,
drop = {
max_items = 1,
items = {
{items = {'farming:seed_wheat'},rarity = 5},
}
},
groups = {snappy=3,flammable=3,flora=1,attached_node=1,dig_immediate=3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
on_place = function(itemstack, placer, pointed_thing)
-- place a random grass node
local stack = ItemStack("default:grass_"..math.random(1,5))
local ret = minetest.item_place(stack, placer, pointed_thing)
return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count()))
end,
})
for i=2,5 do
minetest.register_node(":default:grass_"..i, {
description = "Grass",
drawtype = "plantlike",
tiles = {"default_grass_"..i..".png"},
inventory_image = "default_grass_"..i..".png",
wield_image = "default_grass_"..i..".png",
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
max_items = 1,
items = {
{items = {'farming:seed_wheat'},rarity = 5},
}
},
groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1,dig_immediate=3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
end
minetest.register_node(":default:junglegrass", {
description = "Jungle Grass",
drawtype = "plantlike",
visual_scale = 1.3,
tiles = {"default_junglegrass.png"},
inventory_image = "default_junglegrass.png",
wield_image = "default_junglegrass.png",
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
max_items = 1,
items = {
{items = {'farming:seed_cotton'},rarity = 8},
}
},
groups = {snappy=3,flammable=2,flora=1,attached_node=1,dig_immediate=3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
--
-- Place seeds
--
local function place_seed(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
-- check if pointing at a node
if not pt then
return
end
if pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
local above = minetest.get_node(pt.above)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[above.name] then
return
end
-- check if pointing at the top of the node
if pt.above.y ~= pt.under.y+1 then
return
end
-- check if you can replace the node above the pointed node
if not minetest.registered_nodes[above.name].buildable_to then
return
end
-- check if pointing at soil
if minetest.get_item_group(under.name, "soil") <= 1 then
return
end
-- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name=plantname})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
--
-- Wheat
--
minetest.register_craftitem("farming:seed_wheat", {
description = "Wheat Seed",
inventory_image = "farming_wheat_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
end,
})
minetest.register_craftitem("farming:wheat", {
description = "Wheat",
inventory_image = "farming_wheat.png",
})
minetest.register_craftitem("farming:flour", {
description = "Flour",
inventory_image = "farming_flour.png",
})
minetest.register_craftitem("farming:bread", {
description = "Bread",
inventory_image = "farming_bread.png",
on_use = minetest.item_eat(4),
})
minetest.register_craft({
type = "shapeless",
output = "farming:flour",
recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"}
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:bread",
recipe = "farming:flour"
})
for i=1,8 do
local drop = {
items = {
{items = {'farming:wheat'},rarity=9-i},
{items = {'farming:wheat'},rarity=18-i*2},
{items = {'farming:seed_wheat'},rarity=9-i},
{items = {'farming:seed_wheat'},rarity=18-i*2},
}
}
minetest.register_node("farming:wheat_"..i, {
drawtype = "plantlike",
tiles = {"farming_wheat_"..i..".png"},
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = drop,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
groups = {snappy=3,flammable=2,plant=1,wheat=i,not_in_creative_inventory=1,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
})
end
minetest.register_abm({
nodenames = {"group:wheat"},
neighbors = {"group:soil"},
interval = 90,
chance = 2,
action = function(pos, node)
-- return if already full grown
if minetest.get_item_group(node.name, "wheat") == 8 then
return
end
-- check if on wet soil
pos.y = pos.y-1
local n = minetest.get_node(pos)
if minetest.get_item_group(n.name, "soil") < 3 then
return
end
pos.y = pos.y+1
-- check light
if not minetest.get_node_light(pos) then
return
end
if minetest.get_node_light(pos) < 13 then
return
end
-- grow
local height = minetest.get_item_group(node.name, "wheat") + 1
minetest.set_node(pos, {name="farming:wheat_"..height})
end
})
--
-- Cotton
--
minetest.register_craftitem("farming:seed_cotton", {
description = "Cotton Seed",
inventory_image = "farming_cotton_seed.png",
on_place = function(itemstack, placer, pointed_thing)
return place_seed(itemstack, placer, pointed_thing, "farming:cotton_1")
end,
})
minetest.register_craftitem("farming:string", {
description = "String",
inventory_image = "farming_string.png",
})
minetest.register_craft({
output = "wool:white",
recipe = {
{"farming:string", "farming:string"},
{"farming:string", "farming:string"},
}
})
for i=1,8 do
local drop = {
items = {
{items = {'farming:string'},rarity=9-i},
{items = {'farming:string'},rarity=18-i*2},
{items = {'farming:string'},rarity=27-i*3},
{items = {'farming:seed_cotton'},rarity=9-i},
{items = {'farming:seed_cotton'},rarity=18-i*2},
{items = {'farming:seed_cotton'},rarity=27-i*3},
}
}
minetest.register_node("farming:cotton_"..i, {
drawtype = "plantlike",
tiles = {"farming_cotton_"..i..".png"},
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = drop,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
groups = {snappy=3,flammable=2,plant=1,cotton=i,not_in_creative_inventory=1,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
})
end
minetest.register_abm({
nodenames = {"group:cotton"},
neighbors = {"group:soil"},
interval = 80,
chance = 2,
action = function(pos, node)
-- return if already full grown
if minetest.get_item_group(node.name, "cotton") == 8 then
return
end
-- check if on wet soil
pos.y = pos.y-1
local n = minetest.get_node(pos)
if minetest.get_item_group(n.name, "soil") < 3 then
return
end
pos.y = pos.y+1
-- check light
if not minetest.get_node_light(pos) then
return
end
if minetest.get_node_light(pos) < 13 then
return
end
-- grow
local height = minetest.get_item_group(node.name, "cotton") + 1
minetest.set_node(pos, {name="farming:cotton_"..height})
end
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

View File

@ -1,28 +0,0 @@
Minetest 0.4 mod: wool
======================
Mostly backward-compatible with jordach's 16-color wool mod.
License of source code:
-----------------------
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com>
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.
License of media (textures and sounds)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files
-----------------------
Cisoun:
- wool_black.png wool_brown.png wool_dark_green.png wool_green.png
- wool_magenta.png wool_pink.png wool_violet.png wool_yellow.png wool_blue.png
- wool_cyan.png wool_dark_grey.png wool_grey.png wool_orange.png wool_red.png
- wool_white.png

View File

@ -1 +0,0 @@
default

View File

@ -1,49 +0,0 @@
-- minetest/wool/init.lua
-- Backwards compatibility with jordach's 16-color wool mod
minetest.register_alias("wool:dark_blue", "wool:blue")
minetest.register_alias("wool:gold", "wool:yellow")
local wool = {}
-- This uses a trick: you can first define the recipes using all of the base
-- colors, and then some recipes using more specific colors for a few non-base
-- colors available. When crafting, the last recipes will be checked first.
wool.dyes = {
{"white", "White", nil},
{"grey", "Grey", "basecolor_grey"},
{"black", "Black", "basecolor_black"},
{"red", "Red", "basecolor_red"},
{"yellow", "Yellow", "basecolor_yellow"},
{"green", "Green", "basecolor_green"},
{"cyan", "Cyan", "basecolor_cyan"},
{"blue", "Blue", "basecolor_blue"},
{"magenta", "Magenta", "basecolor_magenta"},
{"orange", "Orange", "excolor_orange"},
{"violet", "Violet", "excolor_violet"},
{"brown", "Brown", "unicolor_dark_orange"},
{"pink", "Pink", "unicolor_light_red"},
{"dark_grey", "Dark Grey", "unicolor_darkgrey"},
{"dark_green", "Dark Green", "unicolor_dark_green"},
}
for _, row in ipairs(wool.dyes) do
local name = row[1]
local desc = row[2]
local craft_color_group = row[3]
-- Node Definition
minetest.register_node("wool:"..name, {
description = desc.." Wool",
tiles = {"wool_"..name..".png"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3,wool=1},
sounds = default.node_sound_defaults(),
})
if craft_color_group then
-- Crafting from dye and white wool
minetest.register_craft({
type = "shapeless",
output = 'wool:'..name,
recipe = {'group:dye,'..craft_color_group, 'group:wool'},
})
end
end