forked from VoxeLibre/VoxeLibre
Railcorridors: Use dark oak wood in terracotta
This commit is contained in:
parent
da8729a7a1
commit
3443e68b76
|
@ -12,15 +12,30 @@ tsm_railcorridors.nodes = {
|
||||||
torch_wall = "mcl_torches:torch_wall",
|
torch_wall = "mcl_torches:torch_wall",
|
||||||
cobweb = "mcl_core:cobweb",
|
cobweb = "mcl_core:cobweb",
|
||||||
spawner = "mcl_mobspawners:spawner",
|
spawner = "mcl_mobspawners:spawner",
|
||||||
|
}
|
||||||
|
|
||||||
|
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||||
|
|
||||||
|
if mg_name == "v6" then
|
||||||
|
-- In v6, wood is chosen randomly.
|
||||||
--[[ Wood types for the corridors. Corridors are made out of full wood blocks
|
--[[ Wood types for the corridors. Corridors are made out of full wood blocks
|
||||||
and posts. For each corridor system, a random wood type is chosen with the chance
|
and posts. For each corridor system, a random wood type is chosen with the chance
|
||||||
specified in per mille. ]]
|
specified in per mille. ]]
|
||||||
corridor_woods = {
|
tsm_railcorridors.nodes.corridor_woods = {
|
||||||
{ wood = "mcl_core:wood", post = "mcl_fences:fence", chance = 900},
|
{ wood = "mcl_core:wood", post = "mcl_fences:fence", chance = 900},
|
||||||
{ wood = "mcl_core:darkwood", post = "mcl_fences:dark_oak_fence", chance = 100},
|
{ wood = "mcl_core:darkwood", post = "mcl_fences:dark_oak_fence", chance = 100},
|
||||||
},
|
}
|
||||||
}
|
else
|
||||||
|
-- This generates dark oak wood in mesa biomes and oak wood everywhere else.
|
||||||
|
tsm_railcorridors.nodes.corridor_woods_function = function(pos, node)
|
||||||
|
if minetest.get_item_group(node.name, "hardened_clay") ~= 0 then
|
||||||
|
return "mcl_core:darkwood", "mcl_fences:dark_oak_fence"
|
||||||
|
else
|
||||||
|
return "mcl_core:wood", "mcl_fences:fence"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- TODO: Use minecart with chest instead of normal minecart
|
-- TODO: Use minecart with chest instead of normal minecart
|
||||||
tsm_railcorridors.carts = { "mcl_minecarts:minecart" }
|
tsm_railcorridors.carts = { "mcl_minecarts:minecart" }
|
||||||
|
@ -41,8 +56,6 @@ function tsm_railcorridors.on_construct_spawner(pos)
|
||||||
mcl_mobspawners.setup_spawner(pos, "mobs_mc:cave_spider")
|
mcl_mobspawners.setup_spawner(pos, "mobs_mc:cave_spider")
|
||||||
end
|
end
|
||||||
|
|
||||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
|
||||||
|
|
||||||
-- MineClone 2's treasure function. Gets all treasures for a single chest.
|
-- MineClone 2's treasure function. Gets all treasures for a single chest.
|
||||||
-- Based on information from Minecraft Wiki.
|
-- Based on information from Minecraft Wiki.
|
||||||
function tsm_railcorridors.get_treasures(pr)
|
function tsm_railcorridors.get_treasures(pr)
|
||||||
|
|
|
@ -746,6 +746,7 @@ local function place_corridors(main_cave_coords, psra)
|
||||||
if not IsGround(main_cave_coords) then
|
if not IsGround(main_cave_coords) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local center_node = minetest.get_node(main_cave_coords)
|
||||||
|
|
||||||
-- Determine if this corridor system is “damaged” (some rails removed) and to which extent
|
-- Determine if this corridor system is “damaged” (some rails removed) and to which extent
|
||||||
local damage = 0
|
local damage = 0
|
||||||
|
@ -769,25 +770,33 @@ local function place_corridors(main_cave_coords, psra)
|
||||||
local xs = pr:next(0, 2) < 1
|
local xs = pr:next(0, 2) < 1
|
||||||
local zs = pr:next(0, 2) < 1;
|
local zs = pr:next(0, 2) < 1;
|
||||||
|
|
||||||
-- Select random wood type (found in gameconfig.lua)
|
-- Get wood and fence post types, using gameconfig.
|
||||||
local rnd = pr:next(1,1000)
|
local wood, post
|
||||||
|
if tsm_railcorridors.nodes.corridor_woods_function then
|
||||||
|
-- Get wood type by gameconfig function
|
||||||
|
wood, post = tsm_railcorridors.nodes.corridor_woods_function(main_cave_coords, center_node)
|
||||||
|
else
|
||||||
|
-- Select random wood type (found in gameconfig.lua)
|
||||||
|
local rnd = pr:next(1,1000)
|
||||||
|
local woodtype = 1
|
||||||
|
local accumulated_chance = 0
|
||||||
|
|
||||||
local woodtype = 1
|
for w=1, #tsm_railcorridors.nodes.corridor_woods do
|
||||||
local accumulated_chance = 0
|
local woodtable = tsm_railcorridors.nodes.corridor_woods[w]
|
||||||
for w=1, #tsm_railcorridors.nodes.corridor_woods do
|
accumulated_chance = accumulated_chance + woodtable.chance
|
||||||
local woodtable = tsm_railcorridors.nodes.corridor_woods[w]
|
if accumulated_chance > 1000 then
|
||||||
accumulated_chance = accumulated_chance + woodtable.chance
|
minetest.log("warning", "[tsm_railcorridors] Warning: Wood chances add up to over 100%!")
|
||||||
if accumulated_chance > 1000 then
|
break
|
||||||
minetest.log("warning", "[tsm_railcorridors] Warning: Wood chances add up to over 100%!")
|
end
|
||||||
break
|
if rnd <= accumulated_chance then
|
||||||
end
|
woodtype = w
|
||||||
if rnd <= accumulated_chance then
|
break
|
||||||
woodtype = w
|
end
|
||||||
break
|
|
||||||
end
|
end
|
||||||
|
wood = tsm_railcorridors.nodes.corridor_woods[woodtype].wood
|
||||||
|
post = tsm_railcorridors.nodes.corridor_woods[woodtype].post
|
||||||
end
|
end
|
||||||
local wood = tsm_railcorridors.nodes.corridor_woods[woodtype].wood
|
|
||||||
local post = tsm_railcorridors.nodes.corridor_woods[woodtype].post
|
|
||||||
start_corridor(main_cave_coords, "x", xs, pr:next(way_min,way_max), psra, wood, post, damage, false)
|
start_corridor(main_cave_coords, "x", xs, pr:next(way_min,way_max), psra, wood, post, damage, false)
|
||||||
start_corridor(main_cave_coords, "z", zs, pr:next(way_min,way_max), psra, wood, post, damage, false)
|
start_corridor(main_cave_coords, "z", zs, pr:next(way_min,way_max), psra, wood, post, damage, false)
|
||||||
-- Auch mal die andere Richtung?
|
-- Auch mal die andere Richtung?
|
||||||
|
|
Loading…
Reference in New Issue