From 881611953862e8b5a0489ea8c31d03ace364d68e Mon Sep 17 00:00:00 2001 From: cheapie Date: Sun, 21 Apr 2024 13:21:48 -0500 Subject: Include current door state in ETA calculation This accounts for the time the doors take to open and close --- dispatcherfw.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dispatcherfw.lua b/dispatcherfw.lua index fcee154..083d755 100644 --- a/dispatcherfw.lua +++ b/dispatcherfw.lua @@ -251,7 +251,14 @@ end local function calculateeta(carid,floor,direction) local sequence = buildstopsequence(carid,getpos(carid),mem.carstatus[carid].direction,floor,direction) - local eta = 0 + local doorstate = mem.carstatus[carid].doorstate + local doortimes = { + closed = 0, + closing = 3, + open = 10, + opening = 13, + } + local eta = doortimes[doorstate] or 0 for k,v in ipairs(sequence) do eta = eta+estimatetraveltime(carid,v.src,v.dest) if k < #sequence then -- cgit v1.2.3