diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2015-07-04 12:22:39 +0100 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2015-07-04 12:22:39 +0100 |
commit | 023d0303c1c01508039c1de0b79c5b86e21cefb1 (patch) | |
tree | 74f54ea2dba1181cf58a9c4e1876cd1acaca3ad6 /water.lua | |
parent | 2bc7406c9a2112eba39e91c304dab74699093c4d (diff) |
Code tidy and fixed fruit not dropping
Diffstat (limited to 'water.lua')
-rw-r--r-- | water.lua | 64 |
1 files changed, 42 insertions, 22 deletions
@@ -5,7 +5,7 @@ minetest.register_node("ethereal:icebrick", { paramtype = "light", freezemelt = "default:water_source", is_ground_content = false, - groups = {cracky=3, melts=1}, + groups = {cracky = 3, melts = 1}, sounds = default.node_sound_glass_defaults(), }) @@ -24,10 +24,10 @@ minetest.register_node("ethereal:snowbrick", { paramtype = "light", freezemelt = "default:water_source", is_ground_content = false, - groups = {crumbly=3, melts=1}, + groups = {crumbly = 3, melts = 1}, sounds = default.node_sound_dirt_defaults({ - footstep = {name="default_snow_footstep", gain=0.25}, - dug = {name="default_snow_footstep", gain=0.75}, + footstep = {name="default_snow_footstep", gain = 0.25}, + dug = {name="default_snow_footstep", gain = 0.75}, }), }) @@ -46,41 +46,52 @@ minetest.register_abm({ interval = 30, chance = 10, action = function(pos, node) - minetest.add_node(pos, {name="default:mossycobble"}) + minetest.add_node(pos, {name = "default:mossycobble"}) end }) -- If Crystal Spike, Crystal Dirt, Snow near Water, change Water to Ice minetest.register_abm({ - nodenames = {"ethereal:crystal_spike", "default:snow", "default:snowblock", "ethereal:snowbrick"}, + nodenames = { + "ethereal:crystal_spike", "default:snow", "default:snowblock", + "ethereal:snowbrick" + }, neighbors = {"default:water_source"}, interval = 15, chance = 2, action = function(pos, node) local water = minetest.find_nodes_in_area( - {x=pos.x-1,y=pos.y-1,z=pos.z-1}, - {x=pos.x+1,y=pos.y+1,z=pos.z+1}, + {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1}, + {x = pos.x + 1, y = pos.y + 1, z = pos.z + 1}, "default:water_source") if water then - minetest.set_node(water[1], {name="default:ice"}) + minetest.set_node(water[1], {name = "default:ice"}) end end, }) -- If Heat Source near Ice or Snow then melt minetest.register_abm({ - nodenames = {"default:ice", "default:snowblock", "default:snow", "default:dirt_with_snow", "ethereal:snowbrick", "ethereal:icebrick"}, - neighbors = {"fire:basic_fire", "default:lava_source", "default:lava_flowing", "default:furnace_active", "default:torch"}, + nodenames = { + "default:ice", "default:snowblock", "default:snow", + "default:dirt_with_snow", "ethereal:snowbrick", "ethereal:icebrick" + }, + neighbors = { + "fire:basic_fire", "default:lava_source", "default:lava_flowing", + "default:furnace_active", "default:torch" + }, interval = 5, chance = 2, action = function(pos, node, active_object_count, active_object_count_wider) - if node.name == "default:ice" or node.name == "default:snowblock" - or node.name == "ethereal:icebrick" or node.name == "ethereal:snowbrick" then - minetest.add_node(pos,{name="default:water_source"}) + if node.name == "default:ice" + or node.name == "default:snowblock" + or node.name == "ethereal:icebrick" + or node.name == "ethereal:snowbrick" then + minetest.add_node(pos, {name = "default:water_source"}) elseif node.name == "default:snow" then - minetest.add_node(pos,{name="default:water_flowing"}) + minetest.add_node(pos, {name = "default:water_flowing"}) elseif node.name == "default:dirt_with_snow" then - minetest.add_node(pos,{name="default:dirt_with_grass"}) + minetest.add_node(pos, {name = "default:dirt_with_grass"}) end nodeupdate(pos) end, @@ -93,7 +104,7 @@ minetest.register_abm({ interval = 15, chance = 2, action = function(pos, node, active_object_count, active_object_count_wider) - minetest.add_node(pos,{name="default:dirt"}) + minetest.add_node(pos, {name = "default:dirt"}) end, }) @@ -104,12 +115,21 @@ minetest.register_abm({ interval = 5, chance = 1, 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"}) + 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.set_node(pos, {name="default:water_flowing"}) + minetest.set_node(pos, {name = "default:water_flowing"}) minetest.add_item(pos, {name = node.name}) end end, -}) +})
\ No newline at end of file |