summaryrefslogtreecommitdiff
path: root/digilines/digilines_inventory
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2016-04-01 21:00:20 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2016-04-01 21:10:04 -0400
commit888b0ebfec8c2eff9015163549a7e47443cb8665 (patch)
tree915080159bfaa6ba6e226087c7ce0e8d5464b518 /digilines/digilines_inventory
parentda66780a569712c23ae4f2996cfb4608a9f9d69d (diff)
downloaddreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.tar
dreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.tar.gz
dreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.tar.bz2
dreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.tar.xz
dreambuilder_modpack-888b0ebfec8c2eff9015163549a7e47443cb8665.zip
"explode" all modpacks into their individual components
(you can't have a modpack buried inside a modpack)
Diffstat (limited to 'digilines/digilines_inventory')
-rw-r--r--digilines/digilines_inventory/README62
-rw-r--r--digilines/digilines_inventory/depends.txt1
-rw-r--r--digilines/digilines_inventory/init.lua143
3 files changed, 0 insertions, 206 deletions
diff --git a/digilines/digilines_inventory/README b/digilines/digilines_inventory/README
deleted file mode 100644
index a88115f..0000000
--- a/digilines/digilines_inventory/README
+++ /dev/null
@@ -1,62 +0,0 @@
-Basic idea: place this chest down at the end of a pipeline. Feed stuff into it. Attach a luacontroller to it with a digiline in between. Program the luacontroller to turn on a wire to stop the pipeline when the chest is full. Don't put more than one kind of item down the pipeline into the chest, unless you want weird tricksy behavior.
-
-...[F]===[C]--{L}
- |__________|
- [B]
-F: filter
-B: blinky plant
-C: digiline chest
-L: luacontroller
-==: pipe
-__: mesecons
---: digiline
-
-Make sure you use mem in the luacontroller to keep the mesecon wire on indefinitely after the chest signals full. When it signals "take" someone took an item out and you can start the pipeline up again.
-This may be a bad idea if they only take half a stack or something. Oh well.
-
-When you put something in, you get a "put" to indicate it's OK (sort of (still buggy)) and can fit inside the chest. When you get a "lost", that means it won't fit inside the chest, and will bounce, possibly popping out. When you get a "overflow" that means you tried to add something to a chest that just filled up, and the stack will bounce. When you get a "full" that means the chest just filled up.
-
-"Filled up" for all intents and purposes, means taking the type of whatever just went into the chest, and seeing if at least 1 of that type can be added to the chest. If it cannot, then it's filled up. That means a chest full of stacks of 30 copper and one spot of 98 gold, and you add one gold to that, it will say it's full. Add 30 copper to it, and it won't.
-
-Generally you'll be working with full stacks in pipeworks. Even the non-mese filters will accumulate items in a chest, and not spread them out into multiple stacks. And generally your destination chests will each have one of any kind of item. So all you have to worry about is when you've got 99 everywhere, and one space possibly free. A mese filter can fail on that in fact, for instance if you have room for 45 gold, and it tries to push a stack of 50 gold. All 50 will bounce! The code for chests isn't smart enough to add the 45 and bounce the leftover 5. So only use mese filters when you're sure a full stack has accumulated for the filter to push, and there are no partial stacks at the destination.
-
-For some reason when an "overflow" happens, when it checks if the stack can fit inside the chest, the answer is yes it can fit! Then it doesn't. Sort of buggy.
-
-itemstack - the qualified name, a space, then the amount. If the space and amount are ommitted, that represents just 1.
-
-examples: "default:chest 33" "default:coal" "default:axe_diamond"
-
-bounce
- - when an item cannot enter the destination container it will travel back up the tube it came from, going along alternate routes if they exist, but otherwise popping out of the tube.
-
-popping out
- - the little thingy travelling through the tube disappears, and an entity of the item appears, as if it was just dropped. This entity can expire, losing your items permanently!
-
-
-The messages are:
-
-
-put <itemstack>
- - this means that the inventory claimed it could fit that stack of items inside it. Inventories lie. But with the above caveats this is quite usable.
-lost <itemstack>
- - the stack couldn't fit in the chest and bounces.
-full <itemstack> <count>
- - the chest has been filled. The itemstack is what filled it. count is what's leftover.
- until chests can suck up part of a stack and not bounce the whole stack, that count will
- always be 0
-overflow <itemstack> <count>
- - generally this is the same as lost, except that the "put" event happened, meaning that the
- itemstack was allowed in the chest.
- - this will happen with two stacks in rapid succession, the first filling the chest, and the
- second bouncing. the <count> in this case will be the amount of the second.
- - overflow can't happen with two different kinds of items, you'll get a put, maybe full, then lost for the second kind
-
-Tricky situation:
-if you have a blank spot and put say 82 torches down your pipeline, followed by 99 coal, the 82 torches will go in the chest, and the chest will see that 1 more torch can fit since that would only go to 83. Since 1 more torch can fit, no "full" message will fire off. Then when the coal hits the chest, the "fail" message will fire and the coal will bounce out. The chest couldn't predict that coal would be coming next, so it couldn't know that the chest is full, for coal, while not full for torches.
-
-TODO:
- - make chest.lua a mixin that gets both default and locked chests
- - digiline aware furnaces
- - digiline aware technic machines, grinders, alloy furnaces, etc
- - the pipes going into the chests don't snap to the pipe holes in the digiline chests. They still act fine as pipeworks destinations though.
- - digiline chests seem to be immune to filters. But it's late and I'm shipping this. Someone else can figure out why the chests aren't acting like pipeworks chests, despite cloning the pipeworks chest's object. Oh who am I kidding. I'll do it myself I guess, once I've lost hope of aid again.
diff --git a/digilines/digilines_inventory/depends.txt b/digilines/digilines_inventory/depends.txt
deleted file mode 100644
index da1d119..0000000
--- a/digilines/digilines_inventory/depends.txt
+++ /dev/null
@@ -1 +0,0 @@
-digilines
diff --git a/digilines/digilines_inventory/init.lua b/digilines/digilines_inventory/init.lua
deleted file mode 100644
index 89aaabc..0000000
--- a/digilines/digilines_inventory/init.lua
+++ /dev/null
@@ -1,143 +0,0 @@
-local function sendMessage(pos, msg, channel)
- if channel == nil then
- channel = minetest.get_meta(pos):get_string("channel")
- end
- digiline:receptor_send(pos,digiline.rules.default,channel,msg)
-end
-
-local function maybeString(stack)
- if type(stack)=='string' then return stack
- elseif type(stack)=='table' then return dump(stack)
- else return stack:to_string()
- end
-end
-
-local function can_insert(pos, stack)
- local can = minetest.get_meta(pos):get_inventory():room_for_item("main", stack)
- if can then
- sendMessage(pos,"put "..maybeString(stack))
- else
- -- overflow and lost means that items are gonna be out as entities :/
- sendMessage(pos,"lost "..maybeString(stack))
- end
- return can
-end
-
-local tubeconn = minetest.get_modpath("pipeworks") and "^pipeworks_tube_connection_wooden.png" or ""
-local tubescan = minetest.get_modpath("pipeworks") and function(pos) pipeworks.scan_for_tube_objects(pos) end or nil
-
-minetest.register_node("digilines_inventory:chest", {
- description = "Digiline Chest",
- tiles = {
- "default_chest_top.png"..tubeconn,
- "default_chest_top.png"..tubeconn,
- "default_chest_side.png"..tubeconn,
- "default_chest_side.png"..tubeconn,
- "default_chest_side.png"..tubeconn,
- "default_chest_front.png",
- },
- paramtype2 = "facedir",
- legacy_facedir_simple = true,
- groups = {choppy=2, oddly_breakable_by_hand=2, tubedevice=1, tubedevice_receiver=1},
- sounds = default.node_sound_wood_defaults(),
- on_construct = function(pos)
- local meta = minetest.get_meta(pos)
- meta:set_string("infotext", "Digiline Chest")
- meta:set_string("formspec", "size[8,10]"..
- ((default and default.gui_bg) or "")..
- ((default and default.gui_bg_img) or "")..
- ((default and default.gui_slots) or "")..
- "label[0,0;Digiline Chest]"..
- "list[current_name;main;0,1;8,4;]"..
- "field[2,5.5;5,1;channel;Channel;${channel}]"..
- ((default and default.get_hotbar_bg) and default.get_hotbar_bg(0,6) or "")..
- "list[current_player;main;0,6;8,4;]")
- local inv = meta:get_inventory()
- inv:set_size("main", 8*4)
- end,
- after_place_node = tubescan,
- after_dig_node = tubescan,
- can_dig = function(pos, player)
- return minetest.get_meta(pos):get_inventory():is_empty("main")
- end,
- on_receive_fields = function(pos, formname, fields, sender)
- if fields.channel ~= nil then
- minetest.get_meta(pos):set_string("channel",fields.channel)
- end
- end,
- digiline = {
- receptor = {},
- effector = {
- action = function(pos,node,channel,msg) end
- }
- },
- tube = {
- connect_sides = {left=1, right=1, back=1, front=1, bottom=1, top=1},
- connects = function(i,param2)
- return not pipeworks.connects.facingFront(i,param2)
- end,
- input_inventory = "main",
- can_insert = function(pos, node, stack, direction)
- return can_insert(pos, stack)
- end,
- insert_object = function(pos, node, stack, direction)
- local inv = minetest.get_meta(pos):get_inventory()
- local leftover = inv:add_item("main", stack)
- local count = leftover:get_count()
- if count == 0 then
- local derpstack = stack:get_name()..' 1'
- if not inv:room_for_item("main", derpstack) then
- -- when you can't put a single more of whatever you just put,
- -- you'll get a put for it, then a full
- sendMessage(pos,"full "..maybeString(stack)..' '..tostring(count))
- end
- else
- -- this happens when the chest has received two stacks in a row and
- -- filled up exactly with the first one.
- -- You get a put for the first stack, a put for the second
- -- and then a overflow with the first in stack and the second in leftover
- -- and NO full?
- sendMessage(pos,"overflow "..maybeString(stack)..' '..tostring(count))
- end
- return leftover
- end,
- },
- allow_metadata_inventory_put = function(pos, listname, index, stack, player)
- if not can_insert(pos, stack) then
- sendMessage(pos,"uoverflow "..maybeString(stack))
- end
- return stack:get_count()
- end,
- on_metadata_inventory_move = function(pos, fromlistname, fromindex, tolistname, toindex, count, player)
- minetest.log("action", player:get_player_name().." moves stuff in chest at "..minetest.pos_to_string(pos))
- end,
- on_metadata_inventory_put = function(pos, listname, index, stack, player)
- local channel = minetest.get_meta(pos):get_string("channel")
- local send = function(msg)
- sendMessage(pos,msg,channel)
- end
- -- direction is only for furnaces
- -- as the item has already been put, can_insert should return false if the chest is now full.
- local derpstack = stack:get_name()..' 1'
- if can_insert(pos,derpstack) then
- send("uput "..maybeString(stack))
- else
- send("ufull "..maybeString(stack))
- end
- minetest.log("action", player:get_player_name().." puts stuff into chest at "..minetest.pos_to_string(pos))
- end,
- on_metadata_inventory_take = function(pos, listname, index, stack, player)
- local inv = minetest.get_meta(pos):get_inventory()
- if inv:is_empty(listname) then
- sendMessage(pos, "empty", channel)
- end
- sendMessage(pos,"utake "..maybeString(stack))
- minetest.log("action", player:get_player_name().." takes stuff from chest at "..minetest.pos_to_string(pos))
- end
-})
-
-minetest.register_craft({
- type = "shapeless",
- output = "digilines_inventory:chest",
- recipe = {"default:chest", "digilines:wire_std_00000000"}
-})