Don't use opaque globals.

This commit is contained in:
Nathan Fritzler 2022-06-16 22:13:00 -06:00
parent c9ec16c2eb
commit 21531eb564
Signed by: Lazerbeak12345
GPG Key ID: 736DE8D7C58AD7FE
3 changed files with 7 additions and 4 deletions

View File

@ -6,12 +6,13 @@ local blocks = {
-- Color picked to be much lighter than above from MCL2, but still mostly green
color = "#58ff3a",
tiles = { "mcl_core_grass_block_top.png" }
-- tiles = { terrain(0) }
-- TODO make this a setting
-- tiles = { mcljepc_core.helpers.terrain(0) }
},
cobblestone = {
description = "Cobblestone",
tiles = { "default_cobble.png" },
-- tiles = { terrain(1) }
-- tiles = { mcljepc_core.helpers.terrain(1) }
}
}

View File

@ -1,12 +1,13 @@
--- Misc. Helper functions
mcljepc_core.helpers = {}
function atlas_id(tex, id)
function mcljepc_core.helpers.atlas_id(tex, id)
local x = id % 16
local y = math.floor(id / 16)
return tex..".png^[sheet:16x16:"..x..","..y
end
function terrain(id)
function mcljepc_core.helpers.terrain(id)
return atlas_id("terrain", id)
end

View File

@ -1,3 +1,4 @@
mcljepc_core = {}
dofile(minetest.get_modpath("mcljepc_core") .. "/helpers.lua")
dofile(minetest.get_modpath("mcljepc_core") .. "/blocks.lua")