From 766b32b1b46507d7debbf0b80bbf6d3762a43436 Mon Sep 17 00:00:00 2001 From: "Squishy (C6H12O6+NaCl+H2O)" <106439598+SweetSea-ButImNotSweet@users.noreply.github.com> Date: Sat, 6 Jan 2024 16:20:55 +0700 Subject: [PATCH] Final update --- parts/gameFuncs.lua | 7 +++++++ parts/gameTables.lua | 4 ++-- parts/language/lang_en.lua | 2 +- parts/language/lang_vi.lua | 4 ++-- parts/player/draw.lua | 8 +++++--- parts/player/init.lua | 10 +++++----- parts/player/player.lua | 2 +- parts/scenes/replays.lua | 1 + 8 files changed, 24 insertions(+), 14 deletions(-) diff --git a/parts/gameFuncs.lua b/parts/gameFuncs.lua index b1a899e7..9f7090fc 100644 --- a/parts/gameFuncs.lua +++ b/parts/gameFuncs.lua @@ -997,6 +997,13 @@ do-- function resetGameData(args) local function task_showMods() -- TODO coroutine.yield() local counter=0 + + do + SFX.play('collect',.2) + TEXT.show(GAME.modApplyAt,640,26,45,'spin') + for _=1,90 do coroutine.yield() end + end + for number,sel in next,GAME.mod do if sel>0 then if counter==0 then diff --git a/parts/gameTables.lua b/parts/gameTables.lua index d013bb77..1251a49a 100644 --- a/parts/gameTables.lua +++ b/parts/gameTables.lua @@ -481,7 +481,7 @@ do-- Mod data end, funcA1=function(P) for _,k in pairs{'das','arr','sddas','sdarr'} do - P.gameEnv[k]=O + P.gameEnv[k]=0 P.gameEnv.__lock(k) end end @@ -555,7 +555,7 @@ do-- Game data tables curMode=false, -- Current gamemode object initPlayerCount=0, -- Player count when init game mod=TABLE.new(0,#MODOPT),-- List of loaded mods - modApplyAt='preInit', -- Apply mod when? (preInit, postInit, always) + modApplyAt='postInit', -- Apply mod when? (preInit, postInit, always) modeEnv=false, -- Current gamemode environment setting={}, -- Game settings rep={}, -- Recording list, key,time,key,time... diff --git a/parts/language/lang_en.lua b/parts/language/lang_en.lua index c4795b05..ec6ef822 100644 --- a/parts/language/lang_en.lua +++ b/parts/language/lang_en.lua @@ -209,7 +209,7 @@ return { tryAnotherBuild="UTF-8 decoding error. If you are using Microsoft Windows, please try to download the build with the different architecture. If you are using the x86 version of Techmino, try downloading the x64 version and vice versa.", modInstruction="Choose your modifiers here!\nMods allow you to change the rules in various ways, but they can also crash the game. Feel free to play the game your way!\nNote that scores are not saved when using mods. You can also toggle mods using your keyboard keys (hold Shift to reverse).", - modApplyAtInstruction="Choose when you want the mod to be applied.\npreInit: Apply the mod before loading the game mode. This is the default option from version 0.17.15 and earlier. Some mods may experience errors when using this option.\npostInit: Apply the mod after loading the game mode. This can fix some errors in preInit. However, the mod may be disabled in some cases, such as after completing a stage in the game.\nalways: Apply the mod throughout the entire game. This option will help you keep the mod's effects in any situation.", + modApplyAtInstruction="Choose when you want the modifier to be applied.\nprelnit: Before loading the modes. The default option in V0.17.15 and earlier, but may cause problems with certain mods.\npostInit: After loading the game. This can fix some bugs in preInit, but some mods can still be disabled by modes in some situations.\nalways: Throughout the entire game. Keeps the effects of the mods in all situations. ", modInfo={ next="NEXT\nOverrides the number of Next pieces displayed.", hold="HOLD\nOverrides the number of Hold pieces displayed.", diff --git a/parts/language/lang_vi.lua b/parts/language/lang_vi.lua index ea148263..d97e0e45 100644 --- a/parts/language/lang_vi.lua +++ b/parts/language/lang_vi.lua @@ -216,7 +216,7 @@ return { tryAnotherBuild="CO LOI KHI GIAI MA UTF-8! Neu dang choi Techmino tren Windows: hay doi tu x86 sang x64 va nguoc lai.", modInstruction="Hãy chọn modifier bạn muốn.\nMod cho phép bạn có thể tùy biến game, nhưng cũng có thể làm game sập.\nKể cả thế, hãy thoải mái và chơi theo cách của bạn!\nBạn có thể dùng bàn phím để chọn mod (giữ Shift để chọn lùi)\nĐiểm sẽ không được lưu lại khi dùng mod.", - modApplyAtInstruction="Chọn thời điểm bạn muốn mod được áp dụng.\npreInit: Áp dụng mod trước khi nạp chế độ chơi. Đây là tùy chọn mặc định từ phiên bản 0.17.15 trở về trước. Có thể gặp lỗi ở một số mod khi dùng tùy chọn này.\npostInit: Áp dụng mod sau khi nạp chế độ chơi, có thể sửa được một số lỗi ở preInit. Tuy nhiên, mod có thể bị mất tác dụng ở một số trường hợp, VD như sau khi hoàn thành một chặng trong game.\nalways: Áp dụng mod trong suốt cả game. Tùy chọn này sẽ giúp bạn giữ lại tác dụng của mod dù ở bất kì trường hợp nào.", + modApplyAtInstruction="Chọn thời điểm bạn muốn mod được áp dụng.\npreInit: Trước khi nạp game. Đây là tùy chọn mặc định từ phiên bản 0.17.15 trở về trước. Một số mod có thể gặp vấn đề nếu dùng tùy chọn này.\npostInit: Sau khi nạp chế độ chơi, có thể sửa được một số lỗi ở preInit. Tuy nhiên, mod có thể bị mất tác dụng ở một số trường hợp nhất định.\nalways: Luôn áp dụng trong cả game. Tùy chọn này sẽ giúp bạn giữ lại tác dụng của mod dù ở bất kì trường hợp nào.", modInfo={ next="NEXT\nGhi đè số gạch hiển thị ở hàng NEXT", hold="HOLD\nGhi đè số lượng gạch được giữ ở cột HOLD", @@ -458,7 +458,7 @@ C. Tay cầm chơi game (Gamepad): mod={ title="Mods", reset="Đặt lại (tab)", - ApplyAt="Áp dụng mod khi", + applyAt="Áp dụng mod khi", unranked ="Không tính điểm", }, pause={ diff --git a/parts/player/draw.lua b/parts/player/draw.lua index f83feb01..259b884d 100644 --- a/parts/player/draw.lua +++ b/parts/player/draw.lua @@ -787,9 +787,11 @@ function draw.norm(P,repMode) gc_scale(P.size) -- Draw username - setFont(30) - gc_setColor(GROUP_COLORS[P.group]) - GC.mStr(P.username or USERS.getUsername(P.uid),300,-60) + if usingMod() and P.frameRun>480 then + setFont(30) + gc_setColor(GROUP_COLORS[P.group]) + GC.mStr(P.username or USERS.getUsername(P.uid),300,-60) + end -- Draw HUD if ENV.nextCount>0 then _drawNext(P,repMode) end diff --git a/parts/player/init.lua b/parts/player/init.lua index e5115f2c..b5d74918 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -182,7 +182,7 @@ local function _executeMod(P) if not GAME.modCodeList[P.id] then GAME.modCodeList[P.id]={} end if not GAME.applyModTask then - function GAME.ApplyModsTask() + function GAME.applyModsTask() while GAME.playing do for _,p in pairs(GAME.modCodeList) do for _,c in pairs(p) do pcall(c) end @@ -190,12 +190,12 @@ local function _executeMod(P) coroutine.yield() end -- Kill mod patching function when game stopped - TASK.removeTask_code(GAME.ApplyModsTask) - TABLE.cut(GAME.modCodeList) + TABLE.clear(GAME.modCodeList) + TASK.removeTask_code(GAME.applyModsTask) GAME.modCodeList=nil - GAME.ApplyModsTask=nil + GAME.applyModsTask=nil end - TASK.new(GAME.ApplyModsTask) + TASK.new(GAME.applyModsTask) end end diff --git a/parts/player/player.lua b/parts/player/player.lua index 9d0ab167..e84a2bad 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -2786,7 +2786,7 @@ function Player:_die() end end end - if GAME.ApplyModsTask then + if GAME.applyModsTask then TABLE.cut(GAME.modCodeList[self.id]) end end diff --git a/parts/scenes/replays.lua b/parts/scenes/replays.lua index 3d8473b3..0c77b66e 100644 --- a/parts/scenes/replays.lua +++ b/parts/scenes/replays.lua @@ -48,6 +48,7 @@ local function _playRep(fileName) for _,m in next,rep.mod do GAME.mod[m[1]+1]=m[2] end + GAME.modApplyAt=rep.modApplyAt or 'preInit' -- For V0.17.15 and older GAME.rep={} DATA.pumpRecording(rep.data,GAME.rep)