Page 1 of 6

[Mod] Weather (Snow, Rain) [weather]

Posted: Sun Mar 24, 2013 16:14
by Jeija
Introducing: The weather mod (WIP)

Image
Image

At the moment it contains rain and snow. Snow will pile up if you uncomment a section in snow.lua where it says only for faster PCs.

It randomly starts and stops raining / snowing.
You can also manually control the precipitation using

Code: Select all

/setweather rain
/setweather snow
/setweather none
(requires weather privilege)

Download
as .zip | as .tar.gz

GitHub
Project page
Clone link

Make sure you are running the latest Git of Minetest and enable particles!

Dependencies: none
License:
  • Code: LGPL
  • Textures:
  • Snow cover: WTFPL
  • Rain / Snow: CC-BY-SA 3.0, credit goes to TeddyDesTodes, from his weather branch

Posted: Sun Mar 24, 2013 17:22
by Nore
A little suggestion for snow:

Code: Select all

-- Snow cover
for i=1,8 do
    local snow_box =
    {
        type  = "fixed",
        fixed = {-0.5, -0.5, -0.5, 0.5, -0.5 + i/8., 0.5}
    }
    minetest.register_node("weather:snow_cover"..tostring(i), {
        tiles = {"weather_snow_cover.png"},
        drawtype = "nodebox",
        paramtype = "light",
        node_box = snow_box,
        selection_box = snow_box,
        groups = {not_in_creative_inventory = 1, crumbly = 3, attached_node = 1},
        drop = {}
    })
end

minetest.register_alias("weather:snow_cover","weather:snow_cover1")
--[[ Enable this section if you have a very fast PC]]
minetest.register_abm({
    nodenames = {"group:crumbly", "group:snappy", "group:cracky", "group:choppy"},
    neighbors = {"default:air"},
    interval = 10.0, 
    chance = 80,
    action = function (pos, node, active_object_count, active_object_count_wider)
        if weather == "snow" then
            if minetest.registered_nodes[node.name].drawtype == "normal"
            or minetest.registered_nodes[node.name].drawtype == "allfaces_optional" then
                local np = addvectors(pos, {x=0, y=1, z=0})
                if minetest.env:get_node_light(np, 0.5) == 15 and minetest.env:get_node(np).name=="air" then
                    minetest.env:add_node(np, {name="weather:snow_cover1"})
                end
            end
            local np = addvectors(pos, {x=0, y=1, z=0})
            if minetest.env:get_node_light(np, 0.5) == 15 then
                if node.name:find("weather:snow_cover")~=nil and node.name:sub(-1)~="8" then
                    minetest.env:set_node(pos,{name="weather:snow_cover"..tostring(1+tonumber(node.name:sub(-1)))})
                else
                    if minetest.env:get_node(np).name=="air" then
                        minetest.env:add_node(np, {name="weather:snow_cover1"})
                    end
                end
            end
        end
    end
})

The snow stacks, with 8 layers per node.

Posted: Sun Mar 24, 2013 18:07
by snakevenom
my computer just had a heart attack

cool though

Posted: Mon Mar 25, 2013 04:51
by Splizard
Can I modify this for snow mod (GPL3/later)?

Posted: Mon Mar 25, 2013 05:24
by Nore
My code is WTFPL.

Posted: Mon Mar 25, 2013 06:47
by Jeija
My code is LGPL, so yes, that's possible. But make sure you give credit to me and TeddyDesTodes.

Posted: Mon Mar 25, 2013 07:17
by Splizard
Jeija wrote:My code is LGPL, so yes, that's possible. But make sure you give credit to me and TeddyDesTodes.
Alright thanks.

Posted: Mon Mar 25, 2013 09:36
by Dopium
Awesome this is what i been waiting for, too cool man.
+1

Edit: What to rename the folder to? I cant get it to work is same deal with animals aswell, none the other mods i use have this problem

debug: 20:14:52: ERROR[main]: Server: Failed to load and run C:\Documents and Settings\Dopium\Desktop\Latest Minetest 0.4.4 Complete With Mods Working\Minetest 0.4.5\minetest-0.4.5\bin\..\mods\minetest\weather\init.lua
20:14:52: ERROR[main]: ModError: Failed to load and run C:\Documents and Settings\Dopium\Desktop\Latest Minetest 0.4.4 Complete With Mods Working\Minetest 0.4.5\minetest-0.4.5\bin\..\mods\minetest\weather\init.lua

Posted: Mon Mar 25, 2013 10:35
by rarkenin
Dopium wrote:Awesome this is what i been waiting for, too cool man.
+1

Edit: What to rename the folder to? I cant get it to work is same deal with animals aswell, none the other mods i use have this problem

debug: 20:14:52: ERROR[main]: Server: Failed to load and run C:\Documents and Settings\Dopium\Desktop\Latest Minetest 0.4.4 Complete With Mods Working\Minetest 0.4.5\minetest-0.4.5\bin\..\mods\minetest\weather\init.lua
20:14:52: ERROR[main]: ModError: Failed to load and run C:\Documents and Settings\Dopium\Desktop\Latest Minetest 0.4.4 Complete With Mods Working\Minetest 0.4.5\minetest-0.4.5\bin\..\mods\minetest\weather\init.lua
Please post the error on the terminal window, below a line that says something like "Error from Lua:"

Posted: Mon Mar 25, 2013 10:50
by Dopium
Says the same thing as the debug: ========== ERROR FROM LUA ===========
21:13:18: ERROR[main]: Failed to load and run script from
21:13:18: ERROR[main]: C:\Documents and Settings\Dopium\Desktop\Latest Minetest 0.4.4 Complete With Mods Working\Minetest 0.4.5\minetest-0.4.5\bin\..\mods\minetest\weather\init.lua:
21:13:18: ERROR[main]: ...minetest-0.4.5\bin\..\mods\minetest\weather\init.lua:6: I told you to run the latest GitHub!
21:13:18: ERROR[main]: stack traceback:
21:13:18: ERROR[main]: [C]: in function 'assert'
21:13:18: ERROR[main]: ...minetest-0.4.5\bin\..\mods\minetest\weather\init.lua:6: in main chunk
21:13:18: ERROR[main]: =======END OF ERROR FROM LUA ========
21:13:18: ERROR[main]: Server: Failed to load and run C:\Documents and Settings\Dopium\Desktop\Latest Minetest 0.4.4 Complete With Mods Working\Minetest 0.4.5\minetest-0.4.5\bin\..\mods\minetest\weather\init.lua
21:13:18: ERROR[main]: ModError: Failed to load and run C:\Documents and Settings\Dopium\Desktop\Latest Minetest 0.4.4 Complete With Mods Working\Minetest 0.4.5\minetest-0.4.5\bin\..\mods\minetest\weather\init.lua

Starting to pull my hair out over this i have changed the folder name many many times i have installed the sub directory still nothing. I really dont understand as i have installed 100's of mods before and the only 2 i have problems with is this and animals. Cant even see the difference these mods have to any others, doesnt matter if i use Adams builds either i get the same error. I know im over looking something simple but this is so frustrating

Posted: Mon Mar 25, 2013 10:52
by kaeza
Dopium wrote:21:13:18: ERROR[main]: ...minetest-0.4.5\bin\..\mods\minetest\weather\init.lua:6: I told you to run the latest GitHub!
'nuff said
Your minetest is too old and does not have particle spawners.
EDIT: Ask PilzAdam to create a new build.

Posted: Mon Mar 25, 2013 11:04
by Dopium
kaeza wrote:
Dopium wrote:21:13:18: ERROR[main]: ...minetest-0.4.5\bin\..\mods\minetest\weather\init.lua:6: I told you to run the latest GitHub!
'nuff said
Your minetest is too old and does not have particle spawners.
EDIT: Ask PilzAdam to create a new build.

Ok thanks for the help i did notice but thought Adams build was up to date, anyway i will ask, if not wait for 0.4.6. Thanks again.

Posted: Mon Mar 25, 2013 11:08
by kaeza
Just tested this mod. It's pure Awesomeness™!

Posted: Mon Mar 25, 2013 11:18
by PilzAdam
The build 57cbb8b-oregen contains the required functions.

Posted: Mon Mar 25, 2013 11:29
by Dopium
PilzAdam wrote:The build 57cbb8b-oregen contains the required functions.
Yes sorry about that, however i am getting dummy image errors with pressure plates and some the mescon items. I have enable_texture_atlas = false but still have errors. Bare with me im am still a bit of a newbie with coding anyway here is the debug:
21:56:38: ERROR[main]: generate_image(): Could not load image "jeija_pressure_plate_stone_off.png" while building texture
21:56:38: ERROR[main]: generate_image(): Creating a dummy image for "jeija_pressure_plate_stone_off.png"
21:56:38: ERROR[main]: generate_image(): Could not load image "mesecons_piston_pusher_front_sticky.png" while building texture
21:56:38: ERROR[main]: generate_image(): Creating a dummy image for "mesecons_piston_pusher_front_sticky.png"
21:56:39: ERROR[main]: generate_image(): Could not load image "jeija_insulated_wire_sides_off.png" while building texture
21:56:39: ERROR[main]: generate_image(): Creating a dummy image for "jeija_insulated_wire_sides_off.png"
21:56:39: ERROR[main]: generate_image(): Could not load image "jeija_insulated_wire_tjunction_tb_on.png" while building texture
21:56:39: ERROR[main]: generate_image(): Creating a dummy image for "jeija_insulated_wire_tjunction_tb_on.png"
21:56:39: ERROR[main]: generate_image(): Could not load image "jeija_insulated_wire_tjunction_tb_off.png" while building texture
21:56:39: ERROR[main]: generate_image(): Creating a dummy image for "jeija_insulated_wire_tjunction_tb_off.png"
21:56:39: ERROR[main]: generate_image(): Could not load image "jeija_insulated_wire_curved_tb_on.png" while building texture
21:56:39: ERROR[main]: generate_image(): Creating a dummy image for "jeija_insulated_wire_curved_tb_on.png"
21:56:39: ERROR[main]: generate_image(): Could not load image "jeija_insulated_wire_curved_tb_off.png" while building texture
21:56:39: ERROR[main]: generate_image(): Creating a dummy image for "jeija_insulated_wire_curved_tb_off.png"
Font size: 8 17

My mesecons mod too old?

Posted: Mon Mar 25, 2013 11:36
by PilzAdam
Dopium wrote:
PilzAdam wrote:The build 57cbb8b-oregen contains the required functions.
Yes sorry about that, however i am getting dummy image errors with pressure plates and some the mescon items. I have enable_texture_atlas = false but still have errors. Bare with me im am still a bit of a newbie with coding anyway here is the debug:
21:56:38: ERROR[main]: generate_image(): Could not load image "jeija_pressure_plate_stone_off.png" while building texture
21:56:38: ERROR[main]: generate_image(): Creating a dummy image for "jeija_pressure_plate_stone_off.png"
21:56:38: ERROR[main]: generate_image(): Could not load image "mesecons_piston_pusher_front_sticky.png" while building texture
21:56:38: ERROR[main]: generate_image(): Creating a dummy image for "mesecons_piston_pusher_front_sticky.png"
21:56:39: ERROR[main]: generate_image(): Could not load image "jeija_insulated_wire_sides_off.png" while building texture
21:56:39: ERROR[main]: generate_image(): Creating a dummy image for "jeija_insulated_wire_sides_off.png"
21:56:39: ERROR[main]: generate_image(): Could not load image "jeija_insulated_wire_tjunction_tb_on.png" while building texture
21:56:39: ERROR[main]: generate_image(): Creating a dummy image for "jeija_insulated_wire_tjunction_tb_on.png"
21:56:39: ERROR[main]: generate_image(): Could not load image "jeija_insulated_wire_tjunction_tb_off.png" while building texture
21:56:39: ERROR[main]: generate_image(): Creating a dummy image for "jeija_insulated_wire_tjunction_tb_off.png"
21:56:39: ERROR[main]: generate_image(): Could not load image "jeija_insulated_wire_curved_tb_on.png" while building texture
21:56:39: ERROR[main]: generate_image(): Creating a dummy image for "jeija_insulated_wire_curved_tb_on.png"
21:56:39: ERROR[main]: generate_image(): Could not load image "jeija_insulated_wire_curved_tb_off.png" while building texture
21:56:39: ERROR[main]: generate_image(): Creating a dummy image for "jeija_insulated_wire_curved_tb_off.png"
Font size: 8 17

My mesecons mod too old?
This happens if the textures dont exist. Maybe redownload mesecons.

Posted: Mon Mar 25, 2013 11:46
by Dopium
I re-downloaded mesecons but unfortunately still getting the same errors, could this have something to do with my OS? Edit: ok so now i have a really weird bug or something, i have noticed as soon as a install messecons to your build it changes the texture names. For example the mesecon torch on ground when intalled to the build is named JE2BEE~1. The weird part is im copy and pasting the mod and before installing its called jeija_torches_on. If i change the texture names it still doesnt recognize the item. I have no idea why this happens its got me stumped

Posted: Mon Mar 25, 2013 12:53
by Gabriele
Nice work ;)

Posted: Mon Mar 25, 2013 13:21
by kaeza

Posted: Thu Mar 28, 2013 22:42
by jordan4ibanez
I had an awesome idea
[18:40:55] <jordan4ibanez> the rain and snow mod
[18:40:58] <jordan4ibanez> that can be improved!
[18:41:10] <jordan4ibanez> air can be mapgen aliased to weather block
[18:41:30] <jordan4ibanez> weather block can be an abm, if there is a block above it, it becomes air
[18:41:50] <jordan4ibanez> if there is air above a weather block it becomes air
[18:42:04] <jordan4ibanez> it doesn't have to be an abm, but called on_block_update or something

Posted: Fri Mar 29, 2013 08:22
by Ragnarok
Jeija! This is amazing! =)

Posted: Sat Mar 30, 2013 10:50
by Matsetes
Very good, I'll try that beautiful stuff!!!

Posted: Sat Mar 30, 2013 12:15
by Traxie21
Is it possible to make snow pile up from the particles instead of ABM's?

Posted: Sat Mar 30, 2013 12:31
by PilzAdam
Traxie21 wrote:Is it possible to make snow pile up from the particles instead of ABM's?
No, there are no callbacks for particles to Lua to make them fast.

Posted: Sat Mar 30, 2013 13:13
by Traxie21
How about attaching particlespawners to entities?