From 753df904db84184773d575353fc5625d76466648 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 13 Feb 2019 23:46:37 +0100 Subject: [PATCH] If vertical again, stick to previous direction --- init.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 40fc4e3..c6daba8 100644 --- a/init.lua +++ b/init.lua @@ -808,7 +808,8 @@ local function start_corridor(waypoint, coord, sign, length, wood, post, damage, local ud = false -- Up or down local udn = false -- Up or down is next 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 local needs_platform -- 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 up = true else - -- Chose random direction in between - up = pr:next(1, 2) == 1 + -- If previous was up/down, keep the vertical direction + if udp then + up = upp + else + -- Chose random direction + up = pr:next(1, 2) == 1 + end end + upp = up else ud = false end