From: RealBadAngel Date: Thu, 13 Dec 2012 00:49:02 +0000 (+0100) Subject: update the mod X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=b8d77627a4d28c624e63423eef317dd09c68e533;p=zefram%2Fminetest%2Ftechnic.git update the mod --- diff --git a/alloy_furnace.lua b/alloy_furnace.lua deleted file mode 100644 index fd0bc70..0000000 --- a/alloy_furnace.lua +++ /dev/null @@ -1,424 +0,0 @@ -alloy_recipes ={} - -registered_recipes_count=1 - -function register_alloy_recipe (string1,count1, string2,count2, string3,count3) -alloy_recipes[registered_recipes_count]={} -alloy_recipes[registered_recipes_count].src1_name=string1 -alloy_recipes[registered_recipes_count].src1_count=count1 -alloy_recipes[registered_recipes_count].src2_name=string2 -alloy_recipes[registered_recipes_count].src2_count=count2 -alloy_recipes[registered_recipes_count].dst_name=string3 -alloy_recipes[registered_recipes_count].dst_count=count3 -registered_recipes_count=registered_recipes_count+1 -alloy_recipes[registered_recipes_count]={} -alloy_recipes[registered_recipes_count].src1_name=string2 -alloy_recipes[registered_recipes_count].src1_count=count2 -alloy_recipes[registered_recipes_count].src2_name=string1 -alloy_recipes[registered_recipes_count].src2_count=count1 -alloy_recipes[registered_recipes_count].dst_name=string3 -alloy_recipes[registered_recipes_count].dst_count=count3 -registered_recipes_count=registered_recipes_count+1 -end - -register_alloy_recipe ("technic:copper_dust",3, "technic:tin_dust",1, "technic:bronze_dust",4) -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:steel_ingot",3, "technic:chromium_ingot",1, "technic:stainless_steel_ingot",4) -register_alloy_recipe ("technic:copper_dust",2, "technic:zinc_dust",1, "technic:brass_dust",3) -register_alloy_recipe ("technic:copper_ingot",2, "technic:zinc_ingot",1, "technic:brass_ingot",3) -register_alloy_recipe ("default:sand",2, "technic:coal_dust",2, "technic:silicon_wafer",1) -register_alloy_recipe ("technic:silicon_wafer",1, "technic:mithril_dust",1, "technic:doped_silicon_wafer",1) - - -minetest.register_craft({ - output = 'technic:alloy_furnace', - recipe = { - {'default:brick', 'default:brick', 'default:brick'}, - {'default:brick', '', 'default:brick'}, - {'default:steel_ingot', 'moreores:copper_ingot', 'default:steel_ingot'}, - } -}) - - -alloy_furnace_formspec = - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png]".. - "list[current_name;src;3,1;1,1;]".. - "list[current_name;src2;3,2;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]".. - "label[0,0;Electric Alloy Furnace]".. - "label[1,3;Power level]" - -minetest.register_node("technic:alloy_furnace", { - description = "Electric alloy furnace", - tiles = {"technic_alloy_furnace_top.png", "technic_machine_bottom.png", "technic_alloy_furnace_side.png", - "technic_alloy_furnace_side.png", "technic_alloy_furnace_side.png", "technic_alloy_furnace_front.png"}, - paramtype2 = "facedir", - groups = {cracky=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), - technic_power_machine=1, - internal_EU_buffer=0; - interal_EU_buffer_size=2000; - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_float("technic_power_machine", 1) - meta:set_string("formspec", alloy_furnace_formspec) - meta:set_string("infotext", "Electric Alloy furnace") - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("src2", 1) - inv:set_size("dst", 4) - local EU_used = 0 - local furnace_is_cookin = 0 - local cooked = nil - meta:set_float("internal_EU_buffer",0) - meta:set_float("internal_EU_buffer_size",2000) - - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("dst") then - return false end - if not inv:is_empty("src") then - return false end - if not inv:is_empty("src2") then - return false end - return true - end, -}) - -minetest.register_node("technic:alloy_furnace_active", { - description = "Alloy Furnace", - tiles = {"technic_alloy_furnace_top.png", "technic_machine_bottom.png", "technic_alloy_furnace_side.png", - "technic_alloy_furnace_side.png", "technic_alloy_furnace_side.png", "technic_alloy_furnace_front_active.png"}, - paramtype2 = "facedir", - light_source = 8, - drop = "technic:alloy_furnace", - groups = {cracky=2, not_in_creative_inventory=1}, - legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), - internal_EU_buffer=0; - interal_EU_buffer_size=2000; - technic_power_machine=1, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - -minetest.register_abm({ - nodenames = {"technic:alloy_furnace","technic:alloy_furnace_active"}, - interval = 1, - chance = 1, - - action = function(pos, node, active_object_count, active_object_count_wider) - - local meta = minetest.env:get_meta(pos) - internal_EU_buffer=meta:get_float("internal_EU_buffer") - internal_EU_buffer_size=meta:get_float("internal_EU_buffer") - local load = math.floor(internal_EU_buffer/2000 * 100) - meta:set_string("formspec", - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. - (load)..":technic_power_meter_fg.png]".. - "list[current_name;src;3,1;1,1;]".. - "list[current_name;src2;3,2;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]".. - "label[0,0;Electric Alloy Furnace]".. - "label[1,3;Power level]") - - local inv = meta:get_inventory() - - local furnace_is_cookin = meta:get_int("furnace_is_cookin") - - - local srclist = inv:get_list("src") - local srclist2 = inv:get_list("src2") - - srcstack = inv:get_stack("src", 1) - if srcstack then src_item1=srcstack:to_table() end - srcstack = inv:get_stack("src2", 1) - if srcstack then src_item2=srcstack:to_table() end - dst_index=nil - - if src_item1 and src_item2 then - dst_index=get_cook_result(src_item1,src_item2) - end - - - if (furnace_is_cookin == 1) then - if internal_EU_buffer>=150 then - internal_EU_buffer=internal_EU_buffer-150; - meta:set_float("internal_EU_buffer",internal_EU_buffer) - meta:set_float("src_time", meta:get_float("src_time") + 1) - if dst_index and meta:get_float("src_time") >= 4 then - -- check if there's room for output in "dst" list - dst_stack={} - dst_stack["name"]=alloy_recipes[dst_index].dst_name - dst_stack["count"]=alloy_recipes[dst_index].dst_count - if inv:room_for_item("dst",dst_stack) then - -- Put result in "dst" list - inv:add_item("dst",dst_stack) - -- take stuff from "src" list - for i=1,alloy_recipes[dst_index].src1_count,1 do - srcstack = inv:get_stack("src", 1) - srcstack:take_item() - inv:set_stack("src", 1, srcstack) - end - for i=1,alloy_recipes[dst_index].src2_count,1 do - srcstack = inv:get_stack("src2", 1) - srcstack:take_item() - inv:set_stack("src2", 1, srcstack) - end - - - else - print("Furnace inventory full!") - end - meta:set_string("src_time", 0) - end - end - end - - - - - if dst_index and meta:get_int("furnace_is_cookin")==0 then - hacky_swap_node(pos,"technic:alloy_furnace_active") - meta:set_string("infotext","Electric Alloy Furnace active") - meta:set_int("furnace_is_cookin",1) - meta:set_string("src_time", 0) - return - end - - - if meta:get_int("furnace_is_cookin")==0 or dst_index==nil then - hacky_swap_node(pos,"technic:alloy_furnace") - meta:set_string("infotext","Electric Alloy Furnace inactive") - meta:set_int("furnace_is_cookin",0) - meta:set_string("src_time", 0) - end - -end, -}) - -function get_cook_result(src_item1, src_item2) -local counter=registered_recipes_count-1 -for i=1, counter,1 do -if alloy_recipes[i].src1_name==src_item1["name"] and - alloy_recipes[i].src2_name==src_item2["name"] and - alloy_recipes[i].src1_count<=src_item1["count"] and - alloy_recipes[i].src2_count<=src_item2["count"] - then return i end -end -return nil -end - - ---coal driven alloy furnace: - -minetest.register_craft({ - output = 'technic:coal_alloy_furnace', - recipe = { - {'default:brick', 'default:brick', 'default:brick'}, - {'default:brick', '', 'default:brick'}, - {'default:brick', 'default:brick', 'default:brick'}, - } -}) - - -coal_alloy_furnace_formspec = - "size[8,9]".. - "label[0,0;Alloy Furnace]".. - "image[2,2;1,1;default_furnace_fire_bg.png]".. - "list[current_name;fuel;2,3;1,1;]".. - "list[current_name;src;2,1;1,1;]".. - "list[current_name;src2;3,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]" - -minetest.register_node("technic:coal_alloy_furnace", { - description = "Alloy Furnace", - tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.png", "technic_coal_alloy_furnace_side.png", - "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front.png"}, - paramtype2 = "facedir", - groups = {cracky=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("formspec", coal_alloy_furnace_formspec) - meta:set_string("infotext", "Alloy Furnace") - local inv = meta:get_inventory() - inv:set_size("fuel", 1) - inv:set_size("src", 1) - inv:set_size("src2", 1) - inv:set_size("dst", 4) - local furnace_is_cookin = 0 - local dst_index = nil - - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not (inv:is_empty("fuel") or inv:is_empty("dst") or inv:is_empty("src") or inv:is_empty("src2") )then - return false - end - return true - end, -}) - -minetest.register_node("technic:coal_alloy_furnace_active", { - description = "Alloy Furnace", - tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.png", "technic_coal_alloy_furnace_side.png", - "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front_active.png"}, - paramtype2 = "facedir", - light_source = 8, - drop = "technic:coal_alloy_furnace", - groups = {cracky=2, not_in_creative_inventory=1}, - legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not (inv:is_empty("fuel") or inv:is_empty("dst") or inv:is_empty("src") or inv:is_empty("src2") )then - return false - end - return true - end, -}) - -minetest.register_abm({ - nodenames = {"technic:coal_alloy_furnace","technic:coal_alloy_furnace_active"}, - interval = 1, - chance = 1, - - action = function(pos, node, active_object_count, active_object_count_wider) - local meta = minetest.env:get_meta(pos) - for i, name in ipairs({ - "fuel_totaltime", - "fuel_time", - "src_totaltime", - "src_time" - }) do - if meta:get_string(name) == "" then - meta:set_float(name, 0.0) - end - end - - local inv = meta:get_inventory() - - srcstack = inv:get_stack("src", 1) - if srcstack then src_item1=srcstack:to_table() end - srcstack = inv:get_stack("src2", 1) - if srcstack then src_item2=srcstack:to_table() end - dst_index=nil - - if src_item1 and src_item2 then - dst_index=get_cook_result(src_item1,src_item2) - end - - local was_active = false - - if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then - was_active = true - meta:set_float("fuel_time", meta:get_float("fuel_time") + 1) - meta:set_float("src_time", meta:get_float("src_time") + 1) - if dst_index and meta:get_float("src_time") >= 5 then - -- check if there's room for output in "dst" list - dst_stack={} - dst_stack["name"]=alloy_recipes[dst_index].dst_name - dst_stack["count"]=alloy_recipes[dst_index].dst_count - if inv:room_for_item("dst",dst_stack) then - -- Put result in "dst" list - inv:add_item("dst", dst_stack) - -- take stuff from "src" list - for i=1,alloy_recipes[dst_index].src1_count,1 do - srcstack = inv:get_stack("src", 1) - srcstack:take_item() - inv:set_stack("src", 1, srcstack) - end - for i=1,alloy_recipes[dst_index].src2_count,1 do - srcstack = inv:get_stack("src2", 1) - srcstack:take_item() - inv:set_stack("src2", 1, srcstack) - end - else - print("Furnace inventory full!") - end - meta:set_string("src_time", 0) - end - end - - if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then - local percent = math.floor(meta:get_float("fuel_time") / - meta:get_float("fuel_totaltime") * 100) - meta:set_string("infotext","Furnace active: "..percent.."%") - hacky_swap_node(pos,"technic:coal_alloy_furnace_active") - meta:set_string("formspec", - "size[8,9]".. - "label[0,0;Electric Alloy Furnace]".. - "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:".. - (100-percent)..":default_furnace_fire_fg.png]".. - "list[current_name;fuel;2,3;1,1;]".. - "list[current_name;src;2,1;1,1;]".. - "list[current_name;src2;3,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]") - return - end - - local fuel = nil - local fuellist = inv:get_list("fuel") - - srcstack = inv:get_stack("src", 1) - if srcstack then src_item1=srcstack:to_table() end - srcstack = inv:get_stack("src2", 1) - if srcstack then src_item2=srcstack:to_table() end - dst_index=nil - - if src_item1 and src_item2 then - dst_index=get_cook_result(src_item1,src_item2) - end - - - if fuellist then - fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) - end - - if fuel.time <= 0 then - meta:set_string("infotext","Furnace out of fuel") - hacky_swap_node(pos,"technic:coal_alloy_furnace") - meta:set_string("formspec", coal_alloy_furnace_formspec) - return - end - - if dst_index==nil then - if was_active then - meta:set_string("infotext","Furnace is empty") - hacky_swap_node(pos,"technic:coal_alloy_furnace") - meta:set_string("formspec", coal_alloy_furnace_formspec) - end - return - end - - meta:set_string("fuel_totaltime", fuel.time) - meta:set_string("fuel_time", 0) - - local stack = inv:get_stack("fuel", 1) - stack:take_item() - inv:set_stack("fuel", 1, stack) - -end, -}) \ No newline at end of file diff --git a/battery_box.lua b/battery_box.lua deleted file mode 100644 index f5827a4..0000000 --- a/battery_box.lua +++ /dev/null @@ -1,398 +0,0 @@ -power_tools ={} - -registered_power_tools_count=1 - -function register_power_tool (string1,max_charge) -power_tools[registered_power_tools_count]={} -power_tools[registered_power_tools_count].tool_name=string1 -power_tools[registered_power_tools_count].max_charge=max_charge -registered_power_tools_count=registered_power_tools_count+1 -end - -register_power_tool ("technic:mining_drill",60000) -register_power_tool ("technic:chainsaw",30000) -register_power_tool ("technic:laser_mk1",40000) -register_power_tool ("technic:battery",10000) -register_power_tool ("technic:sonic_screwdriver",15000) -register_power_tool ("technic:flashlight",30000) -register_power_tool ("technic:red_energy_crystal",100000) -register_power_tool ("technic:green_energy_crystal",250000) -register_power_tool ("technic:blue_energy_crystal",500000) - -minetest.register_alias("battery", "technic:battery") -minetest.register_alias("battery_box", "technic:battery_box") - -minetest.register_craft({ - output = 'technic:battery 1', - recipe = { - {'default:wood', 'moreores:copper_ingot', 'default:wood'}, - {'default:wood', 'moreores:tin_ingot', 'default:wood'}, - {'default:wood', 'moreores:copper_ingot', 'default:wood'}, - } -}) - -minetest.register_craft({ - output = 'technic:battery_box 1', - recipe = { - {'technic:battery', 'default:wood', 'technic:battery'}, - {'technic:battery', 'moreores:copper_ingot', 'technic:battery'}, - {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, - } -}) - - -minetest.register_tool("technic:battery", -{description = "RE Battery", -inventory_image = "technic_battery.png", -tool_capabilities = {load=0,max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}}) - -minetest.register_craftitem("technic:battery_box", { - description = "Battery box", - stack_max = 99, -}) - - - -battery_box_formspec = - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png]".. - "list[current_name;src;3,1;1,1;]".. - "image[4,1;1,1;technic_battery_reload.png]".. - "list[current_name;dst;5,1;1,1;]".. - "label[0,0;Battery box]".. - "label[3,0;Charge]".. - "label[5,0;Discharge]".. - "label[1,3;Power level]".. - "list[current_player;main;0,5;8,4;]" - -minetest.register_node("technic:battery_box", { - description = "Battery box", - tiles = {"technic_battery_box_top.png", "technic_battery_box_bottom.png", "technic_battery_box_side0.png", - "technic_battery_box_side0.png", "technic_battery_box_side0.png", "technic_battery_box_side0.png"}, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - sounds = default.node_sound_wood_defaults(), - technic_power_machine=1, - last_side_shown=0, - drop="technic:battery_box", - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("infotext", "Battery box") - meta:set_float("technic_power_machine", 1) - meta:set_string("formspec", battery_box_formspec) - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("dst", 1) - battery_charge = 0 - max_charge = 60000 - last_side_shown=0 - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - - -for i=1,8,1 do -minetest.register_node("technic:battery_box"..i, { - description = "Battery box", - tiles = {"technic_battery_box_top.png", "technic_battery_box_bottom.png", "technic_battery_box_side0.png^technic_power_meter"..i..".png", - "technic_battery_box_side0.png^technic_power_meter"..i..".png", "technic_battery_box_side0.png^technic_power_meter"..i..".png", "technic_battery_box_side0.png^technic_power_meter"..i..".png"}, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, - sounds = default.node_sound_wood_defaults(), - technic_power_machine=1, - last_side_shown=0, - drop="technic:battery_box", - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("infotext", "Battery box") - meta:set_float("technic_power_machine", 1) - meta:set_string("formspec", battery_box_formspec) - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("dst", 1) - battery_charge = 0 - max_charge = 60000 - last_side_shown=0 - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) -end - - -LV_nodes_visited = {} - -function get_RE_item_load (load1,max_load) -if load1==0 then load1=65535 end -local temp = 65536-load1 -temp= temp/65535*max_load -return math.floor(temp + 0.5) -end - -function set_RE_item_load (load1,max_load) -if load1 == 0 then return 65535 end -local temp=load1/max_load*65535 -temp=65536-temp -return math.floor(temp) -end - -function set_RE_wear (item_stack,load1,max_load) -local temp=65536-math.floor(load1/max_load*65535) -item_stack["wear"]=tostring(temp) -return item_stack -end - -minetest.register_abm({ - nodenames = {"technic:battery_box","technic:battery_box1","technic:battery_box2","technic:battery_box3","technic:battery_box4", - "technic:battery_box5","technic:battery_box6","technic:battery_box7","technic:battery_box8" - }, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - local meta = minetest.env:get_meta(pos) - charge= meta:get_int("battery_charge") - max_charge= 60000 - local i=math.ceil((charge/max_charge)*8) - if i>8 then i=8 end - j=meta:get_float("last_side_shown") - if i~=j then - if i>0 then hacky_swap_node(pos,"technic:battery_box"..i) - elseif i==0 then hacky_swap_node(pos,"technic:battery_box") end - meta:set_float("last_side_shown",i) - end - ---loading registered power tools - local inv = meta:get_inventory() - if inv:is_empty("src")==false then - srcstack = inv:get_stack("src", 1) - src_item=srcstack:to_table() - item_meta=srcstack:get_metadata() - if src_item["metadata"]=="" then src_item["metadata"]="0" end --create meta for not used before tool/item - - local item_max_charge = nil - local counter=registered_power_tools_count-1 - for i=1, counter,1 do - if power_tools[i].tool_name==src_item["name"] then - item_max_charge=power_tools[i].max_charge - end - end - if item_max_charge then - load1=tonumber((src_item["metadata"])) - load_step=1000 - if load10 then - if charge-load_step<0 then load_step=charge end - if load1+load_step>item_max_charge then load_step=item_max_charge-load1 end - load1=load1+load_step - charge=charge-load_step - set_RE_wear(src_item,load1,item_max_charge) - src_item["metadata"]=tostring(load1) - inv:set_stack("src", 1, src_item) - end - meta:set_int("battery_charge",charge) - end - end - --- dischargin registered power tools - if inv:is_empty("dst") == false then - srcstack = inv:get_stack("dst", 1) - src_item=srcstack:to_table() - local item_max_charge = nil - local counter=registered_power_tools_count-1 - for i=1, counter,1 do - if power_tools[i].tool_name==src_item["name"] then - item_max_charge=power_tools[i].max_charge - end - end - if item_max_charge then - if src_item["metadata"]=="" then src_item["metadata"]="0" end --create meta for not used before battery/crystal - local load1=tonumber((src_item["metadata"])) - load_step=1000 - if load1>0 and chargemax_charge then load_step=max_charge-charge end - if load1-load_step<0 then load_step=load1 end - load1=load1-load_step - charge=charge+load_step - set_RE_wear(src_item,load1,item_max_charge) - src_item["metadata"]=tostring(load1) - inv:set_stack("dst", 1, src_item) - end - end - end - - meta:set_int("battery_charge",charge) - - local load = math.floor(charge/60000 * 100) - meta:set_string("formspec", - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. - (load)..":technic_power_meter_fg.png]".. - "list[current_name;src;3,1;1,1;]".. - "image[4,1;1,1;technic_battery_reload.png]".. - "list[current_name;dst;5,1;1,1;]".. - "label[0,0;Battery box]".. - "label[3,0;Charge]".. - "label[5,0;Discharge]".. - "label[1,3;Power level]".. - "list[current_player;main;0,5;8,4;]") - - local pos1={} - - pos1.y=pos.y-1 - pos1.x=pos.x - pos1.z=pos.z - - - meta1 = minetest.env:get_meta(pos1) - if meta1:get_float("cablelike")~=1 then return end - - local LV_nodes = {} - local PR_nodes = {} - local RE_nodes = {} - - LV_nodes[1]={} - LV_nodes[1].x=pos1.x - LV_nodes[1].y=pos1.y - LV_nodes[1].z=pos1.z - LV_nodes[1].visited=false - - -table_index=1 - repeat - check_LV_node (PR_nodes,RE_nodes,LV_nodes,table_index) - table_index=table_index+1 - if LV_nodes[table_index]==nil then break end - until false - - -local pos1={} -i=1 - repeat - if PR_nodes[i]==nil then break end -- gettin power from all connected producers - pos1.x=PR_nodes[i].x - pos1.y=PR_nodes[i].y - pos1.z=PR_nodes[i].z - local meta1 = minetest.env:get_meta(pos1) - local internal_EU_buffer=meta1:get_float("internal_EU_buffer") - if charge0 then - charge=charge+charge_to_take - internal_EU_buffer=internal_EU_buffer-charge_to_take - meta1:set_float("internal_EU_buffer",internal_EU_buffer) - end - end - i=i+1 - until false - -if charge>max_charge then charge=max_charge end - -i=1 - repeat - if RE_nodes[i]==nil then break end - pos1.x=RE_nodes[i].x -- loading all conected machines buffers - pos1.y=RE_nodes[i].y - pos1.z=RE_nodes[i].z - local meta1 = minetest.env:get_meta(pos1) - local internal_EU_buffer=meta1:get_float("internal_EU_buffer") - local internal_EU_buffer_size=meta1:get_float("internal_EU_buffer_size") - - local charge_to_give=200 - if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then - charge_to_give=internal_EU_buffer_size-internal_EU_buffer - end - if charge-charge_to_give<0 then charge_to_give=charge end - - internal_EU_buffer=internal_EU_buffer+charge_to_give - meta1:set_float("internal_EU_buffer",internal_EU_buffer) - charge=charge-charge_to_give; - - i=i+1 - until false - charge=math.floor(charge) - charge_string=tostring(charge) - meta:set_string("infotext", "Battery box: "..charge_string.."/"..max_charge); - meta:set_int("battery_charge",charge) - -end -}) - -function add_new_cable_node (LV_nodes,pos1) -local i=1 - repeat - if LV_nodes[i]==nil then break end - if pos1.x==LV_nodes[i].x and pos1.y==LV_nodes[i].y and pos1.z==LV_nodes[i].z then return false end - i=i+1 - until false -LV_nodes[i]={} -LV_nodes[i].x=pos1.x -LV_nodes[i].y=pos1.y -LV_nodes[i].z=pos1.z -LV_nodes[i].visited=false -return true -end - -function check_LV_node (PR_nodes,RE_nodes,LV_nodes,i) - local pos1={} - pos1.x=LV_nodes[i].x - pos1.y=LV_nodes[i].y - pos1.z=LV_nodes[i].z - LV_nodes[i].visited=true - new_node_added=false - - pos1.x=pos1.x+1 - check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) - pos1.x=pos1.x-2 - check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) - pos1.x=pos1.x+1 - - pos1.y=pos1.y+1 - check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) - pos1.y=pos1.y-2 - check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) - pos1.y=pos1.y+1 - - pos1.z=pos1.z+1 - check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) - pos1.z=pos1.z-2 - check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) - pos1.z=pos1.z+1 -return new_node_added -end - -function check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) -meta = minetest.env:get_meta(pos1) -if meta:get_float("cablelike")==1 then new_node_added=add_new_cable_node(LV_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:solar_panel" then new_node_added=add_new_cable_node(PR_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:generator" then new_node_added=add_new_cable_node(PR_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:generator_active" then new_node_added=add_new_cable_node(PR_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:geothermal" then new_node_added=add_new_cable_node(PR_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:geothermal_active" then new_node_added=add_new_cable_node(PR_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:water_mill" then new_node_added=add_new_cable_node(PR_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:water_mill_active" then new_node_added=add_new_cable_node(PR_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:electric_furnace" then new_node_added=add_new_cable_node(RE_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:electric_furnace_active" then new_node_added=add_new_cable_node(RE_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:alloy_furnace" then new_node_added=add_new_cable_node(RE_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:alloy_furnace_active" then new_node_added=add_new_cable_node(RE_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:tool_workshop" then new_node_added=add_new_cable_node(RE_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:music_player" then new_node_added=add_new_cable_node(RE_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:grinder" then new_node_added=add_new_cable_node(RE_nodes,pos1) end -end - \ No newline at end of file diff --git a/battery_box_mv.lua b/battery_box_mv.lua deleted file mode 100644 index 6288589..0000000 --- a/battery_box_mv.lua +++ /dev/null @@ -1,321 +0,0 @@ -minetest.register_craft({ - output = 'technic:mv_battery_box 1', - recipe = { - {'technic:battery_box', 'technic:battery_box', 'technic:battery_box'}, - {'technic:battery_box', 'technic:mv_transformer', 'technic:battery_box'}, - {'', 'technic:mv_cable', ''}, - } -}) - - - -mv_battery_box_formspec = - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png]".. - "list[current_name;src;3,1;1,1;]".. - "image[4,1;1,1;technic_battery_reload.png]".. - "list[current_name;dst;5,1;1,1;]".. - "label[0,0;MV_Battery box]".. - "label[3,0;Charge]".. - "label[5,0;Discharge]".. - "label[1,3;Power level]".. - "list[current_player;main;0,5;8,4;]" - -minetest.register_node("technic:mv_battery_box", { - description = "MV Battery Box", - tiles = {"technic_mv_battery_box_top.png", "technic_mv_battery_box_bottom.png", "technic_mv_battery_box_side0.png", - "technic_mv_battery_box_side0.png", "technic_mv_battery_box_side0.png", "technic_mv_battery_box_side0.png"}, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - sounds = default.node_sound_wood_defaults(), - technic_mv_power_machine=1, - last_side_shown=0, - drop="technic:mv_battery_box", - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("infotext", "MV Battery box") - meta:set_float("technic_mv_power_machine", 1) - meta:set_string("formspec", battery_box_formspec) - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("dst", 1) - battery_charge = 0 - max_charge = 300000 - last_side_shown=0 - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - - -for i=1,8,1 do -minetest.register_node("technic:mv_battery_box"..i, { - description = "MV Battery Box", - tiles = {"technic_mv_battery_box_top.png", "technic_mv_battery_box_bottom.png", "technic_mv_battery_box_side0.png^technic_power_meter"..i..".png", - "technic_mv_battery_box_side0.png^technic_power_meter"..i..".png", "technic_mv_battery_box_side0.png^technic_power_meter"..i..".png", "technic_mv_battery_box_side0.png^technic_power_meter"..i..".png"}, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, - sounds = default.node_sound_wood_defaults(), - technic_power_machine=1, - last_side_shown=0, - drop="technic:mv_battery_box", - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("infotext", "MV Battery box") - meta:set_float("technic_mv_power_machine", 1) - meta:set_string("formspec", battery_box_formspec) - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("dst", 1) - battery_charge = 0 - max_charge = 300000 - last_side_shown=0 - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) -end - - -MV_nodes_visited = {} - - -minetest.register_abm({ - nodenames = {"technic:mv_battery_box","technic:mv_battery_box1","technic:mv_battery_box2","technic:mv_battery_box3","technic:mv_battery_box4", - "technic:mv_battery_box5","technic:mv_battery_box6","technic:mv_battery_box7","technic:mv_battery_box8" - }, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - local meta = minetest.env:get_meta(pos) - charge= meta:get_int("battery_charge") - max_charge= 300000 - local i=math.ceil((charge/max_charge)*8) - if i>8 then i=8 end - j=meta:get_float("last_side_shown") - if i~=j then - if i>0 then hacky_swap_node(pos,"technic:mv_battery_box"..i) - elseif i==0 then hacky_swap_node(pos,"technic:mv_battery_box") end - meta:set_float("last_side_shown",i) - end - ---loading registered power tools - local inv = meta:get_inventory() - if inv:is_empty("src")==false then - srcstack = inv:get_stack("src", 1) - src_item=srcstack:to_table() - item_meta=srcstack:get_metadata() - if src_item["metadata"]=="" then src_item["metadata"]="0" end --create meta for not used before tool/item - - local item_max_charge = nil - local counter=registered_power_tools_count-1 - for i=1, counter,1 do - if power_tools[i].tool_name==src_item["name"] then - item_max_charge=power_tools[i].max_charge - end - end - if item_max_charge then - load1=tonumber((src_item["metadata"])) - load_step=4000 - if load10 then - if charge-load_step<0 then load_step=charge end - if load1+load_step>item_max_charge then load_step=item_max_charge-load1 end - load1=load1+load_step - charge=charge-load_step - set_RE_wear(src_item,load1,item_max_charge) - src_item["metadata"]=tostring(load1) - inv:set_stack("src", 1, src_item) - end - meta:set_int("battery_charge",charge) - end - end - --- dischargin registered power tools - if inv:is_empty("dst") == false then - srcstack = inv:get_stack("dst", 1) - src_item=srcstack:to_table() - local item_max_charge = nil - local counter=registered_power_tools_count-1 - for i=1, counter,1 do - if power_tools[i].tool_name==src_item["name"] then - item_max_charge=power_tools[i].max_charge - end - end - if item_max_charge then - if src_item["metadata"]=="" then src_item["metadata"]="0" end --create meta for not used before battery/crystal - local load1=tonumber((src_item["metadata"])) - load_step=4000 - if load1>0 and chargemax_charge then load_step=max_charge-charge end - if load1-load_step<0 then load_step=load1 end - load1=load1-load_step - charge=charge+load_step - set_RE_wear(src_item,load1,item_max_charge) - src_item["metadata"]=tostring(load1) - inv:set_stack("dst", 1, src_item) - end - end - end - - meta:set_int("battery_charge",charge) - - local load = math.floor(charge/300000 * 100) - meta:set_string("formspec", - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. - (load)..":technic_power_meter_fg.png]".. - "list[current_name;src;3,1;1,1;]".. - "image[4,1;1,1;technic_battery_reload.png]".. - "list[current_name;dst;5,1;1,1;]".. - "label[0,0;MV Battery box]".. - "label[3,0;Charge]".. - "label[5,0;Discharge]".. - "label[1,3;Power level]".. - "list[current_player;main;0,5;8,4;]") - - local pos1={} - - pos1.y=pos.y-1 - pos1.x=pos.x - pos1.z=pos.z - - - meta1 = minetest.env:get_meta(pos1) - if meta1:get_float("mv_cablelike")~=1 then return end - - local MV_nodes = {} - local PR_nodes = {} - local RE_nodes = {} - - MV_nodes[1]={} - MV_nodes[1].x=pos1.x - MV_nodes[1].y=pos1.y - MV_nodes[1].z=pos1.z - MV_nodes[1].visited=false - -table_index=1 - repeat - check_MV_node (PR_nodes,RE_nodes,MV_nodes,table_index) - table_index=table_index+1 - if MV_nodes[table_index]==nil then break end - until false - - -local pos1={} -i=1 - repeat - if PR_nodes[i]==nil then break end -- gettin power from all connected producers - pos1.x=PR_nodes[i].x - pos1.y=PR_nodes[i].y - pos1.z=PR_nodes[i].z - local meta1 = minetest.env:get_meta(pos1) - local internal_EU_buffer=meta1:get_float("internal_EU_buffer") - if charge0 then - charge=charge+charge_to_take - internal_EU_buffer=internal_EU_buffer-charge_to_take - meta1:set_float("internal_EU_buffer",internal_EU_buffer) - end - end - i=i+1 - until false - -if charge>max_charge then charge=max_charge end - -i=1 - repeat - if RE_nodes[i]==nil then break end - pos1.x=RE_nodes[i].x -- loading all conected machines buffers - pos1.y=RE_nodes[i].y - pos1.z=RE_nodes[i].z - local meta1 = minetest.env:get_meta(pos1) - local internal_EU_buffer=meta1:get_float("internal_EU_buffer") - local internal_EU_buffer_size=meta1:get_float("internal_EU_buffer_size") - - local charge_to_give=1000 - if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then - charge_to_give=internal_EU_buffer_size-internal_EU_buffer - end - if charge-charge_to_give<0 then charge_to_give=charge end - - internal_EU_buffer=internal_EU_buffer+charge_to_give - meta1:set_float("internal_EU_buffer",internal_EU_buffer) - charge=charge-charge_to_give; - - i=i+1 - until false - charge=math.floor(charge) - charge_string=tostring(charge) - meta:set_string("infotext", "Battery box: "..charge_string.."/"..max_charge); - meta:set_int("battery_charge",charge) - -end -}) - -function add_new_MVcable_node (MV_nodes,pos1) -local i=1 - repeat - if MV_nodes[i]==nil then break end - if pos1.x==MV_nodes[i].x and pos1.y==MV_nodes[i].y and pos1.z==MV_nodes[i].z then return false end - i=i+1 - until false -MV_nodes[i]={} -MV_nodes[i].x=pos1.x -MV_nodes[i].y=pos1.y -MV_nodes[i].z=pos1.z -MV_nodes[i].visited=false -return true -end - -function check_MV_node (PR_nodes,RE_nodes,MV_nodes,i) - local pos1={} - pos1.x=MV_nodes[i].x - pos1.y=MV_nodes[i].y - pos1.z=MV_nodes[i].z - MV_nodes[i].visited=true - new_node_added=false - - pos1.x=pos1.x+1 - check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) - pos1.x=pos1.x-2 - check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) - pos1.x=pos1.x+1 - - pos1.y=pos1.y+1 - check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) - pos1.y=pos1.y-2 - check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) - pos1.y=pos1.y+1 - - pos1.z=pos1.z+1 - check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) - pos1.z=pos1.z-2 - check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) - pos1.z=pos1.z+1 -return new_node_added -end - -function check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) -meta = minetest.env:get_meta(pos1) -if meta:get_float("mv_cablelike")==1 then new_node_added=add_new_MVcable_node(MV_nodes,pos1) end -if minetest.env:get_node(pos1).name == "technic:solar_panel_mv" then new_node_added=add_new_MVcable_node(PR_nodes,pos1) end -end - \ No newline at end of file diff --git a/cans.lua b/cans.lua deleted file mode 100644 index 2809498..0000000 --- a/cans.lua +++ /dev/null @@ -1,125 +0,0 @@ -water_can_max_load = 16 -lava_can_max_load = 8 - -minetest.register_craft({ - output = 'technic:water_can 1', - recipe = { - {'technic:zinc_ingot', 'technic:rubber','technic:zinc_ingot'}, - {'default:steel_ingot', '', 'default:steel_ingot'}, - {'technic:zinc_ingot', 'default:steel_ingot', 'technic:zinc_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:lava_can 1', - recipe = { - {'technic:zinc_ingot', 'technic:stainless_steel_ingot','technic:zinc_ingot'}, - {'technic:stainless_steel_ingot', '', 'technic:stainless_steel_ingot'}, - {'technic:zinc_ingot', 'technic:stainless_steel_ingot', 'technic:zinc_ingot'}, - } -}) - - -minetest.register_tool("technic:water_can", { - description = "Water Can", - inventory_image = "technic_water_can.png", - stack_max = 1, - liquids_pointable = true, - on_use = function(itemstack, user, pointed_thing) - - if pointed_thing.type ~= "node" then - return end - - n = minetest.env:get_node(pointed_thing.under) - if n.name == "default:water_source" then - item=itemstack:to_table() - local load=tonumber((item["wear"])) - if load==0 then load =65535 end - load=get_RE_item_load(load,water_can_max_load) - if load+1<17 then - minetest.env:add_node(pointed_thing.under, {name="air"}) - load=load+1; - load=set_RE_item_load(load,water_can_max_load) - item["wear"]=tostring(load) - itemstack:replace(item) - end - return itemstack - end - item=itemstack:to_table() - load=tonumber((item["wear"])) - if load==0 then load =65535 end - load=get_RE_item_load(load,water_can_max_load) - if load==0 then return end - - if n.name == "default:water_flowing" then - minetest.env:add_node(pointed_thing.under, {name="default:water_source"}) - load=load-1; - load=set_RE_item_load(load,water_can_max_load) - item["wear"]=tostring(load) - itemstack:replace(item) - return itemstack - end - - n = minetest.env:get_node(pointed_thing.above) - if n.name == "air" then - minetest.env:add_node(pointed_thing.above, {name="default:water_source"}) - load=load-1; - load=set_RE_item_load(load,water_can_max_load) - item["wear"]=tostring(load) - itemstack:replace(item) - return itemstack - end - end, -}) - -minetest.register_tool("technic:lava_can", { - description = "Lava Can", - inventory_image = "technic_lava_can.png", - stack_max = 1, - liquids_pointable = true, - on_use = function(itemstack, user, pointed_thing) - - if pointed_thing.type ~= "node" then - return end - - n = minetest.env:get_node(pointed_thing.under) - if n.name == "default:lava_source" then - item=itemstack:to_table() - local load=tonumber((item["wear"])) - if load==0 then load =65535 end - load=get_RE_item_load(load,lava_can_max_load) - if load+1<9 then - minetest.env:add_node(pointed_thing.under, {name="air"}) - load=load+1; - load=set_RE_item_load(load,lava_can_max_load) - item["wear"]=tostring(load) - itemstack:replace(item) - end - return itemstack - end - item=itemstack:to_table() - load=tonumber((item["wear"])) - if load==0 then load =65535 end - load=get_RE_item_load(load,lava_can_max_load) - if load==0 then return end - - if n.name == "default:lava_flowing" then - minetest.env:add_node(pointed_thing.under, {name="default:lava_source"}) - load=load-1; - load=set_RE_item_load(load,lava_can_max_load) - item["wear"]=tostring(load) - itemstack:replace(item) - return itemstack - end - - n = minetest.env:get_node(pointed_thing.above) - if n.name == "air" then - minetest.env:add_node(pointed_thing.above, {name="default:lava_source"}) - load=load-1; - load=set_RE_item_load(load,lava_can_max_load) - item["wear"]=tostring(load) - itemstack:replace(item) - return itemstack - end - end, -}) diff --git a/chainsaw.lua b/chainsaw.lua deleted file mode 100644 index 9f69fd9..0000000 --- a/chainsaw.lua +++ /dev/null @@ -1,59 +0,0 @@ -chainsaw_max_charge=30000 - -minetest.register_tool("technic:chainsaw", { - description = "Chainsaw", - inventory_image = "technic_chainsaw.png", - stack_max = 1, - on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type=="node" then - item=itemstack:to_table() - if item["metadata"]=="" or item["metadata"]=="0" then return end --tool not charged - charge=tonumber(item["metadata"]) - charge_to_take=600; - if charge-charge_to_take>0 then - charge_to_take=chainsaw_dig_it(minetest.get_pointed_thing_position(pointed_thing, above),user,charge_to_take) - charge=charge-charge_to_take; - set_RE_wear(item,charge,chainsaw_max_charge) - item["metadata"]=tostring(charge) - itemstack:replace(item) - return itemstack - end - end - end, -}) - -minetest.register_craft({ - output = 'technic:chainsaw', - recipe = { - {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:battery'}, - {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:battery'}, - {'','','moreores:copper_ingot'}, - } -}) - - - - -timber_nodenames={"default:jungletree", "default:papyrus", "default:cactus", "default:tree"} - -function chainsaw_dig_it (pos, player,charge_to_take) - charge_to_take=0 - local node=minetest.env:get_node(pos) - local i=1 - while timber_nodenames[i]~=nil do - if node.name==timber_nodenames[i] then - charge_to_take=600 - np={x=pos.x, y=pos.y, z=pos.z} - while minetest.env:get_node(np).name==timber_nodenames[i] do - minetest.env:remove_node(np) - minetest.env:add_item(np, timber_nodenames[i]) - np={x=np.x, y=np.y+1, z=np.z} - end - minetest.sound_play("chainsaw", {pos = pos, gain = 1.0, max_hear_distance = 10,}) - return charge_to_take - end - i=i+1 - end - -return charge_to_take -end \ No newline at end of file diff --git a/coal_furnace.lua b/coal_furnace.lua deleted file mode 100644 index 9727795..0000000 --- a/coal_furnace.lua +++ /dev/null @@ -1,171 +0,0 @@ -minetest.register_alias("coal_furnace", "technic:coal_furnace") - -minetest.register_craft({ - output = 'technic:coal_furnace', - recipe = { - {'default:stone', 'default:stone', 'default:stone'}, - {'default:stone', '', 'default:stone'}, - {'default:stone', 'default:stone', 'default:stone'}, - } -}) - - -coal_furnace_formspec = - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png]".. - "list[current_name;src;3,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]".. - "label[0,0;Coal Furnace]") - -minetest.register_node("technic:coal_furnace", { - description = "Coal furnace", - tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png", - "technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front.png"}, - paramtype2 = "facedir", - groups = {cracky=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), - technic_power_machine=1, - internal_EU_buffer=0; - interal_EU_buffer_size=2000; - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("formspec", coal_furnace_formspec) - meta:set_string("infotext", "Coal furnace") - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("dst", 4) - local EU_used = 0 - local furnace_is_cookin = 0 - local cooked = nil - meta:set_float("internal_EU_buffer",0) - meta:set_float("internal_EU_buffer_size",2000) - - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - -minetest.register_node("technic:coal_furnace_active", { - description = "Coal Furnace", - tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png", - "technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front_active.png"}, - paramtype2 = "facedir", - light_source = 8, - drop = "technic:coal_furnace", - groups = {cracky=2, not_in_creative_inventory=1}, - legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), - internal_EU_buffer=0; - interal_EU_buffer_size=2000; - technic_power_machine=1, - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("formspec", electric_furnace_formspec) - meta:set_string("infotext", "Coal furnace"); - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("dst", 4) - local EU_used = 0 - local furnace_is_cookin = 0 - local cooked = nil - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - -minetest.register_abm({ - nodenames = {"technic:coal_furnace","technic:coal_furnace_active"}, - interval = 1, - chance = 1, - - action = function(pos, node, active_object_count, active_object_count_wider) - - local meta = minetest.env:get_meta(pos) - internal_EU_buffer=meta:get_float("internal_EU_buffer") - internal_EU_buffer_size=meta:get_float("internal_EU_buffer") - local load = math.floor(internal_EU_buffer/2000 * 100) - meta:set_string("formspec", - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. - (load)..":technic_power_meter_fg.png]".. - "list[current_name;src;3,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]".. - "label[0,0;Electric Furnace]") - - local inv = meta:get_inventory() - - local furnace_is_cookin = meta:get_float("furnace_is_cookin") - - - local srclist = inv:get_list("src") - local cooked=nil - - if srclist then - cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) - end - - - if (furnace_is_cookin == 1) then - if internal_EU_buffer>=150 then - internal_EU_buffer=internal_EU_buffer-150; - meta:set_float("internal_EU_buffer",internal_EU_buffer) - meta:set_float("src_time", meta:get_float("src_time") + 3) - if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then - -- check if there's room for output in "dst" list - if inv:room_for_item("dst",cooked.item) then - -- Put result in "dst" list - inv:add_item("dst", cooked.item) - -- take stuff from "src" list - srcstack = inv:get_stack("src", 1) - srcstack:take_item() - inv:set_stack("src", 1, srcstack) - else - print("Furnace inventory full!") - end - meta:set_string("src_time", 0) - end - end - end - - - - - if srclist then - cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) - if cooked.time>0 then - hacky_swap_node(pos,"technic:coal_furnace_active") - meta:set_string("infotext","Furnace active") - meta:set_string("furnace_is_cookin",1) - meta:set_string("src_time", 0) - return - end - - end - - hacky_swap_node(pos,"technic:coal_furnace") - meta:set_string("infotext","Furnace inactive") - meta:set_string("furnace_is_cookin",0) - meta:set_string("src_time", 0) - - -end, -}) \ No newline at end of file diff --git a/concrete.lua b/concrete.lua deleted file mode 100644 index 0a480a0..0000000 --- a/concrete.lua +++ /dev/null @@ -1,74 +0,0 @@ - -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 4', - recipe = { - {'default:stone','technic:rebar','default:stone'}, - {'default:stone','technic:rebar','default:stone'}, - {'default:stone','technic:rebar','default:stone'}, -} -}) - -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", - inventory_image = "technic_concrete_post.png", - stack_max = 99, -}) - - - --- NODES: - -minetest.register_node("technic:concrete", { - description = "Concrete Block", - tile_images = {"technic_concrete_block.png",}, - is_ground_content = true, - groups = {cracky=1}, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_node("technic:concrete_post", { - description = "Concrete Post", - drawtype = "fencelike", - tiles = {"technic_concrete_block.png"}, - inventory_image = "default_fence.png", - wield_image = "default_fence.png", - paramtype = "light", - is_ground_content = true, - selection_box = { - type = "fixed", - fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, - }, - - groups = {cracky=1}, - sounds = default.node_sound_stone_defaults(), -}) \ No newline at end of file diff --git a/config.lua b/config.lua deleted file mode 100644 index 88662d3..0000000 --- a/config.lua +++ /dev/null @@ -1,3 +0,0 @@ --- Please note that item_drop module already contains item_pickup -enable_item_drop=false -enable_item_pickup=true diff --git a/constructor.lua b/constructor.lua deleted file mode 100644 index 1e58408..0000000 --- a/constructor.lua +++ /dev/null @@ -1,297 +0,0 @@ - -minetest.register_craft({ - type = "shapeless", - output = 'technic:constructor_mk1_off 1', - recipe = {'technic:nodebreaker_off', 'technic:deployer_off'}, - -}) -minetest.register_craft({ - type = "shapeless", - output = 'technic:constructor_mk2_off 1', - recipe = {'technic:constructor_mk1_off', 'technic:constructor_mk1_off'}, - -}) - -minetest.register_craft({ - type = "shapeless", - output = 'technic:constructor_mk3_off 1', - recipe = {'technic:constructor_mk2_off', 'technic:constructor_mk2_off'}, - -}) - -minetest.register_node("technic:constructor_mk1_off", { - description = "Constructor MK1", - tile_images = {"technic_constructor_mk1_top_off.png","technic_constructor_mk1_bottom_off.png","technic_constructor_mk1_side2_off.png","technic_constructor_mk1_side1_off.png", - "technic_constructor_back.png","technic_constructor_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}, - 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;Constructor MK1]".. - "label[5,0;Slot 1]".. - "list[current_name;slot1;6,0;1,1;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Constructor MK1") - local inv = meta:get_inventory() - inv:set_size("slot1", 1) - end, - - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos) - local inv = meta:get_inventory() - return inv:is_empty("slot1") - end, -}) - -minetest.register_node("technic:constructor_mk1_on", { - description = "Constructor MK1", - tile_images = {"technic_constructor_mk1_top_on.png","technic_constructor_mk1_bottom_on.png","technic_constructor_mk1_side2_on.png","technic_constructor_mk1_side1_on.png", - "technic_constructor_back.png","technic_constructor_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,not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), -}) - -mesecon:register_on_signal_on(function(pos, node) - local meta = minetest.env:get_meta(pos) - local inv = meta:get_inventory() - 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:constructor_mk1_off" then - hacky_swap_node(pos,"technic:constructor_mk1_on") - nodeupdate(pos) - local node1=minetest.env:get_node(pos1) - deploy_node (inv,"slot1",pos1,node1,node) - end - -end) - -mesecon:register_on_signal_off(function(pos, node) - if node.name == "technic:constructor_mk1_on" then - hacky_swap_node(pos,"technic:constructor_mk1_off") - nodeupdate(pos) - end -end) - -mesecon:register_effector("technic:constructor_mk1_on", "technic:constructor_mk1_off") - -minetest.register_node("technic:constructor_mk2_off", { - description = "Constructor MK2", - tile_images = {"technic_constructor_mk2_top_off.png","technic_constructor_mk2_bottom_off.png","technic_constructor_mk2_side2_off.png","technic_constructor_mk2_side1_off.png", - "technic_constructor_back.png","technic_constructor_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}, - 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;Constructor MK2]".. - "label[5,0;Slot 1]".. - "list[current_name;slot1;6,0;1,1;]".. - "label[5,1;Slot 2]".. - "list[current_name;slot2;6,1;1,1;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Constructor MK2") - local inv = meta:get_inventory() - inv:set_size("slot1", 1) - inv:set_size("slot2", 1) - end, - - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos) - local inv = meta:get_inventory() - if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false then return false end - return true - end, -}) - -minetest.register_node("technic:constructor_mk2_on", { - description = "Constructor MK2", - tile_images = {"technic_constructor_mk2_top_on.png","technic_constructor_mk2_bottom_on.png","technic_constructor_mk2_side2_on.png","technic_constructor_mk2_side1_on.png", - "technic_constructor_back.png","technic_constructor_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,not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), -}) - -mesecon:register_on_signal_on(function(pos, node) - local meta = minetest.env:get_meta(pos) - local inv = meta:get_inventory() - local pos1={} - local pos2={} - pos1.x=pos.x - pos1.y=pos.y - pos1.z=pos.z - pos2.x=pos.x - pos2.y=pos.y - pos2.z=pos.z - if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 end - if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 end - if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 end - if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 end - - if node.name == "technic:constructor_mk2_off" then - hacky_swap_node(pos,"technic:constructor_mk2_on") - nodeupdate(pos) - local node1=minetest.env:get_node(pos1) - deploy_node (inv,"slot1",pos1,node1,node) - local node1=minetest.env:get_node(pos2) - deploy_node (inv,"slot2",pos2,node1,node) - end - -end) - - -mesecon:register_on_signal_off(function(pos, node) - if node.name == "technic:constructor_mk2_on" then - hacky_swap_node(pos,"technic:constructor_mk2_off") - nodeupdate(pos) - end -end) - -mesecon:register_effector("technic:constructor_mk2_on", "technic:constructor_mk2_off") - -minetest.register_node("technic:constructor_mk3_off", { - description = "Constructor MK3", - tile_images = {"technic_constructor_mk3_top_off.png","technic_constructor_mk3_bottom_off.png","technic_constructor_mk3_side2_off.png","technic_constructor_mk3_side1_off.png", - "technic_constructor_back.png","technic_constructor_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}, - 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;Constructor MK2]".. - "label[5,0;Slot 1]".. - "list[current_name;slot1;6,0;1,1;]".. - "label[5,1;Slot 2]".. - "list[current_name;slot2;6,1;1,1;]".. - "label[5,2;Slot 3]".. - "list[current_name;slot3;6,2;1,1;]".. - "label[5,3;Slot 4]".. - "list[current_name;slot4;6,3;1,1;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Constructor MK3") - local inv = meta:get_inventory() - inv:set_size("slot1", 1) - inv:set_size("slot2", 1) - inv:set_size("slot3", 1) - inv:set_size("slot4", 1) - - end, - - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos) - local inv = meta:get_inventory() - if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false or inv:is_empty("slot3")==false or inv:is_empty("slot4")==false then return false end - return true - end, -}) - -minetest.register_node("technic:constructor_mk3_on", { - description = "Constructor MK3", - tile_images = {"technic_constructor_mk3_top_on.png","technic_constructor_mk3_bottom_on.png","technic_constructor_mk3_side2_on.png","technic_constructor_mk3_side1_on.png", - "technic_constructor_back.png","technic_constructor_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,not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), -}) - -mesecon:register_on_signal_on(function(pos, node) - local meta = minetest.env:get_meta(pos) - local inv = meta:get_inventory() - - local pos1={} - local pos2={} - local pos3={} - local pos4={} - - pos1.x=pos.x - pos1.y=pos.y - pos1.z=pos.z - - pos2.x=pos.x - pos2.y=pos.y - pos2.z=pos.z - - pos3.x=pos.x - pos3.y=pos.y - pos3.z=pos.z - - pos4.x=pos.x - pos4.y=pos.y - pos4.z=pos.z - - if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 pos3.x=pos3.x+3 pos4.x=pos4.x+4 end - if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 pos3.z=pos3.z+3 pos4.z=pos4.z+4 end - if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 pos3.x=pos3.x-3 pos4.x=pos4.x-4 end - if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 pos3.z=pos3.z-3 pos4.z=pos4.z-4 end - - if node.name == "technic:constructor_mk3_off" then - hacky_swap_node(pos,"technic:constructor_mk3_on") - nodeupdate(pos) - local node1=minetest.env:get_node(pos1) - deploy_node (inv,"slot1",pos1,node1,node) - local node1=minetest.env:get_node(pos2) - deploy_node (inv,"slot2",pos2,node1,node) - local node1=minetest.env:get_node(pos3) - deploy_node (inv,"slot3",pos3,node1,node) - local node1=minetest.env:get_node(pos4) - deploy_node (inv,"slot4",pos4,node1,node) - end - -end) - - -mesecon:register_on_signal_off(function(pos, node) - if node.name == "technic:constructor_mk3_on" then - hacky_swap_node(pos,"technic:constructor_mk3_off") - nodeupdate(pos) - end -end) - -mesecon:register_effector("technic:constructor_mk3_on", "technic:constructor_mk3_off") - - -deploy_node =function (inv, slot_name, pos1, node1, node) -if node1.name == "air" then - if not inv:is_empty(slot_name) then - stack1=inv:get_list(slot_name) - node_to_be_placed={name=stack1[1]:get_name(), param1=0, param2=node.param2} - minetest.env:set_node(pos1,node_to_be_placed) - stack1[1]:take_item() - inv:set_stack(slot_name, 1, stack1[1]) - return - end - return - end - if node1.name == "ignore" or - node1.name == "default:lava_source" or - node1.name == "default:lava_flowing" or - node1.name == "default:water_source" or - node1.name == "default:water_flowing" - then return end - if inv:room_for_item(slot_name,node1) then - inv:add_item(slot_name,node1) - minetest.env:remove_node(pos1) - end - -end \ No newline at end of file diff --git a/copper_chest.lua b/copper_chest.lua deleted file mode 100644 index cf1ae06..0000000 --- a/copper_chest.lua +++ /dev/null @@ -1,162 +0,0 @@ -minetest.register_craft({ - output = 'technic:copper_chest 1', - recipe = { - {'moreores:copper_ingot','moreores:copper_ingot','moreores:copper_ingot'}, - {'moreores:copper_ingot','technic:iron_chest','moreores:copper_ingot'}, - {'moreores:copper_ingot','moreores:copper_ingot','moreores:copper_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:copper_locked_chest 1', - recipe = { - {'moreores:copper_ingot','moreores:copper_ingot','moreores:copper_ingot'}, - {'moreores:copper_ingot','technic:iron_locked_chest','moreores:copper_ingot'}, - {'moreores:copper_ingot','moreores:copper_ingot','moreores:copper_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:copper_locked_chest 1', - recipe = { - {'default:steel_ingot'}, - {'technic:copper_chest'}, - } -}) - -minetest.register_craftitem("technic:copper_chest", { - description = "Copper Chest", - stack_max = 99, -}) -minetest.register_craftitem("technic:copper_locked_chest", { - description = "Copper Locked Chest", - stack_max = 99, -}) - -minetest.register_node("technic:copper_chest", { - description = "Copper Chest", - tiles = {"technic_copper_chest_top.png", "technic_copper_chest_top.png", "technic_copper_chest_side.png", - "technic_copper_chest_side.png", "technic_copper_chest_side.png", "technic_copper_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[10,9;]".. - "list[current_name;main;0,0;10,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Copper Chest") - local inv = meta:get_inventory() - inv:set_size("main", 10*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_metadata_inventory_move = function(pos, from_list, from_index, - to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in chest at "..minetest.pos_to_string(pos)) - return minetest.node_metadata_inventory_move_allow_all( - pos, from_list, from_index, to_list, to_index, count, player) - end, - on_metadata_inventory_offer = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to chest at "..minetest.pos_to_string(pos)) - return minetest.node_metadata_inventory_offer_allow_all( - pos, listname, index, stack, player) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from chest at "..minetest.pos_to_string(pos)) - end, -}) - - -local function has_locked_chest_privilege(meta, player) - if player:get_player_name() ~= meta:get_string("owner") then - return false - end - return true -end - -minetest.register_node("technic:copper_locked_chest", { - description = "Copper Locked Chest", - tiles = {"technic_copper_chest_top.png", "technic_copper_chest_top.png", "technic_copper_chest_side.png", - "technic_copper_chest_side.png", "technic_copper_chest_side.png", "technic_copper_chest_locked.png"}, - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - after_place_node = function(pos, placer) - local meta = minetest.env:get_meta(pos) - meta:set_string("owner", placer:get_player_name() or "") - meta:set_string("infotext", "Copper Locked Chest (owned by ".. - meta:get_string("owner")..")") - end, -on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("formspec", - "invsize[10,9;]".. - "list[current_name;main;0,0;10,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Copper Locked Chest") - meta:set_string("owner", "") - local inv = meta:get_inventory() - inv:set_size("main", 10*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, - allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return count - end, - allow_metadata_inventory_put = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return stack:get_count() - end, - allow_metadata_inventory_take = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return stack:get_count() - end, - on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from locked chest at "..minetest.pos_to_string(pos)) - end, -}) diff --git a/depends.txt b/depends.txt deleted file mode 100644 index bfbfdf1..0000000 --- a/depends.txt +++ /dev/null @@ -1,5 +0,0 @@ -moreores -flowers -pipeworks -mesecons -farming diff --git a/deployer.lua b/deployer.lua deleted file mode 100644 index ce3b735..0000000 --- a/deployer.lua +++ /dev/null @@ -1,91 +0,0 @@ -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") - - diff --git a/electric.lua b/electric.lua deleted file mode 100644 index 2eb2bf3..0000000 --- a/electric.lua +++ /dev/null @@ -1,268 +0,0 @@ -power_tools ={} - -registered_power_tools_count=1 - -function register_power_tool (string1,max_charge) -power_tools[registered_power_tools_count]={} -power_tools[registered_power_tools_count].tool_name=string1 -power_tools[registered_power_tools_count].max_charge=max_charge -registered_power_tools_count=registered_power_tools_count+1 -end - -register_power_tool ("technic:mining_drill",60000) -register_power_tool ("technic:laser_mk1",40000) -register_power_tool ("technic:battery",10000) - -minetest.register_alias("battery", "technic:battery") -minetest.register_alias("battery_box", "technic:battery_box") -minetest.register_alias("electric_furnace", "technic:electric_furnace") - - -minetest.register_craft({ - output = 'technic:battery 1', - recipe = { - {'default:wood', 'moreores:copper_ingot', 'default:wood'}, - {'default:wood', 'moreores:tin_ingot', 'default:wood'}, - {'default:wood', 'moreores:copper_ingot', 'default:wood'}, - } -}) - -minetest.register_craft({ - output = 'technic:battery_box 1', - recipe = { - {'technic:battery', 'default:wood', 'technic:battery'}, - {'technic:battery', 'moreores:copper_ingot', 'technic:battery'}, - {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:electric_furnace', - recipe = { - {'default:brick', 'default:brick', 'default:brick'}, - {'default:brick', '', 'default:brick'}, - {'default:steel_ingot', 'moreores:copper_ingot', 'default:steel_ingot'}, - } -}) - - -minetest.register_tool("technic:battery", -{description = "RE Battery", -inventory_image = "technic_battery.png", -energy_charge = 0, -tool_capabilities = {max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}}) - -minetest.register_craftitem("technic:battery_box", { - description = "Battery box", - stack_max = 99, -}) - - - -battery_box_formspec = - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png]".. - "list[current_name;src;3,1;1,1;]".. - "image[4,1;1,1;technic_battery_reload.png]".. - "list[current_name;dst;5,1;1,1;]".. - "label[0,0;Battery box]".. - "label[3,0;Charge]".. - "label[5,0;Discharge]".. - "label[1,3;Power level]".. - "list[current_player;main;0,5;8,4;]" - -minetest.register_node("technic:battery_box", { - description = "Battery box", - tiles = {"technic_battery_box_top.png", "technic_battery_box_bottom.png", "technic_battery_box_side.png", - "technic_battery_box_side.png", "technic_battery_box_side.png", "technic_battery_box_side.png"}, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - sounds = default.node_sound_wood_defaults(), - technic_power_machine=1, - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("infotext", "Battery box") - meta:set_float("technic_power_machine", 1) - meta:set_string("formspec", battery_box_formspec) - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("dst", 1) - battery_charge = 0 - max_charge = 60000 - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - -electric_furnace_formspec = - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png]".. - "list[current_name;src;3,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]".. - "label[0,0;Electric Furnace]".. - "label[1,3;Power level]" - -minetest.register_node("technic:electric_furnace", { - description = "Electric furnace", - tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png", - "technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front.png"}, - paramtype2 = "facedir", - groups = {cracky=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), - technic_power_machine=1, - internal_EU_buffer=0; - interal_EU_buffer_size=2000; - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_float("technic_power_machine", 1) - meta:set_string("formspec", electric_furnace_formspec) - meta:set_string("infotext", "Electric furnace") - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("dst", 4) - local EU_used = 0 - local furnace_is_cookin = 0 - local cooked = nil - meta:set_float("internal_EU_buffer",0) - meta:set_float("internal_EU_buffer_size",2000) - - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - -minetest.register_node("technic:electric_furnace_active", { - description = "Electric Furnace", - tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png", - "technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front_active.png"}, - paramtype2 = "facedir", - light_source = 8, - drop = "technic:electric_furnace", - groups = {cracky=2, not_in_creative_inventory=1}, - legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), - internal_EU_buffer=0; - interal_EU_buffer_size=2000; - technic_power_machine=1, - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_float("technic_power_machine", 1) - meta:set_string("formspec", electric_furnace_formspec) - meta:set_string("infotext", "Electric furnace"); - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("dst", 4) - local EU_used = 0 - local furnace_is_cookin = 0 - local cooked = nil - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - -minetest.register_abm({ - nodenames = {"technic:electric_furnace","technic:electric_furnace_active"}, - interval = 1, - chance = 1, - - action = function(pos, node, active_object_count, active_object_count_wider) - - local meta = minetest.env:get_meta(pos) - internal_EU_buffer=meta:get_float("internal_EU_buffer") - internal_EU_buffer_size=meta:get_float("internal_EU_buffer") - local load = math.floor(internal_EU_buffer/2000 * 100) - meta:set_string("formspec", - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. - (load)..":technic_power_meter_fg.png]".. - "list[current_name;src;3,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]".. - "label[0,0;Electric Furnace]".. - "label[1,3;Power level]") - - local inv = meta:get_inventory() - - local furnace_is_cookin = meta:get_float("furnace_is_cookin") - - - local srclist = inv:get_list("src") - local cooked=nil - - if srclist then - cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) - end - - - if (furnace_is_cookin == 1) then - if internal_EU_buffer>=150 then - internal_EU_buffer=internal_EU_buffer-150; - meta:set_float("internal_EU_buffer",internal_EU_buffer) - meta:set_float("src_time", meta:get_float("src_time") + 3) - if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then - -- check if there's room for output in "dst" list - if inv:room_for_item("dst",cooked.item) then - -- Put result in "dst" list - inv:add_item("dst", cooked.item) - -- take stuff from "src" list - srcstack = inv:get_stack("src", 1) - srcstack:take_item() - inv:set_stack("src", 1, srcstack) - else - print("Furnace inventory full!") - end - meta:set_string("src_time", 0) - end - end - end - - - - - if srclist then - cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) - if cooked.time>0 then - hacky_swap_node(pos,"technic:electric_furnace_active") - meta:set_string("infotext","Furnace active") - meta:set_string("furnace_is_cookin",1) - -- meta:set_string("formspec", electric_furnace_formspec) - meta:set_string("src_time", 0) - return - end - - end - - hacky_swap_node(pos,"technic:electric_furnace") - meta:set_string("infotext","Furnace inactive") - meta:set_string("furnace_is_cookin",0) - -- meta:set_string("formspec", electric_furnace_formspec) - meta:set_string("src_time", 0) - - -end, -}) \ No newline at end of file diff --git a/electric_furnace.lua b/electric_furnace.lua deleted file mode 100644 index 6563efb..0000000 --- a/electric_furnace.lua +++ /dev/null @@ -1,177 +0,0 @@ -minetest.register_alias("electric_furnace", "technic:electric_furnace") - -minetest.register_craft({ - output = 'technic:electric_furnace', - recipe = { - {'default:cobble', 'default:cobble', 'default:cobble'}, - {'default:cobble', '', 'default:cobble'}, - {'default:steel_ingot', 'moreores:copper_ingot', 'default:steel_ingot'}, - } -}) - - -electric_furnace_formspec = - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png]".. - "list[current_name;src;3,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]".. - "label[0,0;Electric Furnace]".. - "label[1,3;Power level]" - -minetest.register_node("technic:electric_furnace", { - description = "Electric furnace", - tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png", - "technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front.png"}, - paramtype2 = "facedir", - groups = {cracky=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), - technic_power_machine=1, - internal_EU_buffer=0; - interal_EU_buffer_size=2000; - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_float("technic_power_machine", 1) - meta:set_string("formspec", electric_furnace_formspec) - meta:set_string("infotext", "Electric furnace") - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("dst", 4) - local EU_used = 0 - local furnace_is_cookin = 0 - local cooked = nil - meta:set_float("internal_EU_buffer",0) - meta:set_float("internal_EU_buffer_size",2000) - - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - -minetest.register_node("technic:electric_furnace_active", { - description = "Electric Furnace", - tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png", - "technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front_active.png"}, - paramtype2 = "facedir", - light_source = 8, - drop = "technic:electric_furnace", - groups = {cracky=2, not_in_creative_inventory=1}, - legacy_facedir_simple = true, - sounds = default.node_sound_stone_defaults(), - internal_EU_buffer=0; - interal_EU_buffer_size=2000; - technic_power_machine=1, - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_float("technic_power_machine", 1) - meta:set_string("formspec", electric_furnace_formspec) - meta:set_string("infotext", "Electric furnace"); - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("dst", 4) - local EU_used = 0 - local furnace_is_cookin = 0 - local cooked = nil - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("dst") then - return false - elseif not inv:is_empty("src") then - return false - end - return true - end, -}) - -minetest.register_abm({ - nodenames = {"technic:electric_furnace","technic:electric_furnace_active"}, - interval = 1, - chance = 1, - - action = function(pos, node, active_object_count, active_object_count_wider) - - local meta = minetest.env:get_meta(pos) - internal_EU_buffer=meta:get_float("internal_EU_buffer") - internal_EU_buffer_size=meta:get_float("internal_EU_buffer") - local load = math.floor(internal_EU_buffer/2000 * 100) - meta:set_string("formspec", - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. - (load)..":technic_power_meter_fg.png]".. - "list[current_name;src;3,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]".. - "label[0,0;Electric Furnace]".. - "label[1,3;Power level]") - - local inv = meta:get_inventory() - - local furnace_is_cookin = meta:get_float("furnace_is_cookin") - - - local srclist = inv:get_list("src") - local cooked=nil - - if srclist then - cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) - end - - - if (furnace_is_cookin == 1) then - if internal_EU_buffer>=150 then - internal_EU_buffer=internal_EU_buffer-150; - meta:set_float("internal_EU_buffer",internal_EU_buffer) - meta:set_float("src_time", meta:get_float("src_time") + 3) - if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then - -- check if there's room for output in "dst" list - if inv:room_for_item("dst",cooked.item) then - -- Put result in "dst" list - inv:add_item("dst", cooked.item) - -- take stuff from "src" list - srcstack = inv:get_stack("src", 1) - srcstack:take_item() - inv:set_stack("src", 1, srcstack) - else - print("Furnace inventory full!") - end - meta:set_string("src_time", 0) - end - end - end - - - - - if srclist then - cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) - if cooked.time>0 then - hacky_swap_node(pos,"technic:electric_furnace_active") - meta:set_string("infotext","Furnace active") - meta:set_string("furnace_is_cookin",1) - -- meta:set_string("formspec", electric_furnace_formspec) - meta:set_string("src_time", 0) - return - end - - end - - hacky_swap_node(pos,"technic:electric_furnace") - meta:set_string("infotext","Furnace inactive") - meta:set_string("furnace_is_cookin",0) - -- meta:set_string("formspec", electric_furnace_formspec) - meta:set_string("src_time", 0) - - -end, -}) diff --git a/flashlight.lua b/flashlight.lua deleted file mode 100644 index c9901d1..0000000 --- a/flashlight.lua +++ /dev/null @@ -1,167 +0,0 @@ --- original code comes from walkin_light mod by Echo http://minetest.net/forum/viewtopic.php?id=2621 - -flashlight_max_charge=30000 - - minetest.register_tool("technic:flashlight", { - description = "Flashlight", - inventory_image = "technic_flashlight.png", - stack_max = 1, - on_use = function(itemstack, user, pointed_thing) - end, - }) - - minetest.register_craft({ - output = "technic:flashlight", - recipe = { - {"glass","glass","glass"}, - {"technic:stainless_steel_ingot","technic:battery","technic:stainless_steel_ingot"}, - {"","technic:battery",""} - } - }) -local players = {} -local player_positions = {} -local last_wielded = {} - -function round(num) - return math.floor(num + 0.5) -end - -minetest.register_on_joinplayer(function(player) - local player_name = player:get_player_name() - table.insert(players, player_name) - local pos = player:getpos() - local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)} - player_positions[player_name] = {} - player_positions[player_name]["x"] = rounded_pos.x; - player_positions[player_name]["y"] = rounded_pos.y; - player_positions[player_name]["z"] = rounded_pos.z; -end) - -minetest.register_on_leaveplayer(function(player) - local player_name = player:get_player_name() - for i,v in ipairs(players) do - if v == player_name then - table.remove(players, i) - last_wielded[player_name] = nil - -- Neuberechnung des Lichts erzwingen - local pos = player:getpos() - local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)} - minetest.env:add_node(rounded_pos,{type="node",name="technic:light_off"}) - minetest.env:add_node(rounded_pos,{type="node",name="air"}) - player_positions[player_name]["x"] = nil - player_positions[player_name]["y"] = nil - player_positions[player_name]["z"] = nil - player_positions[player_name]["m"] = nil - player_positions[player_name] = nil - end - end -end) - -minetest.register_globalstep(function(dtime) - for i,player_name in ipairs(players) do - local player = minetest.env:get_player_by_name(player_name) - flashlight_weared=check_for_flashlight(player) - local pos = player:getpos() - local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)} - local old_pos = {x=player_positions[player_name]["x"], y=player_positions[player_name]["y"], z=player_positions[player_name]["z"]} - - if last_wielded[player_name] and not flashlight_weared then --remove light, flashlight weared out or was removed from hotbar - local node=minetest.env:get_node_or_nil(old_pos) - if node then - if node.name=="technic:light" then - minetest.env:add_node(old_pos,{type="node",name="technic:light_off"}) - minetest.env:add_node(old_pos,{type="node",name="air"}) - last_wielded[player_name]=false - end - end - end - - player_moved=not(old_pos.x==rounded_pos.x and old_pos.y==rounded_pos.y and old_pos.z==rounded_pos.z) - if player_moved and last_wielded[player_name] and flashlight_weared then - - local node=minetest.env:get_node_or_nil(rounded_pos) - if node then - if node.name=="air" then - minetest.env:add_node(rounded_pos,{type="node",name="technic:light"}) - end - end - local node=minetest.env:get_node_or_nil(old_pos) - if node then - if node.name=="technic:light" then - minetest.env:add_node(old_pos,{type="node",name="technic:light_off"}) - minetest.env:add_node(old_pos,{type="node",name="air"}) - end - end - player_positions[player_name]["x"] = rounded_pos.x - player_positions[player_name]["y"] = rounded_pos.y - player_positions[player_name]["z"] = rounded_pos.z - - else if not last_wielded[player_name] and flashlight_weared then - local node=minetest.env:get_node_or_nil(rounded_pos) - if node then - if node.name=="air" then - minetest.env:add_node(rounded_pos,{type="node",name="technic:light"}) - end - end - player_positions[player_name]["x"] = rounded_pos.x - player_positions[player_name]["y"] = rounded_pos.y - player_positions[player_name]["z"] = rounded_pos.z - last_wielded[player_name]=true - end - - end - end -end) - -minetest.register_node("technic:light", { - drawtype = "glasslike", - tile_images = {"technic_light.png"}, - paramtype = "light", - walkable = false, - buildable_to = true, - is_ground_content = true, - light_propagates = true, - sunlight_propagates = true, - light_source = 15, - selection_box = { - type = "fixed", - fixed = {0, 0, 0, 0, 0, 0}, - }, -}) -minetest.register_node("technic:light_off", { - drawtype = "glasslike", - tile_images = {"technic_light.png"}, - paramtype = "light", - walkable = false, - buildable_to = true, - is_ground_content = true, - light_propagates = true, - sunlight_propagates = true, - selection_box = { - type = "fixed", - fixed = {0, 0, 0, 0, 0, 0}, - }, -}) - -function check_for_flashlight (player) -if player==nil then return false end -local inv = player:get_inventory() -local hotbar=inv:get_list("main") - for i=1,8,1 do - - if hotbar[i]:get_name() == "technic:flashlight" then - item=hotbar[i]:to_table() - if item["metadata"]=="" or item["metadata"]=="0" then return false end --flashlight not charghed - charge=tonumber(item["metadata"]) - if charge-2>0 then - charge =charge-2; - set_RE_wear(item,charge,flashlight_max_charge) - item["metadata"]=tostring(charge) - hotbar[i]:replace(item) - inv:set_stack("main",i,hotbar[i]) - return true - end - end - end -return false -end \ No newline at end of file diff --git a/generator.lua b/generator.lua deleted file mode 100644 index c8ac802..0000000 --- a/generator.lua +++ /dev/null @@ -1,148 +0,0 @@ -minetest.register_alias("generator", "technic:generator") -minetest.register_alias("generator", "technic:generator_active") - -minetest.register_craft({ - output = 'technic:generator', - recipe = { - {'default:stone', 'default:stone', 'default:stone'}, - {'default:stone', '', 'default:stone'}, - {'default:stone', 'moreores:copper_ingot', 'default:stone'}, - } -}) - -minetest.register_craftitem("technic:generator", { - description = "Coal Driven Generator", - stack_max = 99, -}) - -generator_formspec = - "invsize[8,9;]".. - "image[0,0;5,5;technic_generator_menu.png]".. - "image[1,1;1,2;technic_power_meter_bg.png]".. --- "label[0,0;Generator]".. - "label[1,3;Power level]".. - "list[current_name;src;3,1;1,1;]".. - "image[4,1;1,1;default_furnace_fire_bg.png]".. - "list[current_player;main;0,5;8,4;]" - - -minetest.register_node("technic:generator", { - description = "Coal Driven Generator", - tiles = {"technic_generator_top.png", "technic_machine_bottom.png", "technic_generator_side.png", - "technic_generator_side.png", "technic_generator_side.png", "technic_generator_front.png"}, - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - technic_power_machine=1, - internal_EU_buffer=0; - internal_EU_buffer_size=5000; - burn_time=0; - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("infotext", "Generator") - meta:set_float("technic_power_machine", 1) - meta:set_float("internal_EU_buffer", 0) - meta:set_float("internal_EU_buffer_size", 5000) - meta:set_string("formspec", generator_formspec) - meta:set_float("burn_time", 0) - - local inv = meta:get_inventory() - inv:set_size("src", 1) - - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("src") then - return false - end - return true - end, - -}) - -minetest.register_node("technic:generator_active", { - description = "Coal Driven Generator", - tiles = {"technic_generator_top.png", "technic_machine_bottom.png", "technic_generator_side.png", - "technic_generator_side.png", "technic_generator_side.png", "technic_generator_front_active.png"}, - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - drop="technic:generator", - technic_power_machine=1, - internal_EU_buffer=0; - internal_EU_buffer_size=0; - burn_time=0; - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("src") then - return false - end - return true - end, - -}) -minetest.register_abm({ - nodenames = {"technic:generator","technic:generator_active"}, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - - local meta = minetest.env:get_meta(pos) - local burn_time= meta:get_float("burn_time") - local charge= meta:get_float("internal_EU_buffer") - local max_charge= meta:get_float("internal_EU_buffer_size") - local burn_charge=200 - - if burn_time>0 then - if charge+burn_charge>max_charge then - burn_charge=max_charge-charge - end - if burn_charge>0 then - burn_time=burn_time-1 - meta:set_float("burn_time",burn_time) - charge=charge+burn_charge - meta:set_float("internal_EU_buffer",charge) - end - - end - if burn_time==0 then - local inv = meta:get_inventory() - if inv:is_empty("src")==false then - local srcstack = inv:get_stack("src", 1) - src_item=srcstack:to_table() - if src_item["name"]== "default:coal_lump" then - srcstack:take_item() - inv:set_stack("src", 1, srcstack) - burn_time=16 - meta:set_float("burn_time",burn_time) - hacky_swap_node (pos,"technic:generator_active") - end - end - end - - local load = math.floor((charge/max_charge)*100) - local percent = math.floor((burn_time/16)*100) - meta:set_string("formspec", - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. - (load)..":technic_power_meter_fg.png]".. - "label[0,0;Generator]".. - "label[1,3;Power level]".. - "list[current_name;src;3,1;1,1;]".. - "image[4,1;1,1;default_furnace_fire_bg.png^[lowpart:".. - (percent)..":default_furnace_fire_fg.png]".. - "list[current_player;main;0,5;8,4;]" - ) - - if burn_time==0 then - hacky_swap_node (pos,"technic:generator") - end - - - end -}) - diff --git a/geothermal.lua b/geothermal.lua deleted file mode 100644 index 8f3a7d7..0000000 --- a/geothermal.lua +++ /dev/null @@ -1,135 +0,0 @@ -minetest.register_alias("geothermal", "technic:geothermal") - -minetest.register_craft({ - output = 'technic:geothermal', - recipe = { - {'default:stone', 'default:stone', 'default:stone'}, - {'moreores:copper_ingot', 'technic:diamond', 'moreores:copper_ingot'}, - {'default:stone', 'moreores:copper_ingot', 'default:stone'}, - } -}) - -minetest.register_craftitem("technic:geothermal", { - description = "Geothermal Generator", - stack_max = 99, -}) - -geothermal_formspec = - "invsize[8,4;]".. - "image[1,1;1,2;technic_power_meter_bg.png]".. - "label[0,0;Geothermal Generator]".. - "label[1,3;Power level]".. - "list[current_player;main;0,5;8,4;]" - - -minetest.register_node("technic:geothermal", { - description = "Geothermal Generator", - tiles = {"technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png", - "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"}, - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - technic_power_machine=1, - internal_EU_buffer=0; - internal_EU_buffer_size=5000; - burn_time=0; - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("infotext", "Geothermal Generator") - meta:set_float("technic_power_machine", 1) - meta:set_float("internal_EU_buffer", 0) - meta:set_float("internal_EU_buffer_size", 2000) - meta:set_string("formspec", geothermal_formspec) - end, - -}) - -minetest.register_node("technic:geothermal_active", { - description = "Geothermal Generator", - tiles = {"technic_geothermal_top_active.png", "technic_machine_bottom.png", "technic_geothermal_side.png", - "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"}, - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - drop="technic:geothermal", - technic_power_machine=1, - internal_EU_buffer=0; - internal_EU_buffer_size=0; -}) - -minetest.register_abm({ - nodenames = {"technic:geothermal","technic:geothermal_active"}, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - - local meta = minetest.env:get_meta(pos) - local charge= meta:get_float("internal_EU_buffer") - local max_charge= meta:get_float("internal_EU_buffer_size") - local water_nodes = 0 - local lava_nodes = 0 - local production_level=0 - local load_step=0 - - pos.x=pos.x+1 - local check=check_node_around (pos) - if check==1 then water_nodes=water_nodes+1 end - if check==2 then lava_nodes=lava_nodes+1 end - pos.x=pos.x-2 - check=check_node_around (pos) - if check==1 then water_nodes=water_nodes+1 end - if check==2 then lava_nodes=lava_nodes+1 end - pos.x=pos.x+1 - pos.z=pos.z+1 - check=check_node_around (pos) - if check==1 then water_nodes=water_nodes+1 end - if check==2 then lava_nodes=lava_nodes+1 end - pos.z=pos.z-2 - check=check_node_around (pos) - if check==1 then water_nodes=water_nodes+1 end - if check==2 then lava_nodes=lava_nodes+1 end - pos.z=pos.z+1 - - if water_nodes==1 and lava_nodes==1 then production_level=50 load_step=30 end - if water_nodes==2 and lava_nodes==1 then production_level=75 load_step=45 end - if water_nodes==1 and lava_nodes==2 then production_level=75 load_step=45 end - if water_nodes==2 and lava_nodes==2 then production_level=100 load_step=60 end - if water_nodes==3 and lava_nodes==1 then production_level=25 load_step=15 end - if water_nodes==1 and lava_nodes==3 then production_level=25 load_step=15 end - - if production_level>0 then - if charge+load_step>max_charge then - load_step=max_charge-charge - end - if load_step>0 then - charge=charge+load_step - meta:set_float("internal_EU_buffer",charge) - end - end - - local load = math.floor((charge/max_charge)*100) - meta:set_string("formspec", - "invsize[8,4;]".. - "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. - (load)..":technic_power_meter_fg.png]".. - "label[0,0;Geothermal Generator]".. - "label[1,3;Power level]".. - "label[4,0;Production at "..tostring(production_level).."%]" - ) - - if production_level>0 and minetest.env:get_node(pos).name=="technic:geothermal" then - hacky_swap_node (pos,"technic:geothermal_active") - return - end - if production_level==0 then hacky_swap_node (pos,"technic:geothermal") end -end -}) - -function check_node_around (pos) -local node=minetest.env:get_node(pos) -if node.name=="default:water_source" or node.name=="default:water_flowing" then return 1 end -if node.name=="default:lava_source" or node.name=="default:lava_flowing" then return 2 end -return 0 -end \ No newline at end of file diff --git a/gold_chest.lua b/gold_chest.lua deleted file mode 100644 index 29f1666..0000000 --- a/gold_chest.lua +++ /dev/null @@ -1,611 +0,0 @@ -local chest_mark_colors = { - '_black', - '_blue', - '_brown', - '_cyan', - '_dark_green', - '_dark_grey', - '_green', - '_grey', - '_magenta', - '_orange', - '_pink', - '_red', - '_violet', - '_white', - '_yellow', -} - -minetest.register_craft({ - output = 'technic:gold_chest 1', - recipe = { - {'moreores:gold_ingot','moreores:gold_ingot','moreores:gold_ingot'}, - {'moreores:gold_ingot','technic:silver_chest','moreores:gold_ingot'}, - {'moreores:gold_ingot','moreores:gold_ingot','moreores:gold_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:gold_locked_chest 1', - recipe = { - {'moreores:gold_ingot','moreores:gold_ingot','moreores:gold_ingot'}, - {'moreores:gold_ingot','technic:silver_locked_chest','moreores:gold_ingot'}, - {'moreores:gold_ingot','moreores:gold_ingot','moreores:gold_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:gold_locked_chest 1', - recipe = { - {'default:steel_ingot'}, - {'technic:gold_chest'}, - } -}) - -minetest.register_craftitem("technic:gold_chest", { - description = "Gold Chest", - stack_max = 99, -}) -minetest.register_craftitem("technic:gold_locked_chest", { - description = "Gold Locked Chest", - stack_max = 99, -}) - -minetest.register_node("technic:gold_chest", { - description = "Gold Chest", - tiles = {"technic_gold_chest_top.png", "technic_gold_chest_top.png", "technic_gold_chest_side.png", - "technic_gold_chest_side.png", "technic_gold_chest_side.png", "technic_gold_chest_front.png"}, - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, - 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[12,9;]".. - "list[current_name;main;0,0;12,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Gold Chest") - local inv = meta:get_inventory() - inv:set_size("main", 12*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) - chest_punched (pos,node,puncher); - end, - - on_receive_fields = function(pos, formname, fields, sender) - local meta = minetest.env:get_meta(pos); - fields.text = fields.text or "" - meta:set_string("text", fields.text) - meta:set_string("infotext", '"'..fields.text..'"') - - meta:set_string("formspec", - "invsize[12,9;]".. - "list[current_name;main;0,0;12,4;]".. - "list[current_player;main;0,5;8,4;]") - end, - - on_metadata_inventory_move = function(pos, from_list, from_index, - to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in chest at "..minetest.pos_to_string(pos)) - return minetest.node_metadata_inventory_move_allow_all( - pos, from_list, from_index, to_list, to_index, count, player) - end, - on_metadata_inventory_offer = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to chest at "..minetest.pos_to_string(pos)) - return minetest.node_metadata_inventory_offer_allow_all( - pos, listname, index, stack, player) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from chest at "..minetest.pos_to_string(pos)) - end, -}) - -for i, state in ipairs(chest_mark_colors) do -minetest.register_node("technic:gold_chest".. state, { - description = "Gold Chest", - tiles = {"technic_gold_chest_top.png", "technic_gold_chest_top.png", "technic_gold_chest_side.png", - "technic_gold_chest_side.png", "technic_gold_chest_side.png", "technic_gold_chest_front"..state..".png"}, - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, not_in_creative_inventory=1,tubedevice=1,tubedevice_receiver=1}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - drop = "technic:gold_chest", - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("formspec", - "invsize[12,9;]".. - "list[current_name;main;0,0;12,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Gold Chest") - local inv = meta:get_inventory() - inv:set_size("main", 12*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) - chest_punched (pos,node,puncher); - end, - - on_receive_fields = function(pos, formname, fields, sender) - local meta = minetest.env:get_meta(pos); - fields.text = fields.text or "" - meta:set_string("text", fields.text) - meta:set_string("infotext", '"'..fields.text..'"') - - meta:set_string("formspec", - "invsize[12,9;]".. - "list[current_name;main;0,0;12,4;]".. - "list[current_player;main;0,5;8,4;]") - end, - - on_metadata_inventory_move = function(pos, from_list, from_index, - to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in chest at "..minetest.pos_to_string(pos)) - return minetest.node_metadata_inventory_move_allow_all( - pos, from_list, from_index, to_list, to_index, count, player) - end, - on_metadata_inventory_offer = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to chest at "..minetest.pos_to_string(pos)) - return minetest.node_metadata_inventory_offer_allow_all( - pos, listname, index, stack, player) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from chest at "..minetest.pos_to_string(pos)) - end, -}) -end - - -local function has_locked_chest_privilege(meta, player) - if player:get_player_name() ~= meta:get_string("owner") then - return false - end - return true -end - -minetest.register_node("technic:gold_locked_chest", { - description = "Gold Locked Chest", - tiles = {"technic_gold_chest_top.png", "technic_gold_chest_top.png", "technic_gold_chest_side.png", - "technic_gold_chest_side.png", "technic_gold_chest_side.png", "technic_gold_chest_locked.png"}, - paramtype2 = "facedir", - drop = "technic:gold_locked_chest", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - after_place_node = function(pos, placer) - local meta = minetest.env:get_meta(pos) - meta:set_string("owner", placer:get_player_name() or "") - meta:set_string("infotext", "Gold Locked Chest (owned by ".. - meta:get_string("owner")..")") - end, - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("formspec", - "invsize[12,9;]".. - "list[current_name;main;0,0;12,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Gold Locked Chest") - meta:set_string("owner", "") - local inv = meta:get_inventory() - inv:set_size("main", 12*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); - if (has_locked_chest_privilege(meta, puncher)) then - locked_chest_punched (pos,node,puncher); - end - end, - - on_receive_fields = function(pos, formname, fields, sender) - local meta = minetest.env:get_meta(pos); - fields.text = fields.text or "" - meta:set_string("text", fields.text) - meta:set_string("infotext", '"'..fields.text..'"') - - meta:set_string("formspec", - "invsize[12,9;]".. - "list[current_name;main;0,0;12,4;]".. - "list[current_player;main;0,5;8,4;]") - end, - - allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return count - end, - allow_metadata_inventory_put = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return stack:get_count() - end, - allow_metadata_inventory_take = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return stack:get_count() - end, - on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from locked chest at "..minetest.pos_to_string(pos)) - end, -}) - -for i, state in ipairs(chest_mark_colors) do -minetest.register_node("technic:gold_locked_chest".. state, { - description = "Gold Locked Chest", - tiles = {"technic_gold_chest_top.png", "technic_gold_chest_top.png", "technic_gold_chest_side.png", - "technic_gold_chest_side.png", "technic_gold_chest_side.png", "technic_gold_chest_locked"..state..".png"}, - paramtype2 = "facedir", - drop = "technic:gold_locked_chest", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, not_in_creative_inventory=1,tubedevice=1,tubedevice_receiver=1}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - after_place_node = function(pos, placer) - local meta = minetest.env:get_meta(pos) - meta:set_string("owner", placer:get_player_name() or "") - meta:set_string("infotext", "Gold Locked Chest (owned by ".. - meta:get_string("owner")..")") - end, - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("formspec", - "invsize[12,9;]".. - "list[current_name;main;0,0;12,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Gold Locked Chest") - meta:set_string("owner", "") - local inv = meta:get_inventory() - inv:set_size("main", 12*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); - if (has_locked_chest_privilege(meta, puncher)) then - locked_chest_punched (pos,node,puncher); - end - end, - - on_receive_fields = function(pos, formname, fields, sender) - local meta = minetest.env:get_meta(pos); - fields.text = fields.text or "" - meta:set_string("text", fields.text) - meta:set_string("infotext", '"'..fields.text..'"') - - meta:set_string("formspec", - "invsize[12,9;]".. - "list[current_name;main;0,0;12,4;]".. - "list[current_player;main;0,5;8,4;]") - end, - - allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return count - end, - allow_metadata_inventory_put = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return stack:get_count() - end, - allow_metadata_inventory_take = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return stack:get_count() - end, - on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from locked chest at "..minetest.pos_to_string(pos)) - end, -}) -end - -function chest_punched (pos,node,puncher) - - local player_tool = puncher:get_wielded_item(); - local item=player_tool:get_name(); - if item == "dye:black" then - if (hacky_swap_node(pos,"technic:gold_chest_black")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:blue" then - if (hacky_swap_node(pos,"technic:gold_chest_blue")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:brown" then - if (hacky_swap_node(pos,"technic:gold_chest_brown")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:cyan" then - if (hacky_swap_node(pos,"technic:gold_chest_cyan")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:dark_green" then - if (hacky_swap_node(pos,"technic:gold_chest_dark_green")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:dark_grey" then - if (hacky_swap_node(pos,"technic:gold_chest_dark_grey")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:green" then - if (hacky_swap_node(pos,"technic:gold_chest_green")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:grey" then - if (hacky_swap_node(pos,"technic:gold_chest_grey")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:magenta" then - if (hacky_swap_node(pos,"technic:gold_chest_magenta")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:orange" then - if (hacky_swap_node(pos,"technic:gold_chest_orange")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:pink" then - if (hacky_swap_node(pos,"technic:gold_chest_pink")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:red" then - if (hacky_swap_node(pos,"technic:gold_chest_red")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:violet" then - if (hacky_swap_node(pos,"technic:gold_chest_violet")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:white" then - if (hacky_swap_node(pos,"technic:gold_chest_white")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:yellow" then - if (hacky_swap_node(pos,"technic:gold_chest_yellow")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - - local meta = minetest.env:get_meta(pos); - meta:set_string("formspec", "hack:sign_text_input") - end - - -function locked_chest_punched (pos,node,puncher) - - local player_tool = puncher:get_wielded_item(); - local item=player_tool:get_name(); - if item == "dye:black" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_black")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:blue" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_blue")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:brown" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_brown")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:cyan" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_cyan")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:dark_green" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_dark_green")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:dark_grey" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_dark_grey")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:green" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_green")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:grey" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_grey")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:magenta" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_magenta")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:orange" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_orange")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:pink" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_pink")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:red" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_red")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:violet" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_violet")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:white" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_white")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - if item == "dye:yellow" then - if (hacky_swap_node(pos,"technic:gold_locked_chest_yellow")) then - player_tool:take_item(1); - puncher:set_wielded_item(player_tool); - return - end - end - - local meta = minetest.env:get_meta(pos); - meta:set_string("formspec", "hack:sign_text_input") - end - \ No newline at end of file diff --git a/grinder.lua b/grinder.lua deleted file mode 100644 index 40c068a..0000000 --- a/grinder.lua +++ /dev/null @@ -1,320 +0,0 @@ -grinder_recipes ={} - -registered_grinder_recipes_count=1 - -function register_grinder_recipe (string1,string2) -grinder_recipes[registered_grinder_recipes_count]={} -grinder_recipes[registered_grinder_recipes_count].src_name=string1 -grinder_recipes[registered_grinder_recipes_count].dst_name=string2 -registered_grinder_recipes_count=registered_grinder_recipes_count+1 -end - -register_grinder_recipe("default:stone","default:sand") -register_grinder_recipe("default:cobble","default:gravel") -register_grinder_recipe("default:gravel","default:dirt") -register_grinder_recipe("default:desert_stone","default:desert_sand") -register_grinder_recipe("default:iron_lump","technic:iron_dust 2") -register_grinder_recipe("default:coal_lump","technic:coal_dust 2") -register_grinder_recipe("moreores:copper_lump","technic:copper_dust 2") -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") -register_grinder_recipe("technic:coal_dust","dye:black 2") -register_grinder_recipe("default:cactus","dye:green 2") -register_grinder_recipe("default:dry_shrub","dye:brown 2") -register_grinder_recipe("flowers:flower_geranium","dye:blue 2") -register_grinder_recipe("flowers:flower_dandelion_white","dye:white 2") -register_grinder_recipe("flowers:flower_dandelion_yellow","dye:yellow 2") -register_grinder_recipe("flowers:flower_tulip","dye:orange 2") -register_grinder_recipe("flowers:flower_rose","dye:red 2") -register_grinder_recipe("flowers:flower_viola","dye:violet 2") - - -minetest.register_craftitem( "technic:coal_dust", { - description = "Coal Dust", - inventory_image = "technic_coal_dust.png", - on_place_on_ground = minetest.craftitem_place_item, - }) - -minetest.register_craftitem( "technic:iron_dust", { - description = "Iron Dust", - inventory_image = "technic_iron_dust.png", - on_place_on_ground = minetest.craftitem_place_item, - }) - -minetest.register_craft({ - type = "cooking", - output = "default:steel_ingot", - recipe = "technic:iron_dust", -}) - -minetest.register_craftitem( "technic:copper_dust", { - description = "Copper Dust", - inventory_image = "technic_copper_dust.png", - on_place_on_ground = minetest.craftitem_place_item, - }) -minetest.register_craft({ - type = "cooking", - output = "moreores:copper_ingot", - recipe = "technic:copper_dust", -}) - -minetest.register_craftitem( "technic:tin_dust", { - description = "Tin Dust", - inventory_image = "technic_tin_dust.png", - on_place_on_ground = minetest.craftitem_place_item, - }) -minetest.register_craft({ - type = "cooking", - output = "moreores:tin_ingot", - recipe = "technic:tin_dust", -}) - -minetest.register_craftitem( "technic:silver_dust", { - description = "Silver Dust", - inventory_image = "technic_silver_dust.png", - on_place_on_ground = minetest.craftitem_place_item, - }) -minetest.register_craft({ - type = "cooking", - output = "moreores:silver_ingot", - recipe = "technic:silver_dust", -}) - -minetest.register_craftitem( "technic:gold_dust", { - description = "Gold Dust", - inventory_image = "technic_gold_dust.png", - on_place_on_ground = minetest.craftitem_place_item, - }) -minetest.register_craft({ - type = "cooking", - output = "moreores:gold_ingot", - recipe = "technic:gold_dust", -}) - -minetest.register_craftitem( "technic:mithril_dust", { - description = "Mithril Dust", - inventory_image = "technic_mithril_dust.png", - on_place_on_ground = minetest.craftitem_place_item, - }) -minetest.register_craft({ - type = "cooking", - output = "moreores:mithril_ingot", - recipe = "technic:mithril_dust", -}) - -minetest.register_craftitem( "technic:chromium_dust", { - description = "Chromium Dust", - inventory_image = "technic_chromium_dust.png", - on_place_on_ground = minetest.craftitem_place_item, - }) -minetest.register_craft({ - type = "cooking", - output = "technic:chromium_ingot", - recipe = "technic:chromium_dust", -}) - -minetest.register_craftitem( "technic:bronze_dust", { - description = "Bronze Dust", - inventory_image = "technic_bronze_dust.png", - on_place_on_ground = minetest.craftitem_place_item, - }) -minetest.register_craft({ - type = "cooking", - output = "moreores:bronze_ingot", - recipe = "technic:bronze_dust", -}) - -minetest.register_craftitem( "technic:brass_dust", { - description = "Brass Dust", - inventory_image = "technic_brass_dust.png", - on_place_on_ground = minetest.craftitem_place_item, - }) -minetest.register_craft({ - type = "cooking", - output = "technic:brass_ingot", - recipe = "technic:brass_dust", -}) - -minetest.register_craftitem( "technic:stainless_steel_dust", { - description = "Stainless Steel Dust", - inventory_image = "technic_stainless_steel_dust.png", - }) - -minetest.register_craft({ - type = "cooking", - output = "technic:stainless_steel_ingot", - 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', - recipe = { - {'default:desert_stone', 'default:desert_stone', 'default:desert_stone'}, - {'default:desert_stone', 'technic:diamond', 'default:desert_stone'}, - {'default:stone', 'moreores:copper_ingot', 'default:stone'}, - } -}) - -minetest.register_craftitem("technic:grinder", { - description = "Grinder", - stack_max = 99, -}) - -grinder_formspec = - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png]".. - "label[0,0;Grinder]".. - "label[1,3;Power level]".. - "list[current_name;src;3,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]" - - -minetest.register_node("technic:grinder", { - description = "Grinder", - tiles = {"technic_grinder_top.png", "technic_machine_bottom.png", "technic_grinder_side.png", - "technic_grinder_side.png", "technic_grinder_side.png", "technic_grinder_front.png"}, - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - technic_power_machine=1, - internal_EU_buffer=0; - internal_EU_buffer_size=5000; - grind_time=0; - grinded = nil; - src_time = 0; - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("infotext", "Grinder") - meta:set_float("technic_power_machine", 1) - meta:set_float("internal_EU_buffer", 0) - meta:set_float("internal_EU_buffer_size", 5000) - meta:set_string("formspec", grinder_formspec) - meta:set_float("grind_time", 0) - - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("dst", 4) - - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("src") then - return false - end - if not inv:is_empty("dst") then - return false - end - - return true - end, - -}) - -minetest.register_abm({ - nodenames = {"technic:grinder"}, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - - local meta = minetest.env:get_meta(pos) - local charge= meta:get_float("internal_EU_buffer") - local max_charge= meta:get_float("internal_EU_buffer_size") - local grind_cost=200 - - local load = math.floor((charge/max_charge)*100) - meta:set_string("formspec", - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. - (load)..":technic_power_meter_fg.png]".. - "label[0,0;Grinder]".. - "label[1,3;Power level]".. - "list[current_name;src;3,1;1,1;]".. - "list[current_name;dst;5,1;2,2;]".. - "list[current_player;main;0,5;8,4;]" - ) - - - - local inv = meta:get_inventory() - --- local grinder_on = meta:get_float("grinder_on") - - - local srclist = inv:get_list("src") - if inv:is_empty("src") then meta:set_float("grinder_on",0) end - - - if (meta:get_float("grinder_on") == 1) then - if charge>=grind_cost then - charge=charge-grind_cost; - meta:set_float("internal_EU_buffer",charge) - meta:set_float("src_time", meta:get_float("src_time") + 1) - if meta:get_float("src_time") >= meta:get_float("grind_time") then - -- check if there's room for output in "dst" list - grinded = get_grinded_item (inv:get_stack("src", 1)) - if inv:room_for_item("dst",grinded) then - -- Put result in "dst" list - inv:add_item("dst", grinded) - -- take stuff from "src" list - srcstack = inv:get_stack("src", 1) - srcstack:take_item() - inv:set_stack("src", 1, srcstack) - if inv:is_empty("src") then meta:set_float("grinder_on",0) end - - - - else - print("Grinder inventory full!") - end - meta:set_float("src_time", 0) - end - end - end - - if (meta:get_float("grinder_on")==0) then - local grinded=nil - if not inv:is_empty("src") then - grinded = get_grinded_item (inv:get_stack("src", 1)) - if grinded then meta:set_float("grinder_on",1) end - grind_time=4 - meta:set_float("grind_time",grind_time) - meta:set_float("src_time", 0) - return - end - end - - - end -}) - -function get_grinded_item (items) -new_item =nil -src_item=items:to_table() -item_name=src_item["name"] - -local counter=registered_grinder_recipes_count-1 -for i=1, counter,1 do -if grinder_recipes[i].src_name==item_name then return ItemStack(grinder_recipes[i].dst_name) end -end -return nil - -end \ No newline at end of file diff --git a/init.lua b/init.lua deleted file mode 100644 index 8933a11..0000000 --- a/init.lua +++ /dev/null @@ -1,85 +0,0 @@ --- Minetest 0.4.3 : technic - -minetest.register_alias("rebar", "technic:rebar") -minetest.register_alias("concrete", "technic:concrete") -minetest.register_alias("concrete_post", "technic:concrete_post") -minetest.register_alias("iron_chest", "technic:iron_chest") -minetest.register_alias("iron_locked_chest", "technic:iron_locked_chest") -minetest.register_alias("copper_chest", "technic:copper_chest") -minetest.register_alias("copper_locked_chest", "technic:copper_locked_chest") -minetest.register_alias("silver_chest", "technic:silver_chest") -minetest.register_alias("silver_locked_chest", "technic:silver_locked_chest") -minetest.register_alias("gold_chest", "technic:gold_chest") -minetest.register_alias("gold_locked_chest", "technic:gold_locked_chest") -minetest.register_alias("mithril_chest", "technic:mithril_chest") -minetest.register_alias("mithril_locked_chest", "technic:mithril_locked_chest") - - -modpath=minetest.get_modpath("technic") - ---Read technic config file -dofile(modpath.."/config.lua") - -dofile(modpath.."/concrete.lua") -dofile(modpath.."/iron_chest.lua") -dofile(modpath.."/copper_chest.lua") -dofile(modpath.."/silver_chest.lua") -dofile(modpath.."/gold_chest.lua") -dofile(modpath.."/mithril_chest.lua") -dofile(modpath.."/electric_furnace.lua") -dofile(modpath.."/battery_box.lua") -dofile(modpath.."/wires.lua") -dofile(modpath.."/wires_mv.lua") -dofile(modpath.."/ores.lua") -dofile(modpath.."/tool_workshop.lua") -dofile(modpath.."/music_player.lua") -dofile(modpath.."/grinder.lua") -dofile(modpath.."/mining_laser_mk1.lua") -dofile(modpath.."/injector.lua") -dofile(modpath.."/generator.lua") -dofile(modpath.."/solar_panel.lua") -dofile(modpath.."/geothermal.lua") -dofile(modpath.."/water_mill.lua") -dofile(modpath.."/alloy_furnace.lua") -dofile(modpath.."/items.lua") -dofile(modpath.."/mining_drill.lua") -dofile(modpath.."/screwdriver.lua") -dofile(modpath.."/sonic_screwdriver.lua") -dofile(modpath.."/node_breaker.lua") -dofile(modpath.."/deployer.lua") -dofile(modpath.."/constructor.lua") -dofile(modpath.."/tree_tap.lua") -dofile(modpath.."/flashlight.lua") -dofile(modpath.."/cans.lua") -dofile(modpath.."/chainsaw.lua") - -if enable_item_drop then dofile(modpath.."/item_drop.lua") end -if enable_item_pickup then dofile(modpath.."/item_pickup.lua") end - ---MV machines -dofile(modpath.."/solar_panel_mv.lua") -dofile(modpath.."/battery_box_mv.lua") - - -function has_locked_chest_privilege(meta, player) - if player:get_player_name() ~= meta:get_string("owner") then - return false - end - return true -end - - -function hacky_swap_node(pos,name) - local node = minetest.env:get_node(pos) - local meta = minetest.env:get_meta(pos) - local meta0 = meta:to_table() - if node.name == name then - return nil - end - 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 \ No newline at end of file diff --git a/injector.lua b/injector.lua deleted file mode 100644 index 0a6a19c..0000000 --- a/injector.lua +++ /dev/null @@ -1,325 +0,0 @@ -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_receiver") == 1 then add_new_TUBE_node(CHEST_nodes,pos1,parent) return end -end \ No newline at end of file diff --git a/iron_chest.lua b/iron_chest.lua deleted file mode 100644 index f0e0fcb..0000000 --- a/iron_chest.lua +++ /dev/null @@ -1,176 +0,0 @@ -minetest.register_craft({ - output = 'technic:iron_chest 1', - recipe = { - {'default:steel_ingot','default:steel_ingot','default:steel_ingot'}, - {'default:steel_ingot','default:chest','default:steel_ingot'}, - {'default:steel_ingot','default:steel_ingot','default:steel_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:iron_locked_chest 1', - recipe = { - {'default:steel_ingot','default:steel_ingot','default:steel_ingot'}, - {'default:steel_ingot','default:chest_locked','default:steel_ingot'}, - {'default:steel_ingot','default:steel_ingot','default:steel_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:iron_locked_chest 1', - recipe = { - {'default:steel_ingot'}, - {'technic:iron_chest'}, - } -}) - - -minetest.register_craftitem("technic:iron_chest", { - description = "Iron Chest", - stack_max = 99, -}) -minetest.register_craftitem("technic:iron_locked_chest", { - description = "Iron Locked Chest", - stack_max = 99, -}) - -minetest.register_alias("blabla", "technic:iron_chest") - -minetest.register_node("technic:iron_chest", { - description = "Iron Chest", - 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,0;9,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Iron Chest") - local inv = meta:get_inventory() - inv:set_size("main", 9*4) - end, - - after_place_node = function(pos, placer) - ntop1 = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z}) - ntop = minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}) - if ntop.name ~= "air" then - minetest.node_dig(pos, ntop1, placer) - end - 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_metadata_inventory_move = function(pos, from_list, from_index, - to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in chest at "..minetest.pos_to_string(pos)) - return minetest.node_metadata_inventory_move_allow_all( - pos, from_list, from_index, to_list, to_index, count, player) - end, - on_metadata_inventory_offer = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to chest at "..minetest.pos_to_string(pos)) - return minetest.node_metadata_inventory_offer_allow_all( - pos, listname, index, stack, player) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from chest at "..minetest.pos_to_string(pos)) - end, -}) - -local function has_locked_chest_privilege(meta, player) - if player:get_player_name() ~= meta:get_string("owner") then - return false - end - return true -end - -minetest.register_node("technic:iron_locked_chest", { - description = "Iron Locked Chest", - 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_locked.png"}, - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - after_place_node = function(pos, placer) - local meta = minetest.env:get_meta(pos) - meta:set_string("owner", placer:get_player_name() or "") - meta:set_string("infotext", "Locked Iron Chest (owned by ".. - meta:get_string("owner")..")") - end, -on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("formspec", - "invsize[9,9;]".. - "list[current_name;main;0,0;9,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Iron Locked Chest") - meta:set_string("owner", "") - local inv = meta:get_inventory() - inv:set_size("main", 9*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, - allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return count - end, - allow_metadata_inventory_put = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return stack:get_count() - end, - allow_metadata_inventory_take = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return stack:get_count() - end, - on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from locked chest at "..minetest.pos_to_string(pos)) - end, -}) - -function add_item (player) -player:get_inventory():add_item("main", "blabla 1") -end \ No newline at end of file diff --git a/item_drop.lua b/item_drop.lua deleted file mode 100644 index 3165e6a..0000000 --- a/item_drop.lua +++ /dev/null @@ -1,100 +0,0 @@ --- This part written by PilzAdam (item_drop mod) - -minetest.register_globalstep(function(dtime) - for _,player in ipairs(minetest.get_connected_players()) do - local pos = player:getpos() - pos.y = pos.y+0.5 - local inv = player:get_inventory() - - for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do - if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then - if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then - inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) - if object:get_luaentity().itemstring ~= "" then - minetest.sound_play("item_drop_pickup", { - to_player = player:get_player_name(), - }) - end - object:get_luaentity().itemstring = "" - object:remove() - end - end - end - - for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 2)) do - if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then - if object:get_luaentity().collect then - if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then - local pos1 = pos - pos1.y = pos1.y+0.2 - local pos2 = object:getpos() - local vec = {x=pos1.x-pos2.x, y=pos1.y-pos2.y, z=pos1.z-pos2.z} - vec.x = vec.x*3 - vec.y = vec.y*3 - vec.z = vec.z*3 - object:setvelocity(vec) - - minetest.after(1, function(args) - local lua = object:get_luaentity() - if object == nil or lua == nil or lua.itemstring == nil then - return - end - if inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then - inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) - if object:get_luaentity().itemstring ~= "" then - minetest.sound_play("item_drop_pickup", { - to_player = player:get_player_name(), - }) - end - object:get_luaentity().itemstring = "" - object:remove() - else - object:setvelocity({x=0,y=0,z=0}) - end - end, {player, object}) - - end - end - end - end - end -end) - -function minetest.handle_node_drops(pos, drops, digger) - for _,item in ipairs(drops) do - local count, name - if type(item) == "string" then - count = 1 - name = item - else - count = item:get_count() - name = item:get_name() - end - for i=1,count do - local obj = minetest.env:add_item(pos, name) - if obj ~= nil then - obj:get_luaentity().collect = true - local x = math.random(1, 5) - if math.random(1,2) == 1 then - x = -x - end - local z = math.random(1, 5) - if math.random(1,2) == 1 then - z = -z - end - obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z}) - - -- FIXME this doesnt work for deactiveted objects - if minetest.setting_get("remove_items") and tonumber(minetest.setting_get("remove_items")) then - minetest.after(tonumber(minetest.setting_get("remove_items")), function(obj) - obj:remove() - end, obj) - end - end - end - end -end - -if minetest.setting_get("log_mods") then - minetest.log("action", "item_drop loaded") -end diff --git a/item_pickup.lua b/item_pickup.lua deleted file mode 100644 index 04ed0f8..0000000 --- a/item_pickup.lua +++ /dev/null @@ -1,63 +0,0 @@ -minetest.register_globalstep(function(dtime) - for _,player in ipairs(minetest.get_connected_players()) do - local pos = player:getpos() - pos.y = pos.y+0.5 - local inv = player:get_inventory() - - for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do - if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then - if inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then - inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) - if object:get_luaentity().itemstring ~= "" then - minetest.sound_play("item_drop_pickup", { - to_player = player:get_player_name(), - }) - end - object:get_luaentity().itemstring = "" - object:remove() - end - end - end - - for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 2)) do - if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then - if object:get_luaentity().collect then - if inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then - local pos1 = pos - pos1.y = pos1.y+0.2 - local pos2 = object:getpos() - local vec = {x=pos1.x-pos2.x, y=pos1.y-pos2.y, z=pos1.z-pos2.z} - vec.x = vec.x*3 - vec.y = vec.y*3 - vec.z = vec.z*3 - object:setvelocity(vec) - - minetest.after(1, function(args) - local lua = object:get_luaentity() - if object == nil or lua == nil or lua.itemstring == nil then - return - end - if inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then - inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) - if object:get_luaentity().itemstring ~= "" then - minetest.sound_play("item_drop_pickup", { - to_player = player:get_player_name(), - }) - end - object:get_luaentity().itemstring = "" - object:remove() - else - object:setvelocity({x=0,y=0,z=0}) - end - end, {player, object}) - - end - else - minetest.after(0.5, function(entity) - entity.collect = true - end, object:get_luaentity()) - end - end - end - end -end) diff --git a/items.lua b/items.lua deleted file mode 100644 index 527fc6f..0000000 --- a/items.lua +++ /dev/null @@ -1,157 +0,0 @@ -minetest.register_craftitem( "technic:silicon_wafer", { - description = "Silicon Wafer", - inventory_image = "technic_silicon_wafer.png", - on_place_on_ground = minetest.craftitem_place_item, -}) - -minetest.register_craftitem( "technic:doped_silicon_wafer", { - description = "Doped Silicon Wafer", - inventory_image = "technic_doped_silicon_wafer.png", - on_place_on_ground = minetest.craftitem_place_item, -}) - -minetest.register_craft({ - output = 'pipeworks:tube_000000 9', - recipe = { - {'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'}, - {'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'}, - {'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'}, - } -}) - -minetest.register_craftitem( "technic:diamond_drill_head", { - description = "Diamond Drill Head", - inventory_image = "technic_diamond_drill_head.png", - on_place_on_ground = minetest.craftitem_place_item, -}) - -minetest.register_craft({ - output = 'technic:diamond_drill_head', - recipe = { - {'technic:stainless_steel_ingot', 'technic:diamond', 'technic:stainless_steel_ingot'}, - {'technic:diamond', '', 'technic:diamond'}, - {'technic:stainless_steel_ingot', 'technic:diamond', 'technic:stainless_steel_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:diamond_block', - recipe = { - {'technic:diamond', 'technic:diamond', 'technic:diamond'}, - {'technic:diamond', 'technic:diamond', 'technic:diamond'}, - {'technic:diamond', 'technic:diamond', 'technic:diamond'}, - } -}) - -minetest.register_node( "technic:diamond_block", { - description = "Diamond Block", - tiles = { "technic_diamond_block.png" }, - is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), - drop = 'craft "technic:diamond_block" 1', -}) - -minetest.register_craft({ - output = 'technic:green_energy_crystal', - recipe = { - {'moreores:gold_ingot', 'technic:battery', 'group:dye,basecolor_green'}, - {'technic:battery', 'technic:red_energy_crystal', 'technic:battery'}, - {'group:dye,basecolor_green', 'technic:battery', 'moreores:gold_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:blue_energy_crystal', - recipe = { - {'moreores:gold_ingot', 'technic:battery', 'group:dye,basecolor_blue'}, - {'technic:battery', 'technic:green_energy_crystal', 'technic:battery'}, - {'group:dye,basecolor_green', 'technic:battery', 'moreores:gold_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:red_energy_crystal', - recipe = { - {'moreores:gold_ingot', 'technic:battery', 'group:dye,basecolor_red'}, - {'technic:battery', 'technic:diamond_block', 'technic:battery'}, - {'group:dye,basecolor_red', 'technic:battery', 'moreores:gold_ingot'}, - } -}) - -minetest.register_tool("technic:blue_energy_crystal", -{description = "Blue Energy Crystal", -inventory_image = minetest.inventorycube("technic_diamond_block_blue.png", "technic_diamond_block_blue.png", "technic_diamond_block_blue.png"), -tool_capabilities = {load=0,max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}}) - -minetest.register_tool("technic:green_energy_crystal", -{description = "Green Energy Crystal", -inventory_image = minetest.inventorycube("technic_diamond_block_green.png", "technic_diamond_block_green.png", "technic_diamond_block_green.png"), -tool_capabilities = {load=0,max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}}) - -minetest.register_tool("technic:red_energy_crystal", -{description = "Red Energy Crystal", -inventory_image = minetest.inventorycube("technic_diamond_block_red.png", "technic_diamond_block_red.png", "technic_diamond_block_red.png"), -tool_capabilities = {load=0,max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}}) - - -minetest.register_craftitem( "technic:fine_copper_wire", { - description = "Fine Copper Wire", - inventory_image = "technic_fine_copper_wire.png", - on_place_on_ground = minetest.craftitem_place_item, -}) - -minetest.register_craft({ - output = 'technic:fine_copper_wire 2', - recipe = { - {'', 'moreores:copper_ingot', ''}, - {'', 'moreores:copper_ingot', ''}, - {'', 'moreores:copper_ingot', ''}, - } -}) - -minetest.register_craftitem( "technic:copper_coil", { - description = "Copper Coil", - inventory_image = "technic_copper_coil.png", - on_place_on_ground = minetest.craftitem_place_item, -}) - -minetest.register_craft({ - output = 'technic:copper_coil 1', - recipe = { - {'technic:fine_copper_wire', 'default:steel_ingot', 'technic:fine_copper_wire'}, - {'default:steel_ingot', '', 'default:steel_ingot'}, - {'technic:fine_copper_wire', 'default:steel_ingot', 'technic:fine_copper_wire'}, - } -}) - -minetest.register_craftitem( "technic:motor", { - description = "Electric Motor", - inventory_image = "technic_motor.png", - on_place_on_ground = minetest.craftitem_place_item, -}) - -minetest.register_craft({ - output = 'technic:motor', - recipe = { - {'default:steel_ingot', 'technic:copper_coil', 'default:steel_ingot'}, - {'default:steel_ingot', 'technic:copper_coil', 'default:steel_ingot'}, - {'default:steel_ingot', 'moreores:copper_ingot', 'default:steel_ingot'}, - } -}) - -minetest.register_craftitem( "technic:mv_transformer", { - description = "Medium Voltage Transformer", - inventory_image = "technic_mv_transformer.png", - on_place_on_ground = minetest.craftitem_place_item, -}) - -minetest.register_craft({ - output = 'technic:mv_transformer', - recipe = { - {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, - {'technic:copper_coil', 'default:steel_ingot', 'technic:copper_coil'}, - {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, - } -}) - diff --git a/mining_drill.lua b/mining_drill.lua deleted file mode 100644 index 5fc5377..0000000 --- a/mining_drill.lua +++ /dev/null @@ -1,49 +0,0 @@ -mining_drill_max_charge=60000 - -minetest.register_tool("technic:mining_drill", { - description = "Mining Drill", - inventory_image = "technic_mining_drill.png", - stack_max = 1, - on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type=="node" then - item=itemstack:to_table() - if item["metadata"]=="" or item["metadata"]=="0" then return end --tool not charged - charge=tonumber(item["metadata"]) - if charge-200>0 then - drill_dig_it(minetest.get_pointed_thing_position(pointed_thing, above),user) - charge =charge-200; - item["metadata"]=tostring(charge) - set_RE_wear(item,charge,mining_drill_max_charge) - itemstack:replace(item) - end - return itemstack - end - end, -}) - -minetest.register_craft({ - output = 'technic:mining_drill', - recipe = { - {'technic:stainless_steel_ingot', 'technic:diamond_drill_head', 'technic:stainless_steel_ingot'}, - {'technic:stainless_steel_ingot', 'technic:red_energy_crystal', 'technic:stainless_steel_ingot'}, - {'', 'moreores:copper_ingot', ''}, - } -}) - - - - - - -function drill_dig_it (pos, player) - local node=minetest.env:get_node(pos) - if node.name == "air" or node.name == "ignore" then return end - if node.name == "default:lava_source" then return end - if node.name == "default:lava_flowing" then return end - if node.name == "default:water_source" then minetest.env:remove_node(pos) return end - if node.name == "default:water_flowing" then minetest.env:remove_node(pos) return end - - minetest.sound_play("mining_drill", {pos = pos, gain = 1.0, max_hear_distance = 10,}) - minetest.node_dig(pos,node,player) - -end \ No newline at end of file diff --git a/mining_laser_mk1.lua b/mining_laser_mk1.lua deleted file mode 100644 index a206bb4..0000000 --- a/mining_laser_mk1.lua +++ /dev/null @@ -1,174 +0,0 @@ -laser_mk1_max_charge=40000 -local laser_shoot = function(itemstack, player, pointed_thing) - local laser_straight_mode=0 - local playerpos=player:getpos() - local dir=player:get_look_dir() - if pointed_thing.type=="node" then - pos=minetest.get_pointed_thing_position(pointed_thing, above) - local node = minetest.env:get_node(pos) - if node.name~="ignore" then - minetest.node_dig(pos,node,player) - end - laser_straight_mode=1 - end - - direction_y=math.abs(math.floor(dir.y*100)) - if direction_y>50 then entity_name="technic:laser_beam_entityV" - else entity_name="technic:laser_beam_entity" end - - if laser_straight_mode==1 then - pos1=minetest.get_pointed_thing_position(pointed_thing, under) - pos1.x=math.floor(pos1.x) - pos1.y=math.floor(pos1.y) - pos1.z=math.floor(pos1.z) - obj=minetest.env:add_entity(pos1,entity_name) - else - obj=minetest.env:add_entity({x=playerpos.x,y=playerpos.y+1.6,z=playerpos.z},entity_name) - end - if obj:get_luaentity().player == nil then - obj:get_luaentity().player = player - end - if laser_straight_mode==1 and direction_y<50 then - obj:setvelocity({x=dir.x*8, y=0, z=dir.z*8}) - else if laser_straight_mode==1 and direction_y>50 then - obj:setvelocity({x=0, y=dir.y*8, z=dir.z*8}) - end - end - if laser_straight_mode==0 then - obj:setvelocity({x=dir.x*8, y=dir.y*8, z=dir.z*8}) - end - obj:setacceleration({x=0, y=0, z=0}) - obj:setyaw(player:get_look_yaw()+math.pi) - if obj:get_luaentity().player == nil then - obj:get_luaentity().player = player - end - --obj:get_luaentity().node = player:get_inventory():get_stack("main", 1):get_name() - minetest.sound_play("technic_laser", {pos = playerpos, gain = 1.0, max_hear_distance = 10,}) - return true -end - - -minetest.register_tool("technic:laser_mk1", { - description = "Mining Laser MK1", - inventory_image = "technic_mining_laser_mk1.png", - stack_max = 1, - on_use = function(itemstack, user, pointed_thing) - item=itemstack:to_table() - if item["metadata"]=="" or item["metadata"]=="0" then return end - local charge=tonumber((item["metadata"])) - if charge-400>0 then - laser_shoot(item, user, pointed_thing) - charge =charge-400; - item["metadata"]=tostring(charge) - charge=set_RE_wear(item,charge,laser_mk1_max_charge) - itemstack:replace(item) - end - return itemstack - end, -}) - -minetest.register_craft({ - output = 'technic:laser_mk1', - recipe = { - {'technic:diamond', 'default:steel_ingot', 'technic:battery'}, - {'', 'default:steel_ingot', 'technic:battery'}, - {'', '', 'moreores:copper_ingot'}, - } -}) - - - -minetest.register_node("technic:laser_beam_box", { - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - { -0.5 , -0.1, -0.1 , 0.1 , 0.1 , 0.1 }, - { -0.1 , -0.1 , -0.1 , 0.5, 0.1 , 0.1 }, - } - }, - tiles = {"technic_laser_beam.png"}, - groups = {not_in_creative_inventory=1}, -}) - -minetest.register_node("technic:laser_beam_boxV", { - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - { -0.1 , -0.1 , -0.1 , 0.1 , 0.5, 0.1 }, - { -0.1 , -0.5, -0.1 , 0.1 , 0.1 , 0.1 }, - - } - }, - tiles = {"technic_laser_beam.png"}, - groups = {not_in_creative_inventory=1}, -}) - -LASER_BEAM_ENTITY={ - physical = false, - timer=0, - visual = "wielditem", - visual_size = {x=0.2, y=0.2}, - textures = {"technic:laser_beam_box"}, - lastpos={}, - max_range=10, - count=0, --- digger=nil, - collisionbox = {0,0,0,0,0,0}, -} - -LASER_BEAM_ENTITY.on_step = function(self, dtime) - self.timer=self.timer+dtime - local pos = self.object:getpos() - if self.player~=nil then if self.lastpos.x~=nil then lazer_it (pos, self.player) end end - if self.lastpos.x ~=nil and self.lastpos.y ~=nil and self.lastpos.y ~=nil then - temp1={x=math.floor(self.lastpos.x),y=math.floor(self.lastpos.y),z=math.floor(self.lastpos.z)} - temp2={x=math.floor(pos.x),y=math.floor(pos.y),z=math.floor(pos.z)} - if temp1.x==temp2.x and temp1.y==temp2.y and temp1.z==temp2.z then return end - end - self.lastpos={x=pos.x, y=pos.y, z=pos.z} - self.count=self.count+1 - if self.count==self.max_range then self.object:remove() end -end - -LASER_BEAM_ENTITYV={ - physical = false, - timer=0, - visual = "wielditem", - visual_size = {x=0.2, y=0.2}, - textures = {"technic:laser_beam_boxV"}, - lastpos={}, - max_range=15, - count=0, - collisionbox = {0,0,0,0,0,0}, -} - -LASER_BEAM_ENTITYV.on_step = function(self, dtime) - self.timer=self.timer+dtime - local pos = self.object:getpos() - if self.player~=nil then if self.lastpos.x~=nil then lazer_it (pos, self.player) end end - if self.lastpos.x ~=nil and self.lastpos.y ~=nil and self.lastpos.y ~=nil then - temp1={x=math.floor(self.lastpos.x),y=math.floor(self.lastpos.y),z=math.floor(self.lastpos.z)} - temp2={x=math.floor(pos.x),y=math.floor(pos.y),z=math.floor(pos.z)} - if temp1.x==temp2.x and temp1.y==temp2.y and temp1.z==temp2.z then return end - end - self.lastpos={x=pos.x, y=pos.y, z=pos.z} - self.count=self.count+1 - if self.count==self.max_range then self.object:remove() end -end - - -minetest.register_entity("technic:laser_beam_entity", LASER_BEAM_ENTITY) -minetest.register_entity("technic:laser_beam_entityV", LASER_BEAM_ENTITYV) - -function lazer_it (pos, player) - local pos1={} --- pos1.x=math.floor(pos.x) --- pos1.y=math.floor(pos.y) --- pos1.z=math.floor(pos.z) - local node = minetest.env:get_node(pos) - if node.name == "air" or node.name == "ignore" or node.name == "default:lava_source" or node.name == "default:lava_flowing" then return end - if node.name == "default:water_source" or node.name == "default:water_flowing" then minetest.env:remove_node(pos) return end - if player then minetest.node_dig(pos,node,player) end -end \ No newline at end of file diff --git a/mithril_chest.lua b/mithril_chest.lua deleted file mode 100644 index 89683f8..0000000 --- a/mithril_chest.lua +++ /dev/null @@ -1,145 +0,0 @@ -minetest.register_craft({ - output = 'technic:mithril_chest 1', - recipe = { - {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, - {'moreores:mithril_ingot','technic:gold_chest','moreores:mithril_ingot'}, - {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:mithril_locked_chest 1', - recipe = { - {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, - {'moreores:mithril_ingot','technic:gold_locked_chest','moreores:mithril_ingot'}, - {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:mithril_locked_chest 1', - recipe = { - {'default:steel_ingot'}, - {'technic:mithril_chest'}, - } -}) - -minetest.register_node("technic:mithril_chest", { - description = "Mithril Chest", - tiles = {"technic_mithril_chest_top.png", "technic_mithril_chest_top.png", "technic_mithril_chest_side.png", - "technic_mithril_chest_side.png", "technic_mithril_chest_side.png", "technic_mithril_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[13,9;]".. - "list[current_name;main;0,0;13,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Mithril Chest") - local inv = meta:get_inventory() - inv:set_size("main", 13*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_metadata_inventory_move = function(pos, from_list, from_index, - to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in chest at "..minetest.pos_to_string(pos)) - return minetest.node_metadata_inventory_move_allow_all( - pos, from_list, from_index, to_list, to_index, count, player) - end, - on_metadata_inventory_offer = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to chest at "..minetest.pos_to_string(pos)) - return minetest.node_metadata_inventory_offer_allow_all( - pos, listname, index, stack, player) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from chest at "..minetest.pos_to_string(pos)) - end, -}) - -minetest.register_node("technic:mithril_locked_chest", { - description = "Mithril Locked Chest", - tiles = {"technic_mithril_chest_top.png", "technic_mithril_chest_top.png", "technic_mithril_chest_side.png", - "technic_mithril_chest_side.png", "technic_mithril_chest_side.png", "technic_mithril_chest_locked.png"}, - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - after_place_node = function(pos, placer) - local meta = minetest.env:get_meta(pos) - meta:set_string("owner", placer:get_player_name() or "") - meta:set_string("infotext", "Mithril Locked Chest (owned by ".. - meta:get_string("owner")..")") - end, -on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("formspec", - "invsize[13,9;]".. - "list[current_name;main;0,0;13,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Mithril Locked Chest") - meta:set_string("owner", "") - local inv = meta:get_inventory() - inv:set_size("main", 13*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, - allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return count - end, - allow_metadata_inventory_put = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return stack:get_count() - end, - allow_metadata_inventory_take = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return stack:get_count() - end, - on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from locked chest at "..minetest.pos_to_string(pos)) - end, -}) diff --git a/music_player.lua b/music_player.lua deleted file mode 100644 index 0a6474a..0000000 --- a/music_player.lua +++ /dev/null @@ -1,126 +0,0 @@ -minetest.register_alias("music_player", "technic:music_player") -minetest.register_craft({ - output = 'technic:music_player', - recipe = { - {'default:wood', 'default:wood', 'default:wood'}, - {'technic:diamond', 'technic:diamond', 'technic:diamond'}, - {'default:stone', 'moreores:copper_ingot', 'default:stone'}, - } -}) - -minetest.register_craftitem("technic:music_player", { - description = "Music Player", - stack_max = 99, -}) - -music_player_formspec = - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png]".. - "label[0,0;Music Player]".. - "label[1,3;Power level]".. - "button[5,2;1,1;track1;1]".. - "button[6,2;1,1;track2;2]" - - -minetest.register_node("technic:music_player", { - description = "Music Player", - tiles = {"technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png", - "technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png"}, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - sounds = default.node_sound_wood_defaults(), - technic_power_machine=1, - internal_EU_buffer=0, - internal_EU_buffer_size=5000, - music_player_on=0, - music_playing =0, - music_handle = 0, - music_player_current_track =1, - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("infotext", "Music Player") - meta:set_float("technic_power_machine", 1) - meta:set_float("internal_EU_buffer", 1) - meta:set_float("internal_EU_buffer_size", 5000) - meta:set_string("formspec", music_player_formspec) - meta:set_float("music_player_on", 0) - meta:set_float("music_player_current_track", 1) - end, - - on_receive_fields = function(pos, formanme, fields, sender) - - local meta = minetest.env:get_meta(pos) - player_on=meta:get_float("music_player_on") - music_handle=meta:get_float("music_handle") - music_player_current_track=meta:get_float("music_player_current_track") - if fields.track1 then music_player_current_track=1 end - if fields.track2 then music_player_current_track=2 end - if fields.track3 then music_player_current_track=3 end - if fields.track4 then music_player_current_track=4 end - if fields.track5 then music_player_current_track=5 end - if fields.track6 then music_player_current_track=6 end - if fields.track7 then music_player_current_track=7 end - if fields.track8 then music_player_current_track=8 end - if fields.track9 then music_player_current_track=9 end - meta:set_float("music_player_current_track",music_player_current_track) - if fields.play and player_on==1 then - if music_handle then minetest.sound_stop(music_handle) end - music_handle=minetest.sound_play("technic_track"..music_player_current_track, {pos = pos, gain = 1.0,loop = true, max_hear_distance = 72,}) - meta:set_float("music_playing",1) - end - if fields.stop then - meta:set_float("music_playing",0) - if music_handle then minetest.sound_stop(music_handle) end - end - meta:set_float("music_handle",music_handle) - end, -}) - -minetest.register_abm({ - nodenames = {"technic:music_player"}, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - local meta = minetest.env:get_meta(pos) - local charge= meta:get_float("internal_EU_buffer") - local max_charge= meta:get_float("internal_EU_buffer_size") - player_on=meta:get_float("music_player_on") - music_player_current_track=meta:get_float("music_player_current_track") - local play_cost=80 - - if charge>play_cost then - if meta:get_float("music_playing")==1 then charge=charge-play_cost end - meta:set_float("internal_EU_buffer",charge) - meta:set_float("music_player_on",1) - else - meta:set_float("music_playing",0) - meta:set_float("music_player_on",0) - if music_handle then minetest.sound_stop(music_handle) end - end - local load = math.floor((charge/max_charge)*100) - meta:set_string("formspec", - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. - (load)..":technic_power_meter_fg.png]".. - "label[0,0;Music Player]".. - "label[1,3;Power level]".. - "button[4,1;1,1;track1;1]".. - "button[5,1;1,1;track2;2]".. - "button[6,1;1,1;track3;3]".. - "button[4,2;1,1;track4;4]".. - "button[5,2;1,1;track5;5]".. - "button[6,2;1,1;track6;6]".. - "button[4,3;1,1;track7;7]".. - "button[5,3;1,1;track8;8]".. - "button[6,3;1,1;track9;9]".. - "button[4,4;1,2;play;Play]".. - "button[6,4;1,2;stop;Stop]".. - "label[4,0;Current track "..tostring(music_player_current_track).."]" - - ) - - - - - end -}) - diff --git a/node_breaker.lua b/node_breaker.lua deleted file mode 100644 index 3a7f53b..0000000 --- a/node_breaker.lua +++ /dev/null @@ -1,94 +0,0 @@ -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_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,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_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", - 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) - if node.name == "technic:nodebreaker_off" then - minetest.env:add_node(pos, {name="technic:nodebreaker_on", param2 = node.param2}) - break_node (pos,node.param2) - nodeupdate(pos) - end -end) - -mesecon:register_on_signal_off(function(pos, node) - if node.name == "technic:nodebreaker_on" then - minetest.env:add_node(pos, {name="technic:nodebreaker_off", param2 = node.param2}) - nodeupdate(pos) - end -end) - -mesecon:register_effector("technic:nodebreaker_on", "technic:nodebreaker_off") - -function break_node (pos,n_param) - local pos1={} - local pos2={} - pos1.x=pos.x - pos1.y=pos.y - pos1.z=pos.z - pos2.x=pos.x - pos2.y=pos.y - pos2.z=pos.z - - --param2 3=x+ 1=x- 2=z+ 0=z- - 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 - if node.name == "default:water_source" then minetest.env:remove_node(pos2) return nil end - if node.name == "default:water_flowing" then minetest.env:remove_node(pos2) return nil end - if node.name == "ignore" then minetest.env:remove_node(pos2) return nil end - local drops = minetest.get_node_drops(node.name, "default:pick_mese") - local _, dropped_item - for _, dropped_item in ipairs(drops) do - 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 - diff --git a/ores.lua b/ores.lua deleted file mode 100644 index 90013fc..0000000 --- a/ores.lua +++ /dev/null @@ -1,201 +0,0 @@ -minetest.register_node( "technic:marble", { - description = "Marble", - tiles = { "technic_marble.png" }, - is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_node( "technic:marble_bricks", { - description = "Marble Bricks", - tiles = { "technic_marble_bricks.png" }, - is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_craft({ - output = 'technic:marble_bricks 4', - recipe = { - {'technic:marble','technic:marble'}, - {'technic:marble','technic:marble'} - } -}) - -minetest.register_node( "technic:granite", { - description = "Granite", - tiles = { "technic_granite.png" }, - is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), -}) - -stairsplus.register_stair_and_slab_and_panel_and_micro("marble", "technic:marble", - {cracky=3}, - {"technic_marble.png"}, - "Marble Stairs", - "Marble Slab", - "Marble Panel", - "Marble Microblock", - "marble") -stairsplus.register_stair_and_slab_and_panel_and_micro("marble_bricks", "technic:marble_bricks", - {cracky=3}, - {"technic_marble_bricks.png"}, - "Marble Bricks Stairs", - "Marble Bricks Slab", - "Marble Bricks Panel", - "Marble Bricks Microblock", - "marble_bricks") -stairsplus.register_stair_and_slab_and_panel_and_micro("granite", "technic:granite", - {cracky=3}, - {"technic_granite.png"}, - "Granite Stairs", - "Granite Slab", - "Granite Panel", - "Granite Microblock", - "granite") - -minetest.register_node( "technic:mineral_diamond", { - description = "Diamond Ore", - tiles = { "default_stone.png^technic_mineral_diamond.png" }, - is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), - drop = 'craft "technic:diamond" 1', -}) - -minetest.register_craftitem( "technic:diamond", { - description = "Diamond", - inventory_image = "technic_diamond.png", - on_place_on_ground = minetest.craftitem_place_item, -}) - -minetest.register_node( "technic:mineral_uranium", { - description = "Uranium Ore", - tiles = { "default_stone.png^technic_mineral_uranium.png" }, - is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), - drop = 'craft "technic:uranium" 1', -}) - -minetest.register_craftitem( "technic:uranium", { - description = "Uranium", - inventory_image = "technic_uranium.png", - on_place_on_ground = minetest.craftitem_place_item, -}) - -minetest.register_node( "technic:mineral_chromium", { - description = "Chromium Ore", - tiles = { "default_stone.png^technic_mineral_chromium.png" }, - is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), - drop = 'craft "technic:chromium_lump" 1', -}) - -minetest.register_craftitem( "technic:chromium_lump", { - description = "Chromium Lump", - inventory_image = "technic_chromium_lump.png", - on_place_on_ground = minetest.craftitem_place_item, -}) - -minetest.register_craftitem( "technic:chromium_ingot", { - description = "Chromium Ingot", - inventory_image = "technic_chromium_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_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_craftitem( "technic:stainless_steel_ingot", { - description = "Stainless Steel Ingot", - inventory_image = "technic_stainless_steel_ingot.png", -}) - -minetest.register_craftitem( "technic:brass_ingot", { - description = "Brass Ingot", - inventory_image = "technic_brass_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 - end - local y_min = math.max(minp.y, height_min) - local y_max = math.min(maxp.y, height_max) - local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) - local pr = PseudoRandom(seed) - local num_chunks = math.floor(chunks_per_volume * volume) - local chunk_size = 3 - if ore_per_chunk <= 4 then - chunk_size = 2 - end - local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk) - --print("generate_ore num_chunks: "..dump(num_chunks)) - for i=1,num_chunks do - if (y_max-chunk_size+1 <= y_min) then return end - local y0 = pr:next(y_min, y_max-chunk_size+1) - if y0 >= height_min and y0 <= height_max then - local x0 = pr:next(minp.x, maxp.x-chunk_size+1) - local z0 = pr:next(minp.z, maxp.z-chunk_size+1) - local p0 = {x=x0, y=y0, z=z0} - for x1=0,chunk_size-1 do - for y1=0,chunk_size-1 do - for z1=0,chunk_size-1 do - if pr:next(1,inverse_chance) == 1 then - local x2 = x0+x1 - local y2 = y0+y1 - local z2 = z0+z1 - local p2 = {x=x2, y=y2, z=z2} - if minetest.env:get_node(p2).name == wherein then - minetest.env:set_node(p2, {name=name}) - end - end - end - end - end - end - end - --print("generate_ore done") -end - -minetest.register_on_generated(function(minp, maxp, seed) -generate_ore("technic:mineral_diamond", "default:stone", minp, maxp, seed+21, 1/11/11/11, 4, -31000, -300) -generate_ore("technic:mineral_uranium", "default:stone", minp, maxp, seed+22, 1/10/10/10, 3, -300, -80) -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, 4, -31000, 2) -generate_ore("technic:marble", "default:stone", minp, maxp, seed+25, 1/128, 20, -100, -32) -generate_ore("technic:granite", "default:stone", minp, maxp, seed+25, 1/128, 15, -190, -90) -end) \ No newline at end of file diff --git a/project_table.lua b/project_table.lua deleted file mode 100644 index 355295c..0000000 --- a/project_table.lua +++ /dev/null @@ -1,39 +0,0 @@ -minetest.register_craft({ - output = 'technic:project_table 1', - recipe = { - {'default:wood','default:wood','default:wood'}, - {'default:wood','default:chest','default:wood'}, - {'default:stone','default:stone','default:stone'}, - } -}) - - -minetest.register_craftitem("technic:project_table", { - description = "Project Table", - stack_max = 99, -}) - -minetest.register_node("technic:project_table", { - description = "Project Table", - 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", "Iron Chest") - 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, -}) \ No newline at end of file diff --git a/rubber.lua b/rubber.lua deleted file mode 100644 index 311f3af..0000000 --- a/rubber.lua +++ /dev/null @@ -1,186 +0,0 @@ --- 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 diff --git a/screwdriver.lua b/screwdriver.lua deleted file mode 100644 index 0b81217..0000000 --- a/screwdriver.lua +++ /dev/null @@ -1,47 +0,0 @@ - minetest.register_tool("technic:screwdriver", { - description = "Screwdriver", - inventory_image = "technic_screwdriver.png", - on_use = function(itemstack, user, pointed_thing) - -- Must be pointing to facedir applicable node - if pointed_thing.type~="node" then return end - local pos=minetest.get_pointed_thing_position(pointed_thing,above) - local node=minetest.env:get_node(pos) - local node_name=node.name - if minetest.registered_nodes[node_name].paramtype2 == "facedir" or minetest.registered_nodes[node_name].paramtype2 == "wallmounted" then - if node.param2==nil then return end - -- Get ready to set the param2 - local n = node.param2 - if minetest.registered_nodes[node_name].paramtype2 == "facedir" then - n = n+1 - if n == 4 then n = 0 end - else - n = n+1 - if n == 6 then n = 0 end - end - -- hacky_swap_node, unforunatly. - local meta = minetest.env:get_meta(pos) - local meta0 = meta:to_table() - node.param2 = n - minetest.env:set_node(pos,node) - meta = minetest.env:get_meta(pos) - meta:from_table(meta0) - 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 - end, - }) - - minetest.register_craft({ - output = "technic:screwdriver", - recipe = { - {"technic:stainless_steel_ingot"}, - {"default:stick"} - } - }) diff --git a/silver_chest.lua b/silver_chest.lua deleted file mode 100644 index 66a915a..0000000 --- a/silver_chest.lua +++ /dev/null @@ -1,197 +0,0 @@ -minetest.register_craft({ - output = 'technic:silver_chest 1', - recipe = { - {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, - {'moreores:silver_ingot','technic:copper_chest','moreores:silver_ingot'}, - {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:silver_locked_chest 1', - recipe = { - {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, - {'moreores:silver_ingot','technic:copper_locked_chest','moreores:silver_ingot'}, - {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, - } -}) - -minetest.register_craft({ - output = 'technic:silver_locked_chest 1', - recipe = { - {'default:steel_ingot'}, - {'technic:silver_chest'}, - } -}) - -minetest.register_craftitem("technic:silver_chest", { - description = "Silver Chest", - stack_max = 99, -}) -minetest.register_craftitem("technic:silver_locked_chest", { - description = "Silver Locked Chest", - stack_max = 99, -}) - -minetest.register_node("technic:silver_chest", { - description = "Silver Chest", - tiles = {"technic_silver_chest_top.png", "technic_silver_chest_top.png", "technic_silver_chest_side.png", - "technic_silver_chest_side.png", "technic_silver_chest_side.png", "technic_silver_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[11,9;]".. - "list[current_name;main;0,0;11,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Silver Chest") - local inv = meta:get_inventory() - inv:set_size("main", 11*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); - meta:set_string("formspec", "hack:sign_text_input") - end, - - on_receive_fields = function(pos, formname, fields, sender) - local meta = minetest.env:get_meta(pos); - fields.text = fields.text or "" - meta:set_string("text", fields.text) - meta:set_string("infotext", '"'..fields.text..'"') - - meta:set_string("formspec", - "invsize[11,9;]".. - "list[current_name;main;0,0;11,4;]".. - "list[current_player;main;0,5;8,4;]") - end, - - on_metadata_inventory_move = function(pos, from_list, from_index, - to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in chest at "..minetest.pos_to_string(pos)) - return minetest.node_metadata_inventory_move_allow_all( - pos, from_list, from_index, to_list, to_index, count, player) - end, - on_metadata_inventory_offer = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to chest at "..minetest.pos_to_string(pos)) - return minetest.node_metadata_inventory_offer_allow_all( - pos, listname, index, stack, player) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from chest at "..minetest.pos_to_string(pos)) - end, - -}) - -local function has_locked_chest_privilege(meta, player) - if player:get_player_name() ~= meta:get_string("owner") then - return false - end - return true -end - -minetest.register_node("technic:silver_locked_chest", { - description = "Silver Locked Chest", - tiles = {"technic_silver_chest_top.png", "technic_silver_chest_top.png", "technic_silver_chest_side.png", - "technic_silver_chest_side.png", "technic_silver_chest_side.png", "technic_silver_chest_locked.png"}, - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - after_place_node = function(pos, placer) - local meta = minetest.env:get_meta(pos) - meta:set_string("owner", placer:get_player_name() or "") - meta:set_string("infotext", "Silver Locked Chest (owned by ".. - meta:get_string("owner")..")") - end, -on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("formspec", - "invsize[11,9;]".. - "list[current_name;main;0,0;11,4;]".. - "list[current_player;main;0,5;8,4;]") - meta:set_string("infotext", "Silver Locked Chest") - meta:set_string("owner", "") - local inv = meta:get_inventory() - inv:set_size("main", 11*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); - meta:set_string("formspec", "hack:sign_text_input") - end, - - on_receive_fields = function(pos, formname, fields, sender) - local meta = minetest.env:get_meta(pos); - fields.text = fields.text or "" - meta:set_string("text", fields.text) - meta:set_string("infotext", '"'..fields.text..'"') - - meta:set_string("formspec", - "invsize[11,9;]".. - "list[current_name;main;0,0;11,4;]".. - "list[current_player;main;0,5;8,4;]") - end, - - allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return count - end, - allow_metadata_inventory_put = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return stack:get_count() - end, - allow_metadata_inventory_take = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - minetest.log("action", player:get_player_name().. - " tried to access a locked chest belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) - return 0 - end - return stack:get_count() - end, - on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to locked chest at "..minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from locked chest at "..minetest.pos_to_string(pos)) - end, -}) diff --git a/solar_panel.lua b/solar_panel.lua deleted file mode 100644 index f2d08f6..0000000 --- a/solar_panel.lua +++ /dev/null @@ -1,76 +0,0 @@ -minetest.register_node("technic:solar_panel", { - tiles = {"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png", - "technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"}, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - sounds = default.node_sound_wood_defaults(), - description="Solar Panel", - active = false, - technic_power_machine=1, - internal_EU_buffer=0; - internal_EU_buffer_size=1000; - drawtype = "nodebox", - paramtype = "light", - is_ground_content = true, - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - }, - selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - }, - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_float("technic_power_machine", 1) - meta:set_float("internal_EU_buffer", 0) - meta:set_float("internal_EU_buffer_size", 1000) - - meta:set_string("infotext", "Solar Panel") - meta:set_float("active", false) - end, -}) - -minetest.register_craft({ - output = 'technic:solar_panel 1', - recipe = { - {'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer','technic:doped_silicon_wafer'}, - {'technic:doped_silicon_wafer', 'moreores:copper_ingot','technic:doped_silicon_wafer'}, - {'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer','technic:doped_silicon_wafer'}, - - } -}) - -minetest.register_abm( - {nodenames = {"technic:solar_panel"}, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - - local pos1={} - pos1.y=pos.y+1 - pos1.x=pos.x - pos1.z=pos.z - - local light = minetest.env:get_node_light(pos1, nil) - local meta = minetest.env:get_meta(pos) - if light == nil then light = 0 end - if light >= 14 then - meta:set_string("infotext", "Solar Panel is active ") - meta:set_float("active",1) - local internal_EU_buffer=meta:get_float("internal_EU_buffer") - local internal_EU_buffer_size=meta:get_float("internal_EU_buffer_size") - local charge_to_give=40+(pos1.y/250*40) -- make solar energy depending on height - if charge_to_give<0 then charge_to_give=0 end - if charge_to_give>160 then charge_to_give=160 end - if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then - charge_to_give=internal_EU_buffer_size-internal_EU_buffer - end - internal_EU_buffer=internal_EU_buffer+charge_to_give - meta:set_float("internal_EU_buffer",internal_EU_buffer) - - else - meta:set_string("infotext", "Solar Panel is inactive"); - meta:set_float("active",0) - end - end, -}) \ No newline at end of file diff --git a/solar_panel_mv.lua b/solar_panel_mv.lua deleted file mode 100644 index 93e21e7..0000000 --- a/solar_panel_mv.lua +++ /dev/null @@ -1,76 +0,0 @@ -minetest.register_node("technic:solar_panel_mv", { - tiles = {"technic_mv_solar_panel_top.png", "technic_mv_solar_panel_bottom.png", "technic_mv_solar_panel_side.png", - "technic_mv_solar_panel_side.png", "technic_mv_solar_panel_side.png", "technic_mv_solar_panel_side.png"}, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - sounds = default.node_sound_wood_defaults(), - description="MV Solar Panel", - active = false, - technic_mv_power_machine=1, - internal_EU_buffer=0; - internal_EU_buffer_size=10000; - drawtype = "nodebox", - paramtype = "light", - is_ground_content = true, - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - }, - selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - }, - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_float("technic_mv_power_machine", 1) - meta:set_float("internal_EU_buffer", 0) - meta:set_float("internal_EU_buffer_size", 10000) - - meta:set_string("infotext", "MV Solar Panel") - meta:set_float("active", false) - end, -}) - -minetest.register_craft({ - output = 'technic:solar_panel_mv 1', - recipe = { - {'technic:solar_panel', 'technic:solar_panel','technic:solar_panel'}, - {'technic:solar_panel', 'technic:mv_transformer','technic:solar_panel'}, - {'', 'technic:mv_cable',''}, - - } -}) - -minetest.register_abm( - {nodenames = {"technic:solar_panel_mv"}, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - - local pos1={} - pos1.y=pos.y+1 - pos1.x=pos.x - pos1.z=pos.z - - local light = minetest.env:get_node_light(pos1, nil) - local meta = minetest.env:get_meta(pos) - if light == nil then light = 0 end - if light >= 14 then - meta:set_string("infotext", "Solar Panel is active ") - meta:set_float("active",1) - local internal_EU_buffer=meta:get_float("internal_EU_buffer") - local internal_EU_buffer_size=meta:get_float("internal_EU_buffer_size") - local charge_to_give=300+(pos1.y/250*300) -- make solar energy depending on height - if charge_to_give<0 then charge_to_give=0 end - if charge_to_give>600 then charge_to_give=600 end - if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then - charge_to_give=internal_EU_buffer_size-internal_EU_buffer - end - internal_EU_buffer=internal_EU_buffer+charge_to_give - meta:set_float("internal_EU_buffer",internal_EU_buffer) - - else - meta:set_string("infotext", "Solar Panel is inactive"); - meta:set_float("active",0) - end - end, -}) \ No newline at end of file diff --git a/sonic_screwdriver.lua b/sonic_screwdriver.lua deleted file mode 100644 index d089778..0000000 --- a/sonic_screwdriver.lua +++ /dev/null @@ -1,55 +0,0 @@ -sonic_screwdriver_max_charge=15000 - - minetest.register_tool("technic:sonic_screwdriver", { - description = "Sonic Screwdriver", - inventory_image = "technic_sonic_screwdriver.png", - on_use = function(itemstack, user, pointed_thing) - -- Must be pointing to facedir applicable node - if pointed_thing.type~="node" then return end - local pos=minetest.get_pointed_thing_position(pointed_thing,above) - local node=minetest.env:get_node(pos) - local node_name=node.name - if minetest.registered_nodes[node_name].paramtype2 == "facedir" or minetest.registered_nodes[node_name].paramtype2 == "wallmounted" then - if node.param2==nil then return end - item=itemstack:to_table() - if item["metadata"]=="" or item["metadata"]=="0" then return end - local charge=tonumber((item["metadata"])) - if charge-100>0 then - minetest.sound_play("technic_sonic_screwdriver", {pos = pos, gain = 0.3, max_hear_distance = 10,}) - local n = node.param2 - if minetest.registered_nodes[node_name].paramtype2 == "facedir" then - n = n+1 - if n == 4 then n = 0 end - else - n = n+1 - if n == 6 then n = 0 end - end - -- hacky_swap_node, unforunatly. - local meta = minetest.env:get_meta(pos) - local meta0 = meta:to_table() - node.param2 = n - minetest.env:set_node(pos,node) - meta = minetest.env:get_meta(pos) - meta:from_table(meta0) - - charge =charge-100; - item["metadata"]=tostring(charge) - set_RE_wear(item,charge,sonic_screwdriver_max_charge) - itemstack:replace(item) - end - return itemstack - else - return itemstack - end - end, - - }) - - minetest.register_craft({ - output = "technic:sonic_screwdriver", - recipe = { - {"technic:diamond"}, - {"technic:battery"}, - {"technic:stainless_steel_ingot"} - } - }) diff --git a/sounds/chainsaw.ogg b/sounds/chainsaw.ogg deleted file mode 100644 index 5fe7552..0000000 Binary files a/sounds/chainsaw.ogg and /dev/null differ diff --git a/sounds/item_drop_pickup.1.ogg b/sounds/item_drop_pickup.1.ogg deleted file mode 100644 index 2ae432d..0000000 Binary files a/sounds/item_drop_pickup.1.ogg and /dev/null differ diff --git a/sounds/item_drop_pickup.2.ogg b/sounds/item_drop_pickup.2.ogg deleted file mode 100644 index f58bf08..0000000 Binary files a/sounds/item_drop_pickup.2.ogg and /dev/null differ diff --git a/sounds/item_drop_pickup.3.ogg b/sounds/item_drop_pickup.3.ogg deleted file mode 100644 index cf57c94..0000000 Binary files a/sounds/item_drop_pickup.3.ogg and /dev/null differ diff --git a/sounds/item_drop_pickup.4.ogg b/sounds/item_drop_pickup.4.ogg deleted file mode 100644 index bfe99d9..0000000 Binary files a/sounds/item_drop_pickup.4.ogg and /dev/null differ diff --git a/sounds/mining_drill.ogg b/sounds/mining_drill.ogg deleted file mode 100644 index 1493544..0000000 Binary files a/sounds/mining_drill.ogg and /dev/null differ diff --git a/sounds/technic_laser.ogg b/sounds/technic_laser.ogg deleted file mode 100644 index 19be080..0000000 Binary files a/sounds/technic_laser.ogg and /dev/null differ diff --git a/sounds/technic_sonic_screwdriver.ogg b/sounds/technic_sonic_screwdriver.ogg deleted file mode 100644 index 471bb72..0000000 Binary files a/sounds/technic_sonic_screwdriver.ogg and /dev/null differ diff --git a/technic/modpack.txt b/technic/modpack.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/technic/modpack.txt @@ -0,0 +1 @@ + diff --git a/technic/pipeworks/.gitignore b/technic/pipeworks/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/technic/pipeworks/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/technic/pipeworks/README b/technic/pipeworks/README new file mode 100644 index 0000000..fb18d4f --- /dev/null +++ b/technic/pipeworks/README @@ -0,0 +1,34 @@ +This simple mod uses nodeboxes to supply a complete set of 3D flanged pipes, +along with "valve" and "pump" devices. + +Unlike the previous version of this mod, these pipes are rounded, and when +placed, they'll automatically join together as needed. Pipes can go vertically +or horizontally, and there are enough nodes defined to allow for all possible +connections. Valves and pumps can only be placed horizontally, and will +automatically rotate and join with neighboring pipes as objects are added, as +well as joining with each other under certain circumstances. + +Pipes come in two variants: one type bears one or more dark windows on each +pipe, suggesting they're empty, while the other type bears green-tinted +windows, as if full (the two colors should also be easy to select if you want +to change them in a paint program). These windows only appear on straight +lengths and on certain junctions. + +There are no crafting recipes, yet, but you can use /giveme as usual, namely +"/giveme pipeworks:pipe 999" or so, and then place them as needed. See +init.lua for more details. + +This mod is intended to be used as a basis or at least as sort of a model for +something else to build on (perhaps a nicer-looking oil mod?), and does not +provide any of the code necessary to cause anything to flow through them. Like +the pipes, the valve and pump don't do anything useful yet, but you can punch +them to turn them "on" and "off". Note that the valve and pump textures and +shapes are not yet complete (hence their boxy appearance). + +This mod is a work in progress. + +Please note that owing to the nature of this mod, I have opted to use 64px +textures. Anything less just looks terrible. + +If you don't need the old node names from the previous version of this mod, +edit init.lua and comment-out the 'dofile' line at the top. diff --git a/technic/pipeworks/autoplace.lua b/technic/pipeworks/autoplace.lua new file mode 100644 index 0000000..390c66a --- /dev/null +++ b/technic/pipeworks/autoplace.lua @@ -0,0 +1,176 @@ +-- autorouting for pipes + +function pipe_scanforobjects(pos) + pipe_autoroute({ x=pos.x-1, y=pos.y , z=pos.z }, "_loaded") + pipe_autoroute({ x=pos.x+1, y=pos.y , z=pos.z }, "_loaded") + pipe_autoroute({ x=pos.x , y=pos.y-1, z=pos.z }, "_loaded") + pipe_autoroute({ x=pos.x , y=pos.y+1, z=pos.z }, "_loaded") + pipe_autoroute({ x=pos.x , y=pos.y , z=pos.z-1 }, "_loaded") + pipe_autoroute({ x=pos.x , y=pos.y , z=pos.z+1 }, "_loaded") + pipe_autoroute(pos, "_loaded") + + pipe_autoroute({ x=pos.x-1, y=pos.y , z=pos.z }, "_empty") + pipe_autoroute({ x=pos.x+1, y=pos.y , z=pos.z }, "_empty") + pipe_autoroute({ x=pos.x , y=pos.y-1, z=pos.z }, "_empty") + pipe_autoroute({ x=pos.x , y=pos.y+1, z=pos.z }, "_empty") + pipe_autoroute({ x=pos.x , y=pos.y , z=pos.z-1 }, "_empty") + pipe_autoroute({ x=pos.x , y=pos.y , z=pos.z+1 }, "_empty") + pipe_autoroute(pos, "_empty") +end + +function pipe_autoroute(pos, state) + nctr = minetest.env:get_node(pos) + if (string.find(nctr.name, "pipeworks:pipe_") == nil) then return end + + pipes_scansurroundings(pos) + + nsurround = pxm..pxp..pym..pyp..pzm..pzp + if nsurround == "000000" then nsurround = "110000" end + minetest.env:add_node(pos, { name = "pipeworks:pipe_"..nsurround..state }) +end + +-- autorouting for pneumatic tubes + +function tube_scanforobjects(pos) + tube_autoroute({ x=pos.x-1, y=pos.y , z=pos.z }) + tube_autoroute({ x=pos.x+1, y=pos.y , z=pos.z }) + tube_autoroute({ x=pos.x , y=pos.y-1, z=pos.z }) + tube_autoroute({ x=pos.x , y=pos.y+1, z=pos.z }) + tube_autoroute({ x=pos.x , y=pos.y , z=pos.z-1 }) + tube_autoroute({ x=pos.x , y=pos.y , z=pos.z+1 }) + tube_autoroute(pos) +end + +function tube_autoroute(pos) + nctr = minetest.env:get_node(pos) + print ("minetest.get_item_group("..nctr.name..',"tubedevice") == '..minetest.get_item_group(nctr.name, "tubedevice")) + if (string.find(nctr.name, "pipeworks:tube_") == nil) + and minetest.get_item_group(nctr.name, "tubedevice") ~= 1 then return end + + pxm=0 + pxp=0 + pym=0 + pyp=0 + pzm=0 + pzp=0 + + nxm = minetest.env:get_node({ x=pos.x-1, y=pos.y , z=pos.z }) + nxp = minetest.env:get_node({ x=pos.x+1, y=pos.y , z=pos.z }) + nym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z }) + nyp = minetest.env:get_node({ x=pos.x , y=pos.y+1, z=pos.z }) + nzm = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z-1 }) + nzp = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z+1 }) + + if (string.find(nxm.name, "pipeworks:tube_") ~= nil) + or minetest.get_item_group(nxm.name, "tubedevice") == 1 then pxm=1 end + if (string.find(nxp.name, "pipeworks:tube_") ~= nil) + or minetest.get_item_group(nxp.name, "tubedevice") == 1 then pxp=1 end + if (string.find(nym.name, "pipeworks:tube_") ~= nil) + or minetest.get_item_group(nym.name, "tubedevice") == 1 then pym=1 end + if (string.find(nyp.name, "pipeworks:tube_") ~= nil) + or minetest.get_item_group(nyp.name, "tubedevice") == 1 then pyp=1 end + if (string.find(nzm.name, "pipeworks:tube_") ~= nil) + or minetest.get_item_group(nzm.name, "tubedevice") == 1 then pzm=1 end + if (string.find(nzp.name, "pipeworks:tube_") ~= nil) + or minetest.get_item_group(nzp.name, "tubedevice") == 1 then pzp=1 end + + nsurround = pxm..pxp..pym..pyp..pzm..pzp + if minetest.get_item_group(nctr.name, "tubedevice") ~= 1 then + minetest.env:add_node(pos, { name = "pipeworks:tube_"..nsurround }) + end + +end + +-- auto-rotation code for various devices the tubes attach to + +function pipe_device_autorotate(pos, state, bname) + + if state == nil then + nname = bname + else + nname = bname.."_"..state + end + + local nctr = minetest.env:get_node(pos) + + pipes_scansurroundings(pos) + + if (pxm+pxp) ~= 0 then + minetest.env:add_node(pos, { name = nname.."_x" }) + return + end + + if (pzm+pzp) ~= 0 then + minetest.env:add_node(pos, { name = nname.."_z" }) + end + +end + +function pipes_scansurroundings(pos) + pxm=0 + pxp=0 + pym=0 + pyp=0 + pzm=0 + pzp=0 + + nxm = minetest.env:get_node({ x=pos.x-1, y=pos.y , z=pos.z }) + nxp = minetest.env:get_node({ x=pos.x+1, y=pos.y , z=pos.z }) + nym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z }) + nyp = minetest.env:get_node({ x=pos.x , y=pos.y+1, z=pos.z }) + nzm = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z-1 }) + nzp = minetest.env:get_node({ x=pos.x , y=pos.y , z=pos.z+1 }) + + if (string.find(nxm.name, "pipeworks:pipe_") ~= nil) then pxm=1 end + if (string.find(nxp.name, "pipeworks:pipe_") ~= nil) then pxp=1 end + if (string.find(nym.name, "pipeworks:pipe_") ~= nil) then pym=1 end + if (string.find(nyp.name, "pipeworks:pipe_") ~= nil) then pyp=1 end + if (string.find(nzm.name, "pipeworks:pipe_") ~= nil) then pzm=1 end + if (string.find(nzp.name, "pipeworks:pipe_") ~= nil) then pzp=1 end + + for p in ipairs(pipes_devicelist) do + pdev = pipes_devicelist[p] + if (string.find(nxm.name, "pipeworks:"..pdev.."_off_x") ~= nil) or + (string.find(nxm.name, "pipeworks:"..pdev.."_on_x") ~= nil) or + (string.find(nxm.name, "pipeworks:"..pdev.."_x") ~= nil) then + pxm=1 + end + + if (string.find(nxp.name, "pipeworks:"..pdev.."_off_x") ~= nil) or + (string.find(nxp.name, "pipeworks:"..pdev.."_on_x") ~= nil) or + (string.find(nxp.name, "pipeworks:"..pdev.."_x") ~= nil) then + pxp=1 + end + + if (string.find(nzm.name, "pipeworks:"..pdev.."_off_z") ~= nil) or + (string.find(nzm.name, "pipeworks:"..pdev.."_on_z") ~= nil) or + (string.find(nzm.name, "pipeworks:"..pdev.."_z") ~= nil) then + pzm=1 + end + + if (string.find(nzp.name, "pipeworks:"..pdev.."_off_z") ~= nil) or + (string.find(nzp.name, "pipeworks:"..pdev.."_on_z") ~= nil) or + (string.find(nzp.name, "pipeworks:"..pdev.."_z") ~= nil) then + pzp=1 + end + end + + -- storage tanks and intake grates have vertical connections + -- also, so they require a special case + + if (string.find(nym.name, "pipeworks:storage_tank_") ~= nil) or + (string.find(nym.name, "pipeworks:intake") ~= nil) or + (string.find(nym.name, "pipeworks:outlet") ~= nil) then + pym=1 + end +end + +function pipe_look_for_stackable_tanks(pos) + tym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z }) + + if string.find(tym.name, "pipeworks:storage_tank_") ~= nil or + string.find(tym.name, "pipeworks:expansion_tank_") ~= nil then + minetest.env:add_node(pos, { name = "pipeworks:expansion_tank_0"}) + end +end + diff --git a/technic/pipeworks/changelog.txt b/technic/pipeworks/changelog.txt new file mode 100644 index 0000000..9e51430 --- /dev/null +++ b/technic/pipeworks/changelog.txt @@ -0,0 +1,46 @@ +Changelog +--------- + +2012-08-24: Added square-ish pneumatic tubes, with their own autoplace code +(they do not connect to the steel pipes or their related devices). + +2012-08-22: Added outlet grate, made it participate in autoplace algorithm. +Extended storage tank to show fill level in 10% steps (0% to 100%). Added +"expansion tank" that appears if the user stacks tanks upwards. (Downwards is +not checked). + +2012-08-21: Made storage tank participate in autoplace algorithm. Tuned API a +little to allow for more flexible placement. Re-organized code a bit to allow +for some upcoming rules changes. Made storage tanks' upper/lower fittins and +intake grate participate in autoplace algorithm. + +2012-08-20: Added temporary nodes for storage tank and intake grating, but +without autoplace. + +2012-08-19: Pumps and valves now fully participate in the +auto-rotate/auto-place algorithm. + +2012-08-18: Total rewrite again. All pipes are now nice and round-looking, and +they auto-connect! Also added temporary nodes for pump and valve (each with an +on/off setting - punch to change). No crafting recipes yet and the pipes still +don't do anything useful yet. Soon. + +2012-08-06: Moved this changelog off the forum post and into a separate file. + +2012-08-05 (multiple updates): Rewrote pipeworks to use loops and tables to +create the nodes. Requires far less code now. Added -X, +X, -Y, +Y, -Z, +Z +capped stubs and a short centered horizontal segment. Changed node definitions +so that the aforementioned "short centered" segment is given on dig/drop. +Renamed it to just "pipeworks:pipe" (and pipe_loaded). Added empty/loaded +indicator images to the capped ends, removed some redundant comments. Made the +empty/loaded indication at the capped end more prominent. + +2012-07-21: Added screenshot showing pipes as they look now that nodebox +texture rotation is fixed. + +2012-07-18: Changed the mod name and all internals to 'pipeworks' instead of +'pipes'... after a couple of mistakes :-) + +2012-07-12: moved project to github. + +2012-06-23: Initial release, followed by reworking the textures a bit. diff --git a/technic/pipeworks/crafts.lua b/technic/pipeworks/crafts.lua new file mode 100644 index 0000000..493fdcf --- /dev/null +++ b/technic/pipeworks/crafts.lua @@ -0,0 +1,94 @@ +-- Crafting recipes for pipeworks + +-- If the technic mod is present, then don't bother registering these recipes +-- as that mod supplies its own. + +if io.open(minetest.get_modpath("pipeworks").."/../technic/init.lua", "r") == nil then + + -- If homedecor is not installed, we need to register a few of its crafts + -- manually so we can use them. + + if minetest.get_modpath("homedecor") == nil then + + minetest.register_craftitem(":homedecor:plastic_sheeting", { + description = "Plastic sheet", + inventory_image = "pipeworks_plastic_sheeting.png", + }) + + minetest.register_craft({ + type = "cooking", + output = "homedecor:plastic_sheeting", + recipe = "default:junglegrass", + }) + + minetest.register_craft({ + type = 'fuel', + recipe = 'homedecor:plastic_sheeting', + burntime = 30, + }) + end + + minetest.register_craft( { + output = "pipeworks:pipe_110000_empty 12", + recipe = { + { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }, + { "", "", "" }, + { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" } + }, + }) + + minetest.register_craft( { + output = "pipeworks:pump 2", + recipe = { + { "default:stone", "default:stone", "default:stone" }, + { "default:steel_ingot", "default:stick", "default:steel_ingot" }, + { "default:stone", "default:stone", "default:stone" } + }, + }) + + minetest.register_craft( { + output = "pipeworks:valve 2", + recipe = { + { "", "default:stick", "" }, + { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }, + { "", "default:steel_ingot", "" } + }, + }) + + minetest.register_craft( { + output = "pipeworks:storage_tank 2", + recipe = { + { "", "default:steel_ingot", "default:steel_ingot" }, + { "default:steel_ingot", "default:glass", "default:steel_ingot" }, + { "default:steel_ingot", "default:steel_ingot", "" } + }, + }) + + minetest.register_craft( { + output = "pipeworks:intake 2", + recipe = { + { "", "default:steel_ingot", "" }, + { "default:steel_ingot", "", "default:steel_ingot" }, + { "", "default:steel_ingot", "" } + }, + }) + + minetest.register_craft( { + output = "pipeworks:outlet 2", + recipe = { + { "default:steel_ingot", "", "default:steel_ingot" }, + { "", "default:steel_ingot", "" }, + { "default:steel_ingot", "", "default:steel_ingot" } + }, + }) + + minetest.register_craft( { + output = "pipeworks:tube 12", + recipe = { + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + { "", "", "" }, + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" } + }, + }) + +end diff --git a/technic/pipeworks/depends.txt b/technic/pipeworks/depends.txt new file mode 100644 index 0000000..3a7daa1 --- /dev/null +++ b/technic/pipeworks/depends.txt @@ -0,0 +1,2 @@ +default + diff --git a/technic/pipeworks/devices.lua b/technic/pipeworks/devices.lua new file mode 100644 index 0000000..5f1ce0d --- /dev/null +++ b/technic/pipeworks/devices.lua @@ -0,0 +1,471 @@ +-- List of devices that should participate in the autoplace algorithm + +pipes_devicelist = { + "pump", + "valve", + "storage_tank_0", + "storage_tank_1", + "storage_tank_2", + "storage_tank_3", + "storage_tank_4", + "storage_tank_5", + "storage_tank_6", + "storage_tank_7", + "storage_tank_8", + "storage_tank_9", + "storage_tank_10" +} + +-- tables + +minetest.register_alias("pipeworks:pump", "pipeworks:pump_off_x") +minetest.register_alias("pipeworks:valve", "pipeworks:valve_off_x") +minetest.register_alias("pipeworks:storage_tank", "pipeworks:storage_tank_0_x") + +pipe_pumpbody_x = { + { -6/16, -8/16, -6/16, 6/16, 8/16, 6/16 } +} + +pipe_pumpbody_z = { + { -6/16, -8/16, -6/16, 6/16, 8/16, 6/16 } +} + +pipe_valvebody_x = { + { -4/16, -4/16, -4/16, 4/16, 4/16, 4/16 } +} + +pipe_valvebody_z = { + { -4/16, -4/16, -4/16, 4/16, 4/16, 4/16 } +} + +pipe_valvehandle_on_x = { + { -5/16, 4/16, -1/16, 0, 5/16, 1/16 } +} + +pipe_valvehandle_on_z = { + { -1/16, 4/16, -5/16, 1/16, 5/16, 0 } +} + +pipe_valvehandle_off_x = { + { -1/16, 4/16, -5/16, 1/16, 5/16, 0 } +} + +pipe_valvehandle_off_z = { + { -5/16, 4/16, -1/16, 0, 5/16, 1/16 } +} + +-- Now define the nodes. + +local states = { "on", "off" } +local dgroups = "" + +for s in ipairs(states) do + + if states[s] == "off" then + dgroups = {snappy=3, pipe=1} + else + dgroups = {snappy=3, pipe=1, not_in_creative_inventory=1} + end + + local pumpboxes = {} + pipe_addbox(pumpboxes, pipe_leftstub) + pipe_addbox(pumpboxes, pipe_pumpbody_x) + pipe_addbox(pumpboxes, pipe_rightstub) + local tilex = "pipeworks_pump_ends.png" + local tilez = "pipeworks_pump_"..states[s]..".png" + + minetest.register_node("pipeworks:pump_"..states[s].."_x", { + description = "Pump Module ("..states[s]..")", + drawtype = "nodebox", + tiles = { + "pipeworks_pump_top_x.png", + "pipeworks_pump_sides.png", + tilex, + tilex, + "pipeworks_pump_sides.png", + tilez + }, + paramtype = "light", + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + }, + node_box = { + type = "fixed", + fixed = pumpboxes + }, + groups = dgroups, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + after_place_node = function(pos) + pipe_device_autorotate(pos, states[s], "pipeworks:pump") + pipe_scanforobjects(pos) + end, + after_dig_node = function(pos) + pipe_scanforobjects(pos) + end, + drop = "pipeworks:pump_off_x" + }) + + local pumpboxes = {} + pipe_addbox(pumpboxes, pipe_frontstub) + pipe_addbox(pumpboxes, pipe_pumpbody_z) + pipe_addbox(pumpboxes, pipe_backstub) + + minetest.register_node("pipeworks:pump_"..states[s].."_z", { + description = "Pump Module ("..states[s]..", Z-axis)", + drawtype = "nodebox", + tiles = { + "pipeworks_pump_top_z.png", + "pipeworks_pump_sides.png", + tilez, + tilez, + "pipeworks_pump_sides.png", + tilex + }, + paramtype = "light", + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + }, + node_box = { + type = "fixed", + fixed = pumpboxes + }, + groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + after_place_node = function(pos) + pipe_device_autorotate(pos, states[s], "pipeworks:pump") + pipe_scanforobjects(pos) + end, + after_dig_node = function(pos) + pipe_scanforobjects(pos) + end, + drop = "pipeworks:pump_off_x" + }) + + local valveboxes = {} + pipe_addbox(valveboxes, pipe_leftstub) + pipe_addbox(valveboxes, pipe_valvebody_x) + if states[s] == "off" then + pipe_addbox(valveboxes, pipe_valvehandle_off_x) + else + pipe_addbox(valveboxes, pipe_valvehandle_on_x) + end + pipe_addbox(valveboxes, pipe_rightstub) + local tilex = "pipeworks_valvebody_ends.png" + local tilez = "pipeworks_valvebody_sides.png" + + minetest.register_node("pipeworks:valve_"..states[s].."_x", { + description = "Valve ("..states[s]..")", + drawtype = "nodebox", + tiles = { + "pipeworks_valvebody_top_"..states[s].."_x.png", + "pipeworks_valvebody_bottom.png", + tilex, + tilex, + tilez, + tilez, + }, + paramtype = "light", + selection_box = { + type = "fixed", + fixed = { -8/16, -4/16, -5/16, 8/16, 5/16, 5/16 } + }, + node_box = { + type = "fixed", + fixed = valveboxes + }, + groups = dgroups, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + after_place_node = function(pos) + pipe_device_autorotate(pos, states[s], "pipeworks:valve") + pipe_scanforobjects(pos) + end, + after_dig_node = function(pos) + pipe_scanforobjects(pos) + end, + drop = "pipeworks:valve_off_x", + pipelike=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_int("pipelike",1) + end, + }) + + local valveboxes = {} + pipe_addbox(valveboxes, pipe_frontstub) + pipe_addbox(valveboxes, pipe_valvebody_z) + if states[s] == "off" then + pipe_addbox(valveboxes, pipe_valvehandle_off_z) + else + pipe_addbox(valveboxes, pipe_valvehandle_on_z) + end + pipe_addbox(valveboxes, pipe_backstub) + + minetest.register_node("pipeworks:valve_"..states[s].."_z", { + description = "Valve ("..states[s]..", Z-axis)", + drawtype = "nodebox", + tiles = { + "pipeworks_valvebody_top_"..states[s].."_z.png", + "pipeworks_valvebody_bottom.png", + tilez, + tilez, + tilex, + tilex, + }, + paramtype = "light", + selection_box = { + type = "fixed", + fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 } + }, + node_box = { + type = "fixed", + fixed = valveboxes + }, + groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + after_place_node = function(pos) + pipe_device_autorotate(pos, states[s], "pipeworks:valve") + pipe_scanforobjects(pos) + + end, + after_dig_node = function(pos) + pipe_scanforobjects(pos) + end, + drop = "pipeworks:valve_off_x", + pipelike=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_int("pipelike",1) + end, + }) +end + +-- intake grate + +minetest.register_node("pipeworks:intake", { + description = "Intake grate", + drawtype = "nodebox", + tiles = { + "pipeworks_intake_top.png", + "pipeworks_intake_sides.png", + "pipeworks_intake_sides.png", + "pipeworks_intake_sides.png", + "pipeworks_intake_sides.png", + "pipeworks_intake_sides.png" + }, + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + }, + node_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + }, + paramtype = "light", + groups = {snappy=3, pipe=1}, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + after_place_node = function(pos) + pipe_scanforobjects(pos) + end, + after_dig_node = function(pos) + pipe_scanforobjects(pos) + end, + pipelike=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_int("pipelike",1) + end, +}) + +-- outlet grate + +minetest.register_node("pipeworks:outlet", { + description = "Outlet grate", + drawtype = "nodebox", + tiles = { + "pipeworks_outlet_top.png", + "pipeworks_outlet_sides.png", + "pipeworks_outlet_sides.png", + "pipeworks_outlet_sides.png", + "pipeworks_outlet_sides.png", + "pipeworks_outlet_sides.png" + }, + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + }, + node_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + }, + paramtype = "light", + groups = {snappy=3, pipe=1}, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + after_place_node = function(pos) + pipe_scanforobjects(pos) + end, + after_dig_node = function(pos) + pipe_scanforobjects(pos) + end, + pipelike=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_int("pipelike",1) + end, +}) + +-- tanks + +for fill = 0, 10 do + if fill == 0 then + filldesc="empty" + sgroups = {snappy=3, pipe=1, tankfill=fill+1} + else + filldesc=fill.."0% full" + sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1} + end + + minetest.register_node("pipeworks:expansion_tank_"..fill, { + description = "Expansion Tank ("..filldesc..")... You hacker, you.", + tiles = { + "pipeworks_storage_tank_fittings.png", + "pipeworks_storage_tank_fittings.png", + "pipeworks_storage_tank_back.png", + "pipeworks_storage_tank_back.png", + "pipeworks_storage_tank_back.png", + "pipeworks_storage_tank_front_"..fill..".png" + }, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + drop = "pipeworks:storage_tank_"..fill.."_x", + after_place_node = function(pos) + pipe_look_for_stackable_tanks(pos) + pipe_scanforobjects(pos) + end, + after_dig_node = function(pos) + pipe_scanforobjects(pos) + end, + pipelike=0, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_int("pipelike",0) + end, + }) + + minetest.register_node("pipeworks:storage_tank_"..fill.."_x", { + description = "Fluid Storage Tank ("..filldesc..")", + tiles = { + "pipeworks_storage_tank_fittings.png", + "pipeworks_storage_tank_back.png", + "pipeworks_storage_tank_fittings.png", + "pipeworks_storage_tank_fittings.png", + "pipeworks_storage_tank_back.png", + "pipeworks_storage_tank_front_"..fill..".png" + }, + paramtype = "light", + groups = sgroups, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + after_place_node = function(pos) + pipe_look_for_stackable_tanks(pos) + if string.find(minetest.env:get_node(pos).name, "pipeworks:storage_tank_") ~= nil then + pipe_device_autorotate(pos, nil, "pipeworks:storage_tank_"..fill) + end + pipe_scanforobjects(pos) + end, + after_dig_node = function(pos) + pipe_scanforobjects(pos) + end, + pipelike=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_int("pipelike",1) + end, + }) + + minetest.register_node("pipeworks:storage_tank_"..fill.."_z", { + description = "Fluid Storage Tank (Z axis, "..filldesc..")... You hacker, you.", + tiles = { + "pipeworks_storage_tank_fittings.png", + "pipeworks_storage_tank_back.png", + "pipeworks_storage_tank_front_"..fill..".png", + "pipeworks_storage_tank_back.png", + "pipeworks_storage_tank_fittings.png", + "pipeworks_storage_tank_fittings.png" + }, + paramtype = "light", + groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + drop = "pipeworks:storage_tank_"..fill.."_x", + after_place_node = function(pos) + pipe_look_for_stackable_tanks(pos) + if string.find(minetest.env:get_node(pos).name, "pipeworks:storage_tank_") ~= nil then + pipe_device_autorotate(pos, nil, "pipeworks:storage_tank_"..fill) + end + pipe_scanforobjects(pos) + end, + after_dig_node = function(pos) + pipe_scanforobjects(pos) + end, + pipelike=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_int("pipelike",1) + end, + }) +end + +-- various actions + +local axes = { "x", "z" } + +for a in ipairs(axes) do + minetest.register_on_punchnode(function (pos, node) + if node.name=="pipeworks:valve_on_"..axes[a] then + minetest.env:add_node(pos, { name = "pipeworks:valve_off_"..axes[a] }) + local meta = minetest.env:get_meta(pos) + meta:set_int("pipelike",0) + end + end) + + minetest.register_on_punchnode(function (pos, node) + if node.name=="pipeworks:valve_off_"..axes[a] then + minetest.env:add_node(pos, { name = "pipeworks:valve_on_"..axes[a] }) + local meta = minetest.env:get_meta(pos) + meta:set_int("pipelike",1) + end + end) + + minetest.register_on_punchnode(function (pos, node) + if node.name=="pipeworks:pump_on_"..axes[a] then + minetest.env:add_node(pos, { name = "pipeworks:pump_off_"..axes[a] }) + end + end) + + minetest.register_on_punchnode(function (pos, node) + if node.name=="pipeworks:pump_off_"..axes[a] then + minetest.env:add_node(pos, { name = "pipeworks:pump_on_"..axes[a] }) + end + end) +end + diff --git a/technic/pipeworks/init.lua b/technic/pipeworks/init.lua new file mode 100644 index 0000000..0c6a501 --- /dev/null +++ b/technic/pipeworks/init.lua @@ -0,0 +1,322 @@ +-- Pipeworks mod by Vanessa Ezekowitz - 2012-08-05 +-- +-- Entirely my own code. This mod supplies various shapes of pipes +-- and devices that they can connect to such as pumps, valves, etc. +-- All pipes autoconnect as you lay them out, and devices will auto- +-- connect to them. +-- +-- License: WTFPL +-- + +-- Un-comment the following dofile line to re-enable the old pipe nodes. +-- dofile(minetest.get_modpath("pipeworks").."/oldpipes.lua") + +minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty") + +pipe_leftstub = { + { -32/64, -2/64, -6/64, 1/64, 2/64, 6/64 }, -- pipe segment against -X face + { -32/64, -4/64, -5/64, 1/64, 4/64, 5/64 }, + { -32/64, -5/64, -4/64, 1/64, 5/64, 4/64 }, + { -32/64, -6/64, -2/64, 1/64, 6/64, 2/64 }, + + { -32/64, -3/64, -8/64, -30/64, 3/64, 8/64 }, -- (the flange for it) + { -32/64, -5/64, -7/64, -30/64, 5/64, 7/64 }, + { -32/64, -6/64, -6/64, -30/64, 6/64, 6/64 }, + { -32/64, -7/64, -5/64, -30/64, 7/64, 5/64 }, + { -32/64, -8/64, -3/64, -30/64, 8/64, 3/64 } +} + +pipe_rightstub = { + { -1/64, -2/64, -6/64, 32/64, 2/64, 6/64 }, -- pipe segment against +X face + { -1/64, -4/64, -5/64, 32/64, 4/64, 5/64 }, + { -1/64, -5/64, -4/64, 32/64, 5/64, 4/64 }, + { -1/64, -6/64, -2/64, 32/64, 6/64, 2/64 }, + + { 30/64, -3/64, -8/64, 32/64, 3/64, 8/64 }, -- (the flange for it) + { 30/64, -5/64, -7/64, 32/64, 5/64, 7/64 }, + { 30/64, -6/64, -6/64, 32/64, 6/64, 6/64 }, + { 30/64, -7/64, -5/64, 32/64, 7/64, 5/64 }, + { 30/64, -8/64, -3/64, 32/64, 8/64, 3/64 } +} + +pipe_bottomstub = { + { -2/64, -32/64, -6/64, 2/64, 1/64, 6/64 }, -- pipe segment against -Y face + { -4/64, -32/64, -5/64, 4/64, 1/64, 5/64 }, + { -5/64, -32/64, -4/64, 5/64, 1/64, 4/64 }, + { -6/64, -32/64, -2/64, 6/64, 1/64, 2/64 }, + + { -3/64, -32/64, -8/64, 3/64, -30/64, 8/64 }, -- (the flange for it) + { -5/64, -32/64, -7/64, 5/64, -30/64, 7/64 }, + { -6/64, -32/64, -6/64, 6/64, -30/64, 6/64 }, + { -7/64, -32/64, -5/64, 7/64, -30/64, 5/64 }, + { -8/64, -32/64, -3/64, 8/64, -30/64, 3/64 } +} + + +pipe_topstub = { + { -2/64, -1/64, -6/64, 2/64, 32/64, 6/64 }, -- pipe segment against +Y face + { -4/64, -1/64, -5/64, 4/64, 32/64, 5/64 }, + { -5/64, -1/64, -4/64, 5/64, 32/64, 4/64 }, + { -6/64, -1/64, -2/64, 6/64, 32/64, 2/64 }, + + { -3/64, 30/64, -8/64, 3/64, 32/64, 8/64 }, -- (the flange for it) + { -5/64, 30/64, -7/64, 5/64, 32/64, 7/64 }, + { -6/64, 30/64, -6/64, 6/64, 32/64, 6/64 }, + { -7/64, 30/64, -5/64, 7/64, 32/64, 5/64 }, + { -8/64, 30/64, -3/64, 8/64, 32/64, 3/64 } +} + +pipe_frontstub = { + { -6/64, -2/64, -32/64, 6/64, 2/64, 1/64 }, -- pipe segment against -Z face + { -5/64, -4/64, -32/64, 5/64, 4/64, 1/64 }, + { -4/64, -5/64, -32/64, 4/64, 5/64, 1/64 }, + { -2/64, -6/64, -32/64, 2/64, 6/64, 1/64 }, + + { -8/64, -3/64, -32/64, 8/64, 3/64, -30/64 }, -- (the flange for it) + { -7/64, -5/64, -32/64, 7/64, 5/64, -30/64 }, + { -6/64, -6/64, -32/64, 6/64, 6/64, -30/64 }, + { -5/64, -7/64, -32/64, 5/64, 7/64, -30/64 }, + { -3/64, -8/64, -32/64, 3/64, 8/64, -30/64 } +} + +pipe_backstub = { + { -6/64, -2/64, -1/64, 6/64, 2/64, 32/64 }, -- pipe segment against -Z face + { -5/64, -4/64, -1/64, 5/64, 4/64, 32/64 }, + { -4/64, -5/64, -1/64, 4/64, 5/64, 32/64 }, + { -2/64, -6/64, -1/64, 2/64, 6/64, 32/64 }, + + { -8/64, -3/64, 30/64, 8/64, 3/64, 32/64 }, -- (the flange for it) + { -7/64, -5/64, 30/64, 7/64, 5/64, 32/64 }, + { -6/64, -6/64, 30/64, 6/64, 6/64, 32/64 }, + { -5/64, -7/64, 30/64, 5/64, 7/64, 32/64 }, + { -3/64, -8/64, 30/64, 3/64, 8/64, 32/64 } +} + +pipe_selectboxes = { + { -32/64, -8/64, -8/64, 8/64, 8/64, 8/64 }, + { -8/64 , -8/64, -8/64, 32/64, 8/64, 8/64 }, + { -8/64 , -32/64, -8/64, 8/64, 8/64, 8/64 }, + { -8/64 , -8/64, -8/64, 8/64, 32/64, 8/64 }, + { -8/64 , -8/64, -32/64, 8/64, 8/64, 8/64 }, + { -8/64 , -8/64, -8/64, 8/64, 8/64, 32/64 } +} + +pipe_bendsphere = { + { -4/64, -4/64, -4/64, 4/64, 4/64, 4/64 }, + { -5/64, -3/64, -3/64, 5/64, 3/64, 3/64 }, + { -3/64, -5/64, -3/64, 3/64, 5/64, 3/64 }, + { -3/64, -3/64, -5/64, 3/64, 3/64, 5/64 } +} + +-- Functions + +dbg = function(s) + if DEBUG == 1 then + print('[PIPEWORKS] ' .. s) + end +end + +function pipes_fix_image_names(table, replacement) + outtable={} + for i in ipairs(table) do + outtable[i]=string.gsub(table[i], "_XXXXX", replacement) + end + + return outtable +end + +function pipe_addbox(t, b) + for i in ipairs(b) + do table.insert(t, b[i]) + end +end + +-- now define the nodes! + +for xm = 0, 1 do +for xp = 0, 1 do +for ym = 0, 1 do +for yp = 0, 1 do +for zm = 0, 1 do +for zp = 0, 1 do + local outboxes = {} + local outsel = {} + local outimgs = {} + + if yp==1 then + pipe_addbox(outboxes, pipe_topstub) + table.insert(outsel, pipe_selectboxes[4]) + table.insert(outimgs, "pipeworks_pipe_end.png") + else + table.insert(outimgs, "pipeworks_plain.png") + end + if ym==1 then + pipe_addbox(outboxes, pipe_bottomstub) + table.insert(outsel, pipe_selectboxes[3]) + table.insert(outimgs, "pipeworks_pipe_end.png") + else + table.insert(outimgs, "pipeworks_plain.png") + end + if xp==1 then + pipe_addbox(outboxes, pipe_rightstub) + table.insert(outsel, pipe_selectboxes[2]) + table.insert(outimgs, "pipeworks_pipe_end.png") + else + table.insert(outimgs, "pipeworks_plain.png") + end + if xm==1 then + pipe_addbox(outboxes, pipe_leftstub) + table.insert(outsel, pipe_selectboxes[1]) + table.insert(outimgs, "pipeworks_pipe_end.png") + else + table.insert(outimgs, "pipeworks_plain.png") + end + if zp==1 then + pipe_addbox(outboxes, pipe_backstub) + table.insert(outsel, pipe_selectboxes[6]) + table.insert(outimgs, "pipeworks_pipe_end.png") + else + table.insert(outimgs, "pipeworks_plain.png") + end + if zm==1 then + pipe_addbox(outboxes, pipe_frontstub) + table.insert(outsel, pipe_selectboxes[5]) + table.insert(outimgs, "pipeworks_pipe_end.png") + else + table.insert(outimgs, "pipeworks_plain.png") + end + + local jx = xp+xm + local jy = yp+ym + local jz = zp+zm + + if (jx+jy+jz) == 1 then + if xm == 1 then + table.remove(outimgs, 3) + table.insert(outimgs, 3, "pipeworks_pipe_end_XXXXX.png") + end + if xp == 1 then + table.remove(outimgs, 4) + table.insert(outimgs, 4, "pipeworks_pipe_end_XXXXX.png") + end + if ym == 1 then + table.remove(outimgs, 1) + table.insert(outimgs, 1, "pipeworks_pipe_end_XXXXX.png") + end + if xp == 1 then + table.remove(outimgs, 2) + table.insert(outimgs, 2, "pipeworks_pipe_end_XXXXX.png") + end + if zm == 1 then + table.remove(outimgs, 5) + table.insert(outimgs, 5, "pipeworks_pipe_end_XXXXX.png") + end + if zp == 1 then + table.remove(outimgs, 6) + table.insert(outimgs, 6, "pipeworks_pipe_end_XXXXX.png") + end + end + + if (jx==1 and jy==1 and jz~=1) or (jx==1 and jy~=1 and jz==1) or (jx~= 1 and jy==1 and jz==1) then + pipe_addbox(outboxes, pipe_bendsphere) + end + + if (jx==2 and jy~=2 and jz~=2) then + table.remove(outimgs, 5) + table.remove(outimgs, 5) + table.insert(outimgs, 5, "pipeworks_windowed_XXXXX.png") + table.insert(outimgs, 5, "pipeworks_windowed_XXXXX.png") + end + + if (jx~=2 and jy~=2 and jz==2) or (jx~=2 and jy==2 and jz~=2) then + table.remove(outimgs, 3) + table.remove(outimgs, 3) + table.insert(outimgs, 3, "pipeworks_windowed_XXXXX.png") + table.insert(outimgs, 3, "pipeworks_windowed_XXXXX.png") + end + + local pname = xm..xp..ym..yp..zm..zp + local pgroups = "" + + if pname ~= "110000" then + pgroups = {snappy=3, pipe=1, not_in_creative_inventory=1} + pipedesc = "Pipe segment (empty, "..pname..")... You hacker, you." + else + pgroups = {snappy=3, pipe=1} + pipedesc = "Pipe segment" + end + + minetest.register_node("pipeworks:pipe_"..pname.."_empty", { + description = pipedesc, + drawtype = "nodebox", + tiles = pipes_fix_image_names(outimgs, "_empty"), + paramtype = "light", + selection_box = { + type = "fixed", + fixed = outsel + }, + node_box = { + type = "fixed", + fixed = outboxes + }, + groups = pgroups, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + drop = "pipeworks:pipe_110000_empty", + pipelike=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_int("pipelike",1) + end, + after_place_node = function(pos) + pipe_scanforobjects(pos) + end, + after_dig_node = function(pos) + pipe_scanforobjects(pos) + end, + }) + + minetest.register_node("pipeworks:pipe_"..pname.."_loaded", { + description = "Pipe segment (loaded, "..pname..")... You hacker, you.", + drawtype = "nodebox", + tiles = pipes_fix_image_names(outimgs, "_loaded"), + paramtype = "light", + selection_box = { + type = "fixed", + fixed = outsel + }, + node_box = { + type = "fixed", + fixed = outboxes + }, + groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + drop = "pipeworks:pipe_110000_loaded", + pipelike=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_int("pipelike",1) + end, + after_place_node = function(pos) + pipe_scanforobjects(pos) + end, + after_dig_node = function(pos) + pipe_scanforobjects(pos) + end + }) +end +end +end +end +end +end + +dofile(minetest.get_modpath("pipeworks").."/tubes.lua") +dofile(minetest.get_modpath("pipeworks").."/devices.lua") +dofile(minetest.get_modpath("pipeworks").."/autoplace.lua") +dofile(minetest.get_modpath("pipeworks").."/crafts.lua") + +print("Pipeworks loaded!") diff --git a/technic/pipeworks/oldpipes.lua b/technic/pipeworks/oldpipes.lua new file mode 100644 index 0000000..90c8a27 --- /dev/null +++ b/technic/pipeworks/oldpipes.lua @@ -0,0 +1,360 @@ +-- This file is basically most of the old init.lua and only supplies the +-- old nodes created by the previous verison of Pipeworks. +-- +-- License: WTFPL +-- + +local nodenames = { + "vertical", + "horizontal", + "junction_xy", + "junction_xz", + "bend_xy_down", + "bend_xy_up", + "bend_xz", + "crossing_xz", + "crossing_xy", + "crossing_xyz", + "pipe_segment", + "cap_neg_x", + "cap_pos_x", + "cap_neg_y", + "cap_pos_y", + "cap_neg_z", + "cap_pos_z" +} + +local descriptions = { + "vertical", + "horizontal", + "junction between X and Y axes", + "junction between X and Z axes", + "downward bend between X and Y axes", + "upward bend between X and Y axes", + "bend between X/Z axes", + "4-way crossing between X and Z axes", + "4-way crossing between X/Z and Y axes", + "6-way crossing", + "basic segment", + "capped, negative X half only", + "capped, positive X half only", + "capped, negative Y half only", + "capped, positive Y half only", + "capped, negative Z half only", + "capped, positive Z half only" +} + +local nodeimages = { + {"pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_plain.png", + "pipeworks_plain.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png"}, + + {"pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_plain.png", + "pipeworks_plain.png"}, + + {"pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_plain.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png"}, + + {"pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_plain.png"}, + + {"pipeworks_plain.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_plain.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png"}, + + {"pipeworks_pipe_end.png", + "pipeworks_plain.png", + "pipeworks_pipe_end.png", + "pipeworks_plain.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png"}, + + {"pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_pipe_end.png", + "pipeworks_plain.png", + "pipeworks_pipe_end.png", + "pipeworks_plain.png"}, + + {"pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png"}, + + {"pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png"}, + + {"pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png"}, + +-- horizontal short segment + + {"pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_pipe_end.png", + "pipeworks_pipe_end.png", + "pipeworks_plain.png", + "pipeworks_plain.png"}, + +-- capped + + {"pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_pipe_end.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png"}, + + {"pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_pipe_end.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png"}, + + {"pipeworks_windowed_XXXXX.png", + "pipeworks_pipe_end.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png"}, + + {"pipeworks_pipe_end.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png"}, + + {"pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_pipe_end.png"}, + + {"pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_windowed_XXXXX.png", + "pipeworks_pipe_end.png", + "pipeworks_windowed_XXXXX.png"}, +} + +local selectionboxes = { + { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 }, + { -0.5, -0.15, -0.15, 0.5, 0.15, 0.15 }, + { -0.15, -0.5, -0.15, 0.5, 0.5, 0.15 }, + { -0.5, -0.15, -0.15, 0.5, 0.15, 0.5 }, + { -0.15, -0.5, -0.15, 0.5, 0.15, 0.15 }, + { -0.15, -0.15, -0.15, 0.5, 0.5, 0.15 }, + { -0.15, -0.15, -0.15, 0.5, 0.15, 0.5 }, + { -0.5, -0.15, -0.5, 0.5, 0.15, 0.5 }, + { -0.5, -0.5, -0.15, 0.5, 0.5, 0.15 }, + { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, + { -0.3, -0.15, -0.15, 0.3, 0.15, 0.15 }, + { -0.5, -0.15, -0.15, 0, 0.15, 0.15 }, + { 0, -0.15, -0.15, 0.5, 0.15, 0.15 }, + { -0.15, -0.5, -0.15, 0.15, 0, 0.15 }, + { -0.15, 0, -0.15, 0.15, 0.5, 0.15 }, + { -0.15, -0.15, -0.5, 0.15, 0.15, 0 }, + { -0.15, -0.15, 0, 0.15, 0.15, 0.5 }, +} + +local nodeboxes = { + {{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- vertical + { -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 }, + { -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 }}, + + {{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, -- horizontal + { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 }, + { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }}, + + {{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- vertical with X/Z junction + { -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 }, + { -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 }, + { 0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 }, + { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }}, + + {{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }, -- horizontal with X/Z junction + { -0.1 , -0.1 , 0.1 , 0.1 , 0.1 , 0.45 }, + { -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, + { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 }, + { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }}, + + {{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- bend down from X/Z to Y axis + { -0.1 , -0.45, -0.1 , 0.1 , 0.1 , 0.1 }, + { -0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 }, + { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }}, + + {{ -0.15, 0.45 , -0.15, 0.15, 0.5, 0.15 }, -- bend up from X/Z to Y axis + { -0.1 , -0.1 , -0.1 , 0.1 , 0.45, 0.1 }, + { -0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 }, + { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }}, + + {{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }, -- bend between X and Z axes + { -0.1 , -0.1 , 0.1 , 0.1 , 0.1 , 0.45 }, + { -0.1 , -0.1 , -0.1 , 0.45, 0.1 , 0.1 }, + { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }}, + + {{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, -- 4-way crossing between X and Z axes + { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 }, + { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }, + { -0.15, -0.15, -0.5 , 0.15, 0.15, -0.45 }, + { -0.1 , -0.1 , -0.45, 0.1 , 0.1 , 0.45 }, + { -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }}, + + {{ -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, -- 4-way crossing between X/Z and Y axes + { -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 }, + { -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 }, + { -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, + { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 }, + { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }}, + + {{ -0.5 , -0.15, -0.15, -0.45, 0.15, 0.15 }, -- 6-way crossing (all 3 axes) + { -0.45, -0.1 , -0.1 , 0.45, 0.1 , 0.1 }, + { 0.45, -0.15, -0.15, 0.5 , 0.15, 0.15 }, + { -0.15, -0.15, -0.5 , 0.15, 0.15, -0.45 }, + { -0.1 , -0.1 , -0.45, 0.1 , 0.1 , 0.45 }, + { -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }, + { -0.15, -0.5 , -0.15, 0.15, -0.45, 0.15 }, + { -0.1 , -0.45, -0.1 , 0.1 , 0.45, 0.1 }, + { -0.15, 0.45, -0.15, 0.15, 0.5 , 0.15 }}, + + {{ -0.3 , -0.15, -0.15, -0.25, 0.15, 0.15 }, -- main center segment + { -0.25, -0.1 , -0.1 , 0.25, 0.1 , 0.1 }, + { 0.25, -0.15, -0.15, 0.3 , 0.15, 0.15 }}, + + {{ -0.5, -0.15, -0.15, -0.45, 0.15, 0.15 }, -- anchored at -X + { -0.45, -0.1, -0.1, -0.2, 0.1, 0.1 }, + { -0.2, -0.15, -0.15, -0.15, 0.15, 0.15 }, + { -0.15, -0.12, -0.12, -0.1, 0.12, 0.12 }, + { -0.1, -0.08, -0.08, -0.05, 0.08, 0.08 }, + { -0.05, -0.04, -0.04, 0, 0.04, 0.04 }}, + + {{ 0.45, -0.15, -0.15, 0.5, 0.15, 0.15 }, -- anchored at +X + { 0.2, -0.1, -0.1, 0.45, 0.1, 0.1 }, + { 0.15, -0.15, -0.15, 0.2, 0.15, 0.15 }, + { 0.1, -0.12, -0.12, 0.15, 0.12, 0.12 }, + { 0.05, -0.08, -0.08, 0.1, 0.08, 0.08 }, + { 0, -0.04, -0.04, 0.05, 0.04, 0.04 }}, + + {{ -0.15, -0.5, -0.15, 0.15, -0.45, 0.15 }, -- anchored at -Y + { -0.1, -0.45, -0.1, 0.1, -0.2, 0.1 }, + { -0.15, -0.2, -0.15, 0.15, -0.15, 0.15 }, + { -0.12, -0.15, -0.12, 0.12, -0.1, 0.12 }, + { -0.08, -0.1, -0.08, 0.08, -0.05, 0.08 }, + { -0.04, -0.05, -0.04, 0.04, 0, 0.04 }}, + + {{ -0.15, 0.45, -0.15, 0.15, 0.5, 0.15 }, -- anchored at +Y + { -0.1, 0.2, -0.1, 0.1, 0.45, 0.1 }, + { -0.15, 0.15, -0.15, 0.15, 0.2, 0.15 }, + { -0.12, 0.1, -0.12, 0.12, 0.15, 0.12 }, + { -0.08, 0.05, -0.08, 0.08, 0.1, 0.08 } , + { -0.04, 0, -0.04, 0.04, 0.05, 0.04 }}, + + {{ -0.15, -0.15, -0.5, 0.15, 0.15, -0.45 }, -- anchored at -Z + { -0.1, -0.1, -0.45, 0.1, 0.1, -0.2 }, + { -0.15, -0.15, -0.2, 0.15, 0.15, -0.15 }, + { -0.12, -0.12, -0.15, 0.12, 0.12, -0.1 }, + { -0.08, -0.08, -0.1, 0.08, 0.08, -0.05 }, + { -0.04, -0.04, -0.05, 0.04, 0.04, 0 }}, + + {{ -0.15, -0.15, 0.45, 0.15, 0.15, 0.5 }, -- anchored at +Z + { -0.1, -0.1, 0.2, 0.1, 0.1, 0.45 }, + { -0.15, -0.15, 0.15, 0.15, 0.15, 0.2 }, + { -0.12, -0.12, 0.1, 0.12, 0.12, 0.15 }, + { -0.08, -0.08, 0.05, 0.08, 0.08, 0.1 }, + { -0.04, -0.04, 0, 0.04, 0.04, 0.05 }}, +} + +function fix_image_names(node, replacement) + outtable={} + for i in ipairs(nodeimages[node]) do + outtable[i]=string.gsub(nodeimages[node][i], "_XXXXX", replacement) + end + + return outtable +end + +-- Now define the actual nodes + +for node in ipairs(nodenames) do + + if node ~= 2 then + pgroups = {snappy=3, pipe=1, not_in_creative_inventory=1} + else + pgroups = {snappy=3, pipe=1} + end + + minetest.register_node("pipeworks:"..nodenames[node], { + description = "Empty Pipe ("..descriptions[node]..")", + drawtype = "nodebox", + tiles = fix_image_names(node, "_empty"), + paramtype = "light", + paramtype2 = "facedir", + selection_box = { + type = "fixed", + fixed = selectionboxes[node], + }, + node_box = { + type = "fixed", + fixed = nodeboxes[node] + }, + groups = pgroups, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + drop = "pipeworks:pipe" + }) + + minetest.register_node("pipeworks:"..nodenames[node].."_loaded", { + description = "Loaded Pipe ("..descriptions[node]..")", + drawtype = "nodebox", + tiles = fix_image_names(node, "_loaded"), + paramtype = "light", + paramtype2 = "facedir", + selection_box = { + type = "fixed", + fixed = selectionboxes[node], + }, + node_box = { + type = "fixed", + fixed = nodeboxes[node] + }, + groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + drop = "pipeworks:pipe" + }) +end + diff --git a/technic/pipeworks/textures/pipeworks_intake_sides.png b/technic/pipeworks/textures/pipeworks_intake_sides.png new file mode 100644 index 0000000..5237f0e Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_intake_sides.png differ diff --git a/technic/pipeworks/textures/pipeworks_intake_top.png b/technic/pipeworks/textures/pipeworks_intake_top.png new file mode 100644 index 0000000..3ca91a8 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_intake_top.png differ diff --git a/technic/pipeworks/textures/pipeworks_outlet_sides.png b/technic/pipeworks/textures/pipeworks_outlet_sides.png new file mode 100644 index 0000000..fa85d0c Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_outlet_sides.png differ diff --git a/technic/pipeworks/textures/pipeworks_outlet_top.png b/technic/pipeworks/textures/pipeworks_outlet_top.png new file mode 100644 index 0000000..7de76de Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_outlet_top.png differ diff --git a/technic/pipeworks/textures/pipeworks_pipe_end.png b/technic/pipeworks/textures/pipeworks_pipe_end.png new file mode 100644 index 0000000..cb0e4b9 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_pipe_end.png differ diff --git a/technic/pipeworks/textures/pipeworks_pipe_end_empty.png b/technic/pipeworks/textures/pipeworks_pipe_end_empty.png new file mode 100644 index 0000000..400a85b Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_pipe_end_empty.png differ diff --git a/technic/pipeworks/textures/pipeworks_pipe_end_loaded.png b/technic/pipeworks/textures/pipeworks_pipe_end_loaded.png new file mode 100644 index 0000000..5624b83 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_pipe_end_loaded.png differ diff --git a/technic/pipeworks/textures/pipeworks_plain.png b/technic/pipeworks/textures/pipeworks_plain.png new file mode 100644 index 0000000..3bd1b6a Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_plain.png differ diff --git a/technic/pipeworks/textures/pipeworks_plastic_sheeting.png b/technic/pipeworks/textures/pipeworks_plastic_sheeting.png new file mode 100644 index 0000000..810ea2a Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_plastic_sheeting.png differ diff --git a/technic/pipeworks/textures/pipeworks_pump_ends.png b/technic/pipeworks/textures/pipeworks_pump_ends.png new file mode 100644 index 0000000..a76aea1 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_pump_ends.png differ diff --git a/technic/pipeworks/textures/pipeworks_pump_off.png b/technic/pipeworks/textures/pipeworks_pump_off.png new file mode 100644 index 0000000..4705a9a Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_pump_off.png differ diff --git a/technic/pipeworks/textures/pipeworks_pump_on.png b/technic/pipeworks/textures/pipeworks_pump_on.png new file mode 100644 index 0000000..4f35b08 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_pump_on.png differ diff --git a/technic/pipeworks/textures/pipeworks_pump_sides.png b/technic/pipeworks/textures/pipeworks_pump_sides.png new file mode 100644 index 0000000..14129f7 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_pump_sides.png differ diff --git a/technic/pipeworks/textures/pipeworks_pump_top_x.png b/technic/pipeworks/textures/pipeworks_pump_top_x.png new file mode 100644 index 0000000..9228bdd Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_pump_top_x.png differ diff --git a/technic/pipeworks/textures/pipeworks_pump_top_z.png b/technic/pipeworks/textures/pipeworks_pump_top_z.png new file mode 100644 index 0000000..45837e7 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_pump_top_z.png differ diff --git a/technic/pipeworks/textures/pipeworks_storage_tank_back.png b/technic/pipeworks/textures/pipeworks_storage_tank_back.png new file mode 100644 index 0000000..aeecdf9 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_storage_tank_back.png differ diff --git a/technic/pipeworks/textures/pipeworks_storage_tank_fittings.png b/technic/pipeworks/textures/pipeworks_storage_tank_fittings.png new file mode 100644 index 0000000..2460b86 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_storage_tank_fittings.png differ diff --git a/technic/pipeworks/textures/pipeworks_storage_tank_front_0.png b/technic/pipeworks/textures/pipeworks_storage_tank_front_0.png new file mode 100644 index 0000000..9118285 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_storage_tank_front_0.png differ diff --git a/technic/pipeworks/textures/pipeworks_storage_tank_front_1.png b/technic/pipeworks/textures/pipeworks_storage_tank_front_1.png new file mode 100644 index 0000000..cebd8ef Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_storage_tank_front_1.png differ diff --git a/technic/pipeworks/textures/pipeworks_storage_tank_front_10.png b/technic/pipeworks/textures/pipeworks_storage_tank_front_10.png new file mode 100644 index 0000000..7d1e54e Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_storage_tank_front_10.png differ diff --git a/technic/pipeworks/textures/pipeworks_storage_tank_front_2.png b/technic/pipeworks/textures/pipeworks_storage_tank_front_2.png new file mode 100644 index 0000000..14babe7 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_storage_tank_front_2.png differ diff --git a/technic/pipeworks/textures/pipeworks_storage_tank_front_3.png b/technic/pipeworks/textures/pipeworks_storage_tank_front_3.png new file mode 100644 index 0000000..f479797 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_storage_tank_front_3.png differ diff --git a/technic/pipeworks/textures/pipeworks_storage_tank_front_4.png b/technic/pipeworks/textures/pipeworks_storage_tank_front_4.png new file mode 100644 index 0000000..08e1092 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_storage_tank_front_4.png differ diff --git a/technic/pipeworks/textures/pipeworks_storage_tank_front_5.png b/technic/pipeworks/textures/pipeworks_storage_tank_front_5.png new file mode 100644 index 0000000..8ba4374 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_storage_tank_front_5.png differ diff --git a/technic/pipeworks/textures/pipeworks_storage_tank_front_6.png b/technic/pipeworks/textures/pipeworks_storage_tank_front_6.png new file mode 100644 index 0000000..1647011 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_storage_tank_front_6.png differ diff --git a/technic/pipeworks/textures/pipeworks_storage_tank_front_7.png b/technic/pipeworks/textures/pipeworks_storage_tank_front_7.png new file mode 100644 index 0000000..3ec4f4a Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_storage_tank_front_7.png differ diff --git a/technic/pipeworks/textures/pipeworks_storage_tank_front_8.png b/technic/pipeworks/textures/pipeworks_storage_tank_front_8.png new file mode 100644 index 0000000..0bd0f3f Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_storage_tank_front_8.png differ diff --git a/technic/pipeworks/textures/pipeworks_storage_tank_front_9.png b/technic/pipeworks/textures/pipeworks_storage_tank_front_9.png new file mode 100644 index 0000000..d24c425 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_storage_tank_front_9.png differ diff --git a/technic/pipeworks/textures/pipeworks_testobject.png b/technic/pipeworks/textures/pipeworks_testobject.png new file mode 100644 index 0000000..38f85b7 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_testobject.png differ diff --git a/technic/pipeworks/textures/pipeworks_tube_end.png b/technic/pipeworks/textures/pipeworks_tube_end.png new file mode 100644 index 0000000..e5d7be6 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_tube_end.png differ diff --git a/technic/pipeworks/textures/pipeworks_tube_inv.png b/technic/pipeworks/textures/pipeworks_tube_inv.png new file mode 100644 index 0000000..6646ca1 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_tube_inv.png differ diff --git a/technic/pipeworks/textures/pipeworks_tube_noctr.png b/technic/pipeworks/textures/pipeworks_tube_noctr.png new file mode 100644 index 0000000..a654bba Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_tube_noctr.png differ diff --git a/technic/pipeworks/textures/pipeworks_tube_plain.png b/technic/pipeworks/textures/pipeworks_tube_plain.png new file mode 100644 index 0000000..b2caab0 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_tube_plain.png differ diff --git a/technic/pipeworks/textures/pipeworks_tube_short.png b/technic/pipeworks/textures/pipeworks_tube_short.png new file mode 100644 index 0000000..8576b87 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_tube_short.png differ diff --git a/technic/pipeworks/textures/pipeworks_tube_transparent.png b/technic/pipeworks/textures/pipeworks_tube_transparent.png new file mode 100644 index 0000000..4b4ee1f Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_tube_transparent.png differ diff --git a/technic/pipeworks/textures/pipeworks_valvebody_bottom.png b/technic/pipeworks/textures/pipeworks_valvebody_bottom.png new file mode 100644 index 0000000..05f20e3 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_valvebody_bottom.png differ diff --git a/technic/pipeworks/textures/pipeworks_valvebody_ends.png b/technic/pipeworks/textures/pipeworks_valvebody_ends.png new file mode 100644 index 0000000..2bc3ecb Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_valvebody_ends.png differ diff --git a/technic/pipeworks/textures/pipeworks_valvebody_sides.png b/technic/pipeworks/textures/pipeworks_valvebody_sides.png new file mode 100644 index 0000000..989cbbc Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_valvebody_sides.png differ diff --git a/technic/pipeworks/textures/pipeworks_valvebody_top_off.png b/technic/pipeworks/textures/pipeworks_valvebody_top_off.png new file mode 100644 index 0000000..4ecd7fc Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_valvebody_top_off.png differ diff --git a/technic/pipeworks/textures/pipeworks_valvebody_top_off_x.png b/technic/pipeworks/textures/pipeworks_valvebody_top_off_x.png new file mode 100644 index 0000000..0ab4938 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_valvebody_top_off_x.png differ diff --git a/technic/pipeworks/textures/pipeworks_valvebody_top_off_z.png b/technic/pipeworks/textures/pipeworks_valvebody_top_off_z.png new file mode 100644 index 0000000..d645b2d Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_valvebody_top_off_z.png differ diff --git a/technic/pipeworks/textures/pipeworks_valvebody_top_on.png b/technic/pipeworks/textures/pipeworks_valvebody_top_on.png new file mode 100644 index 0000000..e36eb94 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_valvebody_top_on.png differ diff --git a/technic/pipeworks/textures/pipeworks_valvebody_top_on_x.png b/technic/pipeworks/textures/pipeworks_valvebody_top_on_x.png new file mode 100644 index 0000000..e2d33a0 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_valvebody_top_on_x.png differ diff --git a/technic/pipeworks/textures/pipeworks_valvebody_top_on_z.png b/technic/pipeworks/textures/pipeworks_valvebody_top_on_z.png new file mode 100644 index 0000000..7199797 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_valvebody_top_on_z.png differ diff --git a/technic/pipeworks/textures/pipeworks_windowed_empty.png b/technic/pipeworks/textures/pipeworks_windowed_empty.png new file mode 100644 index 0000000..ebd4486 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_windowed_empty.png differ diff --git a/technic/pipeworks/textures/pipeworks_windowed_loaded.png b/technic/pipeworks/textures/pipeworks_windowed_loaded.png new file mode 100644 index 0000000..91c4829 Binary files /dev/null and b/technic/pipeworks/textures/pipeworks_windowed_loaded.png differ diff --git a/technic/pipeworks/tubes.lua b/technic/pipeworks/tubes.lua new file mode 100644 index 0000000..7a05d92 --- /dev/null +++ b/technic/pipeworks/tubes.lua @@ -0,0 +1,217 @@ +-- This file supplies pneumatic tubes and a 'test' device + +minetest.register_node("pipeworks:testobject", { + description = "Pneumatic tube test ojbect", + tiles = { + "pipeworks_testobject.png", + }, + paramtype = "light", + groups = {snappy=3, tubedevice=1}, + sounds = default.node_sound_wood_defaults(), + walkable = true, + after_place_node = function(pos) + tube_scanforobjects(pos) + end, + after_dig_node = function(pos) + tube_scanforobjects(pos) + end, +}) + +-- tables + +minetest.register_alias("pipeworks:tube", "pipeworks:tube_000000") + +tube_leftstub = { + { -32/64, -9/64, -9/64, 9/64, 9/64, 9/64 }, -- tube segment against -X face +} + +tube_rightstub = { + { -9/64, -9/64, -9/64, 32/64, 9/64, 9/64 }, -- tube segment against +X face +} + +tube_bottomstub = { + { -9/64, -32/64, -9/64, 9/64, 9/64, 9/64 }, -- tube segment against -Y face +} + + +tube_topstub = { + { -9/64, -9/64, -9/64, 9/64, 32/64, 9/64 }, -- tube segment against +Y face +} + +tube_frontstub = { + { -9/64, -9/64, -32/64, 9/64, 9/64, 9/64 }, -- tube segment against -Z face +} + +tube_backstub = { + { -9/64, -9/64, -9/64, 9/64, 9/64, 32/64 }, -- tube segment against -Z face +} + +tube_selectboxes = { + { -32/64, -10/64, -10/64, 10/64, 10/64, 10/64 }, + { -10/64 , -10/64, -10/64, 32/64, 10/64, 10/64 }, + { -10/64 , -32/64, -10/64, 10/64, 10/64, 10/64 }, + { -10/64 , -10/64, -10/64, 10/64, 32/64, 10/64 }, + { -10/64 , -10/64, -32/64, 10/64, 10/64, 10/64 }, + { -10/64 , -10/64, -10/64, 10/64, 10/64, 32/64 } +} + +-- Functions + +function tube_addbox(t, b) + for i in ipairs(b) + do table.insert(t, b[i]) + end +end + +-- now define the nodes! + +for xm = 0, 1 do +for xp = 0, 1 do +for ym = 0, 1 do +for yp = 0, 1 do +for zm = 0, 1 do +for zp = 0, 1 do + local outboxes = {} + local outsel = {} + local outimgs = {} + + if yp==1 then + tube_addbox(outboxes, tube_topstub) + table.insert(outsel, tube_selectboxes[4]) + table.insert(outimgs, "pipeworks_tube_noctr.png") + else + table.insert(outimgs, "pipeworks_tube_plain.png") + end + if ym==1 then + tube_addbox(outboxes, tube_bottomstub) + table.insert(outsel, tube_selectboxes[3]) + table.insert(outimgs, "pipeworks_tube_noctr.png") + else + table.insert(outimgs, "pipeworks_tube_plain.png") + end + if xp==1 then + tube_addbox(outboxes, tube_rightstub) + table.insert(outsel, tube_selectboxes[2]) + table.insert(outimgs, "pipeworks_tube_noctr.png") + else + table.insert(outimgs, "pipeworks_tube_plain.png") + end + if xm==1 then + tube_addbox(outboxes, tube_leftstub) + table.insert(outsel, tube_selectboxes[1]) + table.insert(outimgs, "pipeworks_tube_noctr.png") + else + table.insert(outimgs, "pipeworks_tube_plain.png") + end + if zp==1 then + tube_addbox(outboxes, tube_backstub) + table.insert(outsel, tube_selectboxes[6]) + table.insert(outimgs, "pipeworks_tube_noctr.png") + else + table.insert(outimgs, "pipeworks_tube_plain.png") + end + if zm==1 then + tube_addbox(outboxes, tube_frontstub) + table.insert(outsel, tube_selectboxes[5]) + table.insert(outimgs, "pipeworks_tube_noctr.png") + else + table.insert(outimgs, "pipeworks_tube_plain.png") + end + + local jx = xp+xm + local jy = yp+ym + local jz = zp+zm + + if (jx+jy+jz) == 1 then + if xm == 1 then + table.remove(outimgs, 3) + table.insert(outimgs, 3, "pipeworks_tube_end.png") + end + if xp == 1 then + table.remove(outimgs, 4) + table.insert(outimgs, 4, "pipeworks_tube_end.png") + end + if ym == 1 then + table.remove(outimgs, 1) + table.insert(outimgs, 1, "pipeworks_tube_end.png") + end + if xp == 1 then + table.remove(outimgs, 2) + table.insert(outimgs, 2, "pipeworks_tube_end.png") + end + if zm == 1 then + table.remove(outimgs, 5) + table.insert(outimgs, 5, "pipeworks_tube_end.png") + end + if zp == 1 then + table.remove(outimgs, 6) + table.insert(outimgs, 6, "pipeworks_tube_end.png") + end + end + + local tname = xm..xp..ym..yp..zm..zp + local tgroups = "" + + if tname ~= "000000" then + tgroups = {snappy=3, tube=1, not_in_creative_inventory=1} + tubedesc = "Pneumatic tube segment ("..tname..")... You hacker, you." + iimg=nil + wscale = {x=1,y=1,z=1} + else + tgroups = {snappy=3, tube=1} + tubedesc = "Pneumatic tube segment" + iimg="pipeworks_tube_inv.png" + outimgs = { + "pipeworks_tube_short.png", + "pipeworks_tube_short.png", + "pipeworks_tube_end.png", + "pipeworks_tube_end.png", + "pipeworks_tube_short.png", + "pipeworks_tube_short.png" + } + outboxes = { -24/64, -9/64, -9/64, 24/64, 9/64, 9/64 } + outsel = { -24/64, -10/64, -10/64, 24/64, 10/64, 10/64 } + wscale = {x=1,y=1,z=0.01} + end + + minetest.register_node("pipeworks:tube_"..tname, { + description = tubedesc, + drawtype = "nodebox", + tiles = outimgs, + inventory_image=iimg, + wield_image=iimg, + wield_scale=wscale, + paramtype = "light", + selection_box = { + type = "fixed", + fixed = outsel + }, + node_box = { + type = "fixed", + fixed = outboxes + }, + groups = tgroups, + sounds = default.node_sound_wood_defaults(), + walkable = true, + stack_max = 99, + drop = "pipeworks:tube_000000", + tubelike=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_int("tubelike",1) + end, + after_place_node = function(pos) + tube_scanforobjects(pos) + end, + after_dig_node = function(pos) + tube_scanforobjects(pos) + end + }) + +end +end +end +end +end +end + diff --git a/technic/technic/alloy_furnace.lua b/technic/technic/alloy_furnace.lua new file mode 100644 index 0000000..83496e1 --- /dev/null +++ b/technic/technic/alloy_furnace.lua @@ -0,0 +1,434 @@ +alloy_recipes ={} + +registered_recipes_count=1 + +function register_alloy_recipe (string1,count1, string2,count2, string3,count3) +alloy_recipes[registered_recipes_count]={} +alloy_recipes[registered_recipes_count].src1_name=string1 +alloy_recipes[registered_recipes_count].src1_count=count1 +alloy_recipes[registered_recipes_count].src2_name=string2 +alloy_recipes[registered_recipes_count].src2_count=count2 +alloy_recipes[registered_recipes_count].dst_name=string3 +alloy_recipes[registered_recipes_count].dst_count=count3 +registered_recipes_count=registered_recipes_count+1 +alloy_recipes[registered_recipes_count]={} +alloy_recipes[registered_recipes_count].src1_name=string2 +alloy_recipes[registered_recipes_count].src1_count=count2 +alloy_recipes[registered_recipes_count].src2_name=string1 +alloy_recipes[registered_recipes_count].src2_count=count1 +alloy_recipes[registered_recipes_count].dst_name=string3 +alloy_recipes[registered_recipes_count].dst_count=count3 +registered_recipes_count=registered_recipes_count+1 +if UI_recipes_hook then + minetest.register_craft({ + type = "alloy", + output = string3.." "..count3, + recipe = { + {string1.." "..count1}, + {string2.." "..count2}, + } + }) + end +end + +register_alloy_recipe ("technic:copper_dust",3, "technic:tin_dust",1, "technic:bronze_dust",4) +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:steel_ingot",3, "technic:chromium_ingot",1, "technic:stainless_steel_ingot",4) +register_alloy_recipe ("technic:copper_dust",2, "technic:zinc_dust",1, "technic:brass_dust",3) +register_alloy_recipe ("moreores:copper_ingot",2, "technic:zinc_ingot",1, "technic:brass_ingot",3) +register_alloy_recipe ("default:sand",2, "technic:coal_dust",2, "technic:silicon_wafer",1) +register_alloy_recipe ("technic:silicon_wafer",1, "technic:mithril_dust",1, "technic:doped_silicon_wafer",1) + + +minetest.register_craft({ + output = 'technic:alloy_furnace', + recipe = { + {'default:brick', 'default:brick', 'default:brick'}, + {'default:brick', '', 'default:brick'}, + {'default:steel_ingot', 'moreores:copper_ingot', 'default:steel_ingot'}, + } +}) + + +alloy_furnace_formspec = + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. + "list[current_name;src;3,1;1,1;]".. + "list[current_name;src2;3,2;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]".. + "label[0,0;Electric Alloy Furnace]".. + "label[1,3;Power level]" + +minetest.register_node("technic:alloy_furnace", { + description = "Electric alloy furnace", + tiles = {"technic_alloy_furnace_top.png", "technic_machine_bottom.png", "technic_alloy_furnace_side.png", + "technic_alloy_furnace_side.png", "technic_alloy_furnace_side.png", "technic_alloy_furnace_front.png"}, + paramtype2 = "facedir", + groups = {cracky=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_stone_defaults(), + technic_power_machine=1, + internal_EU_buffer=0; + interal_EU_buffer_size=2000; + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_float("technic_power_machine", 1) + meta:set_string("formspec", alloy_furnace_formspec) + meta:set_string("infotext", "Electric Alloy furnace") + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("src2", 1) + inv:set_size("dst", 4) + local EU_used = 0 + local furnace_is_cookin = 0 + local cooked = nil + meta:set_float("internal_EU_buffer",0) + meta:set_float("internal_EU_buffer_size",2000) + + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false end + if not inv:is_empty("src") then + return false end + if not inv:is_empty("src2") then + return false end + return true + end, +}) + +minetest.register_node("technic:alloy_furnace_active", { + description = "Alloy Furnace", + tiles = {"technic_alloy_furnace_top.png", "technic_machine_bottom.png", "technic_alloy_furnace_side.png", + "technic_alloy_furnace_side.png", "technic_alloy_furnace_side.png", "technic_alloy_furnace_front_active.png"}, + paramtype2 = "facedir", + light_source = 8, + drop = "technic:alloy_furnace", + groups = {cracky=2, not_in_creative_inventory=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_stone_defaults(), + internal_EU_buffer=0; + interal_EU_buffer_size=2000; + technic_power_machine=1, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) + +minetest.register_abm({ + nodenames = {"technic:alloy_furnace","technic:alloy_furnace_active"}, + interval = 1, + chance = 1, + + action = function(pos, node, active_object_count, active_object_count_wider) + + local meta = minetest.env:get_meta(pos) + internal_EU_buffer=meta:get_float("internal_EU_buffer") + internal_EU_buffer_size=meta:get_float("internal_EU_buffer") + local load = math.floor(internal_EU_buffer/2000 * 100) + meta:set_string("formspec", + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "list[current_name;src;3,1;1,1;]".. + "list[current_name;src2;3,2;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]".. + "label[0,0;Electric Alloy Furnace]".. + "label[1,3;Power level]") + + local inv = meta:get_inventory() + + local furnace_is_cookin = meta:get_int("furnace_is_cookin") + + + local srclist = inv:get_list("src") + local srclist2 = inv:get_list("src2") + + srcstack = inv:get_stack("src", 1) + if srcstack then src_item1=srcstack:to_table() end + srcstack = inv:get_stack("src2", 1) + if srcstack then src_item2=srcstack:to_table() end + dst_index=nil + + if src_item1 and src_item2 then + dst_index=get_cook_result(src_item1,src_item2) + end + + + if (furnace_is_cookin == 1) then + if internal_EU_buffer>=150 then + internal_EU_buffer=internal_EU_buffer-150; + meta:set_float("internal_EU_buffer",internal_EU_buffer) + meta:set_float("src_time", meta:get_float("src_time") + 1) + if dst_index and meta:get_float("src_time") >= 4 then + -- check if there's room for output in "dst" list + dst_stack={} + dst_stack["name"]=alloy_recipes[dst_index].dst_name + dst_stack["count"]=alloy_recipes[dst_index].dst_count + if inv:room_for_item("dst",dst_stack) then + -- Put result in "dst" list + inv:add_item("dst",dst_stack) + -- take stuff from "src" list + for i=1,alloy_recipes[dst_index].src1_count,1 do + srcstack = inv:get_stack("src", 1) + srcstack:take_item() + inv:set_stack("src", 1, srcstack) + end + for i=1,alloy_recipes[dst_index].src2_count,1 do + srcstack = inv:get_stack("src2", 1) + srcstack:take_item() + inv:set_stack("src2", 1, srcstack) + end + + + else + print("Furnace inventory full!") + end + meta:set_string("src_time", 0) + end + end + end + + + + + if dst_index and meta:get_int("furnace_is_cookin")==0 then + hacky_swap_node(pos,"technic:alloy_furnace_active") + meta:set_string("infotext","Electric Alloy Furnace active") + meta:set_int("furnace_is_cookin",1) + meta:set_string("src_time", 0) + return + end + + + if meta:get_int("furnace_is_cookin")==0 or dst_index==nil then + hacky_swap_node(pos,"technic:alloy_furnace") + meta:set_string("infotext","Electric Alloy Furnace inactive") + meta:set_int("furnace_is_cookin",0) + meta:set_string("src_time", 0) + end + +end, +}) + +function get_cook_result(src_item1, src_item2) +local counter=registered_recipes_count-1 +for i=1, counter,1 do +if alloy_recipes[i].src1_name==src_item1["name"] and + alloy_recipes[i].src2_name==src_item2["name"] and + alloy_recipes[i].src1_count<=src_item1["count"] and + alloy_recipes[i].src2_count<=src_item2["count"] + then return i end +end +return nil +end + + +--coal driven alloy furnace: + +minetest.register_craft({ + output = 'technic:coal_alloy_furnace', + recipe = { + {'default:brick', 'default:brick', 'default:brick'}, + {'default:brick', '', 'default:brick'}, + {'default:brick', 'default:brick', 'default:brick'}, + } +}) + + +coal_alloy_furnace_formspec = + "size[8,9]".. + "label[0,0;Alloy Furnace]".. + "image[2,2;1,1;default_furnace_fire_bg.png]".. + "list[current_name;fuel;2,3;1,1;]".. + "list[current_name;src;2,1;1,1;]".. + "list[current_name;src2;3,1;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]" + +minetest.register_node("technic:coal_alloy_furnace", { + description = "Alloy Furnace", + tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.png", "technic_coal_alloy_furnace_side.png", + "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front.png"}, + paramtype2 = "facedir", + groups = {cracky=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_stone_defaults(), + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", coal_alloy_furnace_formspec) + meta:set_string("infotext", "Alloy Furnace") + local inv = meta:get_inventory() + inv:set_size("fuel", 1) + inv:set_size("src", 1) + inv:set_size("src2", 1) + inv:set_size("dst", 4) + local furnace_is_cookin = 0 + local dst_index = nil + + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not (inv:is_empty("fuel") or inv:is_empty("dst") or inv:is_empty("src") or inv:is_empty("src2") )then + return false + end + return true + end, +}) + +minetest.register_node("technic:coal_alloy_furnace_active", { + description = "Alloy Furnace", + tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.png", "technic_coal_alloy_furnace_side.png", + "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front_active.png"}, + paramtype2 = "facedir", + light_source = 8, + drop = "technic:coal_alloy_furnace", + groups = {cracky=2, not_in_creative_inventory=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_stone_defaults(), + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not (inv:is_empty("fuel") or inv:is_empty("dst") or inv:is_empty("src") or inv:is_empty("src2") )then + return false + end + return true + end, +}) + +minetest.register_abm({ + nodenames = {"technic:coal_alloy_furnace","technic:coal_alloy_furnace_active"}, + interval = 1, + chance = 1, + + action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.env:get_meta(pos) + for i, name in ipairs({ + "fuel_totaltime", + "fuel_time", + "src_totaltime", + "src_time" + }) do + if meta:get_string(name) == "" then + meta:set_float(name, 0.0) + end + end + + local inv = meta:get_inventory() + + srcstack = inv:get_stack("src", 1) + if srcstack then src_item1=srcstack:to_table() end + srcstack = inv:get_stack("src2", 1) + if srcstack then src_item2=srcstack:to_table() end + dst_index=nil + + if src_item1 and src_item2 then + dst_index=get_cook_result(src_item1,src_item2) + end + + local was_active = false + + if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then + was_active = true + meta:set_float("fuel_time", meta:get_float("fuel_time") + 1) + meta:set_float("src_time", meta:get_float("src_time") + 1) + if dst_index and meta:get_float("src_time") >= 5 then + -- check if there's room for output in "dst" list + dst_stack={} + dst_stack["name"]=alloy_recipes[dst_index].dst_name + dst_stack["count"]=alloy_recipes[dst_index].dst_count + if inv:room_for_item("dst",dst_stack) then + -- Put result in "dst" list + inv:add_item("dst", dst_stack) + -- take stuff from "src" list + for i=1,alloy_recipes[dst_index].src1_count,1 do + srcstack = inv:get_stack("src", 1) + srcstack:take_item() + inv:set_stack("src", 1, srcstack) + end + for i=1,alloy_recipes[dst_index].src2_count,1 do + srcstack = inv:get_stack("src2", 1) + srcstack:take_item() + inv:set_stack("src2", 1, srcstack) + end + else + print("Furnace inventory full!") + end + meta:set_string("src_time", 0) + end + end + + if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then + local percent = math.floor(meta:get_float("fuel_time") / + meta:get_float("fuel_totaltime") * 100) + meta:set_string("infotext","Furnace active: "..percent.."%") + hacky_swap_node(pos,"technic:coal_alloy_furnace_active") + meta:set_string("formspec", + "size[8,9]".. + "label[0,0;Electric Alloy Furnace]".. + "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:".. + (100-percent)..":default_furnace_fire_fg.png]".. + "list[current_name;fuel;2,3;1,1;]".. + "list[current_name;src;2,1;1,1;]".. + "list[current_name;src2;3,1;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]") + return + end + + local fuel = nil + local fuellist = inv:get_list("fuel") + + srcstack = inv:get_stack("src", 1) + if srcstack then src_item1=srcstack:to_table() end + srcstack = inv:get_stack("src2", 1) + if srcstack then src_item2=srcstack:to_table() end + dst_index=nil + + if src_item1 and src_item2 then + dst_index=get_cook_result(src_item1,src_item2) + end + + + if fuellist then + fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) + end + + if fuel.time <= 0 then + meta:set_string("infotext","Furnace out of fuel") + hacky_swap_node(pos,"technic:coal_alloy_furnace") + meta:set_string("formspec", coal_alloy_furnace_formspec) + return + end + + if dst_index==nil then + if was_active then + meta:set_string("infotext","Furnace is empty") + hacky_swap_node(pos,"technic:coal_alloy_furnace") + meta:set_string("formspec", coal_alloy_furnace_formspec) + end + return + end + + meta:set_string("fuel_totaltime", fuel.time) + meta:set_string("fuel_time", 0) + + local stack = inv:get_stack("fuel", 1) + stack:take_item() + inv:set_stack("fuel", 1, stack) + +end, +}) diff --git a/technic/technic/battery_box.lua b/technic/technic/battery_box.lua new file mode 100644 index 0000000..f5827a4 --- /dev/null +++ b/technic/technic/battery_box.lua @@ -0,0 +1,398 @@ +power_tools ={} + +registered_power_tools_count=1 + +function register_power_tool (string1,max_charge) +power_tools[registered_power_tools_count]={} +power_tools[registered_power_tools_count].tool_name=string1 +power_tools[registered_power_tools_count].max_charge=max_charge +registered_power_tools_count=registered_power_tools_count+1 +end + +register_power_tool ("technic:mining_drill",60000) +register_power_tool ("technic:chainsaw",30000) +register_power_tool ("technic:laser_mk1",40000) +register_power_tool ("technic:battery",10000) +register_power_tool ("technic:sonic_screwdriver",15000) +register_power_tool ("technic:flashlight",30000) +register_power_tool ("technic:red_energy_crystal",100000) +register_power_tool ("technic:green_energy_crystal",250000) +register_power_tool ("technic:blue_energy_crystal",500000) + +minetest.register_alias("battery", "technic:battery") +minetest.register_alias("battery_box", "technic:battery_box") + +minetest.register_craft({ + output = 'technic:battery 1', + recipe = { + {'default:wood', 'moreores:copper_ingot', 'default:wood'}, + {'default:wood', 'moreores:tin_ingot', 'default:wood'}, + {'default:wood', 'moreores:copper_ingot', 'default:wood'}, + } +}) + +minetest.register_craft({ + output = 'technic:battery_box 1', + recipe = { + {'technic:battery', 'default:wood', 'technic:battery'}, + {'technic:battery', 'moreores:copper_ingot', 'technic:battery'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + } +}) + + +minetest.register_tool("technic:battery", +{description = "RE Battery", +inventory_image = "technic_battery.png", +tool_capabilities = {load=0,max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}}) + +minetest.register_craftitem("technic:battery_box", { + description = "Battery box", + stack_max = 99, +}) + + + +battery_box_formspec = + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. + "list[current_name;src;3,1;1,1;]".. + "image[4,1;1,1;technic_battery_reload.png]".. + "list[current_name;dst;5,1;1,1;]".. + "label[0,0;Battery box]".. + "label[3,0;Charge]".. + "label[5,0;Discharge]".. + "label[1,3;Power level]".. + "list[current_player;main;0,5;8,4;]" + +minetest.register_node("technic:battery_box", { + description = "Battery box", + tiles = {"technic_battery_box_top.png", "technic_battery_box_bottom.png", "technic_battery_box_side0.png", + "technic_battery_box_side0.png", "technic_battery_box_side0.png", "technic_battery_box_side0.png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + sounds = default.node_sound_wood_defaults(), + technic_power_machine=1, + last_side_shown=0, + drop="technic:battery_box", + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("infotext", "Battery box") + meta:set_float("technic_power_machine", 1) + meta:set_string("formspec", battery_box_formspec) + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("dst", 1) + battery_charge = 0 + max_charge = 60000 + last_side_shown=0 + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) + + +for i=1,8,1 do +minetest.register_node("technic:battery_box"..i, { + description = "Battery box", + tiles = {"technic_battery_box_top.png", "technic_battery_box_bottom.png", "technic_battery_box_side0.png^technic_power_meter"..i..".png", + "technic_battery_box_side0.png^technic_power_meter"..i..".png", "technic_battery_box_side0.png^technic_power_meter"..i..".png", "technic_battery_box_side0.png^technic_power_meter"..i..".png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + technic_power_machine=1, + last_side_shown=0, + drop="technic:battery_box", + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("infotext", "Battery box") + meta:set_float("technic_power_machine", 1) + meta:set_string("formspec", battery_box_formspec) + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("dst", 1) + battery_charge = 0 + max_charge = 60000 + last_side_shown=0 + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) +end + + +LV_nodes_visited = {} + +function get_RE_item_load (load1,max_load) +if load1==0 then load1=65535 end +local temp = 65536-load1 +temp= temp/65535*max_load +return math.floor(temp + 0.5) +end + +function set_RE_item_load (load1,max_load) +if load1 == 0 then return 65535 end +local temp=load1/max_load*65535 +temp=65536-temp +return math.floor(temp) +end + +function set_RE_wear (item_stack,load1,max_load) +local temp=65536-math.floor(load1/max_load*65535) +item_stack["wear"]=tostring(temp) +return item_stack +end + +minetest.register_abm({ + nodenames = {"technic:battery_box","technic:battery_box1","technic:battery_box2","technic:battery_box3","technic:battery_box4", + "technic:battery_box5","technic:battery_box6","technic:battery_box7","technic:battery_box8" + }, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.env:get_meta(pos) + charge= meta:get_int("battery_charge") + max_charge= 60000 + local i=math.ceil((charge/max_charge)*8) + if i>8 then i=8 end + j=meta:get_float("last_side_shown") + if i~=j then + if i>0 then hacky_swap_node(pos,"technic:battery_box"..i) + elseif i==0 then hacky_swap_node(pos,"technic:battery_box") end + meta:set_float("last_side_shown",i) + end + +--loading registered power tools + local inv = meta:get_inventory() + if inv:is_empty("src")==false then + srcstack = inv:get_stack("src", 1) + src_item=srcstack:to_table() + item_meta=srcstack:get_metadata() + if src_item["metadata"]=="" then src_item["metadata"]="0" end --create meta for not used before tool/item + + local item_max_charge = nil + local counter=registered_power_tools_count-1 + for i=1, counter,1 do + if power_tools[i].tool_name==src_item["name"] then + item_max_charge=power_tools[i].max_charge + end + end + if item_max_charge then + load1=tonumber((src_item["metadata"])) + load_step=1000 + if load10 then + if charge-load_step<0 then load_step=charge end + if load1+load_step>item_max_charge then load_step=item_max_charge-load1 end + load1=load1+load_step + charge=charge-load_step + set_RE_wear(src_item,load1,item_max_charge) + src_item["metadata"]=tostring(load1) + inv:set_stack("src", 1, src_item) + end + meta:set_int("battery_charge",charge) + end + end + +-- dischargin registered power tools + if inv:is_empty("dst") == false then + srcstack = inv:get_stack("dst", 1) + src_item=srcstack:to_table() + local item_max_charge = nil + local counter=registered_power_tools_count-1 + for i=1, counter,1 do + if power_tools[i].tool_name==src_item["name"] then + item_max_charge=power_tools[i].max_charge + end + end + if item_max_charge then + if src_item["metadata"]=="" then src_item["metadata"]="0" end --create meta for not used before battery/crystal + local load1=tonumber((src_item["metadata"])) + load_step=1000 + if load1>0 and chargemax_charge then load_step=max_charge-charge end + if load1-load_step<0 then load_step=load1 end + load1=load1-load_step + charge=charge+load_step + set_RE_wear(src_item,load1,item_max_charge) + src_item["metadata"]=tostring(load1) + inv:set_stack("dst", 1, src_item) + end + end + end + + meta:set_int("battery_charge",charge) + + local load = math.floor(charge/60000 * 100) + meta:set_string("formspec", + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "list[current_name;src;3,1;1,1;]".. + "image[4,1;1,1;technic_battery_reload.png]".. + "list[current_name;dst;5,1;1,1;]".. + "label[0,0;Battery box]".. + "label[3,0;Charge]".. + "label[5,0;Discharge]".. + "label[1,3;Power level]".. + "list[current_player;main;0,5;8,4;]") + + local pos1={} + + pos1.y=pos.y-1 + pos1.x=pos.x + pos1.z=pos.z + + + meta1 = minetest.env:get_meta(pos1) + if meta1:get_float("cablelike")~=1 then return end + + local LV_nodes = {} + local PR_nodes = {} + local RE_nodes = {} + + LV_nodes[1]={} + LV_nodes[1].x=pos1.x + LV_nodes[1].y=pos1.y + LV_nodes[1].z=pos1.z + LV_nodes[1].visited=false + + +table_index=1 + repeat + check_LV_node (PR_nodes,RE_nodes,LV_nodes,table_index) + table_index=table_index+1 + if LV_nodes[table_index]==nil then break end + until false + + +local pos1={} +i=1 + repeat + if PR_nodes[i]==nil then break end -- gettin power from all connected producers + pos1.x=PR_nodes[i].x + pos1.y=PR_nodes[i].y + pos1.z=PR_nodes[i].z + local meta1 = minetest.env:get_meta(pos1) + local internal_EU_buffer=meta1:get_float("internal_EU_buffer") + if charge0 then + charge=charge+charge_to_take + internal_EU_buffer=internal_EU_buffer-charge_to_take + meta1:set_float("internal_EU_buffer",internal_EU_buffer) + end + end + i=i+1 + until false + +if charge>max_charge then charge=max_charge end + +i=1 + repeat + if RE_nodes[i]==nil then break end + pos1.x=RE_nodes[i].x -- loading all conected machines buffers + pos1.y=RE_nodes[i].y + pos1.z=RE_nodes[i].z + local meta1 = minetest.env:get_meta(pos1) + local internal_EU_buffer=meta1:get_float("internal_EU_buffer") + local internal_EU_buffer_size=meta1:get_float("internal_EU_buffer_size") + + local charge_to_give=200 + if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then + charge_to_give=internal_EU_buffer_size-internal_EU_buffer + end + if charge-charge_to_give<0 then charge_to_give=charge end + + internal_EU_buffer=internal_EU_buffer+charge_to_give + meta1:set_float("internal_EU_buffer",internal_EU_buffer) + charge=charge-charge_to_give; + + i=i+1 + until false + charge=math.floor(charge) + charge_string=tostring(charge) + meta:set_string("infotext", "Battery box: "..charge_string.."/"..max_charge); + meta:set_int("battery_charge",charge) + +end +}) + +function add_new_cable_node (LV_nodes,pos1) +local i=1 + repeat + if LV_nodes[i]==nil then break end + if pos1.x==LV_nodes[i].x and pos1.y==LV_nodes[i].y and pos1.z==LV_nodes[i].z then return false end + i=i+1 + until false +LV_nodes[i]={} +LV_nodes[i].x=pos1.x +LV_nodes[i].y=pos1.y +LV_nodes[i].z=pos1.z +LV_nodes[i].visited=false +return true +end + +function check_LV_node (PR_nodes,RE_nodes,LV_nodes,i) + local pos1={} + pos1.x=LV_nodes[i].x + pos1.y=LV_nodes[i].y + pos1.z=LV_nodes[i].z + LV_nodes[i].visited=true + new_node_added=false + + pos1.x=pos1.x+1 + check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) + pos1.x=pos1.x-2 + check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) + pos1.x=pos1.x+1 + + pos1.y=pos1.y+1 + check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) + pos1.y=pos1.y-2 + check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) + pos1.y=pos1.y+1 + + pos1.z=pos1.z+1 + check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) + pos1.z=pos1.z-2 + check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) + pos1.z=pos1.z+1 +return new_node_added +end + +function check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) +meta = minetest.env:get_meta(pos1) +if meta:get_float("cablelike")==1 then new_node_added=add_new_cable_node(LV_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:solar_panel" then new_node_added=add_new_cable_node(PR_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:generator" then new_node_added=add_new_cable_node(PR_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:generator_active" then new_node_added=add_new_cable_node(PR_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:geothermal" then new_node_added=add_new_cable_node(PR_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:geothermal_active" then new_node_added=add_new_cable_node(PR_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:water_mill" then new_node_added=add_new_cable_node(PR_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:water_mill_active" then new_node_added=add_new_cable_node(PR_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:electric_furnace" then new_node_added=add_new_cable_node(RE_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:electric_furnace_active" then new_node_added=add_new_cable_node(RE_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:alloy_furnace" then new_node_added=add_new_cable_node(RE_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:alloy_furnace_active" then new_node_added=add_new_cable_node(RE_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:tool_workshop" then new_node_added=add_new_cable_node(RE_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:music_player" then new_node_added=add_new_cable_node(RE_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:grinder" then new_node_added=add_new_cable_node(RE_nodes,pos1) end +end + \ No newline at end of file diff --git a/technic/technic/battery_box_mv.lua b/technic/technic/battery_box_mv.lua new file mode 100644 index 0000000..ae448e0 --- /dev/null +++ b/technic/technic/battery_box_mv.lua @@ -0,0 +1,321 @@ +minetest.register_craft({ + output = 'technic:mv_battery_box 1', + recipe = { + {'technic:battery_box', 'technic:battery_box', 'technic:battery_box'}, + {'technic:battery_box', 'technic:mv_transformer', 'technic:battery_box'}, + {'', 'technic:mv_cable', ''}, + } +}) + + + +mv_battery_box_formspec = + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. + "list[current_name;src;3,1;1,1;]".. + "image[4,1;1,1;technic_battery_reload.png]".. + "list[current_name;dst;5,1;1,1;]".. + "label[0,0;MV_Battery box]".. + "label[3,0;Charge]".. + "label[5,0;Discharge]".. + "label[1,3;Power level]".. + "list[current_player;main;0,5;8,4;]" + +minetest.register_node("technic:mv_battery_box", { + description = "MV Battery Box", + tiles = {"technic_mv_battery_box_top.png", "technic_mv_battery_box_bottom.png", "technic_mv_battery_box_side0.png", + "technic_mv_battery_box_side0.png", "technic_mv_battery_box_side0.png", "technic_mv_battery_box_side0.png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + sounds = default.node_sound_wood_defaults(), + technic_mv_power_machine=1, + last_side_shown=0, + drop="technic:mv_battery_box", + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("infotext", "MV Battery box") + meta:set_float("technic_mv_power_machine", 1) + meta:set_string("formspec", battery_box_formspec) + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("dst", 1) + battery_charge = 0 + max_charge = 300000 + last_side_shown=0 + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) + + +for i=1,8,1 do +minetest.register_node("technic:mv_battery_box"..i, { + description = "MV Battery Box", + tiles = {"technic_mv_battery_box_top.png", "technic_mv_battery_box_bottom.png", "technic_mv_battery_box_side0.png^technic_power_meter"..i..".png", + "technic_mv_battery_box_side0.png^technic_power_meter"..i..".png", "technic_mv_battery_box_side0.png^technic_power_meter"..i..".png", "technic_mv_battery_box_side0.png^technic_power_meter"..i..".png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + technic_power_machine=1, + last_side_shown=0, + drop="technic:mv_battery_box", + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("infotext", "MV Battery box") + meta:set_float("technic_mv_power_machine", 1) + meta:set_string("formspec", battery_box_formspec) + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("dst", 1) + battery_charge = 0 + max_charge = 300000 + last_side_shown=0 + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) +end + + +MV_nodes_visited = {} + + +minetest.register_abm({ + nodenames = {"technic:mv_battery_box","technic:mv_battery_box1","technic:mv_battery_box2","technic:mv_battery_box3","technic:mv_battery_box4", + "technic:mv_battery_box5","technic:mv_battery_box6","technic:mv_battery_box7","technic:mv_battery_box8" + }, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.env:get_meta(pos) + charge= meta:get_int("battery_charge") + max_charge= 300000 + local i=math.ceil((charge/max_charge)*8) + if i>8 then i=8 end + j=meta:get_float("last_side_shown") + if i~=j then + if i>0 then hacky_swap_node(pos,"technic:mv_battery_box"..i) + elseif i==0 then hacky_swap_node(pos,"technic:mv_battery_box") end + meta:set_float("last_side_shown",i) + end + +--loading registered power tools + local inv = meta:get_inventory() + if inv:is_empty("src")==false then + srcstack = inv:get_stack("src", 1) + src_item=srcstack:to_table() + item_meta=srcstack:get_metadata() + if src_item["metadata"]=="" then src_item["metadata"]="0" end --create meta for not used before tool/item + + local item_max_charge = nil + local counter=registered_power_tools_count-1 + for i=1, counter,1 do + if power_tools[i].tool_name==src_item["name"] then + item_max_charge=power_tools[i].max_charge + end + end + if item_max_charge then + load1=tonumber((src_item["metadata"])) + load_step=4000 + if load10 then + if charge-load_step<0 then load_step=charge end + if load1+load_step>item_max_charge then load_step=item_max_charge-load1 end + load1=load1+load_step + charge=charge-load_step + set_RE_wear(src_item,load1,item_max_charge) + src_item["metadata"]=tostring(load1) + inv:set_stack("src", 1, src_item) + end + meta:set_int("battery_charge",charge) + end + end + +-- dischargin registered power tools + if inv:is_empty("dst") == false then + srcstack = inv:get_stack("dst", 1) + src_item=srcstack:to_table() + local item_max_charge = nil + local counter=registered_power_tools_count-1 + for i=1, counter,1 do + if power_tools[i].tool_name==src_item["name"] then + item_max_charge=power_tools[i].max_charge + end + end + if item_max_charge then + if src_item["metadata"]=="" then src_item["metadata"]="0" end --create meta for not used before battery/crystal + local load1=tonumber((src_item["metadata"])) + load_step=4000 + if load1>0 and chargemax_charge then load_step=max_charge-charge end + if load1-load_step<0 then load_step=load1 end + load1=load1-load_step + charge=charge+load_step + set_RE_wear(src_item,load1,item_max_charge) + src_item["metadata"]=tostring(load1) + inv:set_stack("dst", 1, src_item) + end + end + end + + meta:set_int("battery_charge",charge) + + local load = math.floor(charge/300000 * 100) + meta:set_string("formspec", + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "list[current_name;src;3,1;1,1;]".. + "image[4,1;1,1;technic_battery_reload.png]".. + "list[current_name;dst;5,1;1,1;]".. + "label[0,0;MV Battery box]".. + "label[3,0;Charge]".. + "label[5,0;Discharge]".. + "label[1,3;Power level]".. + "list[current_player;main;0,5;8,4;]") + + local pos1={} + + pos1.y=pos.y-1 + pos1.x=pos.x + pos1.z=pos.z + + + meta1 = minetest.env:get_meta(pos1) + if meta1:get_float("mv_cablelike")~=1 then return end + + local MV_nodes = {} + local PR_nodes = {} + local RE_nodes = {} + + MV_nodes[1]={} + MV_nodes[1].x=pos1.x + MV_nodes[1].y=pos1.y + MV_nodes[1].z=pos1.z + MV_nodes[1].visited=false + +table_index=1 + repeat + check_MV_node (PR_nodes,RE_nodes,MV_nodes,table_index) + table_index=table_index+1 + if MV_nodes[table_index]==nil then break end + until false + + +local pos1={} +i=1 + repeat + if PR_nodes[i]==nil then break end -- gettin power from all connected producers + pos1.x=PR_nodes[i].x + pos1.y=PR_nodes[i].y + pos1.z=PR_nodes[i].z + local meta1 = minetest.env:get_meta(pos1) + local internal_EU_buffer=meta1:get_float("internal_EU_buffer") + if charge0 then + charge=charge+charge_to_take + internal_EU_buffer=internal_EU_buffer-charge_to_take + meta1:set_float("internal_EU_buffer",internal_EU_buffer) + end + end + i=i+1 + until false + +if charge>max_charge then charge=max_charge end + +i=1 + repeat + if RE_nodes[i]==nil then break end + pos1.x=RE_nodes[i].x -- loading all conected machines buffers + pos1.y=RE_nodes[i].y + pos1.z=RE_nodes[i].z + local meta1 = minetest.env:get_meta(pos1) + local internal_EU_buffer=meta1:get_float("internal_EU_buffer") + local internal_EU_buffer_size=meta1:get_float("internal_EU_buffer_size") + + local charge_to_give=1000 + if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then + charge_to_give=internal_EU_buffer_size-internal_EU_buffer + end + if charge-charge_to_give<0 then charge_to_give=charge end + + internal_EU_buffer=internal_EU_buffer+charge_to_give + meta1:set_float("internal_EU_buffer",internal_EU_buffer) + charge=charge-charge_to_give; + + i=i+1 + until false + charge=math.floor(charge) + charge_string=tostring(charge) + meta:set_string("infotext", "Battery box: "..charge_string.."/"..max_charge); + meta:set_int("battery_charge",charge) + +end +}) + +function add_new_MVcable_node (MV_nodes,pos1) +local i=1 + repeat + if MV_nodes[i]==nil then break end + if pos1.x==MV_nodes[i].x and pos1.y==MV_nodes[i].y and pos1.z==MV_nodes[i].z then return false end + i=i+1 + until false +MV_nodes[i]={} +MV_nodes[i].x=pos1.x +MV_nodes[i].y=pos1.y +MV_nodes[i].z=pos1.z +MV_nodes[i].visited=false +return true +end + +function check_MV_node (PR_nodes,RE_nodes,MV_nodes,i) + local pos1={} + pos1.x=MV_nodes[i].x + pos1.y=MV_nodes[i].y + pos1.z=MV_nodes[i].z + MV_nodes[i].visited=true + new_node_added=false + + pos1.x=pos1.x+1 + check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) + pos1.x=pos1.x-2 + check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) + pos1.x=pos1.x+1 + + pos1.y=pos1.y+1 + check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) + pos1.y=pos1.y-2 + check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) + pos1.y=pos1.y+1 + + pos1.z=pos1.z+1 + check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) + pos1.z=pos1.z-2 + check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) + pos1.z=pos1.z+1 +return new_node_added +end + +function check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1) +meta = minetest.env:get_meta(pos1) +if meta:get_float("mv_cablelike")==1 then new_node_added=add_new_MVcable_node(MV_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:solar_panel_mv" then new_node_added=add_new_MVcable_node(PR_nodes,pos1) end +end + diff --git a/technic/technic/cans.lua b/technic/technic/cans.lua new file mode 100644 index 0000000..d50a621 --- /dev/null +++ b/technic/technic/cans.lua @@ -0,0 +1,162 @@ +water_can_max_load = 16 +lava_can_max_load = 8 + +minetest.register_craft({ + output = 'technic:water_can 1', + recipe = { + {'technic:zinc_ingot', 'technic:rubber','technic:zinc_ingot'}, + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'technic:zinc_ingot', 'default:steel_ingot', 'technic:zinc_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:lava_can 1', + recipe = { + {'technic:zinc_ingot', 'technic:stainless_steel_ingot','technic:zinc_ingot'}, + {'technic:stainless_steel_ingot', '', 'technic:stainless_steel_ingot'}, + {'technic:zinc_ingot', 'technic:stainless_steel_ingot', 'technic:zinc_ingot'}, + } +}) + + +minetest.register_tool("technic:water_can", { + description = "Water Can", + inventory_image = "technic_water_can.png", + stack_max = 1, + liquids_pointable = true, + on_use = function(itemstack, user, pointed_thing) + + if pointed_thing.type ~= "node" then + return end + n = minetest.env:get_node(pointed_thing.under) + + item=itemstack:to_table() + local load=nil + if item["metadata"]=="" then load=0 + else load=tonumber(item["metadata"]) + end + + if n.name == "default:water_source" then + if load+1<17 then + minetest.env:add_node(pointed_thing.under, {name="air"}) + load=load+1; + item["metadata"]=tostring(load) + set_RE_wear(item,load,water_can_max_load) + itemstack:replace(item) + end + return itemstack + end + item=itemstack:to_table() + if load==0 then return end + + if n.name == "default:water_flowing" then + minetest.env:add_node(pointed_thing.under, {name="default:water_source"}) + load=load-1; + item["metadata"]=tostring(load) + set_RE_wear(item,load,water_can_max_load) + itemstack:replace(item) + return itemstack + end + + n = minetest.env:get_node(pointed_thing.above) + if n.name == "air" then + minetest.env:add_node(pointed_thing.above, {name="default:water_source"}) + load=load-1; + item["metadata"]=tostring(load) + set_RE_wear(item,load,water_can_max_load) + itemstack:replace(item) + return itemstack + end + end, +}) + +minetest.register_tool("technic:lava_can", { + description = "Lava Can", + inventory_image = "technic_lava_can.png", + stack_max = 1, + liquids_pointable = true, + on_use = function(itemstack, user, pointed_thing) + + item=itemstack:to_table() + local load=nil + if item["metadata"]=="" then load=0 + else load=tonumber(item["metadata"]) + end + + if n.name == "default:water_source" then + if load+1<17 then + minetest.env:add_node(pointed_thing.under, {name="air"}) + load=load+1; + item["metadata"]=tostring(load) + set_RE_wear(item,load,water_can_max_load) + itemstack:replace(item) + end + return itemstack + end + item=itemstack:to_table() + if load==0 then return end + + if n.name == "default:lava_flowing" then + minetest.env:add_node(pointed_thing.under, {name="default:lava_source"}) + load=load-1; + item["metadata"]=tostring(load) + set_RE_wear(item,load,water_can_max_load) + itemstack:replace(item) + return itemstack + end + + n = minetest.env:get_node(pointed_thing.above) + if n.name == "air" then + minetest.env:add_node(pointed_thing.above, {name="default:lava_source"}) + load=load-1; + item["metadata"]=tostring(load) + set_RE_wear(item,load,water_can_max_load) + itemstack:replace(item) + return itemstack + end + + if pointed_thing.type ~= "node" then + return end + + n = minetest.env:get_node(pointed_thing.under) + if n.name == "default:lava_source" then + item=itemstack:to_table() + local load=tonumber((item["wear"])) + if load==0 then load =65535 end + load=get_RE_item_load(load,lava_can_max_load) + if load+1<9 then + minetest.env:add_node(pointed_thing.under, {name="air"}) + load=load+1; + load=set_RE_item_load(load,lava_can_max_load) + item["wear"]=tostring(load) + itemstack:replace(item) + end + return itemstack + end + item=itemstack:to_table() + load=tonumber((item["wear"])) + if load==0 then load =65535 end + load=get_RE_item_load(load,lava_can_max_load) + if load==0 then return end + + if n.name == "default:lava_flowing" then + minetest.env:add_node(pointed_thing.under, {name="default:lava_source"}) + load=load-1; + load=set_RE_item_load(load,lava_can_max_load) + item["wear"]=tostring(load) + itemstack:replace(item) + return itemstack + end + + n = minetest.env:get_node(pointed_thing.above) + if n.name == "air" then + minetest.env:add_node(pointed_thing.above, {name="default:lava_source"}) + load=load-1; + load=set_RE_item_load(load,lava_can_max_load) + item["wear"]=tostring(load) + itemstack:replace(item) + return itemstack + end + end, +}) diff --git a/technic/technic/chainsaw.lua b/technic/technic/chainsaw.lua new file mode 100644 index 0000000..9970935 --- /dev/null +++ b/technic/technic/chainsaw.lua @@ -0,0 +1,59 @@ +chainsaw_max_charge=30000 + +minetest.register_tool("technic:chainsaw", { + description = "Chainsaw", + inventory_image = "technic_chainsaw.png", + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type=="node" then + item=itemstack:to_table() + if item["metadata"]=="" or item["metadata"]=="0" then return end --tool not charged + charge=tonumber(item["metadata"]) + charge_to_take=600; + if charge-charge_to_take>0 then + charge_to_take=chainsaw_dig_it(minetest.get_pointed_thing_position(pointed_thing, above),user,charge_to_take) + charge=charge-charge_to_take; + set_RE_wear(item,charge,chainsaw_max_charge) + item["metadata"]=tostring(charge) + itemstack:replace(item) + return itemstack + end + end + end, +}) + +minetest.register_craft({ + output = 'technic:chainsaw', + recipe = { + {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:battery'}, + {'technic:stainless_steel_ingot', 'technic:motor', 'technic:battery'}, + {'','','moreores:copper_ingot'}, + } +}) + + + + +timber_nodenames={"default:jungletree", "default:papyrus", "default:cactus", "default:tree"} + +function chainsaw_dig_it (pos, player,charge_to_take) + charge_to_take=0 + local node=minetest.env:get_node(pos) + local i=1 + while timber_nodenames[i]~=nil do + if node.name==timber_nodenames[i] then + charge_to_take=600 + np={x=pos.x, y=pos.y, z=pos.z} + while minetest.env:get_node(np).name==timber_nodenames[i] do + minetest.env:remove_node(np) + minetest.env:add_item(np, timber_nodenames[i]) + np={x=np.x, y=np.y+1, z=np.z} + end + minetest.sound_play("chainsaw", {pos = pos, gain = 1.0, max_hear_distance = 10,}) + return charge_to_take + end + i=i+1 + end + +return charge_to_take +end \ No newline at end of file diff --git a/technic/technic/concrete.lua b/technic/technic/concrete.lua new file mode 100644 index 0000000..6d031d9 --- /dev/null +++ b/technic/technic/concrete.lua @@ -0,0 +1,83 @@ + +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 4', + recipe = { + {'default:stone','technic:rebar','default:stone'}, + {'default:stone','technic:rebar','default:stone'}, + {'default:stone','technic:rebar','default:stone'}, +} +}) + +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", + inventory_image = "technic_concrete_post.png", + stack_max = 99, +}) + + + +-- NODES: + +minetest.register_node("technic:concrete", { + description = "Concrete Block", + tile_images = {"technic_concrete_block.png",}, + is_ground_content = true, + groups = {cracky=1}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("technic:concrete_post", { + description = "Concrete Post", + drawtype = "fencelike", + tiles = {"technic_concrete_block.png"}, + inventory_image = "default_fence.png", + wield_image = "default_fence.png", + paramtype = "light", + is_ground_content = true, + selection_box = { + type = "fixed", + fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, + }, + + groups = {cracky=1}, + sounds = default.node_sound_stone_defaults(), +}) + +stairsplus.register_stair_and_slab_and_panel_and_micro("concrete", "technic:concrete", + {cracky=3}, + {"technic_concrete_block.png"}, + "Concrete Stairs", + "Concrete Slab", + "Concrete Panel", + "Concrete Microblock", + "concrete") diff --git a/technic/technic/config.lua b/technic/technic/config.lua new file mode 100644 index 0000000..3fa1282 --- /dev/null +++ b/technic/technic/config.lua @@ -0,0 +1,10 @@ +enable_item_drop=false +enable_item_pickup=true +enable_technic_inventory=true +enable_mining_drill=true +enable_mining_laser=true +enable_flashlight=true +enable_rubber_tree_generation=true +enable_marble_generation=true +enable_granite_generation=true +enable_obsidian_generation=true diff --git a/technic/technic/constructor.lua b/technic/technic/constructor.lua new file mode 100644 index 0000000..1e58408 --- /dev/null +++ b/technic/technic/constructor.lua @@ -0,0 +1,297 @@ + +minetest.register_craft({ + type = "shapeless", + output = 'technic:constructor_mk1_off 1', + recipe = {'technic:nodebreaker_off', 'technic:deployer_off'}, + +}) +minetest.register_craft({ + type = "shapeless", + output = 'technic:constructor_mk2_off 1', + recipe = {'technic:constructor_mk1_off', 'technic:constructor_mk1_off'}, + +}) + +minetest.register_craft({ + type = "shapeless", + output = 'technic:constructor_mk3_off 1', + recipe = {'technic:constructor_mk2_off', 'technic:constructor_mk2_off'}, + +}) + +minetest.register_node("technic:constructor_mk1_off", { + description = "Constructor MK1", + tile_images = {"technic_constructor_mk1_top_off.png","technic_constructor_mk1_bottom_off.png","technic_constructor_mk1_side2_off.png","technic_constructor_mk1_side1_off.png", + "technic_constructor_back.png","technic_constructor_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}, + 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;Constructor MK1]".. + "label[5,0;Slot 1]".. + "list[current_name;slot1;6,0;1,1;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Constructor MK1") + local inv = meta:get_inventory() + inv:set_size("slot1", 1) + end, + + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos) + local inv = meta:get_inventory() + return inv:is_empty("slot1") + end, +}) + +minetest.register_node("technic:constructor_mk1_on", { + description = "Constructor MK1", + tile_images = {"technic_constructor_mk1_top_on.png","technic_constructor_mk1_bottom_on.png","technic_constructor_mk1_side2_on.png","technic_constructor_mk1_side1_on.png", + "technic_constructor_back.png","technic_constructor_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,not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), +}) + +mesecon:register_on_signal_on(function(pos, node) + local meta = minetest.env:get_meta(pos) + local inv = meta:get_inventory() + 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:constructor_mk1_off" then + hacky_swap_node(pos,"technic:constructor_mk1_on") + nodeupdate(pos) + local node1=minetest.env:get_node(pos1) + deploy_node (inv,"slot1",pos1,node1,node) + end + +end) + +mesecon:register_on_signal_off(function(pos, node) + if node.name == "technic:constructor_mk1_on" then + hacky_swap_node(pos,"technic:constructor_mk1_off") + nodeupdate(pos) + end +end) + +mesecon:register_effector("technic:constructor_mk1_on", "technic:constructor_mk1_off") + +minetest.register_node("technic:constructor_mk2_off", { + description = "Constructor MK2", + tile_images = {"technic_constructor_mk2_top_off.png","technic_constructor_mk2_bottom_off.png","technic_constructor_mk2_side2_off.png","technic_constructor_mk2_side1_off.png", + "technic_constructor_back.png","technic_constructor_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}, + 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;Constructor MK2]".. + "label[5,0;Slot 1]".. + "list[current_name;slot1;6,0;1,1;]".. + "label[5,1;Slot 2]".. + "list[current_name;slot2;6,1;1,1;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Constructor MK2") + local inv = meta:get_inventory() + inv:set_size("slot1", 1) + inv:set_size("slot2", 1) + end, + + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos) + local inv = meta:get_inventory() + if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false then return false end + return true + end, +}) + +minetest.register_node("technic:constructor_mk2_on", { + description = "Constructor MK2", + tile_images = {"technic_constructor_mk2_top_on.png","technic_constructor_mk2_bottom_on.png","technic_constructor_mk2_side2_on.png","technic_constructor_mk2_side1_on.png", + "technic_constructor_back.png","technic_constructor_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,not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), +}) + +mesecon:register_on_signal_on(function(pos, node) + local meta = minetest.env:get_meta(pos) + local inv = meta:get_inventory() + local pos1={} + local pos2={} + pos1.x=pos.x + pos1.y=pos.y + pos1.z=pos.z + pos2.x=pos.x + pos2.y=pos.y + pos2.z=pos.z + if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 end + if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 end + if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 end + if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 end + + if node.name == "technic:constructor_mk2_off" then + hacky_swap_node(pos,"technic:constructor_mk2_on") + nodeupdate(pos) + local node1=minetest.env:get_node(pos1) + deploy_node (inv,"slot1",pos1,node1,node) + local node1=minetest.env:get_node(pos2) + deploy_node (inv,"slot2",pos2,node1,node) + end + +end) + + +mesecon:register_on_signal_off(function(pos, node) + if node.name == "technic:constructor_mk2_on" then + hacky_swap_node(pos,"technic:constructor_mk2_off") + nodeupdate(pos) + end +end) + +mesecon:register_effector("technic:constructor_mk2_on", "technic:constructor_mk2_off") + +minetest.register_node("technic:constructor_mk3_off", { + description = "Constructor MK3", + tile_images = {"technic_constructor_mk3_top_off.png","technic_constructor_mk3_bottom_off.png","technic_constructor_mk3_side2_off.png","technic_constructor_mk3_side1_off.png", + "technic_constructor_back.png","technic_constructor_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}, + 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;Constructor MK2]".. + "label[5,0;Slot 1]".. + "list[current_name;slot1;6,0;1,1;]".. + "label[5,1;Slot 2]".. + "list[current_name;slot2;6,1;1,1;]".. + "label[5,2;Slot 3]".. + "list[current_name;slot3;6,2;1,1;]".. + "label[5,3;Slot 4]".. + "list[current_name;slot4;6,3;1,1;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Constructor MK3") + local inv = meta:get_inventory() + inv:set_size("slot1", 1) + inv:set_size("slot2", 1) + inv:set_size("slot3", 1) + inv:set_size("slot4", 1) + + end, + + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos) + local inv = meta:get_inventory() + if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false or inv:is_empty("slot3")==false or inv:is_empty("slot4")==false then return false end + return true + end, +}) + +minetest.register_node("technic:constructor_mk3_on", { + description = "Constructor MK3", + tile_images = {"technic_constructor_mk3_top_on.png","technic_constructor_mk3_bottom_on.png","technic_constructor_mk3_side2_on.png","technic_constructor_mk3_side1_on.png", + "technic_constructor_back.png","technic_constructor_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,not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), +}) + +mesecon:register_on_signal_on(function(pos, node) + local meta = minetest.env:get_meta(pos) + local inv = meta:get_inventory() + + local pos1={} + local pos2={} + local pos3={} + local pos4={} + + pos1.x=pos.x + pos1.y=pos.y + pos1.z=pos.z + + pos2.x=pos.x + pos2.y=pos.y + pos2.z=pos.z + + pos3.x=pos.x + pos3.y=pos.y + pos3.z=pos.z + + pos4.x=pos.x + pos4.y=pos.y + pos4.z=pos.z + + if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 pos3.x=pos3.x+3 pos4.x=pos4.x+4 end + if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 pos3.z=pos3.z+3 pos4.z=pos4.z+4 end + if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 pos3.x=pos3.x-3 pos4.x=pos4.x-4 end + if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 pos3.z=pos3.z-3 pos4.z=pos4.z-4 end + + if node.name == "technic:constructor_mk3_off" then + hacky_swap_node(pos,"technic:constructor_mk3_on") + nodeupdate(pos) + local node1=minetest.env:get_node(pos1) + deploy_node (inv,"slot1",pos1,node1,node) + local node1=minetest.env:get_node(pos2) + deploy_node (inv,"slot2",pos2,node1,node) + local node1=minetest.env:get_node(pos3) + deploy_node (inv,"slot3",pos3,node1,node) + local node1=minetest.env:get_node(pos4) + deploy_node (inv,"slot4",pos4,node1,node) + end + +end) + + +mesecon:register_on_signal_off(function(pos, node) + if node.name == "technic:constructor_mk3_on" then + hacky_swap_node(pos,"technic:constructor_mk3_off") + nodeupdate(pos) + end +end) + +mesecon:register_effector("technic:constructor_mk3_on", "technic:constructor_mk3_off") + + +deploy_node =function (inv, slot_name, pos1, node1, node) +if node1.name == "air" then + if not inv:is_empty(slot_name) then + stack1=inv:get_list(slot_name) + node_to_be_placed={name=stack1[1]:get_name(), param1=0, param2=node.param2} + minetest.env:set_node(pos1,node_to_be_placed) + stack1[1]:take_item() + inv:set_stack(slot_name, 1, stack1[1]) + return + end + return + end + if node1.name == "ignore" or + node1.name == "default:lava_source" or + node1.name == "default:lava_flowing" or + node1.name == "default:water_source" or + node1.name == "default:water_flowing" + then return end + if inv:room_for_item(slot_name,node1) then + inv:add_item(slot_name,node1) + minetest.env:remove_node(pos1) + end + +end \ No newline at end of file diff --git a/technic/technic/copper_chest.lua b/technic/technic/copper_chest.lua new file mode 100644 index 0000000..cf1ae06 --- /dev/null +++ b/technic/technic/copper_chest.lua @@ -0,0 +1,162 @@ +minetest.register_craft({ + output = 'technic:copper_chest 1', + recipe = { + {'moreores:copper_ingot','moreores:copper_ingot','moreores:copper_ingot'}, + {'moreores:copper_ingot','technic:iron_chest','moreores:copper_ingot'}, + {'moreores:copper_ingot','moreores:copper_ingot','moreores:copper_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:copper_locked_chest 1', + recipe = { + {'moreores:copper_ingot','moreores:copper_ingot','moreores:copper_ingot'}, + {'moreores:copper_ingot','technic:iron_locked_chest','moreores:copper_ingot'}, + {'moreores:copper_ingot','moreores:copper_ingot','moreores:copper_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:copper_locked_chest 1', + recipe = { + {'default:steel_ingot'}, + {'technic:copper_chest'}, + } +}) + +minetest.register_craftitem("technic:copper_chest", { + description = "Copper Chest", + stack_max = 99, +}) +minetest.register_craftitem("technic:copper_locked_chest", { + description = "Copper Locked Chest", + stack_max = 99, +}) + +minetest.register_node("technic:copper_chest", { + description = "Copper Chest", + tiles = {"technic_copper_chest_top.png", "technic_copper_chest_top.png", "technic_copper_chest_side.png", + "technic_copper_chest_side.png", "technic_copper_chest_side.png", "technic_copper_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[10,9;]".. + "list[current_name;main;0,0;10,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Copper Chest") + local inv = meta:get_inventory() + inv:set_size("main", 10*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_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_move_allow_all( + pos, from_list, from_index, to_list, to_index, count, player) + end, + on_metadata_inventory_offer = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_offer_allow_all( + pos, listname, index, stack, player) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from chest at "..minetest.pos_to_string(pos)) + end, +}) + + +local function has_locked_chest_privilege(meta, player) + if player:get_player_name() ~= meta:get_string("owner") then + return false + end + return true +end + +minetest.register_node("technic:copper_locked_chest", { + description = "Copper Locked Chest", + tiles = {"technic_copper_chest_top.png", "technic_copper_chest_top.png", "technic_copper_chest_side.png", + "technic_copper_chest_side.png", "technic_copper_chest_side.png", "technic_copper_chest_locked.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + after_place_node = function(pos, placer) + local meta = minetest.env:get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Copper Locked Chest (owned by ".. + meta:get_string("owner")..")") + end, +on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "invsize[10,9;]".. + "list[current_name;main;0,0;10,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Copper Locked Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 10*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, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from locked chest at "..minetest.pos_to_string(pos)) + end, +}) diff --git a/technic/technic/creative.lua b/technic/technic/creative.lua new file mode 100644 index 0000000..7b4c493 --- /dev/null +++ b/technic/technic/creative.lua @@ -0,0 +1,21 @@ +technic.creative_inventory_size = 0 +technic.creative_list = {} + +-- Create detached creative inventory after loading all mods +minetest.after(0, function() + local inv = minetest.create_detached_inventory("technic_creative", {}) + technic.creative_list = {} + for name,def in pairs(minetest.registered_items) do + if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) + and def.description and def.description ~= "" then + table.insert(technic.creative_list, name) + end + end + table.sort(technic.creative_list) + --inv:set_size("main", #technic.creative_list) + --for _,itemstring in ipairs(technic.creative_list) do + -- local stack = ItemStack(itemstring) + -- inv:add_item("main", stack) + --end + --technic.creative_inventory_size = #technic.creative_list +end) diff --git a/technic/technic/depends.txt b/technic/technic/depends.txt new file mode 100644 index 0000000..8f4edab --- /dev/null +++ b/technic/technic/depends.txt @@ -0,0 +1,5 @@ +moreores +flowers +pipeworks +mesecons +stairsplus diff --git a/technic/technic/deployer.lua b/technic/technic/deployer.lua new file mode 100644 index 0000000..ce3b735 --- /dev/null +++ b/technic/technic/deployer.lua @@ -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") + + diff --git a/technic/technic/electric.lua b/technic/technic/electric.lua new file mode 100644 index 0000000..2eb2bf3 --- /dev/null +++ b/technic/technic/electric.lua @@ -0,0 +1,268 @@ +power_tools ={} + +registered_power_tools_count=1 + +function register_power_tool (string1,max_charge) +power_tools[registered_power_tools_count]={} +power_tools[registered_power_tools_count].tool_name=string1 +power_tools[registered_power_tools_count].max_charge=max_charge +registered_power_tools_count=registered_power_tools_count+1 +end + +register_power_tool ("technic:mining_drill",60000) +register_power_tool ("technic:laser_mk1",40000) +register_power_tool ("technic:battery",10000) + +minetest.register_alias("battery", "technic:battery") +minetest.register_alias("battery_box", "technic:battery_box") +minetest.register_alias("electric_furnace", "technic:electric_furnace") + + +minetest.register_craft({ + output = 'technic:battery 1', + recipe = { + {'default:wood', 'moreores:copper_ingot', 'default:wood'}, + {'default:wood', 'moreores:tin_ingot', 'default:wood'}, + {'default:wood', 'moreores:copper_ingot', 'default:wood'}, + } +}) + +minetest.register_craft({ + output = 'technic:battery_box 1', + recipe = { + {'technic:battery', 'default:wood', 'technic:battery'}, + {'technic:battery', 'moreores:copper_ingot', 'technic:battery'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:electric_furnace', + recipe = { + {'default:brick', 'default:brick', 'default:brick'}, + {'default:brick', '', 'default:brick'}, + {'default:steel_ingot', 'moreores:copper_ingot', 'default:steel_ingot'}, + } +}) + + +minetest.register_tool("technic:battery", +{description = "RE Battery", +inventory_image = "technic_battery.png", +energy_charge = 0, +tool_capabilities = {max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}}) + +minetest.register_craftitem("technic:battery_box", { + description = "Battery box", + stack_max = 99, +}) + + + +battery_box_formspec = + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. + "list[current_name;src;3,1;1,1;]".. + "image[4,1;1,1;technic_battery_reload.png]".. + "list[current_name;dst;5,1;1,1;]".. + "label[0,0;Battery box]".. + "label[3,0;Charge]".. + "label[5,0;Discharge]".. + "label[1,3;Power level]".. + "list[current_player;main;0,5;8,4;]" + +minetest.register_node("technic:battery_box", { + description = "Battery box", + tiles = {"technic_battery_box_top.png", "technic_battery_box_bottom.png", "technic_battery_box_side.png", + "technic_battery_box_side.png", "technic_battery_box_side.png", "technic_battery_box_side.png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + sounds = default.node_sound_wood_defaults(), + technic_power_machine=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("infotext", "Battery box") + meta:set_float("technic_power_machine", 1) + meta:set_string("formspec", battery_box_formspec) + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("dst", 1) + battery_charge = 0 + max_charge = 60000 + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) + +electric_furnace_formspec = + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. + "list[current_name;src;3,1;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]".. + "label[0,0;Electric Furnace]".. + "label[1,3;Power level]" + +minetest.register_node("technic:electric_furnace", { + description = "Electric furnace", + tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png", + "technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front.png"}, + paramtype2 = "facedir", + groups = {cracky=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_stone_defaults(), + technic_power_machine=1, + internal_EU_buffer=0; + interal_EU_buffer_size=2000; + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_float("technic_power_machine", 1) + meta:set_string("formspec", electric_furnace_formspec) + meta:set_string("infotext", "Electric furnace") + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("dst", 4) + local EU_used = 0 + local furnace_is_cookin = 0 + local cooked = nil + meta:set_float("internal_EU_buffer",0) + meta:set_float("internal_EU_buffer_size",2000) + + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) + +minetest.register_node("technic:electric_furnace_active", { + description = "Electric Furnace", + tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png", + "technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front_active.png"}, + paramtype2 = "facedir", + light_source = 8, + drop = "technic:electric_furnace", + groups = {cracky=2, not_in_creative_inventory=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_stone_defaults(), + internal_EU_buffer=0; + interal_EU_buffer_size=2000; + technic_power_machine=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_float("technic_power_machine", 1) + meta:set_string("formspec", electric_furnace_formspec) + meta:set_string("infotext", "Electric furnace"); + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("dst", 4) + local EU_used = 0 + local furnace_is_cookin = 0 + local cooked = nil + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) + +minetest.register_abm({ + nodenames = {"technic:electric_furnace","technic:electric_furnace_active"}, + interval = 1, + chance = 1, + + action = function(pos, node, active_object_count, active_object_count_wider) + + local meta = minetest.env:get_meta(pos) + internal_EU_buffer=meta:get_float("internal_EU_buffer") + internal_EU_buffer_size=meta:get_float("internal_EU_buffer") + local load = math.floor(internal_EU_buffer/2000 * 100) + meta:set_string("formspec", + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "list[current_name;src;3,1;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]".. + "label[0,0;Electric Furnace]".. + "label[1,3;Power level]") + + local inv = meta:get_inventory() + + local furnace_is_cookin = meta:get_float("furnace_is_cookin") + + + local srclist = inv:get_list("src") + local cooked=nil + + if srclist then + cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + end + + + if (furnace_is_cookin == 1) then + if internal_EU_buffer>=150 then + internal_EU_buffer=internal_EU_buffer-150; + meta:set_float("internal_EU_buffer",internal_EU_buffer) + meta:set_float("src_time", meta:get_float("src_time") + 3) + if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then + -- check if there's room for output in "dst" list + if inv:room_for_item("dst",cooked.item) then + -- Put result in "dst" list + inv:add_item("dst", cooked.item) + -- take stuff from "src" list + srcstack = inv:get_stack("src", 1) + srcstack:take_item() + inv:set_stack("src", 1, srcstack) + else + print("Furnace inventory full!") + end + meta:set_string("src_time", 0) + end + end + end + + + + + if srclist then + cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + if cooked.time>0 then + hacky_swap_node(pos,"technic:electric_furnace_active") + meta:set_string("infotext","Furnace active") + meta:set_string("furnace_is_cookin",1) + -- meta:set_string("formspec", electric_furnace_formspec) + meta:set_string("src_time", 0) + return + end + + end + + hacky_swap_node(pos,"technic:electric_furnace") + meta:set_string("infotext","Furnace inactive") + meta:set_string("furnace_is_cookin",0) + -- meta:set_string("formspec", electric_furnace_formspec) + meta:set_string("src_time", 0) + + +end, +}) \ No newline at end of file diff --git a/technic/technic/electric_furnace.lua b/technic/technic/electric_furnace.lua new file mode 100644 index 0000000..ab56bdb --- /dev/null +++ b/technic/technic/electric_furnace.lua @@ -0,0 +1,178 @@ +minetest.register_alias("electric_furnace", "technic:electric_furnace") + +minetest.register_craft({ + output = 'technic:electric_furnace', + recipe = { + {'default:cobble', 'default:cobble', 'default:cobble'}, + {'default:cobble', '', 'default:cobble'}, + {'default:steel_ingot', 'moreores:copper_ingot', 'default:steel_ingot'}, + } +}) + + +electric_furnace_formspec = + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. + "list[current_name;src;3,1;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]".. + "label[0,0;Electric Furnace]".. + "label[1,3;Power level]" + +minetest.register_node("technic:electric_furnace", { + description = "Electric furnace", + tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png", + "technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front.png"}, + paramtype2 = "facedir", + groups = {cracky=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_stone_defaults(), + technic_power_machine=1, + internal_EU_buffer=0; + interal_EU_buffer_size=2000; + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_float("technic_power_machine", 1) + meta:set_string("formspec", electric_furnace_formspec) + meta:set_string("infotext", "Electric furnace") + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("dst", 4) + local EU_used = 0 + local furnace_is_cookin = 0 + local cooked = nil + meta:set_float("internal_EU_buffer",0) + meta:set_float("internal_EU_buffer_size",2000) + + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) + +minetest.register_node("technic:electric_furnace_active", { + description = "Electric Furnace", + tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png", + "technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front_active.png"}, + paramtype2 = "facedir", + light_source = 8, + drop = "technic:electric_furnace", + groups = {cracky=2, not_in_creative_inventory=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_stone_defaults(), + internal_EU_buffer=0; + interal_EU_buffer_size=2000; + technic_power_machine=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_float("technic_power_machine", 1) + meta:set_string("formspec", electric_furnace_formspec) + meta:set_string("infotext", "Electric furnace"); + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("dst", 4) + local EU_used = 0 + local furnace_is_cookin = 0 + local cooked = nil + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) + +minetest.register_abm({ + nodenames = {"technic:electric_furnace","technic:electric_furnace_active"}, + interval = 1, + chance = 1, + + action = function(pos, node, active_object_count, active_object_count_wider) + + local meta = minetest.env:get_meta(pos) + internal_EU_buffer=meta:get_float("internal_EU_buffer") + internal_EU_buffer_size=meta:get_float("internal_EU_buffer") + local load = math.floor(internal_EU_buffer/2000 * 100) + meta:set_string("formspec", + "invsize[8,9;]".. + "background[-1,-1;10,11;technic_electric_furnace_GUI.png]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "list[current_name;src;3,1;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]".. + "label[0,0;Electric Furnace]".. + "label[1,3;Power level]") + + local inv = meta:get_inventory() + + local furnace_is_cookin = meta:get_float("furnace_is_cookin") + + + local srclist = inv:get_list("src") + local cooked=nil + + if srclist then + cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + end + + + if (furnace_is_cookin == 1) then + if internal_EU_buffer>=150 then + internal_EU_buffer=internal_EU_buffer-150; + meta:set_float("internal_EU_buffer",internal_EU_buffer) + meta:set_float("src_time", meta:get_float("src_time") + 3) + if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then + -- check if there's room for output in "dst" list + if inv:room_for_item("dst",cooked.item) then + -- Put result in "dst" list + inv:add_item("dst", cooked.item) + -- take stuff from "src" list + srcstack = inv:get_stack("src", 1) + srcstack:take_item() + inv:set_stack("src", 1, srcstack) + else + print("Furnace inventory full!") + end + meta:set_string("src_time", 0) + end + end + end + + + + + if srclist then + cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + if cooked.time>0 then + hacky_swap_node(pos,"technic:electric_furnace_active") + meta:set_string("infotext","Furnace active") + meta:set_string("furnace_is_cookin",1) + -- meta:set_string("formspec", electric_furnace_formspec) + meta:set_string("src_time", 0) + return + end + + end + + hacky_swap_node(pos,"technic:electric_furnace") + meta:set_string("infotext","Furnace inactive") + meta:set_string("furnace_is_cookin",0) + -- meta:set_string("formspec", electric_furnace_formspec) + meta:set_string("src_time", 0) + + +end, +}) diff --git a/technic/technic/flashlight.lua b/technic/technic/flashlight.lua new file mode 100644 index 0000000..460cc21 --- /dev/null +++ b/technic/technic/flashlight.lua @@ -0,0 +1,167 @@ +-- original code comes from walkin_light mod by Echo http://minetest.net/forum/viewtopic.php?id=2621 + +flashlight_max_charge=30000 + + minetest.register_tool("technic:flashlight", { + description = "Flashlight", + inventory_image = "technic_flashlight.png", + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + end, + }) + + minetest.register_craft({ + output = "technic:flashlight", + recipe = { + {"technic:rubber","glass","technic:rubber"}, + {"technic:stainless_steel_ingot","technic:battery","technic:stainless_steel_ingot"}, + {"","technic:battery",""} + } + }) +local players = {} +local player_positions = {} +local last_wielded = {} + +function round(num) + return math.floor(num + 0.5) +end + +minetest.register_on_joinplayer(function(player) + local player_name = player:get_player_name() + table.insert(players, player_name) + local pos = player:getpos() + local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)} + player_positions[player_name] = {} + player_positions[player_name]["x"] = rounded_pos.x; + player_positions[player_name]["y"] = rounded_pos.y; + player_positions[player_name]["z"] = rounded_pos.z; +end) + +minetest.register_on_leaveplayer(function(player) + local player_name = player:get_player_name() + for i,v in ipairs(players) do + if v == player_name then + table.remove(players, i) + last_wielded[player_name] = nil + -- Neuberechnung des Lichts erzwingen + local pos = player:getpos() + local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)} + minetest.env:add_node(rounded_pos,{type="node",name="technic:light_off"}) + minetest.env:add_node(rounded_pos,{type="node",name="air"}) + player_positions[player_name]["x"] = nil + player_positions[player_name]["y"] = nil + player_positions[player_name]["z"] = nil + player_positions[player_name]["m"] = nil + player_positions[player_name] = nil + end + end +end) + +minetest.register_globalstep(function(dtime) + for i,player_name in ipairs(players) do + local player = minetest.env:get_player_by_name(player_name) + flashlight_weared=check_for_flashlight(player) + local pos = player:getpos() + local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)} + local old_pos = {x=player_positions[player_name]["x"], y=player_positions[player_name]["y"], z=player_positions[player_name]["z"]} + + if last_wielded[player_name] and not flashlight_weared then --remove light, flashlight weared out or was removed from hotbar + local node=minetest.env:get_node_or_nil(old_pos) + if node then + if node.name=="technic:light" then + minetest.env:add_node(old_pos,{type="node",name="technic:light_off"}) + minetest.env:add_node(old_pos,{type="node",name="air"}) + last_wielded[player_name]=false + end + end + end + + player_moved=not(old_pos.x==rounded_pos.x and old_pos.y==rounded_pos.y and old_pos.z==rounded_pos.z) + if player_moved and last_wielded[player_name] and flashlight_weared then + + local node=minetest.env:get_node_or_nil(rounded_pos) + if node then + if node.name=="air" then + minetest.env:add_node(rounded_pos,{type="node",name="technic:light"}) + end + end + local node=minetest.env:get_node_or_nil(old_pos) + if node then + if node.name=="technic:light" then + minetest.env:add_node(old_pos,{type="node",name="technic:light_off"}) + minetest.env:add_node(old_pos,{type="node",name="air"}) + end + end + player_positions[player_name]["x"] = rounded_pos.x + player_positions[player_name]["y"] = rounded_pos.y + player_positions[player_name]["z"] = rounded_pos.z + + else if not last_wielded[player_name] and flashlight_weared then + local node=minetest.env:get_node_or_nil(rounded_pos) + if node then + if node.name=="air" then + minetest.env:add_node(rounded_pos,{type="node",name="technic:light"}) + end + end + player_positions[player_name]["x"] = rounded_pos.x + player_positions[player_name]["y"] = rounded_pos.y + player_positions[player_name]["z"] = rounded_pos.z + last_wielded[player_name]=true + end + + end + end +end) + +minetest.register_node("technic:light", { + drawtype = "glasslike", + tile_images = {"technic_light.png"}, + paramtype = "light", + walkable = false, + buildable_to = true, + is_ground_content = true, + light_propagates = true, + sunlight_propagates = true, + light_source = 15, + selection_box = { + type = "fixed", + fixed = {0, 0, 0, 0, 0, 0}, + }, +}) +minetest.register_node("technic:light_off", { + drawtype = "glasslike", + tile_images = {"technic_light.png"}, + paramtype = "light", + walkable = false, + buildable_to = true, + is_ground_content = true, + light_propagates = true, + sunlight_propagates = true, + selection_box = { + type = "fixed", + fixed = {0, 0, 0, 0, 0, 0}, + }, +}) + +function check_for_flashlight (player) +if player==nil then return false end +local inv = player:get_inventory() +local hotbar=inv:get_list("main") + for i=1,8,1 do + + if hotbar[i]:get_name() == "technic:flashlight" then + item=hotbar[i]:to_table() + if item["metadata"]=="" or item["metadata"]=="0" then return false end --flashlight not charghed + charge=tonumber(item["metadata"]) + if charge-2>0 then + charge =charge-2; + set_RE_wear(item,charge,flashlight_max_charge) + item["metadata"]=tostring(charge) + hotbar[i]:replace(item) + inv:set_stack("main",i,hotbar[i]) + return true + end + end + end +return false +end \ No newline at end of file diff --git a/technic/technic/flashlight_old.lua b/technic/technic/flashlight_old.lua new file mode 100644 index 0000000..8a2c338 --- /dev/null +++ b/technic/technic/flashlight_old.lua @@ -0,0 +1,176 @@ +-- original code comes from walkin_light mod by Echo http://minetest.net/forum/viewtopic.php?id=2621 + +flashlight_max_charge=30000 + + minetest.register_tool("technic:flashlight", { + description = "Flashlight", + inventory_image = "technic_flashlight.png", + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + end, + }) + + minetest.register_craft({ + output = "technic:flashlight", + recipe = { + {"glass","glass","glass"}, + {"technic:stainless_steel_ingot","technic:battery","technic:stainless_steel_ingot"}, + {"","technic:battery",""} + } + }) +local players = {} +local player_positions = {} +local last_wielded = {} + +function round(num) + return math.floor(num + 0.5) +end + +minetest.register_on_joinplayer(function(player) + local player_name = player:get_player_name() + table.insert(players, player_name) + last_wielded[player_name] = flashlight_weared(player) + local pos = player:getpos() + local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)} + local wielded_item = player:get_wielded_item():get_name() + if flashlight_weared(player)==true then + -- Neuberechnung des Lichts erzwingen + minetest.env:add_node(rounded_pos,{type="node",name="technic:light_off"}) + minetest.env:add_node(rounded_pos,{type="node",name="air"}) + end + player_positions[player_name] = {} + player_positions[player_name]["x"] = rounded_pos.x; + player_positions[player_name]["y"] = rounded_pos.y; + player_positions[player_name]["z"] = rounded_pos.z; +end) + +minetest.register_on_leaveplayer(function(player) + local player_name = player:get_player_name() + for i,v in ipairs(players) do + if v == player_name then + table.remove(players, i) + last_wielded[player_name] = nil + -- Neuberechnung des Lichts erzwingen + local pos = player:getpos() + local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)} + minetest.env:add_node(rounded_pos,{type="node",name="technic:light_off"}) + minetest.env:add_node(rounded_pos,{type="node",name="air"}) + player_positions[player_name]["x"] = nil + player_positions[player_name]["y"] = nil + player_positions[player_name]["z"] = nil + player_positions[player_name]["m"] = nil + player_positions[player_name] = nil + end + end +end) + +minetest.register_globalstep(function(dtime) + for i,player_name in ipairs(players) do + local player = minetest.env:get_player_by_name(player_name) + if flashlight_weared(player)==true then + -- Fackel ist in der Hand + local pos = player:getpos() + local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)} + if (last_wielded[player_name] ~= true) or (player_positions[player_name]["x"] ~= rounded_pos.x or player_positions[player_name]["y"] ~= rounded_pos.y or player_positions[player_name]["z"] ~= rounded_pos.z) then + -- Fackel gerade in die Hand genommen oder zu neuem Node bewegt + local is_air = minetest.env:get_node_or_nil(rounded_pos) + if is_air == nil or (is_air ~= nil and (is_air.name == "air" or is_air.name == "technic:light")) then + -- wenn an aktueller Position "air" ist, Fackellicht setzen + minetest.env:add_node(rounded_pos,{type="node",name="technic:light"}) + end + if (player_positions[player_name]["x"] ~= rounded_pos.x or player_positions[player_name]["y"] ~= rounded_pos.y or player_positions[player_name]["z"] ~= rounded_pos.z) then + -- wenn Position geänder, dann altes Licht löschen + local old_pos = {x=player_positions[player_name]["x"], y=player_positions[player_name]["y"], z=player_positions[player_name]["z"]} + -- Neuberechnung des Lichts erzwingen + local is_light = minetest.env:get_node_or_nil(old_pos) + if is_light ~= nil and is_light.name == "technic:light" then + minetest.env:add_node(old_pos,{type="node",name="technic:light_off"}) + minetest.env:add_node(old_pos,{type="node",name="air"}) + end + end + -- gemerkte Position ist nun die gerundete neue Position + player_positions[player_name]["x"] = rounded_pos.x + player_positions[player_name]["y"] = rounded_pos.y + player_positions[player_name]["z"] = rounded_pos.z + end + + last_wielded[player_name] = true; + elseif last_wielded[player_name] == true then + -- Fackel nicht in der Hand, aber beim letzten Durchgang war die Fackel noch in der Hand + local pos = player:getpos() + local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)} + repeat + local is_light = minetest.env:get_node_or_nil(rounded_pos) + if is_light ~= nil and is_light.name == "technic:light" then + -- minetest.env:remove_node(rounded_pos) + -- Erzwinge Neuberechnung des Lichts + minetest.env:add_node(rounded_pos,{type="node",name="technic:light_off"}) + minetest.env:add_node(rounded_pos,{type="node",name="air"}) + end + until minetest.env:get_node_or_nil(rounded_pos) ~= "technic:light" + local old_pos = {x=player_positions[player_name]["x"], y=player_positions[player_name]["y"], z=player_positions[player_name]["z"]} + repeat + is_light = minetest.env:get_node_or_nil(old_pos) + if is_light ~= nil and is_light.name == "technic:light" then + -- minetest.env:remove_node(old_pos) + -- Erzwinge Neuberechnung des Lichts + minetest.env:add_node(old_pos,{type="node",name="technic:light_off"}) + minetest.env:add_node(old_pos,{type="node",name="air"}) + end + until minetest.env:get_node_or_nil(old_pos) ~= "technic:light" + last_wielded[player_name] = true + end + end +end) + +minetest.register_node("technic:light", { + drawtype = "glasslike", + tile_images = {"technic_light.png"}, + paramtype = "light", + walkable = false, + is_ground_content = true, + light_propagates = true, + sunlight_propagates = true, + light_source = 15, + selection_box = { + type = "fixed", + fixed = {0, 0, 0, 0, 0, 0}, + }, +}) +minetest.register_node("technic:light_off", { + drawtype = "glasslike", + tile_images = {"technic_light.png"}, + paramtype = "light", + walkable = false, + is_ground_content = true, + light_propagates = true, + sunlight_propagates = true, + selection_box = { + type = "fixed", + fixed = {0, 0, 0, 0, 0, 0}, + }, +}) + +function flashlight_weared (player) +flashlight_on=false +local inv = player:get_inventory() +local hotbar=inv:get_list("main") + for i=1,8,1 do + + if hotbar[i]:get_name() == "technic:flashlight" then + item=hotbar[i]:to_table() + if item["metadata"]=="" or item["metadata"]=="0" then return flashlight_on end --flashlight not charghed + charge=tonumber(item["metadata"]) + if charge-2>0 then + flashlight_on=true + charge =charge-2; + set_RE_wear(item,charge,flashlight_max_charge) + item["metadata"]=tostring(charge) + hotbar[i]:replace(item) + inv:set_stack("main",i,hotbar[i]) + return true + end + end + end +return flashlight_on +end \ No newline at end of file diff --git a/technic/technic/generator.lua b/technic/technic/generator.lua new file mode 100644 index 0000000..c8ac802 --- /dev/null +++ b/technic/technic/generator.lua @@ -0,0 +1,148 @@ +minetest.register_alias("generator", "technic:generator") +minetest.register_alias("generator", "technic:generator_active") + +minetest.register_craft({ + output = 'technic:generator', + recipe = { + {'default:stone', 'default:stone', 'default:stone'}, + {'default:stone', '', 'default:stone'}, + {'default:stone', 'moreores:copper_ingot', 'default:stone'}, + } +}) + +minetest.register_craftitem("technic:generator", { + description = "Coal Driven Generator", + stack_max = 99, +}) + +generator_formspec = + "invsize[8,9;]".. + "image[0,0;5,5;technic_generator_menu.png]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. +-- "label[0,0;Generator]".. + "label[1,3;Power level]".. + "list[current_name;src;3,1;1,1;]".. + "image[4,1;1,1;default_furnace_fire_bg.png]".. + "list[current_player;main;0,5;8,4;]" + + +minetest.register_node("technic:generator", { + description = "Coal Driven Generator", + tiles = {"technic_generator_top.png", "technic_machine_bottom.png", "technic_generator_side.png", + "technic_generator_side.png", "technic_generator_side.png", "technic_generator_front.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + technic_power_machine=1, + internal_EU_buffer=0; + internal_EU_buffer_size=5000; + burn_time=0; + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("infotext", "Generator") + meta:set_float("technic_power_machine", 1) + meta:set_float("internal_EU_buffer", 0) + meta:set_float("internal_EU_buffer_size", 5000) + meta:set_string("formspec", generator_formspec) + meta:set_float("burn_time", 0) + + local inv = meta:get_inventory() + inv:set_size("src", 1) + + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("src") then + return false + end + return true + end, + +}) + +minetest.register_node("technic:generator_active", { + description = "Coal Driven Generator", + tiles = {"technic_generator_top.png", "technic_machine_bottom.png", "technic_generator_side.png", + "technic_generator_side.png", "technic_generator_side.png", "technic_generator_front_active.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + drop="technic:generator", + technic_power_machine=1, + internal_EU_buffer=0; + internal_EU_buffer_size=0; + burn_time=0; + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("src") then + return false + end + return true + end, + +}) +minetest.register_abm({ + nodenames = {"technic:generator","technic:generator_active"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + + local meta = minetest.env:get_meta(pos) + local burn_time= meta:get_float("burn_time") + local charge= meta:get_float("internal_EU_buffer") + local max_charge= meta:get_float("internal_EU_buffer_size") + local burn_charge=200 + + if burn_time>0 then + if charge+burn_charge>max_charge then + burn_charge=max_charge-charge + end + if burn_charge>0 then + burn_time=burn_time-1 + meta:set_float("burn_time",burn_time) + charge=charge+burn_charge + meta:set_float("internal_EU_buffer",charge) + end + + end + if burn_time==0 then + local inv = meta:get_inventory() + if inv:is_empty("src")==false then + local srcstack = inv:get_stack("src", 1) + src_item=srcstack:to_table() + if src_item["name"]== "default:coal_lump" then + srcstack:take_item() + inv:set_stack("src", 1, srcstack) + burn_time=16 + meta:set_float("burn_time",burn_time) + hacky_swap_node (pos,"technic:generator_active") + end + end + end + + local load = math.floor((charge/max_charge)*100) + local percent = math.floor((burn_time/16)*100) + meta:set_string("formspec", + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "label[0,0;Generator]".. + "label[1,3;Power level]".. + "list[current_name;src;3,1;1,1;]".. + "image[4,1;1,1;default_furnace_fire_bg.png^[lowpart:".. + (percent)..":default_furnace_fire_fg.png]".. + "list[current_player;main;0,5;8,4;]" + ) + + if burn_time==0 then + hacky_swap_node (pos,"technic:generator") + end + + + end +}) + diff --git a/technic/technic/geothermal.lua b/technic/technic/geothermal.lua new file mode 100644 index 0000000..8f3a7d7 --- /dev/null +++ b/technic/technic/geothermal.lua @@ -0,0 +1,135 @@ +minetest.register_alias("geothermal", "technic:geothermal") + +minetest.register_craft({ + output = 'technic:geothermal', + recipe = { + {'default:stone', 'default:stone', 'default:stone'}, + {'moreores:copper_ingot', 'technic:diamond', 'moreores:copper_ingot'}, + {'default:stone', 'moreores:copper_ingot', 'default:stone'}, + } +}) + +minetest.register_craftitem("technic:geothermal", { + description = "Geothermal Generator", + stack_max = 99, +}) + +geothermal_formspec = + "invsize[8,4;]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. + "label[0,0;Geothermal Generator]".. + "label[1,3;Power level]".. + "list[current_player;main;0,5;8,4;]" + + +minetest.register_node("technic:geothermal", { + description = "Geothermal Generator", + tiles = {"technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png", + "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + technic_power_machine=1, + internal_EU_buffer=0; + internal_EU_buffer_size=5000; + burn_time=0; + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("infotext", "Geothermal Generator") + meta:set_float("technic_power_machine", 1) + meta:set_float("internal_EU_buffer", 0) + meta:set_float("internal_EU_buffer_size", 2000) + meta:set_string("formspec", geothermal_formspec) + end, + +}) + +minetest.register_node("technic:geothermal_active", { + description = "Geothermal Generator", + tiles = {"technic_geothermal_top_active.png", "technic_machine_bottom.png", "technic_geothermal_side.png", + "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + drop="technic:geothermal", + technic_power_machine=1, + internal_EU_buffer=0; + internal_EU_buffer_size=0; +}) + +minetest.register_abm({ + nodenames = {"technic:geothermal","technic:geothermal_active"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + + local meta = minetest.env:get_meta(pos) + local charge= meta:get_float("internal_EU_buffer") + local max_charge= meta:get_float("internal_EU_buffer_size") + local water_nodes = 0 + local lava_nodes = 0 + local production_level=0 + local load_step=0 + + pos.x=pos.x+1 + local check=check_node_around (pos) + if check==1 then water_nodes=water_nodes+1 end + if check==2 then lava_nodes=lava_nodes+1 end + pos.x=pos.x-2 + check=check_node_around (pos) + if check==1 then water_nodes=water_nodes+1 end + if check==2 then lava_nodes=lava_nodes+1 end + pos.x=pos.x+1 + pos.z=pos.z+1 + check=check_node_around (pos) + if check==1 then water_nodes=water_nodes+1 end + if check==2 then lava_nodes=lava_nodes+1 end + pos.z=pos.z-2 + check=check_node_around (pos) + if check==1 then water_nodes=water_nodes+1 end + if check==2 then lava_nodes=lava_nodes+1 end + pos.z=pos.z+1 + + if water_nodes==1 and lava_nodes==1 then production_level=50 load_step=30 end + if water_nodes==2 and lava_nodes==1 then production_level=75 load_step=45 end + if water_nodes==1 and lava_nodes==2 then production_level=75 load_step=45 end + if water_nodes==2 and lava_nodes==2 then production_level=100 load_step=60 end + if water_nodes==3 and lava_nodes==1 then production_level=25 load_step=15 end + if water_nodes==1 and lava_nodes==3 then production_level=25 load_step=15 end + + if production_level>0 then + if charge+load_step>max_charge then + load_step=max_charge-charge + end + if load_step>0 then + charge=charge+load_step + meta:set_float("internal_EU_buffer",charge) + end + end + + local load = math.floor((charge/max_charge)*100) + meta:set_string("formspec", + "invsize[8,4;]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "label[0,0;Geothermal Generator]".. + "label[1,3;Power level]".. + "label[4,0;Production at "..tostring(production_level).."%]" + ) + + if production_level>0 and minetest.env:get_node(pos).name=="technic:geothermal" then + hacky_swap_node (pos,"technic:geothermal_active") + return + end + if production_level==0 then hacky_swap_node (pos,"technic:geothermal") end +end +}) + +function check_node_around (pos) +local node=minetest.env:get_node(pos) +if node.name=="default:water_source" or node.name=="default:water_flowing" then return 1 end +if node.name=="default:lava_source" or node.name=="default:lava_flowing" then return 2 end +return 0 +end \ No newline at end of file diff --git a/technic/technic/gold_chest.lua b/technic/technic/gold_chest.lua new file mode 100644 index 0000000..29f1666 --- /dev/null +++ b/technic/technic/gold_chest.lua @@ -0,0 +1,611 @@ +local chest_mark_colors = { + '_black', + '_blue', + '_brown', + '_cyan', + '_dark_green', + '_dark_grey', + '_green', + '_grey', + '_magenta', + '_orange', + '_pink', + '_red', + '_violet', + '_white', + '_yellow', +} + +minetest.register_craft({ + output = 'technic:gold_chest 1', + recipe = { + {'moreores:gold_ingot','moreores:gold_ingot','moreores:gold_ingot'}, + {'moreores:gold_ingot','technic:silver_chest','moreores:gold_ingot'}, + {'moreores:gold_ingot','moreores:gold_ingot','moreores:gold_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:gold_locked_chest 1', + recipe = { + {'moreores:gold_ingot','moreores:gold_ingot','moreores:gold_ingot'}, + {'moreores:gold_ingot','technic:silver_locked_chest','moreores:gold_ingot'}, + {'moreores:gold_ingot','moreores:gold_ingot','moreores:gold_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:gold_locked_chest 1', + recipe = { + {'default:steel_ingot'}, + {'technic:gold_chest'}, + } +}) + +minetest.register_craftitem("technic:gold_chest", { + description = "Gold Chest", + stack_max = 99, +}) +minetest.register_craftitem("technic:gold_locked_chest", { + description = "Gold Locked Chest", + stack_max = 99, +}) + +minetest.register_node("technic:gold_chest", { + description = "Gold Chest", + tiles = {"technic_gold_chest_top.png", "technic_gold_chest_top.png", "technic_gold_chest_side.png", + "technic_gold_chest_side.png", "technic_gold_chest_side.png", "technic_gold_chest_front.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, + 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[12,9;]".. + "list[current_name;main;0,0;12,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Gold Chest") + local inv = meta:get_inventory() + inv:set_size("main", 12*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) + chest_punched (pos,node,puncher); + end, + + on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.env:get_meta(pos); + fields.text = fields.text or "" + meta:set_string("text", fields.text) + meta:set_string("infotext", '"'..fields.text..'"') + + meta:set_string("formspec", + "invsize[12,9;]".. + "list[current_name;main;0,0;12,4;]".. + "list[current_player;main;0,5;8,4;]") + end, + + on_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_move_allow_all( + pos, from_list, from_index, to_list, to_index, count, player) + end, + on_metadata_inventory_offer = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_offer_allow_all( + pos, listname, index, stack, player) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from chest at "..minetest.pos_to_string(pos)) + end, +}) + +for i, state in ipairs(chest_mark_colors) do +minetest.register_node("technic:gold_chest".. state, { + description = "Gold Chest", + tiles = {"technic_gold_chest_top.png", "technic_gold_chest_top.png", "technic_gold_chest_side.png", + "technic_gold_chest_side.png", "technic_gold_chest_side.png", "technic_gold_chest_front"..state..".png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, not_in_creative_inventory=1,tubedevice=1,tubedevice_receiver=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + drop = "technic:gold_chest", + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "invsize[12,9;]".. + "list[current_name;main;0,0;12,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Gold Chest") + local inv = meta:get_inventory() + inv:set_size("main", 12*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) + chest_punched (pos,node,puncher); + end, + + on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.env:get_meta(pos); + fields.text = fields.text or "" + meta:set_string("text", fields.text) + meta:set_string("infotext", '"'..fields.text..'"') + + meta:set_string("formspec", + "invsize[12,9;]".. + "list[current_name;main;0,0;12,4;]".. + "list[current_player;main;0,5;8,4;]") + end, + + on_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_move_allow_all( + pos, from_list, from_index, to_list, to_index, count, player) + end, + on_metadata_inventory_offer = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_offer_allow_all( + pos, listname, index, stack, player) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from chest at "..minetest.pos_to_string(pos)) + end, +}) +end + + +local function has_locked_chest_privilege(meta, player) + if player:get_player_name() ~= meta:get_string("owner") then + return false + end + return true +end + +minetest.register_node("technic:gold_locked_chest", { + description = "Gold Locked Chest", + tiles = {"technic_gold_chest_top.png", "technic_gold_chest_top.png", "technic_gold_chest_side.png", + "technic_gold_chest_side.png", "technic_gold_chest_side.png", "technic_gold_chest_locked.png"}, + paramtype2 = "facedir", + drop = "technic:gold_locked_chest", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + after_place_node = function(pos, placer) + local meta = minetest.env:get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Gold Locked Chest (owned by ".. + meta:get_string("owner")..")") + end, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "invsize[12,9;]".. + "list[current_name;main;0,0;12,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Gold Locked Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 12*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); + if (has_locked_chest_privilege(meta, puncher)) then + locked_chest_punched (pos,node,puncher); + end + end, + + on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.env:get_meta(pos); + fields.text = fields.text or "" + meta:set_string("text", fields.text) + meta:set_string("infotext", '"'..fields.text..'"') + + meta:set_string("formspec", + "invsize[12,9;]".. + "list[current_name;main;0,0;12,4;]".. + "list[current_player;main;0,5;8,4;]") + end, + + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from locked chest at "..minetest.pos_to_string(pos)) + end, +}) + +for i, state in ipairs(chest_mark_colors) do +minetest.register_node("technic:gold_locked_chest".. state, { + description = "Gold Locked Chest", + tiles = {"technic_gold_chest_top.png", "technic_gold_chest_top.png", "technic_gold_chest_side.png", + "technic_gold_chest_side.png", "technic_gold_chest_side.png", "technic_gold_chest_locked"..state..".png"}, + paramtype2 = "facedir", + drop = "technic:gold_locked_chest", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, not_in_creative_inventory=1,tubedevice=1,tubedevice_receiver=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + after_place_node = function(pos, placer) + local meta = minetest.env:get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Gold Locked Chest (owned by ".. + meta:get_string("owner")..")") + end, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "invsize[12,9;]".. + "list[current_name;main;0,0;12,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Gold Locked Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 12*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); + if (has_locked_chest_privilege(meta, puncher)) then + locked_chest_punched (pos,node,puncher); + end + end, + + on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.env:get_meta(pos); + fields.text = fields.text or "" + meta:set_string("text", fields.text) + meta:set_string("infotext", '"'..fields.text..'"') + + meta:set_string("formspec", + "invsize[12,9;]".. + "list[current_name;main;0,0;12,4;]".. + "list[current_player;main;0,5;8,4;]") + end, + + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from locked chest at "..minetest.pos_to_string(pos)) + end, +}) +end + +function chest_punched (pos,node,puncher) + + local player_tool = puncher:get_wielded_item(); + local item=player_tool:get_name(); + if item == "dye:black" then + if (hacky_swap_node(pos,"technic:gold_chest_black")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:blue" then + if (hacky_swap_node(pos,"technic:gold_chest_blue")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:brown" then + if (hacky_swap_node(pos,"technic:gold_chest_brown")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:cyan" then + if (hacky_swap_node(pos,"technic:gold_chest_cyan")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:dark_green" then + if (hacky_swap_node(pos,"technic:gold_chest_dark_green")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:dark_grey" then + if (hacky_swap_node(pos,"technic:gold_chest_dark_grey")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:green" then + if (hacky_swap_node(pos,"technic:gold_chest_green")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:grey" then + if (hacky_swap_node(pos,"technic:gold_chest_grey")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:magenta" then + if (hacky_swap_node(pos,"technic:gold_chest_magenta")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:orange" then + if (hacky_swap_node(pos,"technic:gold_chest_orange")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:pink" then + if (hacky_swap_node(pos,"technic:gold_chest_pink")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:red" then + if (hacky_swap_node(pos,"technic:gold_chest_red")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:violet" then + if (hacky_swap_node(pos,"technic:gold_chest_violet")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:white" then + if (hacky_swap_node(pos,"technic:gold_chest_white")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:yellow" then + if (hacky_swap_node(pos,"technic:gold_chest_yellow")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + + local meta = minetest.env:get_meta(pos); + meta:set_string("formspec", "hack:sign_text_input") + end + + +function locked_chest_punched (pos,node,puncher) + + local player_tool = puncher:get_wielded_item(); + local item=player_tool:get_name(); + if item == "dye:black" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_black")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:blue" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_blue")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:brown" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_brown")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:cyan" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_cyan")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:dark_green" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_dark_green")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:dark_grey" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_dark_grey")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:green" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_green")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:grey" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_grey")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:magenta" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_magenta")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:orange" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_orange")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:pink" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_pink")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:red" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_red")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:violet" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_violet")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:white" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_white")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + if item == "dye:yellow" then + if (hacky_swap_node(pos,"technic:gold_locked_chest_yellow")) then + player_tool:take_item(1); + puncher:set_wielded_item(player_tool); + return + end + end + + local meta = minetest.env:get_meta(pos); + meta:set_string("formspec", "hack:sign_text_input") + end + \ No newline at end of file diff --git a/technic/technic/grinder.lua b/technic/technic/grinder.lua new file mode 100644 index 0000000..686ffd3 --- /dev/null +++ b/technic/technic/grinder.lua @@ -0,0 +1,326 @@ +grinder_recipes ={} + +registered_grinder_recipes_count=1 + +function register_grinder_recipe (string1,string2) +grinder_recipes[registered_grinder_recipes_count]={} +grinder_recipes[registered_grinder_recipes_count].src_name=string1 +grinder_recipes[registered_grinder_recipes_count].dst_name=string2 +registered_grinder_recipes_count=registered_grinder_recipes_count+1 +if UI_recipes_hook then + minetest.register_craft({ + type = "grinding", + output = string2, + recipe = string1, + }) + end +end + +register_grinder_recipe("default:stone","default:sand") +register_grinder_recipe("default:cobble","default:gravel") +register_grinder_recipe("default:gravel","default:dirt") +register_grinder_recipe("default:desert_stone","default:desert_sand") +register_grinder_recipe("default:iron_lump","technic:iron_dust 2") +register_grinder_recipe("default:coal_lump","technic:coal_dust 2") +register_grinder_recipe("moreores:copper_lump","technic:copper_dust 2") +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") +register_grinder_recipe("technic:coal_dust","dye:black 2") +register_grinder_recipe("default:cactus","dye:green 2") +register_grinder_recipe("default:dry_shrub","dye:brown 2") +register_grinder_recipe("flowers:flower_geranium","dye:blue 2") +register_grinder_recipe("flowers:flower_dandelion_white","dye:white 2") +register_grinder_recipe("flowers:flower_dandelion_yellow","dye:yellow 2") +register_grinder_recipe("flowers:flower_tulip","dye:orange 2") +register_grinder_recipe("flowers:flower_rose","dye:red 2") +register_grinder_recipe("flowers:flower_viola","dye:violet 2") + +minetest.register_craftitem( "technic:coal_dust", { + description = "Coal Dust", + inventory_image = "technic_coal_dust.png", + on_place_on_ground = minetest.craftitem_place_item, + }) + +minetest.register_craftitem( "technic:iron_dust", { + description = "Iron Dust", + inventory_image = "technic_iron_dust.png", + on_place_on_ground = minetest.craftitem_place_item, + }) + +minetest.register_craft({ + type = "cooking", + output = "default:steel_ingot", + recipe = "technic:iron_dust", +}) + +minetest.register_craftitem( "technic:copper_dust", { + description = "Copper Dust", + inventory_image = "technic_copper_dust.png", + on_place_on_ground = minetest.craftitem_place_item, + }) +minetest.register_craft({ + type = "cooking", + output = "moreores:copper_ingot", + recipe = "technic:copper_dust", +}) + +minetest.register_craftitem( "technic:tin_dust", { + description = "Tin Dust", + inventory_image = "technic_tin_dust.png", + on_place_on_ground = minetest.craftitem_place_item, + }) +minetest.register_craft({ + type = "cooking", + output = "moreores:tin_ingot", + recipe = "technic:tin_dust", +}) + +minetest.register_craftitem( "technic:silver_dust", { + description = "Silver Dust", + inventory_image = "technic_silver_dust.png", + on_place_on_ground = minetest.craftitem_place_item, + }) +minetest.register_craft({ + type = "cooking", + output = "moreores:silver_ingot", + recipe = "technic:silver_dust", +}) + +minetest.register_craftitem( "technic:gold_dust", { + description = "Gold Dust", + inventory_image = "technic_gold_dust.png", + on_place_on_ground = minetest.craftitem_place_item, + }) +minetest.register_craft({ + type = "cooking", + output = "moreores:gold_ingot", + recipe = "technic:gold_dust", +}) + +minetest.register_craftitem( "technic:mithril_dust", { + description = "Mithril Dust", + inventory_image = "technic_mithril_dust.png", + on_place_on_ground = minetest.craftitem_place_item, + }) +minetest.register_craft({ + type = "cooking", + output = "moreores:mithril_ingot", + recipe = "technic:mithril_dust", +}) + +minetest.register_craftitem( "technic:chromium_dust", { + description = "Chromium Dust", + inventory_image = "technic_chromium_dust.png", + on_place_on_ground = minetest.craftitem_place_item, + }) +minetest.register_craft({ + type = "cooking", + output = "technic:chromium_ingot", + recipe = "technic:chromium_dust", +}) + +minetest.register_craftitem( "technic:bronze_dust", { + description = "Bronze Dust", + inventory_image = "technic_bronze_dust.png", + on_place_on_ground = minetest.craftitem_place_item, + }) +minetest.register_craft({ + type = "cooking", + output = "moreores:bronze_ingot", + recipe = "technic:bronze_dust", +}) + +minetest.register_craftitem( "technic:brass_dust", { + description = "Brass Dust", + inventory_image = "technic_brass_dust.png", + on_place_on_ground = minetest.craftitem_place_item, + }) +minetest.register_craft({ + type = "cooking", + output = "technic:brass_ingot", + recipe = "technic:brass_dust", +}) + +minetest.register_craftitem( "technic:stainless_steel_dust", { + description = "Stainless Steel Dust", + inventory_image = "technic_stainless_steel_dust.png", + }) + +minetest.register_craft({ + type = "cooking", + output = "technic:stainless_steel_ingot", + 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', + recipe = { + {'default:desert_stone', 'default:desert_stone', 'default:desert_stone'}, + {'default:desert_stone', 'technic:diamond', 'default:desert_stone'}, + {'default:stone', 'moreores:copper_ingot', 'default:stone'}, + } +}) + +minetest.register_craftitem("technic:grinder", { + description = "Grinder", + stack_max = 99, +}) + +grinder_formspec = + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. + "label[0,0;Grinder]".. + "label[1,3;Power level]".. + "list[current_name;src;3,1;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]" + + +minetest.register_node("technic:grinder", { + description = "Grinder", + tiles = {"technic_grinder_top.png", "technic_machine_bottom.png", "technic_grinder_side.png", + "technic_grinder_side.png", "technic_grinder_side.png", "technic_grinder_front.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + technic_power_machine=1, + internal_EU_buffer=0; + internal_EU_buffer_size=5000; + grind_time=0; + grinded = nil; + src_time = 0; + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("infotext", "Grinder") + meta:set_float("technic_power_machine", 1) + meta:set_float("internal_EU_buffer", 0) + meta:set_float("internal_EU_buffer_size", 5000) + meta:set_string("formspec", grinder_formspec) + meta:set_float("grind_time", 0) + + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("dst", 4) + + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("src") then + return false + end + if not inv:is_empty("dst") then + return false + end + + return true + end, + +}) + +minetest.register_abm({ + nodenames = {"technic:grinder"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + + local meta = minetest.env:get_meta(pos) + local charge= meta:get_float("internal_EU_buffer") + local max_charge= meta:get_float("internal_EU_buffer_size") + local grind_cost=200 + + local load = math.floor((charge/max_charge)*100) + meta:set_string("formspec", + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "label[0,0;Grinder]".. + "label[1,3;Power level]".. + "list[current_name;src;3,1;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]" + ) + + + + local inv = meta:get_inventory() + +-- local grinder_on = meta:get_float("grinder_on") + + + local srclist = inv:get_list("src") + if inv:is_empty("src") then meta:set_float("grinder_on",0) end + + + if (meta:get_float("grinder_on") == 1) then + if charge>=grind_cost then + charge=charge-grind_cost; + meta:set_float("internal_EU_buffer",charge) + meta:set_float("src_time", meta:get_float("src_time") + 1) + if meta:get_float("src_time") >= meta:get_float("grind_time") then + -- check if there's room for output in "dst" list + grinded = get_grinded_item (inv:get_stack("src", 1)) + if inv:room_for_item("dst",grinded) then + -- Put result in "dst" list + inv:add_item("dst", grinded) + -- take stuff from "src" list + srcstack = inv:get_stack("src", 1) + srcstack:take_item() + inv:set_stack("src", 1, srcstack) + if inv:is_empty("src") then meta:set_float("grinder_on",0) end + + + + else + print("Grinder inventory full!") + end + meta:set_float("src_time", 0) + end + end + end + + if (meta:get_float("grinder_on")==0) then + local grinded=nil + if not inv:is_empty("src") then + grinded = get_grinded_item (inv:get_stack("src", 1)) + if grinded then meta:set_float("grinder_on",1) end + grind_time=4 + meta:set_float("grind_time",grind_time) + meta:set_float("src_time", 0) + return + end + end + + + end +}) + +function get_grinded_item (items) +new_item =nil +src_item=items:to_table() +item_name=src_item["name"] + +local counter=registered_grinder_recipes_count-1 +for i=1, counter,1 do +if grinder_recipes[i].src_name==item_name then return ItemStack(grinder_recipes[i].dst_name) end +end +return nil + +end diff --git a/technic/technic/grinder_gloopores.lua b/technic/technic/grinder_gloopores.lua new file mode 100644 index 0000000..0c58c98 --- /dev/null +++ b/technic/technic/grinder_gloopores.lua @@ -0,0 +1,55 @@ +register_grinder_recipe("gloopores:alatro_lump","technic:alatro_dust 2") +register_grinder_recipe("gloopores:kalite_lump","technic:kalite_dust 2") +register_grinder_recipe("gloopores:arol_lump","technic:arol_dust 2") +register_grinder_recipe("gloopores:talinite_lump","technic:talinite_dust 2") +register_grinder_recipe("gloopores:akalin_lump","technic:akalin_dust 2") +  +minetest.register_craftitem("technic:alatro_dust", { +        description = "Alatro Dust", +        inventory_image = "technic_alatro_dust.png", +}) +  +minetest.register_craft({ +    type = "cooking", +    output = "gloopores:alatro_ingot", +    recipe = "technic:alatro_dust", +}) +  +minetest.register_craftitem("technicplus:arol_dust", { +        description = "Arol Dust", +        inventory_image = "technic_arol_dust.png", +}) +  +minetest.register_craft({ +    type = "cooking", +    output = "gloopores:arol_ingot", +    recipe = "technic:arol_dust", +}) +  +minetest.register_craftitem("technic:talinite_dust", { +        description = "Talinite Dust", +        inventory_image = "technic_talinite_dust.png", +}) +  +minetest.register_craft({ +    type = "cooking", +    output = "gloopores:talinite_ingot", +    recipe = "technic:talinite_dust", +}) +  +minetest.register_craftitem("technic:akalin_dust", { +        description = "Akalin Dust", +        inventory_image = "technic_akalin_dust.png", +}) +  +minetest.register_craft({ +    type = "cooking", +    output = "gloopores:akalin_ingot", +    recipe = "technic:akalin_dust", +}) +  +minetest.register_craftitem("technic:kalite_dust", { +        description = "Kalite Dust", +        inventory_image = "technic_kalite_dust.png", +        on_use = minetest.item_eat(2) +}) diff --git a/technic/technic/init.lua b/technic/technic/init.lua new file mode 100644 index 0000000..355e25e --- /dev/null +++ b/technic/technic/init.lua @@ -0,0 +1,96 @@ +-- Minetest 0.4.4 : technic + +minetest.register_alias("rebar", "technic:rebar") +minetest.register_alias("concrete", "technic:concrete") +minetest.register_alias("concrete_post", "technic:concrete_post") +minetest.register_alias("iron_chest", "technic:iron_chest") +minetest.register_alias("iron_locked_chest", "technic:iron_locked_chest") +minetest.register_alias("copper_chest", "technic:copper_chest") +minetest.register_alias("copper_locked_chest", "technic:copper_locked_chest") +minetest.register_alias("silver_chest", "technic:silver_chest") +minetest.register_alias("silver_locked_chest", "technic:silver_locked_chest") +minetest.register_alias("gold_chest", "technic:gold_chest") +minetest.register_alias("gold_locked_chest", "technic:gold_locked_chest") +minetest.register_alias("mithril_chest", "technic:mithril_chest") +minetest.register_alias("mithril_locked_chest", "technic:mithril_locked_chest") + + +modpath=minetest.get_modpath("technic") + +--Read technic config file +dofile(modpath.."/config.lua") + +-- world gen +dofile(modpath.."/ores.lua") +if enable_rubber_tree_generation==true then dofile(modpath.."/rubber.lua") end + +-- chests +dofile(modpath.."/iron_chest.lua") +dofile(modpath.."/copper_chest.lua") +dofile(modpath.."/silver_chest.lua") +dofile(modpath.."/gold_chest.lua") +dofile(modpath.."/mithril_chest.lua") + +--items +dofile(modpath.."/concrete.lua") +dofile(modpath.."/items.lua") + +--LV machines +dofile(modpath.."/alloy_furnace.lua") +dofile(modpath.."/solar_panel.lua") +dofile(modpath.."/geothermal.lua") +dofile(modpath.."/water_mill.lua") +dofile(modpath.."/electric_furnace.lua") +dofile(modpath.."/battery_box.lua") +dofile(modpath.."/wires.lua") +dofile(modpath.."/tool_workshop.lua") +dofile(modpath.."/music_player.lua") +dofile(modpath.."/generator.lua") +dofile(modpath.."/grinder.lua") + +--MV machines +dofile(modpath.."/wires_mv.lua") +dofile(modpath.."/solar_panel_mv.lua") +dofile(modpath.."/battery_box_mv.lua") + +--Tools +if enable_mining_dril==true then dofile(modpath.."/mining_drill.lua") end +if enable_mining_laser==true then dofile(modpath.."/mining_laser_mk1.lua") end +if enable_flashlight==true then dofile(modpath.."/flashlight.lua") end +dofile(modpath.."/cans.lua") +dofile(modpath.."/chainsaw.lua") +dofile(modpath.."/tree_tap.lua") +dofile(modpath.."/screwdriver.lua") +dofile(modpath.."/sonic_screwdriver.lua") + +-- mesecons and tubes related +dofile(modpath.."/injector.lua") +dofile(modpath.."/node_breaker.lua") +dofile(modpath.."/deployer.lua") +dofile(modpath.."/constructor.lua") + +if enable_item_drop then dofile(modpath.."/item_drop.lua") end +if enable_item_pickup then dofile(modpath.."/item_pickup.lua") end + +function has_locked_chest_privilege(meta, player) + if player:get_player_name() ~= meta:get_string("owner") then + return false + end + return true +end + + +function hacky_swap_node(pos,name) + local node = minetest.env:get_node(pos) + local meta = minetest.env:get_meta(pos) + local meta0 = meta:to_table() + if node.name == name then + return nil + end + 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 diff --git a/technic/technic/injector.lua b/technic/technic/injector.lua new file mode 100644 index 0000000..0a6a19c --- /dev/null +++ b/technic/technic/injector.lua @@ -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_receiver") == 1 then add_new_TUBE_node(CHEST_nodes,pos1,parent) return end +end \ No newline at end of file diff --git a/technic/technic/injector1.lua b/technic/technic/injector1.lua new file mode 100644 index 0000000..537e478 --- /dev/null +++ b/technic/technic/injector1.lua @@ -0,0 +1,248 @@ +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) + item1=tube_item({x=pos.x+.5,y=pos.y,z=pos.z},stack) + return + end + end +end, +}) + + +function tube_item(pos, item) + -- 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()) + obj:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z} + obj:setacceleration({x=0, y=0, z=0}) + pos.x=pos.x+1 + local meta = minetest.env:get_meta(pos) + if meta:get_int("tubelike")==1 then obj:setvelocity({x=1, y=0, z=0}) return obj end + pos.x=pos.x-2 + meta = minetest.env:get_meta(pos) + if meta:get_int("tubelike")==1 then obj:setvelocity({x=-1, y=0, z=0}) return obj end + pos.x=pos.x+1 + pos.z=pos.z+1 + meta = minetest.env:get_meta(pos) + if meta:get_int("tubelike")==1 then obj:setvelocity({x=0, y=0, z=1}) return obj end + pos.z=pos.z-2 + meta = minetest.env:get_meta(pos) + if meta:get_int("tubelike")==1 then obj:setvelocity({x=0, y=0, z=-1}) return obj end + pos.z=pos.z+1 + pos.y=pos.y+1 + meta = minetest.env:get_meta(pos) + if meta:get_int("tubelike")==1 then obj:setvelocity({x=0, y=1, z=0}) return obj end + pos.y=pos.y-2 + meta = minetest.env:get_meta(pos) + if meta:get_int("tubelike")==1 then obj:setvelocity({x=0, y=-2, z=0}) return obj end + pos.y=pos.y+1 + 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={} + }, + + 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) + 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 velocity=self.object:getvelocity() + + if not velocity then 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 + check_next_step (self.start_pos, velocity) + 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 + check_next_step (self.start_pos, velocity) + 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 + check_next_step (self.start_pos, velocity) + 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 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 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 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 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 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 end +end + +--velocity.x=0 +--velocity.y=0 +--velocity.z=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 diff --git a/technic/technic/iron_chest.lua b/technic/technic/iron_chest.lua new file mode 100644 index 0000000..27b1aba --- /dev/null +++ b/technic/technic/iron_chest.lua @@ -0,0 +1,163 @@ +minetest.register_craft({ + output = 'technic:iron_chest 1', + recipe = { + {'default:steel_ingot','default:steel_ingot','default:steel_ingot'}, + {'default:steel_ingot','default:chest','default:steel_ingot'}, + {'default:steel_ingot','default:steel_ingot','default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:iron_locked_chest 1', + recipe = { + {'default:steel_ingot','default:steel_ingot','default:steel_ingot'}, + {'default:steel_ingot','default:chest_locked','default:steel_ingot'}, + {'default:steel_ingot','default:steel_ingot','default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:iron_locked_chest 1', + recipe = { + {'default:steel_ingot'}, + {'technic:iron_chest'}, + } +}) + + +minetest.register_craftitem("technic:iron_chest", { + description = "Iron Chest", + stack_max = 99, +}) +minetest.register_craftitem("technic:iron_locked_chest", { + description = "Iron Locked Chest", + stack_max = 99, +}) + +minetest.register_alias("blabla", "technic:iron_chest") + +minetest.register_node("technic:iron_chest", { + description = "Iron Chest", + 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,0;9,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Iron Chest") + local inv = meta:get_inventory() + inv:set_size("main", 9*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_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_move_allow_all( + pos, from_list, from_index, to_list, to_index, count, player) + end, + on_metadata_inventory_offer = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_offer_allow_all( + pos, listname, index, stack, player) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from chest at "..minetest.pos_to_string(pos)) + end, +}) + +local function has_locked_chest_privilege(meta, player) + if player:get_player_name() ~= meta:get_string("owner") then + return false + end + return true +end + +minetest.register_node("technic:iron_locked_chest", { + description = "Iron Locked Chest", + 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_locked.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + after_place_node = function(pos, placer) + local meta = minetest.env:get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Locked Iron Chest (owned by ".. + meta:get_string("owner")..")") + end, +on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "invsize[9,9;]".. + "list[current_name;main;0,0;9,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Iron Locked Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 9*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, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from locked chest at "..minetest.pos_to_string(pos)) + end, +}) diff --git a/technic/technic/item_drop.lua b/technic/technic/item_drop.lua new file mode 100644 index 0000000..3165e6a --- /dev/null +++ b/technic/technic/item_drop.lua @@ -0,0 +1,100 @@ +-- This part written by PilzAdam (item_drop mod) + +minetest.register_globalstep(function(dtime) + for _,player in ipairs(minetest.get_connected_players()) do + local pos = player:getpos() + pos.y = pos.y+0.5 + local inv = player:get_inventory() + + for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do + if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then + if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then + inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) + if object:get_luaentity().itemstring ~= "" then + minetest.sound_play("item_drop_pickup", { + to_player = player:get_player_name(), + }) + end + object:get_luaentity().itemstring = "" + object:remove() + end + end + end + + for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 2)) do + if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then + if object:get_luaentity().collect then + if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then + local pos1 = pos + pos1.y = pos1.y+0.2 + local pos2 = object:getpos() + local vec = {x=pos1.x-pos2.x, y=pos1.y-pos2.y, z=pos1.z-pos2.z} + vec.x = vec.x*3 + vec.y = vec.y*3 + vec.z = vec.z*3 + object:setvelocity(vec) + + minetest.after(1, function(args) + local lua = object:get_luaentity() + if object == nil or lua == nil or lua.itemstring == nil then + return + end + if inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then + inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) + if object:get_luaentity().itemstring ~= "" then + minetest.sound_play("item_drop_pickup", { + to_player = player:get_player_name(), + }) + end + object:get_luaentity().itemstring = "" + object:remove() + else + object:setvelocity({x=0,y=0,z=0}) + end + end, {player, object}) + + end + end + end + end + end +end) + +function minetest.handle_node_drops(pos, drops, digger) + for _,item in ipairs(drops) do + local count, name + if type(item) == "string" then + count = 1 + name = item + else + count = item:get_count() + name = item:get_name() + end + for i=1,count do + local obj = minetest.env:add_item(pos, name) + if obj ~= nil then + obj:get_luaentity().collect = true + local x = math.random(1, 5) + if math.random(1,2) == 1 then + x = -x + end + local z = math.random(1, 5) + if math.random(1,2) == 1 then + z = -z + end + obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z}) + + -- FIXME this doesnt work for deactiveted objects + if minetest.setting_get("remove_items") and tonumber(minetest.setting_get("remove_items")) then + minetest.after(tonumber(minetest.setting_get("remove_items")), function(obj) + obj:remove() + end, obj) + end + end + end + end +end + +if minetest.setting_get("log_mods") then + minetest.log("action", "item_drop loaded") +end diff --git a/technic/technic/item_pickup.lua b/technic/technic/item_pickup.lua new file mode 100644 index 0000000..04ed0f8 --- /dev/null +++ b/technic/technic/item_pickup.lua @@ -0,0 +1,63 @@ +minetest.register_globalstep(function(dtime) + for _,player in ipairs(minetest.get_connected_players()) do + local pos = player:getpos() + pos.y = pos.y+0.5 + local inv = player:get_inventory() + + for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do + if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then + if inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then + inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) + if object:get_luaentity().itemstring ~= "" then + minetest.sound_play("item_drop_pickup", { + to_player = player:get_player_name(), + }) + end + object:get_luaentity().itemstring = "" + object:remove() + end + end + end + + for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 2)) do + if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then + if object:get_luaentity().collect then + if inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then + local pos1 = pos + pos1.y = pos1.y+0.2 + local pos2 = object:getpos() + local vec = {x=pos1.x-pos2.x, y=pos1.y-pos2.y, z=pos1.z-pos2.z} + vec.x = vec.x*3 + vec.y = vec.y*3 + vec.z = vec.z*3 + object:setvelocity(vec) + + minetest.after(1, function(args) + local lua = object:get_luaentity() + if object == nil or lua == nil or lua.itemstring == nil then + return + end + if inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then + inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) + if object:get_luaentity().itemstring ~= "" then + minetest.sound_play("item_drop_pickup", { + to_player = player:get_player_name(), + }) + end + object:get_luaentity().itemstring = "" + object:remove() + else + object:setvelocity({x=0,y=0,z=0}) + end + end, {player, object}) + + end + else + minetest.after(0.5, function(entity) + entity.collect = true + end, object:get_luaentity()) + end + end + end + end +end) diff --git a/technic/technic/items.lua b/technic/technic/items.lua new file mode 100644 index 0000000..c2b596e --- /dev/null +++ b/technic/technic/items.lua @@ -0,0 +1,157 @@ +minetest.register_craftitem( "technic:silicon_wafer", { + description = "Silicon Wafer", + inventory_image = "technic_silicon_wafer.png", + on_place_on_ground = minetest.craftitem_place_item, +}) + +minetest.register_craftitem( "technic:doped_silicon_wafer", { + description = "Doped Silicon Wafer", + inventory_image = "technic_doped_silicon_wafer.png", + on_place_on_ground = minetest.craftitem_place_item, +}) + +minetest.register_craft({ + output = 'pipeworks:tube_000000 9', + recipe = { + {'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'}, + {'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'}, + {'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'}, + } +}) + +minetest.register_craftitem( "technic:diamond_drill_head", { + description = "Diamond Drill Head", + inventory_image = "technic_diamond_drill_head.png", + on_place_on_ground = minetest.craftitem_place_item, +}) + +minetest.register_craft({ + output = 'technic:diamond_drill_head', + recipe = { + {'technic:stainless_steel_ingot', 'technic:diamond', 'technic:stainless_steel_ingot'}, + {'technic:diamond', '', 'technic:diamond'}, + {'technic:stainless_steel_ingot', 'technic:diamond', 'technic:stainless_steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:diamond_block', + recipe = { + {'technic:diamond', 'technic:diamond', 'technic:diamond'}, + {'technic:diamond', 'technic:diamond', 'technic:diamond'}, + {'technic:diamond', 'technic:diamond', 'technic:diamond'}, + } +}) + +minetest.register_node( "technic:diamond_block", { + description = "Diamond Block", + tiles = { "technic_diamond_block.png" }, + is_ground_content = true, + groups = {cracky=3}, + sounds = default.node_sound_stone_defaults(), + drop = 'craft "technic:diamond_block" 1', +}) + +minetest.register_craft({ + output = 'technic:green_energy_crystal', + recipe = { + {'moreores:gold_ingot', 'technic:battery', 'dye:green'}, + {'technic:battery', 'technic:red_energy_crystal', 'technic:battery'}, + {'dye:green', 'technic:battery', 'moreores:gold_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:blue_energy_crystal', + recipe = { + {'moreores:gold_ingot', 'technic:battery', 'dye:blue'}, + {'technic:battery', 'technic:green_energy_crystal', 'technic:battery'}, + {'dye:blue', 'technic:battery', 'moreores:gold_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:red_energy_crystal', + recipe = { + {'moreores:gold_ingot', 'technic:battery', 'dye:red'}, + {'technic:battery', 'technic:diamond_block', 'technic:battery'}, + {'dye:red', 'technic:battery', 'moreores:gold_ingot'}, + } +}) + +minetest.register_tool("technic:blue_energy_crystal", +{description = "Blue Energy Crystal", +inventory_image = minetest.inventorycube("technic_diamond_block_blue.png", "technic_diamond_block_blue.png", "technic_diamond_block_blue.png"), +tool_capabilities = {load=0,max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}}) + +minetest.register_tool("technic:green_energy_crystal", +{description = "Green Energy Crystal", +inventory_image = minetest.inventorycube("technic_diamond_block_green.png", "technic_diamond_block_green.png", "technic_diamond_block_green.png"), +tool_capabilities = {load=0,max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}}) + +minetest.register_tool("technic:red_energy_crystal", +{description = "Red Energy Crystal", +inventory_image = minetest.inventorycube("technic_diamond_block_red.png", "technic_diamond_block_red.png", "technic_diamond_block_red.png"), +tool_capabilities = {load=0,max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}}) + + +minetest.register_craftitem( "technic:fine_copper_wire", { + description = "Fine Copper Wire", + inventory_image = "technic_fine_copper_wire.png", + on_place_on_ground = minetest.craftitem_place_item, +}) + +minetest.register_craft({ + output = 'technic:fine_copper_wire 2', + recipe = { + {'', 'moreores:copper_ingot', ''}, + {'', 'moreores:copper_ingot', ''}, + {'', 'moreores:copper_ingot', ''}, + } +}) + +minetest.register_craftitem( "technic:copper_coil", { + description = "Copper Coil", + inventory_image = "technic_copper_coil.png", + on_place_on_ground = minetest.craftitem_place_item, +}) + +minetest.register_craft({ + output = 'technic:copper_coil 1', + recipe = { + {'technic:fine_copper_wire', 'default:steel_ingot', 'technic:fine_copper_wire'}, + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'technic:fine_copper_wire', 'default:steel_ingot', 'technic:fine_copper_wire'}, + } +}) + +minetest.register_craftitem( "technic:motor", { + description = "Electric Motor", + inventory_image = "technic_motor.png", + on_place_on_ground = minetest.craftitem_place_item, +}) + +minetest.register_craft({ + output = 'technic:motor', + recipe = { + {'default:steel_ingot', 'technic:copper_coil', 'default:steel_ingot'}, + {'default:steel_ingot', 'technic:copper_coil', 'default:steel_ingot'}, + {'default:steel_ingot', 'moreores:copper_ingot', 'default:steel_ingot'}, + } +}) + +minetest.register_craftitem( "technic:mv_transformer", { + description = "Medium Voltage Transformer", + inventory_image = "technic_mv_transformer.png", + on_place_on_ground = minetest.craftitem_place_item, +}) + +minetest.register_craft({ + output = 'technic:mv_transformer', + recipe = { + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'technic:copper_coil', 'default:steel_ingot', 'technic:copper_coil'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + } +}) + diff --git a/technic/technic/mining_drill.lua b/technic/technic/mining_drill.lua new file mode 100644 index 0000000..4ccfc95 --- /dev/null +++ b/technic/technic/mining_drill.lua @@ -0,0 +1,49 @@ +mining_drill_max_charge=60000 + +minetest.register_tool("technic:mining_drill", { + description = "Mining Drill", + inventory_image = "technic_mining_drill.png", + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type=="node" then + item=itemstack:to_table() + if item["metadata"]=="" or item["metadata"]=="0" then return end --tool not charged + charge=tonumber(item["metadata"]) + if charge-200>0 then + drill_dig_it(minetest.get_pointed_thing_position(pointed_thing, above),user) + charge =charge-200; + item["metadata"]=tostring(charge) + set_RE_wear(item,charge,mining_drill_max_charge) + itemstack:replace(item) + end + return itemstack + end + end, +}) + +minetest.register_craft({ + output = 'technic:mining_drill', + recipe = { + {'technic:stainless_steel_ingot', 'technic:diamond_drill_head', 'technic:stainless_steel_ingot'}, + {'technic:stainless_steel_ingot', 'technic:motor', 'technic:stainless_steel_ingot'}, + {'', 'technic:red_energy_crystal', 'moreores:copper_ingot'}, + } +}) + + + + + + +function drill_dig_it (pos, player) + local node=minetest.env:get_node(pos) + if node.name == "air" or node.name == "ignore" then return end + if node.name == "default:lava_source" then return end + if node.name == "default:lava_flowing" then return end + if node.name == "default:water_source" then minetest.env:remove_node(pos) return end + if node.name == "default:water_flowing" then minetest.env:remove_node(pos) return end + + minetest.sound_play("mining_drill", {pos = pos, gain = 1.0, max_hear_distance = 10,}) + minetest.node_dig(pos,node,player) + +end \ No newline at end of file diff --git a/technic/technic/mining_laser_mk1.lua b/technic/technic/mining_laser_mk1.lua new file mode 100644 index 0000000..a206bb4 --- /dev/null +++ b/technic/technic/mining_laser_mk1.lua @@ -0,0 +1,174 @@ +laser_mk1_max_charge=40000 +local laser_shoot = function(itemstack, player, pointed_thing) + local laser_straight_mode=0 + local playerpos=player:getpos() + local dir=player:get_look_dir() + if pointed_thing.type=="node" then + pos=minetest.get_pointed_thing_position(pointed_thing, above) + local node = minetest.env:get_node(pos) + if node.name~="ignore" then + minetest.node_dig(pos,node,player) + end + laser_straight_mode=1 + end + + direction_y=math.abs(math.floor(dir.y*100)) + if direction_y>50 then entity_name="technic:laser_beam_entityV" + else entity_name="technic:laser_beam_entity" end + + if laser_straight_mode==1 then + pos1=minetest.get_pointed_thing_position(pointed_thing, under) + pos1.x=math.floor(pos1.x) + pos1.y=math.floor(pos1.y) + pos1.z=math.floor(pos1.z) + obj=minetest.env:add_entity(pos1,entity_name) + else + obj=minetest.env:add_entity({x=playerpos.x,y=playerpos.y+1.6,z=playerpos.z},entity_name) + end + if obj:get_luaentity().player == nil then + obj:get_luaentity().player = player + end + if laser_straight_mode==1 and direction_y<50 then + obj:setvelocity({x=dir.x*8, y=0, z=dir.z*8}) + else if laser_straight_mode==1 and direction_y>50 then + obj:setvelocity({x=0, y=dir.y*8, z=dir.z*8}) + end + end + if laser_straight_mode==0 then + obj:setvelocity({x=dir.x*8, y=dir.y*8, z=dir.z*8}) + end + obj:setacceleration({x=0, y=0, z=0}) + obj:setyaw(player:get_look_yaw()+math.pi) + if obj:get_luaentity().player == nil then + obj:get_luaentity().player = player + end + --obj:get_luaentity().node = player:get_inventory():get_stack("main", 1):get_name() + minetest.sound_play("technic_laser", {pos = playerpos, gain = 1.0, max_hear_distance = 10,}) + return true +end + + +minetest.register_tool("technic:laser_mk1", { + description = "Mining Laser MK1", + inventory_image = "technic_mining_laser_mk1.png", + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + item=itemstack:to_table() + if item["metadata"]=="" or item["metadata"]=="0" then return end + local charge=tonumber((item["metadata"])) + if charge-400>0 then + laser_shoot(item, user, pointed_thing) + charge =charge-400; + item["metadata"]=tostring(charge) + charge=set_RE_wear(item,charge,laser_mk1_max_charge) + itemstack:replace(item) + end + return itemstack + end, +}) + +minetest.register_craft({ + output = 'technic:laser_mk1', + recipe = { + {'technic:diamond', 'default:steel_ingot', 'technic:battery'}, + {'', 'default:steel_ingot', 'technic:battery'}, + {'', '', 'moreores:copper_ingot'}, + } +}) + + + +minetest.register_node("technic:laser_beam_box", { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + { -0.5 , -0.1, -0.1 , 0.1 , 0.1 , 0.1 }, + { -0.1 , -0.1 , -0.1 , 0.5, 0.1 , 0.1 }, + } + }, + tiles = {"technic_laser_beam.png"}, + groups = {not_in_creative_inventory=1}, +}) + +minetest.register_node("technic:laser_beam_boxV", { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + { -0.1 , -0.1 , -0.1 , 0.1 , 0.5, 0.1 }, + { -0.1 , -0.5, -0.1 , 0.1 , 0.1 , 0.1 }, + + } + }, + tiles = {"technic_laser_beam.png"}, + groups = {not_in_creative_inventory=1}, +}) + +LASER_BEAM_ENTITY={ + physical = false, + timer=0, + visual = "wielditem", + visual_size = {x=0.2, y=0.2}, + textures = {"technic:laser_beam_box"}, + lastpos={}, + max_range=10, + count=0, +-- digger=nil, + collisionbox = {0,0,0,0,0,0}, +} + +LASER_BEAM_ENTITY.on_step = function(self, dtime) + self.timer=self.timer+dtime + local pos = self.object:getpos() + if self.player~=nil then if self.lastpos.x~=nil then lazer_it (pos, self.player) end end + if self.lastpos.x ~=nil and self.lastpos.y ~=nil and self.lastpos.y ~=nil then + temp1={x=math.floor(self.lastpos.x),y=math.floor(self.lastpos.y),z=math.floor(self.lastpos.z)} + temp2={x=math.floor(pos.x),y=math.floor(pos.y),z=math.floor(pos.z)} + if temp1.x==temp2.x and temp1.y==temp2.y and temp1.z==temp2.z then return end + end + self.lastpos={x=pos.x, y=pos.y, z=pos.z} + self.count=self.count+1 + if self.count==self.max_range then self.object:remove() end +end + +LASER_BEAM_ENTITYV={ + physical = false, + timer=0, + visual = "wielditem", + visual_size = {x=0.2, y=0.2}, + textures = {"technic:laser_beam_boxV"}, + lastpos={}, + max_range=15, + count=0, + collisionbox = {0,0,0,0,0,0}, +} + +LASER_BEAM_ENTITYV.on_step = function(self, dtime) + self.timer=self.timer+dtime + local pos = self.object:getpos() + if self.player~=nil then if self.lastpos.x~=nil then lazer_it (pos, self.player) end end + if self.lastpos.x ~=nil and self.lastpos.y ~=nil and self.lastpos.y ~=nil then + temp1={x=math.floor(self.lastpos.x),y=math.floor(self.lastpos.y),z=math.floor(self.lastpos.z)} + temp2={x=math.floor(pos.x),y=math.floor(pos.y),z=math.floor(pos.z)} + if temp1.x==temp2.x and temp1.y==temp2.y and temp1.z==temp2.z then return end + end + self.lastpos={x=pos.x, y=pos.y, z=pos.z} + self.count=self.count+1 + if self.count==self.max_range then self.object:remove() end +end + + +minetest.register_entity("technic:laser_beam_entity", LASER_BEAM_ENTITY) +minetest.register_entity("technic:laser_beam_entityV", LASER_BEAM_ENTITYV) + +function lazer_it (pos, player) + local pos1={} +-- pos1.x=math.floor(pos.x) +-- pos1.y=math.floor(pos.y) +-- pos1.z=math.floor(pos.z) + local node = minetest.env:get_node(pos) + if node.name == "air" or node.name == "ignore" or node.name == "default:lava_source" or node.name == "default:lava_flowing" then return end + if node.name == "default:water_source" or node.name == "default:water_flowing" then minetest.env:remove_node(pos) return end + if player then minetest.node_dig(pos,node,player) end +end \ No newline at end of file diff --git a/technic/technic/mithril_chest.lua b/technic/technic/mithril_chest.lua new file mode 100644 index 0000000..89683f8 --- /dev/null +++ b/technic/technic/mithril_chest.lua @@ -0,0 +1,145 @@ +minetest.register_craft({ + output = 'technic:mithril_chest 1', + recipe = { + {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, + {'moreores:mithril_ingot','technic:gold_chest','moreores:mithril_ingot'}, + {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:mithril_locked_chest 1', + recipe = { + {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, + {'moreores:mithril_ingot','technic:gold_locked_chest','moreores:mithril_ingot'}, + {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:mithril_locked_chest 1', + recipe = { + {'default:steel_ingot'}, + {'technic:mithril_chest'}, + } +}) + +minetest.register_node("technic:mithril_chest", { + description = "Mithril Chest", + tiles = {"technic_mithril_chest_top.png", "technic_mithril_chest_top.png", "technic_mithril_chest_side.png", + "technic_mithril_chest_side.png", "technic_mithril_chest_side.png", "technic_mithril_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[13,9;]".. + "list[current_name;main;0,0;13,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Mithril Chest") + local inv = meta:get_inventory() + inv:set_size("main", 13*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_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_move_allow_all( + pos, from_list, from_index, to_list, to_index, count, player) + end, + on_metadata_inventory_offer = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_offer_allow_all( + pos, listname, index, stack, player) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from chest at "..minetest.pos_to_string(pos)) + end, +}) + +minetest.register_node("technic:mithril_locked_chest", { + description = "Mithril Locked Chest", + tiles = {"technic_mithril_chest_top.png", "technic_mithril_chest_top.png", "technic_mithril_chest_side.png", + "technic_mithril_chest_side.png", "technic_mithril_chest_side.png", "technic_mithril_chest_locked.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + after_place_node = function(pos, placer) + local meta = minetest.env:get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Mithril Locked Chest (owned by ".. + meta:get_string("owner")..")") + end, +on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "invsize[13,9;]".. + "list[current_name;main;0,0;13,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Mithril Locked Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 13*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, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from locked chest at "..minetest.pos_to_string(pos)) + end, +}) diff --git a/technic/technic/mithril_subspace_chest.lua b/technic/technic/mithril_subspace_chest.lua new file mode 100644 index 0000000..89683f8 --- /dev/null +++ b/technic/technic/mithril_subspace_chest.lua @@ -0,0 +1,145 @@ +minetest.register_craft({ + output = 'technic:mithril_chest 1', + recipe = { + {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, + {'moreores:mithril_ingot','technic:gold_chest','moreores:mithril_ingot'}, + {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:mithril_locked_chest 1', + recipe = { + {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, + {'moreores:mithril_ingot','technic:gold_locked_chest','moreores:mithril_ingot'}, + {'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:mithril_locked_chest 1', + recipe = { + {'default:steel_ingot'}, + {'technic:mithril_chest'}, + } +}) + +minetest.register_node("technic:mithril_chest", { + description = "Mithril Chest", + tiles = {"technic_mithril_chest_top.png", "technic_mithril_chest_top.png", "technic_mithril_chest_side.png", + "technic_mithril_chest_side.png", "technic_mithril_chest_side.png", "technic_mithril_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[13,9;]".. + "list[current_name;main;0,0;13,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Mithril Chest") + local inv = meta:get_inventory() + inv:set_size("main", 13*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_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_move_allow_all( + pos, from_list, from_index, to_list, to_index, count, player) + end, + on_metadata_inventory_offer = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_offer_allow_all( + pos, listname, index, stack, player) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from chest at "..minetest.pos_to_string(pos)) + end, +}) + +minetest.register_node("technic:mithril_locked_chest", { + description = "Mithril Locked Chest", + tiles = {"technic_mithril_chest_top.png", "technic_mithril_chest_top.png", "technic_mithril_chest_side.png", + "technic_mithril_chest_side.png", "technic_mithril_chest_side.png", "technic_mithril_chest_locked.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + after_place_node = function(pos, placer) + local meta = minetest.env:get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Mithril Locked Chest (owned by ".. + meta:get_string("owner")..")") + end, +on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "invsize[13,9;]".. + "list[current_name;main;0,0;13,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Mithril Locked Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 13*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, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from locked chest at "..minetest.pos_to_string(pos)) + end, +}) diff --git a/technic/technic/music_player.lua b/technic/technic/music_player.lua new file mode 100644 index 0000000..0a6474a --- /dev/null +++ b/technic/technic/music_player.lua @@ -0,0 +1,126 @@ +minetest.register_alias("music_player", "technic:music_player") +minetest.register_craft({ + output = 'technic:music_player', + recipe = { + {'default:wood', 'default:wood', 'default:wood'}, + {'technic:diamond', 'technic:diamond', 'technic:diamond'}, + {'default:stone', 'moreores:copper_ingot', 'default:stone'}, + } +}) + +minetest.register_craftitem("technic:music_player", { + description = "Music Player", + stack_max = 99, +}) + +music_player_formspec = + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. + "label[0,0;Music Player]".. + "label[1,3;Power level]".. + "button[5,2;1,1;track1;1]".. + "button[6,2;1,1;track2;2]" + + +minetest.register_node("technic:music_player", { + description = "Music Player", + tiles = {"technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png", + "technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + sounds = default.node_sound_wood_defaults(), + technic_power_machine=1, + internal_EU_buffer=0, + internal_EU_buffer_size=5000, + music_player_on=0, + music_playing =0, + music_handle = 0, + music_player_current_track =1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("infotext", "Music Player") + meta:set_float("technic_power_machine", 1) + meta:set_float("internal_EU_buffer", 1) + meta:set_float("internal_EU_buffer_size", 5000) + meta:set_string("formspec", music_player_formspec) + meta:set_float("music_player_on", 0) + meta:set_float("music_player_current_track", 1) + end, + + on_receive_fields = function(pos, formanme, fields, sender) + + local meta = minetest.env:get_meta(pos) + player_on=meta:get_float("music_player_on") + music_handle=meta:get_float("music_handle") + music_player_current_track=meta:get_float("music_player_current_track") + if fields.track1 then music_player_current_track=1 end + if fields.track2 then music_player_current_track=2 end + if fields.track3 then music_player_current_track=3 end + if fields.track4 then music_player_current_track=4 end + if fields.track5 then music_player_current_track=5 end + if fields.track6 then music_player_current_track=6 end + if fields.track7 then music_player_current_track=7 end + if fields.track8 then music_player_current_track=8 end + if fields.track9 then music_player_current_track=9 end + meta:set_float("music_player_current_track",music_player_current_track) + if fields.play and player_on==1 then + if music_handle then minetest.sound_stop(music_handle) end + music_handle=minetest.sound_play("technic_track"..music_player_current_track, {pos = pos, gain = 1.0,loop = true, max_hear_distance = 72,}) + meta:set_float("music_playing",1) + end + if fields.stop then + meta:set_float("music_playing",0) + if music_handle then minetest.sound_stop(music_handle) end + end + meta:set_float("music_handle",music_handle) + end, +}) + +minetest.register_abm({ + nodenames = {"technic:music_player"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.env:get_meta(pos) + local charge= meta:get_float("internal_EU_buffer") + local max_charge= meta:get_float("internal_EU_buffer_size") + player_on=meta:get_float("music_player_on") + music_player_current_track=meta:get_float("music_player_current_track") + local play_cost=80 + + if charge>play_cost then + if meta:get_float("music_playing")==1 then charge=charge-play_cost end + meta:set_float("internal_EU_buffer",charge) + meta:set_float("music_player_on",1) + else + meta:set_float("music_playing",0) + meta:set_float("music_player_on",0) + if music_handle then minetest.sound_stop(music_handle) end + end + local load = math.floor((charge/max_charge)*100) + meta:set_string("formspec", + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "label[0,0;Music Player]".. + "label[1,3;Power level]".. + "button[4,1;1,1;track1;1]".. + "button[5,1;1,1;track2;2]".. + "button[6,1;1,1;track3;3]".. + "button[4,2;1,1;track4;4]".. + "button[5,2;1,1;track5;5]".. + "button[6,2;1,1;track6;6]".. + "button[4,3;1,1;track7;7]".. + "button[5,3;1,1;track8;8]".. + "button[6,3;1,1;track9;9]".. + "button[4,4;1,2;play;Play]".. + "button[6,4;1,2;stop;Stop]".. + "label[4,0;Current track "..tostring(music_player_current_track).."]" + + ) + + + + + end +}) + diff --git a/technic/technic/node_breaker.lua b/technic/technic/node_breaker.lua new file mode 100644 index 0000000..3a7f53b --- /dev/null +++ b/technic/technic/node_breaker.lua @@ -0,0 +1,94 @@ +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_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,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_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", + 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) + if node.name == "technic:nodebreaker_off" then + minetest.env:add_node(pos, {name="technic:nodebreaker_on", param2 = node.param2}) + break_node (pos,node.param2) + nodeupdate(pos) + end +end) + +mesecon:register_on_signal_off(function(pos, node) + if node.name == "technic:nodebreaker_on" then + minetest.env:add_node(pos, {name="technic:nodebreaker_off", param2 = node.param2}) + nodeupdate(pos) + end +end) + +mesecon:register_effector("technic:nodebreaker_on", "technic:nodebreaker_off") + +function break_node (pos,n_param) + local pos1={} + local pos2={} + pos1.x=pos.x + pos1.y=pos.y + pos1.z=pos.z + pos2.x=pos.x + pos2.y=pos.y + pos2.z=pos.z + + --param2 3=x+ 1=x- 2=z+ 0=z- + 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 + if node.name == "default:water_source" then minetest.env:remove_node(pos2) return nil end + if node.name == "default:water_flowing" then minetest.env:remove_node(pos2) return nil end + if node.name == "ignore" then minetest.env:remove_node(pos2) return nil end + local drops = minetest.get_node_drops(node.name, "default:pick_mese") + local _, dropped_item + for _, dropped_item in ipairs(drops) do + 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 + diff --git a/technic/technic/ores.lua b/technic/technic/ores.lua new file mode 100644 index 0000000..2642c9e --- /dev/null +++ b/technic/technic/ores.lua @@ -0,0 +1,339 @@ +minetest.register_node( "technic:marble", { + description = "Marble", + tiles = { "technic_marble.png" }, + is_ground_content = true, + groups = {cracky=3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node( "technic:marble_bricks", { + description = "Marble Bricks", + tiles = { "technic_marble_bricks.png" }, + is_ground_content = true, + groups = {cracky=3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_craft({ + output = 'technic:marble_bricks 4', + recipe = { + {'technic:marble','technic:marble'}, + {'technic:marble','technic:marble'} + } +}) + +minetest.register_node( "technic:granite", { + description = "Granite", + tiles = { "technic_granite.png" }, + is_ground_content = true, + groups = {cracky=3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node( "technic:obsidian", { + description = "Obsidian", + tiles = { "technic_obsidian.png" }, + is_ground_content = true, + groups = {cracky=3}, + sounds = default.node_sound_stone_defaults(), +}) + +stairsplus.register_stair_and_slab_and_panel_and_micro("marble", "technic:marble", + {cracky=3}, + {"technic_marble.png"}, + "Marble Stairs", + "Marble Slab", + "Marble Panel", + "Marble Microblock", + "marble") +stairsplus.register_stair_and_slab_and_panel_and_micro("marble_bricks", "technic:marble_bricks", + {cracky=3}, + {"technic_marble_bricks.png"}, + "Marble Bricks Stairs", + "Marble Bricks Slab", + "Marble Bricks Panel", + "Marble Bricks Microblock", + "marble_bricks") +stairsplus.register_stair_and_slab_and_panel_and_micro("granite", "technic:granite", + {cracky=3}, + {"technic_granite.png"}, + "Granite Stairs", + "Granite Slab", + "Granite Panel", + "Granite Microblock", + "granite") +stairsplus.register_stair_and_slab_and_panel_and_micro("obsidian", "technic:obsidian", + {cracky=3}, + {"technic_obsidian.png"}, + "Obsidian Stairs", + "Obsidian Slab", + "Obsidian Panel", + "Obsidian Microblock", + "obsidian") + +minetest.register_node( "technic:mineral_diamond", { + description = "Diamond Ore", + tiles = { "default_stone.png^technic_mineral_diamond.png" }, + is_ground_content = true, + groups = {cracky=3}, + sounds = default.node_sound_stone_defaults(), + drop = 'craft "technic:diamond" 1', +}) + +minetest.register_craftitem( "technic:diamond", { + description = "Diamond", + inventory_image = "technic_diamond.png", + on_place_on_ground = minetest.craftitem_place_item, +}) + +minetest.register_node( "technic:mineral_uranium", { + description = "Uranium Ore", + tiles = { "default_stone.png^technic_mineral_uranium.png" }, + is_ground_content = true, + groups = {cracky=3}, + sounds = default.node_sound_stone_defaults(), + drop = 'craft "technic:uranium" 1', +}) + +minetest.register_craftitem( "technic:uranium", { + description = "Uranium", + inventory_image = "technic_uranium.png", + on_place_on_ground = minetest.craftitem_place_item, +}) + +minetest.register_node( "technic:mineral_chromium", { + description = "Chromium Ore", + tiles = { "default_stone.png^technic_mineral_chromium.png" }, + is_ground_content = true, + groups = {cracky=3}, + sounds = default.node_sound_stone_defaults(), + drop = 'craft "technic:chromium_lump" 1', +}) + +minetest.register_craftitem( "technic:chromium_lump", { + description = "Chromium Lump", + inventory_image = "technic_chromium_lump.png", + on_place_on_ground = minetest.craftitem_place_item, +}) + +minetest.register_craftitem( "technic:chromium_ingot", { + description = "Chromium Ingot", + inventory_image = "technic_chromium_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_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_craftitem( "technic:stainless_steel_ingot", { + description = "Stainless Steel Ingot", + inventory_image = "technic_stainless_steel_ingot.png", +}) + +minetest.register_craftitem( "technic:brass_ingot", { + description = "Brass Ingot", + inventory_image = "technic_brass_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 + end + local y_min = math.max(minp.y, height_min) + local y_max = math.min(maxp.y, height_max) + local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) + local pr = PseudoRandom(seed) + local num_chunks = math.floor(chunks_per_volume * volume) + local chunk_size = 3 + if ore_per_chunk <= 4 then + chunk_size = 2 + end + local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk) + --print("generate_ore num_chunks: "..dump(num_chunks)) + for i=1,num_chunks do + if (y_max-chunk_size+1 <= y_min) then return end + local y0 = pr:next(y_min, y_max-chunk_size+1) + if y0 >= height_min and y0 <= height_max then + local x0 = pr:next(minp.x, maxp.x-chunk_size+1) + local z0 = pr:next(minp.z, maxp.z-chunk_size+1) + local p0 = {x=x0, y=y0, z=z0} + for x1=0,chunk_size-1 do + for y1=0,chunk_size-1 do + for z1=0,chunk_size-1 do + if pr:next(1,inverse_chance) == 1 then + local x2 = x0+x1 + local y2 = y0+y1 + local z2 = z0+z1 + local p2 = {x=x2, y=y2, z=z2} + if minetest.env:get_node(p2).name == wherein then + minetest.env:set_node(p2, {name=name}) + end + end + end + end + end + end + end + --print("generate_ore done") +end + +minetest.register_on_generated(function(minp, maxp, seed) +generate_ore("technic:mineral_diamond", "default:stone", minp, maxp, seed+21, 1/11/11/11, 4, -31000, -450) +generate_ore("technic:mineral_uranium", "default:stone", minp, maxp, seed+22, 1/10/10/10, 3, -300, -80) +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, 4, -31000, 2) +generate_ore("technic:marble", "default:stone", minp, maxp, seed+25, 1/128, 20, -100, -32) +generate_ore("technic:granite", "default:stone", minp, maxp, seed+25, 1/128, 15, -190, -90) +generate_stratus("technic:obsidian", + {"default:stone"}, + {"default:lava_source"},{"default:air"}, + minp, maxp, seed+4, 10, 25, 7, -450, -31000, -450) +end) + +function generate_stratus(name, wherein, ceilin, ceil, minp, maxp, seed, stratus_chance, radius, radius_y, deep, height_min, height_max) + if maxp.y < height_min or minp.y > height_max then + return + end + -- it will be only generate a stratus for every 100 m of area + local stratus_per_volume=1 + local area=45 + local y_min = math.max(minp.y, height_min) + local y_max = math.min(maxp.y, height_max) + local volume = ((maxp.x-minp.x+1)/area)*((y_max-y_min+1)/area)*((maxp.z-minp.z+1)/area) + local pr = PseudoRandom(seed) + local blocks = math.floor(stratus_per_volume*volume) + print(" <<"..dump(name)..">>"); + if blocks == 0 then + blocks = 1 + end + print(" blocks: "..dump(blocks).." in vol: "..dump(volume).." ("..dump(maxp.x-minp.x+1)..","..dump(y_max-y_min+1)..","..dump(maxp.z-minp.z+1)..")") + for i=1,blocks do + local x = pr:next(1,stratus_chance) + if x == 1 then + -- TODO deep + local y0=y_max-radius_y+1 + if y0 < y_min then + y0=y_min + else + y0=pr:next(y_min, y0) + end + local x0 = maxp.x-radius+1 + if x0 < minp.x then + x0 = minp.x + else + x0 = pr:next(minp.x, x0) + end + local z0 = maxp.z-radius+1 + if z0 < minp.z then + x0 = minp.z + else + z0 = pr:next(minp.z, z0) + end + local p0 = {x=x0, y=y0, z=z0} + local n = minetest.env:get_node(p0).name + local i = 0 + --print(" upper node "..n) + x = 0 + for k, v in ipairs(ceilin) do + if n == v then + x = 1 + break + end + end + if x == 1 then + -- search for the node to replace + --print(" Searching nodes to replace from "..dump(y0-1).." to "..dump(y_min)) + for y1=y0-1,y_min,-1 do + p0.y=y1 + n = minetest.env:get_node(p0).name + x = 0 + for k, v in ipairs(wherein) do + if n == v then + x = 1 + break + end + end + if x == 1 then + y0=y1-deep + if y0 < y_min then + y0 = y_min + end + break + end + end + local rx=pr:next(radius/2,radius)+1 + local rz=pr:next(radius/2,radius)+1 + local ry=pr:next(radius_y/2,radius_y)+1 + --print(" area of generation ("..dump(rx)..","..dump(rz)..","..dump(ry)..")") + for x1=0,rx do + rz = rz + 3 - pr:next(1,6) + if rz < 1 then + rz = 1 + end + for z1=pr:next(1,3),rz do + local ry0=ry+ pr:next(1,3) + for y1=pr:next(1,3),ry0 do + local x2 = x0+x1 + local y2 = y0+y1 + local z2 = z0+z1 + local p2 = {x=x2, y=y2, z=z2} + n = minetest.env:get_node(p2).name + x = 0 + for k, v in ipairs(wherein) do + if n == v then + x = 1 + break + end + end + if x == 1 then + if ceil == nil then + minetest.env:set_node(p2, {name=name}) + i = i +1 + else + local p3 = {p2.x,p2.y+1,p2} + if minetest.env:get_node(p3).name == ceil then + minetest.env:set_node(p2, {name=name}) + i = i +1 + end + end + end + end + end + end + print(" generated "..dump(i).." blocks in ("..dump(x0)..","..dump(y0)..","..dump(z0)..")") + end + + end + end + --print("generate_ore done") +end \ No newline at end of file diff --git a/technic/technic/project_table.lua b/technic/technic/project_table.lua new file mode 100644 index 0000000..355295c --- /dev/null +++ b/technic/technic/project_table.lua @@ -0,0 +1,39 @@ +minetest.register_craft({ + output = 'technic:project_table 1', + recipe = { + {'default:wood','default:wood','default:wood'}, + {'default:wood','default:chest','default:wood'}, + {'default:stone','default:stone','default:stone'}, + } +}) + + +minetest.register_craftitem("technic:project_table", { + description = "Project Table", + stack_max = 99, +}) + +minetest.register_node("technic:project_table", { + description = "Project Table", + 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", "Iron Chest") + 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, +}) \ No newline at end of file diff --git a/technic/technic/rubber.lua b/technic/technic/rubber.lua new file mode 100644 index 0000000..311f3af --- /dev/null +++ b/technic/technic/rubber.lua @@ -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 diff --git a/technic/technic/screwdriver.lua b/technic/technic/screwdriver.lua new file mode 100644 index 0000000..0b81217 --- /dev/null +++ b/technic/technic/screwdriver.lua @@ -0,0 +1,47 @@ + minetest.register_tool("technic:screwdriver", { + description = "Screwdriver", + inventory_image = "technic_screwdriver.png", + on_use = function(itemstack, user, pointed_thing) + -- Must be pointing to facedir applicable node + if pointed_thing.type~="node" then return end + local pos=minetest.get_pointed_thing_position(pointed_thing,above) + local node=minetest.env:get_node(pos) + local node_name=node.name + if minetest.registered_nodes[node_name].paramtype2 == "facedir" or minetest.registered_nodes[node_name].paramtype2 == "wallmounted" then + if node.param2==nil then return end + -- Get ready to set the param2 + local n = node.param2 + if minetest.registered_nodes[node_name].paramtype2 == "facedir" then + n = n+1 + if n == 4 then n = 0 end + else + n = n+1 + if n == 6 then n = 0 end + end + -- hacky_swap_node, unforunatly. + local meta = minetest.env:get_meta(pos) + local meta0 = meta:to_table() + node.param2 = n + minetest.env:set_node(pos,node) + meta = minetest.env:get_meta(pos) + meta:from_table(meta0) + 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 + end, + }) + + minetest.register_craft({ + output = "technic:screwdriver", + recipe = { + {"technic:stainless_steel_ingot"}, + {"default:stick"} + } + }) diff --git a/technic/technic/silver_chest.lua b/technic/technic/silver_chest.lua new file mode 100644 index 0000000..66a915a --- /dev/null +++ b/technic/technic/silver_chest.lua @@ -0,0 +1,197 @@ +minetest.register_craft({ + output = 'technic:silver_chest 1', + recipe = { + {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, + {'moreores:silver_ingot','technic:copper_chest','moreores:silver_ingot'}, + {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:silver_locked_chest 1', + recipe = { + {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, + {'moreores:silver_ingot','technic:copper_locked_chest','moreores:silver_ingot'}, + {'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:silver_locked_chest 1', + recipe = { + {'default:steel_ingot'}, + {'technic:silver_chest'}, + } +}) + +minetest.register_craftitem("technic:silver_chest", { + description = "Silver Chest", + stack_max = 99, +}) +minetest.register_craftitem("technic:silver_locked_chest", { + description = "Silver Locked Chest", + stack_max = 99, +}) + +minetest.register_node("technic:silver_chest", { + description = "Silver Chest", + tiles = {"technic_silver_chest_top.png", "technic_silver_chest_top.png", "technic_silver_chest_side.png", + "technic_silver_chest_side.png", "technic_silver_chest_side.png", "technic_silver_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[11,9;]".. + "list[current_name;main;0,0;11,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Silver Chest") + local inv = meta:get_inventory() + inv:set_size("main", 11*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); + meta:set_string("formspec", "hack:sign_text_input") + end, + + on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.env:get_meta(pos); + fields.text = fields.text or "" + meta:set_string("text", fields.text) + meta:set_string("infotext", '"'..fields.text..'"') + + meta:set_string("formspec", + "invsize[11,9;]".. + "list[current_name;main;0,0;11,4;]".. + "list[current_player;main;0,5;8,4;]") + end, + + on_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_move_allow_all( + pos, from_list, from_index, to_list, to_index, count, player) + end, + on_metadata_inventory_offer = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to chest at "..minetest.pos_to_string(pos)) + return minetest.node_metadata_inventory_offer_allow_all( + pos, listname, index, stack, player) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from chest at "..minetest.pos_to_string(pos)) + end, + +}) + +local function has_locked_chest_privilege(meta, player) + if player:get_player_name() ~= meta:get_string("owner") then + return false + end + return true +end + +minetest.register_node("technic:silver_locked_chest", { + description = "Silver Locked Chest", + tiles = {"technic_silver_chest_top.png", "technic_silver_chest_top.png", "technic_silver_chest_side.png", + "technic_silver_chest_side.png", "technic_silver_chest_side.png", "technic_silver_chest_locked.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + after_place_node = function(pos, placer) + local meta = minetest.env:get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Silver Locked Chest (owned by ".. + meta:get_string("owner")..")") + end, +on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "invsize[11,9;]".. + "list[current_name;main;0,0;11,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Silver Locked Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 11*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); + meta:set_string("formspec", "hack:sign_text_input") + end, + + on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.env:get_meta(pos); + fields.text = fields.text or "" + meta:set_string("text", fields.text) + meta:set_string("infotext", '"'..fields.text..'"') + + meta:set_string("formspec", + "invsize[11,9;]".. + "list[current_name;main;0,0;11,4;]".. + "list[current_player;main;0,5;8,4;]") + end, + + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from locked chest at "..minetest.pos_to_string(pos)) + end, +}) diff --git a/technic/technic/solar_panel.lua b/technic/technic/solar_panel.lua new file mode 100644 index 0000000..02a8f69 --- /dev/null +++ b/technic/technic/solar_panel.lua @@ -0,0 +1,76 @@ +minetest.register_node("technic:solar_panel", { + tiles = {"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png", + "technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + sounds = default.node_sound_wood_defaults(), + description="Solar Panel", + active = false, + technic_power_machine=1, + internal_EU_buffer=0; + internal_EU_buffer_size=1000; + drawtype = "nodebox", + paramtype = "light", + is_ground_content = true, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_float("technic_power_machine", 1) + meta:set_float("internal_EU_buffer", 0) + meta:set_float("internal_EU_buffer_size", 1000) + + meta:set_string("infotext", "Solar Panel") + meta:set_float("active", false) + end, +}) + +minetest.register_craft({ + output = 'technic:solar_panel 1', + recipe = { + {'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer','technic:doped_silicon_wafer'}, + {'technic:doped_silicon_wafer', 'moreores:copper_ingot','technic:doped_silicon_wafer'}, + {'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer','technic:doped_silicon_wafer'}, + + } +}) + +minetest.register_abm( + {nodenames = {"technic:solar_panel"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + + local pos1={} + pos1.y=pos.y+1 + pos1.x=pos.x + pos1.z=pos.z + + local light = minetest.env:get_node_light(pos1, nil) + local meta = minetest.env:get_meta(pos) + if light == nil then light = 0 end + if light >= 12 then + meta:set_string("infotext", "Solar Panel is active ") + meta:set_float("active",1) + local internal_EU_buffer=meta:get_float("internal_EU_buffer") + local internal_EU_buffer_size=meta:get_float("internal_EU_buffer_size") + local charge_to_give=40+(pos1.y/250*40) -- make solar energy depending on height + if charge_to_give<0 then charge_to_give=0 end + if charge_to_give>160 then charge_to_give=160 end + if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then + charge_to_give=internal_EU_buffer_size-internal_EU_buffer + end + internal_EU_buffer=internal_EU_buffer+charge_to_give + meta:set_float("internal_EU_buffer",internal_EU_buffer) + + else + meta:set_string("infotext", "Solar Panel is inactive"); + meta:set_float("active",0) + end + end, +}) \ No newline at end of file diff --git a/technic/technic/solar_panel_mv.lua b/technic/technic/solar_panel_mv.lua new file mode 100644 index 0000000..93e21e7 --- /dev/null +++ b/technic/technic/solar_panel_mv.lua @@ -0,0 +1,76 @@ +minetest.register_node("technic:solar_panel_mv", { + tiles = {"technic_mv_solar_panel_top.png", "technic_mv_solar_panel_bottom.png", "technic_mv_solar_panel_side.png", + "technic_mv_solar_panel_side.png", "technic_mv_solar_panel_side.png", "technic_mv_solar_panel_side.png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + sounds = default.node_sound_wood_defaults(), + description="MV Solar Panel", + active = false, + technic_mv_power_machine=1, + internal_EU_buffer=0; + internal_EU_buffer_size=10000; + drawtype = "nodebox", + paramtype = "light", + is_ground_content = true, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_float("technic_mv_power_machine", 1) + meta:set_float("internal_EU_buffer", 0) + meta:set_float("internal_EU_buffer_size", 10000) + + meta:set_string("infotext", "MV Solar Panel") + meta:set_float("active", false) + end, +}) + +minetest.register_craft({ + output = 'technic:solar_panel_mv 1', + recipe = { + {'technic:solar_panel', 'technic:solar_panel','technic:solar_panel'}, + {'technic:solar_panel', 'technic:mv_transformer','technic:solar_panel'}, + {'', 'technic:mv_cable',''}, + + } +}) + +minetest.register_abm( + {nodenames = {"technic:solar_panel_mv"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + + local pos1={} + pos1.y=pos.y+1 + pos1.x=pos.x + pos1.z=pos.z + + local light = minetest.env:get_node_light(pos1, nil) + local meta = minetest.env:get_meta(pos) + if light == nil then light = 0 end + if light >= 14 then + meta:set_string("infotext", "Solar Panel is active ") + meta:set_float("active",1) + local internal_EU_buffer=meta:get_float("internal_EU_buffer") + local internal_EU_buffer_size=meta:get_float("internal_EU_buffer_size") + local charge_to_give=300+(pos1.y/250*300) -- make solar energy depending on height + if charge_to_give<0 then charge_to_give=0 end + if charge_to_give>600 then charge_to_give=600 end + if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then + charge_to_give=internal_EU_buffer_size-internal_EU_buffer + end + internal_EU_buffer=internal_EU_buffer+charge_to_give + meta:set_float("internal_EU_buffer",internal_EU_buffer) + + else + meta:set_string("infotext", "Solar Panel is inactive"); + meta:set_float("active",0) + end + end, +}) \ No newline at end of file diff --git a/technic/technic/sonic_screwdriver.lua b/technic/technic/sonic_screwdriver.lua new file mode 100644 index 0000000..d089778 --- /dev/null +++ b/technic/technic/sonic_screwdriver.lua @@ -0,0 +1,55 @@ +sonic_screwdriver_max_charge=15000 + + minetest.register_tool("technic:sonic_screwdriver", { + description = "Sonic Screwdriver", + inventory_image = "technic_sonic_screwdriver.png", + on_use = function(itemstack, user, pointed_thing) + -- Must be pointing to facedir applicable node + if pointed_thing.type~="node" then return end + local pos=minetest.get_pointed_thing_position(pointed_thing,above) + local node=minetest.env:get_node(pos) + local node_name=node.name + if minetest.registered_nodes[node_name].paramtype2 == "facedir" or minetest.registered_nodes[node_name].paramtype2 == "wallmounted" then + if node.param2==nil then return end + item=itemstack:to_table() + if item["metadata"]=="" or item["metadata"]=="0" then return end + local charge=tonumber((item["metadata"])) + if charge-100>0 then + minetest.sound_play("technic_sonic_screwdriver", {pos = pos, gain = 0.3, max_hear_distance = 10,}) + local n = node.param2 + if minetest.registered_nodes[node_name].paramtype2 == "facedir" then + n = n+1 + if n == 4 then n = 0 end + else + n = n+1 + if n == 6 then n = 0 end + end + -- hacky_swap_node, unforunatly. + local meta = minetest.env:get_meta(pos) + local meta0 = meta:to_table() + node.param2 = n + minetest.env:set_node(pos,node) + meta = minetest.env:get_meta(pos) + meta:from_table(meta0) + + charge =charge-100; + item["metadata"]=tostring(charge) + set_RE_wear(item,charge,sonic_screwdriver_max_charge) + itemstack:replace(item) + end + return itemstack + else + return itemstack + end + end, + + }) + + minetest.register_craft({ + output = "technic:sonic_screwdriver", + recipe = { + {"technic:diamond"}, + {"technic:battery"}, + {"technic:stainless_steel_ingot"} + } + }) diff --git a/technic/technic/sounds/chainsaw.ogg b/technic/technic/sounds/chainsaw.ogg new file mode 100644 index 0000000..5fe7552 Binary files /dev/null and b/technic/technic/sounds/chainsaw.ogg differ diff --git a/technic/technic/sounds/item_drop_pickup.1.ogg b/technic/technic/sounds/item_drop_pickup.1.ogg new file mode 100644 index 0000000..2ae432d Binary files /dev/null and b/technic/technic/sounds/item_drop_pickup.1.ogg differ diff --git a/technic/technic/sounds/item_drop_pickup.2.ogg b/technic/technic/sounds/item_drop_pickup.2.ogg new file mode 100644 index 0000000..f58bf08 Binary files /dev/null and b/technic/technic/sounds/item_drop_pickup.2.ogg differ diff --git a/technic/technic/sounds/item_drop_pickup.3.ogg b/technic/technic/sounds/item_drop_pickup.3.ogg new file mode 100644 index 0000000..cf57c94 Binary files /dev/null and b/technic/technic/sounds/item_drop_pickup.3.ogg differ diff --git a/technic/technic/sounds/item_drop_pickup.4.ogg b/technic/technic/sounds/item_drop_pickup.4.ogg new file mode 100644 index 0000000..bfe99d9 Binary files /dev/null and b/technic/technic/sounds/item_drop_pickup.4.ogg differ diff --git a/technic/technic/sounds/mining_drill.ogg b/technic/technic/sounds/mining_drill.ogg new file mode 100644 index 0000000..1493544 Binary files /dev/null and b/technic/technic/sounds/mining_drill.ogg differ diff --git a/technic/technic/sounds/technic_laser.ogg b/technic/technic/sounds/technic_laser.ogg new file mode 100644 index 0000000..19be080 Binary files /dev/null and b/technic/technic/sounds/technic_laser.ogg differ diff --git a/technic/technic/sounds/technic_sonic_screwdriver.ogg b/technic/technic/sounds/technic_sonic_screwdriver.ogg new file mode 100644 index 0000000..471bb72 Binary files /dev/null and b/technic/technic/sounds/technic_sonic_screwdriver.ogg differ diff --git a/technic/technic/tetris.lua b/technic/technic/tetris.lua new file mode 100644 index 0000000..3b14c47 --- /dev/null +++ b/technic/technic/tetris.lua @@ -0,0 +1,17 @@ +minetest.register_node("technic:tetris_machine_node1", { + tiles = {"tetris_machine_top.png", "technic_mv_battery_box_bottom.png", "tetris_machine_front1.png", + "tetris_machine_side1B.png", "tetris_machine_side1P.png", "tetris_machine_side1L.png"}, + tile_images = {"technic_tetris_machine.png",}, + is_ground_content = true, + groups = {cracky=1}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("technic:tetris_machine_node2", { + tiles = {"tetris_machine_top.png", "technic_mv_battery_box_bottom.png", "tetris_machine_front2.png", + "tetris_machine_side2B.png", "tetris_machine_side2P.png", "tetris_machine_side2L.png"}, + tile_images = {"technic_tetris_machine.png",}, + is_ground_content = true, + groups = {cracky=1}, + sounds = default.node_sound_stone_defaults(), +}) diff --git a/technic/technic/textures/technic_alloy_furnace_front.png b/technic/technic/textures/technic_alloy_furnace_front.png new file mode 100644 index 0000000..9123fb6 Binary files /dev/null and b/technic/technic/textures/technic_alloy_furnace_front.png differ diff --git a/technic/technic/textures/technic_alloy_furnace_front_active.png b/technic/technic/textures/technic_alloy_furnace_front_active.png new file mode 100644 index 0000000..4dda2e6 Binary files /dev/null and b/technic/technic/textures/technic_alloy_furnace_front_active.png differ diff --git a/technic/technic/textures/technic_alloy_furnace_side.png b/technic/technic/textures/technic_alloy_furnace_side.png new file mode 100644 index 0000000..b5bd428 Binary files /dev/null and b/technic/technic/textures/technic_alloy_furnace_side.png differ diff --git a/technic/technic/textures/technic_alloy_furnace_top.png b/technic/technic/textures/technic_alloy_furnace_top.png new file mode 100644 index 0000000..67ef4b7 Binary files /dev/null and b/technic/technic/textures/technic_alloy_furnace_top.png differ diff --git a/technic/technic/textures/technic_battery.png b/technic/technic/textures/technic_battery.png new file mode 100644 index 0000000..ee83b74 Binary files /dev/null and b/technic/technic/textures/technic_battery.png differ diff --git a/technic/technic/textures/technic_battery_box_bottom.png b/technic/technic/textures/technic_battery_box_bottom.png new file mode 100644 index 0000000..03c7ccc Binary files /dev/null and b/technic/technic/textures/technic_battery_box_bottom.png differ diff --git a/technic/technic/textures/technic_battery_box_side0.png b/technic/technic/textures/technic_battery_box_side0.png new file mode 100644 index 0000000..2662ac0 Binary files /dev/null and b/technic/technic/textures/technic_battery_box_side0.png differ diff --git a/technic/technic/textures/technic_battery_box_top.png b/technic/technic/textures/technic_battery_box_top.png new file mode 100644 index 0000000..4953a32 Binary files /dev/null and b/technic/technic/textures/technic_battery_box_top.png differ diff --git a/technic/technic/textures/technic_battery_reload.png b/technic/technic/textures/technic_battery_reload.png new file mode 100644 index 0000000..164b4ac Binary files /dev/null and b/technic/technic/textures/technic_battery_reload.png differ diff --git a/technic/technic/textures/technic_brass_dust.png b/technic/technic/textures/technic_brass_dust.png new file mode 100644 index 0000000..f86167a Binary files /dev/null and b/technic/technic/textures/technic_brass_dust.png differ diff --git a/technic/technic/textures/technic_brass_ingot.png b/technic/technic/textures/technic_brass_ingot.png new file mode 100644 index 0000000..2d8b153 Binary files /dev/null and b/technic/technic/textures/technic_brass_ingot.png differ diff --git a/technic/technic/textures/technic_bronze_dust.png b/technic/technic/textures/technic_bronze_dust.png new file mode 100644 index 0000000..0a2401e Binary files /dev/null and b/technic/technic/textures/technic_bronze_dust.png differ diff --git a/technic/technic/textures/technic_chainsaw.png b/technic/technic/textures/technic_chainsaw.png new file mode 100644 index 0000000..b7ceee6 Binary files /dev/null and b/technic/technic/textures/technic_chainsaw.png differ diff --git a/technic/technic/textures/technic_chromium_dust.png b/technic/technic/textures/technic_chromium_dust.png new file mode 100644 index 0000000..a33358b Binary files /dev/null and b/technic/technic/textures/technic_chromium_dust.png differ diff --git a/technic/technic/textures/technic_chromium_ingot.png b/technic/technic/textures/technic_chromium_ingot.png new file mode 100644 index 0000000..91d5b20 Binary files /dev/null and b/technic/technic/textures/technic_chromium_ingot.png differ diff --git a/technic/technic/textures/technic_chromium_lump.png b/technic/technic/textures/technic_chromium_lump.png new file mode 100644 index 0000000..1588f92 Binary files /dev/null and b/technic/technic/textures/technic_chromium_lump.png differ diff --git a/technic/technic/textures/technic_coal_alloy_furnace_bottom.png b/technic/technic/textures/technic_coal_alloy_furnace_bottom.png new file mode 100644 index 0000000..7a5eed7 Binary files /dev/null and b/technic/technic/textures/technic_coal_alloy_furnace_bottom.png differ diff --git a/technic/technic/textures/technic_coal_alloy_furnace_front.png b/technic/technic/textures/technic_coal_alloy_furnace_front.png new file mode 100644 index 0000000..b00bef3 Binary files /dev/null and b/technic/technic/textures/technic_coal_alloy_furnace_front.png differ diff --git a/technic/technic/textures/technic_coal_alloy_furnace_front_active.png b/technic/technic/textures/technic_coal_alloy_furnace_front_active.png new file mode 100644 index 0000000..b41f619 Binary files /dev/null and b/technic/technic/textures/technic_coal_alloy_furnace_front_active.png differ diff --git a/technic/technic/textures/technic_coal_alloy_furnace_side.png b/technic/technic/textures/technic_coal_alloy_furnace_side.png new file mode 100644 index 0000000..3db8daa Binary files /dev/null and b/technic/technic/textures/technic_coal_alloy_furnace_side.png differ diff --git a/technic/technic/textures/technic_coal_alloy_furnace_top.png b/technic/technic/textures/technic_coal_alloy_furnace_top.png new file mode 100644 index 0000000..c648fe8 Binary files /dev/null and b/technic/technic/textures/technic_coal_alloy_furnace_top.png differ diff --git a/technic/technic/textures/technic_coal_dust.png b/technic/technic/textures/technic_coal_dust.png new file mode 100644 index 0000000..4a1da0c Binary files /dev/null and b/technic/technic/textures/technic_coal_dust.png differ diff --git a/technic/technic/textures/technic_concrete_block.png b/technic/technic/textures/technic_concrete_block.png new file mode 100644 index 0000000..91364f3 Binary files /dev/null and b/technic/technic/textures/technic_concrete_block.png differ diff --git a/technic/technic/textures/technic_constructor_back.png b/technic/technic/textures/technic_constructor_back.png new file mode 100644 index 0000000..6baf788 Binary files /dev/null and b/technic/technic/textures/technic_constructor_back.png differ diff --git a/technic/technic/textures/technic_constructor_front_off.png b/technic/technic/textures/technic_constructor_front_off.png new file mode 100644 index 0000000..f878e55 Binary files /dev/null and b/technic/technic/textures/technic_constructor_front_off.png differ diff --git a/technic/technic/textures/technic_constructor_front_on.png b/technic/technic/textures/technic_constructor_front_on.png new file mode 100644 index 0000000..89189d6 Binary files /dev/null and b/technic/technic/textures/technic_constructor_front_on.png differ diff --git a/technic/technic/textures/technic_constructor_mk1_bottom_off.png b/technic/technic/textures/technic_constructor_mk1_bottom_off.png new file mode 100644 index 0000000..205dcc4 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk1_bottom_off.png differ diff --git a/technic/technic/textures/technic_constructor_mk1_bottom_on.png b/technic/technic/textures/technic_constructor_mk1_bottom_on.png new file mode 100644 index 0000000..9896c52 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk1_bottom_on.png differ diff --git a/technic/technic/textures/technic_constructor_mk1_side1_off.png b/technic/technic/textures/technic_constructor_mk1_side1_off.png new file mode 100644 index 0000000..e8a01ff Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk1_side1_off.png differ diff --git a/technic/technic/textures/technic_constructor_mk1_side1_on.png b/technic/technic/textures/technic_constructor_mk1_side1_on.png new file mode 100644 index 0000000..c897942 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk1_side1_on.png differ diff --git a/technic/technic/textures/technic_constructor_mk1_side2_off.png b/technic/technic/textures/technic_constructor_mk1_side2_off.png new file mode 100644 index 0000000..8da65f6 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk1_side2_off.png differ diff --git a/technic/technic/textures/technic_constructor_mk1_side2_on.png b/technic/technic/textures/technic_constructor_mk1_side2_on.png new file mode 100644 index 0000000..da8ed34 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk1_side2_on.png differ diff --git a/technic/technic/textures/technic_constructor_mk1_top_off.png b/technic/technic/textures/technic_constructor_mk1_top_off.png new file mode 100644 index 0000000..7d8c7e0 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk1_top_off.png differ diff --git a/technic/technic/textures/technic_constructor_mk1_top_on.png b/technic/technic/textures/technic_constructor_mk1_top_on.png new file mode 100644 index 0000000..439caf5 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk1_top_on.png differ diff --git a/technic/technic/textures/technic_constructor_mk2_bottom_off.png b/technic/technic/textures/technic_constructor_mk2_bottom_off.png new file mode 100644 index 0000000..83c5b07 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk2_bottom_off.png differ diff --git a/technic/technic/textures/technic_constructor_mk2_bottom_on.png b/technic/technic/textures/technic_constructor_mk2_bottom_on.png new file mode 100644 index 0000000..9ad76f4 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk2_bottom_on.png differ diff --git a/technic/technic/textures/technic_constructor_mk2_side1_off.png b/technic/technic/textures/technic_constructor_mk2_side1_off.png new file mode 100644 index 0000000..584dfe3 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk2_side1_off.png differ diff --git a/technic/technic/textures/technic_constructor_mk2_side1_on.png b/technic/technic/textures/technic_constructor_mk2_side1_on.png new file mode 100644 index 0000000..fe02042 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk2_side1_on.png differ diff --git a/technic/technic/textures/technic_constructor_mk2_side2_off.png b/technic/technic/textures/technic_constructor_mk2_side2_off.png new file mode 100644 index 0000000..fd9ad74 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk2_side2_off.png differ diff --git a/technic/technic/textures/technic_constructor_mk2_side2_on.png b/technic/technic/textures/technic_constructor_mk2_side2_on.png new file mode 100644 index 0000000..f51411a Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk2_side2_on.png differ diff --git a/technic/technic/textures/technic_constructor_mk2_top_off.png b/technic/technic/textures/technic_constructor_mk2_top_off.png new file mode 100644 index 0000000..e3e3292 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk2_top_off.png differ diff --git a/technic/technic/textures/technic_constructor_mk2_top_on.png b/technic/technic/textures/technic_constructor_mk2_top_on.png new file mode 100644 index 0000000..83043d4 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk2_top_on.png differ diff --git a/technic/technic/textures/technic_constructor_mk3_bottom_off.png b/technic/technic/textures/technic_constructor_mk3_bottom_off.png new file mode 100644 index 0000000..5f46154 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk3_bottom_off.png differ diff --git a/technic/technic/textures/technic_constructor_mk3_bottom_on.png b/technic/technic/textures/technic_constructor_mk3_bottom_on.png new file mode 100644 index 0000000..f76f29b Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk3_bottom_on.png differ diff --git a/technic/technic/textures/technic_constructor_mk3_side1_off.png b/technic/technic/textures/technic_constructor_mk3_side1_off.png new file mode 100644 index 0000000..0ea1fc0 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk3_side1_off.png differ diff --git a/technic/technic/textures/technic_constructor_mk3_side1_on.png b/technic/technic/textures/technic_constructor_mk3_side1_on.png new file mode 100644 index 0000000..ba86332 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk3_side1_on.png differ diff --git a/technic/technic/textures/technic_constructor_mk3_side2_off.png b/technic/technic/textures/technic_constructor_mk3_side2_off.png new file mode 100644 index 0000000..8e8dce4 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk3_side2_off.png differ diff --git a/technic/technic/textures/technic_constructor_mk3_side2_on.png b/technic/technic/textures/technic_constructor_mk3_side2_on.png new file mode 100644 index 0000000..12dff69 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk3_side2_on.png differ diff --git a/technic/technic/textures/technic_constructor_mk3_top_off.png b/technic/technic/textures/technic_constructor_mk3_top_off.png new file mode 100644 index 0000000..705f255 Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk3_top_off.png differ diff --git a/technic/technic/textures/technic_constructor_mk3_top_on.png b/technic/technic/textures/technic_constructor_mk3_top_on.png new file mode 100644 index 0000000..cef077e Binary files /dev/null and b/technic/technic/textures/technic_constructor_mk3_top_on.png differ diff --git a/technic/technic/textures/technic_copper_chest_front.png b/technic/technic/textures/technic_copper_chest_front.png new file mode 100644 index 0000000..1769435 Binary files /dev/null and b/technic/technic/textures/technic_copper_chest_front.png differ diff --git a/technic/technic/textures/technic_copper_chest_locked.png b/technic/technic/textures/technic_copper_chest_locked.png new file mode 100644 index 0000000..6d059e9 Binary files /dev/null and b/technic/technic/textures/technic_copper_chest_locked.png differ diff --git a/technic/technic/textures/technic_copper_chest_side.png b/technic/technic/textures/technic_copper_chest_side.png new file mode 100644 index 0000000..2c7943f Binary files /dev/null and b/technic/technic/textures/technic_copper_chest_side.png differ diff --git a/technic/technic/textures/technic_copper_chest_top.png b/technic/technic/textures/technic_copper_chest_top.png new file mode 100644 index 0000000..2ab8104 Binary files /dev/null and b/technic/technic/textures/technic_copper_chest_top.png differ diff --git a/technic/technic/textures/technic_copper_coil.png b/technic/technic/textures/technic_copper_coil.png new file mode 100644 index 0000000..db6db1a Binary files /dev/null and b/technic/technic/textures/technic_copper_coil.png differ diff --git a/technic/technic/textures/technic_copper_dust.png b/technic/technic/textures/technic_copper_dust.png new file mode 100644 index 0000000..68678ed Binary files /dev/null and b/technic/technic/textures/technic_copper_dust.png differ diff --git a/technic/technic/textures/technic_deployer_back.png b/technic/technic/textures/technic_deployer_back.png new file mode 100644 index 0000000..0bc8df9 Binary files /dev/null and b/technic/technic/textures/technic_deployer_back.png differ diff --git a/technic/technic/textures/technic_deployer_bottom.png b/technic/technic/textures/technic_deployer_bottom.png new file mode 100644 index 0000000..ff1a2c6 Binary files /dev/null and b/technic/technic/textures/technic_deployer_bottom.png differ diff --git a/technic/technic/textures/technic_deployer_front_off.png b/technic/technic/textures/technic_deployer_front_off.png new file mode 100644 index 0000000..d0f6f55 Binary files /dev/null and b/technic/technic/textures/technic_deployer_front_off.png differ diff --git a/technic/technic/textures/technic_deployer_front_on.png b/technic/technic/textures/technic_deployer_front_on.png new file mode 100644 index 0000000..368ce32 Binary files /dev/null and b/technic/technic/textures/technic_deployer_front_on.png differ diff --git a/technic/technic/textures/technic_deployer_side.png b/technic/technic/textures/technic_deployer_side.png new file mode 100644 index 0000000..aefd7c8 Binary files /dev/null and b/technic/technic/textures/technic_deployer_side.png differ diff --git a/technic/technic/textures/technic_deployer_side1.png b/technic/technic/textures/technic_deployer_side1.png new file mode 100644 index 0000000..8cb8634 Binary files /dev/null and b/technic/technic/textures/technic_deployer_side1.png differ diff --git a/technic/technic/textures/technic_deployer_side2.png b/technic/technic/textures/technic_deployer_side2.png new file mode 100644 index 0000000..c2855d0 Binary files /dev/null and b/technic/technic/textures/technic_deployer_side2.png differ diff --git a/technic/technic/textures/technic_deployer_top.png b/technic/technic/textures/technic_deployer_top.png new file mode 100644 index 0000000..941d333 Binary files /dev/null and b/technic/technic/textures/technic_deployer_top.png differ diff --git a/technic/technic/textures/technic_diamond.png b/technic/technic/textures/technic_diamond.png new file mode 100644 index 0000000..23e6126 Binary files /dev/null and b/technic/technic/textures/technic_diamond.png differ diff --git a/technic/technic/textures/technic_diamond_block.png b/technic/technic/textures/technic_diamond_block.png new file mode 100644 index 0000000..347ed78 Binary files /dev/null and b/technic/technic/textures/technic_diamond_block.png differ diff --git a/technic/technic/textures/technic_diamond_block_blue.png b/technic/technic/textures/technic_diamond_block_blue.png new file mode 100644 index 0000000..d89bd6e Binary files /dev/null and b/technic/technic/textures/technic_diamond_block_blue.png differ diff --git a/technic/technic/textures/technic_diamond_block_green.png b/technic/technic/textures/technic_diamond_block_green.png new file mode 100644 index 0000000..996b254 Binary files /dev/null and b/technic/technic/textures/technic_diamond_block_green.png differ diff --git a/technic/technic/textures/technic_diamond_block_red.png b/technic/technic/textures/technic_diamond_block_red.png new file mode 100644 index 0000000..52fd893 Binary files /dev/null and b/technic/technic/textures/technic_diamond_block_red.png differ diff --git a/technic/technic/textures/technic_diamond_drill_head.png b/technic/technic/textures/technic_diamond_drill_head.png new file mode 100644 index 0000000..e3d31e8 Binary files /dev/null and b/technic/technic/textures/technic_diamond_drill_head.png differ diff --git a/technic/technic/textures/technic_doped_silicon_wafer.png b/technic/technic/textures/technic_doped_silicon_wafer.png new file mode 100644 index 0000000..6ff06a6 Binary files /dev/null and b/technic/technic/textures/technic_doped_silicon_wafer.png differ diff --git a/technic/technic/textures/technic_electric_furnace_GUI.png b/technic/technic/textures/technic_electric_furnace_GUI.png new file mode 100644 index 0000000..320794f Binary files /dev/null and b/technic/technic/textures/technic_electric_furnace_GUI.png differ diff --git a/technic/technic/textures/technic_electric_furnace_GUI.xcf b/technic/technic/textures/technic_electric_furnace_GUI.xcf new file mode 100644 index 0000000..482eeb4 Binary files /dev/null and b/technic/technic/textures/technic_electric_furnace_GUI.xcf differ diff --git a/technic/technic/textures/technic_electric_furnace_bottom.png b/technic/technic/textures/technic_electric_furnace_bottom.png new file mode 100644 index 0000000..d16ac47 Binary files /dev/null and b/technic/technic/textures/technic_electric_furnace_bottom.png differ diff --git a/technic/technic/textures/technic_electric_furnace_front.png b/technic/technic/textures/technic_electric_furnace_front.png new file mode 100644 index 0000000..dfee663 Binary files /dev/null and b/technic/technic/textures/technic_electric_furnace_front.png differ diff --git a/technic/technic/textures/technic_electric_furnace_front_active.png b/technic/technic/textures/technic_electric_furnace_front_active.png new file mode 100644 index 0000000..038eec4 Binary files /dev/null and b/technic/technic/textures/technic_electric_furnace_front_active.png differ diff --git a/technic/technic/textures/technic_electric_furnace_side.png b/technic/technic/textures/technic_electric_furnace_side.png new file mode 100644 index 0000000..cf345e7 Binary files /dev/null and b/technic/technic/textures/technic_electric_furnace_side.png differ diff --git a/technic/technic/textures/technic_electric_furnace_top.png b/technic/technic/textures/technic_electric_furnace_top.png new file mode 100644 index 0000000..d3309ec Binary files /dev/null and b/technic/technic/textures/technic_electric_furnace_top.png differ diff --git a/technic/technic/textures/technic_fine_copper_wire.png b/technic/technic/textures/technic_fine_copper_wire.png new file mode 100644 index 0000000..36e2ed6 Binary files /dev/null and b/technic/technic/textures/technic_fine_copper_wire.png differ diff --git a/technic/technic/textures/technic_flashlight.png b/technic/technic/textures/technic_flashlight.png new file mode 100644 index 0000000..01afdbb Binary files /dev/null and b/technic/technic/textures/technic_flashlight.png differ diff --git a/technic/technic/textures/technic_generator_front.png b/technic/technic/textures/technic_generator_front.png new file mode 100644 index 0000000..2d64844 Binary files /dev/null and b/technic/technic/textures/technic_generator_front.png differ diff --git a/technic/technic/textures/technic_generator_front_active.png b/technic/technic/textures/technic_generator_front_active.png new file mode 100644 index 0000000..4e57ca0 Binary files /dev/null and b/technic/technic/textures/technic_generator_front_active.png differ diff --git a/technic/technic/textures/technic_generator_side.png b/technic/technic/textures/technic_generator_side.png new file mode 100644 index 0000000..5cbcbef Binary files /dev/null and b/technic/technic/textures/technic_generator_side.png differ diff --git a/technic/technic/textures/technic_generator_top.png b/technic/technic/textures/technic_generator_top.png new file mode 100644 index 0000000..e2f3db3 Binary files /dev/null and b/technic/technic/textures/technic_generator_top.png differ diff --git a/technic/technic/textures/technic_geothermal_side.png b/technic/technic/textures/technic_geothermal_side.png new file mode 100644 index 0000000..90fb430 Binary files /dev/null and b/technic/technic/textures/technic_geothermal_side.png differ diff --git a/technic/technic/textures/technic_geothermal_top.png b/technic/technic/textures/technic_geothermal_top.png new file mode 100644 index 0000000..601ff15 Binary files /dev/null and b/technic/technic/textures/technic_geothermal_top.png differ diff --git a/technic/technic/textures/technic_geothermal_top_active.png b/technic/technic/textures/technic_geothermal_top_active.png new file mode 100644 index 0000000..f02bec6 Binary files /dev/null and b/technic/technic/textures/technic_geothermal_top_active.png differ diff --git a/technic/technic/textures/technic_gold_chest_front.png b/technic/technic/textures/technic_gold_chest_front.png new file mode 100644 index 0000000..9bc9615 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_black.png b/technic/technic/textures/technic_gold_chest_front_black.png new file mode 100644 index 0000000..6d0fe5e Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_black.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_blue.png b/technic/technic/textures/technic_gold_chest_front_blue.png new file mode 100644 index 0000000..7efe651 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_blue.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_brown.png b/technic/technic/textures/technic_gold_chest_front_brown.png new file mode 100644 index 0000000..4f4f34e Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_brown.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_cyan.png b/technic/technic/textures/technic_gold_chest_front_cyan.png new file mode 100644 index 0000000..e33d76d Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_cyan.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_dark_green.png b/technic/technic/textures/technic_gold_chest_front_dark_green.png new file mode 100644 index 0000000..3088bbf Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_dark_green.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_dark_grey.png b/technic/technic/textures/technic_gold_chest_front_dark_grey.png new file mode 100644 index 0000000..0aa03b4 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_dark_grey.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_green.png b/technic/technic/textures/technic_gold_chest_front_green.png new file mode 100644 index 0000000..30da993 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_green.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_grey.png b/technic/technic/textures/technic_gold_chest_front_grey.png new file mode 100644 index 0000000..eae7e69 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_grey.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_magenta.png b/technic/technic/textures/technic_gold_chest_front_magenta.png new file mode 100644 index 0000000..6daed3b Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_magenta.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_orange.png b/technic/technic/textures/technic_gold_chest_front_orange.png new file mode 100644 index 0000000..085c102 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_orange.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_pink.png b/technic/technic/textures/technic_gold_chest_front_pink.png new file mode 100644 index 0000000..eada4da Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_pink.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_red.png b/technic/technic/textures/technic_gold_chest_front_red.png new file mode 100644 index 0000000..b67da7b Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_red.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_violet.png b/technic/technic/textures/technic_gold_chest_front_violet.png new file mode 100644 index 0000000..b62011c Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_violet.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_white.png b/technic/technic/textures/technic_gold_chest_front_white.png new file mode 100644 index 0000000..76b5ebf Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_white.png differ diff --git a/technic/technic/textures/technic_gold_chest_front_yellow.png b/technic/technic/textures/technic_gold_chest_front_yellow.png new file mode 100644 index 0000000..b0ab9f4 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_front_yellow.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked.png b/technic/technic/textures/technic_gold_chest_locked.png new file mode 100644 index 0000000..91a8b73 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_black.png b/technic/technic/textures/technic_gold_chest_locked_black.png new file mode 100644 index 0000000..5a5a568 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_black.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_blue.png b/technic/technic/textures/technic_gold_chest_locked_blue.png new file mode 100644 index 0000000..f369ebd Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_blue.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_brown.png b/technic/technic/textures/technic_gold_chest_locked_brown.png new file mode 100644 index 0000000..a44a273 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_brown.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_cyan.png b/technic/technic/textures/technic_gold_chest_locked_cyan.png new file mode 100644 index 0000000..f3ce7b6 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_cyan.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_dark_green.png b/technic/technic/textures/technic_gold_chest_locked_dark_green.png new file mode 100644 index 0000000..084dae5 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_dark_green.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_dark_grey.png b/technic/technic/textures/technic_gold_chest_locked_dark_grey.png new file mode 100644 index 0000000..629e33c Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_dark_grey.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_green.png b/technic/technic/textures/technic_gold_chest_locked_green.png new file mode 100644 index 0000000..9ea1818 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_green.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_grey.png b/technic/technic/textures/technic_gold_chest_locked_grey.png new file mode 100644 index 0000000..c936d7c Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_grey.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_magenta.png b/technic/technic/textures/technic_gold_chest_locked_magenta.png new file mode 100644 index 0000000..4c97fa8 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_magenta.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_orange.png b/technic/technic/textures/technic_gold_chest_locked_orange.png new file mode 100644 index 0000000..f6d5e90 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_orange.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_pink.png b/technic/technic/textures/technic_gold_chest_locked_pink.png new file mode 100644 index 0000000..4248c21 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_pink.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_red.png b/technic/technic/textures/technic_gold_chest_locked_red.png new file mode 100644 index 0000000..4bfe5d4 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_red.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_violet.png b/technic/technic/textures/technic_gold_chest_locked_violet.png new file mode 100644 index 0000000..c9abe73 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_violet.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_white.png b/technic/technic/textures/technic_gold_chest_locked_white.png new file mode 100644 index 0000000..810abb9 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_white.png differ diff --git a/technic/technic/textures/technic_gold_chest_locked_yellow.png b/technic/technic/textures/technic_gold_chest_locked_yellow.png new file mode 100644 index 0000000..2856165 Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_locked_yellow.png differ diff --git a/technic/technic/textures/technic_gold_chest_side.png b/technic/technic/textures/technic_gold_chest_side.png new file mode 100644 index 0000000..5d5ad0f Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_side.png differ diff --git a/technic/technic/textures/technic_gold_chest_top.png b/technic/technic/textures/technic_gold_chest_top.png new file mode 100644 index 0000000..f9c8fec Binary files /dev/null and b/technic/technic/textures/technic_gold_chest_top.png differ diff --git a/technic/technic/textures/technic_gold_dust.png b/technic/technic/textures/technic_gold_dust.png new file mode 100644 index 0000000..e545bb6 Binary files /dev/null and b/technic/technic/textures/technic_gold_dust.png differ diff --git a/technic/technic/textures/technic_granite.png b/technic/technic/textures/technic_granite.png new file mode 100644 index 0000000..abb1385 Binary files /dev/null and b/technic/technic/textures/technic_granite.png differ diff --git a/technic/technic/textures/technic_grinder_front.png b/technic/technic/textures/technic_grinder_front.png new file mode 100644 index 0000000..a28dbc1 Binary files /dev/null and b/technic/technic/textures/technic_grinder_front.png differ diff --git a/technic/technic/textures/technic_grinder_side.png b/technic/technic/textures/technic_grinder_side.png new file mode 100644 index 0000000..af562f2 Binary files /dev/null and b/technic/technic/textures/technic_grinder_side.png differ diff --git a/technic/technic/textures/technic_grinder_top.png b/technic/technic/textures/technic_grinder_top.png new file mode 100644 index 0000000..b074e13 Binary files /dev/null and b/technic/technic/textures/technic_grinder_top.png differ diff --git a/technic/technic/textures/technic_iron_chest_front.png b/technic/technic/textures/technic_iron_chest_front.png new file mode 100644 index 0000000..79d5b49 Binary files /dev/null and b/technic/technic/textures/technic_iron_chest_front.png differ diff --git a/technic/technic/textures/technic_iron_chest_locked.png b/technic/technic/textures/technic_iron_chest_locked.png new file mode 100644 index 0000000..6229487 Binary files /dev/null and b/technic/technic/textures/technic_iron_chest_locked.png differ diff --git a/technic/technic/textures/technic_iron_chest_side.png b/technic/technic/textures/technic_iron_chest_side.png new file mode 100644 index 0000000..e12daa5 Binary files /dev/null and b/technic/technic/textures/technic_iron_chest_side.png differ diff --git a/technic/technic/textures/technic_iron_chest_top.png b/technic/technic/textures/technic_iron_chest_top.png new file mode 100644 index 0000000..da1ab7b Binary files /dev/null and b/technic/technic/textures/technic_iron_chest_top.png differ diff --git a/technic/technic/textures/technic_iron_dust.png b/technic/technic/textures/technic_iron_dust.png new file mode 100644 index 0000000..aaecd2b Binary files /dev/null and b/technic/technic/textures/technic_iron_dust.png differ diff --git a/technic/technic/textures/technic_laser_beam.png b/technic/technic/textures/technic_laser_beam.png new file mode 100644 index 0000000..4814a9b Binary files /dev/null and b/technic/technic/textures/technic_laser_beam.png differ diff --git a/technic/technic/textures/technic_lava_can.png b/technic/technic/textures/technic_lava_can.png new file mode 100644 index 0000000..80d15a6 Binary files /dev/null and b/technic/technic/textures/technic_lava_can.png differ diff --git a/technic/technic/textures/technic_light.png b/technic/technic/textures/technic_light.png new file mode 100644 index 0000000..334cb07 Binary files /dev/null and b/technic/technic/textures/technic_light.png differ diff --git a/technic/technic/textures/technic_lv_cable.png b/technic/technic/textures/technic_lv_cable.png new file mode 100644 index 0000000..87076c9 Binary files /dev/null and b/technic/technic/textures/technic_lv_cable.png differ diff --git a/technic/technic/textures/technic_lv_cable_wield.png b/technic/technic/textures/technic_lv_cable_wield.png new file mode 100644 index 0000000..c4ada04 Binary files /dev/null and b/technic/technic/textures/technic_lv_cable_wield.png differ diff --git a/technic/technic/textures/technic_machine_bottom.png b/technic/technic/textures/technic_machine_bottom.png new file mode 100644 index 0000000..48a47b0 Binary files /dev/null and b/technic/technic/textures/technic_machine_bottom.png differ diff --git a/technic/technic/textures/technic_marble.png b/technic/technic/textures/technic_marble.png new file mode 100644 index 0000000..846a170 Binary files /dev/null and b/technic/technic/textures/technic_marble.png differ diff --git a/technic/technic/textures/technic_marble_bricks.png b/technic/technic/textures/technic_marble_bricks.png new file mode 100644 index 0000000..2ea1e42 Binary files /dev/null and b/technic/technic/textures/technic_marble_bricks.png differ diff --git a/technic/technic/textures/technic_menu_bg.png b/technic/technic/textures/technic_menu_bg.png new file mode 100644 index 0000000..18e6a56 Binary files /dev/null and b/technic/technic/textures/technic_menu_bg.png differ diff --git a/technic/technic/textures/technic_mineral_chromium.png b/technic/technic/textures/technic_mineral_chromium.png new file mode 100644 index 0000000..c66f1c5 Binary files /dev/null and b/technic/technic/textures/technic_mineral_chromium.png differ diff --git a/technic/technic/textures/technic_mineral_diamond.png b/technic/technic/textures/technic_mineral_diamond.png new file mode 100644 index 0000000..2d91505 Binary files /dev/null and b/technic/technic/textures/technic_mineral_diamond.png differ diff --git a/technic/technic/textures/technic_mineral_uranium.png b/technic/technic/textures/technic_mineral_uranium.png new file mode 100644 index 0000000..aad9c07 Binary files /dev/null and b/technic/technic/textures/technic_mineral_uranium.png differ diff --git a/technic/technic/textures/technic_mineral_zinc.png b/technic/technic/textures/technic_mineral_zinc.png new file mode 100644 index 0000000..598efeb Binary files /dev/null and b/technic/technic/textures/technic_mineral_zinc.png differ diff --git a/technic/technic/textures/technic_mining_drill.png b/technic/technic/textures/technic_mining_drill.png new file mode 100644 index 0000000..171888d Binary files /dev/null and b/technic/technic/textures/technic_mining_drill.png differ diff --git a/technic/technic/textures/technic_mining_laser_mk1.png b/technic/technic/textures/technic_mining_laser_mk1.png new file mode 100644 index 0000000..acde392 Binary files /dev/null and b/technic/technic/textures/technic_mining_laser_mk1.png differ diff --git a/technic/technic/textures/technic_mithril_chest_front.png b/technic/technic/textures/technic_mithril_chest_front.png new file mode 100644 index 0000000..9f7ca7e Binary files /dev/null and b/technic/technic/textures/technic_mithril_chest_front.png differ diff --git a/technic/technic/textures/technic_mithril_chest_locked.png b/technic/technic/textures/technic_mithril_chest_locked.png new file mode 100644 index 0000000..abff384 Binary files /dev/null and b/technic/technic/textures/technic_mithril_chest_locked.png differ diff --git a/technic/technic/textures/technic_mithril_chest_side.png b/technic/technic/textures/technic_mithril_chest_side.png new file mode 100644 index 0000000..0763511 Binary files /dev/null and b/technic/technic/textures/technic_mithril_chest_side.png differ diff --git a/technic/technic/textures/technic_mithril_chest_top.png b/technic/technic/textures/technic_mithril_chest_top.png new file mode 100644 index 0000000..2429576 Binary files /dev/null and b/technic/technic/textures/technic_mithril_chest_top.png differ diff --git a/technic/technic/textures/technic_mithril_dust.png b/technic/technic/textures/technic_mithril_dust.png new file mode 100644 index 0000000..988e449 Binary files /dev/null and b/technic/technic/textures/technic_mithril_dust.png differ diff --git a/technic/technic/textures/technic_motor.png b/technic/technic/textures/technic_motor.png new file mode 100644 index 0000000..77d4b91 Binary files /dev/null and b/technic/technic/textures/technic_motor.png differ diff --git a/technic/technic/textures/technic_music_player_bottom.png b/technic/technic/textures/technic_music_player_bottom.png new file mode 100644 index 0000000..bd8fd55 Binary files /dev/null and b/technic/technic/textures/technic_music_player_bottom.png differ diff --git a/technic/technic/textures/technic_music_player_side.png b/technic/technic/textures/technic_music_player_side.png new file mode 100644 index 0000000..6c34fea Binary files /dev/null and b/technic/technic/textures/technic_music_player_side.png differ diff --git a/technic/technic/textures/technic_music_player_top.png b/technic/technic/textures/technic_music_player_top.png new file mode 100644 index 0000000..0d34563 Binary files /dev/null and b/technic/technic/textures/technic_music_player_top.png differ diff --git a/technic/technic/textures/technic_mv_battery_box_bottom.png b/technic/technic/textures/technic_mv_battery_box_bottom.png new file mode 100644 index 0000000..2a9b292 Binary files /dev/null and b/technic/technic/textures/technic_mv_battery_box_bottom.png differ diff --git a/technic/technic/textures/technic_mv_battery_box_side0.png b/technic/technic/textures/technic_mv_battery_box_side0.png new file mode 100644 index 0000000..39d8986 Binary files /dev/null and b/technic/technic/textures/technic_mv_battery_box_side0.png differ diff --git a/technic/technic/textures/technic_mv_battery_box_top.png b/technic/technic/textures/technic_mv_battery_box_top.png new file mode 100644 index 0000000..f7f1ea9 Binary files /dev/null and b/technic/technic/textures/technic_mv_battery_box_top.png differ diff --git a/technic/technic/textures/technic_mv_cable.png b/technic/technic/textures/technic_mv_cable.png new file mode 100644 index 0000000..2819d2b Binary files /dev/null and b/technic/technic/textures/technic_mv_cable.png differ diff --git a/technic/technic/textures/technic_mv_cable_wield.png b/technic/technic/textures/technic_mv_cable_wield.png new file mode 100644 index 0000000..aca9fd4 Binary files /dev/null and b/technic/technic/textures/technic_mv_cable_wield.png differ diff --git a/technic/technic/textures/technic_mv_solar_panel_bottom.png b/technic/technic/textures/technic_mv_solar_panel_bottom.png new file mode 100644 index 0000000..94c8222 Binary files /dev/null and b/technic/technic/textures/technic_mv_solar_panel_bottom.png differ diff --git a/technic/technic/textures/technic_mv_solar_panel_side.png b/technic/technic/textures/technic_mv_solar_panel_side.png new file mode 100644 index 0000000..d39d3d8 Binary files /dev/null and b/technic/technic/textures/technic_mv_solar_panel_side.png differ diff --git a/technic/technic/textures/technic_mv_solar_panel_top.png b/technic/technic/textures/technic_mv_solar_panel_top.png new file mode 100644 index 0000000..3d8c7ab Binary files /dev/null and b/technic/technic/textures/technic_mv_solar_panel_top.png differ diff --git a/technic/technic/textures/technic_mv_transformer.png b/technic/technic/textures/technic_mv_transformer.png new file mode 100644 index 0000000..7c4688e Binary files /dev/null and b/technic/technic/textures/technic_mv_transformer.png differ diff --git a/technic/technic/textures/technic_nodebreaker_back.png b/technic/technic/textures/technic_nodebreaker_back.png new file mode 100644 index 0000000..b669ef6 Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_back.png differ diff --git a/technic/technic/textures/technic_nodebreaker_bottom.png b/technic/technic/textures/technic_nodebreaker_bottom.png new file mode 100644 index 0000000..ff1a2c6 Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_bottom.png differ diff --git a/technic/technic/textures/technic_nodebreaker_bottom_off.png b/technic/technic/textures/technic_nodebreaker_bottom_off.png new file mode 100644 index 0000000..410617a Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_bottom_off.png differ diff --git a/technic/technic/textures/technic_nodebreaker_bottom_on.png b/technic/technic/textures/technic_nodebreaker_bottom_on.png new file mode 100644 index 0000000..d6da4d8 Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_bottom_on.png differ diff --git a/technic/technic/textures/technic_nodebreaker_front_off.png b/technic/technic/textures/technic_nodebreaker_front_off.png new file mode 100644 index 0000000..5a25b4c Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_front_off.png differ diff --git a/technic/technic/textures/technic_nodebreaker_front_on.png b/technic/technic/textures/technic_nodebreaker_front_on.png new file mode 100644 index 0000000..97d22c3 Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_front_on.png differ diff --git a/technic/technic/textures/technic_nodebreaker_side.png b/technic/technic/textures/technic_nodebreaker_side.png new file mode 100644 index 0000000..aefd7c8 Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_side.png differ diff --git a/technic/technic/textures/technic_nodebreaker_side1.png b/technic/technic/textures/technic_nodebreaker_side1.png new file mode 100644 index 0000000..8cb8634 Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_side1.png differ diff --git a/technic/technic/textures/technic_nodebreaker_side1_off.png b/technic/technic/textures/technic_nodebreaker_side1_off.png new file mode 100644 index 0000000..5e36d3a Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_side1_off.png differ diff --git a/technic/technic/textures/technic_nodebreaker_side1_on.png b/technic/technic/textures/technic_nodebreaker_side1_on.png new file mode 100644 index 0000000..c76ccff Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_side1_on.png differ diff --git a/technic/technic/textures/technic_nodebreaker_side2.png b/technic/technic/textures/technic_nodebreaker_side2.png new file mode 100644 index 0000000..c2855d0 Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_side2.png differ diff --git a/technic/technic/textures/technic_nodebreaker_side2_off.png b/technic/technic/textures/technic_nodebreaker_side2_off.png new file mode 100644 index 0000000..622ff7c Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_side2_off.png differ diff --git a/technic/technic/textures/technic_nodebreaker_side2_on.png b/technic/technic/textures/technic_nodebreaker_side2_on.png new file mode 100644 index 0000000..c54e467 Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_side2_on.png differ diff --git a/technic/technic/textures/technic_nodebreaker_top.png b/technic/technic/textures/technic_nodebreaker_top.png new file mode 100644 index 0000000..941d333 Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_top.png differ diff --git a/technic/technic/textures/technic_nodebreaker_top_off.png b/technic/technic/textures/technic_nodebreaker_top_off.png new file mode 100644 index 0000000..1f9b361 Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_top_off.png differ diff --git a/technic/technic/textures/technic_nodebreaker_top_on.png b/technic/technic/textures/technic_nodebreaker_top_on.png new file mode 100644 index 0000000..d02ed10 Binary files /dev/null and b/technic/technic/textures/technic_nodebreaker_top_on.png differ diff --git a/technic/technic/textures/technic_power_meter.png b/technic/technic/textures/technic_power_meter.png new file mode 100644 index 0000000..f1e5120 Binary files /dev/null and b/technic/technic/textures/technic_power_meter.png differ diff --git a/technic/technic/textures/technic_power_meter1.png b/technic/technic/textures/technic_power_meter1.png new file mode 100644 index 0000000..0542c7b Binary files /dev/null and b/technic/technic/textures/technic_power_meter1.png differ diff --git a/technic/technic/textures/technic_power_meter2.png b/technic/technic/textures/technic_power_meter2.png new file mode 100644 index 0000000..bf5703c Binary files /dev/null and b/technic/technic/textures/technic_power_meter2.png differ diff --git a/technic/technic/textures/technic_power_meter3.png b/technic/technic/textures/technic_power_meter3.png new file mode 100644 index 0000000..4204815 Binary files /dev/null and b/technic/technic/textures/technic_power_meter3.png differ diff --git a/technic/technic/textures/technic_power_meter4.png b/technic/technic/textures/technic_power_meter4.png new file mode 100644 index 0000000..82a0148 Binary files /dev/null and b/technic/technic/textures/technic_power_meter4.png differ diff --git a/technic/technic/textures/technic_power_meter5.png b/technic/technic/textures/technic_power_meter5.png new file mode 100644 index 0000000..af783ca Binary files /dev/null and b/technic/technic/textures/technic_power_meter5.png differ diff --git a/technic/technic/textures/technic_power_meter6.png b/technic/technic/textures/technic_power_meter6.png new file mode 100644 index 0000000..44feff4 Binary files /dev/null and b/technic/technic/textures/technic_power_meter6.png differ diff --git a/technic/technic/textures/technic_power_meter7.png b/technic/technic/textures/technic_power_meter7.png new file mode 100644 index 0000000..554baa2 Binary files /dev/null and b/technic/technic/textures/technic_power_meter7.png differ diff --git a/technic/technic/textures/technic_power_meter8.png b/technic/technic/textures/technic_power_meter8.png new file mode 100644 index 0000000..8c4f4a8 Binary files /dev/null and b/technic/technic/textures/technic_power_meter8.png differ diff --git a/technic/technic/textures/technic_power_meter_bg.png b/technic/technic/textures/technic_power_meter_bg.png new file mode 100644 index 0000000..9667cda Binary files /dev/null and b/technic/technic/textures/technic_power_meter_bg.png differ diff --git a/technic/technic/textures/technic_power_meter_fg.png b/technic/technic/textures/technic_power_meter_fg.png new file mode 100644 index 0000000..7f2dde8 Binary files /dev/null and b/technic/technic/textures/technic_power_meter_fg.png differ diff --git a/technic/technic/textures/technic_raw_latex.png b/technic/technic/textures/technic_raw_latex.png new file mode 100644 index 0000000..7fbbe64 Binary files /dev/null and b/technic/technic/textures/technic_raw_latex.png differ diff --git a/technic/technic/textures/technic_rebar.png b/technic/technic/textures/technic_rebar.png new file mode 100644 index 0000000..16d1fc5 Binary files /dev/null and b/technic/technic/textures/technic_rebar.png differ diff --git a/technic/technic/textures/technic_rubber.png b/technic/technic/textures/technic_rubber.png new file mode 100644 index 0000000..9ed4a9d Binary files /dev/null and b/technic/technic/textures/technic_rubber.png differ diff --git a/technic/technic/textures/technic_rubber_sapling.png b/technic/technic/textures/technic_rubber_sapling.png new file mode 100644 index 0000000..e5c9f5d Binary files /dev/null and b/technic/technic/textures/technic_rubber_sapling.png differ diff --git a/technic/technic/textures/technic_rubber_tree_empty.png b/technic/technic/textures/technic_rubber_tree_empty.png new file mode 100644 index 0000000..1792951 Binary files /dev/null and b/technic/technic/textures/technic_rubber_tree_empty.png differ diff --git a/technic/technic/textures/technic_rubber_tree_full.png b/technic/technic/textures/technic_rubber_tree_full.png new file mode 100644 index 0000000..08067ef Binary files /dev/null and b/technic/technic/textures/technic_rubber_tree_full.png differ diff --git a/technic/technic/textures/technic_screwdriver.png b/technic/technic/textures/technic_screwdriver.png new file mode 100644 index 0000000..bd2da22 Binary files /dev/null and b/technic/technic/textures/technic_screwdriver.png differ diff --git a/technic/technic/textures/technic_silicon_wafer.png b/technic/technic/textures/technic_silicon_wafer.png new file mode 100644 index 0000000..78aef20 Binary files /dev/null and b/technic/technic/textures/technic_silicon_wafer.png differ diff --git a/technic/technic/textures/technic_silver_chest_front.png b/technic/technic/textures/technic_silver_chest_front.png new file mode 100644 index 0000000..fe5ce2c Binary files /dev/null and b/technic/technic/textures/technic_silver_chest_front.png differ diff --git a/technic/technic/textures/technic_silver_chest_locked.png b/technic/technic/textures/technic_silver_chest_locked.png new file mode 100644 index 0000000..0f8b1f0 Binary files /dev/null and b/technic/technic/textures/technic_silver_chest_locked.png differ diff --git a/technic/technic/textures/technic_silver_chest_side.png b/technic/technic/textures/technic_silver_chest_side.png new file mode 100644 index 0000000..3a2ed4a Binary files /dev/null and b/technic/technic/textures/technic_silver_chest_side.png differ diff --git a/technic/technic/textures/technic_silver_chest_top.png b/technic/technic/textures/technic_silver_chest_top.png new file mode 100644 index 0000000..353a11c Binary files /dev/null and b/technic/technic/textures/technic_silver_chest_top.png differ diff --git a/technic/technic/textures/technic_silver_dust.png b/technic/technic/textures/technic_silver_dust.png new file mode 100644 index 0000000..9092c90 Binary files /dev/null and b/technic/technic/textures/technic_silver_dust.png differ diff --git a/technic/technic/textures/technic_solar_panel_bottom.png b/technic/technic/textures/technic_solar_panel_bottom.png new file mode 100644 index 0000000..b0ad82f Binary files /dev/null and b/technic/technic/textures/technic_solar_panel_bottom.png differ diff --git a/technic/technic/textures/technic_solar_panel_side.png b/technic/technic/textures/technic_solar_panel_side.png new file mode 100644 index 0000000..b22447e Binary files /dev/null and b/technic/technic/textures/technic_solar_panel_side.png differ diff --git a/technic/technic/textures/technic_solar_panel_top.png b/technic/technic/textures/technic_solar_panel_top.png new file mode 100644 index 0000000..492764b Binary files /dev/null and b/technic/technic/textures/technic_solar_panel_top.png differ diff --git a/technic/technic/textures/technic_sonic_screwdriver.png b/technic/technic/textures/technic_sonic_screwdriver.png new file mode 100644 index 0000000..fb61d96 Binary files /dev/null and b/technic/technic/textures/technic_sonic_screwdriver.png differ diff --git a/technic/technic/textures/technic_stainless_steel_dust.png b/technic/technic/textures/technic_stainless_steel_dust.png new file mode 100644 index 0000000..450e2bb Binary files /dev/null and b/technic/technic/textures/technic_stainless_steel_dust.png differ diff --git a/technic/technic/textures/technic_stainless_steel_ingot.png b/technic/technic/textures/technic_stainless_steel_ingot.png new file mode 100644 index 0000000..46fa296 Binary files /dev/null and b/technic/technic/textures/technic_stainless_steel_ingot.png differ diff --git a/technic/technic/textures/technic_tin_dust.png b/technic/technic/textures/technic_tin_dust.png new file mode 100644 index 0000000..4e94e00 Binary files /dev/null and b/technic/technic/textures/technic_tin_dust.png differ diff --git a/technic/technic/textures/technic_tree_tap.png b/technic/technic/textures/technic_tree_tap.png new file mode 100644 index 0000000..542f30f Binary files /dev/null and b/technic/technic/textures/technic_tree_tap.png differ diff --git a/technic/technic/textures/technic_uranium.png b/technic/technic/textures/technic_uranium.png new file mode 100644 index 0000000..54225f8 Binary files /dev/null and b/technic/technic/textures/technic_uranium.png differ diff --git a/technic/technic/textures/technic_water_can.png b/technic/technic/textures/technic_water_can.png new file mode 100644 index 0000000..18e0225 Binary files /dev/null and b/technic/technic/textures/technic_water_can.png differ diff --git a/technic/technic/textures/technic_water_mill_side.png b/technic/technic/textures/technic_water_mill_side.png new file mode 100644 index 0000000..f4bdb16 Binary files /dev/null and b/technic/technic/textures/technic_water_mill_side.png differ diff --git a/technic/technic/textures/technic_water_mill_top.png b/technic/technic/textures/technic_water_mill_top.png new file mode 100644 index 0000000..601ff15 Binary files /dev/null and b/technic/technic/textures/technic_water_mill_top.png differ diff --git a/technic/technic/textures/technic_water_mill_top_active.png b/technic/technic/textures/technic_water_mill_top_active.png new file mode 100644 index 0000000..f02bec6 Binary files /dev/null and b/technic/technic/textures/technic_water_mill_top_active.png differ diff --git a/technic/technic/textures/technic_workshop_bottom.png b/technic/technic/textures/technic_workshop_bottom.png new file mode 100644 index 0000000..bd8fd55 Binary files /dev/null and b/technic/technic/textures/technic_workshop_bottom.png differ diff --git a/technic/technic/textures/technic_workshop_side.png b/technic/technic/textures/technic_workshop_side.png new file mode 100644 index 0000000..9e3e7a7 Binary files /dev/null and b/technic/technic/textures/technic_workshop_side.png differ diff --git a/technic/technic/textures/technic_workshop_top.png b/technic/technic/textures/technic_workshop_top.png new file mode 100644 index 0000000..feae141 Binary files /dev/null and b/technic/technic/textures/technic_workshop_top.png differ diff --git a/technic/technic/textures/technic_zinc_dust.png b/technic/technic/textures/technic_zinc_dust.png new file mode 100644 index 0000000..0d2f75a Binary files /dev/null and b/technic/technic/textures/technic_zinc_dust.png differ diff --git a/technic/technic/textures/technic_zinc_ingot.png b/technic/technic/textures/technic_zinc_ingot.png new file mode 100644 index 0000000..096ff9c Binary files /dev/null and b/technic/technic/textures/technic_zinc_ingot.png differ diff --git a/technic/technic/textures/technic_zinc_lump.png b/technic/technic/textures/technic_zinc_lump.png new file mode 100644 index 0000000..d28a6dc Binary files /dev/null and b/technic/technic/textures/technic_zinc_lump.png differ diff --git a/technic/technic/textures/tetris_machine_front1.png b/technic/technic/textures/tetris_machine_front1.png new file mode 100644 index 0000000..747bdd2 Binary files /dev/null and b/technic/technic/textures/tetris_machine_front1.png differ diff --git a/technic/technic/textures/tetris_machine_front2.png b/technic/technic/textures/tetris_machine_front2.png new file mode 100644 index 0000000..3ad0908 Binary files /dev/null and b/technic/technic/textures/tetris_machine_front2.png differ diff --git a/technic/technic/textures/tetris_machine_side1B.png b/technic/technic/textures/tetris_machine_side1B.png new file mode 100644 index 0000000..de1e034 Binary files /dev/null and b/technic/technic/textures/tetris_machine_side1B.png differ diff --git a/technic/technic/textures/tetris_machine_side1L.png b/technic/technic/textures/tetris_machine_side1L.png new file mode 100644 index 0000000..73942cf Binary files /dev/null and b/technic/technic/textures/tetris_machine_side1L.png differ diff --git a/technic/technic/textures/tetris_machine_side1P.png b/technic/technic/textures/tetris_machine_side1P.png new file mode 100644 index 0000000..73942cf Binary files /dev/null and b/technic/technic/textures/tetris_machine_side1P.png differ diff --git a/technic/technic/textures/tetris_machine_side2B.png b/technic/technic/textures/tetris_machine_side2B.png new file mode 100644 index 0000000..e8e42fe Binary files /dev/null and b/technic/technic/textures/tetris_machine_side2B.png differ diff --git a/technic/technic/textures/tetris_machine_side2L.png b/technic/technic/textures/tetris_machine_side2L.png new file mode 100644 index 0000000..a619eb3 Binary files /dev/null and b/technic/technic/textures/tetris_machine_side2L.png differ diff --git a/technic/technic/textures/tetris_machine_side2P.png b/technic/technic/textures/tetris_machine_side2P.png new file mode 100644 index 0000000..650fc3b Binary files /dev/null and b/technic/technic/textures/tetris_machine_side2P.png differ diff --git a/technic/technic/textures/tetris_machine_top.png b/technic/technic/textures/tetris_machine_top.png new file mode 100644 index 0000000..f1c3ac2 Binary files /dev/null and b/technic/technic/textures/tetris_machine_top.png differ diff --git a/technic/technic/tool_workshop.lua b/technic/technic/tool_workshop.lua new file mode 100644 index 0000000..86130ff --- /dev/null +++ b/technic/technic/tool_workshop.lua @@ -0,0 +1,93 @@ +minetest.register_alias("tool_workshop", "technic:tool_workshop") +minetest.register_craft({ + output = 'technic:tool_workshop', + recipe = { + {'default:wood', 'default:wood', 'default:wood'}, + {'default:wood', 'technic:diamond', 'default:wood'}, + {'default:stone', 'moreores:copper_ingot', 'default:stone'}, + } +}) + +minetest.register_craftitem("technic:tool_workshop", { + description = "Tool Workshop", + stack_max = 99, +}) + +workshop_formspec = + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. + "list[current_name;src;3,1;1,1;]".. + "label[0,0;Tool Workshop]".. + "label[1,3;Power level]".. + "list[current_player;main;0,5;8,4;]" + +minetest.register_node("technic:tool_workshop", { + description = "Tool Workshop", + tiles = {"technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png", + "technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + sounds = default.node_sound_wood_defaults(), + technic_power_machine=1, + internal_EU_buffer=0; + internal_EU_buffer_size=2000; + + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("infotext", "Tool Workshop") + meta:set_float("technic_power_machine", 1) + meta:set_float("internal_EU_buffer", 1) + meta:set_float("internal_EU_buffer_size", 2000) + meta:set_string("formspec", workshop_formspec) + local inv = meta:get_inventory() + inv:set_size("src", 1) + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("src") then + return false + end + return true + end, +}) + +minetest.register_abm({ + nodenames = {"technic:tool_workshop"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.env:get_meta(pos) + local charge= meta:get_float("internal_EU_buffer") + local max_charge= meta:get_float("internal_EU_buffer_size") + local load_step=2000 + local load_cost=200 + local inv = meta:get_inventory() + if inv:is_empty("src")==false then + srcstack = inv:get_stack("src", 1) + src_item=srcstack:to_table() + local load1=tonumber((src_item["wear"])) + if charge>load_cost then + if load1>1 then + if load1-load_step<0 then load_step=load1 load1=1 + else load1=load1-load_step end + charge=charge-load_cost + src_item["wear"]=tostring(load1) + inv:set_stack("src", 1, src_item) + end + end + end + + meta:set_float("internal_EU_buffer",charge) + + + local load = math.floor((charge/max_charge)*100) + meta:set_string("formspec", + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "list[current_name;src;3,1;1,1;]".. + "label[0,0;Tool Workshop]".. + "label[1,3;Power level]".. + "list[current_player;main;0,5;8,4;]") + end +}) \ No newline at end of file diff --git a/technic/technic/tree_tap.lua b/technic/technic/tree_tap.lua new file mode 100644 index 0000000..107faed --- /dev/null +++ b/technic/technic/tree_tap.lua @@ -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:raw_latex")) 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 == "farming_plus:rubber_tree_full" or node_name == "farming:rubber_tree_full" or node_name == "technic:rubber_tree_full" then + user:get_inventory():add_item("main",ItemStack("technic:raw_latex")) + 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:raw_latex", { + description = "Raw Latex", + inventory_image = "technic_raw_latex.png", + }) + + minetest.register_craft({ + type = "cooking", + output = "technic:rubber", + recipe = "technic:raw_latex", + }) + + minetest.register_craftitem("technic:rubber", { + description = "Rubber Fiber", + inventory_image = "technic_rubber.png", + }) diff --git a/technic/technic/water.lua b/technic/technic/water.lua new file mode 100644 index 0000000..6ddaa46 --- /dev/null +++ b/technic/technic/water.lua @@ -0,0 +1,588 @@ +minetest.register_alias("battery", "technic:battery") +minetest.register_alias("battery_box", "technic:battery_box") +minetest.register_alias("electric_furnace", "technic:electric_furnace") + + +minetest.register_craft({ + output = 'technic:battery 1', + recipe = { + {'default:wood', 'moreores:copper_ingot', 'default:wood'}, + {'default:wood', 'moreores:tin_ingot', 'default:wood'}, + {'default:wood', 'moreores:copper_ingot', 'default:wood'}, + } +}) + +minetest.register_craft({ + output = 'technic:battery_box 1', + recipe = { + {'technic:battery', 'default:wood', 'technic:battery'}, + {'technic:battery', 'moreores:copper_ingot', 'technic:battery'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'technic:electric_furnace', + recipe = { + {'default:brick', 'default:brick', 'default:brick'}, + {'default:brick', '', 'default:brick'}, + {'default:steel_ingot', 'moreores:copper_ingot', 'default:steel_ingot'}, + } +}) + + +--minetest.register_craftitem("technic:battery", { +-- description = "Recharcheable battery", +-- inventory_image = "technic_battery.png", +-- stack_max = 1, +--}) + +minetest.register_tool("technic:battery", +{description = "RE Battery", +inventory_image = "technic_battery.png", +energy_charge = 0, +tool_capabilities = {max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}}) + +minetest.register_craftitem("technic:battery_box", { + description = "Battery box", + stack_max = 99, +}) + + + +battery_box_formspec = + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. + "list[current_name;src;3,1;1,1;]".. + "image[4,1;1,1;technic_battery_reload.png]".. + "list[current_name;dst;5,1;1,1;]".. + "label[0,0;Battery box]".. + "label[3,0;Charge]".. + "label[5,0;Discharge]".. + "label[1,3;Power level]".. + "list[current_player;main;0,5;8,4;]" + +minetest.register_node("technic:battery_box", { + description = "Battery box", + tiles = {"technic_battery_box_top.png", "technic_battery_box_bottom.png", "technic_battery_box_side.png", + "technic_battery_box_side.png", "technic_battery_box_side.png", "technic_battery_box_side.png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + sounds = default.node_sound_wood_defaults(), + technic_power_machine=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("infotext", "Battery box") + meta:set_float("technic_power_machine", 1) + meta:set_string("formspec", battery_box_formspec) + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("dst", 1) + battery_charge = 0 + max_charge = 60000 + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) + +electric_furnace_formspec = + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. + "list[current_name;src;3,1;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]".. + "label[0,0;Electric Furnace]".. + "label[1,3;Power level]" + +minetest.register_node("technic:electric_furnace", { + description = "Electric furnace", + tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png", + "technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front.png"}, + paramtype2 = "facedir", + groups = {cracky=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_stone_defaults(), + technic_power_machine=1, + internal_EU_buffer=0; + interal_EU_buffer_size=2000; + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_float("technic_power_machine", 1) + meta:set_string("formspec", electric_furnace_formspec) + meta:set_string("infotext", "Electric furnace") + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("dst", 4) + local EU_used = 0 + local furnace_is_cookin = 0 + local cooked = nil + meta:set_float("internal_EU_buffer",0) + meta:set_float("internal_EU_buffer_size",2000) + + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) + +minetest.register_node("technic:electric_furnace_active", { + description = "Electric Furnace", + tiles = {"technic_electric_furnace_top.png", "technic_electric_furnace_bottom.png", "technic_electric_furnace_side.png", + "technic_electric_furnace_side.png", "technic_electric_furnace_side.png", "technic_electric_furnace_front_active.png"}, + paramtype2 = "facedir", + light_source = 8, + drop = "technic:electric_furnace", + groups = {cracky=2, not_in_creative_inventory=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_stone_defaults(), + internal_EU_buffer=0; + interal_EU_buffer_size=2000; + technic_power_machine=1, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_float("technic_power_machine", 1) + meta:set_string("formspec", electric_furnace_formspec) + meta:set_string("infotext", "Electric furnace"); + local inv = meta:get_inventory() + inv:set_size("src", 1) + inv:set_size("dst", 4) + local EU_used = 0 + local furnace_is_cookin = 0 + local cooked = nil + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) + +minetest.register_abm({ + nodenames = {"technic:electric_furnace","technic:electric_furnace_active"}, + interval = 1, + chance = 1, + + action = function(pos, node, active_object_count, active_object_count_wider) + + local meta = minetest.env:get_meta(pos) + internal_EU_buffer=meta:get_float("internal_EU_buffer") + internal_EU_buffer_size=meta:get_float("internal_EU_buffer") + local load = math.floor(internal_EU_buffer/2000 * 100) + meta:set_string("formspec", + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "list[current_name;src;3,1;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]".. + "label[0,0;Electric Furnace]".. + "label[1,3;Power level]") + + local inv = meta:get_inventory() + + local furnace_is_cookin = meta:get_float("furnace_is_cookin") + + + local srclist = inv:get_list("src") + local cooked=nil + + if srclist then + cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + end + + + if (furnace_is_cookin == 1) then + if internal_EU_buffer>=150 then + internal_EU_buffer=internal_EU_buffer-150; + meta:set_float("internal_EU_buffer",internal_EU_buffer) + meta:set_float("src_time", meta:get_float("src_time") + 3) + if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then + -- check if there's room for output in "dst" list + if inv:room_for_item("dst",cooked.item) then + -- Put result in "dst" list + inv:add_item("dst", cooked.item) + -- take stuff from "src" list + srcstack = inv:get_stack("src", 1) + srcstack:take_item() + inv:set_stack("src", 1, srcstack) + else + print("Furnace inventory full!") + end + meta:set_string("src_time", 0) + end + end + end + + + + + if srclist then + cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + if cooked.time>0 then + hacky_swap_node(pos,"technic:electric_furnace_active") + meta:set_string("infotext","Furnace active") + meta:set_string("furnace_is_cookin",1) + -- meta:set_string("formspec", electric_furnace_formspec) + meta:set_string("src_time", 0) + return + end + + end + + hacky_swap_node(pos,"technic:electric_furnace") + meta:set_string("infotext","Furnace inactive") + meta:set_string("furnace_is_cookin",0) + -- meta:set_string("formspec", electric_furnace_formspec) + meta:set_string("src_time", 0) + + +end, +}) + + + + +function take_EU_from_net(pos, EU_to_take) + local meta = minetest.env:get_meta(pos) + local pos1=pos + pos1.z=pos1.z +1 + local meta1 = minetest.env:get_meta(pos1) + charge=meta1:get_float("battery_charge") + charge=charge - EU_to_take + meta1:set_float("battery_charge",charge) +end + + LV_nodes_visited = {} + +function get_RE_item_load (load1,max_load) +if load1==0 then load1=65535 end +local temp = 65536-load1 +temp= temp/65535*max_load +return math.floor(temp + 0.5) +end + +function set_RE_item_load (load1,max_load) +if load1 == 0 then return 65535 end +local temp=load1/max_load*65535 +temp=65536-temp +return math.floor(temp) +end + +minetest.register_abm({ + nodenames = {"technic:battery_box"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.env:get_meta(pos) + charge= meta:get_float("battery_charge") + max_charge= 60000 + + local inv = meta:get_inventory() + if inv:is_empty("src")==false then + srcstack = inv:get_stack("src", 1) + src_item=srcstack:to_table() + if src_item["name"]== "technic:battery" then + local load1=tonumber((src_item["wear"])) + load1=get_RE_item_load(load1,10000) + load_step=1000 + if load1<10000 and charge>0 then + if charge-load_step<0 then load_step=charge end + if load1+load_step>10000 then load_step=10000-load1 end + load1=load1+load_step + charge=charge-load_step + + load1=set_RE_item_load(load1,10000) + src_item["wear"]=tostring(load1) + inv:set_stack("src", 1, src_item) + end + end + end + meta:set_float("battery_charge",charge) + + + if inv:is_empty("src")==false then + srcstack = inv:get_stack("src", 1) + src_item=srcstack:to_table() + if src_item["name"]== "technic:laser_mk1" then + local load1=tonumber((src_item["wear"])) + load1=get_RE_item_load(load1,40000) + load_step=1000 + if load1<40000 and charge>0 then + if charge-load_step<0 then load_step=charge end + if load1+load_step>40000 then load_step=40000-load1 end + load1=load1+load_step + charge=charge-load_step + load1=set_RE_item_load(load1,40000) + src_item["wear"]=tostring(load1) + inv:set_stack("src", 1, src_item) + end + end + end + meta:set_float("battery_charge",charge) + + + if inv:is_empty("dst") == false then + srcstack = inv:get_stack("dst", 1) + src_item=srcstack:to_table() + if src_item["name"]== "technic:battery" then + local load1=tonumber((src_item["wear"])) + load1=get_RE_item_load(load1,10000) + load_step=1000 + if load1>0 and chargemax_charge then load_step=max_charge-charge end + if load1-load_step<0 then load_step=load1 end + load1=load1-load_step + charge=charge+load_step + + load1=set_RE_item_load(load1,10000) + src_item["wear"]=tostring(load1) + inv:set_stack("dst", 1, src_item) + end + end + end + + + meta:set_float("battery_charge",charge) + meta:set_string("infotext", "Battery box: "..charge.."/"..max_charge); + + local load = math.floor(charge/60000 * 100) + meta:set_string("formspec", + "invsize[8,9;]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "list[current_name;src;3,1;1,1;]".. + "image[4,1;1,1;technic_battery_reload.png]".. + "list[current_name;dst;5,1;1,1;]".. + "label[0,0;Battery box]".. + "label[3,0;Charge]".. + "label[5,0;Discharge]".. + "label[1,3;Power level]".. + "list[current_player;main;0,5;8,4;]") + + local pos1={} + + pos1.y=pos.y-1 + pos1.x=pos.x + pos1.z=pos.z + + + meta1 = minetest.env:get_meta(pos1) + if meta1:get_float("cablelike")~=1 then return end + + local LV_nodes = {} + local PR_nodes = {} + local RE_nodes = {} + + LV_nodes[1]={} + LV_nodes[1].x=pos1.x + LV_nodes[1].y=pos1.y + LV_nodes[1].z=pos1.z + LV_nodes[1].visited=false + + +table_index=1 + repeat + check_LV_node (PR_nodes,RE_nodes,LV_nodes,table_index) + table_index=table_index+1 + if LV_nodes[table_index]==nil then break end + until false + + +local pos1={} +i=1 + repeat + if PR_nodes[i]==nil then break end + pos1.x=PR_nodes[i].x + pos1.y=PR_nodes[i].y + pos1.z=PR_nodes[i].z + local meta1 = minetest.env:get_meta(pos1) + local active=meta1:get_float("active") + if active==1 then charge=charge+80 end + i=i+1 + until false + +if charge>max_charge then charge=max_charge end + +i=1 + repeat + if RE_nodes[i]==nil then break end + pos1.x=RE_nodes[i].x -- loading all conected machines buffers + pos1.y=RE_nodes[i].y + pos1.z=RE_nodes[i].z + local meta1 = minetest.env:get_meta(pos1) + local internal_EU_buffer=meta1:get_float("internal_EU_buffer") + local internal_EU_buffer_size=meta1:get_float("internal_EU_buffer_size") + + local charge_to_give=200 + if internal_EU_buffer+charge_to_give>internal_EU_buffer_size then + charge_to_give=internal_EU_buffer_size-internal_EU_buffer + end + if charge-charge_to_give<0 then charge_to_give=charge end + + internal_EU_buffer=internal_EU_buffer+charge_to_give + meta1:set_float("internal_EU_buffer",internal_EU_buffer) + charge=charge-charge_to_give; + + i=i+1 + until false + + meta:set_float("battery_charge",charge) + meta:set_string("infotext", "Battery box: "..charge.."/"..max_charge); + + +end +}) + +function add_new_cable_node (LV_nodes,pos1) +local i=1 + repeat + if LV_nodes[i]==nil then break end + if pos1.x==LV_nodes[i].x and pos1.y==LV_nodes[i].y and pos1.z==LV_nodes[i].z then return false end + i=i+1 + until false +LV_nodes[i]={} +LV_nodes[i].x=pos1.x +LV_nodes[i].y=pos1.y +LV_nodes[i].z=pos1.z +LV_nodes[i].visited=false +return true +end + +function check_LV_node (PR_nodes,RE_nodes,LV_nodes,i) + local pos1={} + pos1.x=LV_nodes[i].x + pos1.y=LV_nodes[i].y + pos1.z=LV_nodes[i].z + LV_nodes[i].visited=true + new_node_added=false + + pos1.x=pos1.x+1 + check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) + pos1.x=pos1.x-2 + check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) + pos1.x=pos1.x+1 + + pos1.y=pos1.y+1 + check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) + pos1.y=pos1.y-2 + check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) + pos1.y=pos1.y+1 + + pos1.z=pos1.z+1 + check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) + pos1.z=pos1.z-2 + check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) + pos1.z=pos1.z+1 +return new_node_added +end + +function check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1) +meta = minetest.env:get_meta(pos1) +if meta:get_float("cablelike")==1 then new_node_added=add_new_cable_node(LV_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:solar_panel" then new_node_added=add_new_cable_node(PR_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:electric_furnace" then new_node_added=add_new_cable_node(RE_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:electric_furnace_active" then new_node_added=add_new_cable_node(RE_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:tool_workshop" then new_node_added=add_new_cable_node(RE_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:music_player" then new_node_added=add_new_cable_node(RE_nodes,pos1) end +if minetest.env:get_node(pos1).name == "technic:grinder" then new_node_added=add_new_cable_node(RE_nodes,pos1) end +end + + +function get_connected_charge (charge,pos1) + local charge1=0 + local meta={} + if minetest.env:get_node(pos1).name == "technic:battery_box" then + print ("found batbox") + meta = minetest.env:get_meta(pos1) + return meta:get_float("cable_OUT") + end + + if minetest.env:get_node(pos1).name == "technic:lv_cable" then + meta = minetest.env:get_meta(pos1) + charge1=meta:get_float("cable_OUT") + if charge1>charge then + charge=charge1 + end + end +return charge +end + +minetest.register_node("technic:solar_panel", { + tiles = {"technic_solar_panel_top.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png", + "technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + sounds = default.node_sound_wood_defaults(), + description="Solar Panel", + active = false, + technic_power_machine=1, + drawtype = "nodebox", + paramtype = "light", + is_ground_content = true, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_float("technic_power_machine", 1) + meta:set_string("infotext", "Solar Panel") + meta:set_float("active", false) + end, +}) + +minetest.register_craft({ + output = 'technic:solar_panel 1', + recipe = { + {'default:sand', 'default:sand','default:sand'}, + {'default:sand', 'moreores:copper_ingot','default:sand'}, + {'default:sand', 'default:sand','default:sand'}, + + } +}) + +minetest.register_abm( + {nodenames = {"technic:solar_panel"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + + local pos1={} + pos1.y=pos.y+1 + pos1.x=pos.x + pos1.z=pos.z + + local light = minetest.env:get_node_light(pos1, nil) + local meta = minetest.env:get_meta(pos) + if light == nil then light = 0 end + if light >= 12 then + meta:set_string("infotext", "Solar Panel is active ") + meta:set_float("active",1) + else + meta:set_string("infotext", "Solar Panel is inactive"); + meta:set_float("active",0) + end + end, +}) \ No newline at end of file diff --git a/technic/technic/water_mill.lua b/technic/technic/water_mill.lua new file mode 100644 index 0000000..6e0120d --- /dev/null +++ b/technic/technic/water_mill.lua @@ -0,0 +1,128 @@ +minetest.register_alias("water_mill", "technic:water_mill") + +minetest.register_craft({ + output = 'technic:water_mill', + recipe = { + {'default:stone', 'default:stone', 'default:stone'}, + {'default:wood', 'technic:diamond', 'default:wood'}, + {'default:stone', 'moreores:copper_ingot', 'default:stone'}, + } +}) + +minetest.register_craftitem("technic:water_mill", { + description = "Water Mill", + stack_max = 99, +}) + +water_mill_formspec = + "invsize[8,4;]".. + "image[1,1;1,2;technic_power_meter_bg.png]".. + "label[0,0;Water Mill]".. + "label[1,3;Power level]".. + "list[current_player;main;0,5;8,4;]" + + +minetest.register_node("technic:water_mill", { + description = "Water Mill", + tiles = {"technic_water_mill_top.png", "technic_machine_bottom.png", "technic_water_mill_side.png", + "technic_water_mill_side.png", "technic_water_mill_side.png", "technic_water_mill_side.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + technic_power_machine=1, + internal_EU_buffer=0; + internal_EU_buffer_size=5000; + burn_time=0; + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("infotext", "Water Mill") + meta:set_float("technic_power_machine", 1) + meta:set_float("internal_EU_buffer", 0) + meta:set_float("internal_EU_buffer_size", 3000) + meta:set_string("formspec", water_mill_formspec) + end, + +}) + +minetest.register_node("technic:water_mill_active", { + description = "Water Mill", + tiles = {"technic_water_mill_top_active.png", "technic_machine_bottom.png", "technic_water_mill_side.png", + "technic_water_mill_side.png", "technic_water_mill_side.png", "technic_water_mill_side.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + drop="technic:water_mill", + technic_power_machine=1, + internal_EU_buffer=0; + internal_EU_buffer_size=0; +}) + +minetest.register_abm({ + nodenames = {"technic:water_mill","technic:water_mill_active"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + + local meta = minetest.env:get_meta(pos) + local charge= meta:get_float("internal_EU_buffer") + local max_charge= meta:get_float("internal_EU_buffer_size") + local water_nodes = 0 + local lava_nodes = 0 + local production_level=0 + local load_step=0 + + pos.x=pos.x+1 + local check=check_node_around_mill (pos) + if check==1 then water_nodes=water_nodes+1 end + pos.x=pos.x-2 + check=check_node_around_mill (pos) + if check==1 then water_nodes=water_nodes+1 end + pos.x=pos.x+1 + pos.z=pos.z+1 + check=check_node_around_mill (pos) + if check==1 then water_nodes=water_nodes+1 end + pos.z=pos.z-2 + check=check_node_around_mill (pos) + if check==1 then water_nodes=water_nodes+1 end + pos.z=pos.z+1 + + if water_nodes==1 then production_level=25 load_step=30 end + if water_nodes==2 then production_level=50 load_step=60 end + if water_nodes==3 then production_level=75 load_step=90 end + if water_nodes==4 then production_level=100 load_step=120 end + + if production_level>0 then + if charge+load_step>max_charge then + load_step=max_charge-charge + end + if load_step>0 then + charge=charge+load_step + meta:set_float("internal_EU_buffer",charge) + end + end + + local load = math.floor((charge/max_charge)*100) + meta:set_string("formspec", + "invsize[8,4;]".. + "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. + (load)..":technic_power_meter_fg.png]".. + "label[0,0;Water Mill]".. + "label[1,3;Power level]".. + "label[4,0;Production at "..tostring(production_level).."%]" + ) + + if production_level>0 and minetest.env:get_node(pos).name=="technic:water_mill" then + hacky_swap_node (pos,"technic:water_mill_active") + return + end + if production_level==0 then hacky_swap_node (pos,"technic:water_mill") end +end +}) + +function check_node_around_mill (pos) +local node=minetest.env:get_node(pos) +if node.name=="default:water_flowing" then return 1 end +return 0 +end \ No newline at end of file diff --git a/technic/technic/wires.lua b/technic/technic/wires.lua new file mode 100644 index 0000000..e09fc2a --- /dev/null +++ b/technic/technic/wires.lua @@ -0,0 +1,401 @@ +--LV cable node boxes + + +minetest.register_alias("lv_cable", "technic:lv_cable") + +minetest.register_craft({ + output = 'technic:lv_cable 6', + recipe = { + {'moreores:copper_ingot', 'moreores:copper_ingot', 'moreores:copper_ingot'}, + } +}) + +minetest.register_craftitem("technic:lv_cable", { + description = "Low Voltage Copper Cable", + stack_max = 99, +}) + +minetest.register_node("technic:lv_cable", { + description = "Low Voltage Copper Cable", + tiles = {"technic_lv_cable.png"}, + inventory_image = "technic_lv_cable_wield.png", + wield_image = "technic_lv_cable_wield.png", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + sounds = default.node_sound_wood_defaults(), + drop = "technic:lv_cable", + 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("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) + check_connections (pos) + end, + + after_dig_node = function (pos, oldnode, oldmetadata, digger) + 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:lv_cable"..count, { + description = "Low Voltage Copper Cable", + tiles = {"technic_lv_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:lv_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) + check_connections_on_destroy (pos) + end, + +}) + +count=count+1 end end end end end end + +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("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:lv_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:lv_cable"..rule) + end + + pos1.x=pos1.x-2 + if minetest.env:get_meta(pos1):get_float("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:lv_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:lv_cable"..rule) + end + + pos1.x=pos1.x+1 + + pos1.y=pos1.y+1 + if minetest.env:get_meta(pos1):get_float("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:lv_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:lv_cable"..rule) + end + + if minetest.env:get_meta(pos1):get_float("technic_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:lv_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("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:lv_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:lv_cable"..rule) + end + pos1.y=pos1.y+1 + + pos1.z=pos1.z+1 + if minetest.env:get_meta(pos1):get_float("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:lv_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:lv_cable"..rule) + end + pos1.z=pos1.z-2 + if minetest.env:get_meta(pos1):get_float("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:lv_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:lv_cable"..rule) + end + pos1.z=pos1.z+1 +end + +function make_rule_number (x1,x2,y1,y2,z1,z2) +local temp= z2+z1*2+y2*4+y1*8+x2*16+x1*32 +return temp +end + +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("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:lv_cable") end + if rule>0 then hacky_swap_node(pos1,"technic:lv_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("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:lv_cable") end + if rule>0 then hacky_swap_node(pos1,"technic:lv_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("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:lv_cable") end + if rule>0 then hacky_swap_node(pos1,"technic:lv_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("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:lv_cable") end + if rule>0 then hacky_swap_node(pos1,"technic:lv_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("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:lv_cable") end + if rule>0 then hacky_swap_node(pos1,"technic:lv_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("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:lv_cable") end + if rule>0 then hacky_swap_node(pos1,"technic:lv_cable"..rule) end + meta=minetest.env:get_meta(pos1) + meta:set_float("z1",z1) + end + pos1.y=pos1.y+1 + +end + diff --git a/technic/technic/wires_mv.lua b/technic/technic/wires_mv.lua new file mode 100644 index 0000000..7924956 --- /dev/null +++ b/technic/technic/wires_mv.lua @@ -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 + diff --git a/textures/technic_alloy_furnace_front.png b/textures/technic_alloy_furnace_front.png deleted file mode 100644 index 9123fb6..0000000 Binary files a/textures/technic_alloy_furnace_front.png and /dev/null differ diff --git a/textures/technic_alloy_furnace_front_active.png b/textures/technic_alloy_furnace_front_active.png deleted file mode 100644 index 4dda2e6..0000000 Binary files a/textures/technic_alloy_furnace_front_active.png and /dev/null differ diff --git a/textures/technic_alloy_furnace_side.png b/textures/technic_alloy_furnace_side.png deleted file mode 100644 index b5bd428..0000000 Binary files a/textures/technic_alloy_furnace_side.png and /dev/null differ diff --git a/textures/technic_alloy_furnace_top.png b/textures/technic_alloy_furnace_top.png deleted file mode 100644 index 67ef4b7..0000000 Binary files a/textures/technic_alloy_furnace_top.png and /dev/null differ diff --git a/textures/technic_battery.png b/textures/technic_battery.png deleted file mode 100644 index ee83b74..0000000 Binary files a/textures/technic_battery.png and /dev/null differ diff --git a/textures/technic_battery_box_bottom.png b/textures/technic_battery_box_bottom.png deleted file mode 100644 index 03c7ccc..0000000 Binary files a/textures/technic_battery_box_bottom.png and /dev/null differ diff --git a/textures/technic_battery_box_side0.png b/textures/technic_battery_box_side0.png deleted file mode 100644 index 2662ac0..0000000 Binary files a/textures/technic_battery_box_side0.png and /dev/null differ diff --git a/textures/technic_battery_box_top.png b/textures/technic_battery_box_top.png deleted file mode 100644 index 4953a32..0000000 Binary files a/textures/technic_battery_box_top.png and /dev/null differ diff --git a/textures/technic_battery_reload.png b/textures/technic_battery_reload.png deleted file mode 100644 index 164b4ac..0000000 Binary files a/textures/technic_battery_reload.png and /dev/null differ diff --git a/textures/technic_brass_dust.png b/textures/technic_brass_dust.png deleted file mode 100644 index f86167a..0000000 Binary files a/textures/technic_brass_dust.png and /dev/null differ diff --git a/textures/technic_brass_ingot.png b/textures/technic_brass_ingot.png deleted file mode 100644 index 2d8b153..0000000 Binary files a/textures/technic_brass_ingot.png and /dev/null differ diff --git a/textures/technic_bronze_dust.png b/textures/technic_bronze_dust.png deleted file mode 100644 index 0a2401e..0000000 Binary files a/textures/technic_bronze_dust.png and /dev/null differ diff --git a/textures/technic_chainsaw.png b/textures/technic_chainsaw.png deleted file mode 100644 index b7ceee6..0000000 Binary files a/textures/technic_chainsaw.png and /dev/null differ diff --git a/textures/technic_chromium_dust.png b/textures/technic_chromium_dust.png deleted file mode 100644 index a33358b..0000000 Binary files a/textures/technic_chromium_dust.png and /dev/null differ diff --git a/textures/technic_chromium_ingot.png b/textures/technic_chromium_ingot.png deleted file mode 100644 index 91d5b20..0000000 Binary files a/textures/technic_chromium_ingot.png and /dev/null differ diff --git a/textures/technic_chromium_lump.png b/textures/technic_chromium_lump.png deleted file mode 100644 index 1588f92..0000000 Binary files a/textures/technic_chromium_lump.png and /dev/null differ diff --git a/textures/technic_coal_alloy_furnace_bottom.png b/textures/technic_coal_alloy_furnace_bottom.png deleted file mode 100644 index 7a5eed7..0000000 Binary files a/textures/technic_coal_alloy_furnace_bottom.png and /dev/null differ diff --git a/textures/technic_coal_alloy_furnace_front.png b/textures/technic_coal_alloy_furnace_front.png deleted file mode 100644 index b00bef3..0000000 Binary files a/textures/technic_coal_alloy_furnace_front.png and /dev/null differ diff --git a/textures/technic_coal_alloy_furnace_front_active.png b/textures/technic_coal_alloy_furnace_front_active.png deleted file mode 100644 index b41f619..0000000 Binary files a/textures/technic_coal_alloy_furnace_front_active.png and /dev/null differ diff --git a/textures/technic_coal_alloy_furnace_side.png b/textures/technic_coal_alloy_furnace_side.png deleted file mode 100644 index 3db8daa..0000000 Binary files a/textures/technic_coal_alloy_furnace_side.png and /dev/null differ diff --git a/textures/technic_coal_alloy_furnace_top.png b/textures/technic_coal_alloy_furnace_top.png deleted file mode 100644 index c648fe8..0000000 Binary files a/textures/technic_coal_alloy_furnace_top.png and /dev/null differ diff --git a/textures/technic_coal_dust.png b/textures/technic_coal_dust.png deleted file mode 100644 index 4a1da0c..0000000 Binary files a/textures/technic_coal_dust.png and /dev/null differ diff --git a/textures/technic_concrete_block.png b/textures/technic_concrete_block.png deleted file mode 100644 index 91364f3..0000000 Binary files a/textures/technic_concrete_block.png and /dev/null differ diff --git a/textures/technic_constructor_back.png b/textures/technic_constructor_back.png deleted file mode 100644 index 6baf788..0000000 Binary files a/textures/technic_constructor_back.png and /dev/null differ diff --git a/textures/technic_constructor_front_off.png b/textures/technic_constructor_front_off.png deleted file mode 100644 index f878e55..0000000 Binary files a/textures/technic_constructor_front_off.png and /dev/null differ diff --git a/textures/technic_constructor_front_on.png b/textures/technic_constructor_front_on.png deleted file mode 100644 index 89189d6..0000000 Binary files a/textures/technic_constructor_front_on.png and /dev/null differ diff --git a/textures/technic_constructor_mk1_bottom_off.png b/textures/technic_constructor_mk1_bottom_off.png deleted file mode 100644 index 205dcc4..0000000 Binary files a/textures/technic_constructor_mk1_bottom_off.png and /dev/null differ diff --git a/textures/technic_constructor_mk1_bottom_on.png b/textures/technic_constructor_mk1_bottom_on.png deleted file mode 100644 index 9896c52..0000000 Binary files a/textures/technic_constructor_mk1_bottom_on.png and /dev/null differ diff --git a/textures/technic_constructor_mk1_side1_off.png b/textures/technic_constructor_mk1_side1_off.png deleted file mode 100644 index e8a01ff..0000000 Binary files a/textures/technic_constructor_mk1_side1_off.png and /dev/null differ diff --git a/textures/technic_constructor_mk1_side1_on.png b/textures/technic_constructor_mk1_side1_on.png deleted file mode 100644 index c897942..0000000 Binary files a/textures/technic_constructor_mk1_side1_on.png and /dev/null differ diff --git a/textures/technic_constructor_mk1_side2_off.png b/textures/technic_constructor_mk1_side2_off.png deleted file mode 100644 index 8da65f6..0000000 Binary files a/textures/technic_constructor_mk1_side2_off.png and /dev/null differ diff --git a/textures/technic_constructor_mk1_side2_on.png b/textures/technic_constructor_mk1_side2_on.png deleted file mode 100644 index da8ed34..0000000 Binary files a/textures/technic_constructor_mk1_side2_on.png and /dev/null differ diff --git a/textures/technic_constructor_mk1_top_off.png b/textures/technic_constructor_mk1_top_off.png deleted file mode 100644 index 7d8c7e0..0000000 Binary files a/textures/technic_constructor_mk1_top_off.png and /dev/null differ diff --git a/textures/technic_constructor_mk1_top_on.png b/textures/technic_constructor_mk1_top_on.png deleted file mode 100644 index 439caf5..0000000 Binary files a/textures/technic_constructor_mk1_top_on.png and /dev/null differ diff --git a/textures/technic_constructor_mk2_bottom_off.png b/textures/technic_constructor_mk2_bottom_off.png deleted file mode 100644 index 83c5b07..0000000 Binary files a/textures/technic_constructor_mk2_bottom_off.png and /dev/null differ diff --git a/textures/technic_constructor_mk2_bottom_on.png b/textures/technic_constructor_mk2_bottom_on.png deleted file mode 100644 index 9ad76f4..0000000 Binary files a/textures/technic_constructor_mk2_bottom_on.png and /dev/null differ diff --git a/textures/technic_constructor_mk2_side1_off.png b/textures/technic_constructor_mk2_side1_off.png deleted file mode 100644 index 584dfe3..0000000 Binary files a/textures/technic_constructor_mk2_side1_off.png and /dev/null differ diff --git a/textures/technic_constructor_mk2_side1_on.png b/textures/technic_constructor_mk2_side1_on.png deleted file mode 100644 index fe02042..0000000 Binary files a/textures/technic_constructor_mk2_side1_on.png and /dev/null differ diff --git a/textures/technic_constructor_mk2_side2_off.png b/textures/technic_constructor_mk2_side2_off.png deleted file mode 100644 index fd9ad74..0000000 Binary files a/textures/technic_constructor_mk2_side2_off.png and /dev/null differ diff --git a/textures/technic_constructor_mk2_side2_on.png b/textures/technic_constructor_mk2_side2_on.png deleted file mode 100644 index f51411a..0000000 Binary files a/textures/technic_constructor_mk2_side2_on.png and /dev/null differ diff --git a/textures/technic_constructor_mk2_top_off.png b/textures/technic_constructor_mk2_top_off.png deleted file mode 100644 index e3e3292..0000000 Binary files a/textures/technic_constructor_mk2_top_off.png and /dev/null differ diff --git a/textures/technic_constructor_mk2_top_on.png b/textures/technic_constructor_mk2_top_on.png deleted file mode 100644 index 83043d4..0000000 Binary files a/textures/technic_constructor_mk2_top_on.png and /dev/null differ diff --git a/textures/technic_constructor_mk3_bottom_off.png b/textures/technic_constructor_mk3_bottom_off.png deleted file mode 100644 index 5f46154..0000000 Binary files a/textures/technic_constructor_mk3_bottom_off.png and /dev/null differ diff --git a/textures/technic_constructor_mk3_bottom_on.png b/textures/technic_constructor_mk3_bottom_on.png deleted file mode 100644 index f76f29b..0000000 Binary files a/textures/technic_constructor_mk3_bottom_on.png and /dev/null differ diff --git a/textures/technic_constructor_mk3_side1_off.png b/textures/technic_constructor_mk3_side1_off.png deleted file mode 100644 index 0ea1fc0..0000000 Binary files a/textures/technic_constructor_mk3_side1_off.png and /dev/null differ diff --git a/textures/technic_constructor_mk3_side1_on.png b/textures/technic_constructor_mk3_side1_on.png deleted file mode 100644 index ba86332..0000000 Binary files a/textures/technic_constructor_mk3_side1_on.png and /dev/null differ diff --git a/textures/technic_constructor_mk3_side2_off.png b/textures/technic_constructor_mk3_side2_off.png deleted file mode 100644 index 8e8dce4..0000000 Binary files a/textures/technic_constructor_mk3_side2_off.png and /dev/null differ diff --git a/textures/technic_constructor_mk3_side2_on.png b/textures/technic_constructor_mk3_side2_on.png deleted file mode 100644 index 12dff69..0000000 Binary files a/textures/technic_constructor_mk3_side2_on.png and /dev/null differ diff --git a/textures/technic_constructor_mk3_top_off.png b/textures/technic_constructor_mk3_top_off.png deleted file mode 100644 index 705f255..0000000 Binary files a/textures/technic_constructor_mk3_top_off.png and /dev/null differ diff --git a/textures/technic_constructor_mk3_top_on.png b/textures/technic_constructor_mk3_top_on.png deleted file mode 100644 index cef077e..0000000 Binary files a/textures/technic_constructor_mk3_top_on.png and /dev/null differ diff --git a/textures/technic_copper_chest_front.png b/textures/technic_copper_chest_front.png deleted file mode 100644 index 1769435..0000000 Binary files a/textures/technic_copper_chest_front.png and /dev/null differ diff --git a/textures/technic_copper_chest_locked.png b/textures/technic_copper_chest_locked.png deleted file mode 100644 index 6d059e9..0000000 Binary files a/textures/technic_copper_chest_locked.png and /dev/null differ diff --git a/textures/technic_copper_chest_side.png b/textures/technic_copper_chest_side.png deleted file mode 100644 index 2c7943f..0000000 Binary files a/textures/technic_copper_chest_side.png and /dev/null differ diff --git a/textures/technic_copper_chest_top.png b/textures/technic_copper_chest_top.png deleted file mode 100644 index 2ab8104..0000000 Binary files a/textures/technic_copper_chest_top.png and /dev/null differ diff --git a/textures/technic_copper_coil.png b/textures/technic_copper_coil.png deleted file mode 100644 index db6db1a..0000000 Binary files a/textures/technic_copper_coil.png and /dev/null differ diff --git a/textures/technic_copper_dust.png b/textures/technic_copper_dust.png deleted file mode 100644 index 68678ed..0000000 Binary files a/textures/technic_copper_dust.png and /dev/null differ diff --git a/textures/technic_deployer_back.png b/textures/technic_deployer_back.png deleted file mode 100644 index 0bc8df9..0000000 Binary files a/textures/technic_deployer_back.png and /dev/null differ diff --git a/textures/technic_deployer_bottom.png b/textures/technic_deployer_bottom.png deleted file mode 100644 index ff1a2c6..0000000 Binary files a/textures/technic_deployer_bottom.png and /dev/null differ diff --git a/textures/technic_deployer_front_off.png b/textures/technic_deployer_front_off.png deleted file mode 100644 index d0f6f55..0000000 Binary files a/textures/technic_deployer_front_off.png and /dev/null differ diff --git a/textures/technic_deployer_front_on.png b/textures/technic_deployer_front_on.png deleted file mode 100644 index 368ce32..0000000 Binary files a/textures/technic_deployer_front_on.png and /dev/null differ diff --git a/textures/technic_deployer_side.png b/textures/technic_deployer_side.png deleted file mode 100644 index aefd7c8..0000000 Binary files a/textures/technic_deployer_side.png and /dev/null differ diff --git a/textures/technic_deployer_side1.png b/textures/technic_deployer_side1.png deleted file mode 100644 index 8cb8634..0000000 Binary files a/textures/technic_deployer_side1.png and /dev/null differ diff --git a/textures/technic_deployer_side2.png b/textures/technic_deployer_side2.png deleted file mode 100644 index c2855d0..0000000 Binary files a/textures/technic_deployer_side2.png and /dev/null differ diff --git a/textures/technic_deployer_top.png b/textures/technic_deployer_top.png deleted file mode 100644 index 941d333..0000000 Binary files a/textures/technic_deployer_top.png and /dev/null differ diff --git a/textures/technic_diamond.png b/textures/technic_diamond.png deleted file mode 100644 index 23e6126..0000000 Binary files a/textures/technic_diamond.png and /dev/null differ diff --git a/textures/technic_diamond_block.png b/textures/technic_diamond_block.png deleted file mode 100644 index 347ed78..0000000 Binary files a/textures/technic_diamond_block.png and /dev/null differ diff --git a/textures/technic_diamond_block_blue.png b/textures/technic_diamond_block_blue.png deleted file mode 100644 index d89bd6e..0000000 Binary files a/textures/technic_diamond_block_blue.png and /dev/null differ diff --git a/textures/technic_diamond_block_green.png b/textures/technic_diamond_block_green.png deleted file mode 100644 index 996b254..0000000 Binary files a/textures/technic_diamond_block_green.png and /dev/null differ diff --git a/textures/technic_diamond_block_red.png b/textures/technic_diamond_block_red.png deleted file mode 100644 index 52fd893..0000000 Binary files a/textures/technic_diamond_block_red.png and /dev/null differ diff --git a/textures/technic_diamond_drill_head.png b/textures/technic_diamond_drill_head.png deleted file mode 100644 index e3d31e8..0000000 Binary files a/textures/technic_diamond_drill_head.png and /dev/null differ diff --git a/textures/technic_doped_silicon_wafer.png b/textures/technic_doped_silicon_wafer.png deleted file mode 100644 index 6ff06a6..0000000 Binary files a/textures/technic_doped_silicon_wafer.png and /dev/null differ diff --git a/textures/technic_electric_furnace_bottom.png b/textures/technic_electric_furnace_bottom.png deleted file mode 100644 index d16ac47..0000000 Binary files a/textures/technic_electric_furnace_bottom.png and /dev/null differ diff --git a/textures/technic_electric_furnace_front.png b/textures/technic_electric_furnace_front.png deleted file mode 100644 index dfee663..0000000 Binary files a/textures/technic_electric_furnace_front.png and /dev/null differ diff --git a/textures/technic_electric_furnace_front_active.png b/textures/technic_electric_furnace_front_active.png deleted file mode 100644 index 038eec4..0000000 Binary files a/textures/technic_electric_furnace_front_active.png and /dev/null differ diff --git a/textures/technic_electric_furnace_side.png b/textures/technic_electric_furnace_side.png deleted file mode 100644 index cf345e7..0000000 Binary files a/textures/technic_electric_furnace_side.png and /dev/null differ diff --git a/textures/technic_electric_furnace_top.png b/textures/technic_electric_furnace_top.png deleted file mode 100644 index d3309ec..0000000 Binary files a/textures/technic_electric_furnace_top.png and /dev/null differ diff --git a/textures/technic_fine_copper_wire.png b/textures/technic_fine_copper_wire.png deleted file mode 100644 index 36e2ed6..0000000 Binary files a/textures/technic_fine_copper_wire.png and /dev/null differ diff --git a/textures/technic_flashlight.png b/textures/technic_flashlight.png deleted file mode 100644 index 01afdbb..0000000 Binary files a/textures/technic_flashlight.png and /dev/null differ diff --git a/textures/technic_generator_front.png b/textures/technic_generator_front.png deleted file mode 100644 index 2d64844..0000000 Binary files a/textures/technic_generator_front.png and /dev/null differ diff --git a/textures/technic_generator_front_active.png b/textures/technic_generator_front_active.png deleted file mode 100644 index 4e57ca0..0000000 Binary files a/textures/technic_generator_front_active.png and /dev/null differ diff --git a/textures/technic_generator_side.png b/textures/technic_generator_side.png deleted file mode 100644 index 5cbcbef..0000000 Binary files a/textures/technic_generator_side.png and /dev/null differ diff --git a/textures/technic_generator_top.png b/textures/technic_generator_top.png deleted file mode 100644 index e2f3db3..0000000 Binary files a/textures/technic_generator_top.png and /dev/null differ diff --git a/textures/technic_geothermal_side.png b/textures/technic_geothermal_side.png deleted file mode 100644 index 90fb430..0000000 Binary files a/textures/technic_geothermal_side.png and /dev/null differ diff --git a/textures/technic_geothermal_top.png b/textures/technic_geothermal_top.png deleted file mode 100644 index 601ff15..0000000 Binary files a/textures/technic_geothermal_top.png and /dev/null differ diff --git a/textures/technic_geothermal_top_active.png b/textures/technic_geothermal_top_active.png deleted file mode 100644 index f02bec6..0000000 Binary files a/textures/technic_geothermal_top_active.png and /dev/null differ diff --git a/textures/technic_gold_chest_front.png b/textures/technic_gold_chest_front.png deleted file mode 100644 index 9bc9615..0000000 Binary files a/textures/technic_gold_chest_front.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_black.png b/textures/technic_gold_chest_front_black.png deleted file mode 100644 index 6d0fe5e..0000000 Binary files a/textures/technic_gold_chest_front_black.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_blue.png b/textures/technic_gold_chest_front_blue.png deleted file mode 100644 index 7efe651..0000000 Binary files a/textures/technic_gold_chest_front_blue.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_brown.png b/textures/technic_gold_chest_front_brown.png deleted file mode 100644 index 4f4f34e..0000000 Binary files a/textures/technic_gold_chest_front_brown.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_cyan.png b/textures/technic_gold_chest_front_cyan.png deleted file mode 100644 index e33d76d..0000000 Binary files a/textures/technic_gold_chest_front_cyan.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_dark_green.png b/textures/technic_gold_chest_front_dark_green.png deleted file mode 100644 index 3088bbf..0000000 Binary files a/textures/technic_gold_chest_front_dark_green.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_dark_grey.png b/textures/technic_gold_chest_front_dark_grey.png deleted file mode 100644 index 0aa03b4..0000000 Binary files a/textures/technic_gold_chest_front_dark_grey.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_green.png b/textures/technic_gold_chest_front_green.png deleted file mode 100644 index 30da993..0000000 Binary files a/textures/technic_gold_chest_front_green.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_grey.png b/textures/technic_gold_chest_front_grey.png deleted file mode 100644 index eae7e69..0000000 Binary files a/textures/technic_gold_chest_front_grey.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_magenta.png b/textures/technic_gold_chest_front_magenta.png deleted file mode 100644 index 6daed3b..0000000 Binary files a/textures/technic_gold_chest_front_magenta.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_orange.png b/textures/technic_gold_chest_front_orange.png deleted file mode 100644 index 085c102..0000000 Binary files a/textures/technic_gold_chest_front_orange.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_pink.png b/textures/technic_gold_chest_front_pink.png deleted file mode 100644 index eada4da..0000000 Binary files a/textures/technic_gold_chest_front_pink.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_red.png b/textures/technic_gold_chest_front_red.png deleted file mode 100644 index b67da7b..0000000 Binary files a/textures/technic_gold_chest_front_red.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_violet.png b/textures/technic_gold_chest_front_violet.png deleted file mode 100644 index b62011c..0000000 Binary files a/textures/technic_gold_chest_front_violet.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_white.png b/textures/technic_gold_chest_front_white.png deleted file mode 100644 index 76b5ebf..0000000 Binary files a/textures/technic_gold_chest_front_white.png and /dev/null differ diff --git a/textures/technic_gold_chest_front_yellow.png b/textures/technic_gold_chest_front_yellow.png deleted file mode 100644 index b0ab9f4..0000000 Binary files a/textures/technic_gold_chest_front_yellow.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked.png b/textures/technic_gold_chest_locked.png deleted file mode 100644 index 91a8b73..0000000 Binary files a/textures/technic_gold_chest_locked.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_black.png b/textures/technic_gold_chest_locked_black.png deleted file mode 100644 index 5a5a568..0000000 Binary files a/textures/technic_gold_chest_locked_black.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_blue.png b/textures/technic_gold_chest_locked_blue.png deleted file mode 100644 index f369ebd..0000000 Binary files a/textures/technic_gold_chest_locked_blue.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_brown.png b/textures/technic_gold_chest_locked_brown.png deleted file mode 100644 index a44a273..0000000 Binary files a/textures/technic_gold_chest_locked_brown.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_cyan.png b/textures/technic_gold_chest_locked_cyan.png deleted file mode 100644 index f3ce7b6..0000000 Binary files a/textures/technic_gold_chest_locked_cyan.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_dark_green.png b/textures/technic_gold_chest_locked_dark_green.png deleted file mode 100644 index 084dae5..0000000 Binary files a/textures/technic_gold_chest_locked_dark_green.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_dark_grey.png b/textures/technic_gold_chest_locked_dark_grey.png deleted file mode 100644 index 629e33c..0000000 Binary files a/textures/technic_gold_chest_locked_dark_grey.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_green.png b/textures/technic_gold_chest_locked_green.png deleted file mode 100644 index 9ea1818..0000000 Binary files a/textures/technic_gold_chest_locked_green.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_grey.png b/textures/technic_gold_chest_locked_grey.png deleted file mode 100644 index c936d7c..0000000 Binary files a/textures/technic_gold_chest_locked_grey.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_magenta.png b/textures/technic_gold_chest_locked_magenta.png deleted file mode 100644 index 4c97fa8..0000000 Binary files a/textures/technic_gold_chest_locked_magenta.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_orange.png b/textures/technic_gold_chest_locked_orange.png deleted file mode 100644 index f6d5e90..0000000 Binary files a/textures/technic_gold_chest_locked_orange.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_pink.png b/textures/technic_gold_chest_locked_pink.png deleted file mode 100644 index 4248c21..0000000 Binary files a/textures/technic_gold_chest_locked_pink.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_red.png b/textures/technic_gold_chest_locked_red.png deleted file mode 100644 index 4bfe5d4..0000000 Binary files a/textures/technic_gold_chest_locked_red.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_violet.png b/textures/technic_gold_chest_locked_violet.png deleted file mode 100644 index c9abe73..0000000 Binary files a/textures/technic_gold_chest_locked_violet.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_white.png b/textures/technic_gold_chest_locked_white.png deleted file mode 100644 index 810abb9..0000000 Binary files a/textures/technic_gold_chest_locked_white.png and /dev/null differ diff --git a/textures/technic_gold_chest_locked_yellow.png b/textures/technic_gold_chest_locked_yellow.png deleted file mode 100644 index 2856165..0000000 Binary files a/textures/technic_gold_chest_locked_yellow.png and /dev/null differ diff --git a/textures/technic_gold_chest_side.png b/textures/technic_gold_chest_side.png deleted file mode 100644 index 5d5ad0f..0000000 Binary files a/textures/technic_gold_chest_side.png and /dev/null differ diff --git a/textures/technic_gold_chest_top.png b/textures/technic_gold_chest_top.png deleted file mode 100644 index f9c8fec..0000000 Binary files a/textures/technic_gold_chest_top.png and /dev/null differ diff --git a/textures/technic_gold_dust.png b/textures/technic_gold_dust.png deleted file mode 100644 index e545bb6..0000000 Binary files a/textures/technic_gold_dust.png and /dev/null differ diff --git a/textures/technic_granite.png b/textures/technic_granite.png deleted file mode 100644 index abb1385..0000000 Binary files a/textures/technic_granite.png and /dev/null differ diff --git a/textures/technic_grinder_front.png b/textures/technic_grinder_front.png deleted file mode 100644 index a28dbc1..0000000 Binary files a/textures/technic_grinder_front.png and /dev/null differ diff --git a/textures/technic_grinder_side.png b/textures/technic_grinder_side.png deleted file mode 100644 index af562f2..0000000 Binary files a/textures/technic_grinder_side.png and /dev/null differ diff --git a/textures/technic_grinder_top.png b/textures/technic_grinder_top.png deleted file mode 100644 index b074e13..0000000 Binary files a/textures/technic_grinder_top.png and /dev/null differ diff --git a/textures/technic_iron_chest_front.png b/textures/technic_iron_chest_front.png deleted file mode 100644 index 79d5b49..0000000 Binary files a/textures/technic_iron_chest_front.png and /dev/null differ diff --git a/textures/technic_iron_chest_locked.png b/textures/technic_iron_chest_locked.png deleted file mode 100644 index 6229487..0000000 Binary files a/textures/technic_iron_chest_locked.png and /dev/null differ diff --git a/textures/technic_iron_chest_side.png b/textures/technic_iron_chest_side.png deleted file mode 100644 index e12daa5..0000000 Binary files a/textures/technic_iron_chest_side.png and /dev/null differ diff --git a/textures/technic_iron_chest_top.png b/textures/technic_iron_chest_top.png deleted file mode 100644 index da1ab7b..0000000 Binary files a/textures/technic_iron_chest_top.png and /dev/null differ diff --git a/textures/technic_iron_dust.png b/textures/technic_iron_dust.png deleted file mode 100644 index aaecd2b..0000000 Binary files a/textures/technic_iron_dust.png and /dev/null differ diff --git a/textures/technic_laser_beam.png b/textures/technic_laser_beam.png deleted file mode 100644 index 4814a9b..0000000 Binary files a/textures/technic_laser_beam.png and /dev/null differ diff --git a/textures/technic_lava_can.png b/textures/technic_lava_can.png deleted file mode 100644 index 80d15a6..0000000 Binary files a/textures/technic_lava_can.png and /dev/null differ diff --git a/textures/technic_light.png b/textures/technic_light.png deleted file mode 100644 index 334cb07..0000000 Binary files a/textures/technic_light.png and /dev/null differ diff --git a/textures/technic_lv_cable.png b/textures/technic_lv_cable.png deleted file mode 100644 index 87076c9..0000000 Binary files a/textures/technic_lv_cable.png and /dev/null differ diff --git a/textures/technic_lv_cable_wield.png b/textures/technic_lv_cable_wield.png deleted file mode 100644 index c4ada04..0000000 Binary files a/textures/technic_lv_cable_wield.png and /dev/null differ diff --git a/textures/technic_machine_bottom.png b/textures/technic_machine_bottom.png deleted file mode 100644 index 48a47b0..0000000 Binary files a/textures/technic_machine_bottom.png and /dev/null differ diff --git a/textures/technic_marble.png b/textures/technic_marble.png deleted file mode 100644 index 846a170..0000000 Binary files a/textures/technic_marble.png and /dev/null differ diff --git a/textures/technic_marble_bricks.png b/textures/technic_marble_bricks.png deleted file mode 100644 index 2ea1e42..0000000 Binary files a/textures/technic_marble_bricks.png and /dev/null differ diff --git a/textures/technic_menu_bg.png b/textures/technic_menu_bg.png deleted file mode 100644 index 18e6a56..0000000 Binary files a/textures/technic_menu_bg.png and /dev/null differ diff --git a/textures/technic_mineral_chromium.png b/textures/technic_mineral_chromium.png deleted file mode 100644 index c66f1c5..0000000 Binary files a/textures/technic_mineral_chromium.png and /dev/null differ diff --git a/textures/technic_mineral_diamond.png b/textures/technic_mineral_diamond.png deleted file mode 100644 index 2d91505..0000000 Binary files a/textures/technic_mineral_diamond.png and /dev/null differ diff --git a/textures/technic_mineral_uranium.png b/textures/technic_mineral_uranium.png deleted file mode 100644 index aad9c07..0000000 Binary files a/textures/technic_mineral_uranium.png and /dev/null differ diff --git a/textures/technic_mineral_zinc.png b/textures/technic_mineral_zinc.png deleted file mode 100644 index 598efeb..0000000 Binary files a/textures/technic_mineral_zinc.png and /dev/null differ diff --git a/textures/technic_mining_drill.png b/textures/technic_mining_drill.png deleted file mode 100644 index 171888d..0000000 Binary files a/textures/technic_mining_drill.png and /dev/null differ diff --git a/textures/technic_mining_laser_mk1.png b/textures/technic_mining_laser_mk1.png deleted file mode 100644 index acde392..0000000 Binary files a/textures/technic_mining_laser_mk1.png and /dev/null differ diff --git a/textures/technic_mithril_chest_front.png b/textures/technic_mithril_chest_front.png deleted file mode 100644 index 9f7ca7e..0000000 Binary files a/textures/technic_mithril_chest_front.png and /dev/null differ diff --git a/textures/technic_mithril_chest_locked.png b/textures/technic_mithril_chest_locked.png deleted file mode 100644 index abff384..0000000 Binary files a/textures/technic_mithril_chest_locked.png and /dev/null differ diff --git a/textures/technic_mithril_chest_side.png b/textures/technic_mithril_chest_side.png deleted file mode 100644 index 0763511..0000000 Binary files a/textures/technic_mithril_chest_side.png and /dev/null differ diff --git a/textures/technic_mithril_chest_top.png b/textures/technic_mithril_chest_top.png deleted file mode 100644 index 2429576..0000000 Binary files a/textures/technic_mithril_chest_top.png and /dev/null differ diff --git a/textures/technic_mithril_dust.png b/textures/technic_mithril_dust.png deleted file mode 100644 index 988e449..0000000 Binary files a/textures/technic_mithril_dust.png and /dev/null differ diff --git a/textures/technic_motor.png b/textures/technic_motor.png deleted file mode 100644 index 77d4b91..0000000 Binary files a/textures/technic_motor.png and /dev/null differ diff --git a/textures/technic_music_player_bottom.png b/textures/technic_music_player_bottom.png deleted file mode 100644 index bd8fd55..0000000 Binary files a/textures/technic_music_player_bottom.png and /dev/null differ diff --git a/textures/technic_music_player_side.png b/textures/technic_music_player_side.png deleted file mode 100644 index 6c34fea..0000000 Binary files a/textures/technic_music_player_side.png and /dev/null differ diff --git a/textures/technic_music_player_top.png b/textures/technic_music_player_top.png deleted file mode 100644 index 0d34563..0000000 Binary files a/textures/technic_music_player_top.png and /dev/null differ diff --git a/textures/technic_mv_battery_box_bottom.png b/textures/technic_mv_battery_box_bottom.png deleted file mode 100644 index 2a9b292..0000000 Binary files a/textures/technic_mv_battery_box_bottom.png and /dev/null differ diff --git a/textures/technic_mv_battery_box_side0.png b/textures/technic_mv_battery_box_side0.png deleted file mode 100644 index 39d8986..0000000 Binary files a/textures/technic_mv_battery_box_side0.png and /dev/null differ diff --git a/textures/technic_mv_battery_box_top.png b/textures/technic_mv_battery_box_top.png deleted file mode 100644 index f7f1ea9..0000000 Binary files a/textures/technic_mv_battery_box_top.png and /dev/null differ diff --git a/textures/technic_mv_cable.png b/textures/technic_mv_cable.png deleted file mode 100644 index 2819d2b..0000000 Binary files a/textures/technic_mv_cable.png and /dev/null differ diff --git a/textures/technic_mv_cable_wield.png b/textures/technic_mv_cable_wield.png deleted file mode 100644 index aca9fd4..0000000 Binary files a/textures/technic_mv_cable_wield.png and /dev/null differ diff --git a/textures/technic_mv_solar_panel_bottom.png b/textures/technic_mv_solar_panel_bottom.png deleted file mode 100644 index 94c8222..0000000 Binary files a/textures/technic_mv_solar_panel_bottom.png and /dev/null differ diff --git a/textures/technic_mv_solar_panel_side.png b/textures/technic_mv_solar_panel_side.png deleted file mode 100644 index d39d3d8..0000000 Binary files a/textures/technic_mv_solar_panel_side.png and /dev/null differ diff --git a/textures/technic_mv_solar_panel_top.png b/textures/technic_mv_solar_panel_top.png deleted file mode 100644 index 3d8c7ab..0000000 Binary files a/textures/technic_mv_solar_panel_top.png and /dev/null differ diff --git a/textures/technic_mv_transformer.png b/textures/technic_mv_transformer.png deleted file mode 100644 index 7c4688e..0000000 Binary files a/textures/technic_mv_transformer.png and /dev/null differ diff --git a/textures/technic_nodebreaker_back.png b/textures/technic_nodebreaker_back.png deleted file mode 100644 index b669ef6..0000000 Binary files a/textures/technic_nodebreaker_back.png and /dev/null differ diff --git a/textures/technic_nodebreaker_bottom.png b/textures/technic_nodebreaker_bottom.png deleted file mode 100644 index ff1a2c6..0000000 Binary files a/textures/technic_nodebreaker_bottom.png and /dev/null differ diff --git a/textures/technic_nodebreaker_bottom_off.png b/textures/technic_nodebreaker_bottom_off.png deleted file mode 100644 index 410617a..0000000 Binary files a/textures/technic_nodebreaker_bottom_off.png and /dev/null differ diff --git a/textures/technic_nodebreaker_bottom_on.png b/textures/technic_nodebreaker_bottom_on.png deleted file mode 100644 index d6da4d8..0000000 Binary files a/textures/technic_nodebreaker_bottom_on.png and /dev/null differ diff --git a/textures/technic_nodebreaker_front_off.png b/textures/technic_nodebreaker_front_off.png deleted file mode 100644 index 5a25b4c..0000000 Binary files a/textures/technic_nodebreaker_front_off.png and /dev/null differ diff --git a/textures/technic_nodebreaker_front_on.png b/textures/technic_nodebreaker_front_on.png deleted file mode 100644 index 97d22c3..0000000 Binary files a/textures/technic_nodebreaker_front_on.png and /dev/null differ diff --git a/textures/technic_nodebreaker_side.png b/textures/technic_nodebreaker_side.png deleted file mode 100644 index aefd7c8..0000000 Binary files a/textures/technic_nodebreaker_side.png and /dev/null differ diff --git a/textures/technic_nodebreaker_side1.png b/textures/technic_nodebreaker_side1.png deleted file mode 100644 index 8cb8634..0000000 Binary files a/textures/technic_nodebreaker_side1.png and /dev/null differ diff --git a/textures/technic_nodebreaker_side1_off.png b/textures/technic_nodebreaker_side1_off.png deleted file mode 100644 index 5e36d3a..0000000 Binary files a/textures/technic_nodebreaker_side1_off.png and /dev/null differ diff --git a/textures/technic_nodebreaker_side1_on.png b/textures/technic_nodebreaker_side1_on.png deleted file mode 100644 index c76ccff..0000000 Binary files a/textures/technic_nodebreaker_side1_on.png and /dev/null differ diff --git a/textures/technic_nodebreaker_side2.png b/textures/technic_nodebreaker_side2.png deleted file mode 100644 index c2855d0..0000000 Binary files a/textures/technic_nodebreaker_side2.png and /dev/null differ diff --git a/textures/technic_nodebreaker_side2_off.png b/textures/technic_nodebreaker_side2_off.png deleted file mode 100644 index 622ff7c..0000000 Binary files a/textures/technic_nodebreaker_side2_off.png and /dev/null differ diff --git a/textures/technic_nodebreaker_side2_on.png b/textures/technic_nodebreaker_side2_on.png deleted file mode 100644 index c54e467..0000000 Binary files a/textures/technic_nodebreaker_side2_on.png and /dev/null differ diff --git a/textures/technic_nodebreaker_top.png b/textures/technic_nodebreaker_top.png deleted file mode 100644 index 941d333..0000000 Binary files a/textures/technic_nodebreaker_top.png and /dev/null differ diff --git a/textures/technic_nodebreaker_top_off.png b/textures/technic_nodebreaker_top_off.png deleted file mode 100644 index 1f9b361..0000000 Binary files a/textures/technic_nodebreaker_top_off.png and /dev/null differ diff --git a/textures/technic_nodebreaker_top_on.png b/textures/technic_nodebreaker_top_on.png deleted file mode 100644 index d02ed10..0000000 Binary files a/textures/technic_nodebreaker_top_on.png and /dev/null differ diff --git a/textures/technic_power_meter.png b/textures/technic_power_meter.png deleted file mode 100644 index f1e5120..0000000 Binary files a/textures/technic_power_meter.png and /dev/null differ diff --git a/textures/technic_power_meter1.png b/textures/technic_power_meter1.png deleted file mode 100644 index 0542c7b..0000000 Binary files a/textures/technic_power_meter1.png and /dev/null differ diff --git a/textures/technic_power_meter2.png b/textures/technic_power_meter2.png deleted file mode 100644 index bf5703c..0000000 Binary files a/textures/technic_power_meter2.png and /dev/null differ diff --git a/textures/technic_power_meter3.png b/textures/technic_power_meter3.png deleted file mode 100644 index 4204815..0000000 Binary files a/textures/technic_power_meter3.png and /dev/null differ diff --git a/textures/technic_power_meter4.png b/textures/technic_power_meter4.png deleted file mode 100644 index 82a0148..0000000 Binary files a/textures/technic_power_meter4.png and /dev/null differ diff --git a/textures/technic_power_meter5.png b/textures/technic_power_meter5.png deleted file mode 100644 index af783ca..0000000 Binary files a/textures/technic_power_meter5.png and /dev/null differ diff --git a/textures/technic_power_meter6.png b/textures/technic_power_meter6.png deleted file mode 100644 index 44feff4..0000000 Binary files a/textures/technic_power_meter6.png and /dev/null differ diff --git a/textures/technic_power_meter7.png b/textures/technic_power_meter7.png deleted file mode 100644 index 554baa2..0000000 Binary files a/textures/technic_power_meter7.png and /dev/null differ diff --git a/textures/technic_power_meter8.png b/textures/technic_power_meter8.png deleted file mode 100644 index 8c4f4a8..0000000 Binary files a/textures/technic_power_meter8.png and /dev/null differ diff --git a/textures/technic_power_meter_bg.png b/textures/technic_power_meter_bg.png deleted file mode 100644 index 9667cda..0000000 Binary files a/textures/technic_power_meter_bg.png and /dev/null differ diff --git a/textures/technic_power_meter_fg.png b/textures/technic_power_meter_fg.png deleted file mode 100644 index 7f2dde8..0000000 Binary files a/textures/technic_power_meter_fg.png and /dev/null differ diff --git a/textures/technic_raw_latex.png b/textures/technic_raw_latex.png deleted file mode 100644 index 7fbbe64..0000000 Binary files a/textures/technic_raw_latex.png and /dev/null differ diff --git a/textures/technic_rebar.png b/textures/technic_rebar.png deleted file mode 100644 index 16d1fc5..0000000 Binary files a/textures/technic_rebar.png and /dev/null differ diff --git a/textures/technic_rubber.png b/textures/technic_rubber.png deleted file mode 100644 index 9ed4a9d..0000000 Binary files a/textures/technic_rubber.png and /dev/null differ diff --git a/textures/technic_rubber_sapling.png b/textures/technic_rubber_sapling.png deleted file mode 100644 index e5c9f5d..0000000 Binary files a/textures/technic_rubber_sapling.png and /dev/null differ diff --git a/textures/technic_rubber_tree_empty.png b/textures/technic_rubber_tree_empty.png deleted file mode 100644 index 1792951..0000000 Binary files a/textures/technic_rubber_tree_empty.png and /dev/null differ diff --git a/textures/technic_rubber_tree_full.png b/textures/technic_rubber_tree_full.png deleted file mode 100644 index 08067ef..0000000 Binary files a/textures/technic_rubber_tree_full.png and /dev/null differ diff --git a/textures/technic_screwdriver.png b/textures/technic_screwdriver.png deleted file mode 100644 index bd2da22..0000000 Binary files a/textures/technic_screwdriver.png and /dev/null differ diff --git a/textures/technic_silicon_wafer.png b/textures/technic_silicon_wafer.png deleted file mode 100644 index 78aef20..0000000 Binary files a/textures/technic_silicon_wafer.png and /dev/null differ diff --git a/textures/technic_silver_chest_front.png b/textures/technic_silver_chest_front.png deleted file mode 100644 index fe5ce2c..0000000 Binary files a/textures/technic_silver_chest_front.png and /dev/null differ diff --git a/textures/technic_silver_chest_locked.png b/textures/technic_silver_chest_locked.png deleted file mode 100644 index 0f8b1f0..0000000 Binary files a/textures/technic_silver_chest_locked.png and /dev/null differ diff --git a/textures/technic_silver_chest_side.png b/textures/technic_silver_chest_side.png deleted file mode 100644 index 3a2ed4a..0000000 Binary files a/textures/technic_silver_chest_side.png and /dev/null differ diff --git a/textures/technic_silver_chest_top.png b/textures/technic_silver_chest_top.png deleted file mode 100644 index 353a11c..0000000 Binary files a/textures/technic_silver_chest_top.png and /dev/null differ diff --git a/textures/technic_silver_dust.png b/textures/technic_silver_dust.png deleted file mode 100644 index 9092c90..0000000 Binary files a/textures/technic_silver_dust.png and /dev/null differ diff --git a/textures/technic_solar_panel_bottom.png b/textures/technic_solar_panel_bottom.png deleted file mode 100644 index b0ad82f..0000000 Binary files a/textures/technic_solar_panel_bottom.png and /dev/null differ diff --git a/textures/technic_solar_panel_side.png b/textures/technic_solar_panel_side.png deleted file mode 100644 index b22447e..0000000 Binary files a/textures/technic_solar_panel_side.png and /dev/null differ diff --git a/textures/technic_solar_panel_top.png b/textures/technic_solar_panel_top.png deleted file mode 100644 index 492764b..0000000 Binary files a/textures/technic_solar_panel_top.png and /dev/null differ diff --git a/textures/technic_sonic_screwdriver.png b/textures/technic_sonic_screwdriver.png deleted file mode 100644 index fb61d96..0000000 Binary files a/textures/technic_sonic_screwdriver.png and /dev/null differ diff --git a/textures/technic_stainless_steel_dust.png b/textures/technic_stainless_steel_dust.png deleted file mode 100644 index 450e2bb..0000000 Binary files a/textures/technic_stainless_steel_dust.png and /dev/null differ diff --git a/textures/technic_stainless_steel_ingot.png b/textures/technic_stainless_steel_ingot.png deleted file mode 100644 index 46fa296..0000000 Binary files a/textures/technic_stainless_steel_ingot.png and /dev/null differ diff --git a/textures/technic_tin_dust.png b/textures/technic_tin_dust.png deleted file mode 100644 index 4e94e00..0000000 Binary files a/textures/technic_tin_dust.png and /dev/null differ diff --git a/textures/technic_tree_tap.png b/textures/technic_tree_tap.png deleted file mode 100644 index 542f30f..0000000 Binary files a/textures/technic_tree_tap.png and /dev/null differ diff --git a/textures/technic_uranium.png b/textures/technic_uranium.png deleted file mode 100644 index 54225f8..0000000 Binary files a/textures/technic_uranium.png and /dev/null differ diff --git a/textures/technic_water_can.png b/textures/technic_water_can.png deleted file mode 100644 index 18e0225..0000000 Binary files a/textures/technic_water_can.png and /dev/null differ diff --git a/textures/technic_water_mill_side.png b/textures/technic_water_mill_side.png deleted file mode 100644 index f4bdb16..0000000 Binary files a/textures/technic_water_mill_side.png and /dev/null differ diff --git a/textures/technic_water_mill_top.png b/textures/technic_water_mill_top.png deleted file mode 100644 index 601ff15..0000000 Binary files a/textures/technic_water_mill_top.png and /dev/null differ diff --git a/textures/technic_water_mill_top_active.png b/textures/technic_water_mill_top_active.png deleted file mode 100644 index f02bec6..0000000 Binary files a/textures/technic_water_mill_top_active.png and /dev/null differ diff --git a/textures/technic_workshop_bottom.png b/textures/technic_workshop_bottom.png deleted file mode 100644 index bd8fd55..0000000 Binary files a/textures/technic_workshop_bottom.png and /dev/null differ diff --git a/textures/technic_workshop_side.png b/textures/technic_workshop_side.png deleted file mode 100644 index 9e3e7a7..0000000 Binary files a/textures/technic_workshop_side.png and /dev/null differ diff --git a/textures/technic_workshop_top.png b/textures/technic_workshop_top.png deleted file mode 100644 index feae141..0000000 Binary files a/textures/technic_workshop_top.png and /dev/null differ diff --git a/textures/technic_zinc_dust.png b/textures/technic_zinc_dust.png deleted file mode 100644 index 0d2f75a..0000000 Binary files a/textures/technic_zinc_dust.png and /dev/null differ diff --git a/textures/technic_zinc_ingot.png b/textures/technic_zinc_ingot.png deleted file mode 100644 index 096ff9c..0000000 Binary files a/textures/technic_zinc_ingot.png and /dev/null differ diff --git a/textures/technic_zinc_lump.png b/textures/technic_zinc_lump.png deleted file mode 100644 index d28a6dc..0000000 Binary files a/textures/technic_zinc_lump.png and /dev/null differ diff --git a/tool_workshop.lua b/tool_workshop.lua deleted file mode 100644 index 86130ff..0000000 --- a/tool_workshop.lua +++ /dev/null @@ -1,93 +0,0 @@ -minetest.register_alias("tool_workshop", "technic:tool_workshop") -minetest.register_craft({ - output = 'technic:tool_workshop', - recipe = { - {'default:wood', 'default:wood', 'default:wood'}, - {'default:wood', 'technic:diamond', 'default:wood'}, - {'default:stone', 'moreores:copper_ingot', 'default:stone'}, - } -}) - -minetest.register_craftitem("technic:tool_workshop", { - description = "Tool Workshop", - stack_max = 99, -}) - -workshop_formspec = - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png]".. - "list[current_name;src;3,1;1,1;]".. - "label[0,0;Tool Workshop]".. - "label[1,3;Power level]".. - "list[current_player;main;0,5;8,4;]" - -minetest.register_node("technic:tool_workshop", { - description = "Tool Workshop", - tiles = {"technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png", - "technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"}, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - sounds = default.node_sound_wood_defaults(), - technic_power_machine=1, - internal_EU_buffer=0; - internal_EU_buffer_size=2000; - - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("infotext", "Tool Workshop") - meta:set_float("technic_power_machine", 1) - meta:set_float("internal_EU_buffer", 1) - meta:set_float("internal_EU_buffer_size", 2000) - meta:set_string("formspec", workshop_formspec) - local inv = meta:get_inventory() - inv:set_size("src", 1) - end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - if not inv:is_empty("src") then - return false - end - return true - end, -}) - -minetest.register_abm({ - nodenames = {"technic:tool_workshop"}, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - local meta = minetest.env:get_meta(pos) - local charge= meta:get_float("internal_EU_buffer") - local max_charge= meta:get_float("internal_EU_buffer_size") - local load_step=2000 - local load_cost=200 - local inv = meta:get_inventory() - if inv:is_empty("src")==false then - srcstack = inv:get_stack("src", 1) - src_item=srcstack:to_table() - local load1=tonumber((src_item["wear"])) - if charge>load_cost then - if load1>1 then - if load1-load_step<0 then load_step=load1 load1=1 - else load1=load1-load_step end - charge=charge-load_cost - src_item["wear"]=tostring(load1) - inv:set_stack("src", 1, src_item) - end - end - end - - meta:set_float("internal_EU_buffer",charge) - - - local load = math.floor((charge/max_charge)*100) - meta:set_string("formspec", - "invsize[8,9;]".. - "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. - (load)..":technic_power_meter_fg.png]".. - "list[current_name;src;3,1;1,1;]".. - "label[0,0;Tool Workshop]".. - "label[1,3;Power level]".. - "list[current_player;main;0,5;8,4;]") - end -}) \ No newline at end of file diff --git a/tree_tap.lua b/tree_tap.lua deleted file mode 100644 index 76f50ef..0000000 --- a/tree_tap.lua +++ /dev/null @@ -1,49 +0,0 @@ - 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:raw_latex")) 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 == "farming_plus:rubber_tree_full" then - user:get_inventory():add_item("main",ItemStack("technic:raw_latex")) - 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:raw_latex", { - description = "Raw Latex", - inventory_image = "technic_raw_latex.png", - }) - - minetest.register_craft({ - type = "cooking", - output = "technic:rubber", - recipe = "technic:raw_latex", - }) - - minetest.register_craftitem("technic:rubber", { - description = "Rubber Fiber", - inventory_image = "technic_rubber.png", - }) diff --git a/water_mill.lua b/water_mill.lua deleted file mode 100644 index 6e0120d..0000000 --- a/water_mill.lua +++ /dev/null @@ -1,128 +0,0 @@ -minetest.register_alias("water_mill", "technic:water_mill") - -minetest.register_craft({ - output = 'technic:water_mill', - recipe = { - {'default:stone', 'default:stone', 'default:stone'}, - {'default:wood', 'technic:diamond', 'default:wood'}, - {'default:stone', 'moreores:copper_ingot', 'default:stone'}, - } -}) - -minetest.register_craftitem("technic:water_mill", { - description = "Water Mill", - stack_max = 99, -}) - -water_mill_formspec = - "invsize[8,4;]".. - "image[1,1;1,2;technic_power_meter_bg.png]".. - "label[0,0;Water Mill]".. - "label[1,3;Power level]".. - "list[current_player;main;0,5;8,4;]" - - -minetest.register_node("technic:water_mill", { - description = "Water Mill", - tiles = {"technic_water_mill_top.png", "technic_machine_bottom.png", "technic_water_mill_side.png", - "technic_water_mill_side.png", "technic_water_mill_side.png", "technic_water_mill_side.png"}, - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - technic_power_machine=1, - internal_EU_buffer=0; - internal_EU_buffer_size=5000; - burn_time=0; - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("infotext", "Water Mill") - meta:set_float("technic_power_machine", 1) - meta:set_float("internal_EU_buffer", 0) - meta:set_float("internal_EU_buffer_size", 3000) - meta:set_string("formspec", water_mill_formspec) - end, - -}) - -minetest.register_node("technic:water_mill_active", { - description = "Water Mill", - tiles = {"technic_water_mill_top_active.png", "technic_machine_bottom.png", "technic_water_mill_side.png", - "technic_water_mill_side.png", "technic_water_mill_side.png", "technic_water_mill_side.png"}, - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, - legacy_facedir_simple = true, - sounds = default.node_sound_wood_defaults(), - drop="technic:water_mill", - technic_power_machine=1, - internal_EU_buffer=0; - internal_EU_buffer_size=0; -}) - -minetest.register_abm({ - nodenames = {"technic:water_mill","technic:water_mill_active"}, - interval = 1, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - - local meta = minetest.env:get_meta(pos) - local charge= meta:get_float("internal_EU_buffer") - local max_charge= meta:get_float("internal_EU_buffer_size") - local water_nodes = 0 - local lava_nodes = 0 - local production_level=0 - local load_step=0 - - pos.x=pos.x+1 - local check=check_node_around_mill (pos) - if check==1 then water_nodes=water_nodes+1 end - pos.x=pos.x-2 - check=check_node_around_mill (pos) - if check==1 then water_nodes=water_nodes+1 end - pos.x=pos.x+1 - pos.z=pos.z+1 - check=check_node_around_mill (pos) - if check==1 then water_nodes=water_nodes+1 end - pos.z=pos.z-2 - check=check_node_around_mill (pos) - if check==1 then water_nodes=water_nodes+1 end - pos.z=pos.z+1 - - if water_nodes==1 then production_level=25 load_step=30 end - if water_nodes==2 then production_level=50 load_step=60 end - if water_nodes==3 then production_level=75 load_step=90 end - if water_nodes==4 then production_level=100 load_step=120 end - - if production_level>0 then - if charge+load_step>max_charge then - load_step=max_charge-charge - end - if load_step>0 then - charge=charge+load_step - meta:set_float("internal_EU_buffer",charge) - end - end - - local load = math.floor((charge/max_charge)*100) - meta:set_string("formspec", - "invsize[8,4;]".. - "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. - (load)..":technic_power_meter_fg.png]".. - "label[0,0;Water Mill]".. - "label[1,3;Power level]".. - "label[4,0;Production at "..tostring(production_level).."%]" - ) - - if production_level>0 and minetest.env:get_node(pos).name=="technic:water_mill" then - hacky_swap_node (pos,"technic:water_mill_active") - return - end - if production_level==0 then hacky_swap_node (pos,"technic:water_mill") end -end -}) - -function check_node_around_mill (pos) -local node=minetest.env:get_node(pos) -if node.name=="default:water_flowing" then return 1 end -return 0 -end \ No newline at end of file diff --git a/wires.lua b/wires.lua deleted file mode 100644 index e09fc2a..0000000 --- a/wires.lua +++ /dev/null @@ -1,401 +0,0 @@ ---LV cable node boxes - - -minetest.register_alias("lv_cable", "technic:lv_cable") - -minetest.register_craft({ - output = 'technic:lv_cable 6', - recipe = { - {'moreores:copper_ingot', 'moreores:copper_ingot', 'moreores:copper_ingot'}, - } -}) - -minetest.register_craftitem("technic:lv_cable", { - description = "Low Voltage Copper Cable", - stack_max = 99, -}) - -minetest.register_node("technic:lv_cable", { - description = "Low Voltage Copper Cable", - tiles = {"technic_lv_cable.png"}, - inventory_image = "technic_lv_cable_wield.png", - wield_image = "technic_lv_cable_wield.png", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - sounds = default.node_sound_wood_defaults(), - drop = "technic:lv_cable", - 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("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) - check_connections (pos) - end, - - after_dig_node = function (pos, oldnode, oldmetadata, digger) - 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:lv_cable"..count, { - description = "Low Voltage Copper Cable", - tiles = {"technic_lv_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:lv_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) - check_connections_on_destroy (pos) - end, - -}) - -count=count+1 end end end end end end - -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("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:lv_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:lv_cable"..rule) - end - - pos1.x=pos1.x-2 - if minetest.env:get_meta(pos1):get_float("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:lv_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:lv_cable"..rule) - end - - pos1.x=pos1.x+1 - - pos1.y=pos1.y+1 - if minetest.env:get_meta(pos1):get_float("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:lv_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:lv_cable"..rule) - end - - if minetest.env:get_meta(pos1):get_float("technic_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:lv_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("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:lv_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:lv_cable"..rule) - end - pos1.y=pos1.y+1 - - pos1.z=pos1.z+1 - if minetest.env:get_meta(pos1):get_float("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:lv_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:lv_cable"..rule) - end - pos1.z=pos1.z-2 - if minetest.env:get_meta(pos1):get_float("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:lv_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:lv_cable"..rule) - end - pos1.z=pos1.z+1 -end - -function make_rule_number (x1,x2,y1,y2,z1,z2) -local temp= z2+z1*2+y2*4+y1*8+x2*16+x1*32 -return temp -end - -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("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:lv_cable") end - if rule>0 then hacky_swap_node(pos1,"technic:lv_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("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:lv_cable") end - if rule>0 then hacky_swap_node(pos1,"technic:lv_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("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:lv_cable") end - if rule>0 then hacky_swap_node(pos1,"technic:lv_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("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:lv_cable") end - if rule>0 then hacky_swap_node(pos1,"technic:lv_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("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:lv_cable") end - if rule>0 then hacky_swap_node(pos1,"technic:lv_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("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:lv_cable") end - if rule>0 then hacky_swap_node(pos1,"technic:lv_cable"..rule) end - meta=minetest.env:get_meta(pos1) - meta:set_float("z1",z1) - end - pos1.y=pos1.y+1 - -end - diff --git a/wires_mv.lua b/wires_mv.lua deleted file mode 100644 index 7924956..0000000 --- a/wires_mv.lua +++ /dev/null @@ -1,400 +0,0 @@ ---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 -