Version MFF.

This commit is contained in:
sys4-fr
2018-09-08 13:07:27 +02:00
parent f92a938d75
commit 17a4963cb6
97 changed files with 281 additions and 278 deletions

43
circular_saw.lua Normal file → Executable file
View File

@ -31,36 +31,33 @@ circular_saw.cost_in_microblocks = {
6, 2, 1, 3, 4,
}
-- This parameter is legacy node
circular_saw.names = {
{"micro", "_1"},
{"panel", "_1"},
{"micro", "_2"},
{"panel", "_2"},
{"micro", "_4"},
{"panel", "_4"},
{"micro", ""},
{"panel", ""},
{"micro", "_12"},
{"panel", "_12"},
{"micro", "_14"},
{"panel", "_14"},
{"micro", "_15"},
{"panel", "_15"},
{"stair", "_outer"},
{"stair", ""},
{"stair", "_inner"},
{"slab", "_1"},
{"slab", "_2"},
{"slab", "_quarter"},
{"slab", ""},
{"slab", "_three_quarter"},
{"slab", "_14"},
{"slab", "_15"},
{"stair", "_half"},
{"stair", "_alt_1"},
{"stair", "_alt_2"},
{"stair", "_alt_4"},
{"stair", "_alt"},
{"slope", ""},
{"slope", "_half"},
{"slope", "_half_raised"},
@ -100,12 +97,14 @@ function circular_saw:get_output_inv(modname, material, amount, max)
for i = 1, #circular_saw.names do
local t = circular_saw.names[i]
local cost = circular_saw.cost_in_microblocks[i]
local balance = math.min(math.floor(amount/cost), max)
local nodename = modname .. ":" .. t[1] .. "_" .. material .. t[2]
if minetest.registered_nodes[nodename] then
pos = pos + 1
list[pos] = nodename .. " " .. balance
if not t[3] then
local cost = circular_saw.cost_in_microblocks[i]
local balance = math.min(math.floor(amount/cost), max)
local nodename = modname .. ":" .. t[1] .. "_" .. material .. t[2]
if minetest.registered_nodes[nodename] then
pos = pos + 1
list[pos] = nodename .. " " .. balance
end
end
end
return list
@ -145,7 +144,7 @@ function circular_saw:update_inventory(pos, amount)
self:reset(pos)
return
end
local stack = inv:get_stack("input", 1)
-- At least one "normal" block is necessary to see what kind of stairs are requested.
if stack:is_empty() then
@ -371,14 +370,14 @@ function circular_saw.can_dig(pos,player)
end
minetest.register_node("moreblocks:circular_saw", {
description = S("Circular Saw"),
drawtype = "nodebox",
description = S("Circular Saw"),
drawtype = "nodebox",
node_box = {
type = "fixed",
type = "fixed",
fixed = {
{-0.4, -0.5, -0.4, -0.25, 0.25, -0.25}, -- Leg
{0.25, -0.5, 0.25, 0.4, 0.25, 0.4}, -- Leg
{-0.4, -0.5, 0.25, -0.25, 0.25, 0.4}, -- Leg
{-0.4, -0.5, 0.25, -0.25, 0.25, 0.4}, -- Leg
{0.25, -0.5, -0.4, 0.4, 0.25, -0.25}, -- Leg
{-0.5, 0.25, -0.5, 0.5, 0.375, 0.5}, -- Tabletop
{-0.01, 0.4375, -0.125, 0.01, 0.5, 0.125}, -- Saw blade (top)
@ -389,9 +388,9 @@ minetest.register_node("moreblocks:circular_saw", {
tiles = {"moreblocks_circular_saw_top.png",
"moreblocks_circular_saw_bottom.png",
"moreblocks_circular_saw_side.png"},
paramtype = "light",
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
paramtype2 = "facedir",
groups = {choppy = 2,oddly_breakable_by_hand = 2},
sounds = default.node_sound_wood_defaults(),
on_construct = circular_saw.on_construct,