Dirt leeches to sand under water + time.

This commit is contained in:
Aaron Suen 2019-11-30 10:15:02 -05:00
parent 0fd31152ca
commit 967653bf65
3 changed files with 35 additions and 10 deletions

View File

@ -11,11 +11,6 @@ ROADMAP: Large New Development Projects
- Split this doc into "core gameplay" and "side quest" forks?
- Sand renewability.
- Dirt turns to sand if left near water.
- Stronger near more water.
- Stronger near flowing water.
- Consider using a separate kind of water node for artificial water.
- For sponge squeezing and future pumping features.
- Make it a little grayer, or clearer than natural fresh water?

View File

@ -1,10 +1,15 @@
-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore
= minetest, nodecore
local math, minetest, nodecore
= math, minetest, nodecore
local math_random
= math.random
-- LUALOCALS > ---------------------------------------------------------
local dirt = "nc_terrain:dirt"
local grass = "nc_terrain:dirt_with_grass"
local modname = minetest.get_current_modname()
local dirt = modname .. ":dirt"
local grass = modname .. ":dirt_with_grass"
local sand = modname .. ":sand"
local breathable = {
airlike = true,
@ -62,3 +67,28 @@ nodecore.register_limited_abm({
return minetest.set_node(pos, {name = dirt})
end
})
local function waterat(pos, dx, dy, dz)
pos = {x = pos.x + dx, y = pos.y + dy, z = pos.z + dz}
local node = minetest.get_node(pos)
return minetest.get_item_group(node.name, "water") ~= 0
end
nodecore.register_limited_abm({
label = "Dirt Leeching to Sand",
nodenames = {dirt},
neighbors = {"group:water"},
interval = 5,
chance = 50,
action = function(pos)
if not waterat(pos, 0, 1, 0) then return end
local qty = 1
if waterat(pos, 1, 0, 0) then qty = qty * 1.5 end
if waterat(pos, -1, 0, 0) then qty = qty * 1.5 end
if waterat(pos, 0, 0, 1) then qty = qty * 1.5 end
if waterat(pos, 0, 0, -1) then qty = qty * 1.5 end
if waterat(pos, 0, -1, 0) then qty = qty * 1.5 end
if math_random() * 100 >= qty then return end
minetest.set_node(pos, {name = sand})
nodecore.node_sound(pos, "place")
end
})

View File

@ -10,5 +10,5 @@ include('node')
include('biome')
include('strata')
include('ore')
include('grasslife')
include('abm')
include('ambiance')