commit f32feb0a225b4b9f8b0e47d04d16b1526d4b4181 Author: tacotexmex Date: Tue Jun 6 04:40:40 2017 +0200 Initial commit diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..a5f042f --- /dev/null +++ b/depends.txt @@ -0,0 +1,3 @@ +default? +flowers? +farming? diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..06c4968 --- /dev/null +++ b/init.lua @@ -0,0 +1,47 @@ +local floodables = { + { group = "torch", drop = "default:torch", sound = "floodables_torch", gain = 0.8 }, + { group = "flora", sound = "floodables_grass", gain = 0.2 }, + { group = "wheat", drop = "farming:seed_wheat", sound = "floodables_grass", gain = 0.2 }, + { name = "default:junglegrass", sound = "floodables_grass", gain = 0.2 }, + { group = "grass", drop = "default:grass_1", sound = "floodables_grass", gain = 0.2 }, + { group = "dry_grass", drop = "default:dry_grass_1", sound = "floodables_grass", gain = 0.2 }, +-- { name = "default:dirt_with_grass", erode = true }, +} + +for _,c in ipairs(floodables) do + if c.name ~=nil then + minetest.override_item(c.name, { + floodable = true, + on_flood = function(pos, oldnode, newnode) + minetest.remove_node(pos) + if c.sound ~= nil then + minetest.sound_play({ name = c.sound, gain = c.gain }, { pos = pos, max_hear_distance = 16 }) + end + if c.drop == nil or c.drop ~= false then c.drop = c.name end + minetest.add_item(pos, {name = c.drop}) + if c.erode == true then + minetest.remove_node( { x = pos.x, y = pos.y-1, z = pos.z } ) + end + end + }) + elseif c.group ~=nil then + for _,v in pairs(minetest.registered_nodes) do + if minetest.get_item_group(v.name, c.group) ~= 0 then + minetest.override_item(v.name, { + floodable = true, + on_flood = function(pos, oldnode, newnode) + minetest.remove_node(pos) + if c.sound ~= nil then + minetest.sound_play({ name = c.sound, gain = c.gain }, { pos = pos, max_hear_distance = 16 }) + end + if c.drop == nil or c.drop == true then c.drop = v.name end + minetest.add_item(pos, {name = c.drop}) + if c.erode == true then + minetest.remove_node( { x = pos.x, y = pos.y-1, z = pos.z } ) + end + end + }) + end + end + end +end diff --git a/sounds/floodables_grass.1.ogg b/sounds/floodables_grass.1.ogg new file mode 100644 index 0000000..dfb8177 Binary files /dev/null and b/sounds/floodables_grass.1.ogg differ diff --git a/sounds/floodables_grass.2.ogg b/sounds/floodables_grass.2.ogg new file mode 100644 index 0000000..ecb055f Binary files /dev/null and b/sounds/floodables_grass.2.ogg differ diff --git a/sounds/floodables_grass.3.ogg b/sounds/floodables_grass.3.ogg new file mode 100644 index 0000000..4ecdc94 Binary files /dev/null and b/sounds/floodables_grass.3.ogg differ diff --git a/sounds/floodables_plant.1.ogg b/sounds/floodables_plant.1.ogg new file mode 100644 index 0000000..250408a Binary files /dev/null and b/sounds/floodables_plant.1.ogg differ diff --git a/sounds/floodables_plant.2.ogg b/sounds/floodables_plant.2.ogg new file mode 100644 index 0000000..dbe0844 Binary files /dev/null and b/sounds/floodables_plant.2.ogg differ diff --git a/sounds/floodables_plant.3.ogg b/sounds/floodables_plant.3.ogg new file mode 100644 index 0000000..dbe0844 Binary files /dev/null and b/sounds/floodables_plant.3.ogg differ diff --git a/sounds/floodables_torch.ogg b/sounds/floodables_torch.ogg new file mode 100644 index 0000000..a94a6cd Binary files /dev/null and b/sounds/floodables_torch.ogg differ diff --git a/sounds/license.txt b/sounds/license.txt new file mode 100644 index 0000000..6241991 --- /dev/null +++ b/sounds/license.txt @@ -0,0 +1,7 @@ +# Extinguish sound +Attribution 3.0 Unported (CC BY 3.0) +Extrapolated from https://www.freesound.org/people/VlatkoBlazek/sounds/264811/ +Vlatko Blažek +Varaždin, Croatia +e-mail: vlatkoblazek@gmail.com +http://www.freesound.org/people/VlatkoBlazek/