Use git submodules for mods
Conflicts: mods/digilines mods/digilines/digilines/wire_std.lua mods/digilines/digilines_lcd/init.lua mods/digilines/digilines_lightsensor/init.lua mods/digilines/digilines_rtc/init.luamaster
|
@ -0,0 +1,27 @@
|
|||
[submodule "mods/technic"]
|
||||
path = mods/technic
|
||||
url = https://github.com/RealBadAngel/technic.git
|
||||
[submodule "mods/digilines"]
|
||||
path = mods/digilines
|
||||
url = https://github.com/Jeija/minetest-mod-digilines.git
|
||||
[submodule "mods/mesecons"]
|
||||
path = mods/mesecons
|
||||
url = https://github.com/Jeija/minetest-mod-mesecons.git
|
||||
[submodule "mods/moretrees"]
|
||||
path = mods/moretrees
|
||||
url = https://github.com/VanessaE/moretrees.git
|
||||
[submodule "mods/pipeworks"]
|
||||
path = mods/pipeworks
|
||||
url = https://github.com/VanessaE/pipeworks.git
|
||||
[submodule "mods/plantlife"]
|
||||
path = mods/plantlife
|
||||
url = https://github.com/VanessaE/plantlife.git
|
||||
[submodule "mods/moreblocks"]
|
||||
path = mods/moreblocks
|
||||
url = https://github.com/Calinou/moreblocks
|
||||
[submodule "mods/moreores"]
|
||||
path = mods/moreores
|
||||
url = https://github.com/Calinou/moreores
|
||||
[submodule "mods/forth_computer"]
|
||||
path = mods/forth_computer
|
||||
url = https://github.com/Novatux/forth_computer.git
|
|
@ -1 +0,0 @@
|
|||
default
|
|
@ -1,508 +0,0 @@
|
|||
--Minetest 0.4.6 mod: concrete
|
||||
--(c) 2013 by RealBadAngel <mk@realbadangel.pl>
|
||||
|
||||
minetest.register_craft({
|
||||
output = ':technic:rebar 6',
|
||||
recipe = {
|
||||
{'','', 'default:steel_ingot'},
|
||||
{'','default:steel_ingot',''},
|
||||
{'default:steel_ingot', '', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = ':technic:concrete 5',
|
||||
recipe = {
|
||||
{'default:stone','technic:rebar','default:stone'},
|
||||
{'technic:rebar','default:stone','technic:rebar'},
|
||||
{'default:stone','technic:rebar','default:stone'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = ':technic:concrete_post_platform 6',
|
||||
recipe = {
|
||||
{'technic:concrete','technic:concrete_post','technic:concrete'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = ':technic:concrete_post 12',
|
||||
recipe = {
|
||||
{'default:stone','technic:rebar','default:stone'},
|
||||
{'default:stone','technic:rebar','default:stone'},
|
||||
{'default:stone','technic:rebar','default:stone'},
|
||||
}
|
||||
})
|
||||
|
||||
platform_box = {-0.5 , 0.3 , -0.5 , 0.5 , 0.5 , 0.5 }
|
||||
post_str_y={ -0.15 , -0.5 , -0.15 , 0.15 , 0.5 , 0.15 }
|
||||
post_str_x1={ 0 , -0.3 , -0.1, 0.5 , 0.3 , 0.1 } -- x+
|
||||
post_str_z1={ -0.1 , -0.3 , 0, 0.1 , 0.3 , 0.5 } -- z+
|
||||
post_str_x2={ 0 , -0.3 , -0.1, -0.5 , 0.3 , 0.1 } -- x-
|
||||
post_str_z2={ -0.1 , -0.3 , 0, 0.1 , 0.3 , -0.5 } -- z-
|
||||
|
||||
minetest.register_craftitem(":technic:rebar", {
|
||||
description = "Rebar",
|
||||
inventory_image = "technic_rebar.png",
|
||||
stack_max = 99,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":technic:concrete", {
|
||||
description = "Concrete Block",
|
||||
inventory_image = "technic_concrete_block.png",
|
||||
stack_max = 99,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":technic:concrete_post", {
|
||||
description = "Concrete Post",
|
||||
stack_max = 99,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":technic:concrete_post_platform", {
|
||||
description = "Concrete Post Platform",
|
||||
stack_max = 99,
|
||||
})
|
||||
|
||||
minetest.register_node(":technic:concrete", {
|
||||
description = "Concrete Block",
|
||||
tile_images = {"technic_concrete_block.png",},
|
||||
is_ground_content = true,
|
||||
groups={cracky=1,level=2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
paramtype = "light",
|
||||
light_source = 0,
|
||||
sunlight_propagates = true,
|
||||
on_construct = function(pos)
|
||||
meta=minetest.env:get_meta(pos)
|
||||
meta:set_float("postlike",1)
|
||||
check_post_connections (pos,1)
|
||||
end,
|
||||
after_dig_node = function (pos, oldnode, oldmetadata, digger)
|
||||
check_post_connections (pos,0)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node(":technic:concrete_post_platform", {
|
||||
description = "Concrete Post Platform",
|
||||
tile_images = {"technic_concrete_block.png",},
|
||||
is_ground_content = true,
|
||||
groups={cracky=1,level=2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
paramtype = "light",
|
||||
light_source = 0,
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {platform_box}
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {platform_box}
|
||||
},
|
||||
on_place=function (itemstack, placer, pointed_thing)
|
||||
local node=minetest.env:get_node(pointed_thing.under)
|
||||
if minetest.get_item_group(node.name, "concrete_post")==0 then
|
||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
end
|
||||
local meta=minetest.env:get_meta(pointed_thing.under)
|
||||
y1=meta:get_float("y1")
|
||||
platform=meta:get_float("platform")
|
||||
if y1==1 or platform==1 then
|
||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
end
|
||||
y2=meta:get_float("y2")
|
||||
x1=meta:get_float("x1")
|
||||
x2=meta:get_float("x2")
|
||||
z1=meta:get_float("z1")
|
||||
z2=meta:get_float("z2")
|
||||
rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,1)
|
||||
meta:set_float("platform",1)
|
||||
hacky_swap_posts(pointed_thing.under,"technic:concrete_post"..rule)
|
||||
itemstack:take_item()
|
||||
placer:set_wielded_item(itemstack)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node(":technic:concrete_post", {
|
||||
description = "Concrete Post",
|
||||
tiles = {"technic_concrete_block.png"},
|
||||
groups={cracky=1,level=2,concrete_post=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
paramtype = "light",
|
||||
light_source = 0,
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.15 , -0.5 , -0.15 , 0.15 , 0.5 , 0.15 }},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.15 , -0.5 , -0.15 , 0.15 , 0.5 , 0.15 }},
|
||||
on_construct = function(pos)
|
||||
meta=minetest.env:get_meta(pos)
|
||||
meta:set_int("postlike",1)
|
||||
meta:set_int("platform",0)
|
||||
meta:set_int("x1",0)
|
||||
meta:set_int("x2",0)
|
||||
meta:set_int("y1",0)
|
||||
meta:set_int("y2",0)
|
||||
meta:set_int("z1",0)
|
||||
meta:set_int("z2",0)
|
||||
check_post_connections (pos,1)
|
||||
end,
|
||||
|
||||
after_dig_node = function (pos, oldnode, oldmetadata, digger)
|
||||
check_post_connections (pos,0)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
local x1,x2,y1,z1,z2
|
||||
local count=0
|
||||
|
||||
for x1 = 0, 1, 1 do --x-
|
||||
for x2 = 0, 1, 1 do --x+
|
||||
for z1 = 0, 1, 1 do --z-
|
||||
for z2 = 0, 1, 1 do --z+
|
||||
|
||||
temp_x1={} temp_x2={} temp_z1={} temp_z2={}
|
||||
|
||||
if x1==1 then temp_x1=post_str_x1 end
|
||||
if x2==1 then temp_x2=post_str_x2 end
|
||||
if z1==1 then temp_z1=post_str_z1 end
|
||||
if z2==1 then temp_z2=post_str_z2 end
|
||||
|
||||
|
||||
minetest.register_node(":technic:concrete_post"..count, {
|
||||
description = "Concrete Post",
|
||||
tiles = {"technic_concrete_block.png"},
|
||||
groups={cracky=1,level=2,not_in_creative_inventory=1,concrete_post=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = "technic:concrete_post",
|
||||
paramtype = "light",
|
||||
light_source = 0,
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
temp_x1,temp_x2,post_str_y,temp_z1,temp_z2,
|
||||
}},
|
||||
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
temp_x1,temp_x2,post_str_y,temp_z1,temp_z2,
|
||||
}},
|
||||
|
||||
after_dig_node = function (pos, oldnode, oldmetadata, digger)
|
||||
check_post_connections (pos,0)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_node(":technic:concrete_post"..count+16, {
|
||||
description = "Concrete Post",
|
||||
tiles = {"technic_concrete_block.png"},
|
||||
groups={cracky=1,level=2,not_in_creative_inventory=1,concrete_post=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = "technic:concrete_post_platform",
|
||||
paramtype = "light",
|
||||
light_source = 0,
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
platform_box,temp_x1,temp_x2,post_str_y,temp_z1,temp_z2,
|
||||
}},
|
||||
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
platform_box,temp_x1,temp_x2,post_str_y,temp_z1,temp_z2,
|
||||
}},
|
||||
|
||||
after_dig_node = function (pos, oldnode, oldmetadata, digger)
|
||||
dig_post_with_platform (pos,oldnode,oldmetadata)
|
||||
end,
|
||||
})
|
||||
|
||||
count=count+1 end end end end
|
||||
|
||||
minetest.register_node(":technic:concrete_post32", {
|
||||
description = "Concrete Post",
|
||||
tiles = {"technic_concrete_block.png"},
|
||||
groups={cracky=1,level=2,not_in_creative_inventory=1,concrete_post=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = "technic:concrete_post",
|
||||
paramtype = "light",
|
||||
light_source = 0,
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5,-0.3,-0.1,0.5,0.3,0.1},
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
post_str_x1,post_str_x2,
|
||||
}},
|
||||
|
||||
after_dig_node = function (pos, oldnode, oldmetadata, digger)
|
||||
check_post_connections (pos,0)
|
||||
end,
|
||||
})
|
||||
minetest.register_node(":technic:concrete_post33", {
|
||||
description = "Concrete Post",
|
||||
tiles = {"technic_concrete_block.png"},
|
||||
groups={cracky=1,level=2,not_in_creative_inventory=1,concrete_post=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = "technic:concrete_post",
|
||||
paramtype = "light",
|
||||
light_source = 0,
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
post_str_z1,post_str_z2,
|
||||
}},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
post_str_z1,post_str_z2,
|
||||
}},
|
||||
|
||||
after_dig_node = function (pos, oldnode, oldmetadata, digger)
|
||||
check_post_connections (pos,0)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node(":technic:concrete_post34", {
|
||||
description = "Concrete Post",
|
||||
tiles = {"technic_concrete_block.png"},
|
||||
groups={cracky=1,level=2,not_in_creative_inventory=1,concrete_post=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = "technic:concrete_post_platform",
|
||||
paramtype = "light",
|
||||
light_source = 0,
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
platform_box,post_str_x1,post_str_x2,
|
||||
}},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
platform_box,post_str_x1,post_str_x2,
|
||||
}},
|
||||
|
||||
after_dig_node = function (pos, oldnode, oldmetadata, digger)
|
||||
dig_post_with_platform (pos,oldnode,oldmetadata)
|
||||
end,
|
||||
})
|
||||
minetest.register_node(":technic:concrete_post35", {
|
||||
description = "Concrete Post",
|
||||
tiles = {"technic_concrete_block.png"},
|
||||
groups={cracky=1,level=2,not_in_creative_inventory=1,concrete_post=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = "technic:concrete_post_platform",
|
||||
paramtype = "light",
|
||||
light_source = 0,
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
platform_box,post_str_z1,post_str_z2,
|
||||
}},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
platform_box,post_str_z1,post_str_z2,
|
||||
}},
|
||||
after_dig_node = function (pos, oldnode, oldmetadata, digger)
|
||||
dig_post_with_platform (pos,oldnode,oldmetadata)
|
||||
end,
|
||||
})
|
||||
|
||||
dig_post_with_platform = function (pos,oldnode,oldmetadata)
|
||||
x1=tonumber(oldmetadata.fields["x1"])
|
||||
x2=tonumber(oldmetadata.fields["x2"])
|
||||
y1=tonumber(oldmetadata.fields["y1"])
|
||||
y2=tonumber(oldmetadata.fields["y2"])
|
||||
z1=tonumber(oldmetadata.fields["z1"])
|
||||
z2=tonumber(oldmetadata.fields["z2"])
|
||||
print(dump(x1))
|
||||
oldmetadata.fields["platform"]="0"
|
||||
local rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,0)
|
||||
print(dump(rule))
|
||||
oldnode.name="technic:concrete_post"..rule
|
||||
minetest.env:set_node(pos,oldnode)
|
||||
meta = minetest.env:get_meta(pos)
|
||||
meta:from_table(oldmetadata)
|
||||
end
|
||||
|
||||
check_post_connections = function(pos,mode)
|
||||
local pos1={}
|
||||
pos1.x=pos.x
|
||||
pos1.y=pos.y
|
||||
pos1.z=pos.z
|
||||
tempx1=0
|
||||
tempx2=0
|
||||
tempy1=0
|
||||
tempy2=0
|
||||
tempz1=0
|
||||
tempz2=0
|
||||
|
||||
pos1.x=pos1.x+1
|
||||
if minetest.env:get_meta(pos1):get_int("postlike")==1 then
|
||||
x2=mode
|
||||
x1=minetest.env:get_meta(pos1):get_int("x1")
|
||||
y1=minetest.env:get_meta(pos1):get_int("y1")
|
||||
y2=minetest.env:get_meta(pos1):get_int("y2")
|
||||
z1=minetest.env:get_meta(pos1):get_int("z1")
|
||||
z2=minetest.env:get_meta(pos1):get_int("z2")
|
||||
platform=minetest.env:get_meta(pos1):get_int("platform")
|
||||
rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
|
||||
hacky_swap_posts(pos1,"technic:concrete_post"..rule)
|
||||
meta=minetest.env:get_meta(pos1)
|
||||
meta:set_int("x2",x2)
|
||||
tempx1=mode
|
||||
end
|
||||
|
||||
pos1.x=pos1.x-2
|
||||
if minetest.env:get_meta(pos1):get_int("postlike")==1 then
|
||||
x1=mode
|
||||
x2=minetest.env:get_meta(pos1):get_int("x2")
|
||||
y1=minetest.env:get_meta(pos1):get_int("y1")
|
||||
y2=minetest.env:get_meta(pos1):get_int("y2")
|
||||
z1=minetest.env:get_meta(pos1):get_int("z1")
|
||||
z2=minetest.env:get_meta(pos1):get_int("z2")
|
||||
platform=minetest.env:get_meta(pos1):get_int("platform")
|
||||
rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
|
||||
hacky_swap_posts(pos1,"technic:concrete_post"..rule)
|
||||
meta=minetest.env:get_meta(pos1)
|
||||
meta:set_int("x1",x1)
|
||||
tempx2=mode
|
||||
end
|
||||
|
||||
pos1.x=pos1.x+1
|
||||
|
||||
pos1.y=pos1.y+1
|
||||
if minetest.env:get_meta(pos1):get_int("postlike")==1 then
|
||||
y2=mode
|
||||
x1=minetest.env:get_meta(pos1):get_int("x1")
|
||||
x2=minetest.env:get_meta(pos1):get_int("x2")
|
||||
y1=minetest.env:get_meta(pos1):get_int("y1")
|
||||
z1=minetest.env:get_meta(pos1):get_int("z1")
|
||||
z2=minetest.env:get_meta(pos1):get_int("z2")
|
||||
platform=minetest.env:get_meta(pos1):get_int("platform")
|
||||
rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
|
||||
hacky_swap_posts(pos1,"technic:concrete_post"..rule)
|
||||
meta=minetest.env:get_meta(pos1)
|
||||
meta:set_int("y2",y2)
|
||||
tempy1=mode
|
||||
end
|
||||
|
||||
pos1.y=pos1.y-2
|
||||
if minetest.env:get_meta(pos1):get_int("postlike")==1 then
|
||||
y1=mode
|
||||
x1=minetest.env:get_meta(pos1):get_int("x1")
|
||||
x2=minetest.env:get_meta(pos1):get_int("x2")
|
||||
y2=minetest.env:get_meta(pos1):get_int("y2")
|
||||
z1=minetest.env:get_meta(pos1):get_int("z1")
|
||||
z2=minetest.env:get_meta(pos1):get_int("z2")
|
||||
platform=minetest.env:get_meta(pos1):get_int("platform")
|
||||
rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
|
||||
hacky_swap_posts(pos1,"technic:concrete_post"..rule)
|
||||
meta=minetest.env:get_meta(pos1)
|
||||
meta:set_int("y1",y1)
|
||||
tempy2=mode
|
||||
end
|
||||
pos1.y=pos1.y+1
|
||||
|
||||
pos1.z=pos1.z+1
|
||||
if minetest.env:get_meta(pos1):get_int("postlike")==1 then
|
||||
z2=mode
|
||||
x1=minetest.env:get_meta(pos1):get_int("x1")
|
||||
x2=minetest.env:get_meta(pos1):get_int("x2")
|
||||
y1=minetest.env:get_meta(pos1):get_int("y1")
|
||||
y2=minetest.env:get_meta(pos1):get_int("y2")
|
||||
z1=minetest.env:get_meta(pos1):get_int("z1")
|
||||
platform=minetest.env:get_meta(pos1):get_int("platform")
|
||||
rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
|
||||
hacky_swap_posts(pos1,"technic:concrete_post"..rule)
|
||||
meta=minetest.env:get_meta(pos1)
|
||||
meta:set_int("z2",z2)
|
||||
tempz1=mode
|
||||
end
|
||||
pos1.z=pos1.z-2
|
||||
|
||||
if minetest.env:get_meta(pos1):get_int("postlike")==1 then
|
||||
z1=mode
|
||||
x1=minetest.env:get_meta(pos1):get_int("x1")
|
||||
x2=minetest.env:get_meta(pos1):get_int("x2")
|
||||
y1=minetest.env:get_meta(pos1):get_int("y1")
|
||||
y2=minetest.env:get_meta(pos1):get_int("y2")
|
||||
z2=minetest.env:get_meta(pos1):get_int("z2")
|
||||
platform=minetest.env:get_meta(pos1):get_int("platform")
|
||||
rule=make_post_rule_number(x1,x2,y1,y2,z1,z2,platform)
|
||||
hacky_swap_posts(pos1,"technic:concrete_post"..rule)
|
||||
meta=minetest.env:get_meta(pos1)
|
||||
meta:set_int("z1",z1)
|
||||
tempz2=mode
|
||||
end
|
||||
pos1.z=pos1.z+1
|
||||
if mode==1 then
|
||||
meta=minetest.env:get_meta(pos)
|
||||
meta:set_int("x1",tempx1)
|
||||
meta:set_int("x2",tempx2)
|
||||
meta:set_int("y1",tempy1)
|
||||
meta:set_int("y2",tempy2)
|
||||
meta:set_int("z1",tempz1)
|
||||
meta:set_int("z2",tempz2)
|
||||
rule=make_post_rule_number(tempx1,tempx2,tempy1,tempy2,tempz1,tempz2,0)
|
||||
hacky_swap_posts(pos,"technic:concrete_post"..rule)
|
||||
end
|
||||
end
|
||||
|
||||
function make_post_rule_number (x1,x2,y1,y2,z1,z2,platform)
|
||||
local tempy=y1+y2
|
||||
local tempx=x1+x2
|
||||
local tempz=z1+z2
|
||||
if platform==0 then
|
||||
if tempy==0 and tempx==0 and tempz==0 then return 0 end
|
||||
if x1==1 and x2==1 and tempz==0 and tempy==0 then return 32 end
|
||||
if z1==1 and z2==1 and tempx==0 and tempy==0 then return 33 end
|
||||
return z2+z1*2+x2*4+x1*8
|
||||
else
|
||||
if tempy==0 and tempx==0 and tempz==0 then return 16 end
|
||||
if x1==1 and x2==1 and tempz==0 and tempy==0 then return 34 end
|
||||
if z1==1 and z2==1 and tempx==0 and tempy==0 then return 35 end
|
||||
return z2+z1*2+x2*4+x1*8+16
|
||||
end
|
||||
end
|
||||
|
||||
function hacky_swap_posts(pos,name)
|
||||
local node = minetest.env:get_node(pos)
|
||||
if node.name == "technic:concrete" then
|
||||
return nil
|
||||
end
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
local meta0 = meta:to_table()
|
||||
node.name = name
|
||||
local meta0 = meta:to_table()
|
||||
minetest.env:set_node(pos,node)
|
||||
meta = minetest.env:get_meta(pos)
|
||||
meta:from_table(meta0)
|
||||
return 1
|
||||
end
|
Before Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 813 B |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 813 B |
|
@ -0,0 +1 @@
|
|||
Subproject commit ead577365db4aebc1a51a0c43a8ad7a756ed6ddb
|
|
@ -1 +0,0 @@
|
|||
default
|
|
@ -1,16 +0,0 @@
|
|||
digiline = {}
|
||||
dofile(minetest.get_modpath("digilines").."/presetrules.lua")
|
||||
dofile(minetest.get_modpath("digilines").."/util.lua")
|
||||
dofile(minetest.get_modpath("digilines").."/internal.lua")
|
||||
dofile(minetest.get_modpath("digilines").."/wires_common.lua")
|
||||
dofile(minetest.get_modpath("digilines").."/wire_std.lua")
|
||||
|
||||
function digiline:receptor_send(pos, rules, channel, msg)
|
||||
local checked = {}
|
||||
checked[tostring(pos.x).."_"..tostring(pos.y).."_"..tostring(pos.z)] = true -- exclude itself
|
||||
for _,rule in ipairs(rules) do
|
||||
if digiline:rules_link(pos, digiline:addPosRule(pos, rule)) then
|
||||
digiline:transmit(digiline:addPosRule(pos, rule), channel, msg, checked)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,94 +0,0 @@
|
|||
function digiline:getspec(node)
|
||||
if not minetest.registered_nodes[node.name] then return false end
|
||||
return minetest.registered_nodes[node.name].digiline
|
||||
end
|
||||
|
||||
function digiline:importrules(spec, node)
|
||||
if type(spec) == 'function' then
|
||||
return spec(node)
|
||||
elseif spec then
|
||||
return spec
|
||||
else
|
||||
return digiline.rules.default
|
||||
end
|
||||
end
|
||||
|
||||
function digiline:getAnyInputRules(pos)
|
||||
local node = minetest.env:get_node(pos)
|
||||
spec = digiline:getspec(node)
|
||||
if not spec then return end
|
||||
|
||||
if spec.wire then
|
||||
return digiline:importrules(spec.wire.rules, node)
|
||||
end
|
||||
if spec.effector then
|
||||
return digiline:importrules(spec.effector.rules, node)
|
||||
end
|
||||
|
||||
return rules
|
||||
end
|
||||
|
||||
function digiline:getAnyOutputRules(pos)
|
||||
local node = minetest.env:get_node(pos)
|
||||
spec = digiline:getspec(node)
|
||||
if not spec then return end
|
||||
|
||||
if spec.wire then
|
||||
return digiline:importrules(spec.wire.rules, node)
|
||||
end
|
||||
if spec.receptor then
|
||||
return digiline:importrules(spec.receptor.rules, node)
|
||||
end
|
||||
end
|
||||
|
||||
function digiline:rules_link(output, input)
|
||||
local outputrules = digiline:getAnyOutputRules(output)
|
||||
local inputrules = digiline:getAnyInputRules (input)
|
||||
|
||||
if not outputrules or not inputrules then return false end
|
||||
|
||||
|
||||
for _, orule in ipairs(outputrules) do
|
||||
if digiline:cmpPos(digiline:addPosRule(output, orule), input) then
|
||||
for _, irule in ipairs(inputrules) do
|
||||
if digiline:cmpPos(digiline:addPosRule(input, irule), output) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function digiline:rules_link_anydir(output, input)
|
||||
return digiline:rules_link(output, input)
|
||||
or digiline:rules_link(input, output)
|
||||
end
|
||||
|
||||
function digiline:transmit(pos, channel, msg, checked)
|
||||
checked = checked or {}
|
||||
local checkedid = tostring(pos.x).."_"..tostring(pos.y).."_"..tostring(pos.z)
|
||||
if checked[checkedid] then return checked end
|
||||
checked[checkedid] = true
|
||||
|
||||
local node = minetest.env:get_node(pos)
|
||||
local spec = digiline:getspec(node)
|
||||
if not spec then return end
|
||||
|
||||
|
||||
-- Effector actions --> Receive
|
||||
if spec.effector then
|
||||
spec.effector.action(pos, node, channel, msg)
|
||||
end
|
||||
|
||||
-- Cable actions --> Transmit
|
||||
if spec.wire then
|
||||
local rules = digiline:importrules(spec.wire.rules, node)
|
||||
for _,rule in ipairs(rules) do
|
||||
if digiline:rules_link(pos, digiline:addPosRule(pos, rule)) then
|
||||
checked = digiline:transmit(digiline:addPosRule(pos, rule), channel, msg, checked)
|
||||
end
|
||||
end
|
||||
end
|
||||
return checked
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
digiline.rules = {}
|
||||
|
||||
digiline.rules.default =
|
||||
{{x=0, y=0, z=-1},
|
||||
{x=1, y=0, z=0},
|
||||
{x=-1, y=0, z=0},
|
||||
{x=0, y=0, z=1},
|
||||
{x=1, y=1, z=0},
|
||||
{x=1, y=-1, z=0},
|
||||
{x=-1, y=1, z=0},
|
||||
{x=-1, y=-1, z=0},
|
||||
{x=0, y=1, z=1},
|
||||
{x=0, y=-1, z=1},
|
||||
{x=0, y=1, z=-1},
|
||||
{x=0, y=-1, z=-1}}
|
Before Width: | Height: | Size: 446 B |
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 378 B |
|
@ -1,52 +0,0 @@
|
|||
function digiline:addPosRule(p, r)
|
||||
return {x = p.x + r.x, y = p.y + r.y, z = p.z + r.z}
|
||||
end
|
||||
|
||||
function digiline:cmpPos(p1, p2)
|
||||
return (p1.x == p2.x and p1.y == p2.y and p1.z == p2.z)
|
||||
end
|
||||
|
||||
--Rules rotation Functions:
|
||||
function digiline:rotate_rules_right(rules)
|
||||
local nr={}
|
||||
for i, rule in ipairs(rules) do
|
||||
nr[i]={}
|
||||
nr[i].z=rule.x
|
||||
nr[i].x=-rule.z
|
||||
nr[i].y=rule.y
|
||||
end
|
||||
return nr
|
||||
end
|
||||
|
||||
function digiline:rotate_rules_left(rules)
|
||||
local nr={}
|
||||
for i, rule in ipairs(rules) do
|
||||
nr[i]={}
|
||||
nr[i].z=-rules[i].x
|
||||
nr[i].x=rules[i].z
|
||||
nr[i].y=rules[i].y
|
||||
end
|
||||
return nr
|
||||
end
|
||||
|
||||
function digiline:rotate_rules_down(rules)
|
||||
local nr={}
|
||||
for i, rule in ipairs(rules) do
|
||||
nr[i]={}
|
||||
nr[i].y=rule.x
|
||||
nr[i].x=-rule.y
|
||||
nr[i].z=rule.z
|
||||
end
|
||||
return nr
|
||||
end
|
||||
|
||||
function digiline:rotate_rules_up(rules)
|
||||
local nr={}
|
||||
for i, rule in ipairs(rules) do
|
||||
nr[i]={}
|
||||
nr[i].y=-rule.x
|
||||
nr[i].x=rule.y
|
||||
nr[i].z=rule.z
|
||||
end
|
||||
return nr
|
||||
end
|
|
@ -1,117 +0,0 @@
|
|||
-- naming scheme: wire:(xp)(zp)(xm)(zm)_on/off
|
||||
-- The conditions in brackets define whether there is a digiline at that place or not
|
||||
-- 1 = there is one; 0 = there is none
|
||||
-- y always means y+
|
||||
|
||||
box_center = {-1/16, -.5, -1/16, 1/16, -.5+1/16, 1/16}
|
||||
box_bump1 = { -2/16, -8/16, -2/16, 2/16, -13/32, 2/16 }
|
||||
box_bump2 = { -3/32, -13/32, -3/32, 3/32, -12/32, 3/32 }
|
||||
|
||||
box_xp = {1/16, -.5, -1/16, 8/16, -.5+1/16, 1/16}
|
||||
box_zp = {-1/16, -.5, 1/16, 1/16, -.5+1/16, 8/16}
|
||||
box_xm = {-8/16, -.5, -1/16, -1/16, -.5+1/16, 1/16}
|
||||
box_zm = {-1/16, -.5, -8/16, 1/16, -.5+1/16, -1/16}
|
||||
|
||||
box_xpy = {.5-1/16, -.5+1/16, -1/16, .5, .4999+1/16, 1/16}
|
||||
box_zpy = {-1/16, -.5+1/16, .5-1/16, 1/16, .4999+1/16, .5}
|
||||
box_xmy = {-.5, -.5+1/16, -1/16, -.5+1/16, .4999+1/16, 1/16}
|
||||
box_zmy = {-1/16, -.5+1/16, -.5, 1/16, .4999+1/16, -.5+1/16}
|
||||
|
||||
for xp=0, 1 do
|
||||
for zp=0, 1 do
|
||||
for xm=0, 1 do
|
||||
for zm=0, 1 do
|
||||
for xpy=0, 1 do
|
||||
for zpy=0, 1 do
|
||||
for xmy=0, 1 do
|
||||
for zmy=0, 1 do
|
||||
if (xpy == 1 and xp == 0) or (zpy == 1 and zp == 0)
|
||||
or (xmy == 1 and xm == 0) or (zmy == 1 and zm == 0) then break end
|
||||
|
||||
local groups
|
||||
local nodeid = tostring(xp )..tostring(zp )..tostring(xm )..tostring(zm )..
|
||||
tostring(xpy)..tostring(zpy)..tostring(xmy)..tostring(zmy)
|
||||
|
||||
if nodeid == "00000000" then
|
||||
groups = {dig_immediate = 3}
|
||||
wiredesc = "Digiline"
|
||||
else
|
||||
groups = {dig_immediate = 3, not_in_creative_inventory = 1}
|
||||
end
|
||||
|
||||
local nodebox = {}
|
||||
local adjx = false
|
||||
local adjz = false
|
||||
if xp == 1 then table.insert(nodebox, box_xp) adjx = true end
|
||||
if zp == 1 then table.insert(nodebox, box_zp) adjz = true end
|
||||
if xm == 1 then table.insert(nodebox, box_xm) adjx = true end
|
||||
if zm == 1 then table.insert(nodebox, box_zm) adjz = true end
|
||||
if xpy == 1 then table.insert(nodebox, box_xpy) end
|
||||
if zpy == 1 then table.insert(nodebox, box_zpy) end
|
||||
if xmy == 1 then table.insert(nodebox, box_xmy) end
|
||||
if zmy == 1 then table.insert(nodebox, box_zmy) end
|
||||
|
||||
if adjx and adjz and (xp + zp + xm + zm > 2) then
|
||||
table.insert(nodebox, box_bump1)
|
||||
table.insert(nodebox, box_bump2)
|
||||
tiles = {
|
||||
"digiline_std_bump.png",
|
||||
"digiline_std_bump.png",
|
||||
"digiline_std_vertical.png",
|
||||
"digiline_std_vertical.png",
|
||||
"digiline_std_vertical.png",
|
||||
"digiline_std_vertical.png"
|
||||
}
|
||||
else
|
||||
table.insert(nodebox, box_center)
|
||||
tiles = {
|
||||
"digiline_std.png",
|
||||
"digiline_std.png",
|
||||
"digiline_std_vertical.png",
|
||||
"digiline_std_vertical.png",
|
||||
"digiline_std_vertical.png",
|
||||
"digiline_std_vertical.png"
|
||||
}
|
||||
end
|
||||
|
||||
if nodeid == "00000000" then
|
||||
nodebox = {-8/16, -.5, -1/16, 8/16, -.5+1/16, 1/16}
|
||||
end
|
||||
|
||||
minetest.register_node("digilines:wire_std_"..nodeid, {
|
||||
description = wiredesc,
|
||||
drawtype = "nodebox",
|
||||
tiles = tiles,
|
||||
inventory_image = "digiline_std_inv.png",
|
||||
wield_image = "digiline_std_inv.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
digiline =
|
||||
{
|
||||
wire =
|
||||
{
|
||||
basename = "digilines:wire_std_"
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-.5, -.5, -.5, .5, -.5+1/16, .5}
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = nodebox
|
||||
},
|
||||
groups = groups,
|
||||
walkable = false,
|
||||
stack_max = 99,
|
||||
drop = "digilines:wire_std_00000000"
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,84 +0,0 @@
|
|||
minetest.register_on_placenode(function(pos, node)
|
||||
if minetest.registered_nodes[node.name].digiline then
|
||||
digiline:update_autoconnect(pos)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_dignode(function(pos, node)
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].digiline then
|
||||
-- need to make sure that node exists (unknown nodes!)
|
||||
digiline:update_autoconnect(pos)
|
||||
end
|
||||
end)
|
||||
|
||||
function digiline:update_autoconnect(pos, secondcall)
|
||||
local xppos = {x=pos.x+1, y=pos.y, z=pos.z}
|
||||
local zppos = {x=pos.x, y=pos.y, z=pos.z+1}
|
||||
local xmpos = {x=pos.x-1, y=pos.y, z=pos.z}
|
||||
local zmpos = {x=pos.x, y=pos.y, z=pos.z-1}
|
||||
local xpympos = {x=pos.x+1, y=pos.y-1, z=pos.z}
|
||||
local zpympos = {x=pos.x, y=pos.y-1, z=pos.z+1}
|
||||
local xmympos = {x=pos.x-1, y=pos.y-1, z=pos.z}
|
||||
local zmympos = {x=pos.x, y=pos.y-1, z=pos.z-1}
|
||||
local xpypos = {x=pos.x+1, y=pos.y+1, z=pos.z}
|
||||
local zpypos = {x=pos.x, y=pos.y+1, z=pos.z+1}
|
||||
local xmypos = {x=pos.x-1, y=pos.y+1, z=pos.z}
|
||||
local zmypos = {x=pos.x, y=pos.y+1, z=pos.z-1}
|
||||
|
||||
if secondcall == nil then
|
||||
digiline:update_autoconnect(xppos, true)
|
||||
digiline:update_autoconnect(zppos, true)
|
||||
digiline:update_autoconnect(xmpos, true)
|
||||
digiline:update_autoconnect(zmpos, true)
|
||||
|
||||
digiline:update_autoconnect(xpypos, true)
|
||||
digiline:update_autoconnect(zpypos, true)
|
||||
digiline:update_autoconnect(xmypos, true)
|
||||
digiline:update_autoconnect(zmypos, true)
|
||||
|
||||
digiline:update_autoconnect(xpympos, true)
|
||||
digiline:update_autoconnect(zpympos, true)
|
||||
digiline:update_autoconnect(xmympos, true)
|
||||
digiline:update_autoconnect(zmympos, true)
|
||||
end
|
||||
|
||||
local digilinespec = minetest.registered_nodes[minetest.env:get_node(pos).name].digiline
|
||||
if not digilinespec then return nil end
|
||||
if not digilinespec.wire then return nil end
|
||||
|
||||
local zmg = digiline:rules_link_anydir(pos, zmpos)
|
||||
local zmymg = digiline:rules_link_anydir(pos, zmympos)
|
||||
local xmg = digiline:rules_link_anydir(pos, xmpos)
|
||||
local xmymg = digiline:rules_link_anydir(pos, xmympos)
|
||||
local zpg = digiline:rules_link_anydir(pos, zppos)
|
||||
local zpymg = digiline:rules_link_anydir(pos, zpympos)
|
||||
local xpg = digiline:rules_link_anydir(pos, xppos)
|
||||
local xpymg = digiline:rules_link_anydir(pos, xpympos)
|
||||
|
||||
|
||||
local xpyg = digiline:rules_link_anydir(pos, xpypos)
|
||||
local zpyg = digiline:rules_link_anydir(pos, zpypos)
|
||||
local xmyg = digiline:rules_link_anydir(pos, xmypos)
|
||||
local zmyg = digiline:rules_link_anydir(pos, zmypos)
|
||||
|
||||
if zmg or zmymg then zm = 1 else zm = 0 end
|
||||
if xmg or xmymg then xm = 1 else xm = 0 end
|
||||
if zpg or zpymg then zp = 1 else zp = 0 end
|
||||
if xpg or xpymg then xp = 1 else xp = 0 end
|
||||
|
||||
if xpyg then xpy = 1 else xpy = 0 end
|
||||
if zpyg then zpy = 1 else zpy = 0 end
|
||||
if xmyg then xmy = 1 else xmy = 0 end
|
||||
if zmyg then zmy = 1 else zmy = 0 end
|
||||
|
||||
if xpy == 1 then xp = 1 end
|
||||
if zpy == 1 then zp = 1 end
|
||||
if xmy == 1 then xm = 1 end
|
||||
if zmy == 1 then zm = 1 end
|
||||
|
||||
local nodeid = tostring(xp )..tostring(zp )..tostring(xm )..tostring(zm )..
|
||||
tostring(xpy)..tostring(zpy)..tostring(xmy)..tostring(zmy)
|
||||
|
||||
|
||||
minetest.env:set_node(pos, {name = digilinespec.wire.basename..nodeid})
|
||||
end
|
|
@ -1,279 +0,0 @@
|
|||
A
|
||||
_a_
|
||||
7
|
||||
B
|
||||
_b_
|
||||
5
|
||||
C
|
||||
_c_
|
||||
6
|
||||
D
|
||||
_d_
|
||||
6
|
||||
E
|
||||
_e_
|
||||
5
|
||||
F
|
||||
_f_
|
||||
5
|
||||
G
|
||||
_g_
|
||||
6
|
||||
H
|
||||
_h_
|
||||
6
|
||||
I
|
||||
_i_
|
||||
1
|
||||
J
|
||||
_j_
|
||||
4
|
||||
K
|
||||
_k_
|
||||
5
|
||||
L
|
||||
_l_
|
||||
4
|
||||
M
|
||||
_m_
|
||||
7
|
||||
N
|
||||
_n_
|
||||
6
|
||||
O
|
||||
_o_
|
||||
6
|
||||
P
|
||||
_p_
|
||||
5
|
||||
Q
|
||||
_q_
|
||||
7
|
||||
R
|
||||
_r_
|
||||
5
|
||||
S
|
||||
_s_
|
||||
5
|
||||
T
|
||||
_t_
|
||||
5
|
||||
U
|
||||
_u_
|
||||
6
|
||||
V
|
||||
_v_
|
||||
7
|
||||
W
|
||||
_w_
|
||||
9
|
||||
X
|
||||
_x_
|
||||
5
|
||||
Y
|
||||
_y_
|
||||
7
|
||||
Z
|
||||
_z_
|
||||
5
|
||||
a
|
||||
_a
|
||||
5
|
||||
b
|
||||
_b
|
||||
5
|
||||
c
|
||||
_c
|
||||
4
|
||||
d
|
||||
_d
|
||||
5
|
||||
e
|
||||
_e
|
||||
4
|
||||
f
|
||||
_f
|
||||
4
|
||||
g
|
||||
_g
|
||||
5
|
||||
h
|
||||
_h
|
||||
5
|
||||
i
|
||||
_i
|
||||
1
|
||||
j
|
||||
_j
|
||||
1
|
||||
k
|
||||
_k
|
||||
4
|
||||
l
|
||||
_l
|
||||
1
|
||||
m
|
||||
_m
|
||||
7
|
||||
n
|
||||
_n
|
||||
5
|
||||
o
|
||||
_o
|
||||
5
|
||||
p
|
||||
_p
|
||||
5
|
||||
q
|
||||
_q
|
||||
5
|
||||
r
|
||||
_r
|
||||
3
|
||||
s
|
||||
_s
|
||||
4
|
||||
t
|
||||
_t
|
||||
3
|
||||
u
|
||||
_u
|
||||
4
|
||||
v
|
||||
_v
|
||||
5
|
||||
w
|
||||
_w
|
||||
7
|
||||
x
|
||||
_x
|
||||
5
|
||||
y
|
||||
_y
|
||||
4
|
||||
z
|
||||
_z
|
||||
4
|
||||
|
||||
_sp
|
||||
2
|
||||
0
|
||||
_0
|
||||
4
|
||||
1
|
||||
_1
|
||||
2
|
||||
2
|
||||
_2
|
||||
4
|
||||
3
|
||||
_3
|
||||
4
|
||||
4
|
||||
_4
|
||||
4
|
||||
5
|
||||
_5
|
||||
4
|
||||
6
|
||||
_6
|
||||
4
|
||||
7
|
||||
_7
|
||||
4
|
||||
8
|
||||
_8
|
||||
4
|
||||
9
|
||||
_9
|
||||
4
|
||||
(
|
||||
_bl
|
||||
2
|
||||
)
|
||||
_br
|
||||
2
|
||||
{
|
||||
_cl
|
||||
3
|
||||
}
|
||||
_cr
|
||||
3
|
||||
[
|
||||
_sl
|
||||
2
|
||||
]
|
||||
_sr
|
||||
2
|
||||
'
|
||||
_ap
|
||||
1
|
||||
!
|
||||
_ex
|
||||
1
|
||||
?
|
||||
_qu
|
||||
4
|
||||
@
|
||||
_at
|
||||
5
|
||||
#
|
||||
_hs
|
||||
5
|
||||
$
|
||||
_dl
|
||||
4
|
||||
%
|
||||
_pr
|
||||
5
|
||||
^
|
||||
_ca
|
||||
3
|
||||
&
|
||||
_am
|
||||
5
|
||||
*
|
||||
_as
|
||||
3
|
||||
_
|
||||
_un
|
||||
3
|
||||
+
|
||||
_ps
|
||||
3
|
||||
-
|
||||
_mn
|
||||
3
|
||||
=
|
||||
_eq
|
||||
3
|
||||
;
|
||||
_sm
|
||||
1
|
||||
,
|
||||
_cm
|
||||
2
|
||||
"
|
||||
_qo
|
||||
3
|
||||
/
|
||||
_dv
|
||||
5
|
||||
~
|
||||
_tl
|
||||
4
|
||||
<
|
||||
_lt
|
||||
3
|
||||
>
|
||||
_gt
|
||||
3
|
||||
\
|
||||
_re
|
||||
5
|
||||
|
|
||||
_vb
|
||||
1
|
||||
.
|
||||
_dt
|
||||
1
|
|
@ -1,234 +0,0 @@
|
|||
--* parts are currently not possible because you cannot set the pitch of an entity from lua
|
||||
|
||||
-- Font: 04.jp.org
|
||||
|
||||
-- load characters map
|
||||
local chars_file = io.open(minetest.get_modpath("digilines_lcd").."/characters", "r")
|
||||
local charmap = {}
|
||||
local max_chars = 12
|
||||
if not chars_file then
|
||||
print("[digilines_lcd] E: character map file not found")
|
||||
else
|
||||
while true do
|
||||
local char = chars_file:read("*l")
|
||||
if char == nil then
|
||||
break
|
||||
end
|
||||
local img = chars_file:read("*l")
|
||||
chars_file:read("*l")
|
||||
charmap[char] = img
|
||||
end
|
||||
end
|
||||
|
||||
local lcds = {
|
||||
-- on ceiling
|
||||
--* [0] = {delta = {x = 0, y = 0.4, z = 0}, pitch = math.pi / -2},
|
||||
-- on ground
|
||||
--* [1] = {delta = {x = 0, y =-0.4, z = 0}, pitch = math.pi / 2},
|
||||
-- sides
|
||||
[2] = {delta = {x = 0.4, y = 0, z = 0}, yaw = math.pi / -2},
|
||||
[3] = {delta = {x = -0.4, y = 0, z = 0}, yaw = math.pi / 2},
|
||||
[4] = {delta = {x = 0, y = 0, z = 0.4}, yaw = 0},
|
||||
[5] = {delta = {x = 0, y = 0, z = -0.4}, yaw = math.pi},
|
||||
}
|
||||
|
||||
local reset_meta = function(pos)
|
||||
minetest.env:get_meta(pos):set_string("formspec", "field[channel;Channel;${channel}]")
|
||||
end
|
||||
|
||||
local clearscreen = function(pos)
|
||||
local objects = minetest.env:get_objects_inside_radius(pos, 0.5)
|
||||
for _, o in ipairs(objects) do
|
||||
if o:get_entity_name() == "digilines_lcd:text" then
|
||||
o:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local prepare_writing = function (pos)
|
||||
lcd_info = lcds[minetest.env:get_node(pos).param2]
|
||||
if lcd_info == nil then return end
|
||||
local text = minetest.env:add_entity(
|
||||
{x = pos.x + lcd_info.delta.x,
|
||||
y = pos.y + lcd_info.delta.y,
|
||||
z = pos.z + lcd_info.delta.z}, "digilines_lcd:text")
|
||||
text:setyaw (lcd_info.yaw or 0)
|
||||
--* text:setpitch(lcd_info.yaw or 0)
|
||||
return text
|
||||
end
|
||||
|
||||
local on_digiline_receive = function(pos, node, channel, msg)
|
||||
clearscreen(pos)
|
||||
local setchan = minetest.env:get_meta(pos):get_string("channel")
|
||||
if setchan ~= channel then return end
|
||||
|
||||
local text = prepare_writing (pos)
|
||||
text:set_properties({textures={generate_texture(create_lines(msg))}})
|
||||
end
|
||||
|
||||
local lcd_box = {
|
||||
type = "wallmounted",
|
||||
wall_top = {-8/16, 7/16, -8/16, 8/16, 8/16, 8/16}
|
||||
}
|
||||
|
||||
minetest.register_node("digilines_lcd:lcd", {
|
||||
drawtype = "nodebox",
|
||||
description = "Digiline LCD",
|
||||
inventory_image = "lcd_lcd.png",
|
||||
wield_image = "lcd_lcd.png",
|
||||
tiles = {"lcd_anyside.png"},
|
||||
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "wallmounted",
|
||||
node_box = lcd_box,
|
||||
selection_box = lcd_box,
|
||||
groups = {choppy = 3, dig_immediate = 2},
|
||||
|
||||
after_place_node = function (pos, placer, itemstack)
|
||||
local param2 = minetest.env:get_node(pos).param2
|
||||
if param2 == 0 or param2 == 1 then
|
||||
minetest.env:add_node(pos, {name = "digilines_lcd:lcd", param2 = 3})
|
||||
end
|
||||
prepare_writing (pos)
|
||||
end,
|
||||
|
||||
on_construct = function(pos)
|
||||
reset_meta(pos)
|
||||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
clearscreen(pos)
|
||||
end,
|
||||
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
minetest.env:get_meta(pos):set_string("channel", fields.channel)
|
||||
end,
|
||||
|
||||
digiline =
|
||||
{
|
||||
receptor = {},
|
||||
effector = {
|
||||
action = on_digiline_receive
|
||||
},
|
||||
},
|
||||
|
||||
light_source = 6,
|
||||
})
|
||||
|
||||
minetest.register_entity("digilines_lcd:text", {
|
||||
collisionbox = { 0, 0, 0, 0, 0, 0 },
|
||||
visual = "upright_sprite",
|
||||
textures = {},
|
||||
|
||||
on_activate = function(self)
|
||||
local meta = minetest.env:get_meta(self.object:getpos())
|
||||
local text = meta:get_string("text")
|
||||
self.object:set_properties({textures={generate_texture(create_lines(text))}})
|
||||
end
|
||||
})
|
||||
|
||||
-- CONSTANTS
|
||||
local LCD_WITH = 100
|
||||
local LCD_PADDING = 8
|
||||
|
||||
local LINE_LENGTH = 12
|
||||
local NUMBER_OF_LINES = 5
|
||||
|
||||
local LINE_HEIGHT = 14
|
||||
local CHAR_WIDTH = 5
|
||||
|
||||
string_to_array = function(str)
|
||||
local tab = {}
|
||||
for i=1,string.len(str) do
|
||||
table.insert(tab, string.sub(str, i,i))
|
||||
end
|
||||
return tab
|
||||
end
|
||||
|
||||
string_to_word_array = function(str)
|
||||
local tab = {}
|
||||
local current = 1
|
||||
tab[1] = ""
|
||||
for _,char in ipairs(string_to_array(str)) do
|
||||
if char ~= " " then
|
||||
tab[current] = tab[current]..char
|
||||
else
|
||||
current = current+1
|
||||
tab[current] = ""
|
||||
end
|
||||
end
|
||||
return tab
|
||||
end
|
||||
|
||||
create_lines = function(text)
|
||||
local line = ""
|
||||
local line_num = 1
|
||||
local tab = {}
|
||||
for _,word in ipairs(string_to_word_array(text)) do
|
||||
if string.len(line)+string.len(word) < LINE_LENGTH and word ~= "|" then
|
||||
if line ~= "" then
|
||||
line = line.." "..word
|
||||
else
|
||||
line = word
|
||||
end
|
||||
else
|
||||
table.insert(tab, line)
|
||||
if word ~= "|" then
|
||||
line = word
|
||||
else
|
||||
line = ""
|
||||
end
|
||||
line_num = line_num+1
|
||||
if line_num > NUMBER_OF_LINES then
|
||||
return tab
|
||||
end
|
||||
end
|
||||
end
|
||||
table.insert(tab, line)
|
||||
return tab
|
||||
end
|
||||
|
||||
generate_texture = function(lines)
|
||||
local texture = "[combine:"..LCD_WITH.."x"..LCD_WITH
|
||||
local ypos = 16
|
||||
for i = 1, #lines do
|
||||
texture = texture..generate_line(lines[i], ypos)
|
||||
ypos = ypos + LINE_HEIGHT
|
||||
end
|
||||
return texture
|
||||
end
|
||||
|
||||
generate_line = function(s, ypos)
|
||||
local i = 1
|
||||
local parsed = {}
|
||||
local width = 0
|
||||
local chars = 0
|
||||
while chars < max_chars and i <= #s do
|
||||
local file = nil
|
||||
if charmap[s:sub(i, i)] ~= nil then
|
||||
file = charmap[s:sub(i, i)]
|
||||
i = i + 1
|
||||
elseif i < #s and charmap[s:sub(i, i + 1)] ~= nil then
|
||||
file = charmap[s:sub(i, i + 1)]
|
||||
i = i + 2
|
||||
else
|
||||
print("[digilines_lcd] W: unknown symbol in '"..s.."' at "..i)
|
||||
i = i + 1
|
||||
end
|
||||
if file ~= nil then
|
||||
width = width + CHAR_WIDTH
|
||||
table.insert(parsed, file)
|
||||
chars = chars + 1
|
||||
end
|
||||
end
|
||||
width = width - 1
|
||||
|
||||
local texture = ""
|
||||
local xpos = math.floor((LCD_WITH - 2 * LCD_PADDING - width) / 2 + LCD_PADDING)
|
||||
for i = 1, #parsed do
|
||||
texture = texture..":"..xpos..","..ypos.."="..parsed[i]..".png"
|
||||
xpos = xpos + CHAR_WIDTH + 1
|
||||
end
|
||||
return texture
|
||||
end
|
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 241 B |
Before Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 156 B |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 244 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 252 B |
Before Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 144 B |
Before Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 227 B |
Before Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 244 B |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 252 B |
Before Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 241 B |
Before Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 227 B |
Before Width: | Height: | Size: 215 B |
Before Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 241 B |
Before Width: | Height: | Size: 249 B |