Initial commit
This commit is contained in:
commit
c7d5ff00de
4
README.txt
Normal file
4
README.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
rain 0.1.0 by paramat
|
||||||
|
For latest stable Minetest back to 0.4.8
|
||||||
|
Depends default bucket
|
||||||
|
Licenses: code WTFPL, textures CC BY-SA
|
1
depends.txt
Normal file
1
depends.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
default
|
109
init.lua
Normal file
109
init.lua
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
-- rain 0.1.0 by paramat
|
||||||
|
-- For latest stable Minetest and back to 0.4.8
|
||||||
|
-- Depends default bucket
|
||||||
|
-- License: code WTFPL, textures CC BY-SA
|
||||||
|
|
||||||
|
-- Parameters
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Nodes
|
||||||
|
|
||||||
|
minetest.register_node("rain:cloud", {
|
||||||
|
description = "Rain Cloud",
|
||||||
|
drawtype = "glasslike",
|
||||||
|
tiles = {"rain_cloud.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
is_ground_content = false,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
pointable = false,
|
||||||
|
diggable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
post_effect_color = {a=23, r=241, g=248, b=255},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("rain:rain", {
|
||||||
|
description = "Rain",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = {
|
||||||
|
{
|
||||||
|
name="rain_rain.png",
|
||||||
|
animation={type="vertical_frames",
|
||||||
|
aspect_w=16, aspect_h=16, length=0.25}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
is_ground_content = false,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
pointable = false,
|
||||||
|
diggable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- ABM
|
||||||
|
|
||||||
|
-- Spawn raincloud above grass
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"default:dirt_with_grass"},
|
||||||
|
interval = 13,
|
||||||
|
chance = 2048,
|
||||||
|
action = function(pos, node)
|
||||||
|
local x = pos.x
|
||||||
|
local y = pos.y
|
||||||
|
local z = pos.z
|
||||||
|
local c_air = minetest.get_content_id("air")
|
||||||
|
local c_rain = minetest.get_content_id("rain:rain")
|
||||||
|
local c_cloud = minetest.get_content_id("rain:cloud")
|
||||||
|
|
||||||
|
local vm = minetest.get_voxel_manip() -- volume for cloud check
|
||||||
|
local pos1 = {x=x-64, y=104, z=z-64}
|
||||||
|
local pos2 = {x=x+95, y=104, z=z+95}
|
||||||
|
local emin, emax = vm:read_from_map(pos1, pos2)
|
||||||
|
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||||
|
local data = vm:get_data()
|
||||||
|
|
||||||
|
for vi in area:iterp(emin, emax) do -- check volume is clear of cloud
|
||||||
|
if data[vi] == c_cloud then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local vm = minetest.get_voxel_manip()
|
||||||
|
local pos1 = {x=x, y=y-48, z=z}
|
||||||
|
local pos2 = {x=x+31, y=y+134, z=z+31}
|
||||||
|
local emin, emax = vm:read_from_map(pos1, pos2)
|
||||||
|
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||||
|
local data = vm:get_data()
|
||||||
|
local vvii = emax.x - emin.x + 1 -- vertical vi interval
|
||||||
|
-- local nvii = (emax.y - emin.y + 1) * vvii
|
||||||
|
|
||||||
|
for y = 104, 135 do -- spawn cloud and rain columns
|
||||||
|
for k = 0, 31 do
|
||||||
|
local vi = area:index(x, y, z + k)
|
||||||
|
for i = 0, 31 do
|
||||||
|
data[vi] = c_cloud
|
||||||
|
if y == 104 and math.random() < 0.25
|
||||||
|
and k >= 4 and k <= 27 and i >= 4 and i <= 27 then
|
||||||
|
local vir = vi - vvii
|
||||||
|
for fall = 1, 144 do
|
||||||
|
if data[vir] == c_air then
|
||||||
|
data[vir] = c_rain
|
||||||
|
else
|
||||||
|
break
|
||||||
|
end
|
||||||
|
vir = vir - vvii
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vi = vi + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vm:set_data(data)
|
||||||
|
vm:write_to_map()
|
||||||
|
vm:update_map()
|
||||||
|
end,
|
||||||
|
})
|
14
license.txt
Normal file
14
license.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
Version 2, December 2004
|
||||||
|
|
||||||
|
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim or modified
|
||||||
|
copies of this license document, and changing it is allowed as long
|
||||||
|
as the name is changed.
|
||||||
|
|
||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||||
|
|
BIN
textures/rain_cloud.png
Normal file
BIN
textures/rain_cloud.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 136 B |
BIN
textures/rain_rain.png
Normal file
BIN
textures/rain_rain.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Loading…
x
Reference in New Issue
Block a user