ta4 injector added, ta4 pusher and distributor changed, maintenance and minor bugfixes
@ -47,7 +47,7 @@ local function formspec(self, pos, nvm)
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;dst]" ..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 4)
|
||||
default.get_hotbar_bg(0, 5.4)
|
||||
end
|
||||
|
||||
local function count_index(invlist)
|
||||
|
@ -16,6 +16,9 @@
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local mConf = dofile(MP.."/basis/conf_inv.lua")
|
||||
|
||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
@ -145,17 +148,95 @@ minetest.register_node("techage:chest_ta3", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
local function formspec4()
|
||||
techage.register_node({"techage:chest_ta2", "techage:chest_ta3"}, {
|
||||
on_pull_item = function(pos, in_dir, num, item_name)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.get_items(pos, inv, "main", num)
|
||||
end,
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end,
|
||||
on_unpull_item = function(pos, in_dir, stack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end,
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
if topic == "state" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.get_inv_state(inv, "main")
|
||||
else
|
||||
return "unsupported"
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
local function formspec4(pos)
|
||||
return "size[10,9]"..
|
||||
"tabheader[0,0;tab;"..S("Inventory,Configuration")..";1;;true]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[context;main;0,0;10,5;]"..
|
||||
mConf.preassigned_stacks(pos, 10, 5)..
|
||||
"list[current_player;main;1,5.3;8,4;]"..
|
||||
"listring[context;main]"..
|
||||
"listring[current_player;main]"
|
||||
end
|
||||
|
||||
local function formspec4_cfg(pos)
|
||||
return "size[10,9]"..
|
||||
"tabheader[0,0;tab;"..S("Inventory,Configuration")..";2;;true]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[context;conf;0,0;10,5;]"..
|
||||
"list[current_player;main;1,5.3;8,4;]"..
|
||||
"listring[context;conf]"..
|
||||
"listring[current_player;main]"
|
||||
end
|
||||
|
||||
local function ta4_allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
if listname == "main" then
|
||||
return stack:get_count()
|
||||
else
|
||||
return mConf.allow_conf_inv_put(pos, listname, index, stack, player)
|
||||
end
|
||||
end
|
||||
|
||||
local function ta4_allow_metadata_inventory_take(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
if listname == "main" then
|
||||
return stack:get_count()
|
||||
else
|
||||
return mConf.allow_conf_inv_take(pos, listname, index, stack, player)
|
||||
end
|
||||
end
|
||||
|
||||
local function ta4_allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
if from_list == "main" then
|
||||
return count
|
||||
else
|
||||
return mConf.allow_conf_inv_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("techage:chest_ta4", {
|
||||
description = S("TA4 Protected Chest"),
|
||||
tiles = {
|
||||
@ -172,6 +253,7 @@ minetest.register_node("techage:chest_ta4", {
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('main', 50)
|
||||
inv:set_size('conf', 50)
|
||||
end,
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
@ -179,18 +261,36 @@ minetest.register_node("techage:chest_ta4", {
|
||||
local number = techage.add_node(pos, "techage:chest_ta4")
|
||||
meta:set_string("node_number", number)
|
||||
meta:set_string("owner", placer:get_player_name())
|
||||
meta:set_string("formspec", formspec4())
|
||||
meta:set_string("formspec", formspec4(pos))
|
||||
meta:set_string("infotext", S("TA4 Protected Chest").." "..number)
|
||||
end,
|
||||
|
||||
on_receive_fields = function(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
if fields.tab == "1" then
|
||||
mem.filter = nil
|
||||
meta:set_string("formspec", formspec4(pos))
|
||||
elseif fields.tab == "2" then
|
||||
meta:set_string("formspec", formspec4_cfg(pos))
|
||||
elseif fields.quit == "true" then
|
||||
mem.filter = nil
|
||||
end
|
||||
end,
|
||||
|
||||
techage_set_numbers = function(pos, numbers, player_name)
|
||||
return techage.logic.set_numbers(pos, numbers, player_name, S("TA4 Protected Chest"))
|
||||
end,
|
||||
|
||||
can_dig = can_dig,
|
||||
after_dig_node = after_dig_node,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
allow_metadata_inventory_put = ta4_allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = ta4_allow_metadata_inventory_take,
|
||||
allow_metadata_inventory_move = ta4_allow_metadata_inventory_move,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy=2, cracky=2, crumbly=2},
|
||||
@ -198,28 +298,68 @@ minetest.register_node("techage:chest_ta4", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
techage.register_node({"techage:chest_ta2", "techage:chest_ta3", "techage:chest_ta4"}, {
|
||||
|
||||
techage.register_node({"techage:chest_ta4"}, {
|
||||
on_pull_item = function(pos, in_dir, num, item_name)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if item_name and inv:get_size("main") == 50 then -- TA4 chest?
|
||||
local taken = inv:remove_item("main", {name = item_name, count = num})
|
||||
if taken:get_count() > 0 then
|
||||
return taken
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.filter = mem.filter or mConf.item_filter(pos, 50)
|
||||
mem.chest_configured = mem.chest_configured or #mem.filter["unconfigured"] < 50
|
||||
|
||||
if inv:is_empty("main") then
|
||||
return nil
|
||||
end
|
||||
|
||||
if item_name then
|
||||
if mem.filter[item_name] then -- configured item
|
||||
local taken = inv:remove_item("main", {name = item_name, count = num})
|
||||
if taken:get_count() > 0 then
|
||||
return taken
|
||||
end
|
||||
elseif not mem.chest_configured then
|
||||
local taken = inv:remove_item("main", {name = item_name, count = num})
|
||||
if taken:get_count() > 0 then
|
||||
return taken
|
||||
end
|
||||
end
|
||||
else -- no item given
|
||||
if mem.chest_configured then
|
||||
return mConf.take_item(pos, inv, "main", num, mem.filter["unconfigured"] or {})
|
||||
else
|
||||
return techage.get_items(pos, inv, "main", num)
|
||||
end
|
||||
else
|
||||
return techage.get_items(pos, inv, "main", num)
|
||||
end
|
||||
end,
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
on_push_item = function(pos, in_dir, item, idx)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "main", stack)
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.filter = mem.filter or mConf.item_filter(pos, 50)
|
||||
mem.chest_configured = mem.chest_configured or #mem.filter["unconfigured"] < 50
|
||||
|
||||
if mem.chest_configured then
|
||||
local name = item:get_name()
|
||||
local stacks = mem.filter[name] or mem.filter["unconfigured"]
|
||||
return mConf.put_items(pos, inv, "main", item, stacks, idx)
|
||||
else
|
||||
return techage.put_items(inv, "main", item, idx)
|
||||
end
|
||||
end,
|
||||
on_unpull_item = function(pos, in_dir, stack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "main", stack)
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.filter = mem.filter or mConf.item_filter(pos, 50)
|
||||
mem.chest_configured = mem.chest_configured or #mem.filter["unconfigured"] < 50
|
||||
|
||||
if mem.chest_configured then
|
||||
local name = item:get_name()
|
||||
local stacks = mem.filter[name] or mem.filter["unconfigured"]
|
||||
return mConf.put_items(pos, inv, "main", item, stacks)
|
||||
else
|
||||
return techage.put_items(inv, "main", item)
|
||||
end
|
||||
end,
|
||||
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
|
@ -219,7 +219,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
|
||||
selection_box = tNode.selection_box,
|
||||
|
||||
can_dig = tNode.can_dig,
|
||||
on_rotate = screwdriver.disallow,
|
||||
on_rotate = tNode.on_rotate or screwdriver.disallow,
|
||||
on_timer = node_timer,
|
||||
on_receive_fields = tNode.on_receive_fields,
|
||||
on_rightclick = tNode.on_rightclick,
|
||||
@ -251,7 +251,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
|
||||
node_box = tNode.node_box,
|
||||
selection_box = tNode.selection_box,
|
||||
|
||||
on_rotate = screwdriver.disallow,
|
||||
on_rotate = tNode.on_rotate or screwdriver.disallow,
|
||||
on_timer = node_timer,
|
||||
on_receive_fields = tNode.on_receive_fields,
|
||||
on_rightclick = tNode.on_rightclick,
|
||||
|
@ -41,8 +41,6 @@ local function filter_settings(pos)
|
||||
local filter = minetest.deserialize(meta:get_string("filter")) or {false,false,false,false}
|
||||
local ItemFilter = {} -- {<item:name> = {dir,...}]
|
||||
local OpenPorts = {} -- {dir, ...}
|
||||
local FilterItems = {} -- {<item:name>, <item:name>, ...} for sequencing only
|
||||
local FilterItemIdx = {} -- {<item:name> = <slot-idx>, <item:name> = <slot-idx>, ...} for sequencing only
|
||||
-- collect all filter settings
|
||||
for idx,slot in ipairs(SlotColors) do
|
||||
if filter[idx] == true then
|
||||
@ -58,8 +56,6 @@ local function filter_settings(pos)
|
||||
ItemFilter[name] = {}
|
||||
end
|
||||
table.insert(ItemFilter[name], out_dir)
|
||||
table.insert(FilterItems, name)
|
||||
FilterItemIdx[name] = idx2
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -69,8 +65,6 @@ local function filter_settings(pos)
|
||||
FilterCache[minetest.hash_node_position(pos)] = {
|
||||
ItemFilter = ItemFilter,
|
||||
OpenPorts = OpenPorts,
|
||||
FilterItems = FilterItems,
|
||||
FilterItemIdx = FilterItemIdx,
|
||||
}
|
||||
end
|
||||
|
||||
@ -82,40 +76,13 @@ local function get_filter_settings(pos)
|
||||
-- ["default:cobble"] = {4},
|
||||
-- }
|
||||
-- local OpenPorts = {3}
|
||||
-- local FilterItems = {"default:dirt",...}
|
||||
-- return ItemFilter, OpenPorts, FilterItems
|
||||
-- return ItemFilter, OpenPorts
|
||||
|
||||
local hash = minetest.hash_node_position(pos)
|
||||
if FilterCache[hash] == nil then
|
||||
filter_settings(pos)
|
||||
end
|
||||
return FilterCache[hash].ItemFilter, FilterCache[hash].OpenPorts, FilterCache[hash].FilterItems
|
||||
end
|
||||
|
||||
local function get_slot_index(pos, name)
|
||||
local hash = minetest.hash_node_position(pos)
|
||||
if FilterCache[hash] == nil then
|
||||
filter_settings(pos)
|
||||
end
|
||||
return FilterCache[hash].FilterItemIdx[name]
|
||||
end
|
||||
|
||||
local function order_checkbox(pos, filter)
|
||||
local cnt = 0
|
||||
|
||||
if CRD(pos).stage == 2 then return "" end
|
||||
|
||||
for _,val in ipairs(filter) do
|
||||
if val then cnt = cnt + 1 end
|
||||
end
|
||||
if cnt == 1 then
|
||||
local order = M(pos):get_int("order") == 1 and "true" or "false"
|
||||
return "checkbox[2,0;order;1:1;"..order.."]"..
|
||||
"tooltip[2,0;1,1;"..S("Force order of filter items")..";#0C3D32;#FFFFFF]"
|
||||
else
|
||||
M(pos):set_int("order", 0) -- disable sequencing
|
||||
end
|
||||
return ""
|
||||
return FilterCache[hash].ItemFilter, FilterCache[hash].OpenPorts
|
||||
end
|
||||
|
||||
local function blocking_checkbox(pos, filter)
|
||||
@ -127,8 +94,8 @@ local function blocking_checkbox(pos, filter)
|
||||
end
|
||||
if cnt > 1 and #open_ports > 0 then
|
||||
local blocking = M(pos):get_int("blocking") == 1 and "true" or "false"
|
||||
return "checkbox[2,0;blocking;>>|;"..blocking.."]"..
|
||||
"tooltip[2,0;1,1;"..S("Block configured items for open ports")..";#0C3D32;#FFFFFF]"
|
||||
return "checkbox[3,3.9;blocking;"..S("blocking mode")..";"..blocking.."]"..
|
||||
"tooltip[3,3.9;1,1;"..S("Block configured items for open ports")..";#0C3D32;#FFFFFF]"
|
||||
else
|
||||
M(pos):set_int("blocking", 0) -- disable blocking
|
||||
end
|
||||
@ -137,18 +104,16 @@ end
|
||||
|
||||
local function formspec(self, pos, nvm)
|
||||
local filter = minetest.deserialize(M(pos):get_string("filter")) or {false,false,false,false}
|
||||
local order = order_checkbox(pos, filter)
|
||||
local blocking = blocking_checkbox(pos, filter)
|
||||
return "size[10.5,8.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[context;src;0,0;2,4;]"..
|
||||
order..
|
||||
blocking..
|
||||
"image[2,1.5;1,1;techage_form_arrow.png]"..
|
||||
"image_button[2,3;1,1;"..self:get_state_button_image(nvm)..";state_button;]"..
|
||||
"tooltip[2,3;1,1;"..self:get_state_tooltip(nvm).."]"..
|
||||
"image_button[0,4.8;1,1;"..self:get_state_button_image(nvm)..";state_button;]"..
|
||||
"tooltip[0,4.8;1,1;"..self:get_state_tooltip(nvm).."]"..
|
||||
"checkbox[3,0;filter1;On;"..dump(filter[1]).."]"..
|
||||
"checkbox[3,1;filter2;On;"..dump(filter[2]).."]"..
|
||||
"checkbox[3,2;filter3;On;"..dump(filter[3]).."]"..
|
||||
@ -161,10 +126,10 @@ local function formspec(self, pos, nvm)
|
||||
"list[context;green;4.5,1;6,1;]"..
|
||||
"list[context;blue;4.5,2;6,1;]"..
|
||||
"list[context;yellow;4.5,3;6,1;]"..
|
||||
"list[current_player;main;1.25,4.5;8,4;]"..
|
||||
"list[current_player;main;1.25,4.8;8,4;]"..
|
||||
"listring[context;src]"..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(1.25,4.5)
|
||||
default.get_hotbar_bg(1.25,4.8)
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
@ -284,41 +249,7 @@ local function distributing(pos, inv, crd, nvm)
|
||||
if num_pushed == 0 then
|
||||
crd.State:blocked(pos, nvm)
|
||||
else
|
||||
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS, sum_num_pushed)
|
||||
end
|
||||
end
|
||||
|
||||
local function sequencing(pos, inv, crd, nvm)
|
||||
local _,open_ports, filter_items = get_filter_settings(pos)
|
||||
local offs = nvm.last_index or 1
|
||||
local num_filters = 0 -- already processed
|
||||
local num_pushed = 0
|
||||
local push_dir = open_ports[1] or 1
|
||||
local blocked = true
|
||||
|
||||
while num_pushed < crd.num_items and num_filters < 7 do
|
||||
local stack = filter_items[offs] and ItemStack(filter_items[offs])
|
||||
if stack then
|
||||
if not inv:contains_item("src", stack) then
|
||||
break
|
||||
end
|
||||
if techage.push_items(pos, push_dir, stack, offs) then
|
||||
num_pushed = num_pushed + 1
|
||||
inv:remove_item("src", stack)
|
||||
blocked = false
|
||||
end
|
||||
end
|
||||
offs = (offs % 6) + 1
|
||||
num_filters = num_filters + 1
|
||||
end
|
||||
|
||||
nvm.last_index = offs
|
||||
if blocked then
|
||||
crd.State:blocked(pos, nvm)
|
||||
elseif num_pushed == 0 then
|
||||
crd.State:standby(pos, nvm)
|
||||
else
|
||||
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS, num_pushed)
|
||||
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||
end
|
||||
end
|
||||
|
||||
@ -329,11 +260,7 @@ local function keep_running(pos, elapsed)
|
||||
local crd = CRD(pos)
|
||||
local inv = M(pos):get_inventory()
|
||||
if not inv:is_empty("src") then
|
||||
if M(pos):get_int("order") == 1 then
|
||||
sequencing(pos, inv, crd, nvm)
|
||||
else
|
||||
distributing(pos, inv, crd, nvm)
|
||||
end
|
||||
distributing(pos, inv, crd, nvm)
|
||||
else
|
||||
crd.State:idle(pos, nvm)
|
||||
end
|
||||
@ -355,10 +282,6 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
filter[3] = fields.filter3 == "true"
|
||||
elseif fields.filter4 ~= nil then
|
||||
filter[4] = fields.filter4 == "true"
|
||||
elseif fields.order ~= nil and CRD(pos).stage > 2 then
|
||||
meta:set_int("order", fields.order == "true" and 1 or 0)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.last_index = 1 -- start from the beginning
|
||||
elseif fields.blocking ~= nil then
|
||||
meta:set_int("blocking", fields.blocking == "true" and 1 or 0)
|
||||
end
|
||||
@ -431,26 +354,6 @@ tiles.act = {
|
||||
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_distri_blue.png",
|
||||
}
|
||||
|
||||
local function put_items(pos, item)
|
||||
local order = M(pos):get_int("order") == 1
|
||||
local inv = M(pos):get_inventory()
|
||||
if order then
|
||||
local name = item:get_name()
|
||||
local idx = get_slot_index(pos, name)
|
||||
if idx then
|
||||
local stack = inv:get_stack("src", idx)
|
||||
if stack:item_fits(item) then
|
||||
stack:add_item(item)
|
||||
inv:set_stack("src", idx, stack)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
else
|
||||
return techage.put_items(inv, "src", item)
|
||||
end
|
||||
end
|
||||
|
||||
local tubing = {
|
||||
on_pull_item = function(pos, in_dir, num)
|
||||
local inv = M(pos):get_inventory()
|
||||
@ -458,10 +361,12 @@ local tubing = {
|
||||
end,
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
CRD(pos).State:start_if_standby(pos)
|
||||
return put_items(pos, stack)
|
||||
local inv = M(pos):get_inventory()
|
||||
return techage.put_items(inv, "src", stack)
|
||||
end,
|
||||
on_unpull_item = function(pos, in_dir, stack)
|
||||
return put_items(pos, stack)
|
||||
local inv = M(pos):get_inventory()
|
||||
return techage.put_items(inv, "src", stack)
|
||||
end,
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
if topic == "info" then
|
||||
@ -528,7 +433,7 @@ local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
|
||||
groups = {choppy=2, cracky=2, crumbly=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
num_items = {0,4,12,36},
|
||||
num_items = {0,4,12,24},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -219,7 +219,7 @@ local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
groups = {choppy=2, cracky=2, crumbly=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
num_items = {0,1,1,1},
|
||||
power_consumption = {0,8,12,18},
|
||||
power_consumption = {0,8,12,12},
|
||||
},
|
||||
{false, true, true, true}) -- TA2/TA3/TA4
|
||||
|
||||
|
@ -42,7 +42,7 @@ local function ta4_formspec(self, pos, nvm)
|
||||
"box[0,-0.1;7.8,0.5;#c6e8ff]"..
|
||||
"label[3,-0.1;"..minetest.colorize("#000000", S("Pusher")).."]"..
|
||||
techage.question_mark_help(8, S("Optionally configure\nthe pusher with one item"))..
|
||||
"list[context;main;3.5,1;1,1;]"..
|
||||
"list[context;main;3.5,0.8;1,1;]"..
|
||||
"image_button[3.5,2;1,1;".. self:get_state_button_image(nvm) ..";state_button;]"..
|
||||
"tooltip[3.5,2;1,1;"..self:get_state_tooltip(nvm).."]"..
|
||||
"list[current_player;main;0,3.5;8,4;]"..
|
||||
|
@ -205,7 +205,7 @@ local function quarry_task(pos, crd, nvm)
|
||||
if item_name then
|
||||
if add_to_inv(pos, item_name) then
|
||||
minetest.remove_node(qpos)
|
||||
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS, 1)
|
||||
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||
else
|
||||
crd.State:blocked(pos, nvm, S("inventory full"))
|
||||
end
|
||||
|
@ -157,6 +157,22 @@ local function get_item(pos, nvm, item_name, count)
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif M(pos):get_int("priority") == 1 then
|
||||
-- Take any items. The position within the inventory is from right to left
|
||||
for idx = 8,1,-1 do
|
||||
local item = nvm.inventory[idx]
|
||||
if item.name ~= "" and (stack.name == nil or stack.name == item.name) then
|
||||
local num = math.min(item.count, count - stack.count, max_stacksize(item.name))
|
||||
if M(pos):get_int("assignment") == 1 and num == item.count then
|
||||
-- never take the last item
|
||||
num = num - 1
|
||||
end
|
||||
stack = move_items_to_stack(item, stack, num)
|
||||
if stack.count == count then
|
||||
return ItemStack(stack)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Take any items. The position within the inventory
|
||||
-- is incremented each time so that different item stacks will be considered.
|
||||
@ -212,17 +228,20 @@ local function formspec(pos)
|
||||
local inv = M(pos):get_inventory()
|
||||
local size = get_stacksize(pos)
|
||||
local assignment = M(pos):get_int("assignment") == 1 and "true" or "false"
|
||||
return "size[8,8]"..
|
||||
local priority = M(pos):get_int("priority") == 1 and "true" or "false"
|
||||
return "size[8,8.3]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
formspec_container(0, 0, nvm, inv)..
|
||||
"button[1,3;2,1;unlock;"..S("Unlock").."]"..
|
||||
"tooltip[1,3;2,1;"..S("Unlock connected chest\nif all slots are below 2000")..";#0C3D32;#FFFFFF]"..
|
||||
"label[4,3;"..S("Size")..": 8x"..size.."]"..
|
||||
"checkbox[4,3.3;assignment;"..S("keep assignment")..";"..assignment.."]"..
|
||||
"tooltip[4,3.5;2,0.6;"..S("Never completely empty the slots\nwith the pusher to keep the items assignment")..";#0C3D32;#FFFFFF]"..
|
||||
"list[current_player;main;0,4.3;8,4;]"..
|
||||
"button[0,3.5;3,1;unlock;"..S("Unlock").."]"..
|
||||
"tooltip[0,3.5;3,1;"..S("Unlock connected chest\nif all slots are below 2000")..";#0C3D32;#FFFFFF]"..
|
||||
"label[0,3;"..S("Size")..": 8x"..size.."]"..
|
||||
"checkbox[4,3;assignment;"..S("keep assignment")..";"..assignment.."]"..
|
||||
"tooltip[4,3;2,0.6;"..S("Never completely empty the slots\nwith the pusher to keep the item assignment")..";#0C3D32;#FFFFFF]"..
|
||||
"checkbox[4,3.6;priority;"..S("right to left")..";"..priority.."]"..
|
||||
"tooltip[4,3.6;2,0.6;"..S("Empty the slots always \nfrom right to left")..";#0C3D32;#FFFFFF]"..
|
||||
"list[current_player;main;0,4.6;8,4;]"..
|
||||
"listring[context;main]"..
|
||||
"listring[current_player;main]"
|
||||
end
|
||||
@ -392,6 +411,10 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
if fields.assignment then
|
||||
M(pos):set_int("assignment", fields.assignment == "true" and 1 or 0)
|
||||
end
|
||||
if fields.priority then
|
||||
M(pos):set_int("priority", fields.priority == "true" and 1 or 0)
|
||||
end
|
||||
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
end
|
||||
|
||||
@ -404,6 +427,14 @@ local function can_dig(pos, player)
|
||||
return inv:is_empty("main") and inv_empty(nvm)
|
||||
end
|
||||
|
||||
local function on_rotate(pos, node, user, mode, new_param2)
|
||||
if get_stacksize(pos) == STACK_SIZE then
|
||||
return screwdriver.rotate_simple(pos, node, user, mode, new_param2)
|
||||
else
|
||||
return screwdriver.disallow(pos, node, user, mode, new_param2)
|
||||
end
|
||||
end
|
||||
|
||||
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos)
|
||||
convert_to_chest_again(pos, oldnode, digger)
|
||||
@ -445,6 +476,7 @@ minetest.register_node("techage:ta4_chest", {
|
||||
return techage.logic.set_numbers(pos, numbers, player_name, DESCRIPTION)
|
||||
end,
|
||||
|
||||
on_rotate = on_rotate,
|
||||
on_rightclick = on_rightclick,
|
||||
on_receive_fields = on_receive_fields,
|
||||
can_dig = can_dig,
|
||||
|
214
basic_machines/ta4_injector.lua
Normal file
@ -0,0 +1,214 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2020 Joachim Stolberg
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA4 Injector
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
|
||||
local STANDBY_TICKS = 2
|
||||
local COUNTDOWN_TICKS = 4
|
||||
local CYCLE_TIME = 3
|
||||
|
||||
local function formspec(self, pos, nvm)
|
||||
if CRD(pos).stage == 4 then -- TA4 node?
|
||||
return "size[8,7.2]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"box[0,-0.1;7.8,0.5;#c6e8ff]"..
|
||||
"label[3,-0.1;"..minetest.colorize("#000000", S("Injector")).."]"..
|
||||
techage.question_mark_help(8, S("Configure up to 8 items \nto be pushed by the injector"))..
|
||||
"list[context;filter;0,0.8;8,1;]"..
|
||||
"image_button[3.5,2;1,1;".. self:get_state_button_image(nvm) ..";state_button;]"..
|
||||
"tooltip[3.5,2;1,1;"..self:get_state_tooltip(nvm).."]"..
|
||||
"list[current_player;main;0,3.5;8,4;]"..
|
||||
"listring[context;filter]"..
|
||||
"listring[current_player;main]"
|
||||
end
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then
|
||||
return 0
|
||||
end
|
||||
|
||||
local inv = M(pos):get_inventory()
|
||||
local list = inv:get_list(listname)
|
||||
if list[index]:get_count() == 0 then
|
||||
stack:set_count(1)
|
||||
inv:set_stack(listname, index, stack)
|
||||
return 0
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then
|
||||
return 0
|
||||
end
|
||||
|
||||
local inv = M(pos):get_inventory()
|
||||
inv:set_stack(listname, index, nil)
|
||||
return 0
|
||||
end
|
||||
|
||||
local function pushing(pos, crd, meta, nvm)
|
||||
local pull_dir = meta:get_int("pull_dir")
|
||||
local push_dir = meta:get_int("push_dir")
|
||||
local inv = M(pos):get_inventory()
|
||||
local filter = inv:get_list("filter")
|
||||
local pushed = false
|
||||
local pulled = false
|
||||
|
||||
for idx, item in ipairs(filter) do
|
||||
local name = item:get_name()
|
||||
if name ~= "" then
|
||||
local items = techage.pull_items(pos, pull_dir, 1, name)
|
||||
if items ~= nil then
|
||||
pulled = true
|
||||
if techage.push_items(pos, push_dir, items, idx) then
|
||||
pushed = true
|
||||
else -- place item back
|
||||
techage.unpull_items(pos, pull_dir, items)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not pulled then
|
||||
crd.State:idle(pos, nvm)
|
||||
elseif not pushed then
|
||||
crd.State:blocked(pos, nvm)
|
||||
else
|
||||
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||
end
|
||||
end
|
||||
|
||||
local function keep_running(pos, elapsed)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local crd = CRD(pos)
|
||||
pushing(pos, crd, M(pos), nvm)
|
||||
end
|
||||
|
||||
local function on_receive_fields(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
local nvm = techage.get_nvm(pos)
|
||||
CRD(pos).State:state_button_event(pos, nvm, fields)
|
||||
M(pos):set_string("formspec", formspec(CRD(pos).State, pos, nvm))
|
||||
end
|
||||
|
||||
local tiles = {}
|
||||
-- '#' will be replaced by the stage number
|
||||
-- '{power}' will be replaced by the power PNG
|
||||
tiles.pas = {
|
||||
"techage_filling_ta#.png^techage_frame_ta#_top.png^techage_appl_arrow.png",
|
||||
"techage_filling_ta#.png^techage_frame_ta#.png",
|
||||
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_outp.png",
|
||||
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png",
|
||||
"techage_appl_pusher.png^[transformR180]^techage_frame_ta#.png^techage_appl_injector.png",
|
||||
"techage_appl_pusher.png^techage_frame_ta#.png^techage_appl_injector.png",
|
||||
}
|
||||
tiles.act = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta#.png^techage_frame_ta#_top.png^techage_appl_arrow.png",
|
||||
"techage_filling_ta#.png^techage_frame_ta#.png",
|
||||
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_outp.png",
|
||||
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png",
|
||||
{
|
||||
image = "techage_appl_pusher14.png^[transformR180]^techage_frame14_ta#.png^techage_appl_injector14.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 32,
|
||||
aspect_h = 32,
|
||||
length = 2.0,
|
||||
},
|
||||
},
|
||||
{
|
||||
image = "techage_appl_pusher14.png^techage_frame14_ta#.png^techage_appl_injector14.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 32,
|
||||
aspect_h = 32,
|
||||
length = 2.0,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local tubing = {
|
||||
-- push item through the injector in opposit direction
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
return in_dir == M(pos):get_int("pull_dir") and techage.push_items(pos, in_dir, stack)
|
||||
end,
|
||||
is_pusher = true, -- is a pulling/pushing node
|
||||
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
return CRD(pos).State:on_receive_message(pos, topic, payload)
|
||||
end,
|
||||
}
|
||||
|
||||
local _, _, node_name_ta4 =
|
||||
techage.register_consumer("injector", S("Injector"), tiles, {
|
||||
cycle_time = CYCLE_TIME,
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
formspec = formspec,
|
||||
tubing = tubing,
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = M(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
meta:set_int("pull_dir", techage.side_to_outdir("L", node.param2))
|
||||
meta:set_int("push_dir", techage.side_to_outdir("R", node.param2))
|
||||
local inv = M(pos):get_inventory()
|
||||
inv:set_size('filter', 8)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
M(pos):set_string("formspec", formspec(CRD(pos).State, pos, nvm))
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
on_receive_fields = on_receive_fields,
|
||||
node_timer = keep_running,
|
||||
on_rotate = screwdriver.disallow,
|
||||
|
||||
groups = {choppy=2, cracky=2, crumbly=2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
num_items = {0,2,6,12},
|
||||
}, {false, false, false, true})
|
||||
|
||||
minetest.register_craft({
|
||||
output = node_name_ta4,
|
||||
recipe = {
|
||||
{"", "techage:aluminum", ""},
|
||||
{"", "techage:ta4_pusher_pas", ""},
|
||||
{"", "basic_materials:ic", ""},
|
||||
},
|
||||
})
|
||||
|
109
basis/conf_inv.lua
Normal file
@ -0,0 +1,109 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2020 Joachim Stolberg
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
Configured inventory lib
|
||||
Assuming the inventory has the name "conf"
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local M = minetest.get_meta
|
||||
|
||||
local inv_lib = {}
|
||||
|
||||
function inv_lib.preassigned_stacks(pos, xsize, ysize)
|
||||
local inv = M(pos):get_inventory()
|
||||
local tbl = {}
|
||||
for idx = 1, xsize * ysize do
|
||||
local item_name = inv:get_stack("conf", idx):get_name()
|
||||
if item_name ~= "" then
|
||||
local x = (idx - 1) % xsize
|
||||
local y = math.floor(idx / xsize)
|
||||
tbl[#tbl+1] = "item_image["..x..","..y..";1,1;"..item_name.."]"
|
||||
end
|
||||
end
|
||||
return table.concat(tbl, "")
|
||||
end
|
||||
|
||||
function inv_lib.item_filter(pos, size)
|
||||
local inv = M(pos):get_inventory()
|
||||
local filter = {}
|
||||
for idx = 1, size do
|
||||
local item_name = inv:get_stack("conf", idx):get_name()
|
||||
if item_name == "" then item_name = "unconfigured" end
|
||||
if not filter[item_name] then
|
||||
filter[item_name] = {}
|
||||
end
|
||||
table.insert(filter[item_name], idx)
|
||||
end
|
||||
return filter
|
||||
end
|
||||
|
||||
function inv_lib.allow_conf_inv_put(pos, listname, index, stack, player)
|
||||
local inv = M(pos):get_inventory()
|
||||
local list = inv:get_list(listname)
|
||||
|
||||
if list[index]:get_count() == 0 then
|
||||
stack:set_count(1)
|
||||
inv:set_stack(listname, index, stack)
|
||||
return 0
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function inv_lib.allow_conf_inv_take(pos, listname, index, stack, player)
|
||||
local inv = M(pos):get_inventory()
|
||||
inv:set_stack(listname, index, nil)
|
||||
return 0
|
||||
end
|
||||
|
||||
function inv_lib.allow_conf_inv_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local stack = inv:get_stack(to_list, to_index)
|
||||
|
||||
if stack:get_count() == 0 then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
function inv_lib.put_items(pos, inv, listname, item, stacks, idx)
|
||||
for _, i in ipairs(stacks) do
|
||||
if not idx or idx == i then
|
||||
local stack = inv:get_stack(listname, i)
|
||||
if stack:item_fits(item) then
|
||||
stack:add_item(item)
|
||||
inv:set_stack(listname, i, stack)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function inv_lib.take_item(pos, inv, listname, num, stacks)
|
||||
local mem = techage.get_mem(pos)
|
||||
local size = #stacks
|
||||
mem.ta_startpos = mem.ta_startpos or 1
|
||||
for idx = mem.ta_startpos, mem.ta_startpos + size do
|
||||
idx = (idx % size) + 1
|
||||
local stack = inv:get_stack(listname, idx)
|
||||
local taken = stack:take_item(num)
|
||||
if taken:get_count() > 0 then
|
||||
inv:set_stack(listname, idx, stack)
|
||||
mem.ta_startpos = idx
|
||||
return taken
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return inv_lib
|
@ -53,7 +53,6 @@ Node states:
|
||||
|
||||
Node nvm data:
|
||||
"techage_state" - node state, like "RUNNING"
|
||||
"techage_item_meter" - node item/runtime counter
|
||||
"techage_countdown" - countdown to standby mode
|
||||
]]--
|
||||
|
||||
@ -190,7 +189,6 @@ function NodeStates:node_init(pos, nvm, number)
|
||||
if self.infotext_name then
|
||||
M(pos):set_string("infotext", self.infotext_name.." "..number..": stopped")
|
||||
end
|
||||
nvm.techage_item_meter = 0
|
||||
if self.formspec_func then
|
||||
M(pos):set_string("formspec", self.formspec_func(self, pos, nvm))
|
||||
end
|
||||
@ -400,13 +398,12 @@ end
|
||||
|
||||
-- To be called after successful node action to raise the timer
|
||||
-- and keep the node in state RUNNING
|
||||
function NodeStates:keep_running(pos, nvm, val, num_items)
|
||||
function NodeStates:keep_running(pos, nvm, val)
|
||||
-- set to RUNNING if not already done
|
||||
if nvm.techage_state ~= RUNNING then
|
||||
self:start(pos, nvm)
|
||||
end
|
||||
nvm.techage_countdown = val or 4
|
||||
nvm.techage_item_meter = (nvm.techage_item_meter or 0) + (num_items or 1)
|
||||
end
|
||||
|
||||
-- Start/stop node based on button events.
|
||||
|
@ -158,10 +158,13 @@ techage.Items = {
|
||||
ta4_gravelsieve = "techage:ta4_gravelsieve_pas",
|
||||
ta4_grinder = "techage:ta4_grinder_pas",
|
||||
ta4_detector = "techage:ta4_detector_off",
|
||||
ta4_chest = "techage:ta4_chest",
|
||||
ta4_chest = "techage:chest_ta4",
|
||||
ta4_8x2000_chest = "techage:ta4_chest",
|
||||
ta4_growlight = "techage:growlight_on",
|
||||
ta4_streetlamp = "techage_ta4_streetlamp.png",
|
||||
ta4_industriallamp = "techage:industriallamp4_off",
|
||||
ta4_quarry = "techage:ta4_quarry_pas",
|
||||
ta4_electronicfab = "techage:ta4_electronic_fab_pas",
|
||||
ta4_injector = "techage:ta4_injector_pas",
|
||||
--ta4_ "",
|
||||
}
|
||||
|
@ -175,6 +175,8 @@ techage.manual_DE.aTitel = {
|
||||
"3,TA4 Kiessieb / Gravel Sieve",
|
||||
"3,TA4 Mühle / Grinder",
|
||||
"3,TA4 Steinbrecher / Quarry",
|
||||
"3,TA4 Elektronikfabrik / Electronic Fab",
|
||||
"3,TA4 Injektor / Injector",
|
||||
}
|
||||
|
||||
techage.manual_DE.aText = {
|
||||
@ -1358,6 +1360,8 @@ techage.manual_DE.aText = {
|
||||
"\n",
|
||||
"Die Funktion entspricht der von TA3. Die Kiste kann aber mehr Inhalt aufnehmen.\n"..
|
||||
"\n"..
|
||||
"Zusätzlich besitzt die TA4 Kiste ein Schatteninventar zur Konfiguration. Hier können bestimmte Speicherplätze mit einem Item vorbelegt werden. Vorbelegte Speicherplätze werden beim Füllen nur mit diesen Items belegt. Zum Leeren eines vorbelegten Speicherplatzes wird ein TA4 Schieber oder TA4 Injektor mit entsprechender Konfiguration benötigt.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Die TA4 8x2000 Kiste hat kein normales Inventar wir andere Kisten\\, sondern verfügt über 8 Speicher\\, wobei jeder Speicher bis zu 2000 Items einer Sorte aufnehmen kann. Über die orangefarbenen Taster können Items in den Speicher verschoben bzw. wieder heraus geholt werden. Die Kiste kann auch wie sonst üblich mit einem Schieber (TA2\\, TA3 oder TA4) gefüllt bzw. geleert werden.\n"..
|
||||
@ -1386,7 +1390,7 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"\n",
|
||||
"Die Funktion entspricht der von TA2.\n"..
|
||||
"Die Verarbeitungsleistung beträgt 36 Items alle 4 s.\n"..
|
||||
"Die Verarbeitungsleistung beträgt 24 Items alle 4 s.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
@ -1407,6 +1411,19 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Die Funktion entspricht der von TA2\\, nur werden hier verschiedene Chips produziert.\n"..
|
||||
"Die Verarbeitungsleistung beträgt ein Chip alle 6 s. Der Block benötigt hierfür 12 ku Strom.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Der Injektor ist ein TA4 Schieber mit speziellen Eigenschaften. Er besitzt ein Menü zur Konfiguration. Hier können bis zu 8 Items konfiguriert werden. Er entnimmt nur diese Items einer Kiste (TA4 Kiste oder TA4 8x2000 Kiste) um sie an Maschinen mit Rezepturen weiterzugeben (Autocrafter\\, Industrieofen und Elektronikfabrik). \n"..
|
||||
"\n"..
|
||||
"Beim Weitergeben wird in der Zielmaschine pro Item nur eine Position im Inventar genutzt. Sind bspw. nur die ersten drei Einträge im Injektor konfiguriert\\, so werden auch nur die ersten drei Speicherplätze im Inventar der Maschine belegt. Damit wir ein Überlauf im Inventar der Maschine verhindert. \n"..
|
||||
"\n"..
|
||||
"Die Verarbeitungsleistung beträgt bis zu 8 Items alle 3 Sekunden.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
}
|
||||
|
||||
techage.manual_DE.aItemName = {
|
||||
@ -1579,11 +1596,13 @@ techage.manual_DE.aItemName = {
|
||||
"ta4_tube",
|
||||
"ta4_pusher",
|
||||
"ta4_chest",
|
||||
"ta4_chest",
|
||||
"ta4_8x2000_chest",
|
||||
"ta4_distributor",
|
||||
"ta4_gravelsieve",
|
||||
"ta4_grinder",
|
||||
"ta4_quarry",
|
||||
"ta4_electronicfab",
|
||||
"ta4_injector",
|
||||
}
|
||||
|
||||
techage.manual_DE.aPlanTable = {
|
||||
@ -1761,5 +1780,7 @@ techage.manual_DE.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ local function node_timer(pos, elapsed)
|
||||
if nvm.liquid.amount < CAPACITY then
|
||||
nvm.taken = power.consumer_alive(pos, Cable, CYCLE_TIME)
|
||||
generating(pos, nvm)
|
||||
State:keep_running(pos, nvm, 1, 0) -- count items
|
||||
State:keep_running(pos, nvm, 1) -- TODO warum hier 1 und nicht COUNTDOWN_TICKS?
|
||||
else
|
||||
State:blocked(pos, nvm, S("full"))
|
||||
power.consumer_stop(pos, Cable)
|
||||
|
@ -99,7 +99,7 @@ local function node_timer(pos, elapsed)
|
||||
local outdir = M(pos):get_int("outdir")
|
||||
nvm.given = power.generator_alive(pos, Cable, CYCLE_TIME, outdir)
|
||||
consuming(pos, nvm)
|
||||
State:keep_running(pos, nvm, 1, 0) -- count items
|
||||
State:keep_running(pos, nvm, 1) -- TODO warum hier 1 und nicht COUNTDOWN_TICKS?
|
||||
else
|
||||
State:standby(pos, nvm)
|
||||
nvm.given = 0
|
||||
|
@ -24,6 +24,11 @@ minetest.register_craft({
|
||||
recipe = {
|
||||
{'default:copper_ingot', 'techage:ta4_carbon_fiber', 'default:copper_ingot'},
|
||||
{'techage:baborium_ingot', 'techage:ta4_carbon_fiber', 'techage:baborium_ingot'},
|
||||
{"techage:lye", 'techage:ta4_carbon_fiber', 'techage:lye'},
|
||||
{"techage:canister_lye", 'techage:ta4_carbon_fiber', "techage:canister_lye"},
|
||||
},
|
||||
replacements = {
|
||||
{"techage:canister_lye", "techage:ta3_canister_empty"},
|
||||
{"techage:canister_lye", "techage:ta3_canister_empty"},
|
||||
}
|
||||
})
|
||||
|
||||
|
1
init.lua
@ -110,6 +110,7 @@ else
|
||||
dofile(MP.."/basic_machines/liquidsampler.lua")
|
||||
dofile(MP.."/basic_machines/quarry.lua")
|
||||
dofile(MP.."/basic_machines/ta4_chest.lua")
|
||||
dofile(MP.."/basic_machines/ta4_injector.lua")
|
||||
|
||||
-- Liquids II
|
||||
dofile(MP.."/liquids/tank.lua")
|
||||
|
@ -33,6 +33,7 @@ Biome=Biom
|
||||
Block configured items for open ports=Blockiere konfigurierte Gegenstände für offene Ausgänge
|
||||
Build derrick=Errichte Ölturm
|
||||
Compressed Gravel=Komprimiertes Kies
|
||||
Configure up to 8 items @nto be pushed by the injector=Konfiguriere bis zu 8 Gegenstände \n die vom Injektor weitergegeben werden sollen
|
||||
Consum. 1=Konsum. 1
|
||||
Consum. 2=Konsum. 2
|
||||
Current power:=Strom aktuell:
|
||||
@ -48,6 +49,7 @@ Ele Power Source=Ele Kraftquelle
|
||||
Electricity=Strom
|
||||
Electrolyzer=Eletrolyseur
|
||||
Electronic Fab=Elektronikfabrik
|
||||
Empty the slots always @nfrom right to left=Speicherplätze von rechts nach links leeren
|
||||
Energy storage=Engergiespeicher
|
||||
Energy stored:=Energie gespeichert
|
||||
Enter=Eingeben
|
||||
@ -59,7 +61,6 @@ Firebox=Feuerkasten
|
||||
Flint and Iron=Flint and Iron
|
||||
Flowing Oil=Fließendes Öl
|
||||
Flywheel=Schwungrad
|
||||
Force order of filter items=Erzwinge Reihenfolge
|
||||
Fuel Cell=Brennstoffzelle
|
||||
Fuel Menu=Brennstoff Menü
|
||||
Fuel cell=Brennstoffzelle
|
||||
@ -81,9 +82,11 @@ Hole size=Lochgröße
|
||||
Hydrogen Cylinder Large=Wasserstoffflasche groß
|
||||
Hydrogen Cylinder Small=Wasserstoffflasche klein
|
||||
In use:=In Benutzung:
|
||||
Injector=Injektor
|
||||
Insert destination node number(s)=Gebe Zielnummer(n) ein
|
||||
Insert door/gate block number(s)=Gebe Tür-/Tornummer(n) ein
|
||||
Intake=Stromaufnahme
|
||||
Inventory,Configuration=Inventar,Konfiguration
|
||||
Inverter=Wechselrichter
|
||||
Leave Powder=Laub Pulver
|
||||
Liquid Filler=Einfülltrichter
|
||||
@ -109,7 +112,7 @@ More water expected (2 m deep)!=Mehr Wasser erwartet (2 m tief)
|
||||
Nacelle is missing=Die Gondel fehlt
|
||||
Needle Powder=Nadel Pulver
|
||||
Network Data=Netzwerkdaten
|
||||
Never completely empty the slots@nwith the pusher to keep the items assignment=Slots mit dem Schieber nie ganz@nleeren, um die Item-Zuordnung beizubehalten
|
||||
Never completely empty the slots@nwith the pusher to keep the item assignment=Speicherplätze mit dem Schieber nie ganz@nleeren, um die Item-Zuordnung beizubehalten
|
||||
No network or active generator available!=Kein Stromnetz oder aktiver Generator verfügbar
|
||||
No plan available=Kein Plan verfügar
|
||||
No power grid or running generator!=Kein Stromnetz oder Generator verfügbar!
|
||||
@ -367,7 +370,7 @@ Tube Wall Entry=Tube Wanddurchbruch
|
||||
Turned on:=Eingeschaltet:
|
||||
Type=Typ
|
||||
Unlock=Entsperren
|
||||
Unlock connected chest@nif all slots are below 2000=Nachfolgende Kiste entsperren,@nsofern alle Slots <= 2000
|
||||
Unlock connected chest@nif all slots are below 2000=Nachfolgende Kiste entsperren,@nsofern alle Speicherplätze <= 2000
|
||||
Update=Update
|
||||
Usmium Nuggets=Usmium Nuggets
|
||||
Usmium Powder=Usmium Pulver
|
||||
@ -394,6 +397,7 @@ accept=akzeptieren
|
||||
added=hinzugefügt wird
|
||||
added or removed=hinzugefügt oder entfernt wird
|
||||
area is protected=Bereich ist geschützt
|
||||
blocking mode=Blockiert
|
||||
commands like: help=Kommandos wie: help
|
||||
connected with=verbunden mit
|
||||
depth=Tiefe
|
||||
@ -422,9 +426,9 @@ reactor defect or no power=Reaktor defekt oder kein Strom
|
||||
reactor has no power=Reaktor hat keinen Strom
|
||||
removed=entfernt
|
||||
repaired=repariert
|
||||
right to left=von rechts nach links
|
||||
stopped=gestoppt
|
||||
storage empty?=Speicher leer?
|
||||
water temperature=Wassertemperatur
|
||||
wrong storage diameter=Falscher Wärmespeicher-Durchmesser
|
||||
##### not used anymore #####
|
||||
TA4 Wall Pipe=TA4 Wandröhre
|
@ -31,6 +31,7 @@ Biome=
|
||||
Block configured items for open ports=
|
||||
Build derrick=
|
||||
Compressed Gravel=
|
||||
Configure up to 8 items @nto be pushed by the injector=
|
||||
Consum. 1=
|
||||
Consum. 2=
|
||||
Current power:=
|
||||
@ -46,6 +47,7 @@ Ele Power Source=
|
||||
Electricity=
|
||||
Electrolyzer=
|
||||
Electronic Fab=
|
||||
Empty the slots always @nfrom right to left=
|
||||
Energy storage=
|
||||
Energy stored:=
|
||||
Enter=
|
||||
@ -57,7 +59,6 @@ Firebox=
|
||||
Flint and Iron=
|
||||
Flowing Oil=
|
||||
Flywheel=
|
||||
Force order of filter items=
|
||||
Fuel Cell=
|
||||
Fuel Menu=
|
||||
Fuel cell=
|
||||
@ -79,9 +80,11 @@ Hole size=
|
||||
Hydrogen Cylinder Large=
|
||||
Hydrogen Cylinder Small=
|
||||
In use:=
|
||||
Injector=
|
||||
Insert destination node number(s)=
|
||||
Insert door/gate block number(s)=
|
||||
Intake=
|
||||
Inventory,Configuration=
|
||||
Inverter=
|
||||
Leave Powder=
|
||||
Liquid Filler=
|
||||
@ -107,7 +110,7 @@ More water expected (2 m deep)!=
|
||||
Nacelle is missing=
|
||||
Needle Powder=
|
||||
Network Data=
|
||||
Never completely empty the slots@nwith the pusher to keep the items assignment=
|
||||
Never completely empty the slots@nwith the pusher to keep the item assignment=
|
||||
No network or active generator available!=
|
||||
No plan available=
|
||||
No power grid or running generator!=
|
||||
@ -392,6 +395,7 @@ accept=
|
||||
added=
|
||||
added or removed=
|
||||
area is protected=
|
||||
blocking mode=
|
||||
commands like: help=
|
||||
connected with=
|
||||
depth=
|
||||
@ -420,6 +424,7 @@ reactor defect or no power=
|
||||
reactor has no power=
|
||||
removed=
|
||||
repaired=
|
||||
right to left=
|
||||
stopped=
|
||||
storage empty?=
|
||||
water temperature=
|
||||
|
@ -36,7 +36,7 @@ local function read_number(itemstack, user, pointed_thing)
|
||||
local number = techage.get_node_number(pos)
|
||||
if number then
|
||||
local numbers = minetest.deserialize(user:get_attribute("techage_prog_numbers")) or {}
|
||||
numbers[number] = true
|
||||
techage.add_to_set(numbers, number)
|
||||
user:set_attribute("techage_prog_numbers", minetest.serialize(numbers))
|
||||
minetest.chat_send_player(user:get_player_name(), S("[TechAge Programmer] number").." "..number.." read")
|
||||
else
|
||||
@ -59,7 +59,7 @@ local function program_numbers(itemstack, placer, pointed_thing)
|
||||
minetest.chat_send_player(player_name, S("[TechAge Programmer] foreign or unknown node!"))
|
||||
return itemstack
|
||||
end
|
||||
local text = join_to_string(numbers)
|
||||
local text = table.concat(numbers, " ")
|
||||
local ndef = minetest.registered_nodes[minetest.get_node(pos).name]
|
||||
if ndef and ndef.techage_set_numbers then
|
||||
local res = ndef.techage_set_numbers(pos, text, player_name)
|
||||
|
@ -513,6 +513,8 @@ Der TA4 Schieber besitzt zwei zusätzliche Kommandos für den Lua Controller:
|
||||
|
||||
Die Funktion entspricht der von TA3. Die Kiste kann aber mehr Inhalt aufnehmen.
|
||||
|
||||
Zusätzlich besitzt die TA4 Kiste ein Schatteninventar zur Konfiguration. Hier können bestimmte Speicherplätze mit einem Item vorbelegt werden. Vorbelegte Speicherplätze werden beim Füllen nur mit diesen Items belegt. Zum Leeren eines vorbelegten Speicherplatzes wird ein TA4 Schieber oder TA4 Injektor mit entsprechender Konfiguration benötigt.
|
||||
|
||||
[ta4_chest|image]
|
||||
|
||||
### TA4 8x2000 Kiste / TA4 8x2000 Chest
|
||||
@ -542,14 +544,14 @@ Der Kiste besitzt ein zusätzliches Kommandos für den Lua Controller:
|
||||
Beispiel 1: `$read_data(CHEST, "count")` --> Summe der Items über alle 8 Speicher
|
||||
Beispiel 2: `$read_data(CHEST, "count", 2)` --> Anzahl der Items in Speicher 2 (zweiter von links)
|
||||
|
||||
[ta4_chest|image]
|
||||
[ta4_8x2000_chest|image]
|
||||
|
||||
|
||||
|
||||
### TA4 Verteiler / Distributor
|
||||
|
||||
Die Funktion entspricht der von TA2.
|
||||
Die Verarbeitungsleistung beträgt 36 Items alle 4 s.
|
||||
Die Verarbeitungsleistung beträgt 24 Items alle 4 s.
|
||||
|
||||
[ta4_distributor|image]
|
||||
|
||||
@ -575,3 +577,20 @@ Zusätzlich kann die Lochgröße zwischen 3x3 und 11x11 Blöcken eingestellt wer
|
||||
Die maximale Tiefe beträgt 80 Meter. Der Steinbrecher benötigt 14 ku Strom.
|
||||
|
||||
[ta4_quarry|image]
|
||||
|
||||
### TA4 Elektronikfabrik / Electronic Fab
|
||||
|
||||
Die Funktion entspricht der von TA2, nur werden hier verschiedene Chips produziert.
|
||||
Die Verarbeitungsleistung beträgt ein Chip alle 6 s. Der Block benötigt hierfür 12 ku Strom.
|
||||
|
||||
[ta4_electronicfab|image]
|
||||
|
||||
### TA4 Injektor / Injector
|
||||
|
||||
Der Injektor ist ein TA4 Schieber mit speziellen Eigenschaften. Er besitzt ein Menü zur Konfiguration. Hier können bis zu 8 Items konfiguriert werden. Er entnimmt nur diese Items einer Kiste (TA4 Kiste oder TA4 8x2000 Kiste) um sie an Maschinen mit Rezepturen weiterzugeben (Autocrafter, Industrieofen und Elektronikfabrik).
|
||||
|
||||
Beim Weitergeben wird in der Zielmaschine pro Item nur eine Position im Inventar genutzt. Sind bspw. nur die ersten drei Einträge im Injektor konfiguriert, so werden auch nur die ersten drei Speicherplätze im Inventar der Maschine belegt. Damit wir ein Überlauf im Inventar der Maschine verhindert.
|
||||
|
||||
Die Verarbeitungsleistung beträgt bis zu 8 Items alle 3 Sekunden.
|
||||
|
||||
[ta4_injector|image]
|
@ -174,3 +174,5 @@
|
||||
- [TA4 Kiessieb / Gravel Sieve](./manual_ta4_DE.md#ta4-kiessieb--gravel-sieve)
|
||||
- [TA4 Mühle / Grinder](./manual_ta4_DE.md#ta4-mühle--grinder)
|
||||
- [TA4 Steinbrecher / Quarry](./manual_ta4_DE.md#ta4-steinbrecher--quarry)
|
||||
- [TA4 Elektronikfabrik / Electronic Fab](./manual_ta4_DE.md#ta4-elektronikfabrik--electronic-fab)
|
||||
- [TA4 Injektor / Injector](./manual_ta4_DE.md#ta4-injektor--injector)
|
@ -86,7 +86,8 @@ local function trigger_network(pos, outdir, Cable)
|
||||
networks.build_network(pos, outdir, Cable, netID)
|
||||
elseif not networks.get_network(Cable.tube_type, netID) then
|
||||
--print("build_network !!!!!!!!!!!!!!!!!!!!")
|
||||
delete_netID(pos, outdir, Cable)
|
||||
netID = determine_netID(pos, outdir, Cable)
|
||||
store_netID(pos, outdir, netID, Cable)
|
||||
networks.build_network(pos, outdir, Cable, netID)
|
||||
end
|
||||
end
|
||||
@ -169,6 +170,7 @@ function techage.power.consumer_alive(pos, Cable, cycle_time)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local def = nvm[Cable.tube_type] -- power related network data
|
||||
if def then
|
||||
-- if network is deleted (cable removed/placed) rebuild it to prevent flickering lights
|
||||
if not def["netID"] or not networks.get_network(Cable.tube_type, def["netID"]) then
|
||||
build_network_consumer(pos, Cable)
|
||||
end
|
||||
|
@ -20,6 +20,16 @@ local networks = techage.networks
|
||||
local Cable = techage.ElectricCable
|
||||
local power = techage.power
|
||||
|
||||
local function can_dig(pos, digger)
|
||||
if M(pos):get_string("owner") == digger:get_player_name() then
|
||||
return true
|
||||
end
|
||||
if minetest.check_player_privs(digger:get_player_name(), "powerline") then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- legacy node
|
||||
minetest.register_node("techage:power_line", {
|
||||
description = S("TA Power Line"),
|
||||
@ -33,6 +43,7 @@ minetest.register_node("techage:power_line", {
|
||||
return false
|
||||
end,
|
||||
|
||||
can_dig = can_dig,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
if oldmetadata and oldmetadata.fields and oldmetadata.fields.tl2_param2 then
|
||||
oldnode.param2 = oldmetadata.fields.tl2_param2
|
||||
@ -74,6 +85,7 @@ minetest.register_node("techage:power_lineS", {
|
||||
return false
|
||||
end,
|
||||
|
||||
can_dig = can_dig,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
if oldmetadata and oldmetadata.fields and oldmetadata.fields.tl2_param2 then
|
||||
oldnode.param2 = oldmetadata.fields.tl2_param2
|
||||
@ -121,6 +133,7 @@ minetest.register_node("techage:power_lineA", {
|
||||
return false
|
||||
end,
|
||||
|
||||
can_dig = can_dig,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
if oldmetadata and oldmetadata.fields and oldmetadata.fields.tl2_param2 then
|
||||
oldnode.param2 = oldmetadata.fields.tl2_param2
|
||||
@ -199,16 +212,7 @@ minetest.register_node("techage:power_pole2", {
|
||||
end
|
||||
return false
|
||||
end,
|
||||
can_dig = function(pos, digger)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_string("owner") == digger:get_player_name() then
|
||||
return true
|
||||
end
|
||||
if minetest.check_player_privs(digger:get_player_name(), "powerline") then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
can_dig = can_dig,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
if oldmetadata and oldmetadata.fields and oldmetadata.fields.tl2_param2 then
|
||||
oldnode.param2 = oldmetadata.fields.tl2_param2
|
||||
@ -305,16 +309,7 @@ minetest.register_node("techage:power_pole_conn", {
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Cable:after_dig_node(pos)
|
||||
end,
|
||||
can_dig = function(pos, digger)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_string("owner") == digger:get_player_name() then
|
||||
return true
|
||||
end
|
||||
if minetest.check_player_privs(digger:get_player_name(), "powerline") then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
can_dig = can_dig,
|
||||
networks = {
|
||||
ele1 = {
|
||||
sides = networks.AllSides, -- connection sides for cables
|
||||
@ -350,6 +345,7 @@ minetest.register_node("techage:power_pole3", {
|
||||
{ -4/32, -16/32, -4/32, 4/32, 16/32, 4/32},
|
||||
},
|
||||
},
|
||||
can_dig = can_dig,
|
||||
on_rotate = screwdriver.disallow, -- important!
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
|
Before Width: | Height: | Size: 302 B After Width: | Height: | Size: 303 B |
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 290 B |
Before Width: | Height: | Size: 237 B After Width: | Height: | Size: 204 B |
BIN
textures/techage_appl_injector.png
Normal file
After Width: | Height: | Size: 273 B |
BIN
textures/techage_appl_injector14.png
Normal file
After Width: | Height: | Size: 473 B |