2 -- Based on the Dripping Water Mod by kddekadenz
5 --TODO: Get proper random seed based on world seed or something like that
6 math
.randomseed(4053633)
9 minetest
.register_entity("pedology:drop_water", {
12 collisionbox
= {0,0,0,0,0,0},
14 visual_size
= {x
=0.05, y
=0.1},
15 textures
= {"pedology_water_fresh.png", "pedology_water_fresh.png", "pedology_water_fresh.png", "pedology_water_fresh.png", "pedology_water_fresh.png", "pedology_water_fresh.png"},
16 spritediv
= {x
=1, y
=1},
17 initial_sprite_basepos
= {x
=0, y
=0},
19 on_activate
= function(self
, staticdata
)
20 self
.object
:setsprite({x
=0,y
=0}, 1, 1, true)
23 on_step
= function(self
, dtime
)
24 local k
= math
.random(1,222)
25 local ownpos
= self
.object
:getpos()
28 self
.object
:setacceleration({x
=0, y
=-5, z
=0})
31 if minetest
.env
:get_node({x
=ownpos
.x
, y
=ownpos
.y
+0.5, z
=ownpos
.z
}).name
== "air" then
32 self
.object
:setacceleration({x
=0, y
=-5, z
=0})
35 if minetest
.env
:get_node({x
=ownpos
.x
, y
=ownpos
.y
-0.5, z
=ownpos
.z
}).name
~= "air" then
37 minetest
.sound_play({name
="pedology_drip"}, {pos
= ownpos
, gain
= 0.5, max_hear_distance
= 8})
42 function pedology
.create_drip(pos
)
43 if minetest
.env
:get_node({x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
}).name
== "air" and
44 minetest
.env
:get_node({x
=pos
.x
, y
=pos
.y
-2, z
=pos
.z
}).name
== "air" then
45 local i
= math
.random(-45,45) / 100
46 minetest
.env
:add_entity({x
=pos
.x
+ i
, y
=pos
.y
- 0.5, z
=pos
.z
+ i
}, "pedology:drop_water")