Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4c51d72
First drop of changes from the development branch.
beepbopbeepboop Jan 31, 2024
fac587b
Pull in a few more bits to fix importer and exporter.
beepbopbeepboop Feb 1, 2024
5bd5503
Allow importing cells, if empty.
beepbopbeepboop Feb 1, 2024
a9b1add
Improve imported/exporter UI.
beepbopbeepboop Feb 2, 2024
a3f9a40
When interfaces lose network connectivity, we have to reject input.
beepbopbeepboop Feb 3, 2024
0a24904
Add quantum bridges (links and rings).
beepbopbeepboop Feb 3, 2024
a05c4fc
Fix crafting terminal.
beepbopbeepboop Feb 3, 2024
60550a8
Fix typo.
beepbopbeepboop Feb 4, 2024
2cf2224
Add an ability to search the descriptions. #25
beepbopbeepboop Feb 5, 2024
b0466d4
Fix reset on the remote.
beepbopbeepboop Feb 5, 2024
ed256bb
Fix controller recipe.
beepbopbeepboop Feb 7, 2024
9a2e379
Improve technic integration.
beepbopbeepboop Feb 9, 2024
c0d5476
Also set the speed for technic:coal_alloy_furnace.
beepbopbeepboop Feb 9, 2024
80b3a72
Default speed to 1.
beepbopbeepboop Feb 9, 2024
f8172f5
Improve query clearing on the remote.
beepbopbeepboop Feb 10, 2024
0cb853f
Separate autocrafting input and output by a little to ensure they don…
beepbopbeepboop Feb 10, 2024
02c228b
FIx remote GUI clearing.
beepbopbeepboop Feb 10, 2024
33d4bac
Add description searching to cterminal.
beepbopbeepboop Feb 11, 2024
6be657d
Reduce the odds of creating a singularity to something kinda rare.
beepbopbeepboop Feb 11, 2024
8a3b409
Fix remote GUI clearing.
beepbopbeepboop Feb 11, 2024
689812e
Singularities that are not entangled are not useful to have.
beepbopbeepboop Feb 11, 2024
4de9017
Don't ignore remove_item.
beepbopbeepboop Feb 11, 2024
008e904
Also return the slot. This allows higher performance api.
beepbopbeepboop Feb 13, 2024
9541750
Harden the crafting terminal and the remote.
beepbopbeepboop Feb 13, 2024
e1bc6d9
Harden autocrafting.
beepbopbeepboop Feb 13, 2024
c0b82b4
Don't network search on non-me stuff.
beepbopbeepboop Feb 14, 2024
81e9478
Add annihilation plane.
beepbopbeepboop Feb 18, 2024
b59cab7
Remove debugging output.
beepbopbeepboop Feb 18, 2024
7c84c01
Ensure we don't loose any items when back pressured.
beepbopbeepboop Feb 19, 2024
5b70b5d
Make the remote of the quantum link a hair more expensive.
beepbopbeepboop Feb 25, 2024
83639c6
Fixup autocrafting a little.
beepbopbeepboop Feb 27, 2024
d16e11d
Add glass builtin.
beepbopbeepboop Mar 4, 2024
f275b61
Refine autocrafting to be more robust.
beepbopbeepboop Mar 12, 2024
e2cdad3
Fix recipe for annihilation plane.
beepbopbeepboop Mar 20, 2024
89a1101
Allow technic uranium to be exported sanely to centrifuge.
beepbopbeepboop Mar 21, 2024
cee1c1d
Prefer me crafting.
beepbopbeepboop Mar 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ MicroExpansion - ME [microexpansion]

* **Licence:** Code: MIT (see LICENSE), Media: CC-BY-SA 3.0

Quantum Textures, from https://github.com/AppliedEnergistics/Applied-Energistics-2.git
(c) 2020, [Ridanisaurus Rid](https://github.com/Ridanisaurus/), (c) 2013 - 2020 AlgorithmX2 et al
CC-BY-NC-SA 3.0 (https://creativecommons.org/licenses/by-nc-sa/3.0/)

When you really get into a survival world, you typically end up with a lot of items, like a ton of items.
Sometimes literally.
But with that huge amount of resources, comes something annoying and typically unwanted: chests.
Expand Down
14 changes: 7 additions & 7 deletions api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function microexpansion.register_node(itemstring, def)
end
end

-- get a node, if nessecary load it
-- get a node, if necessary load it
function microexpansion.get_node(pos)
local node = minetest.get_node_or_nil(pos)
if node then return node end
Expand All @@ -143,7 +143,7 @@ function microexpansion.update_node(pos,event)
end

-- [function] Move items from inv to inv
function microexpansion.move_inv(inv1, inv2, max, filter)
function microexpansion.move_inv(net, inv1, inv2, max, filter)
if max <= 0 then return end
local finv, tinv = inv1.inv, inv2.inv
local fname, tname = inv1.name, inv2.name
Expand All @@ -161,18 +161,18 @@ function microexpansion.move_inv(inv1, inv2, max, filter)
end
if tinv and tinv:room_for_item(tname, v) and (not filter or not filter(v)) then
if huge then
microexpansion.insert_item(v, tinv, tname)
microexpansion.insert_item(v, net, tinv, tname)
finv:remove_item(fname, v)
else
--TODO: continue inserting from the same stack if it is bigger than max
if v:get_count() > v:get_stack_max() then
v = v:peek_item(v:get_stack_max())
end
local leftover = tinv:add_item(tname, v)
local leftovers = tinv:add_item(tname, v)
finv:remove_item(fname, v)
if leftover and not(leftover:is_empty()) then
microexpansion.log("leftover items when transferring inventory","warning")
finv:add_item(fname, leftover)
if leftovers and not leftovers:is_empty() then
microexpansion.log("leftover items when transferring inventory", "warning")
finv:add_item(fname, leftovers)
end
end
inserted = inserted + v:get_count()
Expand Down
2 changes: 1 addition & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = microexpansion
description = A storage managing solution to get an overview over all your items.
optional_depends = pipeworks,basic_materials,mcl_furnaces,mcl_core
optional_depends = pipeworks,basic_materials,mcl_furnaces,mcl_core,drawers,technic,technic_plus
supported_games = mineclone2,mineclonia,minetest_game
1 change: 1 addition & 0 deletions modules.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
network = true
quantum = true
power = false
storage = true
ores = true
Expand Down
109 changes: 109 additions & 0 deletions modules/item_transfer/annihilation.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
-- microexpansion/modules/item_transfer/annihilation.lua

local me = microexpansion
local item_transfer = me.item_transfer
local access_level = microexpansion.constants.security.access_levels

local importer_timer = function(pos, elapsed)
local net, cp = me.get_connected_network(pos)
if not net then
return false
end
local node = minetest.get_node(pos)
local target = vector.add(pos, microexpansion.facedir_to_right_dir(node.param2))
--TODO: allow setting list with upgrade
local n = minetest.get_node(target)
if n and n.name ~= "air" and n.name ~= "default:water_flowing" and n.name ~= "default:lava_flowing"
and n.name ~= "default:river_water_flowing" then
minetest.remove_node(target)
local own_inv = minetest.get_meta(pos):get_inventory()
local upgrades = me.count_upgrades(own_inv)
local count = math.min(net:get_inventory_space(),math.pow(2, upgrades.bulk or 0))
local list = "main"
local inv = own_inv
if count <= 0 then
return true
end
if n.name ~= "default:stone" then
count = 1
end
local stack = ItemStack(n.name)
stack:set_count(count)
inv:add_item(list, stack)
local import_filter = function(stack)
local stack_name = stack:get_name()
if upgrades.filter then
return not own_inv:contains_item("filter",stack:peek_item())
end
return false
end
me.move_inv(net, {inv=inv, name=list}, {inv=net:get_inventory(), name="main", huge=true}, count, import_filter)
net:set_storage_space(true)
end
return true
end

-- [MicroExpansion Annihilation] Register node
item_transfer.register_io_device("annihilation", {
description = "ME Annihilation Plane",
usedfor = "Annihilates items and imports them into ME Networks",
tiles = {
"importer",
"importer",
"interface",
"cable",
"microexpansion_importer.png^[transform4",
"importer",
},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.25, -0.25, 0.25, 0.25, 0.25},
{0.25, -0.375, -0.375, 0.5, 0.375, 0.375},
},
},
connect_sides = { "left" },
recipe = {
{ 1, {
{"", "", microexpansion.iron_ingot_ingredient },
{"", "microexpansion:cable", "group:hoe" },
{"", "basic_materials:ic", microexpansion.iron_ingot_ingredient },
},
},
{ 1, {
{"", "", microexpansion.iron_ingot_ingredient },
{"", "microexpansion:cable", "group:hoe" },
{"", "microexpansion:logic_chip", microexpansion.iron_ingot_ingredient },
},
}
},
is_ground_content = false,
groups = { crumbly = 1 },
on_timer = importer_timer,
on_construct = function(pos)
local own_inv = minetest.get_meta(pos):get_inventory()
own_inv:set_size("main", 1)
item_transfer.setup_io_device("ME Annihilation Plane",pos)
me.send_event(pos,"connect")
item_transfer.update_timer_based(pos)
end,
after_destruct = function(pos)
minetest.get_node_timer(pos):stop()
me.send_event(pos,"disconnect")
end,
on_metadata_inventory_put = function(pos, listname, _, stack, player)
if listname == "upgrades" then
item_transfer.setup_io_device("ME Annihilation Plane",pos)
end
end,
on_metadata_inventory_take = function(pos, listname, _, stack, player)
if listname == "upgrades" then
item_transfer.setup_io_device("ME Annihilation Plane",pos)
end
end
})

if me.uinv_category_enabled then
unified_inventory.add_category_item("storage", "microexpansion:annihilation")
end
23 changes: 15 additions & 8 deletions modules/item_transfer/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,29 @@ function item_transfer.setup_io_device(title, pos, metadata, inventory)
formspec = formspec .. [[
label[0.5,0.75;filter]
list[context;filter;0.5,1;5,3]
listring[current_name;upgrades]
listring[current_player;main]
listring[current_name;filter]
listring[current_player;main]
]]
else
inv:set_size("filter",0)
end
--TODO: target inventory dropdown
inv:set_size("upgrades", 4)
meta:set_string("formspec",
formspec ..
[[
label[8.5,2.5;upgrades]
list[context;upgrades;8,2.75;2,2]
list[current_player;main;0.5,5.5;8,1;]
list[current_player;main;0.5,7;8,3;8]
formspec = formspec .. [[
label[8.5,2.5;upgrades]
list[context;upgrades;8,2.75;2,2]
list[current_player;main;0.5,5.5;8,1;]
list[current_player;main;0.5,7;8,3;8]
]]
if not upgrades.filter then
formspec = formspec .. [[
listring[current_name;upgrades]
listring[current_player;main]
]])
]]
end
meta:set_string("formspec", formspec)
end

local access_level = microexpansion.constants.security.access_levels
Expand Down
10 changes: 8 additions & 2 deletions modules/item_transfer/exporter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ local function exporter_timer(pos, elapsed)
--TODO: move more with upgrades
local own_inv = minetest.get_meta(pos):get_inventory()
local upgrades = me.count_upgrades(own_inv)
local max_count = math.pow(2, upgrades.bulk or 0)
local export_filter = upgrades.filter and function(stack)
local s = stack:peek_item(max_count)
-- Ensure bulk exports are full sized, this allows uranium to work
-- in centrifuges.
if s:get_count() < max_count then
return not false
end
return not own_inv:contains_item("filter",stack:peek_item())
end
local max_count = math.pow(2, upgrades.bulk or 0)
microexpansion.move_inv({inv=net:get_inventory(),name="main",huge=true}, {inv=inv,name=list}, max_count, export_filter)
me.move_inv(net, {inv=net:get_inventory(), name="main", huge=true}, {inv=inv, name=list}, max_count, export_filter)
--TODO: perhaps call allow_insert and on_insert callbacks
end
return true
Expand Down
6 changes: 4 additions & 2 deletions modules/item_transfer/importer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ function importer_timer(pos, elapsed)
end
local import_filter = function(stack)
local stack_name = stack:get_name()
if minetest.get_item_group(stack_name, "microexpansion_cell") > 0 then
if minetest.get_item_group(stack_name, "microexpansion_cell") > 0 and
stack:get_meta():get_string("items") ~= "" and
stack:get_meta():get_string("items") ~= "return {}" then
return true
end
if upgrades.filter then
return not own_inv:contains_item("filter",stack:peek_item())
end
return false
end
microexpansion.move_inv({inv=inv,name=list}, {inv=net:get_inventory(),name="main",huge=true}, count, import_filter)
me.move_inv(net, {inv=inv, name=list}, {inv=net:get_inventory(), name="main", huge=true}, count, import_filter)
net:set_storage_space(true)
end
return true
Expand Down
1 change: 1 addition & 0 deletions modules/item_transfer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ dofile(module_path.."/upgrades.lua")
-- Load ports
dofile(module_path.."/importer.lua")
dofile(module_path.."/exporter.lua")
dofile(module_path.."/annihilation.lua")
--dofile(module_path.."/interface.lua")
3 changes: 2 additions & 1 deletion modules/item_transfer/upgrades.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

local me = microexpansion

-- TODO: regulation upgrade (1: disable in formspec, mesecon control; 2: requests from the me network and perhaps digiline)
-- TODO: regulation upgrade (1: disable in formspec, mesecon control; 2: requests
-- from the me network and perhaps digiline)

-- [register item] Upgrade Base
me.register_item("upgrade_base", {
Expand Down
Loading