update technic

master
Brett O'Donnell 2012-10-09 18:24:06 +10:30
parent 6c24063595
commit 6f78758164
49 changed files with 1328 additions and 39 deletions

22
technic/.gitattributes vendored Normal file
View File

@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

163
technic/.gitignore vendored Normal file
View File

@ -0,0 +1,163 @@
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
*.dotCover
## TODO: If you have NuGet Package Restore enabled, uncomment this
#packages/
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
# Visual Studio profiler
*.psess
*.vsp
# ReSharper is a .NET coding add-in
_ReSharper*
# Installshield output folder
[Ee]xpress
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish
# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
############
## Windows
############
# Windows image file caches
Thumbs.db
# Folder config file
Desktop.ini
#############
## Python
#############
*.py[co]
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
# Mac crap
.DS_Store

View File

@ -1,15 +0,0 @@
[mod]Technic v0.2
Forum Page: http://minetest.net/forum/viewtopic.php?id=2538
License: LGPLv2/later
Contributors:
RealBadAngel
Description:
Rebar, made out of steel ingots, block of concrete made out of rebar and smooth stone and chests.
Well, lotsa chests :)
Iron, copper, silver, gold and mithril chests. (HD 128x textures preview)
Each level of chest gives more storage space from 9*4 - Iron Chest to 13*4 - Mithril Chest. All chests can be unlocked/locked.

View File

@ -25,7 +25,7 @@ register_alloy_recipe ("technic:copper_dust",3, "technic:tin_dust",1, "technic:b
register_alloy_recipe ("moreores:copper_ingot",3, "moreores:tin_ingot",1, "moreores:bronze_ingot",4)
register_alloy_recipe ("technic:iron_dust",3, "technic:chromium_dust",1, "technic:stainless_steel_dust",4)
register_alloy_recipe ("default:sand",2, "technic:coal_dust",2, "technic:silicon_wafer",1)
register_alloy_recipe ("technic:silicon_wafer",1, "technic:mithril_dust",3, "technic:doped_silicon_wafer",1)
register_alloy_recipe ("technic:silicon_wafer",1, "technic:mithril_dust",2, "technic:doped_silicon_wafer",1)
minetest.register_alias("alloy_furnace", "technic:alloy_furnace")

View File

@ -1,6 +1,5 @@
default
moreores
stairsplus
flowers
dye
pipeworks

91
technic/deployer.lua Normal file
View File

@ -0,0 +1,91 @@
minetest.register_craft({
output = 'technic:deployer_off 1',
recipe = {
{'default:wood', 'default:chest','default:wood'},
{'default:stone', 'mesecons:piston','default:stone'},
{'default:stone', 'mesecons:mesecon','default:stone'},
}
})
minetest.register_node("technic:deployer_off", {
description = "Deployer",
tile_images = {"technic_deployer_top.png","technic_deployer_bottom.png","technic_deployer_side2.png","technic_deployer_side1.png",
"technic_deployer_back.png","technic_deployer_front_off.png"},
is_ground_content = true,
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2,tubedevice=1},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"label[0,0;Deployer]"..
"list[current_name;main;4,1;3,3;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Deployer")
local inv = meta:get_inventory()
inv:set_size("main", 3*3)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("main") then
return false
end
return true
end,
})
minetest.register_node("technic:deployer_on", {
description = "Deployer",
tile_images = {"technic_deployer_top.png","technic_deployer_bottom.png","technic_deployer_side2.png","technic_deployer_side1.png",
"technic_deployer_back.png","technic_deployer_front_on.png"},
is_ground_content = true,
paramtype2 = "facedir",
tubelike=1,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2,tubedevice=1,not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(),
})
mesecon:register_on_signal_on(function(pos, node)
local pos1={}
pos1.x=pos.x
pos1.y=pos.y
pos1.z=pos.z
if node.param2==3 then pos1.x=pos1.x+1 end
if node.param2==2 then pos1.z=pos1.z+1 end
if node.param2==1 then pos1.x=pos1.x-1 end
if node.param2==0 then pos1.z=pos1.z-1 end
if node.name == "technic:deployer_off" then
hacky_swap_node(pos,"technic:deployer_on")
nodeupdate(pos)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
print (dump(inv))
for _,stack in ipairs(inv:get_list("main")) do
print (dump(stack:get_name()))
if stack:get_name() ~=nil then
node1={name=stack:get_name(), param1=0, param2=node.param2}
minetest.env:place_node(pos1,node1)
return
end
end
end
end)
mesecon:register_on_signal_off(function(pos, node)
if node.name == "technic:deployer_on" then
hacky_swap_node(pos,"technic:deployer_off")
nodeupdate(pos)
end
end)
mesecon:register_effector("technic:deployer_on", "technic:deployer_off")

View File

@ -20,6 +20,8 @@ register_grinder_recipe("moreores:tin_lump","technic:tin_dust 2")
register_grinder_recipe("moreores:silver_lump","technic:silver_dust 2")
register_grinder_recipe("moreores:gold_lump","technic:gold_dust 2")
register_grinder_recipe("moreores:mithril_lump","technic:mithril_dust 2")
register_grinder_recipe("technic:chromium_lump","technic:chromium_dust 2")
register_grinder_recipe("technic:zinc_lump","technic:zinc_dust 2")
minetest.register_craftitem( "technic:coal_dust", {
@ -120,7 +122,6 @@ minetest.register_craft({
minetest.register_craftitem( "technic:stainless_steel_dust", {
description = "Stainless Steel Dust",
inventory_image = "technic_stainless_steel_dust.png",
on_place_on_ground = minetest.craftitem_place_item,
})
minetest.register_craft({
@ -129,6 +130,17 @@ minetest.register_craft({
recipe = "technic:stainless_steel_dust",
})
minetest.register_craftitem( "technic:zinc_dust", {
description = "Zinc Dust",
inventory_image = "technic_zinc_dust.png",
})
minetest.register_craft({
type = "cooking",
output = "technic:zinc_ingot",
recipe = "technic:zinc_dust",
})
minetest.register_alias("grinder", "technic:grinder")
minetest.register_craft({
output = 'technic:grinder',

View File

@ -1,4 +1,4 @@
-- Minetest 0.4.2 rc1: technic
-- Minetest 0.4.3 : technic
minetest.register_alias("rebar", "technic:rebar")
minetest.register_alias("concrete", "technic:concrete")
@ -23,6 +23,7 @@ dofile(minetest.get_modpath("technic").."/mithril_chest.lua")
dofile(minetest.get_modpath("technic").."/electric_furnace.lua")
dofile(minetest.get_modpath("technic").."/battery_box.lua")
dofile(minetest.get_modpath("technic").."/wires.lua")
dofile(minetest.get_modpath("technic").."/wires_mv.lua")
dofile(minetest.get_modpath("technic").."/dyes.lua")
dofile(minetest.get_modpath("technic").."/ores.lua")
@ -31,7 +32,7 @@ dofile(minetest.get_modpath("technic").."/music_player.lua")
dofile(minetest.get_modpath("technic").."/grinder.lua")
dofile(minetest.get_modpath("technic").."/mining_laser_mk1.lua")
--dofile(minetest.get_modpath("technic").."/project_table.lua")
--dofile(minetest.get_modpath("technic").."/injector.lua")
dofile(minetest.get_modpath("technic").."/injector.lua")
dofile(minetest.get_modpath("technic").."/generator.lua")
dofile(minetest.get_modpath("technic").."/solar_panel.lua")
dofile(minetest.get_modpath("technic").."/geothermal.lua")
@ -41,6 +42,10 @@ dofile(minetest.get_modpath("technic").."/items.lua")
dofile(minetest.get_modpath("technic").."/mining_drill.lua")
dofile(minetest.get_modpath("technic").."/screwdriver.lua")
dofile(minetest.get_modpath("technic").."/sonic_screwdriver.lua")
dofile(minetest.get_modpath("technic").."/node_breaker.lua")
dofile(minetest.get_modpath("technic").."/deployer.lua")
dofile(minetest.get_modpath("technic").."/rubber.lua")
dofile(minetest.get_modpath("technic").."/tree_tap.lua")
function has_locked_chest_privilege(meta, player)

325
technic/injector.lua Normal file
View File

@ -0,0 +1,325 @@
minetest.register_craftitem("technic:injector", {
description = "Injector",
stack_max = 99,
})
minetest.register_node("technic:injector", {
description = "Injector",
tiles = {"technic_iron_chest_top.png", "technic_iron_chest_top.png", "technic_iron_chest_side.png",
"technic_iron_chest_side.png", "technic_iron_chest_side.png", "technic_iron_chest_front.png"},
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"invsize[9,9;]"..
"list[current_name;main;0,2;8,2;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Injector")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
on_punch = function (pos, node, puncher)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
for _,stack in ipairs(inv:get_list("main")) do
if stack:get_name() ~="" then
inv:remove_item("main",stack)
pos1=pos
pos1.y=pos1.y
local x=pos1.x+1.5
local z=pos1.z
item1=tube_item({x=pos1.x,y=pos1.y,z=pos1.z},stack)
item1:get_luaentity().start_pos = {x=pos1.x,y=pos1.y,z=pos1.z}
item1:setvelocity({x=1, y=0, z=0})
item1:setacceleration({x=0, y=0, z=0})
return
end
end
end,
})
function tube_item(pos, item)
local TUBE_nodes = {}
local CHEST_nodes = {}
TUBE_nodes[1]={}
TUBE_nodes[1].x=pos.x
TUBE_nodes[1].y=pos.y
TUBE_nodes[1].z=pos.z
table_index=1
repeat
check_TUBE_node (TUBE_nodes,CHEST_nodes,table_index)
table_index=table_index+1
if TUBE_nodes[table_index]==nil then break end
until false
found=table_index-1
print("Found "..found.." tubes connected")
print(dump(CHEST_nodes))
-- Take item in any format
local stack = ItemStack(item)
local obj = minetest.env:add_entity(pos, "technic:tubed_item")
obj:get_luaentity():set_item(stack:to_string())
return obj
end
minetest.register_entity("technic:tubed_item", {
initial_properties = {
hp_max = 1,
physical = false,
collisionbox = {0,0,0,0,0,0},
visual = "sprite",
visual_size = {x=0.5, y=0.5},
textures = {""},
spritediv = {x=1, y=1},
initial_sprite_basepos = {x=0, y=0},
is_visible = false,
start_pos={},
route={}
},
itemstring = '',
physical_state = false,
set_item = function(self, itemstring)
self.itemstring = itemstring
local stack = ItemStack(itemstring)
local itemtable = stack:to_table()
local itemname = nil
if itemtable then
itemname = stack:to_table().name
end
local item_texture = nil
local item_type = ""
if minetest.registered_items[itemname] then
item_texture = minetest.registered_items[itemname].inventory_image
item_type = minetest.registered_items[itemname].type
end
prop = {
is_visible = true,
visual = "sprite",
textures = {"unknown_item.png"}
}
if item_texture and item_texture ~= "" then
prop.visual = "sprite"
prop.textures = {item_texture}
prop.visual_size = {x=0.3, y=0.3}
else
prop.visual = "wielditem"
prop.textures = {itemname}
prop.visual_size = {x=0.15, y=0.15}
end
self.object:set_properties(prop)
end,
get_staticdata = function(self)
return minetest.serialize({
itemstring=self.itemstring,
velocity=self.object:getvelocity(),
start_pos=self.start_pos
})
end,
on_activate = function(self, staticdata)
-- print (dump(staticdata))
if staticdata=="" or staticdata==nil then return end
local item = minetest.deserialize(staticdata)
local stack = ItemStack(item.itemstring)
local itemtable = stack:to_table()
local itemname = nil
if itemtable then
itemname = stack:to_table().name
end
if itemname then
self.start_pos=item.start_pos
self.object:setvelocity(item.velocity)
self.object:setacceleration({x=0, y=0, z=0})
self.object:setpos(item.start_pos)
end
self:set_item(item.itemstring)
end,
on_step = function(self, dtime)
if self.start_pos then
local pos = self.object:getpos()
local node = minetest.env:get_node(pos)
local meta = minetest.env:get_meta(pos)
tubelike=meta:get_int("tubelike")
local stack = ItemStack(self.itemstring)
local drop_pos=nil
local velocity=self.object:getvelocity()
if velocity==nil then print ("wypadl") return end
if math.abs(velocity.x)==1 then
local next_node=math.abs(pos.x-self.start_pos.x)
if next_node >= 1 then
self.start_pos.x=self.start_pos.x+velocity.x
if check_pos_vector (self.start_pos, velocity)==0 then
if check_next_step (self.start_pos, velocity)==0 then
drop_pos=minetest.env:find_node_near({x=self.start_pos.x,y=self.start_pos.y,z=self.start_pos.z+velocity.x}, 1, "air")
if drop_pos then minetest.item_drop(stack, "", drop_pos) end
self.object:remove()
end
self.object:setpos(self.start_pos)
self.object:setvelocity(velocity)
return
end
end
end
if math.abs(velocity.y)==1 then
local next_node=math.abs(pos.y-self.start_pos.y)
if next_node >= 1 then
self.start_pos.y=self.start_pos.y+velocity.y
if check_pos_vector (self.start_pos, velocity)==0 then
if check_next_step (self.start_pos, velocity)==0 then
drop_pos=minetest.env:find_node_near({x=self.start_pos.x+velocity.x,y=self.start_pos.y+velocity.y,z=self.start_pos.z+velocity.z}, 1, "air")
if drop_pos then minetest.item_drop(stack, "", drop_pos) end
self.object:remove()
end
self.object:setpos(self.start_pos)
self.object:setvelocity(velocity)
return
end
end
end
if math.abs(velocity.z)==1 then
local next_node=math.abs(pos.z-self.start_pos.z)
if next_node >= 1 then
self.start_pos.z=self.start_pos.z+velocity.z
if check_pos_vector (self.start_pos, velocity)==0 then
if check_next_step (self.start_pos, velocity)==0 then
drop_pos=minetest.env:find_node_near({x=self.start_pos.x+velocity.x,y=self.start_pos.y+velocity.y,z=self.start_pos.z+velocity.z}, 1, "air")
if drop_pos then minetest.item_drop(stack, "", drop_pos) end
self.object:remove()
end
self.object:setpos(self.start_pos)
self.object:setvelocity(velocity)
return
end
end
end
end
end
})
function check_next_step (pos,velocity)
local meta
local tubelike
if velocity.x==0 then
meta = minetest.env:get_meta({x=pos.x-1,y=pos.y,z=pos.z})
tubelike=meta:get_int("tubelike")
if tubelike==1 then velocity.x=-1 velocity.y=0 velocity.z=0 return 1 end
meta = minetest.env:get_meta({x=pos.x+1,y=pos.y,z=pos.z})
tubelike=meta:get_int("tubelike")
if tubelike==1 then velocity.x=1 velocity.y=0 velocity.z=0 return 1 end
end
if velocity.z==0 then
meta = minetest.env:get_meta({x=pos.x,y=pos.y,z=pos.z+1})
tubelike=meta:get_int("tubelike")
if tubelike==1 then velocity.x=0 velocity.y=0 velocity.z=1 return 1 end
meta = minetest.env:get_meta({x=pos.x,y=pos.y,z=pos.z-1})
tubelike=meta:get_int("tubelike")
if tubelike==1 then velocity.x=0 velocity.y=0 velocity.z=-1 return 1 end
end
if velocity.y==0 then
meta = minetest.env:get_meta({x=pos.x,y=pos.y+1,z=pos.z})
tubelike=meta:get_int("tubelike")
if tubelike==1 then velocity.x=0 velocity.y=1 velocity.z=0 return 1 end
meta = minetest.env:get_meta({x=pos.x,y=pos.y-1,z=pos.z})
tubelike=meta:get_int("tubelike")
if tubelike==1 then velocity.x=0 velocity.y=-1 velocity.z=0 return 1 end
end
print ("spadl")
return 0
end
function check_pos_vector (pos,velocity)
added={}
added.x=pos.x+velocity.x
added.y=pos.y+velocity.y
added.z=pos.z+velocity.z
local meta=minetest.env:get_meta(added)
--print(dump(added).." : "..tubelike)
if meta:get_int("tubelike")==1 then return 1 end
return 0
end
function add_new_TUBE_node (TUBE_nodes,pos1,parent)
local i=1
repeat
if TUBE_nodes[i]==nil then break end
if pos1.x==TUBE_nodes[i].x and pos1.y==TUBE_nodes[i].y and pos1.z==TUBE_nodes[i].z then return false end
i=i+1
until false
TUBE_nodes[i]={}
TUBE_nodes[i].x=pos1.x
TUBE_nodes[i].y=pos1.y
TUBE_nodes[i].z=pos1.z
TUBE_nodes[i].parent_x=parent.x
TUBE_nodes[i].parent_y=parent.y
TUBE_nodes[i].parent_z=parent.z
return true
end
function check_TUBE_node (TUBE_nodes,CHEST_nodes,i)
local pos1={}
local parent={}
pos1.x=TUBE_nodes[i].x
pos1.y=TUBE_nodes[i].y
pos1.z=TUBE_nodes[i].z
parent.x=pos1.x
parent.y=pos1.y
parent.z=pos1.z
new_node_added=false
pos1.x=pos1.x+1
check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
pos1.x=pos1.x-2
check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
pos1.x=pos1.x+1
pos1.y=pos1.y+1
check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
pos1.y=pos1.y-2
check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
pos1.y=pos1.y+1
pos1.z=pos1.z+1
check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
pos1.z=pos1.z-2
check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
pos1.z=pos1.z+1
return new_node_added
end
function check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
meta = minetest.env:get_meta(pos1)
if meta:get_float("tubelike")==1 then add_new_TUBE_node(TUBE_nodes,pos1,parent) return end
nctr = minetest.env:get_node(pos1)
if minetest.get_item_group(nctr.name, "tubedevice") == 1 then add_new_TUBE_node(CHEST_nodes,pos1,parent) return end
end

View File

@ -32,6 +32,7 @@ minetest.register_node("technic:iron_chest", {
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",

View File

@ -1,20 +1,35 @@
minetest.register_craft({
output = 'technic:nodebreaker_off 1',
recipe = {
{'default:wood', 'default:pick_mese','default:wood'},
{'default:stone', 'mesecons:piston','default:stone'},
{'default:stone', 'mesecons:mesecon','default:stone'},
}
})
minetest.register_node("technic:nodebreaker_off", {
description = "Node Breaker",
tile_images = {"technic_nodebreaker_top.png","technic_nodebreaker_bottom.png","technic_nodebreaker_side2.png","technic_nodebreaker_side1.png",
tile_images = {"technic_nodebreaker_top_off.png","technic_nodebreaker_bottom_off.png","technic_nodebreaker_side2_off.png","technic_nodebreaker_side1_off.png",
"technic_nodebreaker_back.png","technic_nodebreaker_front_off.png"},
is_ground_content = true,
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2,tubedevice=1},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
end,
})
minetest.register_node("technic:nodebreaker_on", {
description = "Node Breaker",
tile_images = {"technic_nodebreaker_top.png","technic_nodebreaker_bottom.png","technic_nodebreaker_side2.png","technic_nodebreaker_side1.png",
tile_images = {"technic_nodebreaker_top_on.png","technic_nodebreaker_bottom_on.png","technic_nodebreaker_side2_on.png","technic_nodebreaker_side1_on.png",
"technic_nodebreaker_back.png","technic_nodebreaker_front_on.png"},
is_ground_content = true,
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2},
tubelike=1,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2,tubedevice=1,not_in_creative_inventory=1},
sounds = default.node_sound_stone_defaults(),
})
@ -46,12 +61,18 @@ function break_node (pos,n_param)
pos2.z=pos.z
--param2 3=x+ 1=x- 2=z+ 0=z-
if n_param==3 then pos2.x=pos2.x+1 pos1.x=pos1.x-1 end
if n_param==2 then pos2.z=pos2.z+1 pos1.z=pos1.z-1 end
if n_param==1 then pos2.x=pos2.x-1 pos1.x=pos1.x+1 end
if n_param==0 then pos2.z=pos2.z-1 pos1.x=pos1.z+1 end
local x_velocity=0
local z_velocity=0
if n_param==3 then pos2.x=pos2.x+1 pos1.x=pos1.x-1 x_velocity=-1 end
if n_param==2 then pos2.z=pos2.z+1 pos1.z=pos1.z-1 z_velocity=-1 end
if n_param==1 then pos2.x=pos2.x-1 pos1.x=pos1.x+1 x_velocity=1 end
if n_param==0 then pos2.z=pos2.z-1 pos1.x=pos1.z+1 z_velocity=1 end
local node=minetest.env:get_node(pos2)
local meta = minetest.env:get_meta(pos1)
tubelike=meta:get_int("tubelike")
--if tubelike==1 then
if node.name == "air" then return nil end
if node.name == "default:lava_source" then return nil end
if node.name == "default:lava_flowing" then return nil end
@ -61,9 +82,13 @@ function break_node (pos,n_param)
local drops = minetest.get_node_drops(node.name, "default:pick_mese")
local _, dropped_item
for _, dropped_item in ipairs(drops) do
minetest.item_drop(dropped_item, "", pos1)
local item1=tube_item({x=pos.x,y=pos.y,z=pos.z},dropped_item)
item1:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z}
item1:setvelocity({x=x_velocity, y=0, z=z_velocity})
item1:setacceleration({x=0, y=0, z=0})
-- minetest.item_drop(dropped_item, "", pos1)
end
minetest.env:remove_node(pos2)
--end
end

View File

@ -49,18 +49,43 @@ minetest.register_craftitem( "technic:chromium_ingot", {
on_place_on_ground = minetest.craftitem_place_item,
})
minetest.register_craftitem( "technic:stainless_steel_ingot", {
description = "Stainless Steel Ingot",
inventory_image = "technic_stainless_steel_ingot.png",
on_place_on_ground = minetest.craftitem_place_item,
})
minetest.register_craft({
type = 'cooking',
output = "technic:chromium_ingot",
recipe = "technic:chromium_lump"
})
minetest.register_craftitem( "technic:stainless_steel_ingot", {
description = "Stainless Steel Ingot",
inventory_image = "technic_stainless_steel_ingot.png",
})
minetest.register_node( "technic:mineral_zinc", {
description = "Zinc Ore",
tile_images = { "default_stone.png^technic_mineral_zinc.png" },
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
drop = 'craft "technic:zinc_lump" 1',
})
minetest.register_craftitem( "technic:zinc_lump", {
description = "Zinc Lump",
inventory_image = "technic_zinc_lump.png",
})
minetest.register_craftitem( "technic:zinc_ingot", {
description = "Zinc Ingot",
inventory_image = "technic_zinc_ingot.png",
})
minetest.register_craft({
type = 'cooking',
output = "technic:zinc_ingot",
recipe = "technic:zinc_lump"
})
local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, ore_per_chunk, height_min, height_max)
if maxp.y < height_min or minp.y > height_max then
return
@ -104,7 +129,8 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume,
end
minetest.register_on_generated(function(minp, maxp, seed)
generate_ore("technic:mineral_diamond", "default:stone", minp, maxp, seed+20, 1/11/11/11, 2, -31000, -450)
generate_ore("technic:mineral_uranium", "default:stone", minp, maxp, seed+20, 1/11/11/11, 1, -300, -100)
generate_ore("technic:mineral_chromium", "default:stone", minp, maxp, seed+30, 1/10/10/10, 2, -31000, -100)
generate_ore("technic:mineral_diamond", "default:stone", minp, maxp, seed+21, 1/11/11/11, 2, -31000, -450)
generate_ore("technic:mineral_uranium", "default:stone", minp, maxp, seed+22, 1/11/11/11, 1, -300, -100)
generate_ore("technic:mineral_chromium", "default:stone", minp, maxp, seed+23, 1/10/10/10, 2, -31000, -100)
generate_ore("technic:mineral_zinc", "default:stone", minp, maxp, seed+24, 1/9/9/9, 5, -31000, 2)
end)

186
technic/rubber.lua Normal file
View File

@ -0,0 +1,186 @@
-- Code of rubber tree by PilzAdam
minetest.register_node("technic:rubber_sapling", {
description = "Rubber Tree Sapling",
drawtype = "plantlike",
tiles = {"technic_rubber_sapling.png"},
inventory_image = "technic_rubber_sapling.png",
wield_image = "technic_rubber_sapling.png",
paramtype = "light",
walkable = false,
groups = {dig_immediate=3,flammable=2},
sounds = default.node_sound_defaults(),
})
minetest.register_node("technic:rubber_tree_full", {
description = "Rubber Tree",
tiles = {"default_tree_top.png", "default_tree_top.png", "technic_rubber_tree_full.png"},
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
drop = "default:tree",
sounds = default.node_sound_wood_defaults(),
on_dig = function(pos, node, digger)
minetest.node_dig(pos, node, digger)
minetest.env:remove_node(pos)
end,
after_destruct = function(pos, oldnode)
oldnode.name = "technic:rubber_tree_empty"
minetest.env:set_node(pos, oldnode)
end
})
minetest.register_node("technic:rubber_tree_empty", {
tiles = {"default_tree_top.png", "default_tree_top.png", "technic_rubber_tree_empty.png"},
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2, not_in_creative_inventory=1},
drop = "default:tree",
sounds = default.node_sound_wood_defaults(),
})
minetest.register_abm({
nodenames = {"technic:rubber_tree_empty"},
interval = 60,
chance = 15,
action = function(pos, node)
node.name = "technic:rubber_tree_full"
minetest.env:set_node(pos, node)
end
})
minetest.register_node("technic:rubber_leaves", {
drawtype = "allfaces_optional",
visual_scale = 1.3,
tiles = {"default_leaves.png"},
paramtype = "light",
groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1},
drop = {
max_items = 1,
items = {
{
items = {'technic:rubber_sapling'},
rarity = 20,
},
}
},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_abm({
nodenames = {"technic:rubber_sapling"},
interval = 60,
chance = 20,
action = function(pos, node)
generate_tree(pos, "technic:rubber_tree_full", "technic:rubber_leaves", {"default:dirt", "default:dirt_with_grass"})
end
})
minetest.register_on_generated(function(minp, maxp, blockseed)
if math.random(1, 100) > 5 then
return
end
local tmp = {x=(maxp.x-minp.x)/2+minp.x, y=(maxp.y-minp.y)/2+minp.y, z=(maxp.z-minp.z)/2+minp.z}
local pos = minetest.env:find_node_near(tmp, maxp.x-minp.x, {"default:dirt_with_grass"})
if pos ~= nil then
generate_tree({x=pos.x, y=pos.y+1, z=pos.z}, "technic:rubber_tree_full", "technic:rubber_leaves", {"default:dirt", "default:dirt_with_grass"})
end
end)
-- ========= FUEL =========
minetest.register_craft({
type = "fuel",
recipe = "technic:rubber_sapling",
burntime = 10
})
function generate_tree(pos, trunk, leaves, underground, replacements)
pos.y = pos.y-1
local nodename = minetest.env:get_node(pos).name
local ret = true
for _,name in ipairs(underground) do
if nodename == name then
ret = false
break
end
end
pos.y = pos.y+1
if ret or minetest.env:get_node_light(pos) < 8 then
return
end
node = {name = ""}
for dy=1,4 do
pos.y = pos.y+dy
if minetest.env:get_node(pos).name ~= "air" then
return
end
pos.y = pos.y-dy
end
node.name = trunk
for dy=0,4 do
pos.y = pos.y+dy
minetest.env:set_node(pos, node)
pos.y = pos.y-dy
end
if not replacements then
replacements = {}
end
node.name = leaves
pos.y = pos.y+3
for dx=-2,2 do
for dz=-2,2 do
for dy=0,3 do
pos.x = pos.x+dx
pos.y = pos.y+dy
pos.z = pos.z+dz
if dx == 0 and dz == 0 and dy==3 then
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
minetest.env:set_node(pos, node)
for name,rarity in pairs(replacements) do
if math.random(1, rarity) == 1 then
minetest.env:set_node(pos, {name=name})
end
end
end
elseif dx == 0 and dz == 0 and dy==4 then
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
minetest.env:set_node(pos, node)
for name,rarity in pairs(replacements) do
if math.random(1, rarity) == 1 then
minetest.env:set_node(pos, {name=name})
end
end
end
elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then
if minetest.env:get_node(pos).name == "air" then
minetest.env:set_node(pos, node)
for name,rarity in pairs(replacements) do
if math.random(1, rarity) == 1 then
minetest.env:set_node(pos, {name=name})
end
end
end
else
if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then
if minetest.env:get_node(pos).name == "air" and math.random(1, 5) <= 4 then
minetest.env:set_node(pos, node)
for name,rarity in pairs(replacements) do
if math.random(1, rarity) == 1 then
minetest.env:set_node(pos, {name=name})
end
end
end
end
end
pos.x = pos.x-dx
pos.y = pos.y-dy
pos.z = pos.z-dz
end
end
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 B

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

49
technic/tree_tap.lua Normal file
View File

@ -0,0 +1,49 @@
minetest.register_tool("technic:treetap", {
description = "Tree Tap",
inventory_image = "technic_tree_tap.png",
on_use = function(itemstack,user,pointed_thing)
if pointed_thing.type~="node" then return end
if user:get_inventory():room_for_item("main",ItemStack("technic:caouthouc")) then
local pos=minetest.get_pointed_thing_position(pointed_thing,above)
local node=minetest.env:get_node(pos)
local node_name=node.name
if node_name == "technic:rubber_tree_full" then
user:get_inventory():add_item("main",ItemStack("technic:caouthouc"))
minetest.env:set_node(pos,node)
local item=itemstack:to_table()
local item_wear=tonumber((item["wear"]))
item_wear=item_wear+819
if item_wear>65535 then itemstack:clear() return itemstack end
item["wear"]=tostring(item_wear)
itemstack:replace(item)
return itemstack
else
return itemstack
end
else return end
end,
})
minetest.register_craft({
output = "technic:treetap",
recipe = {
{"pipeworks:tube", "default:wood", "default:stick"},
{"", "default:stick", "default:stick"}
},
})
minetest.register_craftitem("technic:caouthouc", {
description = "Caouthouc",
inventory_image = "technic_caouthouc.png",
})
minetest.register_craft({
type = "cooking",
output = "technic:rubber",
recipe = "technic:caouthouc",
})
minetest.register_craftitem("technic:rubber", {
description = "Rubber Fiber",
inventory_image = "technic_rubber.png",
})

400
technic/wires_mv.lua Normal file
View File

@ -0,0 +1,400 @@
--MV cable node boxes
minetest.register_alias("mv_cable", "technic:mv_cable")
minetest.register_craft({
output = 'technic:mv_cable 3',
recipe ={
{'technic:rubber','technic:rubber','technic:rubber'},
{'technic:lv_cable','technic:lv_cable','technic:lv_cable'},
{'technic:rubber','technic:rubber','technic:rubber'},
}
})
minetest.register_craftitem("technic:mv_cable", {
description = "Medium Voltage Copper Cable",
stack_max = 99,
})
minetest.register_node("technic:mv_cable", {
description = "Medium Voltage Copper Cable",
tiles = {"technic_mv_cable.png"},
inventory_image = "technic_mv_cable_wield.png",
wield_image = "technic_mv_cable_wield.png",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
drop = "technic:mv_cable",
mv_cablelike=1,
rules_x1=0,
rules_x2=0,
rules_y1=0,
rules_y2=0,
rules_z1=0,
rules_z2=0,
paramtype = "light",
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = {
{ -0.1 , -0.1 , -0.1 , 0.1 , 0.1 , 0.1 },
}},
node_box = {
type = "fixed",
fixed = {
{ -0.1 , -0.1 , -0.1 , 0.1 , 0.1 , 0.1 },
}},
on_construct = function(pos)
meta=minetest.env:get_meta(pos)
meta:set_float("mv_cablelike",1)
meta:set_float("x1",0)
meta:set_float("x2",0)
meta:set_float("y1",0)
meta:set_float("y2",0)
meta:set_float("z1",0)
meta:set_float("z2",0)
MV_check_connections (pos)
end,
after_dig_node = function (pos, oldnode, oldmetadata, digger)
MV_check_connections_on_destroy (pos)
end,
})
str_y1= { -0.1 , -0.1 , -0.1 , 0.1 , 0.5, 0.1 } --0 y+
str_x1= { -0.1 , -0.1 , -0.1 , 0.5, 0.1 , 0.1 } --0 x+
str_z1= { -0.1 , -0.1 , 0.1 , 0.1 , 0.1 , 0.5 } --0 z+
str_z2= { -0.1 , -0.1, -0.5 , 0.1 , 0.1 , 0.1 } --0 z-
str_y2= { -0.1 , -0.5, -0.1 , 0.1 , 0.1 , 0.1 } --0 y-
str_x2= { -0.5 , -0.1, -0.1 , 0.1 , 0.1 , 0.1 } --0 x-
local x1,x2,y1,y2,z1,z2
local count=0
for x1 = 0, 1, 1 do --x-
for x2 = 0, 1, 1 do --x+
for y1 = 0, 1, 1 do --y-
for y2 = 0, 1, 1 do --y-
for z1 = 0, 1, 1 do --z-
for z2 = 0, 1, 1 do --z+
temp_x1={} temp_x2={} temp_y1={} temp_y2={} temp_z1={} temp_z2={}
if x1==1 then temp_x1=str_x1 end
if x2==1 then temp_x2=str_x2 end
if y1==1 then temp_y1=str_y1 end
if y2==1 then temp_y2=str_y2 end
if z1==1 then temp_z1=str_z1 end
if z2==1 then temp_z2=str_z2 end
minetest.register_node("technic:mv_cable"..count, {
description = "Medium Voltage Copper Cable",
tiles = {"technic_mv_cable.png"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
drop = "technic:mv_cable",
rules_x1=0,
rules_x2=0,
rules_y1=0,
rules_y2=0,
rules_z1=0,
rules_z2=0,
cablelike=1,
paramtype = "light",
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = {
temp_x1,temp_x2,temp_y1,temp_y2,temp_z1,temp_z2,
}},
node_box = {
type = "fixed",
fixed = {
temp_x1,temp_x2,temp_y1,temp_y2,temp_z1,temp_z2,
}},
after_dig_node = function (pos, oldnode, oldmetadata, digger)
MV_check_connections_on_destroy (pos)
end,
})
count=count+1 end end end end end end
MV_check_connections = function(pos)
local pos1={}
pos1.x=pos.x
pos1.y=pos.y
pos1.z=pos.z
pos1.x=pos1.x+1
if minetest.env:get_meta(pos1):get_float("mv_cablelike")==1 then
x2=1
x1=minetest.env:get_meta(pos1):get_float("x1")
y1=minetest.env:get_meta(pos1):get_float("y1")
y2=minetest.env:get_meta(pos1):get_float("y2")
z1=minetest.env:get_meta(pos1):get_float("z1")
z2=minetest.env:get_meta(pos1):get_float("z2")
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
hacky_swap_node(pos1,"technic:mv_cable"..rule)
meta=minetest.env:get_meta(pos1)
meta:set_float("x2",x2)
meta=minetest.env:get_meta(pos)
x1=1
x2=minetest.env:get_meta(pos):get_float("x2")
y1=minetest.env:get_meta(pos):get_float("y1")
y2=minetest.env:get_meta(pos):get_float("y2")
z1=minetest.env:get_meta(pos):get_float("z1")
z2=minetest.env:get_meta(pos):get_float("z2")
meta:set_float("x1",x1)
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
hacky_swap_node(pos,"technic:mv_cable"..rule)
end
pos1.x=pos1.x-2
if minetest.env:get_meta(pos1):get_float("mv_cablelike")==1 then
x1=1
x2=minetest.env:get_meta(pos1):get_float("x2")
y1=minetest.env:get_meta(pos1):get_float("y1")
y2=minetest.env:get_meta(pos1):get_float("y2")
z1=minetest.env:get_meta(pos1):get_float("z1")
z2=minetest.env:get_meta(pos1):get_float("z2")
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
hacky_swap_node(pos1,"technic:mv_cable"..rule)
meta=minetest.env:get_meta(pos1)
meta:set_float("x1",x1)
meta=minetest.env:get_meta(pos)
x2=1
x1=minetest.env:get_meta(pos):get_float("x1")
y1=minetest.env:get_meta(pos):get_float("y1")
y2=minetest.env:get_meta(pos):get_float("y2")
z1=minetest.env:get_meta(pos):get_float("z1")
z2=minetest.env:get_meta(pos):get_float("z2")
meta:set_float("x2",x2)
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
hacky_swap_node(pos,"technic:mv_cable"..rule)
end
pos1.x=pos1.x+1
pos1.y=pos1.y+1
if minetest.env:get_meta(pos1):get_float("mv_cablelike")==1 then
y2=1
x1=minetest.env:get_meta(pos1):get_float("x1")
x2=minetest.env:get_meta(pos1):get_float("x2")
y1=minetest.env:get_meta(pos1):get_float("y1")
z1=minetest.env:get_meta(pos1):get_float("z1")
z2=minetest.env:get_meta(pos1):get_float("z2")
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
hacky_swap_node(pos1,"technic:mv_cable"..rule)
meta=minetest.env:get_meta(pos1)
meta:set_float("y2",y2)
meta=minetest.env:get_meta(pos)
y1=1
x1=minetest.env:get_meta(pos):get_float("x1")
x2=minetest.env:get_meta(pos):get_float("x2")
y2=minetest.env:get_meta(pos):get_float("y2")
z1=minetest.env:get_meta(pos):get_float("z1")
z2=minetest.env:get_meta(pos):get_float("z2")
meta:set_float("y1",y1)
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
hacky_swap_node(pos,"technic:mv_cable"..rule)
end
if minetest.env:get_meta(pos1):get_float("technic_mv_power_machine")==1 then
y1=1
x1=minetest.env:get_meta(pos):get_float("x1")
x2=minetest.env:get_meta(pos):get_float("x2")
y2=minetest.env:get_meta(pos):get_float("y2")
z1=minetest.env:get_meta(pos):get_float("z1")
z2=minetest.env:get_meta(pos):get_float("z2")
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
hacky_swap_node(pos,"technic:mv_cable"..rule)
meta=minetest.env:get_meta(pos)
meta:set_float("y1",y1)
end
pos1.y=pos1.y-2
if minetest.env:get_meta(pos1):get_float("mv_cablelike")==1 then
y1=1
x1=minetest.env:get_meta(pos1):get_float("x1")
x2=minetest.env:get_meta(pos1):get_float("x2")
y2=minetest.env:get_meta(pos1):get_float("y2")
z1=minetest.env:get_meta(pos1):get_float("z1")
z2=minetest.env:get_meta(pos1):get_float("z2")
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
hacky_swap_node(pos1,"technic:mv_cable"..rule)
meta=minetest.env:get_meta(pos1)
meta:set_float("y1",y1)
meta=minetest.env:get_meta(pos)
y2=1
x1=minetest.env:get_meta(pos):get_float("x1")
x2=minetest.env:get_meta(pos):get_float("x2")
y1=minetest.env:get_meta(pos):get_float("y1")
z1=minetest.env:get_meta(pos):get_float("z1")
z2=minetest.env:get_meta(pos):get_float("z2")
meta:set_float("y2",y2)
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
hacky_swap_node(pos,"technic:mv_cable"..rule)
end
pos1.y=pos1.y+1
pos1.z=pos1.z+1
if minetest.env:get_meta(pos1):get_float("mv_cablelike")==1 then
z2=1
x1=minetest.env:get_meta(pos1):get_float("x1")
x2=minetest.env:get_meta(pos1):get_float("x2")
y1=minetest.env:get_meta(pos1):get_float("y1")
y2=minetest.env:get_meta(pos1):get_float("y2")
z1=minetest.env:get_meta(pos1):get_float("z1")
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
hacky_swap_node(pos1,"technic:mv_cable"..rule)
meta=minetest.env:get_meta(pos1)
meta:set_float("z2",z2)
meta=minetest.env:get_meta(pos)
z1=1
x1=minetest.env:get_meta(pos):get_float("x1")
x2=minetest.env:get_meta(pos):get_float("x2")
y1=minetest.env:get_meta(pos):get_float("y1")
y2=minetest.env:get_meta(pos):get_float("y2")
z2=minetest.env:get_meta(pos):get_float("z2")
meta:set_float("z1",z1)
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
hacky_swap_node(pos,"technic:mv_cable"..rule)
end
pos1.z=pos1.z-2
if minetest.env:get_meta(pos1):get_float("mv_cablelike")==1 then
z1=1
x1=minetest.env:get_meta(pos1):get_float("x1")
x2=minetest.env:get_meta(pos1):get_float("x2")
y1=minetest.env:get_meta(pos1):get_float("y1")
y2=minetest.env:get_meta(pos1):get_float("y2")
z2=minetest.env:get_meta(pos1):get_float("z2")
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
hacky_swap_node(pos1,"technic:mv_cable"..rule)
meta=minetest.env:get_meta(pos1)
meta:set_float("z1",z1)
meta=minetest.env:get_meta(pos)
z2=1
x1=minetest.env:get_meta(pos):get_float("x1")
x2=minetest.env:get_meta(pos):get_float("x2")
y1=minetest.env:get_meta(pos):get_float("y1")
y2=minetest.env:get_meta(pos):get_float("y2")
z1=minetest.env:get_meta(pos):get_float("z1")
meta:set_float("z2",z2)
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
hacky_swap_node(pos,"technic:mv_cable"..rule)
end
pos1.z=pos1.z+1
end
MV_check_connections_on_destroy = function(pos)
local pos1={}
pos1.x=pos.x
pos1.y=pos.y
pos1.z=pos.z
pos1.x=pos1.x+1
if minetest.env:get_meta(pos1):get_float("mv_cablelike")==1 then
x2=0
x1=minetest.env:get_meta(pos1):get_float("x1")
y1=minetest.env:get_meta(pos1):get_float("y1")
y2=minetest.env:get_meta(pos1):get_float("y2")
z1=minetest.env:get_meta(pos1):get_float("z1")
z2=minetest.env:get_meta(pos1):get_float("z2")
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
if rule==0 then hacky_swap_node(pos1,"technic:mv_cable") end
if rule>0 then hacky_swap_node(pos1,"technic:mv_cable"..rule) end
meta=minetest.env:get_meta(pos1)
meta:set_float("x2",x2)
end
pos1.x=pos1.x-2
if minetest.env:get_meta(pos1):get_float("mv_cablelike")==1 then
x1=0
x2=minetest.env:get_meta(pos1):get_float("x2")
y1=minetest.env:get_meta(pos1):get_float("y1")
y2=minetest.env:get_meta(pos1):get_float("y2")
z1=minetest.env:get_meta(pos1):get_float("z1")
z2=minetest.env:get_meta(pos1):get_float("z2")
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
if rule==0 then hacky_swap_node(pos1,"technic:mv_cable") end
if rule>0 then hacky_swap_node(pos1,"technic:mv_cable"..rule) end
meta=minetest.env:get_meta(pos1)
meta:set_float("x1",x1)
end
pos1.x=pos1.x+1
pos1.y=pos1.y+1
if minetest.env:get_meta(pos1):get_float("mv_cablelike")==1 then
y2=0
x1=minetest.env:get_meta(pos1):get_float("x1")
x2=minetest.env:get_meta(pos1):get_float("x2")
y1=minetest.env:get_meta(pos1):get_float("y1")
z1=minetest.env:get_meta(pos1):get_float("z1")
z2=minetest.env:get_meta(pos1):get_float("z2")
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
if rule==0 then hacky_swap_node(pos1,"technic:mv_cable") end
if rule>0 then hacky_swap_node(pos1,"technic:mv_cable"..rule) end
meta=minetest.env:get_meta(pos1)
meta:set_float("y2",y2)
end
pos1.y=pos1.y-2
if minetest.env:get_meta(pos1):get_float("mv_cablelike")==1 then
y1=0
x1=minetest.env:get_meta(pos1):get_float("x1")
x2=minetest.env:get_meta(pos1):get_float("x2")
y2=minetest.env:get_meta(pos1):get_float("y2")
z1=minetest.env:get_meta(pos1):get_float("z1")
z2=minetest.env:get_meta(pos1):get_float("z2")
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
if rule==0 then hacky_swap_node(pos1,"technic:mv_cable") end
if rule>0 then hacky_swap_node(pos1,"technic:mv_cable"..rule) end
meta=minetest.env:get_meta(pos1)
meta:set_float("y1",y1)
end
pos1.y=pos1.y+1
pos1.z=pos1.z+1
if minetest.env:get_meta(pos1):get_float("mv_cablelike")==1 then
z2=0
x1=minetest.env:get_meta(pos1):get_float("x1")
x2=minetest.env:get_meta(pos1):get_float("x2")
y1=minetest.env:get_meta(pos1):get_float("y1")
y2=minetest.env:get_meta(pos1):get_float("y2")
z1=minetest.env:get_meta(pos1):get_float("z1")
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
if rule==0 then hacky_swap_node(pos1,"technic:mv_cable") end
if rule>0 then hacky_swap_node(pos1,"technic:mv_cable"..rule) end
meta=minetest.env:get_meta(pos1)
meta:set_float("z2",z2)
end
pos1.z=pos1.z-2
if minetest.env:get_meta(pos1):get_float("mv_cablelike")==1 then
z1=0
x1=minetest.env:get_meta(pos1):get_float("x1")
x2=minetest.env:get_meta(pos1):get_float("x2")
y1=minetest.env:get_meta(pos1):get_float("y1")
y2=minetest.env:get_meta(pos1):get_float("y2")
z2=minetest.env:get_meta(pos1):get_float("z2")
rule=make_rule_number(x1,x2,y1,y2,z1,z2)
if rule==0 then hacky_swap_node(pos1,"technic:mv_cable") end
if rule>0 then hacky_swap_node(pos1,"technic:mv_cable"..rule) end
meta=minetest.env:get_meta(pos1)
meta:set_float("z1",z1)
end
pos1.y=pos1.y+1
end