From dce3e812192f026833dfb8c3b78bffad5bd71191 Mon Sep 17 00:00:00 2001 From: 9382 Date: Sun, 18 May 2025 11:13:06 +0100 Subject: [PATCH] =?UTF-8?q?Do=20interpolation=20beyond=20the=20dataset=20b?= =?UTF-8?q?ounds=20(=F0=9F=A4=A2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Still not sure this is a good idea, but it means there's less need to update the IDToDate dataset --- src/SlashCommands/User.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/SlashCommands/User.lua b/src/SlashCommands/User.lua index 0e7f2a6..e6307cf 100644 --- a/src/SlashCommands/User.lua +++ b/src/SlashCommands/User.lua @@ -71,13 +71,19 @@ local function GuessDateFromAssetID(InstanceID, AssetID) local ID,Time = unpack(IDToDate[i]) if ID < InstanceID then if not IDToDate[i+1] then - return "After "..ToYMD(Time) + -- Screw it we ball, just do unjustified interpolation + local ID1, Time1 = unpack(IDToDate[#IDToDate-1]) + local ID2, Time2 = unpack(IDToDate[#IDToDate]) + return "Around "..ToYMD(linterp(Time1, Time2, (InstanceID-ID1)/(ID2-ID1)))..note end local ParentID, ParentTime = unpack(IDToDate[i+1]) return "Around "..ToYMD(linterp(Time, ParentTime, (InstanceID-ID)/(ParentID-ID)))..note end end - return "Before "..ToYMD(IDToDate[1][2]) + -- Screw it we ball, just do unjustified interpolation + local ID1, Time1 = unpack(IDToDate[1]) + local ID2, Time2 = unpack(IDToDate[2]) + return "Around "..ToYMD(linterp(Time1, Time2, (InstanceID-ID1)/(ID2-ID1)))..note end local function Callback(Interaction, Command, Args)