Sapling placement

Add jungle sapling to water restriction
Remove sapling restriction at y > 14400
This commit is contained in:
James Stevenson 2016-01-14 06:52:19 -05:00
parent 7406db9438
commit 45b0346b80
2 changed files with 21 additions and 6 deletions

View File

@ -105,6 +105,10 @@ function default.drop_node_inventory()
end
end
-- FIXME this is bugged when a player is (timed-out?)
-- and a kick will result in a crash
-- Something about inv being nil?
function default.drop_player_inventory(pos, digger)
pos.y = pos.y+1.5
local inv = digger:get_inventory()
@ -371,10 +375,13 @@ minetest.register_abm({
minetest.register_on_placenode(function(pos, newnode, placer, oldnode)
if placer:is_player() then
if newnode.name == "default:sapling" then
if newnode.name == "default:sapling" or
newnode.name == "default:junglesapling" then
if pos.y < 14400 then
if not minetest.find_node_near(pos, 8, {"group:water"}) then
minetest.set_node(pos, oldnode)
minetest.add_item(pos, {name="default:sapling"})
minetest.add_item(pos, newnode) --{name="default:sapling"})
end
end
end
end

View File

@ -1,9 +1,12 @@
minetest.register_node("kalite:plastic_grass", {
description = "Plastic Grass",
tiles = {"default_grass.png"},
groups = {cracky = default.dig.cobble}
groups = {cracky=default.dig.cobble, soil=3}
})
-- Map Generation
local c_cloud = minetest.get_content_id("default:cloud")
local c_plastic_grass = minetest.get_content_id("kalite:plastic_grass")
--local c_air = minetest.get_content_id("air")
@ -65,7 +68,12 @@ minetest.register_on_generated(function(minp, maxp, seed)
end)
-- Black sky in caves:
-- Black sky in caves
-- Damage players trying to dig to the bottom
-- TODO Damage players at world's edge. Possibly
-- teleport to the other side. Shouldn't have
-- to worry about the top, but put that in there
-- for completeness.
local dur = 0