Changed mod name to logikraft
This commit is contained in:
+20
-20
@@ -113,11 +113,11 @@ end
|
||||
nbconn: Which correspond each nodebox correspond to
|
||||
ex: {1,1,2,1} -> nodeboxes 1,2,3 correspond to connection ES, and nodebox 2 correspond to connection W
|
||||
--]]
|
||||
circuits.cablesnb = {}
|
||||
circuits.cablesconn = {}
|
||||
circuits.cablesnbconn = {}
|
||||
logikraft.cablesnb = {}
|
||||
logikraft.cablesconn = {}
|
||||
logikraft.cablesnbconn = {}
|
||||
local function createCables(name,nodeboxes,connections,nbconn)
|
||||
minetest.register_node("circuits:cable_"..name, {
|
||||
minetest.register_node("logikraft:cable_"..name, {
|
||||
tiles = {
|
||||
"cable_gray.png",
|
||||
"cable_gray.png",
|
||||
@@ -150,9 +150,9 @@ local function createCables(name,nodeboxes,connections,nbconn)
|
||||
if name == "EW8_N1_S1"
|
||||
then print(dump(connections2)) end
|
||||
|
||||
circuits.cablesnb[name] = nodeboxes
|
||||
circuits.cablesconn[name] = connections2
|
||||
circuits.cablesnbconn[name] = nbconn2
|
||||
logikraft.cablesnb[name] = nodeboxes
|
||||
logikraft.cablesconn[name] = connections2
|
||||
logikraft.cablesnbconn[name] = nbconn2
|
||||
end
|
||||
|
||||
-- cable_NSEW0
|
||||
@@ -334,24 +334,24 @@ end
|
||||
end
|
||||
--]]
|
||||
|
||||
circuits.cablesfromconn = table.invert(circuits.cablesconn)
|
||||
logikraft.cablesfromconn = table.invert(logikraft.cablesconn)
|
||||
|
||||
|
||||
function circuits.rotateCable(name,r)
|
||||
local conn = circuits.cablesconn[name]
|
||||
function logikraft.rotateCable(name,r)
|
||||
local conn = logikraft.cablesconn[name]
|
||||
local newconn = {}
|
||||
for i,v in ipairs(conn)
|
||||
do
|
||||
newconn[i] = rotate4dir(v,r)
|
||||
end
|
||||
table.sort(newconn)
|
||||
return table.getkey1(circuits.cablesconn,newconn)
|
||||
return table.getkey1(logikraft.cablesconn,newconn)
|
||||
end
|
||||
|
||||
function circuits.connectInCable(name,a,b)
|
||||
local conns = table.copy(circuits.cablesconn[name])
|
||||
local cia = circuits.cablesnbconn[name][a]
|
||||
local cib = circuits.cablesnbconn[name][b]
|
||||
function logikraft.connectInCable(name,a,b)
|
||||
local conns = table.copy(logikraft.cablesconn[name])
|
||||
local cia = logikraft.cablesnbconn[name][a]
|
||||
local cib = logikraft.cablesnbconn[name][b]
|
||||
local conna = conns[cia]
|
||||
local connb = conns[cib]
|
||||
|
||||
@@ -361,12 +361,12 @@ function circuits.connectInCable(name,a,b)
|
||||
table.remove(conns,cib)
|
||||
|
||||
table.sort(conns)
|
||||
return table.getkey1(circuits.cablesconn,conns)
|
||||
return table.getkey1(logikraft.cablesconn,conns)
|
||||
end
|
||||
|
||||
function circuits.disconnectInCable(name,a)
|
||||
local conns = table.copy(circuits.cablesconn[name])
|
||||
local cindex = circuits.cablesnbconn[name][a]
|
||||
function logikraft.disconnectInCable(name,a)
|
||||
local conns = table.copy(logikraft.cablesconn[name])
|
||||
local cindex = logikraft.cablesnbconn[name][a]
|
||||
local conn = conns[cindex]
|
||||
|
||||
table.remove(conns,cindex)
|
||||
@@ -384,5 +384,5 @@ function circuits.disconnectInCable(name,a)
|
||||
end
|
||||
|
||||
table.sort(conns)
|
||||
return table.getkey1(circuits.cablesconn,conns)
|
||||
return table.getkey1(logikraft.cablesconn,conns)
|
||||
end
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
local _contexts = {}
|
||||
|
||||
function circuits.setNameFormspec(targetType, defaultName)
|
||||
function logikraft.setNameFormspec(targetType, defaultName)
|
||||
|
||||
local text = "Please enter the name of this " .. targetType
|
||||
|
||||
@@ -16,12 +16,12 @@ function circuits.setNameFormspec(targetType, defaultName)
|
||||
return table.concat(formspec, "")
|
||||
end
|
||||
|
||||
function circuits.showSetNameFormspec(playerName, targetName)
|
||||
minetest.show_formspec(playerName, "circuits:setNameFormSpec", circuits.setNameFormspec(targetName))
|
||||
function logikraft.showSetNameFormspec(playerName, targetName)
|
||||
minetest.show_formspec(playerName, "logikraft:setNameFormSpec", logikraft.setNameFormspec(targetName))
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "circuits:setNameFormSpec" then return end
|
||||
if formname ~= "logikraft:setNameFormSpec" then return end
|
||||
|
||||
if fields.commit then
|
||||
local pname = player:get_player_name()
|
||||
@@ -29,11 +29,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_node("circuits:circuitBlock", {
|
||||
minetest.register_node("logikraft:circuitBlock", {
|
||||
description = "Circuit Block",
|
||||
tiles = {"circuit_block.png"},
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
circuits.discoverBlocks(pos)
|
||||
logikraft.discoverBlocks(pos)
|
||||
end,
|
||||
groups = {circuitry = 1,dig_immediate = 3}
|
||||
})
|
||||
@@ -42,7 +42,7 @@ local function remove_no_destruct(pos)
|
||||
minetest.check_for_falling(pos)
|
||||
end
|
||||
|
||||
minetest.register_node("circuits:component_head", {
|
||||
minetest.register_node("logikraft:component_head", {
|
||||
drawtype = "block",
|
||||
tiles = {"component.png"},
|
||||
groups = {circuitry = 1,dig_immediate = 3},
|
||||
@@ -85,10 +85,10 @@ minetest.register_node("circuits:component_head", {
|
||||
end
|
||||
end
|
||||
-- If we reached this point, we can build the component
|
||||
minetest.set_node(pos, {name = "circuits:component_head", param2 = dir})
|
||||
minetest.set_node(pos, {name = "logikraft:component_head", param2 = dir})
|
||||
for i = 1,w*h-1 do
|
||||
local loc = addToPos8dir(dir,pos,i%w,(i-i%w)/w)
|
||||
minetest.set_node(loc, {name = "circuits:component_tail", param2 = dir})
|
||||
minetest.set_node(loc, {name = "logikraft:component_tail", param2 = dir})
|
||||
end
|
||||
|
||||
if not minetest.is_creative_enabled(player_name) then
|
||||
@@ -104,11 +104,11 @@ minetest.register_node("circuits:component_head", {
|
||||
|
||||
dir = node.param2
|
||||
|
||||
remove_no_destruct(pos) -- Should be circuits:component_head
|
||||
remove_no_destruct(pos) -- Should be logikraft:component_head
|
||||
for i = 1,w*h-1 do
|
||||
local loc = addToPos8dir(dir,pos,i%w,(i-i%w)/w)
|
||||
local onode = minetest.get_node(loc)
|
||||
if onode.name == "circuits:component_tail" and onode.param2 == dir
|
||||
if onode.name == "logikraft:component_tail" and onode.param2 == dir
|
||||
then
|
||||
remove_no_destruct(loc)
|
||||
end
|
||||
@@ -117,7 +117,7 @@ minetest.register_node("circuits:component_head", {
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("circuits:component_tail", {
|
||||
minetest.register_node("logikraft:component_tail", {
|
||||
drawtype = "block",
|
||||
paramtype2 = "4dir",
|
||||
groups = {circuitry = 1},
|
||||
|
||||
Reference in New Issue
Block a user