From dc1053d3f1425e650feba39f0ceebc81a1dd52b0 Mon Sep 17 00:00:00 2001 From: Ombridride Date: Mon, 26 Jan 2015 00:03:27 +0100 Subject: [PATCH] Update snow mod to 3.2 version --- mods/snow/changelog.txt | 5 +++++ mods/snow/init.lua | 1 + mods/snow/readme.txt | 2 +- mods/snow/src/falling_snow.lua | 8 ++++---- mods/snow/src/mapgen.lua | 22 +++++++++++----------- mods/snow/src/mapgen_v6.lua | 2 +- mods/snow/src/nodes.lua | 2 +- mods/snow/src/sled.lua | 6 +++--- mods/snow/src/snowball.lua | 7 +++++++ mods/snow/src/stairsplus.lua | 2 +- 10 files changed, 35 insertions(+), 22 deletions(-) diff --git a/mods/snow/changelog.txt b/mods/snow/changelog.txt index 34aff145..02dd11ef 100755 --- a/mods/snow/changelog.txt +++ b/mods/snow/changelog.txt @@ -1,5 +1,10 @@ CHANGELOG: ------------ + +Version 3.2 + + Update compatibility to the latest minetest. + Version 0.3.1 Paramat's rewrite of mapgenv6.lua: bugfixes, use noisemaps for big speed increase diff --git a/mods/snow/init.lua b/mods/snow/init.lua index 2c033a1d..733f6f8c 100755 --- a/mods/snow/init.lua +++ b/mods/snow/init.lua @@ -128,6 +128,7 @@ snow.is_uneven = function(pos) local found local foundx local foundy + local foundz for x=-1,1 do for z=-1,1 do local node = get_node({x=pos.x+x,y=pos.y,z=pos.z+z}) diff --git a/mods/snow/readme.txt b/mods/snow/readme.txt index 0ee89cd7..13013b40 100755 --- a/mods/snow/readme.txt +++ b/mods/snow/readme.txt @@ -5,7 +5,7 @@ ____) | | | | (_) \ V V / | | | | (_) | (_| | |_____/|_| |_|\___/ \_/\_/ |_| |_|\___/ \__,_| - Version 3.1 + Version 3.2 By Splizard and LazyJ. diff --git a/mods/snow/src/falling_snow.lua b/mods/snow/src/falling_snow.lua index 963ff447..5192b3b9 100755 --- a/mods/snow/src/falling_snow.lua +++ b/mods/snow/src/falling_snow.lua @@ -79,7 +79,7 @@ if snow.enable_snowfall then local get_snow = function(pos) --Legacy support. if weather_legacy == "snow" then - local perlin1 = minetest.get_perlin(112,3, 0.5, 150) + local perlin1 = minetest.env:get_perlin(112,3, 0.5, 150) if perlin1:get2d( {x=pos.x, y=pos.z} ) > 0.53 then return true else @@ -106,13 +106,13 @@ if snow.enable_snowfall then local snow_fall=function (pos, player, animate) local ground_y = nil for y=pos.y+10,pos.y+20,1 do - local n = minetest.get_node({x=pos.x,y=y,z=pos.z}).name + local n = minetest.env:get_node({x=pos.x,y=y,z=pos.z}).name if n ~= "air" and n ~= "ignore" then return end end for y=pos.y+10,pos.y-15,-1 do - local n = minetest.get_node({x=pos.x,y=y,z=pos.z}).name + local n = minetest.env:get_node({x=pos.x,y=y,z=pos.z}).name if n ~= "air" and n ~= "ignore" then ground_y = y break @@ -151,7 +151,7 @@ if snow.enable_snowfall then local smaxp = addvectors(ppos, {x= 20, y=0, z= 20}) -- Make sure player is not in a cave/house... - if get_snow(ppos) and minetest.get_node_light(ppos, 0.5) == 15 then + if get_snow(ppos) and minetest.env:get_node_light(ppos, 0.5) == 15 then local minp = addvectors(ppos, {x=-9, y=3, z=-9}) local maxp = addvectors(ppos, {x= 9, y=5, z= 9}) diff --git a/mods/snow/src/mapgen.lua b/mods/snow/src/mapgen.lua index 7bfef6c2..1b42c8f1 100755 --- a/mods/snow/src/mapgen.lua +++ b/mods/snow/src/mapgen.lua @@ -68,30 +68,30 @@ local xmas_tree = { --Makes pine tree function snow.make_pine(pos,snow,xmas) - - local perlin1 = minetest.get_perlin(112,3, 0.5, 150) + local env = minetest.env + local perlin1 = env:get_perlin(112,3, 0.5, 150) local try_node = function(pos, node) - local n = minetest.get_node(pos).name + local n = env:get_node(pos).name if n == "air" or n == "ignore" then - minetest.add_node(pos,node) + env:add_node(pos,node) end end --Clear ground. for x=-1,1 do for z=-1,1 do - if minetest.get_node({x=pos.x+x,y=pos.y,z=pos.z+z}).name == "default:snow" then - minetest.remove_node({x=pos.x+x,y=pos.y,z=pos.z+z}) + if env:get_node({x=pos.x+x,y=pos.y,z=pos.z+z}).name == "default:snow" then + env:remove_node({x=pos.x+x,y=pos.y,z=pos.z+z}) end - if minetest.get_node({x=pos.x+x,y=pos.y,z=pos.z+z}).name == "default:snowblock" then - minetest.remove_node({x=pos.x+x,y=pos.y,z=pos.z+z}) + if env:get_node({x=pos.x+x,y=pos.y,z=pos.z+z}).name == "default:snowblock" then + env:remove_node({x=pos.x+x,y=pos.y,z=pos.z+z}) end end end if xmas then - minetest.remove_node(pos) - minetest.spawn_tree(pos, xmas_tree) + env:remove_node(pos) + minetest.env:spawn_tree(pos, xmas_tree) else - minetest.spawn_tree(pos, pine_tree) + minetest.env:spawn_tree(pos, pine_tree) end if snow then local x,z = pos.x,pos.z diff --git a/mods/snow/src/mapgen_v6.lua b/mods/snow/src/mapgen_v6.lua index 9f9453ed..414fddc2 100755 --- a/mods/snow/src/mapgen_v6.lua +++ b/mods/snow/src/mapgen_v6.lua @@ -106,7 +106,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local plain = biome == 2 -- spawns not much local alpine = biome == 3 -- rocky terrain -- Water biomes - local biome2 = pr:next(1, 5) + biome2 = pr:next(1, 5) local cool = biome == 1 -- only spawns ice on edge of water local icebergs = biome == 2 local icesheet = biome == 3 diff --git a/mods/snow/src/nodes.lua b/mods/snow/src/nodes.lua index a6113c20..cd6d02f8 100755 --- a/mods/snow/src/nodes.lua +++ b/mods/snow/src/nodes.lua @@ -66,7 +66,7 @@ end --Christmas easter egg minetest.register_on_mapgen_init( function() - if minetest.get_modpath("skins") ~= nil then + if skins then skins.add("character_snow_man") end end diff --git a/mods/snow/src/sled.lua b/mods/snow/src/sled.lua index 3d6fbb0a..de20bace 100755 --- a/mods/snow/src/sled.lua +++ b/mods/snow/src/sled.lua @@ -53,7 +53,7 @@ than I originally planned. :p ~ LazyJ -- local function is_water(pos) - local nn = minetest:get_node(pos).name + local nn = minetest.env:get_node(pos).name return minetest.get_item_group(nn, "water") ~= 0 end @@ -68,7 +68,7 @@ local sled = { visual = "mesh", mesh = "sled.x", textures = {"sled.png"}, - HUD = nil, + HUD, driver = nil, sliding = false, @@ -182,7 +182,7 @@ minetest.register_craftitem("snow:sled", { local player_pos = placer:getpos() if not players_sled[name] then if minetest.get_node({x=player_pos.x,y=player_pos.y, z=player_pos.z}).name == "default:snow" then - local sled = minetest:add_entity(pos, "snow:sled") + local sled = minetest.env:add_entity(pos, "snow:sled") sled:get_luaentity():on_rightclick(placer) end end diff --git a/mods/snow/src/snowball.lua b/mods/snow/src/snowball.lua index cb7468c0..89a78e86 100755 --- a/mods/snow/src/snowball.lua +++ b/mods/snow/src/snowball.lua @@ -130,6 +130,13 @@ minetest.override_item("default:snow", { } } }, + leveled = 7, + node_box = { + type = "leveled", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.5, 0.5}, + }, + }, groups = {cracky=3, crumbly=3, choppy=3, oddly_breakable_by_hand=3,falling_node=1, melts=2, float=1}, sunlight_propagates = true, --Disable placement prediction for snow. diff --git a/mods/snow/src/stairsplus.lua b/mods/snow/src/stairsplus.lua index c143c31d..011fd851 100755 --- a/mods/snow/src/stairsplus.lua +++ b/mods/snow/src/stairsplus.lua @@ -264,7 +264,7 @@ local snow_nodes = { "snow_brick", "snow_cobble", } -local drop = nil + for _, name in pairs(snow_nodes) do local nodename = "snow:"..name local ndef = minetest.registered_nodes[nodename]