mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add config/user-props.toml combined object
This commit is contained in:
parent
b3ac1bd8f4
commit
1cd890ff88
2 changed files with 17 additions and 1 deletions
1
res/content/base/config/user-props.toml
Normal file
1
res/content/base/config/user-props.toml
Normal file
|
|
@ -0,0 +1 @@
|
|||
"base:durability" = {}
|
||||
|
|
@ -1,4 +1,19 @@
|
|||
function make_read_only(t)
|
||||
local user_props = file.read_combined_object("config/user-props.toml")
|
||||
local names = {}
|
||||
for name, _ in pairs(user_props) do
|
||||
table.insert(names, name)
|
||||
end
|
||||
-- remove undefined properties
|
||||
for id, blockprops in pairs(block.properties) do
|
||||
for propname, value in pairs(blockprops) do
|
||||
if propname:find(':') and not table.has(names, propname) then
|
||||
print("erase property", propname)
|
||||
blockprops[propname] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function make_read_only(t)
|
||||
setmetatable(t, {
|
||||
__newindex = function()
|
||||
error("table is read-only")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue