Skip to content
Snippets Groups Projects
Commit 2939255d authored by Milan's avatar Milan
Browse files

...

parents 916b2163 8c59b1bf
No related branches found
No related tags found
No related merge requests found
......@@ -133,12 +133,12 @@ local function cap(str)
end
-- Higher number = stronger enchant.
local use_factor = 1.5
local times_subtractor = 0.4
local damage_adder = 2
local strength_factor = 1.8
local speed_factor = 0.4
local jump_factor = 0.3
enchanting.uses = 1.2
enchanting.times = 0.1
enchanting.damages = 1
enchanting.strength = 1.2
enchanting.speed = 0.2
enchanting.jump = 0.2
local tools = {
--[[ Registration format :
......@@ -180,13 +180,13 @@ for _, ench in pairs(tooldef[3]) do
local max_drop_level = original_tool.tool_capabilities.max_drop_level
if enchant == "durable" then
groupcaps[group].uses = math.ceil(original_groupcaps[group].uses * use_factor)
groupcaps[group].uses = math.ceil(original_groupcaps[group].uses * enchanting.uses)
elseif enchant == "fast" then
for i = 1, 3 do
groupcaps[group].times[i] = original_groupcaps[group].times[i] - times_subtractor
groupcaps[group].times[i] = original_groupcaps[group].times[i] - enchanting.times
end
elseif enchant == "sharp" then
fleshy = fleshy + damage_adder
fleshy = fleshy + enchanting.damages
end
minetest.register_tool(":"..mod..":enchanted_"..tool.."_"..material.."_"..enchant, {
......@@ -205,15 +205,15 @@ for _, ench in pairs(tooldef[3]) do
local original_armor_groups = original_tool.groups
local armorcaps = table.copy(original_armor_groups)
local armorcaps = {}
armorcaps.not_in_creative_inventory=1
armorcaps.not_in_creative_inventory = 1
for armor_group, value in pairs(original_armor_groups) do
if enchant == "strong" then
armorcaps[armor_group] = math.ceil(value * strength_factor)
armorcaps[armor_group] = math.ceil(value * enchanting.strength)
elseif enchant == "speed" then
armorcaps[armor_group] = value
armorcaps.physics_speed = speed_factor
armorcaps.physics_jump = jump_factor
armorcaps.physics_speed = enchanting.speed
armorcaps.physics_jump = enchanting.jump
end
end
......
local worktable = {}
screwdriver = screwdriver or {}
local nodes = { -- Nodes allowed to be cut. Mod name = {node name}.
["default"] = {"wood", "junglewood", "pine_wood", "acacia_wood",
"tree", "jungletree", "pine_tree", "acacia_tree",
"cobble", "mossycobble", "desert_cobble",
"stone", "sandstone", "desert_stone", "obsidian",
"stonebrick", "sandstonebrick", "desert_stonebrick", "obsidianbrick",
"coalblock", "copperblock", "steelblock", "goldblock",
"bronzeblock", "mese", "diamondblock",
"brick", "cactus", "ice", "meselamp", "glass", "obsidian_glass"},
["xdecor"] = {"coalstone_tile", "desertstone_tile", "stone_rune", "stone_tile",
"cactusbrick", "hard_clay", "packed_ice", "moonbrick",
"woodframed_glass", "wood_tile"},
local nodes = { -- Nodes allowed to be cut. Registration format: [mod name] = [[ node names ]].
["default"] = [[
wood tree cobble desert_stone
junglewood jungletree mossycobble stonebrick
pine_wood pine_tree desert_cobble sandstonebrick
acacia_wood acacia_tree stone desert_stonebrick
aspen_wood aspen_tree sandstone obsidianbrick
coalblock mese obsidian
copperblock brick obsidian_glass
steelblock cactus
goldblock ice
bronzeblock meselamp
diamondblock glass
]],
["xdecor"] = [[
coalstone_tile hard_clay
desertstone_tile packed_ice
stone_rune moonbrick
stone_tile woodframed_glass
cactusbrick wood_tile
]],
}
local def = { -- Nodebox name, yield, definition.
{"nanoslab", 16, {-.5,-.5,-.5,0,-.4375,0}},
{"micropanel", 16, {-.5,-.5,-.5,.5,-.4375,0}},
{"microslab", 8, {-.5,-.5,-.5,.5,-.4375,.5}},
{"thinstair", 8, {{-.5,-.0625,-.5,.5,0,0},{-.5,.4375,0,.5,.5,.5}}},
{"cube", 4, {-.5,-.5,0,0,0,.5}},
{"panel", 4, {-.5,-.5,-.5,.5,0,0}},
{"slab", 2, {-.5,-.5,-.5,.5,0,.5}},
{"doublepanel", 2, {{-.5,-.5,-.5,.5,0,0},{-.5,0,0,.5,.5,.5}}},
{"halfstair", 2, {{-.5,-.5,-.5,0,0,.5},{-.5,0,0,0,.5,.5}}},
{"outerstair", 1, {{-.5,-.5,-.5,.5,0,.5},{-.5,0,0,0,.5,.5}}},
{"stair", 1, {{-.5,-.5,-.5,.5,0,.5},{-.5,0,0,.5,.5,.5}}},
{"innerstair", 1, {{-.5,-.5,-.5,.5,0,.5},{-.5,0,0,.5,.5,.5},{-.5,0,-.5,0,.5,0}}}
local defs = { -- Nodebox name, yield, definition.
{"nanoslab", 16, {-.5,-.5,-.5,0,-.4375,0}},
{"micropanel", 16, {-.5,-.5,-.5,.5,-.4375,0}},
{"microslab", 8, {-.5,-.5,-.5,.5,-.4375,.5}},
{"thinstair", 8, {{-.5,-.0625,-.5,.5,0,0},{-.5,.4375,0,.5,.5,.5}}},
{"cube", 4, {-.5,-.5,0,0,0,.5}},
{"panel", 4, {-.5,-.5,-.5,.5,0,0}},
{"slab", 2, {-.5,-.5,-.5,.5,0,.5}},
{"doublepanel", 2, {{-.5,-.5,-.5,.5,0,0},{-.5,0,0,.5,.5,.5}}},
{"halfstair", 2, {{-.5,-.5,-.5,0,0,.5},{-.5,0,0,0,.5,.5}}},
{"outerstair", 1, {{-.5,-.5,-.5,.5,0,.5},{-.5,0,0,0,.5,.5}}},
{"stair", 1, {{-.5,-.5,-.5,.5,0,.5},{-.5,0,0,.5,.5,.5}}},
{"innerstair", 1, {{-.5,-.5,-.5,.5,0,.5},{-.5,0,0,.5,.5,.5},{-.5,0,-.5,0,.5,0}}}
}
function worktable.get_recipe(item)
......@@ -38,8 +48,8 @@ function worktable.get_recipe(item)
elseif minetest.registered_items["default:"..item:sub(7)] then
item = item:gsub("group:", "default:")
else
for node, definition in pairs(minetest.registered_items) do
if definition.groups[item:match("[^,:]+$")] then
for node, def in pairs(minetest.registered_items) do
if def.groups[item:match("[^,:]+$")] then
item = node
end
end
......@@ -128,7 +138,8 @@ local function tab_category(tab_id)
minetest.registered_items,
minetest.registered_nodes,
minetest.registered_tools,
minetest.registered_craftitems }
minetest.registered_craftitems
}
return id_category[tab_id] or id_category[1]
end
......@@ -226,8 +237,8 @@ function worktable.fields(pos, _, fields)
elseif fields.storage then
worktable.formspecs.storage(meta)
elseif fields.craftguide or fields.clearfilter then
worktable.craftguide_main_list(meta, nil, 1)
worktable.craftguide_formspec(meta, 1, nil, 1, "", 1)
worktable.craftguide_main_list(meta, nil, tab_id)
worktable.craftguide_formspec(meta, 1, nil, 1, "", tab_id)
elseif fields.alternate then
local item = formspec:match("item_image%[.*;([%w_:]+)%]") or ""
local recipe_num = tonumber(formspec:match("Recipe%s(%d+)")) or 1
......@@ -261,13 +272,10 @@ function worktable.dig(pos)
inv:is_empty("tool") and inv:is_empty("storage")
end
function worktable.allowed(table, element)
if table then
for _, value in pairs(table) do
if value == element then
return true
end
end
function worktable.allowed(mod, node)
if not mod then return end
for it in mod:gmatch("[%w_]+") do
if it == node then return true end
end
return false
end
......@@ -322,7 +330,7 @@ function worktable.get_output(inv, stack)
end
local input, output = inv:get_stack("input", 1), {}
for _, n in pairs(def) do
for _, n in pairs(defs) do
local count = math.min(n[2] * input:get_count(), input:get_stack_max())
output[#output+1] = stack:get_name().."_"..n[1].." "..count
end
......@@ -348,7 +356,7 @@ function worktable.on_take(pos, listname, index, stack)
inv:set_list("forms", {})
end
elseif listname == "forms" then
inputstack:take_item(math.ceil(stack:get_count() / def[index][2]))
inputstack:take_item(math.ceil(stack:get_count() / defs[index][2]))
inv:set_stack("input", 1, inputstack)
worktable.get_output(inv, inputstack)
end
......@@ -374,9 +382,9 @@ xdecor.register("worktable", {
allow_metadata_inventory_move = worktable.move
})
for _, d in pairs(def) do
for _, d in pairs(defs) do
for mod, n in pairs(nodes) do
for _, name in pairs(n) do
for name in n:gmatch("[%w_]+") do
local ndef = minetest.registered_nodes[mod..":"..name]
if ndef then
local groups, tiles, light = {}, {}
......
......@@ -7,9 +7,9 @@ screwdriver = screwdriver or {}
xwall.get_candidate = {}
local profiles = {
{0, "_c0", 0}, {1, "_c1", 1}, {2, "_c1", 0}, {4, "_c1", 3},
{8, "_c1", 2}, {5, "_ln", 1}, {10, "_ln", 0}, {3, "_c2", 0},
{6, "_c2", 3}, {12, "_c2", 2}, {9, "_c2", 1}, {7, "_c3", 3},
{0, "_c0", 0}, {1, "_c1", 1}, {2, "_c1", 0}, {4, "_c1", 3},
{8, "_c1", 2}, {5, "_ln", 1}, {10, "_ln", 0}, {3, "_c2", 0},
{6, "_c2", 3}, {12, "_c2", 2}, {9, "_c2", 1}, {7, "_c3", 3},
{11, "_c3", 0}, {13, "_c3", 1}, {14, "_c3", 2}, {15, "_c4", 1}
}
......@@ -18,7 +18,7 @@ for _, p in pairs(profiles) do
end
local directions = {
{x=1, y=0, z=0}, {x=0, y=0, z=1},
{x=1, y=0, z=0}, {x=0, y=0, z=1},
{x=-1, y=0, z=0}, {x=0, y=0, z=-1}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment