forked from VoxeLibre/VoxeLibre
Merge branch 'master' into Bamboo-Piston-Dig
This commit is contained in:
commit
dfa849e19a
|
@ -644,6 +644,7 @@ function mob_class:do_env_damage()
|
||||||
end
|
end
|
||||||
|
|
||||||
local nodef = minetest.registered_nodes[self.standing_in]
|
local nodef = minetest.registered_nodes[self.standing_in]
|
||||||
|
local nodef2 = minetest.registered_nodes[self.standing_on]
|
||||||
|
|
||||||
-- rain
|
-- rain
|
||||||
if self.rain_damage > 0 then
|
if self.rain_damage > 0 then
|
||||||
|
@ -675,7 +676,19 @@ function mob_class:do_env_damage()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- magma damage
|
||||||
|
elseif self.fire_damage > 0
|
||||||
|
and (nodef2.groups.fire) then
|
||||||
|
|
||||||
|
if self.fire_damage ~= 0 then
|
||||||
|
|
||||||
|
self.health = self.health - self.fire_damage
|
||||||
|
|
||||||
|
if self:check_for_death("fire", {type = "environment",
|
||||||
|
pos = pos, node = self.standing_in}) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
-- lava damage
|
-- lava damage
|
||||||
elseif self.lava_damage > 0
|
elseif self.lava_damage > 0
|
||||||
and (nodef.groups.lava) then
|
and (nodef.groups.lava) then
|
||||||
|
|
|
@ -11,16 +11,22 @@ function mcl_weather.set_sky_box_clear(player, sky, fog)
|
||||||
local sc = {
|
local sc = {
|
||||||
day_sky = "#7BA4FF",
|
day_sky = "#7BA4FF",
|
||||||
day_horizon = "#C0D8FF",
|
day_horizon = "#C0D8FF",
|
||||||
dawn_sky = "#B4BAFA",
|
dawn_sky = "#7BA4FF",
|
||||||
dawn_horizon = "#BAC1F0",
|
dawn_horizon = "#C0D8FF",
|
||||||
night_sky = "#000000",
|
night_sky = "#000000",
|
||||||
night_horizon = "#4A6790",
|
night_horizon = "#4A6790",
|
||||||
|
indoors = "#C0D8FF",
|
||||||
|
fog_sun_tint = "#ff5f33",
|
||||||
|
fog_moon_tint = nil,
|
||||||
|
fog_tint_type = "custom"
|
||||||
}
|
}
|
||||||
if sky then
|
if sky then
|
||||||
sc.day_sky = sky
|
sc.day_sky = sky
|
||||||
|
sc.dawn_sky = sky
|
||||||
end
|
end
|
||||||
if fog then
|
if fog then
|
||||||
sc.day_horizon = fog
|
sc.day_horizon = fog
|
||||||
|
sc.dawn_horizon = fog
|
||||||
end
|
end
|
||||||
player:set_sky({
|
player:set_sky({
|
||||||
type = "regular",
|
type = "regular",
|
||||||
|
@ -128,8 +134,12 @@ mcl_weather.skycolor = {
|
||||||
dawn_horizon = water_color,
|
dawn_horizon = water_color,
|
||||||
night_sky = water_color,
|
night_sky = water_color,
|
||||||
night_horizon = water_color,
|
night_horizon = water_color,
|
||||||
|
indoors = water_color,
|
||||||
|
fog_sun_tint = water_color,
|
||||||
|
fog_moon_tint = water_color,
|
||||||
|
fog_tint_type = "custom"
|
||||||
},
|
},
|
||||||
clouds = true,
|
clouds = false,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
if dim == "overworld" then
|
if dim == "overworld" then
|
||||||
|
@ -258,6 +268,10 @@ mcl_weather.skycolor = {
|
||||||
dawn_horizon = biomefog,
|
dawn_horizon = biomefog,
|
||||||
night_sky = biomefog,
|
night_sky = biomefog,
|
||||||
night_horizon = biomefog,
|
night_horizon = biomefog,
|
||||||
|
indoors = biomefog,
|
||||||
|
fog_sun_tint = biomefog,
|
||||||
|
fog_moon_tint = biomefog,
|
||||||
|
fog_tint_type = "custom"
|
||||||
},
|
},
|
||||||
clouds = false,
|
clouds = false,
|
||||||
})
|
})
|
||||||
|
|
|
@ -74,7 +74,7 @@ minetest.register_node("mcl_crimson:warped_fungus", {
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1},
|
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1,compostability=65},
|
||||||
light_source = 1,
|
light_source = 1,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
|
@ -109,7 +109,7 @@ minetest.register_node("mcl_crimson:twisting_vines", {
|
||||||
walkable = false,
|
walkable = false,
|
||||||
climbable = true,
|
climbable = true,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
groups = {dig_immediate=3, shearsy=1, vines=1, dig_by_water=1, destroy_by_lava_flow=1, dig_by_piston=1, deco_block=1},
|
groups = {dig_immediate=3, shearsy=1, vines=1, dig_by_water=1, destroy_by_lava_flow=1, dig_by_piston=1, deco_block=1, compostability=50},
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
|
@ -184,7 +184,7 @@ minetest.register_node("mcl_crimson:weeping_vines", {
|
||||||
walkable = false,
|
walkable = false,
|
||||||
climbable = true,
|
climbable = true,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
groups = {dig_immediate=3, shearsy=1, vines=1, dig_by_water=1, destroy_by_lava_flow=1, dig_by_piston=1, deco_block=1},
|
groups = {dig_immediate=3, shearsy=1, vines=1, dig_by_water=1, destroy_by_lava_flow=1, dig_by_piston=1, deco_block=1, compostability=50},
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
|
@ -258,7 +258,7 @@ minetest.register_node("mcl_crimson:nether_sprouts", {
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1, shearsy = 1},
|
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1,shearsy=1,compostability=50},
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
|
@ -280,7 +280,7 @@ minetest.register_node("mcl_crimson:warped_roots", {
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1, shearsy = 1},
|
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1,shearsy = 1,compostability=65},
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
|
@ -301,7 +301,7 @@ mcl_flowerpots.register_potted_flower("mcl_crimson:warped_roots", {
|
||||||
minetest.register_node("mcl_crimson:warped_wart_block", {
|
minetest.register_node("mcl_crimson:warped_wart_block", {
|
||||||
description = S("Warped Wart Block"),
|
description = S("Warped Wart Block"),
|
||||||
tiles = {"warped_wart_block.png"},
|
tiles = {"warped_wart_block.png"},
|
||||||
groups = {handy = 1, hoey = 7, swordy = 1, deco_block = 1},
|
groups = {handy = 1, hoey = 7, swordy = 1, deco_block = 1, compostability = 85},
|
||||||
_mcl_hardness = 1,
|
_mcl_hardness = 1,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults({
|
sounds = mcl_sounds.node_sound_leaves_defaults({
|
||||||
footstep={name="default_dirt_footstep", gain=0.7},
|
footstep={name="default_dirt_footstep", gain=0.7},
|
||||||
|
@ -312,7 +312,7 @@ minetest.register_node("mcl_crimson:warped_wart_block", {
|
||||||
minetest.register_node("mcl_crimson:shroomlight", {
|
minetest.register_node("mcl_crimson:shroomlight", {
|
||||||
description = S("Shroomlight"),
|
description = S("Shroomlight"),
|
||||||
tiles = {"shroomlight.png"},
|
tiles = {"shroomlight.png"},
|
||||||
groups = {handy = 1, hoey = 7, swordy = 1, deco_block = 1},
|
groups = {handy = 1, hoey = 7, swordy = 1, deco_block = 1, compostability = 65},
|
||||||
light_source = minetest.LIGHT_MAX,
|
light_source = minetest.LIGHT_MAX,
|
||||||
_mcl_hardness = 1,
|
_mcl_hardness = 1,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults({
|
sounds = mcl_sounds.node_sound_leaves_defaults({
|
||||||
|
@ -458,7 +458,7 @@ minetest.register_node("mcl_crimson:crimson_fungus", {
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1},
|
groups = {dig_immediate=3,mushroom=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1,compostability=65},
|
||||||
light_source = 1,
|
light_source = 1,
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
selection_box = {
|
selection_box = {
|
||||||
|
@ -496,7 +496,7 @@ minetest.register_node("mcl_crimson:crimson_roots", {
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1, shearsy = 1},
|
groups = {dig_immediate=3,vines=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,deco_block=1,shearsy = 1,compostability=65},
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
|
|
|
@ -130,7 +130,7 @@ minetest.register_node("mcl_nether:magma", {
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
light_source = 3,
|
light_source = 3,
|
||||||
sunlight_propagates = false,
|
sunlight_propagates = false,
|
||||||
groups = {pickaxey=1, building_block=1, material_stone=1},
|
groups = {pickaxey=1, building_block=1, material_stone=1, fire=1},
|
||||||
sounds = mcl_sounds.node_sound_stone_defaults(),
|
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||||
-- From walkover mod
|
-- From walkover mod
|
||||||
on_walk_over = function(loc, nodeiamon, player)
|
on_walk_over = function(loc, nodeiamon, player)
|
||||||
|
|
|
@ -80,20 +80,29 @@ end
|
||||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||||
if mg_name ~= "singlenode" then
|
if mg_name ~= "singlenode" then
|
||||||
mcl_mapgen_core.register_generator("villages", nil, function(minp, maxp, blockseed)
|
mcl_mapgen_core.register_generator("villages", nil, function(minp, maxp, blockseed)
|
||||||
-- don't build settlement underground
|
|
||||||
if maxp.y < 0 then return end
|
if maxp.y < 0 then return end
|
||||||
|
|
||||||
-- randomly try to build settlements
|
-- randomly try to build settlements
|
||||||
if blockseed % 77 ~= 17 then return end
|
if blockseed % 77 ~= 17 then return end
|
||||||
|
--minetest.log("Rng good. Generate attempt")
|
||||||
|
|
||||||
-- needed for manual and automated settlement building
|
-- needed for manual and automated settlement building
|
||||||
-- don't build settlements on (too) uneven terrain
|
-- don't build settlements on (too) uneven terrain
|
||||||
local n=minetest.get_node_or_nil(minp)
|
local n=minetest.get_node_or_nil(minp)
|
||||||
if n and n.name == "mcl_villages:structblock" then return end
|
if n and n.name == "mcl_villages:structblock" then return end
|
||||||
|
--minetest.log("No existing village attempt here")
|
||||||
|
|
||||||
if villagegen[minetest.pos_to_string(minp)] ~= nil then return end
|
if villagegen[minetest.pos_to_string(minp)] ~= nil then return end
|
||||||
|
|
||||||
|
--minetest.log("Not in village gen. Put down placeholder: " .. minetest.pos_to_string(minp) .. " || " .. minetest.pos_to_string(maxp))
|
||||||
minetest.set_node(minp,{name="mcl_villages:structblock"})
|
minetest.set_node(minp,{name="mcl_villages:structblock"})
|
||||||
|
|
||||||
local height_difference = settlements.evaluate_heightmap()
|
local height_difference = settlements.evaluate_heightmap()
|
||||||
if height_difference > max_height_difference then return end
|
if not height_difference or height_difference > max_height_difference then
|
||||||
|
minetest.log("action", "Do not spawn village here as heightmap not good")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
--minetest.log("Build me a village: " .. minetest.pos_to_string(minp) .. " || " .. minetest.pos_to_string(maxp))
|
||||||
villagegen[minetest.pos_to_string(minp)]={minp=vector.new(minp), maxp=vector.new(maxp), blockseed=blockseed}
|
villagegen[minetest.pos_to_string(minp)]={minp=vector.new(minp), maxp=vector.new(maxp), blockseed=blockseed}
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -198,6 +198,14 @@ end
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
function settlements.evaluate_heightmap()
|
function settlements.evaluate_heightmap()
|
||||||
local heightmap = minetest.get_mapgen_object("heightmap")
|
local heightmap = minetest.get_mapgen_object("heightmap")
|
||||||
|
|
||||||
|
if not heightmap then
|
||||||
|
minetest.log("action", "No heightmap. That should not happen")
|
||||||
|
return max_height_difference + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
--minetest.log("action", "heightmap size: " .. tostring(#heightmap))
|
||||||
|
|
||||||
-- max height and min height, initialize with impossible values for easier first time setting
|
-- max height and min height, initialize with impossible values for easier first time setting
|
||||||
local max_y = -50000
|
local max_y = -50000
|
||||||
local min_y = 50000
|
local min_y = 50000
|
||||||
|
@ -205,16 +213,32 @@ function settlements.evaluate_heightmap()
|
||||||
local square_start = 1621
|
local square_start = 1621
|
||||||
local square_end = 1661
|
local square_end = 1661
|
||||||
for j = 1 , 40, 1 do
|
for j = 1 , 40, 1 do
|
||||||
|
if square_start >= #heightmap then
|
||||||
|
--minetest.log("action", "Heightmap size reached. Go no further outside")
|
||||||
|
break
|
||||||
|
end
|
||||||
for i = square_start, square_end, 1 do
|
for i = square_start, square_end, 1 do
|
||||||
-- skip buggy heightmaps, return high value
|
--minetest.log("action", "current hm index: " .. tostring(i) .. "current hm entry: " .. tostring(heightmap[i]))
|
||||||
if heightmap[i] == -31000 or heightmap[i] == 31000 then
|
|
||||||
|
if i >= #heightmap then
|
||||||
|
--minetest.log("action", "Heightmap size reached. Go no further")
|
||||||
|
break
|
||||||
|
end
|
||||||
|
local current_hm_entry = heightmap[i]
|
||||||
|
if current_hm_entry then
|
||||||
|
-- skip buggy heightmaps, return high value. Converted mcl5 maps can be -31007
|
||||||
|
if current_hm_entry == -31000 or heightmap[i] == 31000 then
|
||||||
|
--minetest.log("action", "incorrect heighmap values. abandon")
|
||||||
return max_height_difference + 1
|
return max_height_difference + 1
|
||||||
end
|
end
|
||||||
if heightmap[i] < min_y then
|
if current_hm_entry < min_y then
|
||||||
min_y = heightmap[i]
|
min_y = current_hm_entry
|
||||||
end
|
end
|
||||||
if heightmap[i] > max_y then
|
if current_hm_entry > max_y then
|
||||||
max_y = heightmap[i]
|
max_y = current_hm_entry
|
||||||
|
end
|
||||||
|
else
|
||||||
|
--minetest.log("action", "Failed to get hm index: " .. tostring(i) .. "and ... " .. tostring(#heightmap))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- set next line
|
-- set next line
|
||||||
|
@ -223,10 +247,14 @@ function settlements.evaluate_heightmap()
|
||||||
end
|
end
|
||||||
-- return the difference between highest and lowest pos in chunk
|
-- return the difference between highest and lowest pos in chunk
|
||||||
local height_diff = max_y - min_y
|
local height_diff = max_y - min_y
|
||||||
|
|
||||||
|
--minetest.log("action", "height_diff = " .. tostring(height_diff))
|
||||||
|
|
||||||
-- filter buggy heightmaps
|
-- filter buggy heightmaps
|
||||||
if height_diff <= 1 then
|
if height_diff <= 1 then
|
||||||
return max_height_difference + 1
|
return max_height_difference + 1
|
||||||
end
|
end
|
||||||
|
--minetest.log("action", "return heigh diff = " .. tostring(height_diff))
|
||||||
-- debug info
|
-- debug info
|
||||||
settlements.debug("heightdiff ".. height_diff)
|
settlements.debug("heightdiff ".. height_diff)
|
||||||
return height_diff
|
return height_diff
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 106 B |
Loading…
Reference in New Issue