From 0708ea6af3243304887958e6c88e7ef31550a3e9 Mon Sep 17 00:00:00 2001 From: HybridDog Date: Tue, 26 May 2015 20:55:13 +0200 Subject: [PATCH] change debug comment --- src/mapgen_v6.lua | 40 +++++++++------------------------------- src/sled.lua | 3 +-- src/util.lua | 2 +- 3 files changed, 11 insertions(+), 34 deletions(-) diff --git a/src/mapgen_v6.lua b/src/mapgen_v6.lua index ea31a27..ec69947 100644 --- a/src/mapgen_v6.lua +++ b/src/mapgen_v6.lua @@ -22,32 +22,13 @@ local np_ice = { -- Debugging function -local biome_to_string = function(num,num2) - local biome, biome2 - if num == 1 then - biome = "snowy" - elseif num == 2 then - biome = "plain" - elseif num == 3 then - biome = "alpine" - elseif num == 4 or num == 5 then - biome = "normal" - else - biome = "unknown "..num - end - if num2 == 1 then - biome2 = "cool" - elseif num2 == 2 then - biome2 = "icebergs" - elseif num2 == 3 then - biome2 = "icesheet" - elseif num2 == 4 then - biome2 = "icecave" - elseif num2 == 5 then - biome2 = "icehole" - else - biome2 = "unknown "..num - end +local biome_strings = { + {"snowy", "plain", "alpine", "normal", "normal"}, + {"cool", "icebergs", "icesheet", "icecave", "icehole"} +} +local function biome_to_string(num,num2) + local biome = biome_strings[1][num] or "unknown "..num + local biome2 = biome_strings[2][num2] or "unknown "..num2 return biome, biome2 end @@ -61,11 +42,8 @@ minetest.register_on_generated(function(minp, maxp, seed) local x1 = maxp.x local z1 = maxp.z - local debug = snow.debug - local min_height = snow.min_height local spawn_pine = snow.voxelmanip_pine local smooth = snow.smooth_biomes - local legacy = snow.legacy local c_dirt_with_grass = minetest.get_content_id("default:dirt_with_grass") local c_dirt = minetest.get_content_id("default:dirt") @@ -93,7 +71,6 @@ minetest.register_on_generated(function(minp, maxp, seed) local sidelen = x1 - x0 + 1 local chulens = {x=sidelen, y=sidelen, z=sidelen} - local minpos = {x=x0, y=z0} local nvals_cold = minetest.get_perlin_map(np_cold, chulens):get2dMap_flat({x=x0, y=z0}) local nvals_ice = minetest.get_perlin_map(np_ice, chulens):get2dMap_flat({x=x0, y=z0}) @@ -305,7 +282,8 @@ minetest.register_on_generated(function(minp, maxp, seed) vm:calc_lighting() vm:write_to_map() - if write_to_map and debug then -- print if any column of mapchunk was snow biome + if write_to_map + and snow.debug then -- print if any column of mapchunk was snow biome local biome_string,biome2_string = biome_to_string(biome,biome2) local chugent = math.ceil((os.clock() - t1) * 1000) print("[snow] "..biome_string.." and "..biome2_string.." x "..minp.x.." z "..minp.z.." time "..chugent.." ms") diff --git a/src/sled.lua b/src/sled.lua index c965527..98f0ec2 100644 --- a/src/sled.lua +++ b/src/sled.lua @@ -161,8 +161,7 @@ function sled:on_step(dtime) p.y = p.y+0.4 local s = self.object:getpos() s.y = s.y -0.5 - local keys = self.driver:get_player_control() - if keys["sneak"] + if self.driver:get_player_control().sneak or is_water(p) or not minetest.find_node_near(s, 1, {"default:snow","default:snowblock","default:ice","default:dirt_with_snow", "group:icemaker"}) then -- LazyJ self.driver:set_physics_override({ diff --git a/src/util.lua b/src/util.lua index a9e42e2..35f9ee5 100644 --- a/src/util.lua +++ b/src/util.lua @@ -17,7 +17,7 @@ local doc = { sleds = "Disable this to prevent sleds from being riden.", enable_snowfall = "Enables falling snow.", lighter_snowfall = "Reduces the amount of resources and fps used by snowfall.", - debug = "Enables debug output.", + debug = "Enables debug output. Currently it only prints mgapgen_v6 info.", smooth_biomes = "Enables smooth transition of biomes", christmas_content = "Disable this to remove christmas saplings from being found.", smooth_snow = "Disable this to stop snow from being smoothed.",