summaryrefslogtreecommitdiff
path: root/technic/machines/other
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/machines/other
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/machines/other')
-rw-r--r--technic/machines/other/injector.lua61
1 files changed, 46 insertions, 15 deletions
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,