Optimize code, allfaces leaves by default, leaves walkable by default

This commit is contained in:
TenPlus1 2016-01-21 14:59:28 +00:00
parent bd0fae584c
commit 87031b6051
17 changed files with 187 additions and 135 deletions

View File

@ -6,7 +6,7 @@ minetest.register_node("ethereal:crystal_spike", {
inventory_image = "crystal_spike.png",
wield_image = "crystal_spike.png",
paramtype = "light",
light_source = default.LIGHT_MAX - 7,
light_source = 7,
sunlight_propagates = true,
walkable = false,
damage_per_second = 1,
@ -38,7 +38,7 @@ minetest.register_craft({
minetest.register_node("ethereal:crystal_block", {
description = "Crystal Block",
tiles = {"crystal_block.png"},
light_source = default.LIGHT_MAX - 5,
light_source = 9,
is_ground_content = false,
groups = {cracky = 1, level = 2, puts_out_fire = 1},
sounds = default.node_sound_glass_defaults(),
@ -152,28 +152,33 @@ minetest.register_tool("ethereal:shovel_crystal", {
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then return end
if pointed_thing.type ~= "node" then
return
end
-- Check if node protected
if not minetest.is_protected(pointed_thing.under, user:get_player_name()) then
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
return
end
local pos = pointed_thing.under
local nn = minetest.get_node_or_nil(pos)
if nn then nn = nn.name else return end
local pos = pointed_thing.under
local nn = minetest.get_node(pos).name
-- Is node dirt, sand or gravel
if minetest.get_item_group(nn, "crumbly") > 0 then
-- Is node dirt, sand or gravel
if minetest.get_item_group(nn, "crumbly") > 0 then
local inv = user:get_inventory()
local inv = user:get_inventory()
minetest.remove_node(pointed_thing.under)
nodeupdate(pos)
inv:add_item("main", {name = nn})
itemstack:add_wear(65535 / 100) -- 111 uses
minetest.sound_play("default_dirt_footstep", {pos = pos, gain = 0.35})
return itemstack
end
minetest.remove_node(pointed_thing.under)
nodeupdate(pos)
inv:add_item("main", {name = nn})
itemstack:add_wear(65535 / 100) -- 111 uses
minetest.sound_play("default_dirt_footstep", {pos = pos, gain = 0.35})
return itemstack
end
end,
})

View File

@ -36,15 +36,14 @@ minetest.register_craft({
cooktime = 3,
})
local dirt = {}
dirt.type = {
{"Bamboo"}, {"Jungle"}, {"Grove"}, {"Prairie"}, {"Cold"},
{"Crystal"}, {"Mushroom"}, {"Fiery"}, {"Gray"},
local dirts = {
"Bamboo", "Jungle", "Grove", "Prairie", "Cold",
"Crystal", "Mushroom", "Fiery", "Gray"
}
for _, row in pairs(dirt.type) do
for n = 1, #dirts do
local desc = row[1]
local desc = dirts[n]
local name = desc:lower()
minetest.register_node("ethereal:"..name.."_dirt", {
@ -80,31 +79,34 @@ minetest.register_abm({
chance = 2,
catch_up = false,
action = function(pos, node)
local count_grasses = {}
local curr_max = 0
local curr_type = "ethereal:green_dirt" -- fallback
local positions = minetest.find_nodes_in_area_under_air(
{x = (pos.x - 2), y = (pos.y - 1), z = (pos.z - 2)},
{x = (pos.x + 2), y = (pos.y + 1), z = (pos.z + 2)},
local positions = minetest.find_nodes_in_area(
{x = (pos.x - 1), y = (pos.y - 2), z = (pos.z - 1)},
{x = (pos.x + 1), y = (pos.y + 2), z = (pos.z + 1)},
"group:ethereal_grass")
local n
-- count new grass nodes
for _,p in pairs(positions) do
n = minetest.get_node_or_nil(p)
if n and n.name then
count_grasses[n.name] = (count_grasses[n.name] or 0) + 1
-- we found a grass type with more than current max
if count_grasses[n.name] > curr_max then
curr_max = count_grasses[n.name]
curr_type = n.name
end
local n = minetest.get_node(p).name
count_grasses[n] = (count_grasses[n] or 0) + 1
-- we found a grass type with more than current max
if count_grasses[n] > curr_max then
curr_max = count_grasses[n]
curr_type = n
end
end
minetest.swap_node(pos, {name = curr_type})
end
})
-- make dirt with dry grass spreads like ethereal grasses
-- have dirt with dry grass spreads like ethereal grasses
minetest.override_item("default:dirt_with_dry_grass", {
groups = {crumbly = 3, soil = 1, ethereal_grass = 1},
})
@ -116,21 +118,25 @@ minetest.register_abm({
chance = 20,
catch_up = false,
action = function(pos, node)
local name = minetest.get_node({
x = pos.x,
y = pos.y + 1,
z = pos.z
}).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
if name ~= "ignore" and nodedef
and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
and nodedef.liquidtype == "none") then
minetest.swap_node(pos, {name = "default:dirt"})
end
end
})
-- If Baked Clay mod not active, make Red and Orange nodes
-- If Baked Clay mod not active, make Red, Orange and Grey nodes
if not minetest.get_modpath("bakedclay") then
minetest.register_node(":bakedclay:red", {

View File

@ -1,4 +1,4 @@
-- Vines
-- vines
minetest.register_node("ethereal:vine", {
description = "Vine",
drawtype = "signlike",
@ -106,8 +106,6 @@ minetest.register_craft({
output = "ethereal:glostone",
recipe = {
{"default:torch", "default:stone", "dye:yellow"},
{"", "", ""},
{"", "", ""},
}
})
@ -287,15 +285,17 @@ minetest.register_tool("ethereal:light_staff", {
return
end
local node = minetest.get_node_or_nil(pos)
if node then node = node.name else return end
local node = minetest.get_node(pos).name
if node == "default:stone"
or node == "default:desert_stone" then
minetest.swap_node(pos, {name="ethereal:glostone"})
minetest.swap_node(pos, {name = "ethereal:glostone"})
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535 / 149) -- 150 uses
end
return itemstack
end
@ -319,13 +319,13 @@ minetest.register_on_generated(function(minp, maxp)
end
local bpos
local coal = minetest.find_nodes_in_area_under_air(minp, maxp, "default:stone_with_coal")
for key, pos in pairs(minetest.find_nodes_in_area_under_air(minp, maxp, "default:stone_with_coal")) do
for n = 1, #coal do
bpos = {x = pos.x, y = pos.y + 1, z = pos.z }
bpos = {x = coal[n].x, y = coal[n].y + 1, z = coal[n].z }
if math.random(1, 2) == 1
and minetest.get_node(bpos).name == "air" then
if math.random(1, 2) == 1 then
if bpos.y > -3000 and bpos.y < -2000 then
minetest.swap_node(bpos, {name = "ethereal:illumishroom3"})

View File

@ -15,29 +15,31 @@ local fences = {
for _, row in pairs(fences) do
minetest.register_node("ethereal:fence_"..row[1], {
description = row[2].." Fence",
drawtype = "fencelike",
is_ground_content = false,
tiles = {row[3]},
inventory_image = "default_fence_overlay.png^"..row[3].."^default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^"..row[3].."^default_fence_overlay.png^[makealpha:255,126,126",
paramtype = "light",
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
},
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("ethereal:fence_"..row[1], {
description = row[2].." Fence",
drawtype = "fencelike",
is_ground_content = false,
tiles = {row[3]},
inventory_image = "default_fence_overlay.png^" .. row[3]
.. "^default_fence_overlay.png^[makealpha:255,126,126",
wield_image = "default_fence_overlay.png^" .. row[3]
.. "^default_fence_overlay.png^[makealpha:255,126,126",
paramtype = "light",
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
},
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_craft({
output = "ethereal:fence_"..row[1].." 4",
recipe = {
{row[4], "group:stick", row[4]},
{row[4], "group:stick", row[4]},
}
})
minetest.register_craft({
output = "ethereal:fence_"..row[1].." 4",
recipe = {
{row[4], "group:stick", row[4]},
{row[4], "group:stick", row[4]},
}
})
end

View File

@ -87,10 +87,11 @@ minetest.register_craftitem("ethereal:fishing_rod_baited", {
liquids_pointable = true,
on_use = function (itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then return end
if pointed_thing.type ~= "node" then
return
end
local node = minetest.get_node_or_nil(pointed_thing.under)
if node then node = node.name else return end
local node = minetest.get_node(pointed_thing.under).name
if (node == "default:water_source"
or node == "default:river_water_source")
@ -100,7 +101,9 @@ minetest.register_craftitem("ethereal:fishing_rod_baited", {
local inv = user:get_inventory()
if inv:room_for_item("main", {name = type}) then
inv:add_item("main", {name = type})
return {name = "ethereal:fishing_rod"}
else
minetest.chat_send_player(user:get_player_name(),

View File

@ -90,9 +90,7 @@ minetest.register_abm({
return
end
if minetest.get_node(seedling).name == "air" then
minetest.swap_node(seedling, {name = node.name})
end
minetest.swap_node(seedling, {name = node.name})
end
end,
})

View File

@ -26,6 +26,7 @@ function gate_rightclick(pos, node)
end
node.name = split[1] .. "_" .. split[2] .. "_" .. name
minetest.swap_node(pos, node)
minetest.sound_play("doors_door_"..sound, {
@ -60,7 +61,10 @@ minetest.register_node("ethereal:fencegate_"..row[1].."_open", {
sunlight_propagates = true,
is_ground_content = false,
walkable = true,
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, not_in_inventory = 1},
groups = {
snappy = 1, choppy = 2, oddly_breakable_by_hand = 2,
flammable = 2, not_in_inventory = 1
},
drop = "ethereal:fencegate_"..row[1].."_closed",
drawtype = "nodebox",
node_box = {
@ -93,8 +97,10 @@ minetest.register_alias("ethereal:"..row[1].."gate_open", "ethereal:fencegate_".
minetest.register_node("ethereal:fencegate_"..row[1].."_closed", {
description = row[2].." Gate",
tiles = {row[3]},
inventory_image = "default_gate_overlay.png^"..row[3].."^default_gate_overlay.png^[makealpha:255,126,126",
wield_image = "default_gate_overlay.png^"..row[3].."^default_gate_overlay.png^[makealpha:255,126,126",
inventory_image = "default_gate_overlay.png^" .. row[3]
.. "^default_gate_overlay.png^[makealpha:255,126,126",
wield_image = "default_gate_overlay.png^" .. row[3]
.. "^default_gate_overlay.png^[makealpha:255,126,126",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,

View File

@ -1,6 +1,6 @@
--[[
Minetest Ethereal Mod 1.19 (13th December 2015)
Minetest Ethereal Mod 1.19 (21st January 2016)
Created by ChinChow
@ -9,7 +9,8 @@
]]
ethereal = {}
ethereal.leaftype = 0 -- 0 for 2D plantlike, 1 for 3D allfaces
ethereal.leaftype = 1 -- 0 for 2D plantlike, 1 for 3D allfaces
ethereal.leafwalk = true -- true for walkable leaves, false to fall through
-- Set following to 1 to enable biome or 0 to disable
ethereal.glacier = 1 -- Ice glaciers with snow

View File

@ -16,7 +16,7 @@ minetest.register_node("ethereal:acacia_leaves", {
inventory_image = "moretrees_acacia_leaves.png",
wield_image = "moretrees_acacia_leaves.png",
paramtype = "light",
walkable = false,
walkable = ethereal.leafwalk,
visual_scale = 1.2,
waving = 1,
groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
@ -37,7 +37,7 @@ minetest.override_item("default:acacia_leaves", {
inventory_image = "moretrees_acacia_leaves.png",
wield_image = "moretrees_acacia_leaves.png",
visual_scale = 1.2,
walkable = false,
walkable = ethereal.leafwalk,
drop = {
max_items = 1,
items = {
@ -57,7 +57,7 @@ minetest.register_node("ethereal:willow_twig", {
inventory_image = "willow_twig.png",
wield_image = "willow_twig.png",
paramtype = "light",
walkable = false,
walkable = ethereal.leafwalk,
visual_scale = 1.2,
waving = 1,
groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
@ -81,7 +81,7 @@ minetest.register_node("ethereal:redwood_leaves", {
inventory_image = "redwood_leaves.png",
wield_image = "redwood_leaves.png",
paramtype = "light",
walkable = false,
walkable = ethereal.leafwalk,
waving = 1,
groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
drop = {
@ -101,7 +101,7 @@ minetest.override_item("default:leaves", {
visual_scale = 1.2,
inventory_image = "default_leaves.png",
wield_image = "default_leaves.png",
walkable = false,
walkable = ethereal.leafwalk,
drop = {
max_items = 1,
items = {
@ -120,7 +120,7 @@ minetest.register_node("ethereal:orange_leaves", {
inventory_image = "orange_leaves.png",
wield_image = "orange_leaves.png",
paramtype = "light",
walkable = false,
walkable = ethereal.leafwalk,
waving = 1,
groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
drop = {
@ -140,7 +140,7 @@ minetest.override_item("default:jungleleaves", {
visual_scale = 1.2,
inventory_image = "default_jungleleaves.png",
wield_image = "default_jungleleaves.png",
walkable = false,
walkable = ethereal.leafwalk,
drop = {
max_items = 1,
items = {
@ -159,7 +159,7 @@ minetest.register_node("ethereal:bananaleaves", {
inventory_image = "banana_leaf.png",
wield_image = "banana_leaf.png",
paramtype = "light",
walkable = false,
walkable = ethereal.leafwalk,
waving = 1,
groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
drop = {
@ -182,7 +182,7 @@ minetest.register_node("ethereal:yellowleaves", {
inventory_image = "yellow_leaves.png",
wield_image = "yellow_leaves.png",
paramtype = "light",
walkable = false,
walkable = ethereal.leafwalk,
waving = 1,
groups = {snappy = 3, leafdecay = 3, leaves = 1},
drop = {
@ -208,7 +208,7 @@ minetest.register_node("ethereal:palmleaves", {
inventory_image = "moretrees_palm_leaves.png",
wield_image = "moretrees_palm_leaves.png",
paramtype = "light",
walkable = false,
walkable = ethereal.leafwalk,
waving = 1,
groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
drop = {
@ -231,7 +231,7 @@ minetest.register_node("ethereal:birch_leaves", {
inventory_image = "moretrees_birch_leaves.png",
wield_image = "moretrees_birch_leaves.png",
paramtype = "light",
walkable = false,
walkable = ethereal.leafwalk,
waving = 1,
groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
drop = {
@ -252,7 +252,7 @@ minetest.override_item("default:pine_needles", {
tiles = {"pine_leaves.png"},
inventory_image = "pine_leaves.png",
wield_image = "pine_leaves.png",
walkable = false,
walkable = ethereal.leafwalk,
drop = {
max_items = 1,
items = {
@ -273,7 +273,7 @@ minetest.register_node("ethereal:frost_leaves", {
inventory_image = "ethereal_frost_leaves.png",
wield_image = "ethereal_frost_leaves.png",
paramtype = "light",
walkable = false,
walkable = ethereal.leafwalk,
waving = 1,
groups = {snappy = 3, leafdecay = 3, leaves = 1, puts_out_fire = 1},
drop = {
@ -347,7 +347,7 @@ minetest.register_node("ethereal:bamboo_leaves", {
inventory_image = "bamboo_leaves.png",
wield_image = "bamboo_leaves.png",
paramtype = "light",
walkable = false,
walkable = ethereal.leafwalk,
waving = 1,
groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
drop = {

View File

@ -59,14 +59,16 @@ minetest.register_abm({
action = function(pos, node)
if minetest.get_node_light(pos, nil) > 14 then
minetest.remove_node(pos)
return
end
local random = {
x = pos.x + math.random(-2,2),
y = pos.y + math.random(-1,1),
z = pos.z + math.random(-2,2)
x = pos.x + math.random(-2, 2),
y = pos.y + math.random(-1, 1),
z = pos.z + math.random(-2, 2)
}
local random_node = minetest.get_node_or_nil(random)

View File

@ -14,6 +14,7 @@ minetest.register_abm({
local high = 4
pos.y = pos.y - 1
local nod = minetest.get_node_or_nil(pos)
if not nod
@ -23,10 +24,11 @@ minetest.register_abm({
end
if node.name == "ethereal:bamboo" then
high = 8 -- was 5
high = 8
end
pos.y = pos.y + 1
local height = 0
while height < high
@ -40,8 +42,10 @@ minetest.register_abm({
if nod
and nod.name == "air"
and height < high then
if node.name == "ethereal:bamboo"
and height == (high - 1) then
ethereal.add_tree({
x = pos.x,
y = oripos,

View File

@ -17,8 +17,7 @@ minetest.register_node("ethereal:fire_flower", {
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
on_punch = function(pos, node, puncher)
--local item = puncher:get_wielded_item()
--local itemname = item:get_name()
puncher:punch(puncher, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 2}
@ -151,8 +150,9 @@ minetest.register_node("ethereal:crystalgrass", {
-- Define Moss Types (Has grass textures on all sides)
function ethereal.add_moss(typ, descr, texture, receipe_item)
minetest.register_node("ethereal:"..typ.."_moss", {
description = descr.." Moss",
minetest.register_node("ethereal:" .. typ .. "_moss", {
description = descr .. " Moss",
tiles = {texture},
groups = {crumbly = 3},
sounds = default.node_sound_dirt_defaults()
@ -170,7 +170,7 @@ ethereal.add_moss( "fiery", "Fiery", "ethereal_grass_fiery_top.png", "ethereal:d
ethereal.add_moss( "gray", "Gray", "ethereal_grass_gray_top.png", "ethereal:snowygrass")
ethereal.add_moss( "green", "Green", "default_grass.png", "default:jungleleaves")
-- apple
-- fix apples hanging in sky when no tree around
minetest.override_item("default:apple", {
drop = "default:apple",
})
@ -341,7 +341,7 @@ minetest.register_node("ethereal:bamboo", {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {choppy = 3, oddly_breakable_by_hand = 1, flammable = 2, tree = 1}, -- added tree
groups = {choppy = 3, oddly_breakable_by_hand = 1, flammable = 2, tree = 1},
sounds = default.node_sound_leaves_defaults(),
after_dig_node = function(pos, node, metadata, digger)
default.dig_up(pos, node, digger)
@ -364,13 +364,10 @@ minetest.register_node("ethereal:bamboo_sprout", {
paramtype = "light",
sunlight_propagates = true,
walkable = false,
--buildable_to = true,
--groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 2},
groups = {
snappy = 3, attached_node = 1, flammable = 2,
dig_immediate = 3, ethereal_sapling = 1
},
--sounds = default.node_sound_leaves_defaults(),
sounds = default.node_sound_defaults(),
selection_box = {
type = "fixed",
@ -462,7 +459,7 @@ for _,items in pairs({
{"default:ice", "default:snow"},
{"ethereal:dry_dirt", "default:desert_sand"},
}) do
local a,b = unpack(items)
local a, b = unpack(items)
minetest.register_craft({
output = b.." 5",
recipe = {
@ -531,7 +528,7 @@ minetest.register_node("ethereal:candle", {
},
},
paramtype = "light",
light_source = default.LIGHT_MAX - 3,
light_source = 11,
sunlight_propagates = true,
walkable = false,
groups = {dig_immediate = 3, attached_node = 1},
@ -543,7 +540,7 @@ minetest.register_node("ethereal:candle", {
})
minetest.register_craft({
output = "ethereal:candle 6",
output = "ethereal:candle 4",
recipe = {
{"","farming:cotton"},
{"","ethereal:palm_wax"},

View File

@ -57,8 +57,11 @@ local path = minetest.get_modpath("ethereal").."/schematics/"
ethereal.grow_sapling = function (pos, node)
local under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z})
if under then under = under.name else return end
local under = minetest.get_node({
x = pos.x,
y = pos.y - 1,
z = pos.z
}).name
-- Check if Sapling is growing on correct substrate
if node.name == "ethereal:yellow_tree_sapling"
@ -139,13 +142,15 @@ minetest.register_craftitem("ethereal:tree_tool", {
description = "Tree Tool",
inventory_image = "default_stick.png",
on_use = function(itemstack, user, pointed_thing)
if not pointed_thing
or pointed_thing.type ~= "node" then
return
end
local pos = pointed_thing.under
local nod = minetest.get_node_or_nil(pos)
if not nod then return end
local nod = minetest.get_node(pos)
ethereal.grow_sapling(pos, nod)
end,
})

View File

@ -138,11 +138,11 @@ minetest.register_ore({
clust_scarcity = 10*10*10,
clust_num_ores = 24,
clust_size = 4,
y_max = -14,
y_max = -12,
y_min = -100,
})
-- randomly generate coral or seaweed and have seaweed grow up to 10 high
-- randomly generate coral or seaweed and have seaweed grow up to 14 high
minetest.register_abm({
nodenames = {"ethereal:sandy"},
neighbors = {"group:water"},
@ -152,29 +152,42 @@ minetest.register_abm({
action = function(pos, node)
local sel = math.random(1, 5)
if sel == 1
or node.name == "ethereal:seaweed" then
local height = 0
while (minetest.get_node(pos).name == "ethereal:seaweed"
or minetest.get_node(pos).name == "ethereal:sandy")
and height < 14 do
pos.y = pos.y + 1
local nod = minetest.get_node(pos).name
if nod == "default:water_source"
and sel > 1 then
if minetest.get_node(pos).name == "default:water_source" then
minetest.swap_node(pos, {name = "ethereal:coral" .. sel})
end
return
end
if nod == "ethereal:seaweed"
or sel == 1 then
local height = 0
local high = 14
while height < high
and minetest.get_node(pos).name == "ethereal:seaweed" do
height = height + 1
pos.y = pos.y + 1
end
if height < 14
and pos.y < 0
if pos.y < 1
and height < high
and minetest.get_node(pos).name == "default:water_source" then
minetest.swap_node(pos, {name = "ethereal:seaweed"})
end
else
pos.y = pos.y + 1
if minetest.get_node(pos).name == "default:water_source" then
minetest.swap_node(pos, {name = "ethereal:coral"..sel})
end
end
end,
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 B

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

View File

@ -89,6 +89,7 @@ minetest.register_abm({
action = function(pos, node)
local water_node = "default:water"
if pos.y > 2 then
water_node = "default:river_water"
end
@ -98,8 +99,10 @@ minetest.register_abm({
or node.name == "ethereal:icebrick"
or node.name == "ethereal:snowbrick" then
minetest.swap_node(pos, {name = water_node.."_source"})
elseif node.name == "default:snow" then
minetest.swap_node(pos, {name = water_node.."_flowing"})
elseif node.name == "default:dirt_with_snow" then
minetest.swap_node(pos, {name = "default:dirt_with_grass"})
end
@ -116,6 +119,7 @@ minetest.register_abm({
chance = 2,
catch_up = false,
action = function(pos, node)
if node == "ethereal:dry_dirt" then
minetest.swap_node(pos, {name = "default:dirt"})
else
@ -132,20 +136,26 @@ minetest.register_abm({
chance = 1,
catch_up = false,
action = function(pos, node)
local num = #minetest.find_nodes_in_area(
{x = pos.x - 1, y = pos.y, z = pos.z},
{x = pos.x + 1, y = pos.y, z = pos.z},
{"group:water"})
num = num + #minetest.find_nodes_in_area(
{x = pos.x, y = pos.y, z = pos.z - 1},
{x = pos.x, y = pos.y, z = pos.z + 1},
{"group:water"})
num = num + #minetest.find_nodes_in_area(
{x = pos.x, y = pos.y + 1, z = pos.z},
{x = pos.x, y = pos.y + 1, z = pos.z},
{"group:water"})
if num > 0 then
minetest.swap_node(pos, {name = "default:water_flowing"})
minetest.add_item(pos, {name = node.name})
end
end,