summaryrefslogtreecommitdiff
path: root/technic
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-04-12 03:11:48 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-04-12 03:11:48 -0400
commit29881ec85e87e5bc186aded048af596e36e84597 (patch)
tree1372bbc080f3161014abe40db29e15fa59f43093 /technic
parent7af18188490f514e7768ca0aae7454134f85140f (diff)
downloaddreambuilder_modpack-29881ec85e87e5bc186aded048af596e36e84597.tar
dreambuilder_modpack-29881ec85e87e5bc186aded048af596e36e84597.tar.gz
dreambuilder_modpack-29881ec85e87e5bc186aded048af596e36e84597.tar.bz2
dreambuilder_modpack-29881ec85e87e5bc186aded048af596e36e84597.tar.xz
dreambuilder_modpack-29881ec85e87e5bc186aded048af596e36e84597.zip
updated technic and pipeworks
Diffstat (limited to 'technic')
-rw-r--r--technic/machines/HV/forcefield.lua20
-rw-r--r--technic/machines/HV/quarry.lua17
-rw-r--r--technic/machines/LV/water_mill.lua13
-rw-r--r--technic/machines/MV/tool_workshop.lua15
-rw-r--r--technic/machines/other/injector.lua61
-rw-r--r--technic/machines/power_monitor.lua6
-rw-r--r--technic/machines/register/battery_box.lua93
-rw-r--r--technic/machines/register/generator.lua158
-rw-r--r--technic/machines/register/machine_base.lua99
-rw-r--r--technic/machines/supply_converter.lua13
-rw-r--r--technic/machines/switching_station.lua12
-rw-r--r--technic/textures/technic_cable_connection_overlay.pngbin0 -> 293 bytes
-rw-r--r--technic/textures/technic_supply_converter_bottom.pngbin738 -> 696 bytes
-rw-r--r--technic/textures/technic_supply_converter_tb.pngbin0 -> 656 bytes
-rw-r--r--technic/textures/technic_supply_converter_top.pngbin738 -> 707 bytes
15 files changed, 412 insertions, 95 deletions
diff --git a/technic/machines/HV/forcefield.lua b/technic/machines/HV/forcefield.lua
index 1d46bcf..3bb8d03 100644
--- a/technic/machines/HV/forcefield.lua
+++ b/technic/machines/HV/forcefield.lua
@@ -12,6 +12,8 @@ local forcefield_power_drain = 10
local S = technic.getter
+local cable_entry = "^technic_cable_connection_overlay.png"
+
minetest.register_craft({
output = "technic:forcefield_emitter_off",
recipe = {
@@ -258,7 +260,14 @@ end
minetest.register_node("technic:forcefield_emitter_off", {
description = S("%s Forcefield Emitter"):format("HV"),
- tiles = {"technic_forcefield_emitter_off.png"},
+ tiles = {
+ "technic_forcefield_emitter_off.png",
+ "technic_machine_bottom.png"..cable_entry,
+ "technic_forcefield_emitter_off.png",
+ "technic_forcefield_emitter_off.png",
+ "technic_forcefield_emitter_off.png",
+ "technic_forcefield_emitter_off.png"
+ },
groups = {cracky = 1, technic_machine = 1, technic_hv = 1},
on_receive_fields = forcefield_receive_fields,
on_construct = function(pos)
@@ -282,7 +291,14 @@ minetest.register_node("technic:forcefield_emitter_off", {
minetest.register_node("technic:forcefield_emitter_on", {
description = S("%s Forcefield Emitter"):format("HV"),
- tiles = {"technic_forcefield_emitter_on.png"},
+ tiles = {
+ "technic_forcefield_emitter_on.png",
+ "technic_machine_bottom.png"..cable_entry,
+ "technic_forcefield_emitter_on.png",
+ "technic_forcefield_emitter_on.png",
+ "technic_forcefield_emitter_on.png",
+ "technic_forcefield_emitter_on.png"
+ },
groups = {cracky = 1, technic_machine = 1, technic_hv = 1,
not_in_creative_inventory=1},
drop = "technic:forcefield_emitter_off",
diff --git a/technic/machines/HV/quarry.lua b/technic/machines/HV/quarry.lua
index 8d87b65..c1ee1bb 100644
--- a/technic/machines/HV/quarry.lua
+++ b/technic/machines/HV/quarry.lua
@@ -1,6 +1,9 @@
local S = technic.getter
+local tube_entry = "^pipeworks_tube_connection_metallic.png"
+local cable_entry = "^technic_cable_connection_overlay.png"
+
minetest.register_craft({
recipe = {
{"technic:carbon_plate", "pipeworks:filter", "technic:composite_plate"},
@@ -207,12 +210,14 @@ end
minetest.register_node("technic:quarry", {
description = S("%s Quarry"):format("HV"),
- tiles = {"technic_carbon_steel_block.png", "technic_carbon_steel_block.png",
- "technic_carbon_steel_block.png", "technic_carbon_steel_block.png",
- "technic_carbon_steel_block.png^default_tool_mesepick.png", "technic_carbon_steel_block.png"},
- inventory_image = minetest.inventorycube("technic_carbon_steel_block.png",
- "technic_carbon_steel_block.png^default_tool_mesepick.png",
- "technic_carbon_steel_block.png"),
+ tiles = {
+ "technic_carbon_steel_block.png"..tube_entry,
+ "technic_carbon_steel_block.png"..cable_entry,
+ "technic_carbon_steel_block.png"..cable_entry,
+ "technic_carbon_steel_block.png"..cable_entry,
+ "technic_carbon_steel_block.png^default_tool_mesepick.png",
+ "technic_carbon_steel_block.png"..cable_entry
+ },
paramtype2 = "facedir",
groups = {cracky=2, tubedevice=1, technic_machine=1, technic_hv=1},
connect_sides = {"bottom", "front", "left", "right"},
diff --git a/technic/machines/LV/water_mill.lua b/technic/machines/LV/water_mill.lua
index d291332..5d871f0 100644
--- a/technic/machines/LV/water_mill.lua
+++ b/technic/machines/LV/water_mill.lua
@@ -4,6 +4,8 @@
local S = technic.getter
+local cable_entry = "^technic_cable_connection_overlay.png"
+
minetest.register_alias("water_mill", "technic:water_mill")
minetest.register_craft({
@@ -68,9 +70,14 @@ end
minetest.register_node("technic:water_mill", {
description = S("Hydro %s Generator"):format("LV"),
- 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"},
+ tiles = {
+ "technic_water_mill_top.png",
+ "technic_machine_bottom.png"..cable_entry,
+ "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,
technic_machine=1, technic_lv=1},
diff --git a/technic/machines/MV/tool_workshop.lua b/technic/machines/MV/tool_workshop.lua
index 9219717..6679d1d 100644
--- a/technic/machines/MV/tool_workshop.lua
+++ b/technic/machines/MV/tool_workshop.lua
@@ -5,6 +5,8 @@ minetest.register_alias("tool_workshop", "technic:tool_workshop")
local S = technic.getter
+local tube_entry = "^pipeworks_tube_connection_wooden.png"
+
minetest.register_craft({
output = 'technic:tool_workshop',
recipe = {
@@ -83,8 +85,14 @@ end
minetest.register_node("technic:tool_workshop", {
description = S("%s Tool Workshop"):format("MV"),
paramtype2 = "facedir",
- 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"},
+ tiles = {
+ "technic_workshop_top.png"..tube_entry,
+ "technic_machine_bottom.png"..tube_entry,
+ "technic_workshop_side.png"..tube_entry,
+ "technic_workshop_side.png"..tube_entry,
+ "technic_workshop_side.png"..tube_entry,
+ "technic_workshop_side.png"
+ },
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
technic_machine=1, technic_mv=1, tubedevice=1, tubedevice_receiver=1},
connect_sides = {"bottom", "back", "left", "right"},
@@ -103,8 +111,7 @@ minetest.register_node("technic:tool_workshop", {
allow_metadata_inventory_take = technic.machine_inventory_take,
tube = {
can_insert = function (pos, node, stack, direction)
- local onestack = stack:peek_item(1)
- return minetest.get_meta(pos):get_inventory():room_for_item("src", onestack)
+ return minetest.get_meta(pos):get_inventory():room_for_item("src", stack)
end,
insert_object = function (pos, node, stack, direction)
return minetest.get_meta(pos):get_inventory():add_item("src", stack)
diff --git a/technic/machines/other/injector.lua b/technic/machines/other/injector.lua
index f803a25..b34dd79 100644
--- a/technic/machines/other/injector.lua
+++ b/technic/machines/other/injector.lua
@@ -1,6 +1,10 @@
local S = technic.getter
+local fs_helpers = pipeworks.fs_helpers
+
+local tube_entry = "^pipeworks_tube_connection_metallic.png"
+
local function inject_items (pos)
local meta=minetest.get_meta(pos)
local inv = meta:get_inventory()
@@ -51,38 +55,59 @@ minetest.register_craft({
local function set_injector_formspec(meta)
local is_stack = meta:get_string("mode") == "whole stacks"
meta:set_string("formspec",
- "invsize[8,9;]"..
- "item_image[0,0;1,1;technic:injector]"..
- "label[1,0;"..S("Self-Contained Injector").."]"..
- (is_stack and
- "button[0,1;2,1;mode_item;"..S("Stackwise").."]" or
- "button[0,1;2,1;mode_stack;"..S("Itemwise").."]")..
- "list[current_name;main;0,2;8,2;]"..
- "list[current_player;main;0,5;8,4;]"..
- "listring[]")
+ "invsize[8,9;]"..
+ "item_image[0,0;1,1;technic:injector]"..
+ "label[1,0;"..S("Self-Contained Injector").."]"..
+ (is_stack and
+ "button[0,1;2,1;mode_item;"..S("Stackwise").."]" or
+ "button[0,1;2,1;mode_stack;"..S("Itemwise").."]")..
+ "list[current_name;main;0,2;8,2;]"..
+ "list[current_player;main;0,5;8,4;]"..
+ "listring[]"..
+ fs_helpers.cycling_button(
+ meta,
+ pipeworks.button_base,
+ "splitstacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ )..pipeworks.button_label
+ )
end
minetest.register_node("technic:injector", {
description = S("Self-Contained Injector"),
- tiles = {"technic_injector_top.png", "technic_injector_bottom.png", "technic_injector_side.png",
- "technic_injector_side.png", "technic_injector_side.png", "technic_injector_side.png"},
+ tiles = {
+ "technic_injector_top.png"..tube_entry,
+ "technic_injector_bottom.png",
+ "technic_injector_side.png"..tube_entry,
+ "technic_injector_side.png"..tube_entry,
+ "technic_injector_side.png"..tube_entry,
+ "technic_injector_side.png"
+ },
+ paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, tubedevice=1, tubedevice_receiver=1},
tube = {
can_insert = function(pos, node, stack, direction)
- local onestack = stack:peek_item(1)
- return minetest.get_meta(pos):get_inventory():room_for_item("main", onestack)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ if meta:get_int("splitstacks") == 1 then
+ stack = stack:peek_item(1)
+ end
+ return meta:get_inventory():room_for_item("main", stack)
end,
insert_object = function(pos, node, stack, direction)
return minetest.get_meta(pos):get_inventory():add_item("main", stack)
end,
- connect_sides = {left=1, right=1, front=1, back=1, top=1, bottom=1},
+ connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
},
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Self-Contained Injector"))
local inv = meta:get_inventory()
- inv:set_size("main", 8*4)
+ inv:set_size("main", 8*2)
meta:set_string("mode","single items")
set_injector_formspec(meta)
end,
@@ -95,6 +120,12 @@ minetest.register_node("technic:injector", {
local meta = minetest.get_meta(pos)
if fields.mode_item then meta:set_string("mode", "single items") end
if fields.mode_stack then meta:set_string("mode", "whole stacks") end
+
+ if fields["fs_helpers_cycling:0:splitstacks"]
+ or fields["fs_helpers_cycling:1:splitstacks"] then
+ if not pipeworks.may_configure(pos, sender) then return end
+ fs_helpers.on_receive_fields(pos, fields)
+ end
set_injector_formspec(meta)
end,
allow_metadata_inventory_put = technic.machine_inventory_put,
diff --git a/technic/machines/power_monitor.lua b/technic/machines/power_monitor.lua
index 8c5bed6..4d722a2 100644
--- a/technic/machines/power_monitor.lua
+++ b/technic/machines/power_monitor.lua
@@ -4,6 +4,8 @@
local S = technic.getter
+local cable_entry = "^technic_cable_connection_overlay.png"
+
minetest.register_craft({
output = "technic:power_monitor",
recipe = {
@@ -17,10 +19,10 @@ minetest.register_node("technic:power_monitor",{
description = S("Power Monitor"),
tiles = {
"technic_power_monitor_sides.png",
- "technic_power_monitor_bottom_back.png",
+ "technic_power_monitor_sides.png"..cable_entry,
"technic_power_monitor_sides.png",
"technic_power_monitor_sides.png",
- "technic_power_monitor_bottom_back.png",
+ "technic_power_monitor_sides.png"..cable_entry,
"technic_power_monitor_front.png"
},
paramtype2 = "facedir",
diff --git a/technic/machines/register/battery_box.lua b/technic/machines/register/battery_box.lua
index 2a45b13..7238d6d 100644
--- a/technic/machines/register/battery_box.lua
+++ b/technic/machines/register/battery_box.lua
@@ -2,6 +2,9 @@
local digilines_path = minetest.get_modpath("digilines")
local S = technic.getter
+local tube_entry = "^pipeworks_tube_connection_metallic.png"
+
+local fs_helpers = pipeworks.fs_helpers
technic.register_power_tool("technic:battery", 10000)
technic.register_power_tool("technic:red_energy_crystal", 50000)
@@ -50,16 +53,49 @@ local tube = {
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
- local onestack = stack:peek_item(1)
if direction.y > 0 then
- return inv:room_for_item("src", onestack)
+ if meta:get_int("split_src_stacks") == 1 then
+ stack = stack:peek_item(1)
+ end
+ return inv:room_for_item("src", stack)
else
- return inv:room_for_item("dst", onestack)
+ if meta:get_int("split_dst_stacks") == 1 then
+ stack = stack:peek_item(1)
+ end
+ return inv:room_for_item("dst", stack)
end
end,
connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
}
+local function add_on_off_buttons(meta, ltier, charge_percent)
+ local formspec = ""
+ if ltier == "mv" or ltier == "hv" then
+ formspec = "image[1,1;1,2;technic_power_meter_bg.png"
+ .."^[lowpart:"..charge_percent
+ ..":technic_power_meter_fg.png]"..
+ fs_helpers.cycling_button(
+ meta,
+ "image_button[3,2.0;1,0.6",
+ "split_src_stacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ ).."label[3.9,2.01;Allow splitting incoming 'charge' stacks from tubes]"..
+ fs_helpers.cycling_button(
+ meta,
+ "image_button[3,2.5;1,0.6",
+ "split_dst_stacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ ).."label[3.9,2.51;Allow splitting incoming 'discharge' stacks]"
+ end
+ return formspec
+end
+
function technic.register_battery_box(data)
local tier = data.tier
local ltier = string.lower(tier)
@@ -79,6 +115,7 @@ function technic.register_battery_box(data)
"listring[current_player;main]"..
"listring[context;src]"..
"listring[current_player;main]"
+
if digilines_path then
formspec = formspec.."button[0.6,3.7;2,1;edit_channel;edit Channel]"
end
@@ -150,12 +187,7 @@ function technic.register_battery_box(data)
end
local charge_percent = math.floor(current_charge / max_charge * 100)
- meta:set_string("formspec",
- formspec..
- "image[1,1;1,2;technic_power_meter_bg.png"
- .."^[lowpart:"..charge_percent
- ..":technic_power_meter_fg.png]")
-
+ meta:set_string("formspec", formspec..add_on_off_buttons(meta, ltier, charge_percent))
local infotext = S("@1 Battery Box: @2/@3", tier,
technic.pretty_num(current_charge), technic.pretty_num(max_charge))
if eu_input == 0 then
@@ -176,11 +208,16 @@ function technic.register_battery_box(data)
groups.tubedevice_receiver = 1
end
+ local tentry = tube_entry
+ if ltier == "lv" then
+ tentry = ""
+ end
+
minetest.register_node("technic:"..ltier.."_battery_box"..i, {
description = S("%s Battery Box"):format(tier),
tiles = {
- "technic_"..ltier.."_battery_box_top.png",
- "technic_"..ltier.."_battery_box_bottom.png",
+ "technic_"..ltier.."_battery_box_top.png"..tentry,
+ "technic_"..ltier.."_battery_box_bottom.png"..tentry,
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
@@ -193,11 +230,17 @@ function technic.register_battery_box(data)
drop = "technic:"..ltier.."_battery_box0",
on_construct = function(pos)
local meta = minetest.get_meta(pos)
+ local EU_upgrade, tube_upgrade = 0, 0
+ if data.upgrade then
+ EU_upgrade, tube_upgrade = technic.handle_machine_upgrades(meta)
+ end
+ local max_charge = data.max_charge * (1 + EU_upgrade / 10)
+ local charge = meta:get_int("internal_EU_charge")
+ local cpercent = math.floor(charge / max_charge * 100)
local inv = meta:get_inventory()
local node = minetest.get_node(pos)
-
meta:set_string("infotext", S("%s Battery Box"):format(tier))
- meta:set_string("formspec", formspec)
+ meta:set_string("formspec", formspec..add_on_off_buttons(meta, ltier, cpercent))
meta:set_string("channel", ltier.."_battery_box"..minetest.pos_to_string(pos))
meta:set_int(tier.."_EU_demand", 0)
meta:set_int(tier.."_EU_supply", 0)
@@ -216,13 +259,28 @@ function technic.register_battery_box(data)
after_place_node = data.tube and pipeworks.after_place,
after_dig_node = technic.machine_after_dig_node,
on_receive_fields = function(pos, formname, fields, sender)
- if not fields.edit_channel then
- return
- end
local meta = minetest.get_meta(pos)
- minetest.show_formspec(sender:get_player_name(),
+ local nodename = minetest.get_node(pos).name
+ if fields.edit_channel then
+ minetest.show_formspec(sender:get_player_name(),
"technic:battery_box_edit_channel"..minetest.pos_to_string(pos),
"field[channel;Digiline Channel;"..meta:get_string("channel").."]")
+ elseif fields["fs_helpers_cycling:0:split_src_stacks"]
+ or fields["fs_helpers_cycling:0:split_dst_stacks"]
+ or fields["fs_helpers_cycling:1:split_src_stacks"]
+ or fields["fs_helpers_cycling:1:split_dst_stacks"] then
+ local meta = minetest.get_meta(pos)
+ if not pipeworks.may_configure(pos, sender) then return end
+ fs_helpers.on_receive_fields(pos, fields)
+ local EU_upgrade, tube_upgrade = 0, 0
+ if data.upgrade then
+ EU_upgrade, tube_upgrade = technic.handle_machine_upgrades(meta)
+ end
+ local max_charge = data.max_charge * (1 + EU_upgrade / 10)
+ local charge = meta:get_int("internal_EU_charge")
+ local cpercent = math.floor(charge / max_charge * 100)
+ meta:set_string("formspec", formspec..add_on_off_buttons(meta, ltier, cpercent))
+ end
end,
digiline = {
receptor = {action = function() end},
@@ -278,7 +336,6 @@ minetest.register_on_player_receive_fields(
end
)
-
function technic.charge_tools(meta, batt_charge, charge_step)
local inv = meta:get_inventory()
if inv:is_empty("src") then
diff --git a/technic/machines/register/generator.lua b/technic/machines/register/generator.lua
index f3ada1f..9062d09 100644
--- a/technic/machines/register/generator.lua
+++ b/technic/machines/register/generator.lua
@@ -1,5 +1,8 @@
local S = technic.getter
+local fs_helpers = pipeworks.fs_helpers
+local tube_entry = "^pipeworks_tube_connection_metallic.png"
+
local tube = {
insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
@@ -9,13 +12,16 @@ local tube = {
can_insert = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
- local onestack = stack:peek_item(1)
- return inv:room_for_item("src", onestack)
+ if meta:get_int("splitstacks") == 1 then
+ stack = stack:peek_item(1)
+ end
+ return inv:room_for_item("src", stack)
end,
connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
}
-function technic.register_generator(data)
+function technic.register_generator(data)
+
local tier = data.tier
local ltier = string.lower(tier)
@@ -77,21 +83,41 @@ function technic.register_generator(data)
if burn_totaltime == 0 then burn_totaltime = 1 end
local percent = math.floor((burn_time / burn_totaltime) * 100)
meta:set_string("infotext", desc.." ("..percent.."%)")
- meta:set_string("formspec",
- "size[8, 9]"..
- "label[0, 0;"..minetest.formspec_escape(desc).."]"..
- "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;]"..
- "listring[]")
+
+ local form_buttons = ""
+ if ltier ~= "lv" then
+ form_buttons = fs_helpers.cycling_button(
+ meta,
+ pipeworks.button_base,
+ "splitstacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ )..pipeworks.button_label
+ end
+ meta:set_string("formspec",
+ "size[8, 9]"..
+ "label[0, 0;"..minetest.formspec_escape(desc).."]"..
+ "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;]"..
+ "listring[]"..
+ form_buttons
+ )
end
-
+
minetest.register_node("technic:"..ltier.."_generator", {
description = desc,
- tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png",
- "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png",
- "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front.png"},
+ tiles = {
+ "technic_"..ltier.."_generator_top.png"..tube_entry,
+ "technic_machine_bottom.png"..tube_entry,
+ "technic_"..ltier.."_generator_side.png"..tube_entry,
+ "technic_"..ltier.."_generator_side.png"..tube_entry,
+ "technic_"..ltier.."_generator_side.png"..tube_entry,
+ "technic_"..ltier.."_generator_front.png"
+ },
paramtype2 = "facedir",
groups = groups,
connect_sides = {"bottom", "back", "left", "right"},
@@ -100,11 +126,24 @@ function technic.register_generator(data)
tube = data.tube and tube or nil,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
+ local node = minetest.get_node(pos)
meta:set_string("infotext", desc)
meta:set_int(data.tier.."_EU_supply", 0)
meta:set_int("burn_time", 0)
meta:set_int("tube_time", 0)
- meta:set_string("formspec", generator_formspec)
+ local form_buttons = ""
+ if not string.find(node.name, ":lv_") then
+ form_buttons = fs_helpers.cycling_button(
+ meta,
+ pipeworks.button_base,
+ "splitstacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ )..pipeworks.button_label
+ end
+ meta:set_string("formspec", generator_formspec..form_buttons)
local inv = meta:get_inventory()
inv:set_size("src", 1)
end,
@@ -114,14 +153,39 @@ function technic.register_generator(data)
allow_metadata_inventory_move = technic.machine_inventory_move,
technic_run = run,
after_place_node = data.tube and pipeworks.after_place,
- after_dig_node = technic.machine_after_dig_node
+ after_dig_node = technic.machine_after_dig_node,
+ on_receive_fields = function(pos, formname, fields, sender)
+ if not pipeworks.may_configure(pos, sender) then return end
+ fs_helpers.on_receive_fields(pos, fields)
+ local meta = minetest.get_meta(pos)
+ local node = minetest.get_node(pos)
+ local form = generator_formspec
+ local form_buttons = ""
+ if not string.find(node.name, ":lv_") then
+ form_buttons = fs_helpers.cycling_button(
+ meta,
+ pipeworks.button_base,
+ "splitstacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ )..pipeworks.button_label
+ end
+ meta:set_string("formspec", generator_formspec..form_buttons)
+ end,
})
minetest.register_node("technic:"..ltier.."_generator_active", {
description = desc,
- tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png",
- "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png",
- "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front_active.png"},
+ tiles = {
+ "technic_"..ltier.."_generator_top.png"..tube_entry,
+ "technic_machine_bottom.png"..tube_entry,
+ "technic_"..ltier.."_generator_side.png"..tube_entry,
+ "technic_"..ltier.."_generator_side.png"..tube_entry,
+ "technic_"..ltier.."_generator_side.png"..tube_entry,
+ "technic_"..ltier.."_generator_front_active.png"
+ },
paramtype2 = "facedir",
groups = active_groups,
connect_sides = {"bottom"},
@@ -130,6 +194,7 @@ function technic.register_generator(data)
tube = data.tube and tube or nil,
drop = "technic:"..ltier.."_generator",
can_dig = technic.machine_can_dig,
+ after_dig_node = technic.machine_after_dig_node,
allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take,
allow_metadata_inventory_move = technic.machine_inventory_move,
@@ -140,7 +205,8 @@ function technic.register_generator(data)
end,
on_timer = function(pos, node)
local meta = minetest.get_meta(pos)
-
+ local node = minetest.get_node(pos)
+
-- Connected back?
if meta:get_int(tier.."_EU_timeout") > 0 then return false end
@@ -158,6 +224,19 @@ function technic.register_generator(data)
burn_time = burn_time - 1
meta:set_int("burn_time", burn_time)
local percent = math.floor(burn_time / burn_totaltime * 100)
+
+ local form_buttons = ""
+ if not string.find(node.name, ":lv_") then
+ form_buttons = fs_helpers.cycling_button(
+ meta,
+ pipeworks.button_base,
+ "splitstacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ )..pipeworks.button_label
+ end
meta:set_string("formspec",
"size[8, 9]"..
"label[0, 0;"..minetest.formspec_escape(desc).."]"..
@@ -165,9 +244,44 @@ function technic.register_generator(data)
"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;]"..
- "listring[]")
+ "listring[]"..
+ form_buttons
+ )
return true
end,
+ on_receive_fields = function(pos, formname, fields, sender)
+ if not pipeworks.may_configure(pos, sender) then return end
+ fs_helpers.on_receive_fields(pos, fields)
+ local meta = minetest.get_meta(pos)
+ local node = minetest.get_node(pos)
+ local form_buttons = ""
+ if not string.find(node.name, ":lv_") then
+ form_buttons = fs_helpers.cycling_button(
+ meta,
+ pipeworks.button_base,
+ "splitstacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ )..pipeworks.button_label
+ end
+
+ local burn_totaltime = meta:get_int("burn_totaltime") or 0
+ local burn_time = meta:get_int("burn_time")
+ local percent = math.floor(burn_time / burn_totaltime * 100)
+
+ meta:set_string("formspec",
+ "size[8, 9]"..
+ "label[0, 0;"..minetest.formspec_escape(desc).."]"..
+ "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;]"..
+ "listring[]"..
+ form_buttons
+ )
+ end,
})
technic.register_machine(tier, "technic:"..ltier.."_generator", technic.producer)
diff --git a/technic/machines/register/machine_base.lua b/technic/machines/register/machine_base.lua
index d479773..0c6a6b3 100644
--- a/technic/machines/register/machine_base.lua
+++ b/technic/machines/register/machine_base.lua
@@ -1,6 +1,9 @@
local S = technic.getter
+local fs_helpers = pipeworks.fs_helpers
+local tube_entry = "^pipeworks_tube_connection_metallic.png"
+
local tube = {
insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
@@ -10,8 +13,10 @@ local tube = {
can_insert = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
- local onestack = stack:peek_item(1)
- return inv:room_for_item("src", onestack)
+ if meta:get_int("splitstacks") == 1 then
+ stack = stack:peek_item(1)
+ end
+ return inv:room_for_item("src", stack)
end,
connect_sides = {left = 1, right = 1, back = 1, top = 1, bottom = 1},
}
@@ -134,15 +139,21 @@ function technic.register_base_machine(data)
inv:set_list("dst", inv:get_list("dst_tmp"))
end
end
-
+
+ local tentry = tube_entry
+ if ltier == "lv" then
+ tentry = ""
+ end
minetest.register_node("technic:"..ltier.."_"..machine_name, {
description = machine_desc:format(tier),
- tiles = {"technic_"..ltier.."_"..machine_name.."_top.png",
- "technic_"..ltier.."_"..machine_name.."_bottom.png",
- "technic_"..ltier.."_"..machine_name.."_side.png",
- "technic_"..ltier.."_"..machine_name.."_side.png",
- "technic_"..ltier.."_"..machine_name.."_side.png",
- "technic_"..ltier.."_"..machine_name.."_front.png"},
+ tiles = {
+ "technic_"..ltier.."_"..machine_name.."_top.png"..tentry,
+ "technic_"..ltier.."_"..machine_name.."_bottom.png"..tentry,
+ "technic_"..ltier.."_"..machine_name.."_side.png"..tentry,
+ "technic_"..ltier.."_"..machine_name.."_side.png"..tentry,
+ "technic_"..ltier.."_"..machine_name.."_side.png"..tentry,
+ "technic_"..ltier.."_"..machine_name.."_front.png"
+ },
paramtype2 = "facedir",
groups = groups,
tube = data.tube and tube or nil,
@@ -152,9 +163,23 @@ function technic.register_base_machine(data)
on_construct = function(pos)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
+
+ local form_buttons = ""
+ if not string.find(node.name, ":lv_") then
+ form_buttons = fs_helpers.cycling_button(
+ meta,
+ pipeworks.button_base,
+ "splitstacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ )..pipeworks.button_label
+ end
+
meta:set_string("infotext", machine_desc:format(tier))
meta:set_int("tube_time", 0)
- meta:set_string("formspec", formspec)
+ meta:set_string("formspec", formspec..form_buttons)
local inv = meta:get_inventory()
inv:set_size("src", input_size)
inv:set_size("dst", 4)
@@ -167,17 +192,38 @@ function technic.register_base_machine(data)
allow_metadata_inventory_move = technic.machine_inventory_move,
technic_run = run,
after_place_node = data.tube and pipeworks.after_place,
- after_dig_node = technic.machine_after_dig_node
+ after_dig_node = technic.machine_after_dig_node,
+ on_receive_fields = function(pos, formname, fields, sender)
+ local node = minetest.get_node(pos)
+ if not pipeworks.may_configure(pos, sender) then return end
+ fs_helpers.on_receive_fields(pos, fields)
+ local meta = minetest.get_meta(pos)
+ local form_buttons = ""
+ if not string.find(node.name, ":lv_") then
+ form_buttons = fs_helpers.cycling_button(
+ meta,
+ pipeworks.button_base,
+ "splitstacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ )..pipeworks.button_label
+ end
+ meta:set_string("formspec", formspec..form_buttons)
+ end,
})
minetest.register_node("technic:"..ltier.."_"..machine_name.."_active",{
description = machine_desc:format(tier),
- tiles = {"technic_"..ltier.."_"..machine_name.."_top.png",
- "technic_"..ltier.."_"..machine_name.."_bottom.png",
- "technic_"..ltier.."_"..machine_name.."_side.png",
- "technic_"..ltier.."_"..machine_name.."_side.png",
- "technic_"..ltier.."_"..machine_name.."_side.png",
- "technic_"..ltier.."_"..machine_name.."_front_active.png"},
+ tiles = {
+ "technic_"..ltier.."_"..machine_name.."_top.png"..tentry,
+ "technic_"..ltier.."_"..machine_name.."_bottom.png"..tentry,
+ "technic_"..ltier.."_"..machine_name.."_side.png"..tentry,
+ "technic_"..ltier.."_"..machine_name.."_side.png"..tentry,
+ "technic_"..ltier.."_"..machine_name.."_side.png"..tentry,
+ "technic_"..ltier.."_"..machine_name.."_front_active.png"
+ },
paramtype2 = "facedir",
drop = "technic:"..ltier.."_"..machine_name,
groups = active_groups,
@@ -191,6 +237,25 @@ function technic.register_base_machine(data)
allow_metadata_inventory_move = technic.machine_inventory_move,
technic_run = run,
technic_disabled_machine_name = "technic:"..ltier.."_"..machine_name,
+ on_receive_fields = function(pos, formname, fields, sender)
+ local node = minetest.get_node(pos)
+ if not pipeworks.may_configure(pos, sender) then return end
+ fs_helpers.on_receive_fields(pos, fields)
+ local meta = minetest.get_meta(pos)
+ local form_buttons = ""
+ if not string.find(node.name, ":lv_") then
+ form_buttons = fs_helpers.cycling_button(
+ meta,
+ pipeworks.button_base,
+ "splitstacks",
+ {
+ pipeworks.button_off,
+ pipeworks.button_on
+ }
+ )..pipeworks.button_label
+ end
+ meta:set_string("formspec", formspec..form_buttons)
+ end,
})
technic.register_machine(tier, "technic:"..ltier.."_"..machine_name, technic.receiver)
diff --git a/technic/machines/supply_converter.lua b/technic/machines/supply_converter.lua
index 8ae4dd4..aa41791 100644
--- a/technic/machines/supply_converter.lua
+++ b/technic/machines/supply_converter.lua
@@ -11,6 +11,8 @@ local digilines_path = minetest.get_modpath("digilines")
local S = technic.getter
+local cable_entry = "^technic_cable_connection_overlay.png"
+
local function set_supply_converter_formspec(meta)
local formspec = "size[5,2.25]"..
"field[0.3,0.5;2,1;power;"..S("Input Power")..";"..meta:get_int("power").."]"
@@ -158,9 +160,14 @@ end
minetest.register_node("technic:supply_converter", {
description = S("Supply Converter"),
- tiles = {"technic_supply_converter_top.png", "technic_supply_converter_bottom.png",
- "technic_supply_converter_side.png", "technic_supply_converter_side.png",
- "technic_supply_converter_side.png", "technic_supply_converter_side.png"},
+ tiles = {
+ "technic_supply_converter_tb.png"..cable_entry,
+ "technic_supply_converter_tb.png"..cable_entry,
+ "technic_supply_converter_side.png",
+ "technic_supply_converter_side.png",
+ "technic_supply_converter_side.png",
+ "technic_supply_converter_side.png"
+ },
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
technic_machine=1, technic_all_tiers=1},
connect_sides = {"top", "bottom"},
diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua
index be5f6c0..9c6f32c 100644
--- a/technic/machines/switching_station.lua
+++ b/technic/machines/switching_station.lua
@@ -39,6 +39,8 @@ local digilines_path = minetest.get_modpath("digilines")
local S = technic.getter
+local cable_entry = "^technic_cable_connection_overlay.png"
+
minetest.register_craft({
output = "technic:switching_station",
recipe = {
@@ -57,9 +59,13 @@ end
minetest.register_node("technic:switching_station",{
description = S("Switching Station"),
- tiles = {"technic_water_mill_top_active.png", "technic_water_mill_top_active.png",
- "technic_water_mill_top_active.png", "technic_water_mill_top_active.png",
- "technic_water_mill_top_active.png", "technic_water_mill_top_active.png"},
+ tiles = {
+ "technic_water_mill_top_active.png",
+ "technic_water_mill_top_active.png"..cable_entry,
+ "technic_water_mill_top_active.png",
+ "technic_water_mill_top_active.png",
+ "technic_water_mill_top_active.png",
+ "technic_water_mill_top_active.png"},
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_all_tiers=1},
connect_sides = {"bottom"},
sounds = default.node_sound_wood_defaults(),
diff --git a/technic/textures/technic_cable_connection_overlay.png b/technic/textures/technic_cable_connection_overlay.png
new file mode 100644
index 0000000..122cad2
--- /dev/null
+++ b/technic/textures/technic_cable_connection_overlay.png
Binary files differ
diff --git a/technic/textures/technic_supply_converter_bottom.png b/technic/textures/technic_supply_converter_bottom.png
index a610660..ca49733 100644
--- a/technic/textures/technic_supply_converter_bottom.png
+++ b/technic/textures/technic_supply_converter_bottom.png
Binary files differ
diff --git a/technic/textures/technic_supply_converter_tb.png b/technic/textures/technic_supply_converter_tb.png
new file mode 100644
index 0000000..053b3d8
--- /dev/null
+++ b/technic/textures/technic_supply_converter_tb.png
Binary files differ
diff --git a/technic/textures/technic_supply_converter_top.png b/technic/textures/technic_supply_converter_top.png
index a610660..d3c20a2 100644
--- a/technic/textures/technic_supply_converter_top.png
+++ b/technic/textures/technic_supply_converter_top.png
Binary files differ