Skip to content

Commit 5802db7

Browse files
authored
enforce lua formatting (#154)
* Drop .vimrc * Format and fix lua files Adds git job to enforce lua formatting.
1 parent 6f92034 commit 5802db7

File tree

11 files changed

+556
-496
lines changed

11 files changed

+556
-496
lines changed

.github/workflows/cmake-multi-platform.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ on:
99
branches: [ "dev" ]
1010

1111
jobs:
12+
lua-lint:
13+
name: Lua formatting (StyLua)
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install StyLua
19+
uses: JohnnyMorganz/stylua-action@v4
20+
with:
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
version: latest
23+
args: --check data/
24+
1225
build:
1326
name: ${{ matrix.platform.name }}
1427
runs-on: ${{ matrix.platform.os }}

.luarc.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"diagnostics.globals": [
3+
"map_random",
4+
"map_randomseed",
5+
"add_keybearers",
6+
"set_current_room",
7+
"map",
8+
"CURRENT_LEVEL",
9+
"QUICK_MODE",
10+
"ARCADE_MODE",
11+
"get_random_seed",
12+
"info",
13+
"PlayerData",
14+
"create_map",
15+
"add_chest",
16+
"read_file",
17+
"add_texture",
18+
"create_shop_artifact",
19+
"add_tile",
20+
"add_decoration",
21+
"set_modifier",
22+
"add_wall",
23+
"add_door",
24+
"add_monster",
25+
"add_trap"
26+
]
27+
}

.stylua.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
indent_type = "Tabs"
2+
indent_width = 4
3+
column_width = 120

.vimrc

Lines changed: 0 additions & 16 deletions
This file was deleted.

data/chestgen.lua

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
local room_builder = require "maproombuilder"
1+
local room_builder = require("maproombuilder")
22
local module = {}
33
local random = map_random
44

55
local textures = {
66
"Items/Chest0.png",
7-
"Items/Chest1.png"
7+
"Items/Chest1.png",
88
}
99

1010
local chests = {}
11-
for i=0,1 do
11+
for i = 0, 1 do
1212
table.insert(chests, {
1313
textures[1],
1414
textures[2],
1515
0,
16-
i * 16
17-
});
16+
i * 16,
17+
})
1818
table.insert(chests, {
1919
textures[1],
2020
textures[2],
2121
16,
22-
i * 16
23-
});
22+
i * 16,
23+
})
2424
end
2525

2626
local function repack(data)
2727
return {
28-
texturePath1 = data[1],
29-
texturePath2 = data[2],
30-
clipX = data[3],
31-
clipY = data[4]
28+
texturePath1 = data[1],
29+
texturePath2 = data[2],
30+
clipX = data[3],
31+
clipY = data[4],
3232
}
3333
end
3434

@@ -49,10 +49,10 @@ function module.add_chests_to_room(room)
4949
end
5050
end
5151

52-
function module.load_chests(map, chests)
53-
for i=0,15 do
54-
for j=0,11 do
55-
chest = chests[i][j]
52+
function module.load_chests(map, room_chests)
53+
for i = 0, 15 do
54+
for j = 0, 11 do
55+
local chest = room_chests[i][j]
5656
if chest then
5757
add_chest(map, i, j, CURRENT_LEVEL, repack(chest))
5858
end

0 commit comments

Comments
 (0)