forked from Mineclonia/Mineclonia
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",
|
||||
cobweb = "mcl_core:cobweb",
|
||||
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
|
||||
and posts. For each corridor system, a random wood type is chosen with the chance
|
||||
specified in per mille. ]]
|
||||
corridor_woods = {
|
||||
tsm_railcorridors.nodes.corridor_woods = {
|
||||
{ wood = "mcl_core:wood", post = "mcl_fences:fence", chance = 900},
|
||||
{ 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
|
||||
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")
|
||||
end
|
||||
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
|
||||
-- MineClone 2's treasure function. Gets all treasures for a single chest.
|
||||
-- Based on information from Minecraft Wiki.
|
||||
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
|
||||
return
|
||||
end
|
||||
local center_node = minetest.get_node(main_cave_coords)
|
||||
|
||||
-- Determine if this corridor system is “damaged” (some rails removed) and to which extent
|
||||
local damage = 0
|
||||
|
@ -769,25 +770,33 @@ local function place_corridors(main_cave_coords, psra)
|
|||
local xs = pr:next(0, 2) < 1
|
||||
local zs = pr:next(0, 2) < 1;
|
||||
|
||||
-- Select random wood type (found in gameconfig.lua)
|
||||
local rnd = pr:next(1,1000)
|
||||
-- Get wood and fence post types, using gameconfig.
|
||||
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
|
||||
local accumulated_chance = 0
|
||||
for w=1, #tsm_railcorridors.nodes.corridor_woods do
|
||||
local woodtable = tsm_railcorridors.nodes.corridor_woods[w]
|
||||
accumulated_chance = accumulated_chance + woodtable.chance
|
||||
if accumulated_chance > 1000 then
|
||||
minetest.log("warning", "[tsm_railcorridors] Warning: Wood chances add up to over 100%!")
|
||||
break
|
||||
end
|
||||
if rnd <= accumulated_chance then
|
||||
woodtype = w
|
||||
break
|
||||
for w=1, #tsm_railcorridors.nodes.corridor_woods do
|
||||
local woodtable = tsm_railcorridors.nodes.corridor_woods[w]
|
||||
accumulated_chance = accumulated_chance + woodtable.chance
|
||||
if accumulated_chance > 1000 then
|
||||
minetest.log("warning", "[tsm_railcorridors] Warning: Wood chances add up to over 100%!")
|
||||
break
|
||||
end
|
||||
if rnd <= accumulated_chance then
|
||||
woodtype = w
|
||||
break
|
||||
end
|
||||
end
|
||||
wood = tsm_railcorridors.nodes.corridor_woods[woodtype].wood
|
||||
post = tsm_railcorridors.nodes.corridor_woods[woodtype].post
|
||||
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, "z", zs, pr:next(way_min,way_max), psra, wood, post, damage, false)
|
||||
-- Auch mal die andere Richtung?
|
||||
|
|
Loading…
Reference in New Issue