mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-20 22:33:16 -04:00
Merge remote-tracking branch 'upstream/master' into weather
This commit is contained in:
commit
40672e067c
8 changed files with 304 additions and 83 deletions
|
@ -24,8 +24,8 @@ minetest.register_craft({
|
|||
minetest.register_craft({
|
||||
output = 'default:fence_wood 2',
|
||||
recipe = {
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
{'group:stick', 'group:stick', 'group:stick'},
|
||||
{'group:stick', 'group:stick', 'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -34,7 +34,7 @@ minetest.register_craft({
|
|||
recipe = {
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'group:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -42,7 +42,7 @@ minetest.register_craft({
|
|||
output = 'default:torch 4',
|
||||
recipe = {
|
||||
{'default:coal_lump'},
|
||||
{'default:stick'},
|
||||
{'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -50,8 +50,8 @@ minetest.register_craft({
|
|||
output = 'default:pick_wood',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'group:stick', ''},
|
||||
{'', 'group:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -59,8 +59,8 @@ minetest.register_craft({
|
|||
output = 'default:pick_stone',
|
||||
recipe = {
|
||||
{'group:stone', 'group:stone', 'group:stone'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'group:stick', ''},
|
||||
{'', 'group:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -68,8 +68,8 @@ minetest.register_craft({
|
|||
output = 'default:pick_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'group:stick', ''},
|
||||
{'', 'group:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -77,8 +77,8 @@ minetest.register_craft({
|
|||
output = 'default:pick_bronze',
|
||||
recipe = {
|
||||
{'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'group:stick', ''},
|
||||
{'', 'group:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -86,8 +86,8 @@ minetest.register_craft({
|
|||
output = 'default:pick_mese',
|
||||
recipe = {
|
||||
{'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'group:stick', ''},
|
||||
{'', 'group:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -95,8 +95,8 @@ minetest.register_craft({
|
|||
output = 'default:pick_diamond',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:diamond', 'default:diamond'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'group:stick', ''},
|
||||
{'', 'group:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -104,8 +104,8 @@ minetest.register_craft({
|
|||
output = 'default:shovel_wood',
|
||||
recipe = {
|
||||
{'group:wood'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
{'group:stick'},
|
||||
{'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -113,8 +113,8 @@ minetest.register_craft({
|
|||
output = 'default:shovel_stone',
|
||||
recipe = {
|
||||
{'group:stone'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
{'group:stick'},
|
||||
{'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -122,8 +122,8 @@ minetest.register_craft({
|
|||
output = 'default:shovel_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
{'group:stick'},
|
||||
{'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -131,8 +131,8 @@ minetest.register_craft({
|
|||
output = 'default:shovel_bronze',
|
||||
recipe = {
|
||||
{'default:bronze_ingot'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
{'group:stick'},
|
||||
{'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -140,8 +140,8 @@ minetest.register_craft({
|
|||
output = 'default:shovel_mese',
|
||||
recipe = {
|
||||
{'default:mese_crystal'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
{'group:stick'},
|
||||
{'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -149,8 +149,8 @@ minetest.register_craft({
|
|||
output = 'default:shovel_diamond',
|
||||
recipe = {
|
||||
{'default:diamond'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
{'group:stick'},
|
||||
{'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -158,8 +158,8 @@ minetest.register_craft({
|
|||
output = 'default:axe_wood',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood'},
|
||||
{'group:wood', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
{'group:wood', 'group:stick'},
|
||||
{'', 'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -167,8 +167,8 @@ minetest.register_craft({
|
|||
output = 'default:axe_stone',
|
||||
recipe = {
|
||||
{'group:stone', 'group:stone'},
|
||||
{'group:stone', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
{'group:stone', 'group:stick'},
|
||||
{'', 'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -176,8 +176,8 @@ minetest.register_craft({
|
|||
output = 'default:axe_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
{'default:steel_ingot', 'group:stick'},
|
||||
{'', 'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -185,8 +185,8 @@ minetest.register_craft({
|
|||
output = 'default:axe_bronze',
|
||||
recipe = {
|
||||
{'default:bronze_ingot', 'default:bronze_ingot'},
|
||||
{'default:bronze_ingot', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
{'default:bronze_ingot', 'group:stick'},
|
||||
{'', 'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -194,8 +194,8 @@ minetest.register_craft({
|
|||
output = 'default:axe_mese',
|
||||
recipe = {
|
||||
{'default:mese_crystal', 'default:mese_crystal'},
|
||||
{'default:mese_crystal', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
{'default:mese_crystal', 'group:stick'},
|
||||
{'', 'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -203,8 +203,8 @@ minetest.register_craft({
|
|||
output = 'default:axe_diamond',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:diamond'},
|
||||
{'default:diamond', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
{'default:diamond', 'group:stick'},
|
||||
{'', 'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -213,7 +213,7 @@ minetest.register_craft({
|
|||
recipe = {
|
||||
{'group:wood'},
|
||||
{'group:wood'},
|
||||
{'default:stick'},
|
||||
{'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -222,7 +222,7 @@ minetest.register_craft({
|
|||
recipe = {
|
||||
{'group:stone'},
|
||||
{'group:stone'},
|
||||
{'default:stick'},
|
||||
{'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -231,7 +231,7 @@ minetest.register_craft({
|
|||
recipe = {
|
||||
{'default:steel_ingot'},
|
||||
{'default:steel_ingot'},
|
||||
{'default:stick'},
|
||||
{'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -240,7 +240,7 @@ minetest.register_craft({
|
|||
recipe = {
|
||||
{'default:bronze_ingot'},
|
||||
{'default:bronze_ingot'},
|
||||
{'default:stick'},
|
||||
{'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -249,7 +249,7 @@ minetest.register_craft({
|
|||
recipe = {
|
||||
{'default:mese_crystal'},
|
||||
{'default:mese_crystal'},
|
||||
{'default:stick'},
|
||||
{'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -258,7 +258,7 @@ minetest.register_craft({
|
|||
recipe = {
|
||||
{'default:diamond'},
|
||||
{'default:diamond'},
|
||||
{'default:stick'},
|
||||
{'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -266,7 +266,7 @@ minetest.register_craft({
|
|||
output = 'default:rail 15',
|
||||
recipe = {
|
||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:stick', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'group:stick', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||
}
|
||||
})
|
||||
|
@ -474,9 +474,9 @@ minetest.register_craft({
|
|||
minetest.register_craft({
|
||||
output = 'default:ladder',
|
||||
recipe = {
|
||||
{'default:stick', '', 'default:stick'},
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
{'default:stick', '', 'default:stick'},
|
||||
{'group:stick', '', 'group:stick'},
|
||||
{'group:stick', 'group:stick', 'group:stick'},
|
||||
{'group:stick', '', 'group:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
minetest.register_craftitem("default:stick", {
|
||||
description = "Stick",
|
||||
inventory_image = "default_stick.png",
|
||||
groups = {stick=1},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("default:paper", {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
-- Aliases for map generator outputs
|
||||
--
|
||||
|
||||
minetest.register_alias("mapgen_air", "air")
|
||||
minetest.register_alias("mapgen_stone", "default:stone")
|
||||
minetest.register_alias("mapgen_tree", "default:tree")
|
||||
minetest.register_alias("mapgen_leaves", "default:leaves")
|
||||
|
|
|
@ -122,7 +122,6 @@ minetest.register_node("default:dirt_with_snow", {
|
|||
footstep = {name="default_snow_footstep", gain=0.25},
|
||||
}),
|
||||
})
|
||||
minetest.register_alias("dirt_with_snow", "default:dirt_with_snow")
|
||||
|
||||
minetest.register_node("default:dirt", {
|
||||
description = "Dirt",
|
||||
|
@ -133,6 +132,42 @@ minetest.register_node("default:dirt", {
|
|||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
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
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt_with_grass"},
|
||||
interval = 2,
|
||||
chance = 20,
|
||||
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 name ~= "ignore" and nodedef
|
||||
and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
|
||||
and nodedef.liquidtype == "none") then
|
||||
minetest.set_node(pos, {name = "default:dirt"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("default:sand", {
|
||||
description = "Sand",
|
||||
tiles = {"default_sand.png"},
|
||||
|
@ -255,9 +290,193 @@ minetest.register_node("default:junglesapling", {
|
|||
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
-- aliases for tree growing abm in content_abm.cpp
|
||||
minetest.register_alias("sapling", "default:sapling")
|
||||
minetest.register_alias("junglesapling", "default:junglesapling")
|
||||
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local c_ignore = minetest.get_content_id("ignore")
|
||||
local c_tree = minetest.get_content_id("default:tree")
|
||||
local c_leaves = minetest.get_content_id("default:leaves")
|
||||
local c_apple = minetest.get_content_id("default:apple")
|
||||
function default.grow_tree(data, a, pos, is_apple_tree, seed)
|
||||
--[[
|
||||
NOTE: Tree-placing code is currently duplicated in the engine
|
||||
and in games that have saplings; both are deprecated but not
|
||||
replaced yet
|
||||
]]--
|
||||
local pr = PseudoRandom(seed)
|
||||
local th = pr:next(4, 5)
|
||||
local x, y, z = pos.x, pos.y, pos.z
|
||||
for yy = y, y+th-1 do
|
||||
local vi = a:index(x, yy, z)
|
||||
if a:contains(x, yy, z) and (data[vi] == c_air or yy == y) then
|
||||
data[vi] = c_tree
|
||||
end
|
||||
end
|
||||
y = y+th-1 -- (x, y, z) is now last piece of trunk
|
||||
local leaves_a = VoxelArea:new{MinEdge={x=-2, y=-1, z=-2}, MaxEdge={x=2, y=2, z=2}}
|
||||
local leaves_buffer = {}
|
||||
|
||||
-- Force leaves near the trunk
|
||||
local d = 1
|
||||
for xi = -d, d do
|
||||
for yi = -d, d do
|
||||
for zi = -d, d do
|
||||
leaves_buffer[leaves_a:index(xi, yi, zi)] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Add leaves randomly
|
||||
for iii = 1, 8 do
|
||||
local d = 1
|
||||
local xx = pr:next(leaves_a.MinEdge.x, leaves_a.MaxEdge.x - d)
|
||||
local yy = pr:next(leaves_a.MinEdge.y, leaves_a.MaxEdge.y - d)
|
||||
local zz = pr:next(leaves_a.MinEdge.z, leaves_a.MaxEdge.z - d)
|
||||
|
||||
for xi = 0, d do
|
||||
for yi = 0, d do
|
||||
for zi = 0, d do
|
||||
leaves_buffer[leaves_a:index(xx+xi, yy+yi, zz+zi)] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Add the leaves
|
||||
for xi = leaves_a.MinEdge.x, leaves_a.MaxEdge.x do
|
||||
for yi = leaves_a.MinEdge.y, leaves_a.MaxEdge.y do
|
||||
for zi = leaves_a.MinEdge.z, leaves_a.MaxEdge.z do
|
||||
if a:contains(x+xi, y+yi, z+zi) then
|
||||
local vi = a:index(x+xi, y+yi, z+zi)
|
||||
if data[vi] == c_air or data[vi] == c_ignore then
|
||||
if leaves_buffer[leaves_a:index(xi, yi, zi)] then
|
||||
if is_apple_tree and pr:next(1, 100) <= 10 then
|
||||
data[vi] = c_apple
|
||||
else
|
||||
data[vi] = c_leaves
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
})
|
||||
|
||||
local c_jungletree = minetest.get_content_id("default:jungletree")
|
||||
local c_jungleleaves = minetest.get_content_id("default:jungleleaves")
|
||||
function default.grow_jungletree(data, a, pos, seed)
|
||||
--[[
|
||||
NOTE: Tree-placing code is currently duplicated in the engine
|
||||
and in games that have saplings; both are deprecated but not
|
||||
replaced yet
|
||||
]]--
|
||||
local pr = PseudoRandom(seed)
|
||||
local x, y, z = pos.x, pos.y, pos.z
|
||||
for xi = -1, 1 do
|
||||
for zi = -1, 1 do
|
||||
if pr:next(1, 3) >= 2 then
|
||||
local vi1 = a:index(x+xi, y, z+zi)
|
||||
local vi2 = a:index(x+xi, y-1, z+zi)
|
||||
if a:contains(x+xi, y-1, z+zi) and data[vi2] == c_air then
|
||||
data[vi2] = c_jungletree
|
||||
elseif a:contains(x+xi, y, z+zi) and data[vi1] == c_air then
|
||||
data[vi1] = c_jungletree
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local th = pr:next(8, 12)
|
||||
for yy = y, y+th-1 do
|
||||
local vi = a:index(x, yy, z)
|
||||
if a:contains(x, yy, z) and (data[vi] == c_air or yy == y) then
|
||||
data[vi] = c_jungletree
|
||||
end
|
||||
end
|
||||
y = y+th-1 -- (x, y, z) is now last piece of trunk
|
||||
local leaves_a = VoxelArea:new{MinEdge={x=-3, y=-2, z=-3}, MaxEdge={x=3, y=2, z=3}}
|
||||
local leaves_buffer = {}
|
||||
|
||||
-- Force leaves near the trunk
|
||||
local d = 1
|
||||
for xi = -d, d do
|
||||
for yi = -d, d do
|
||||
for zi = -d, d do
|
||||
leaves_buffer[leaves_a:index(xi, yi, zi)] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Add leaves randomly
|
||||
for iii = 1, 30 do
|
||||
local d = 1
|
||||
local xx = pr:next(leaves_a.MinEdge.x, leaves_a.MaxEdge.x - d)
|
||||
local yy = pr:next(leaves_a.MinEdge.y, leaves_a.MaxEdge.y - d)
|
||||
local zz = pr:next(leaves_a.MinEdge.z, leaves_a.MaxEdge.z - d)
|
||||
|
||||
for xi = 0, d do
|
||||
for yi = 0, d do
|
||||
for zi = 0, d do
|
||||
leaves_buffer[leaves_a:index(xx+xi, yy+yi, zz+zi)] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Add the leaves
|
||||
for xi = leaves_a.MinEdge.x, leaves_a.MaxEdge.x do
|
||||
for yi = leaves_a.MinEdge.y, leaves_a.MaxEdge.y do
|
||||
for zi = leaves_a.MinEdge.z, leaves_a.MaxEdge.z do
|
||||
if a:contains(x+xi, y+yi, z+zi) then
|
||||
local vi = a:index(x+xi, y+yi, z+zi)
|
||||
if data[vi] == c_air or data[vi] == c_ignore then
|
||||
if leaves_buffer[leaves_a:index(xi, yi, zi)] then
|
||||
data[vi] = c_jungleleaves
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:junglesapling"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
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
|
||||
})
|
||||
|
||||
minetest.register_node("default:junglegrass", {
|
||||
description = "Jungle Grass",
|
||||
|
|
|
@ -11,7 +11,7 @@ minetest.register_item(":", {
|
|||
groupcaps = {
|
||||
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
|
||||
snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
|
||||
oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=1.40}, uses=0, maxlevel=3}
|
||||
oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, uses=0}
|
||||
},
|
||||
damage_groups = {fleshy=1},
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
-- Minetest 0.4 mod: farming
|
||||
-- See README.txt for licensing and other information.
|
||||
|
||||
farming = {}
|
||||
|
||||
--
|
||||
-- Soil
|
||||
--
|
||||
|
@ -62,7 +64,7 @@ minetest.register_abm({
|
|||
-- Hoes
|
||||
--
|
||||
-- turns nodes with group soil=1 into soil
|
||||
local function hoe_on_use(itemstack, user, pointed_thing, uses)
|
||||
function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
|
||||
local pt = pointed_thing
|
||||
-- check if pointing at a node
|
||||
if not pt then
|
||||
|
@ -109,7 +111,7 @@ minetest.register_tool("farming:hoe_wood", {
|
|||
inventory_image = "farming_tool_woodhoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return hoe_on_use(itemstack, user, pointed_thing, 30)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 30)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -118,7 +120,7 @@ minetest.register_tool("farming:hoe_stone", {
|
|||
inventory_image = "farming_tool_stonehoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return hoe_on_use(itemstack, user, pointed_thing, 90)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 90)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -127,7 +129,7 @@ minetest.register_tool("farming:hoe_steel", {
|
|||
inventory_image = "farming_tool_steelhoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return hoe_on_use(itemstack, user, pointed_thing, 200)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 200)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -136,7 +138,7 @@ minetest.register_tool("farming:hoe_bronze", {
|
|||
inventory_image = "farming_tool_bronzehoe.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return hoe_on_use(itemstack, user, pointed_thing, 220)
|
||||
return farming.hoe_on_use(itemstack, user, pointed_thing, 220)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -144,8 +146,8 @@ minetest.register_craft({
|
|||
output = "farming:hoe_wood",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood"},
|
||||
{"", "default:stick"},
|
||||
{"", "default:stick"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -153,8 +155,8 @@ minetest.register_craft({
|
|||
output = "farming:hoe_stone",
|
||||
recipe = {
|
||||
{"group:stone", "group:stone"},
|
||||
{"", "default:stick"},
|
||||
{"", "default:stick"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -162,8 +164,8 @@ minetest.register_craft({
|
|||
output = "farming:hoe_steel",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot"},
|
||||
{"", "default:stick"},
|
||||
{"", "default:stick"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -171,8 +173,8 @@ minetest.register_craft({
|
|||
output = "farming:hoe_bronze",
|
||||
recipe = {
|
||||
{"default:bronze_ingot", "default:bronze_ingot"},
|
||||
{"", "default:stick"},
|
||||
{"", "default:stick"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ minetest.register_craft({
|
|||
output = "screwdriver:screwdriver",
|
||||
recipe = {
|
||||
{"default:steel_ingot"},
|
||||
{"default:stick"}
|
||||
{"group:stick"}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
|||
if pointed_thing.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
||||
local p0 = pointed_thing.under
|
||||
local p1 = pointed_thing.above
|
||||
local param2 = 0
|
||||
|
||||
|
||||
local placer_pos = placer:getpos()
|
||||
if placer_pos then
|
||||
local dir = {
|
||||
|
@ -39,7 +39,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
|||
}
|
||||
param2 = minetest.dir_to_facedir(dir)
|
||||
end
|
||||
|
||||
|
||||
if p0.y-1 == p1.y then
|
||||
param2 = param2 + 20
|
||||
if param2 == 21 then
|
||||
|
@ -48,11 +48,11 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
|||
param2 = 21
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- for replace ABM
|
||||
minetest.register_node(":stairs:stair_" .. subname.."upside_down", {
|
||||
replace_name = "stairs:stair_" .. subname,
|
||||
|
@ -108,10 +108,10 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
|||
local n0 = minetest.get_node(p0)
|
||||
local n1 = minetest.get_node(p1)
|
||||
local param2 = 0
|
||||
|
||||
|
||||
local n0_is_upside_down = (n0.name == "stairs:slab_" .. subname and
|
||||
n0.param2 >= 20)
|
||||
|
||||
|
||||
if n0.name == "stairs:slab_" .. subname and not n0_is_upside_down and p0.y+1 == p1.y then
|
||||
slabpos = p0
|
||||
slabnode = n0
|
||||
|
@ -125,7 +125,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
|||
-- Make a fake stack of a single item and try to place it
|
||||
local fakestack = ItemStack(recipeitem)
|
||||
fakestack:set_count(itemstack:get_count())
|
||||
|
||||
|
||||
pointed_thing.above = slabpos
|
||||
local success
|
||||
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
|
||||
|
@ -148,7 +148,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
|||
-- Make a fake stack of a single item and try to place it
|
||||
local fakestack = ItemStack(recipeitem)
|
||||
fakestack:set_count(itemstack:get_count())
|
||||
|
||||
|
||||
pointed_thing.above = p0
|
||||
local success
|
||||
fakestack, success = minetest.item_place(fakestack, placer, pointed_thing)
|
||||
|
@ -161,20 +161,20 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
|||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
||||
-- Place upside down slab
|
||||
param2 = 20
|
||||
end
|
||||
|
||||
|
||||
-- If pointing at the side of a upside down slab
|
||||
if n0_is_upside_down and p0.y+1 ~= p1.y then
|
||||
param2 = 20
|
||||
end
|
||||
|
||||
|
||||
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- for replace ABM
|
||||
minetest.register_node(":stairs:slab_" .. subname.."upside_down", {
|
||||
replace_name = "stairs:slab_"..subname,
|
||||
|
|
Loading…
Add table
Reference in a new issue