Better corridor ends

This commit is contained in:
Wuzzy 2017-05-10 05:26:12 +02:00
parent adb7346b3e
commit 681dc026b5

View File

@ -210,7 +210,7 @@ end
-- Gänge mit Schienen -- Gänge mit Schienen
-- Corridors with rails -- Corridors with rails
local function corridor_part(start_point, segment_vector, segment_count, wood, post) local function corridor_part(start_point, segment_vector, segment_count, wood, post, is_final)
local p = {x=start_point.x, y=start_point.y, z=start_point.z} local p = {x=start_point.x, y=start_point.y, z=start_point.z}
local torches = pr:next() < probability_torches_in_segment local torches = pr:next() < probability_torches_in_segment
local dir = {0, 0} local dir = {0, 0}
@ -312,9 +312,14 @@ local function corridor_part(start_point, segment_vector, segment_count, wood, p
-- next way point -- next way point
p = vector.add(p, segment_vector) p = vector.add(p, segment_vector)
end end
-- End of the corridor; create the final piece
if is_final then
Cube(p, 1, {name="air"})
end
end end
local function corridor_func(waypoint, coord, sign, up_or_down, up, wood, post) local function corridor_func(waypoint, coord, sign, up_or_down, up, wood, post, is_final)
local segamount = 3 local segamount = 3
if up_or_down then if up_or_down then
segamount = 1 segamount = 1
@ -336,7 +341,7 @@ local function corridor_func(waypoint, coord, sign, up_or_down, up, wood, post)
end end
end end
local segcount = pr:next(4,6) local segcount = pr:next(4,6)
corridor_part(waypoint, vek, segcount, wood, post) corridor_part(waypoint, vek, segcount, wood, post, is_final)
local corridor_vek = {x=vek.x*segcount, y=vek.y*segcount, z=vek.z*segcount} local corridor_vek = {x=vek.x*segcount, y=vek.y*segcount, z=vek.z*segcount}
-- nachträglich Schienen legen -- nachträglich Schienen legen
@ -417,7 +422,7 @@ local function start_corridor(waypoint, coord, sign, length, psra, wood, post)
ud = false ud = false
end end
-- Make corridor / Korridor graben -- Make corridor / Korridor graben
wp = corridor_func(wp,c,s, ud, up, wood, post) wp = corridor_func(wp,c,s, ud, up, wood, post, i == length)
-- Verzweigung? -- Verzweigung?
-- Fork? -- Fork?
if pr:next() < probability_fork then if pr:next() < probability_fork then