Add disabled
definition property
This commit is contained in:
parent
4d97ea6d80
commit
8bb8a49701
28
api.lua
28
api.lua
@ -3,6 +3,11 @@ local BASENAME = "microexpansion"
|
||||
|
||||
-- [function] Register Recipe
|
||||
function microexpansion.register_recipe(output, recipe)
|
||||
-- Check if disabled
|
||||
if recipe.disabled == true then
|
||||
return
|
||||
end
|
||||
|
||||
local function isint(n)
|
||||
return n==math.floor(n)
|
||||
end
|
||||
@ -29,12 +34,22 @@ function microexpansion.register_recipe(output, recipe)
|
||||
end
|
||||
|
||||
for _, i in ipairs(recipe) do
|
||||
-- Check if disabled
|
||||
if recipe.disabled == true then
|
||||
return
|
||||
end
|
||||
|
||||
register(_)
|
||||
end
|
||||
end
|
||||
|
||||
-- [function] Register oredef
|
||||
function microexpansion.register_oredef(ore, def)
|
||||
-- Check if disabled
|
||||
if def.disabled == true then
|
||||
return
|
||||
end
|
||||
|
||||
local function register(_)
|
||||
local def = def[_]
|
||||
def.ore = "microexpansion:"..ore
|
||||
@ -42,6 +57,11 @@ function microexpansion.register_oredef(ore, def)
|
||||
end
|
||||
|
||||
for _, i in ipairs(def) do
|
||||
-- Check if disabled
|
||||
if def.disabled == true then
|
||||
return
|
||||
end
|
||||
|
||||
register(_)
|
||||
end
|
||||
end
|
||||
@ -59,6 +79,10 @@ end
|
||||
|
||||
-- [function] Register Item
|
||||
function microexpansion.register_item(itemstring, def)
|
||||
-- Check if disabled
|
||||
if def.disabled == true then
|
||||
return
|
||||
end
|
||||
-- Set usedfor
|
||||
if def.usedfor then
|
||||
def.description = def.description .. "\n"..minetest.colorize("grey", def.usedfor)
|
||||
@ -83,6 +107,10 @@ end
|
||||
|
||||
-- [function] Register Node
|
||||
function microexpansion.register_node(itemstring, def)
|
||||
-- Check if disabled
|
||||
if def.disabled == true then
|
||||
return
|
||||
end
|
||||
-- Set usedfor
|
||||
if def.usedfor then
|
||||
def.description = def.description .. "\n"..minetest.colorize("grey", def.usedfor)
|
||||
|
@ -1,6 +1,8 @@
|
||||
# Core API
|
||||
The core API is composed of several functions to make registering new items, nodes, and recipes for items and nodes more efficient and intuitive. Code for this public API is in `./api.lua`. This documentation is divided up per function.
|
||||
|
||||
__Note:__ Any definition table for registering anything using the ME API allow a `disabled` property to be specified. If set to `false`, the node/item will not be registered, if not set, it will.
|
||||
|
||||
#### `register_recipe(output, def)`
|
||||
__Usage:__ `microexpansion.register_recipe(<output (string)>, <recipe (table)>)`
|
||||
|
||||
|
@ -20,6 +20,7 @@ me.register_node("incranium", {
|
||||
y_max = -90,
|
||||
},
|
||||
},
|
||||
disabled = true,
|
||||
})
|
||||
|
||||
-- "Supernatet", pronounced "Super-nat-et" is Latin for "float", this ore will
|
||||
@ -39,5 +40,6 @@ me.register_node("supernatet", {
|
||||
clust_size = 3,
|
||||
y_min = -300,
|
||||
y_max = -90,
|
||||
}
|
||||
},
|
||||
status = "unstable",
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user