mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-06-28 14:16:06 +02:00
[columnia & moreblocks & moreores] Update
This commit is contained in:
@ -283,12 +283,32 @@ function circular_saw.on_metadata_inventory_put(
|
||||
elseif listname == "recycle" then
|
||||
-- Lets look which shape this represents:
|
||||
local cost = circular_saw:get_cost(inv, stackname)
|
||||
circular_saw:update_inventory(pos, cost * count)
|
||||
local input_stack = inv:get_stack("input", 1)
|
||||
-- check if this would not exceed input itemstack max_stacks
|
||||
if input_stack:get_count() + ((cost * count) / 8) <= input_stack:get_stack_max() then
|
||||
circular_saw:update_inventory(pos, cost * count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function circular_saw.on_metadata_inventory_take(
|
||||
pos, listname, index, stack, player)
|
||||
|
||||
-- Prevent (inbuilt) swapping between inventories with different blocks
|
||||
-- corrupting player inventory or Saw with 'unknown' items.
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local input_stack = inv:get_stack(listname, index)
|
||||
if not input_stack:is_empty() and input_stack:get_name()~=stack:get_name() then
|
||||
local player_inv = player:get_inventory()
|
||||
if player_inv:room_for_item("main", input_stack) then
|
||||
player_inv:add_item("main", input_stack)
|
||||
end
|
||||
|
||||
circular_saw:reset(pos)
|
||||
return
|
||||
end
|
||||
|
||||
-- If it is one of the offered stairs: find out how many
|
||||
-- microblocks have to be substracted:
|
||||
if listname == "output" then
|
||||
|
1
mods/moreblocks/description.txt
Normal file
1
mods/moreblocks/description.txt
Normal file
@ -0,0 +1 @@
|
||||
Adds various miscellaneous blocks to the game.
|
1
mods/moreblocks/mod.conf
Normal file
1
mods/moreblocks/mod.conf
Normal file
@ -0,0 +1 @@
|
||||
name = moreblocks
|
@ -46,12 +46,18 @@ for _, name in pairs(default_nodes) do
|
||||
if type(ndef.drop) == "string" then
|
||||
drop = ndef.drop:split(" ")[1]:sub(9)
|
||||
end
|
||||
|
||||
local tiles = ndef.tiles
|
||||
if #ndef.tiles > 1 and ndef.drawtype:find("glass") then
|
||||
tiles = { ndef.tiles[1] }
|
||||
end
|
||||
|
||||
stairsplus:register_all("moreblocks", name, nodename, {
|
||||
description = ndef.description,
|
||||
drop = drop,
|
||||
groups = ndef.groups,
|
||||
sounds = ndef.sounds,
|
||||
tiles = ndef.tiles,
|
||||
tiles = tiles,
|
||||
sunlight_propagates = true,
|
||||
light_source = ndef.light_source
|
||||
})
|
||||
|
Reference in New Issue
Block a user