tile generator in alpha!!!!!!!!! yeyey

This commit is contained in:
Neckrat 2025-08-12 11:25:39 +03:00
parent 043c38285e
commit eebd5e4132
3 changed files with 207 additions and 126 deletions

View File

@ -1,121 +0,0 @@
return {
tile_size = 32,
tags = { "surface", "ground" },
tiles = {
grass = {
grass1 = {
quad = { x = 0, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass2 = {
quad = { x = 32, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass3 = {
quad = { x = 64, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass4 = {
quad = { x = 96, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass5 = {
quad = { x = 0, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass6 = {
quad = { x = 32, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass7 = {
quad = { x = 64, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass8 = {
quad = { x = 96, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass9 = {
quad = { x = 0, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass10 = {
quad = { x = 32, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass11 = {
quad = { x = 64, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass12 = {
quad = { x = 96, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass13 = {
quad = { x = 0, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass14 = {
quad = { x = 32, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass15 = {
quad = { x = 64, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
grass16 = {
quad = { x = 96, y = 0, w = 32, h = 32 },
category = "ground",
sockets = { N = "grass|flower_grass", E = "grass|flower_grass", S = "grass|flower_grass", W = "grass|flower_grass" }, -- «разъёмы» для состыковки
weight = 3, -- шанс выбора среди аналогов
flags = { walkable = true },
},
}
}
}

View File

@ -0,0 +1,199 @@
return {
flower_grass = {
flower_grass1 = {
h = 32,
w = 32,
x = 96,
y = 0
} --[[table: 0x7f4aca9c8c90]],
flower_grass2 = {
h = 32,
w = 32,
x = 96,
y = 32
} --[[table: 0x7f4aca9c8850]],
flower_grass3 = {
h = 32,
w = 32,
x = 96,
y = 64
} --[[table: 0x7f4aca9c7240]],
flower_grass4 = {
h = 32,
w = 32,
x = 96,
y = 96
} --[[table: 0x7f4aca9c7358]],
flower_grass5 = {
h = 32,
w = 32,
x = 128,
y = 0
} --[[table: 0x7f4aca9c7438]],
flower_grass6 = {
h = 32,
w = 32,
x = 128,
y = 32
} --[[table: 0x7f4aca9bb9e8]],
flower_grass7 = {
h = 32,
w = 32,
x = 128,
y = 64
} --[[table: 0x7f4aca9bba60]],
flower_grass8 = {
h = 32,
w = 32,
x = 128,
y = 96
} --[[table: 0x7f4aca9bbb40]],
flower_grass9 = {
h = 32,
w = 32,
x = 160,
y = 0
} --[[table: 0x7f4aca9c9088]],
flower_grass10 = {
h = 32,
w = 32,
x = 160,
y = 32
} --[[table: 0x7f4aca9c92c0]],
flower_grass11 = {
h = 32,
w = 32,
x = 160,
y = 64
} --[[table: 0x7f4aca9bb8f0]],
flower_grass12 = {
h = 32,
w = 32,
x = 160,
y = 96
} --[[table: 0x7f4aca9c5500]],
flower_grass13 = {
h = 32,
w = 32,
x = 192,
y = 0
} --[[table: 0x7f4aca9c55e0]],
flower_grass14 = {
h = 32,
w = 32,
x = 192,
y = 32
} --[[table: 0x7f4aca9c56c0]],
flower_grass15 = {
h = 32,
w = 32,
x = 192,
y = 64
} --[[table: 0x7f4aca9c57a0]],
flower_grass16 = {
h = 32,
w = 32,
x = 192,
y = 96
} --[[table: 0x7f4aca9c7f80]]
} --[[table: 0x7f4aca9c8be0]],
grass = {
grass1 = {
h = 32,
w = 32,
x = 0,
y = 0
} --[[table: 0x7f4aca9ca818]],
grass2 = {
h = 32,
w = 32,
x = 0,
y = 32
} --[[table: 0x7f4aca9caa18]],
grass3 = {
h = 32,
w = 32,
x = 0,
y = 64
} --[[table: 0x7f4aca9c7a20]],
grass4 = {
h = 32,
w = 32,
x = 0,
y = 96
} --[[table: 0x7f4aca9c7da8]],
grass5 = {
h = 32,
w = 32,
x = 32,
y = 0
} --[[table: 0x7f4aca9c7780]],
grass6 = {
h = 32,
w = 32,
x = 32,
y = 32
} --[[table: 0x7f4aca9c5060]],
grass7 = {
h = 32,
w = 32,
x = 32,
y = 64
} --[[table: 0x7f4aca9cf078]],
grass8 = {
h = 32,
w = 32,
x = 32,
y = 96
} --[[table: 0x7f4aca9c96e8]],
grass9 = {
h = 32,
w = 32,
x = 64,
y = 0
} --[[table: 0x7f4aca9c7ad8]],
grass10 = {
h = 32,
w = 32,
x = 64,
y = 32
} --[[table: 0x7f4aca9c5318]],
grass11 = {
h = 32,
w = 32,
x = 64,
y = 64
} --[[table: 0x7f4aca9ca900]],
grass12 = {
h = 32,
w = 32,
x = 64,
y = 96
} --[[table: 0x7f4aca9cab58]],
grass13 = {
h = 32,
w = 32,
x = 96,
y = 0
} --[[table: 0x7f4aca9c5e60]],
grass14 = {
h = 32,
w = 32,
x = 96,
y = 32
} --[[table: 0x7f4aca9caba0]],
grass15 = {
h = 32,
w = 32,
x = 96,
y = 64
} --[[table: 0x7f4aca9c6e90]],
grass16 = {
h = 32,
w = 32,
x = 96,
y = 96
} --[[table: 0x7f4aca9c8b30]]
} --[[table: 0x7f4aca9c5240]],
tileSize = 32
} --[[table: 0x7f4aca9c93e0]]

View File

@ -1,21 +1,24 @@
local serpent = require('dev_utils.serpent')
--- @type {[string]: any}
local out = {
tileSize = arg[1]
tileSize = tonumber(arg[1])
}
local idx = ""
local cnt = 1
for i = 0, #arg - 1, 4 do
for i = 0, #arg - 2, 5 do
local cnt = 1
idx = arg[i + 2]
out[idx] = {}
for x = tonumber(arg[i + 3]), tonumber(arg[i + 5]), tonumber(out.tileSize) do
for y = arg[i + 4], arg[i + 6], out.tileSize do
out[idx][idx .. cnt] = { x = x, y = y, w = out.tileSize, h = out.tileSize }
cnt = cnt + 1
end
end
end
print(out)
print("return " .. serpent.block(out))
-- command for test: luajit dev_utils/tile_generator.lua 32 grass 0 0 95 95 flower_grass 96 0 189 95
-- command for test: luajit dev_utils/tile_generator.lua 32 grass 0 0 96 96 flower_grass 96 0 192 96 >> assets/tiles/grass/manifest2.lua