Just a thought about the 30x30 cloud/square on the ground. If you randomly added snow to the ground further out without processing the falling snow. That way there wouldn't be any processor load, but it wouldn't look so artificial.
If you use voxel_manip then you force minetest to load the block which would be a bit safer than just hoping a distant block would be correctly set
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local manip = minetest.get_voxel_manip()
manip:read_from_map(p, p)
Actually on the processor load front. Would it be possible to have a non-particle weather option (using animated walkable nodes). Every computer I've tried it on (including multi-processor pcs) have ground to a halt when the rain or snow starts.
Finally, as it is particularly uncool when it rains inside buildings, what about a quick height check? Something like this would work, you probably only need to check within 5-10 nodes of a player, and if wanted to be really efficient and kept it in an array and only tested unknown columns the speed cost should be pretty negligible:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
-- This will fail if ground level is below -100 or an obsticle above 96 (but this doesn't happen very often)
--if more robust code is needed then could start at cloud level and keep going down til you hit non-air
local manip = minetest.get_voxel_manip()
for i = 96, -100, -1 do
p = {x=targetX, y=i, z=targetZ}
manip:read_from_map(p, p)
if minetest.get_node(p).name ~= "air" and minetest.get_node(p).name ~= "ignore" then
groundLevel = i
break
end
end