Fix style issues with previous commit

master
JP Guerrero 2018-03-08 21:12:21 +01:00
parent 271d5b1147
commit a45c1c915a
5 changed files with 24 additions and 40 deletions

View File

@ -29,10 +29,9 @@ function xdecor.tablecopy(T)
return new
end
-- Return true if a def is accepting for stair
function xdecor.stairs_valid_def(def)
return (def.drawtype == "normal" or def.drawtype:sub(1,5) == "glass") and
(def.groups.cracky or def.groups.choppy) and
(def.groups.cracky or def.groups.choppy) and
not def.on_construct and
not def.after_place_node and
not def.on_rightclick and
@ -46,5 +45,5 @@ function xdecor.stairs_valid_def(def)
not def.mesecons and
def.description and
def.description ~= "" and
def.light_source == 0
def.light_source == 0
end

View File

@ -46,15 +46,13 @@ function xdecor.register(name, def)
local function xdecor_stairs_alternative(nodename, def)
local mod, name = nodename:match("(.*):(.*)")
for groupname, value in pairs(def.groups) do
if groupname ~= "cracky" and
groupname ~= "choppy" and
groupname ~= "flammable" and
groupname ~= "crumbly" and
groupname ~= "snappy"
then
if groupname ~= "cracky" and groupname ~= "choppy" and
groupname ~= "flammable" and groupname ~= "crumbly" and
groupname ~= "snappy" then
def.groups.groupname = nil
end
end
end
if minetest.get_modpath("moreblocks") then
stairsplus:register_all(
mod,
@ -77,6 +75,7 @@ function xdecor.register(name, def)
)
end
end
def.drawtype = def.drawtype or (def.mesh and "mesh") or (def.node_box and "nodebox")
def.sounds = def.sounds or default.node_sound_defaults()
@ -122,9 +121,9 @@ function xdecor.register(name, def)
end
minetest.register_node("xdecor:"..name, def)
if minetest.settings:get_bool("disable_xdecor_workbench") and
(minetest.get_modpath("moreblocks") or minetest.get_modpath("stairs")) then
(minetest.get_modpath("moreblocks") or minetest.get_modpath("stairs")) then
if xdecor.stairs_valid_def(def) then
xdecor_stairs_alternative("xdecor:"..name, def)
end

View File

@ -2,19 +2,16 @@
xdecor = {}
local modpath = minetest.get_modpath("xdecor")
-- Handlers.
dofile(modpath.."/handlers/animations.lua")
dofile(modpath.."/handlers/helpers.lua")
dofile(modpath.."/handlers/nodeboxes.lua")
dofile(modpath.."/handlers/registration.lua")
-- Node and others
dofile(modpath.."/src/alias.lua")
dofile(modpath.."/src/nodes.lua")
dofile(modpath.."/src/recipes.lua")
-- Elements
local submod = {
local subpart = {
"chess",
"cooking",
"enchanting",
@ -26,12 +23,11 @@ local submod = {
"workbench"
}
for _, name in ipairs(submod) do
local enable = not(minetest.settings:get_bool("disable_xdecor_"..name))
if enable then
for _, name in pairs(subpart) do
local enable = minetest.settings:get_bool("enable_xdecor_"..name)
if enable or enable == nil then
dofile(modpath.."/src/"..name..".lua")
end
end
--print(string.format("[xdecor] loaded in %.2f ms", (os.clock()-t)*1000))

View File

@ -1,11 +1,11 @@
#For disabling a element in xdecor.
#For enabling a subpart of X-Decor.
disable_xdecor_chess (Disable element Chess) bool false
disable_xdecor_cooking (Disable element Cooking) bool false
disable_xdecor_enchanting (Disable element Enchanting) bool false
disable_xdecor_hive (Disable element Hive) bool false
disable_xdecor_itemframe (Disable element Itemframe) bool false
disable_xdecor_mailbox (Disable element Mailbox) bool false
disable_xdecor_mechanisms (Disable element Mechanisms) bool false
disable_xdecor_rope (Disable element Rope) bool false
disable_xdecor_workbench (Disable element Workbench) bool false
enable_xdecor_chess (Enable Chess) bool true
enable_xdecor_cooking (Enable Cooking) bool true
enable_xdecor_enchanting (Enable Enchanting) bool true
enable_xdecor_hive (Enable Hive) bool true
enable_xdecor_itemframe (Enable Itemframe) bool true
enable_xdecor_mailbox (Enable Mailbox) bool true
enable_xdecor_mechanisms (Enable Mechanisms) bool true
enable_xdecor_rope (Enable Rope) bool true
enable_xdecor_workbench (Enable Workbench) bool true

View File

@ -282,16 +282,6 @@ enchanting:register_tools("default", {
}
})
enchanting:register_tools("3d_armor", {
materials = "steel, bronze, gold, diamond",
tools = {
boots = {enchants = "strong, speed"},
chestplate = {enchants = "strong"},
helmet = {enchants = "strong"},
leggings = {enchants = "strong"}
}
})
-- Recipes
minetest.register_craft({