Added the resizer
This commit is contained in:
parent
6e4c9f1b02
commit
3ea8517ff9
@ -458,3 +458,13 @@ function logikraft.disconnectInCable(name,a)
|
|||||||
table.sort(conns)
|
table.sort(conns)
|
||||||
return table.getkey1(logikraft.cablesconn,conns)
|
return table.getkey1(logikraft.cablesconn,conns)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function logikraft.resizeInCable(name,a)
|
||||||
|
local conns = table.copy(logikraft.cablesconn[name])
|
||||||
|
local cindex = logikraft.cablesnbconn[name][a]
|
||||||
|
|
||||||
|
conns[cindex] = (conns[cindex] >= 16) and (conns[cindex] - 16) or (conns[cindex] + 16)
|
||||||
|
|
||||||
|
table.sort(conns)
|
||||||
|
return table.getkey1(logikraft.cablesconn,conns)
|
||||||
|
end
|
||||||
17
items.lua
17
items.lua
@ -112,3 +112,20 @@ minetest.register_craftitem("logikraft:unlinker", {
|
|||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
minetest.register_craftitem("logikraft:resizer", {
|
||||||
|
description = "The Resizer",
|
||||||
|
inventory_image = "resizer.png",
|
||||||
|
on_place = function(itemstack, user, pointed_thing)
|
||||||
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
|
if not string.startsWith(node.name,"logikraft:cable_")
|
||||||
|
then return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
local index = logikraft.lookingAtNbIndex(user,pointed_thing.under)
|
||||||
|
|
||||||
|
local new = logikraft.resizeInCable(string.without(node.name,"logikraft:cable_"),index)
|
||||||
|
minetest.swap_node(pointed_thing.under, {name = "logikraft:cable_" .. new})
|
||||||
|
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
})
|
||||||
BIN
textures/resizer.png
Normal file
BIN
textures/resizer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
Loading…
x
Reference in New Issue
Block a user