控制台输入布尔值的两个命令改成on/off,tas会修改设置,重启游戏依然生效

This commit is contained in:
MrZ626
2021-08-18 15:33:28 +08:00
parent eaf4e3d71e
commit 9e6295e008
4 changed files with 20 additions and 15 deletions

View File

@@ -30,7 +30,6 @@ SAVEDIR=fs.getSaveDirectory()
--Global Vars & Settings
FIRSTLAUNCH=false
DAILYLAUNCH=false
ALLOWTAS=false
--System setting
math.randomseed(os.time()*626)

View File

@@ -251,6 +251,7 @@ SETTING={--Settings
--System
reTime=4,
allowTAS=false,
autoPause=true,
menuPos='middle',
fine=false,

View File

@@ -357,34 +357,34 @@ local commands={}do
}
commands.wireframe={
code=function(bool)
if bool=="true"or bool=="false"then
gc.setWireframe(bool=="true")
if bool=="on"or bool=="off"then
gc.setWireframe(bool=="on")
log("Wireframe: "..(gc.isWireframe()and"on"or"off"))
else
log{C.A,"Usage: wireframe <true|false>"}
log{C.A,"Usage: wireframe <on|off>"}
end
end,
description="Turn on/off wireframe mode",
details={
"Enable or disable wireframe drawing mode.",
"",
"Usage: wireframe <true|false>",
"Usage: wireframe <on|off>",
},
}
commands.gammacorrect={
code=function(bool)
if bool=="true"or bool=="false"then
love._setGammaCorrect(bool=="true")
if bool=="on"or bool=="off"then
love._setGammaCorrect(bool=="on")
log("GammaCorrect: "..(gc.isGammaCorrect()and"on"or"off"))
else
log{C.A,"Usage: gammacorrect <true|false>"}
log{C.A,"Usage: gammacorrect <on|off>"}
end
end,
description="Turn on/off gamma correction",
details={
"Enable or disable gamma correction.",
"",
"Usage: gammacorrect <true|false>",
"Usage: gammacorrect <on|off>",
},
}
commands.fn={
@@ -732,15 +732,20 @@ local commands={}do
},
}
commands.tas={
code=function()
ALLOWTAS=true
log{C.lC,"TAS mode on"}
code=function(bool)
if bool=="on"or bool=="off"then
SETTING.allowTAS=bool=="on"
FILE.save(SETTING,'conf/settings')
log("Allow TAS: "..bool)
else
log{C.A,"Usage: tas <on|off>"}
end
end,
description="Allow you to use TAS tool",
details={
"Allow you to use TAS tool, a TAS button will show up at the pause menu",
"",
"Usage: tas",
"Usage: tas <on|off>",
},
}

View File

@@ -162,7 +162,7 @@ function scene.keyDown(key,isRep)
end
timer2=0
elseif key=="t"then
if ALLOWTAS and not(GAME.result or GAME.replaying)then
if SETTING.allowTAS and not(GAME.result or GAME.replaying)then
GAME.tasUsed=true
SFX.play('ren_mega')
SFX.play('clear_3')
@@ -358,7 +358,7 @@ scene.widgetList={
WIDGET.newKey{name="restart", x=290,y=340,w=300,h=70,code=pressKey"r",hideF=function()return GAME.fromRepMenu end},
WIDGET.newKey{name="setting", x=290,y=440,w=300,h=70,code=pressKey"s",hideF=function()return GAME.fromRepMenu end},
WIDGET.newKey{name="quit", x=290,y=540,w=300,h=70,code=backScene},
WIDGET.newKey{name="tas", x=290,y=620,w=240,h=50,code=pressKey"t",hideF=function()return not ALLOWTAS or GAME.tasUsed or GAME.result or GAME.replaying end},
WIDGET.newKey{name="tas", x=290,y=620,w=240,h=50,code=pressKey"t",hideF=function()return not SETTING.allowTAS or GAME.tasUsed or GAME.result or GAME.replaying end},
WIDGET.newKey{name="page_prev", x=500,y=390,w=70,code=pressKey"tab",noFrame=true,
fText=GC.DO{70,70,{'setLW',2}, {'dRPol',33,35,32,3,6,3.142},{'dRPol',45,35,32,3,6,3.142}},
fShade=GC.DO{70,70,{'setCL',1,1,1,.4},{'draw',GC.DO{70,70,{'setCL',1,1,1,1},{'fRPol',33,35,32,3,6,3.142},{'fRPol',45,35,32,3,6,3.142}}}},