If vertical again, stick to previous direction

master
Wuzzy 2019-02-13 23:46:37 +01:00
parent f272e6e7e1
commit 753df904db
1 changed files with 10 additions and 3 deletions

View File

@ -808,7 +808,8 @@ local function start_corridor(waypoint, coord, sign, length, wood, post, damage,
local ud = false -- Up or down local ud = false -- Up or down
local udn = false -- Up or down is next local udn = false -- Up or down is next
local udp = false -- Up or down was previous local udp = false -- Up or down was previous
local up local up = false -- true if going up
local upp = false -- true if was going up previously
for i=1,length do for i=1,length do
local needs_platform local needs_platform
-- Update previous up/down status -- Update previous up/down status
@ -826,9 +827,15 @@ local function start_corridor(waypoint, coord, sign, length, wood, post, damage,
elseif wp.y <= height_min + 12 then elseif wp.y <= height_min + 12 then
up = true up = true
else else
-- Chose random direction in between -- If previous was up/down, keep the vertical direction
up = pr:next(1, 2) == 1 if udp then
up = upp
else
-- Chose random direction
up = pr:next(1, 2) == 1
end
end end
upp = up
else else
ud = false ud = false
end end