添加代码格式化风格文件

试着格式化一些文件
This commit is contained in:
MrZ_26
2023-09-12 20:01:16 +08:00
parent 7b97aefa0a
commit c695596285
3 changed files with 170 additions and 122 deletions

31
.editorconfig Normal file
View File

@@ -0,0 +1,31 @@
# EmmyLuaCodeStyle
[*.lua]
max_line_length = 26000
indent_style = space
insert_final_newline = true
space_around_table_field_list = false
space_before_attribute = false
space_before_function_call_open_parenthesis = false
space_before_closure_open_parenthesis = false
space_before_function_call_single_arg = false
space_before_open_square_bracket = false
space_inside_function_call_parentheses = false
space_inside_function_param_list_parentheses = false
space_inside_square_brackets = false
space_around_table_append_operator = false
space_before_inline_comment = false
space_around_math_operator = false
space_around_logical_operator = false
space_around_assign_operator = false
space_after_comma = false
space_after_comma_in_for_statement = false
space_around_concat_operator = false
align_call_args = false
align_function_params = false
align_continuous_assign_statement = true
align_continuous_rect_table_field = true
align_if_branch = false
align_array_table = true
ignore_spaces_inside_function_call = true
line_space_after_function_statement = keep
trailing_table_separator = smart

View File

@@ -1,4 +1,5 @@
SYSTEM=love._os if SYSTEM=='OS X' then SYSTEM='macOS' end
SYSTEM=love._os
if SYSTEM=='OS X' then SYSTEM='macOS' end
MOBILE=SYSTEM=='Android' or SYSTEM=='iOS'
FNNS=SYSTEM:find'\79\83' -- What does FNSF stand for? IDK so don't ask me lol
@@ -54,6 +55,7 @@ function love.conf(t)
W.x,W.y=nil,nil -- Position of the window
W.borderless=MOBILE -- Display window frame
W.resizable=not MOBILE -- Whether window is resizable
W.fullscreentype=MOBILE and "exclusive" or "desktop" -- Fullscreen type
if portrait then
W.width,W.height=720,1280

View File

@@ -11,8 +11,7 @@
1. I made a framework called Zframework, *most* code in Zframework are not directly relevant to game;
2. "xxx" are texts for reading by player, 'xxx' are string values just used in program;
3. Except "gcinfo" function of lua itself, other "gc" are short for "graphics";
]]--
]]
-- Var leak check
-- setmetatable(_G,{__newindex=function(self,k,v) print('>>'..k..string.rep(" ",26-#k),debug.traceback():match("\n.-\n\t(.-): "))rawset(self,k,v) end})
@@ -116,11 +115,13 @@ PLY= require'parts.player'
NETPLY =require'parts.netPlayer'
MODES =require'parts.modes'
setmetatable(TEXTURE,{__index=function(self,k)
setmetatable(TEXTURE,{
__index=function(self,k)
MES.new('warn',"No texture called: "..k)
self[k]=PAPER
return self[k]
end})
end,
})
-- Load mode files
for i=1,#MODES do
@@ -509,19 +510,21 @@ LANG.init('zh',
-- 3. Add a button in parts/scenes/lang.lua;
},
{
block=BLOCK_NAMES
block=BLOCK_NAMES,
},
(function()
local tipMeta={__call=function(L) return L[math.random(#L)] end}
return function(L)
if type(rawget(L,'getTip'))=='table' then setmetatable(L.getTip,tipMeta) end
setmetatable(L,{__index=function(self,k)
setmetatable(L,{
__index=function(self,k)
local mes="No Text ("..SETTING.locale.."): "..k
LOG(mes)
MES.new('warn',mes)
self[k]="["..k.."]"
return self[k]
end})
end,
})
end
end)()
)
@@ -533,7 +536,9 @@ for _,v in next,fs.getDirectoryItems('parts/backgrounds') do
BG.add(name,require('parts.backgrounds.'..name))
end
end
BG.remList('none')BG.remList('gray')BG.remList('custom')
BG.remList('none')
BG.remList('gray')
BG.remList('custom')
-- Load scene files from SOURCE ONLY
for _,v in next,fs.getDirectoryItems('parts/scenes') do
@@ -559,24 +564,32 @@ applySettings()
-- Load replays
for _,fileName in next,fs.getDirectoryItems('replay') do
if fileName:sub(12,12):match("[a-zA-Z]") then repeat
if fileName:sub(12,12):match("[a-zA-Z]") then
repeat
local date,mode,version,player,seed,setting,mod
local success,fileData=true,fs.read('replay/'..fileName)
date, fileData=STRING.readLine(fileData)date=date:gsub("[a-zA-Z]","")
mode, fileData=STRING.readLine(fileData)mode=MODE_UPDATE_MAP[mode] or mode
date,fileData=STRING.readLine(fileData)
date=date:gsub("[a-zA-Z]","")
mode,fileData=STRING.readLine(fileData)
mode=MODE_UPDATE_MAP[mode] or mode
version,fileData=STRING.readLine(fileData)
player, fileData=STRING.readLine(fileData) if player=="Local Player" then player="Stacker" end
player,fileData=STRING.readLine(fileData)
if player=="Local Player" then player="Stacker" end
success,fileData=pcall(love.data.decompress,'string','zlib',fileData)
if not success then break end
seed,fileData=STRING.readLine(fileData)
setting,fileData=STRING.readLine(fileData)setting=JSON.decode(setting)
mod, fileData=STRING.readLine(fileData)mod=JSON.decode(mod)
setting,fileData=STRING.readLine(fileData)
setting=JSON.decode(setting)
mod,fileData=STRING.readLine(fileData)
mod=JSON.decode(mod)
if
not setting or
not mod or
not mode or
#mode==0
then break end
then
break
end
fs.remove('replay/'..fileName)
local newName=fileName:sub(1,10)..fileName:sub(15)
@@ -595,7 +608,8 @@ for _,fileName in next,fs.getDirectoryItems('replay') do
)
)
fileName=newName
until true end
until true
end
local rep=DATA.parseReplay('replay/'..fileName)
table.insert(REPLAY,rep)
end
@@ -617,7 +631,8 @@ if TABLE.find(arg,'-- test') then
while not LOADED do coroutine.yield() end
LOG("\27[92m\27[1mAutomatic Test Started\27[0m")
BGM.setVol(0)SFX.setVol(0)
BGM.setVol(0)
SFX.setVol(0)
love.keypressed('space')
TEST.yieldUntilNextScene()