From 20f1a5168e64486fff16f16807f2014797f35b89 Mon Sep 17 00:00:00 2001 From: HybridDog Date: Fri, 22 May 2015 19:43:59 +0200 Subject: add watercan sounds --- LICENSE | 14 ++++++++++++-- init.lua | 27 ++++++++++++++++++++++----- sounds/crops_watercan_entering.ogg | Bin 0 -> 18988 bytes sounds/crops_watercan_splash_big.ogg | Bin 0 -> 21733 bytes sounds/crops_watercan_splash_quiet.ogg | Bin 0 -> 4950 bytes sounds/crops_watercan_splash_small.ogg | Bin 0 -> 5988 bytes 6 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 sounds/crops_watercan_entering.ogg create mode 100644 sounds/crops_watercan_splash_big.ogg create mode 100644 sounds/crops_watercan_splash_quiet.ogg create mode 100644 sounds/crops_watercan_splash_small.ogg diff --git a/LICENSE b/LICENSE index f1bfe07..5a70ce5 100644 --- a/LICENSE +++ b/LICENSE @@ -9,9 +9,19 @@ All source code (lua): (C) Auke Kok LGPL-2.0+ -All textures, models, sounds: +All textures, models: (C) Auke Kok CC-BY-SA-3.0 -=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ +Sounds: + - crops_watercan_splash* + http://freesound.org/people/junggle/sounds/27361/ + http://profiles.google.com/jun66le + CC-BY-3.0 + - crops_watercan_entering.ogg + http://freesound.org/people/Quistard/sounds/166824/ + CC-BY-3.0 + +* Sounds edited with audacity +=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ diff --git a/init.lua b/init.lua index e3fd1f6..3e630a4 100644 --- a/init.lua +++ b/init.lua @@ -110,7 +110,7 @@ crops.plant = function(pos, node) end crops.can_grow = function(pos) - if minetest.get_node_light(pos, nil) < crops.settings.light then + if minetest.get_node_light(pos) < crops.settings.light then return false end local node = minetest.get_node(pos) @@ -214,9 +214,27 @@ minetest.register_tool("crops:watering_can", { return itemstack end -- filling it up? - local node = minetest.get_node(pos) - if minetest.get_item_group(node.name, "water") >= 3 then - itemstack:set_wear(1) + local wear = itemstack:get_wear() + if minetest.get_item_group(minetest.get_node(pos).name, "water") >= 3 then + if wear ~= 1 then + minetest.sound_play("crops_watercan_entering", {pos=pos, gain=0.8}) + minetest.after(math.random()/2, function(pos) + if math.random(2) == 1 then + minetest.sound_play("crops_watercan_splash_quiet", {pos=pos, gain=0.1}) + end + if math.random(3) == 1 then + minetest.after(math.random()/2, function(pos) + minetest.sound_play("crops_watercan_splash_small", {pos=pos, gain=0.7}) + end, pos) + end + if math.random(3) == 1 then + minetest.after(math.random()/2, function(pos) + minetest.sound_play("crops_watercan_splash_big", {pos=pos, gain=0.7}) + end, pos) + end + end, pos) + itemstack:set_wear(1) + end return itemstack end -- using it on a top-half part of a plant? @@ -229,7 +247,6 @@ minetest.register_tool("crops:watering_can", { if water == nil then return itemstack end - local wear = itemstack:get_wear() -- empty? if wear == 65534 then return itemstack diff --git a/sounds/crops_watercan_entering.ogg b/sounds/crops_watercan_entering.ogg new file mode 100644 index 0000000..68212bc Binary files /dev/null and b/sounds/crops_watercan_entering.ogg differ diff --git a/sounds/crops_watercan_splash_big.ogg b/sounds/crops_watercan_splash_big.ogg new file mode 100644 index 0000000..19c4b5e Binary files /dev/null and b/sounds/crops_watercan_splash_big.ogg differ diff --git a/sounds/crops_watercan_splash_quiet.ogg b/sounds/crops_watercan_splash_quiet.ogg new file mode 100644 index 0000000..9518e17 Binary files /dev/null and b/sounds/crops_watercan_splash_quiet.ogg differ diff --git a/sounds/crops_watercan_splash_small.ogg b/sounds/crops_watercan_splash_small.ogg new file mode 100644 index 0000000..7c02b3e Binary files /dev/null and b/sounds/crops_watercan_splash_small.ogg differ -- cgit v1.2.3