summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2015-05-09 23:15:54 -0700
committerAuke Kok <auke-jan.h.kok@intel.com>2015-05-09 23:15:54 -0700
commitc210807fe440522bd2d368e22db26ecd8686aaf3 (patch)
tree7b18e6b3ec8aed4652d400f6db556372725a99ea
parent6c32b3c6c1e41f010d560617eed31075a92370d3 (diff)
Add particles showing plants being watered.
Supposed to be a visual reinforcement that water actually made it to the plant. The particles are drops of water that fall down from the plant that was watered.
-rw-r--r--init.lua22
-rw-r--r--textures/crops_watering.pngbin0 -> 117 bytes
2 files changed, 21 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index fbef295..2e107bb 100644
--- a/init.lua
+++ b/init.lua
@@ -163,7 +163,7 @@ crops.particles = function(pos, flag)
texture = "crops_wither.png",
vertical = true,
}
- else
+ elseif flag == 1 then
-- soak (1)
p = {
amount = 8 * crops.settings.interval,
@@ -182,6 +182,24 @@ crops.particles = function(pos, flag)
texture = "crops_soak.png",
vertical = false,
}
+ else -- watering (2)
+ p = {
+ amount = 30,
+ time = 3,
+ minpos = { x = pos.x - 0.4, y = pos.y - 0.4, z = pos.z - 0.4 },
+ maxpos = { x = pos.x + 0.4, y = pos.y + 0.4, z = pos.z + 0.4 },
+ minvel = { x = 0, y = 0.0, z = 0 },
+ maxvel = { x = 0, y = 0.0, z = 0 },
+ minacc = { x = 0, y = -9.81, z = 0 },
+ maxacc = { x = 0, y = -9.81, z = 0 },
+ minexptime = 2,
+ maxexptime = 2,
+ minsize = 1,
+ maxsize = 3,
+ collisiondetection = false,
+ texture = "crops_watering.png",
+ vertical = true,
+ }
end
minetest.add_particlespawner(p)
end
@@ -196,6 +214,7 @@ minetest.register_tool("crops:watering_can", {
tool_capabilities = {},
on_use = function(itemstack, user, pointed_thing)
local pos = pointed_thing.under
+ local ppos = pos
if pos == nil then
return itemstack
end
@@ -222,6 +241,7 @@ minetest.register_tool("crops:watering_can", {
if wear == 65534 then
return itemstack
end
+ crops.particles(ppos, 2)
water = math.min(water + crops.settings.watercan, crops.settings.watercan_max)
meta:set_int("crops_water", water)
diff --git a/textures/crops_watering.png b/textures/crops_watering.png
new file mode 100644
index 0000000..a63053e
--- /dev/null
+++ b/textures/crops_watering.png
Binary files differ