From e3eae25caad37d548c036904eb9324e3438ad2d6 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 22 Aug 2021 16:17:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcc=E5=87=BA=E6=95=85=E9=9A=9C?= =?UTF-8?q?=E5=90=8E=E9=9D=9Elua=E5=AF=B9=E8=B1=A1=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=9B=9E=E6=94=B6=E5=AF=BC=E8=87=B4=E5=86=85?= =?UTF-8?q?=E5=AD=98=E6=B3=84=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/ai.lua | 6 +++--- parts/player/player.lua | 6 ++++++ parts/player/update.lua | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/parts/ai.lua b/parts/ai.lua index 016aa36a..d01ac313 100644 --- a/parts/ai.lua +++ b/parts/ai.lua @@ -59,7 +59,7 @@ if type(_CC)=='table'then end error("Row "..y.." full") ]] - P.AI_thread=nil + P:destroyBot() return end end @@ -68,12 +68,12 @@ if type(_CC)=='table'then n=n+1 end if not pcall(CC.update,P.AI_bot,F,P.b2b>=100,P.combo)then - P.AI_thread=nil + P:destroyBot() end end function CC.switch20G(P) if not pcall(CC.destroy,P.AI_bot)then - P.AI_thread=nil + P:destroyBot() return end P.AIdata._20G=true diff --git a/parts/player/player.lua b/parts/player/player.lua index 4cf56cd1..66d848d1 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -230,6 +230,12 @@ end function Player:setRS(RSname) self.RS=RSlist[RSname]or RSlist.TRS end +function Player:destroyBot() + if self.AI_mode=='CC'then + if self.AI_bot then CC.destroy(self.AI_bot)end + end + self.AI_thread=nil +end function Player:getHolePos()--Get a good garbage-line hole position if self.garbageBeneath==0 then diff --git a/parts/player/update.lua b/parts/player/update.lua index ce88c676..491a6c6b 100644 --- a/parts/player/update.lua +++ b/parts/player/update.lua @@ -189,7 +189,7 @@ function update.alive(P,dt) if not C[1]then if P.AI_thread then if not pcall(P.AI_thread)then - P.AI_thread=nil + P:destroyBot() end else P:act_hardDrop()