XL display, stackable 8x2000 chests added

This commit is contained in:
Joachim Stolberg 2020-04-11 23:21:54 +02:00
parent 7e40b18cf1
commit 3dbf81365b
22 changed files with 297 additions and 60 deletions

View File

@ -13,6 +13,7 @@
]]-- ]]--
-- for lazy programmers -- for lazy programmers
local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local M = minetest.get_meta local M = minetest.get_meta
local S = techage.S local S = techage.S
@ -162,16 +163,65 @@ end
local function formspec(pos) local function formspec(pos)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local inv = M(pos):get_inventory() local inv = M(pos):get_inventory()
return "size[8,7.2]".. local size = M(pos):get_int("stacksize")
if size == 0 then size = STACK_SIZE end
return "size[8,7.6]"..
default.gui_bg.. default.gui_bg..
default.gui_bg_img.. default.gui_bg_img..
default.gui_slots.. default.gui_slots..
formspec_container(0, 0, nvm, inv).. "label[0,-0.2;"..S("Size")..": 8x"..size.."]"..
"list[current_player;main;0,3.5;8,4;]".. formspec_container(0, 0.4, nvm, inv)..
"list[current_player;main;0,3.9;8,4;]"..
"listring[context;main]".. "listring[context;main]"..
"listring[current_player;main]" "listring[current_player;main]"
end end
local function count_number_of_chests(pos)
local node = techage.get_node_lvm(pos)
local dir = techage.side_to_outdir("B", node.param2)
local pos1 = tubelib2.get_pos(pos, dir)
local cnt = 1
while cnt < 50 do
node = techage.get_node_lvm(pos1)
if node.name ~= "techage:ta4_chest_dummy" then
break
end
pos1 = tubelib2.get_pos(pos1, dir)
cnt = cnt + 1
end
M(pos):set_int("stacksize", STACK_SIZE * cnt)
end
local function search_chest_in_front(pos, node)
local dir = techage.side_to_outdir("F", node.param2)
local pos1 = tubelib2.get_pos(pos, dir)
local cnt = 1
while cnt < 50 do
node = techage.get_node_lvm(pos1)
if node.name ~= "techage:ta4_chest_dummy" then
break
end
pos1 = tubelib2.get_pos(pos1, dir)
cnt = cnt + 1
end
if node.name == "techage:ta4_chest" then
minetest.after(1, count_number_of_chests, pos1)
return true
end
return false
end
local function convert_to_chest_again(pos, node, player)
local dir = techage.side_to_outdir("B", node.param2)
local pos1 = tubelib2.get_pos(pos, dir)
local node1 = techage.get_node_lvm(pos1)
if node1.name == "techage:ta4_chest_dummy" then
node1.name = "techage:ta4_chest"
minetest.swap_node(pos1, node1)
M(pos1):set_int("disabled", 1)
end
end
local function allow_metadata_inventory_put(pos, listname, index, stack, player) local function allow_metadata_inventory_put(pos, listname, index, stack, player)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
return 0 return 0
@ -209,8 +259,10 @@ local function on_metadata_inventory_take(pos, listname, index, stack, player)
end end
local function on_rightclick(pos, node, clicker) local function on_rightclick(pos, node, clicker)
if M(pos):get_int("disabled") ~= 1 then
M(pos):set_string("formspec", formspec(pos)) M(pos):set_string("formspec", formspec(pos))
techage.set_activeformspec(pos, clicker) techage.set_activeformspec(pos, clicker)
end
end end
-- take items from chest -- take items from chest
@ -276,6 +328,7 @@ end
local function after_dig_node(pos, oldnode, oldmetadata, digger) local function after_dig_node(pos, oldnode, oldmetadata, digger)
techage.remove_node(pos) techage.remove_node(pos)
convert_to_chest_again(pos, oldnode, digger)
end end
minetest.register_node("techage:ta4_chest", { minetest.register_node("techage:ta4_chest", {
@ -287,7 +340,7 @@ minetest.register_node("techage:ta4_chest", {
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_chest_back_ta4.png", "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_chest_back_ta4.png",
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_chest_back_ta4.png", "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_chest_back_ta4.png",
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_chest_back_ta4.png", "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_chest_back_ta4.png",
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_chest_front_ta4.png", "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_chest_front_ta4.png^techage_appl_warehouse.png",
}, },
on_construct = function(pos) on_construct = function(pos)
@ -296,12 +349,18 @@ minetest.register_node("techage:ta4_chest", {
end, end,
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
local node = minetest.get_node(pos)
if search_chest_in_front(pos, node) then
node.name = "techage:ta4_chest_dummy"
minetest.swap_node(pos, node)
else
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
gen_inv(nvm) gen_inv(nvm)
local number = techage.add_node(pos, "techage:ta4_chest") local number = techage.add_node(pos, "techage:ta4_chest")
M(pos):set_string("owner", placer:get_player_name()) M(pos):set_string("owner", placer:get_player_name())
M(pos):set_string("formspec", formspec(pos)) M(pos):set_string("formspec", formspec(pos))
M(pos):set_string("infotext", DESCRIPTION.." "..number) M(pos):set_string("infotext", DESCRIPTION.." "..number)
end
end, end,
techage_set_numbers = function(pos, numbers, player_name) techage_set_numbers = function(pos, numbers, player_name)
@ -320,7 +379,28 @@ minetest.register_node("techage:ta4_chest", {
on_metadata_inventory_take = on_metadata_inventory_take, on_metadata_inventory_take = on_metadata_inventory_take,
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {choppy=2, cracky=2, crumbly=2}, groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory = 1},
is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("techage:ta4_chest_dummy", {
description = DESCRIPTION,
tiles = {
-- up, down, right, left, back, front
"techage_filling_ta4.png^techage_frame_ta4_top.png",
"techage_filling_ta4.png^techage_frame_ta4.png",
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_chest_back_ta4.png",
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_chest_back_ta4.png",
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_chest_back_ta4.png",
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_chest_front_ta4.png^techage_appl_warehouse.png",
},
on_rightclick = function(pos, node, clicker)
end,
paramtype2 = "facedir",
diggable = false,
groups = {not_in_creative_inventory = 1},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })

View File

@ -53,6 +53,16 @@ local function output(network, valid)
print("Network ("..valid.."): "..table.concat(tbl, ", ")) print("Network ("..valid.."): "..table.concat(tbl, ", "))
end end
local function debug(ntype)
local tbl = {}
for netID,netw in pairs(Networks[ntype] or {}) do
if type(netw) == "table" then
tbl[#tbl+1] = string.format("%X", netID)
end
end
return "Networks: "..table.concat(tbl, ", ")
end
local function hidden_node(pos, net_name) local function hidden_node(pos, net_name)
local name = M(pos):get_string("techage_hidden_nodename") local name = M(pos):get_string("techage_hidden_nodename")
local ndef = minetest.registered_nodes[name] local ndef = minetest.registered_nodes[name]
@ -257,7 +267,6 @@ local function remove_outdated_networks()
end end
for _,item in ipairs(to_be_deleted) do for _,item in ipairs(to_be_deleted) do
local net_name, netID = unpack(item) local net_name, netID = unpack(item)
print("delete", net_name, netID)
Networks[net_name][netID] = nil Networks[net_name][netID] = nil
end end
minetest.after(60, remove_outdated_networks) minetest.after(60, remove_outdated_networks)
@ -296,6 +305,7 @@ end
-- return network without maintainting the "alive" data -- return network without maintainting the "alive" data
function techage.networks.peek_network(tube_type, netID) function techage.networks.peek_network(tube_type, netID)
--print("peek_network", debug(tube_type))
return Networks[tube_type] and Networks[tube_type][netID] return Networks[tube_type] and Networks[tube_type][netID]
end end
@ -326,6 +336,7 @@ function techage.networks.build_network(pos, outdir, tlib2, netID)
end end
function techage.networks.get_network(tube_type, netID) function techage.networks.get_network(tube_type, netID)
--print("get_network", string.format("%X", netID), debug(tube_type))
local netw = Networks[tube_type] and Networks[tube_type][netID] local netw = Networks[tube_type] and Networks[tube_type][netID]
if netw then if netw then
netw.alive = 3 -- monitored by scheduler (power) netw.alive = 3 -- monitored by scheduler (power)

View File

@ -141,6 +141,7 @@ techage.Items = {
ta4_icta_controller = "techage:ta4_icta_controller", ta4_icta_controller = "techage:ta4_icta_controller",
ta4_battery = "techage:ta4_battery", ta4_battery = "techage:ta4_battery",
ta4_display = "techage:ta4_display", ta4_display = "techage:ta4_display",
ta4_displayXL = "techage:ta4_displayXL",
ta4_signaltower = "techage:ta4_signaltower", ta4_signaltower = "techage:ta4_signaltower",
ta4_lua_controller = "techage:ta4_lua_controller", ta4_lua_controller = "techage:ta4_lua_controller",
ta4_lua_server = "techage:ta4_server", ta4_lua_server = "techage:ta4_server",

View File

@ -144,6 +144,7 @@ techage.manual_DE.aTitel = {
"3,TA4 ICTA Controller", "3,TA4 ICTA Controller",
"3,Batterie", "3,Batterie",
"3,TA4 Display", "3,TA4 Display",
"3,TA4 Display XL",
"3,TA4 Signal Tower", "3,TA4 Signal Tower",
"2,TA4 Lua Controller", "2,TA4 Lua Controller",
"3,TA4 Lua Server", "3,TA4 Lua Server",
@ -1217,6 +1218,14 @@ techage.manual_DE.aText = {
"\n", "\n",
"Das Display zeigt nach dem Platzieren seine Nummer an. Über diese Nummer kann das Display angesprochen werden. Auf dem Display können Texte ausgegeben werden\\, wobei das Display 5 Zeilen und damit 5 unterschiedliche Texte darstellen kann.\n".. "Das Display zeigt nach dem Platzieren seine Nummer an. Über diese Nummer kann das Display angesprochen werden. Auf dem Display können Texte ausgegeben werden\\, wobei das Display 5 Zeilen und damit 5 unterschiedliche Texte darstellen kann.\n"..
"\n".. "\n"..
"Das Display wird maximal ein mal pro Sekunde aktualisiert.\n"..
"\n"..
"\n"..
"\n",
"Das TA4 Display XL hat die doppelte Größ wie das TA4 Display.\n"..
"\n"..
"Das Display wird maximal alle zwei Sekunden aktualisiert.\n"..
"\n"..
"\n".. "\n"..
"\n", "\n",
"Der Signal Tower kann rot\\, grün und orange anzeigen. Eine Kombination der 3 Farben ist nicht möglich.\n".. "Der Signal Tower kann rot\\, grün und orange anzeigen. Eine Kombination der 3 Farben ist nicht möglich.\n"..
@ -1335,6 +1344,14 @@ techage.manual_DE.aText = {
"\n".. "\n"..
"Wird die Kiste über einen Schieber geleert\\, leeren sich auch die Speicher wieder von links nach rechts.\n".. "Wird die Kiste über einen Schieber geleert\\, leeren sich auch die Speicher wieder von links nach rechts.\n"..
"\n".. "\n"..
"*Stapelfunktion*\n"..
"\n"..
"Mehrere TA4 8x2000 Kisten können zu einer großen Kiste mit mehr Inhalt verbunden werden. Dazu müssen die Kisten in einer Reihe hintereinander gesetzt werden.\n"..
"\n"..
"Zuerst muss die Front-Kiste gesetzt werden\\, dann werden die Stapel-Kisten mit gleicher Blickrichtung dahinter gesetzt (alle Kisten haben die Front in Richtung Spieler). Bei 2 Kisten in Reihe erhöht sich die Größe auf 8x4000\\, usw.\n"..
"\n"..
"Die angereihten Kisten können nun nicht mehr entfernt werden. Um die Kisten wieder abbauen zu können\\, muss zuerst die Frontkiste entfernt werden. Danach können die Kisten der Reihe nach wieder entfernt werden. \n"..
"\n"..
"Die Kiste kann nur von den Spielern genutzt werden\\, die an diesem Ort auch bauen können\\, also Protection Rechte besitzen. Es spielt dabei keine Rolle\\, wer die Kiste setzt. \n".. "Die Kiste kann nur von den Spielern genutzt werden\\, die an diesem Ort auch bauen können\\, also Protection Rechte besitzen. Es spielt dabei keine Rolle\\, wer die Kiste setzt. \n"..
"\n".. "\n"..
"Der Kiste besitzt ein zusätzliches Kommandos für den Lua Controller:\n".. "Der Kiste besitzt ein zusätzliches Kommandos für den Lua Controller:\n"..
@ -1511,6 +1528,7 @@ techage.manual_DE.aItemName = {
"ta4_icta_controller", "ta4_icta_controller",
"ta4_battery", "ta4_battery",
"ta4_display", "ta4_display",
"ta4_displayXL",
"ta4_signaltower", "ta4_signaltower",
"ta4_lua_controller", "ta4_lua_controller",
"ta4_lua_server", "ta4_lua_server",
@ -1711,5 +1729,6 @@ techage.manual_DE.aPlanTable = {
"", "",
"", "",
"", "",
"",
} }

View File

@ -17,6 +17,7 @@ local RADIUS = 6
local Param2ToFacedir = {[0] = 0, 0, 3, 1, 2, 0} local Param2ToFacedir = {[0] = 0, 0, 3, 1, 2, 0}
lcdlib.register_display_entity("techage:display_entity") lcdlib.register_display_entity("techage:display_entity")
lcdlib.register_display_entity("techage:display_entityXL")
local function display_update(pos, objref) local function display_update(pos, objref)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -29,10 +30,21 @@ local function display_update(pos, objref)
visual_size = {x=0.94, y=0.94} }) visual_size = {x=0.94, y=0.94} })
end end
local function display_updateXL(pos, objref)
local meta = minetest.get_meta(pos)
local text = meta:get_string("text") or ""
text = string.gsub(text, "|", " \n")
local texture = lcdlib.make_multiline_texture(
"default", text,
126, 70, NUM_ROWS, "top", "#000")
objref:set_properties({ textures = {texture},
visual_size = {x=0.94*1.9, y=0.94} })
end
local function on_timer(pos) local function on_timer(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
-- check if display is loaded and a player in front of the display -- check if display is loaded and a player in front of the display
if node.name == "techage:ta4_display" then if node.name == "techage:ta4_display" or node.name == "techage:ta4_displayXL" then
local dir = minetest.facedir_to_dir(Param2ToFacedir[node.param2 % 6]) local dir = minetest.facedir_to_dir(Param2ToFacedir[node.param2 % 6])
local pos2 = vector.add(pos, vector.multiply(dir, RADIUS)) local pos2 = vector.add(pos, vector.multiply(dir, RADIUS))
for _, obj in pairs(minetest.get_objects_inside_radius(pos2, RADIUS)) do for _, obj in pairs(minetest.get_objects_inside_radius(pos2, RADIUS)) do
@ -90,6 +102,51 @@ minetest.register_node("techage:ta4_display", {
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
}) })
local lcd_boxXL = {
type = "fixed",
fixed = {-0.9, -8/16, -8/16, 0.9, -15/32, 8/16}
}
minetest.register_node("techage:ta4_displayXL", {
description = "TA4 Display XL",
inventory_image = 'techage_display_inventoryXL.png',
tiles = {"techage_displayXL.png"},
drawtype = "nodebox",
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "wallmounted",
node_box = lcd_boxXL,
selection_box = lcd_boxXL,
light_source = 6,
display_entities = {
["techage:display_entityXL"] = { depth = 0.42,
on_display_update = display_updateXL},
},
after_place_node = function(pos, placer)
local number = techage.add_node(pos, "techage:ta4_displayXL")
local meta = minetest.get_meta(pos)
meta:set_string("number", number)
meta:set_string("text", "My\nTechage\nTA4\nDisplay\nNo: "..number)
meta:set_int("startscreen", 1)
lcdlib.update_entities(pos)
end,
after_dig_node = function(pos)
techage.remove_node(pos)
end,
on_timer = on_timer,
on_place = lcdlib.on_place,
on_construct = lcdlib.on_construct,
on_destruct = lcdlib.on_destruct,
on_rotate = lcdlib.on_rotate,
groups = {cracky=2, crumbly=2},
is_ground_content = false,
sounds = default.node_sound_glass_defaults(),
})
minetest.register_craft({ minetest.register_craft({
output = "techage:ta4_display", output = "techage:ta4_display",
@ -100,6 +157,14 @@ minetest.register_craft({
}, },
}) })
minetest.register_craft({
output = "techage:ta4_displayXL",
recipe = {
{"techage:ta4_display", "techage:ta4_display"},
{"", ""},
},
})
local function add_line(meta, payload) local function add_line(meta, payload)
local text = meta:get_string("text") local text = meta:get_string("text")
local rows local rows
@ -147,7 +212,6 @@ end
techage.register_node({"techage:ta4_display"}, { techage.register_node({"techage:ta4_display"}, {
on_recv_message = function(pos, src, topic, payload) on_recv_message = function(pos, src, topic, payload)
local node = minetest.get_node(pos)
local timer = minetest.get_node_timer(pos) local timer = minetest.get_node_timer(pos)
if topic == "add" then -- add one line and scroll if necessary if topic == "add" then -- add one line and scroll if necessary
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -171,3 +235,27 @@ techage.register_node({"techage:ta4_display"}, {
end, end,
}) })
techage.register_node({"techage:ta4_displayXL"}, {
on_recv_message = function(pos, src, topic, payload)
local timer = minetest.get_node_timer(pos)
if topic == "add" then -- add one line and scroll if necessary
local meta = minetest.get_meta(pos)
add_line(meta, payload)
if not timer:is_started() then
timer:start(2)
end
elseif topic == "set" then -- overwrite the given row
local meta = minetest.get_meta(pos)
write_row(meta, payload)
if not timer:is_started() then
timer:start(2)
end
elseif topic == "clear" then -- clear the screen
local meta = minetest.get_meta(pos)
meta:set_string("text", "")
if not timer:is_started() then
timer:start(2)
end
end
end,
})

View File

@ -15,6 +15,7 @@
local S = techage.S local S = techage.S
local CYCLE_TIME = 2 local CYCLE_TIME = 2
local RANDOM_VAL = 20
local Cable = techage.ElectricCable local Cable = techage.ElectricCable
local power = techage.power local power = techage.power
local Flowers = {} local Flowers = {}
@ -35,21 +36,31 @@ local Positions = {
local function node_timer(pos, elapsed) local function node_timer(pos, elapsed)
power.consumer_alive(pos, Cable, CYCLE_TIME) power.consumer_alive(pos, Cable, CYCLE_TIME)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
nvm.tick = nvm.tick or math.random(15, 30) local mem = techage.get_mem(pos)
mem.grow_pos = mem.grow_pos or {} -- keep the pos blank for same time
nvm.tick = nvm.tick or math.random(RANDOM_VAL, RANDOM_VAL*2)
nvm.tick = nvm.tick - 1 nvm.tick = nvm.tick - 1
if nvm.tick == 0 then if nvm.tick == 0 then
nvm.tick = math.random(15, 30) nvm.tick = math.random(RANDOM_VAL, RANDOM_VAL*2)
local plant_pos = vector.add(pos, Positions[math.random(1, 9)]) local plant_idx = math.random(1, 9)
local plant_pos = vector.add(pos, Positions[plant_idx])
local soil_pos = {x = plant_pos.x, y = plant_pos.y - 1, z = plant_pos.z} local soil_pos = {x = plant_pos.x, y = plant_pos.y - 1, z = plant_pos.z}
local plant_node = minetest.get_node(plant_pos) local plant_node = minetest.get_node(plant_pos)
local soil_node = minetest.get_node(soil_pos) local soil_node = minetest.get_node(soil_pos)
if soil_node and soil_node.name == "compost:garden_soil" then if soil_node and soil_node.name == "compost:garden_soil" then
if plant_node and plant_node.name == "air" then if plant_node and plant_node.name == "air" then
if mem.grow_pos[plant_idx] then
local idx = math.floor(math.random(1, #Flowers)) local idx = math.floor(math.random(1, #Flowers))
minetest.set_node(plant_pos, {name = Flowers[idx]}) minetest.set_node(plant_pos, {name = Flowers[idx]})
mem.grow_pos[plant_idx] = false
else
mem.grow_pos[plant_idx] = true
end
elseif plant_node and Plants[plant_node.name] then elseif plant_node and Plants[plant_node.name] then
local ndef = minetest.registered_nodes[plant_node.name] local ndef = minetest.registered_nodes[plant_node.name]
ndef.on_timer(plant_pos, 200) ndef.on_timer(plant_pos, 200)
else
mem.grow_pos[plant_idx] = false
end end
end end
end end

View File

@ -41,22 +41,24 @@ minetest.register_node("techage:lightblock", {
groups = {not_in_creative_inventory=1}, groups = {not_in_creative_inventory=1},
}) })
function techage.light_ring(center_pos, on) function techage.light_ring(center_pos, on, large)
if on then
for _,dir in ipairs(Positions) do for _,dir in ipairs(Positions) do
if large then
dir = vector.multiply(dir, 2)
end
local pos1 = vector.add(center_pos, dir) local pos1 = vector.add(center_pos, dir)
local node = techage.get_node_lvm(pos1) local node = techage.get_node_lvm(pos1)
if on then
if node.name == "air" then if node.name == "air" then
minetest.set_node(pos1, {name = "techage:lightblock"}) minetest.set_node(pos1, {name = "techage:lightblock"})
end end
end
else else
if node.name == "techage:lightblock" then
minetest.remove_node(pos1)
end
end
end
local pos1 = {x=center_pos.x-2, y=center_pos.y-2, z=center_pos.z-2} local pos1 = {x=center_pos.x-2, y=center_pos.y-2, z=center_pos.z-2}
local pos2 = {x=center_pos.x+2, y=center_pos.y+2, z=center_pos.z+2} local pos2 = {x=center_pos.x+2, y=center_pos.y+2, z=center_pos.z+2}
for _,pos in ipairs(minetest.find_nodes_in_area(pos1, pos2, "techage:lightblock")) do
minetest.remove_node(pos)
end
minetest.fix_light(pos1, pos2) minetest.fix_light(pos1, pos2)
end
end end

View File

@ -15,7 +15,7 @@
local S = techage.S local S = techage.S
local function on_switch_lamp(pos, on) local function on_switch_lamp(pos, on)
techage.light_ring({x = pos.x, y = pos.y - 3, z = pos.z}, on) techage.light_ring({x = pos.x, y = pos.y - 3, z = pos.z}, on, true)
end end
techage.register_lamp("techage:streetlamp2", { techage.register_lamp("techage:streetlamp2", {

View File

@ -35,7 +35,7 @@ Build derrick=Errichte Ölturm
Compressed Gravel=Komprimiertes Kies Compressed Gravel=Komprimiertes Kies
Consum. 1=Konsum. 1 Consum. 1=Konsum. 1
Consum. 2=Konsum. 2 Consum. 2=Konsum. 2
Current power:=Aktueller Verbrauch: Current power:=Strom aktuell:
Depth=Tiefe Depth=Tiefe
Digging depth=Grabungstiefe Digging depth=Grabungstiefe
Dirt with Ash=Erde mit Asche Dirt with Ash=Erde mit Asche
@ -161,6 +161,7 @@ Send signal if nodes have been:=Sende ein Signal falls Blöcke:
Show all forceload blocks in a 64x64x64 range=Zeige alle Forceload Blöcke im Umkreis von 64x64x64 Blöcken Show all forceload blocks in a 64x64x64 range=Zeige alle Forceload Blöcke im Umkreis von 64x64x64 Blöcken
Sieved Basalt Gravel=Basaltkies gesiebt Sieved Basalt Gravel=Basaltkies gesiebt
Sieved Gravel=Gesiebtes Kies Sieved Gravel=Gesiebtes Kies
Size=Größe
Solar system=Solaranlage Solar system=Solaranlage
Start level=Startebene Start level=Startebene
Start level @= 0@nmeans the same level@nas the quarry is placed=Startebene @= 0@nbedeutet gleiche Ebene@nwie der Steinbrecher Start level @= 0@nmeans the same level@nas the quarry is placed=Startebene @= 0@nbedeutet gleiche Ebene@nwie der Steinbrecher

View File

@ -159,6 +159,7 @@ Send signal if nodes have been:=
Show all forceload blocks in a 64x64x64 range= Show all forceload blocks in a 64x64x64 range=
Sieved Basalt Gravel= Sieved Basalt Gravel=
Sieved Gravel= Sieved Gravel=
Size=
Solar system= Solar system=
Start level= Start level=
Start level @= 0@nmeans the same level@nas the quarry is placed= Start level @= 0@nmeans the same level@nas the quarry is placed=

View File

@ -225,7 +225,6 @@ techage.register_node({"techage:ta4_detector_off", "techage:ta4_detector_on"}, {
is_pusher = true, -- is a pulling/pushing node is_pusher = true, -- is a pulling/pushing node
on_recv_message = function(pos, src, topic, payload) on_recv_message = function(pos, src, topic, payload)
print(topic, payload)
if topic == "count" then if topic == "count" then
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
return nvm.counter or 0 return nvm.counter or 0

View File

@ -59,7 +59,6 @@ for idx,pgn in ipairs(tPgns) do
end end
if fields.exit then if fields.exit then
meta:set_string("formspec", nil) meta:set_string("formspec", nil)
print(node.name)
local number = techage.add_node(pos, node.name) local number = techage.add_node(pos, node.name)
meta:set_string("infotext", S("TechAge Gate Block").." "..number) meta:set_string("infotext", S("TechAge Gate Block").." "..number)
end end

View File

@ -149,11 +149,8 @@ local function write_value(nvm, key, item)
if nvm.data[key] then if nvm.data[key] then
nvm.size = nvm.size - calc_size(nvm.data[key]) nvm.size = nvm.size - calc_size(nvm.data[key])
end end
print(type(item))
if type(item) == "table" then if type(item) == "table" then
print("item1", dump(item))
item = safer_lua.datastruct_to_table(item) item = safer_lua.datastruct_to_table(item)
print("item1", dump(item))
end end
nvm.size = nvm.size + calc_size(item) nvm.size = nvm.size + calc_size(item)
nvm.data[key] = item nvm.data[key] = item

View File

@ -340,8 +340,18 @@ Die Batterie muss in unmittelbarer Nähe zum Controller platziert werden, also a
Das Display zeigt nach dem Platzieren seine Nummer an. Über diese Nummer kann das Display angesprochen werden. Auf dem Display können Texte ausgegeben werden, wobei das Display 5 Zeilen und damit 5 unterschiedliche Texte darstellen kann. Das Display zeigt nach dem Platzieren seine Nummer an. Über diese Nummer kann das Display angesprochen werden. Auf dem Display können Texte ausgegeben werden, wobei das Display 5 Zeilen und damit 5 unterschiedliche Texte darstellen kann.
Das Display wird maximal ein mal pro Sekunde aktualisiert.
[ta4_display|image] [ta4_display|image]
### TA4 Display XL
Das TA4 Display XL hat die doppelte Größ wie das TA4 Display.
Das Display wird maximal alle zwei Sekunden aktualisiert.
[ta4_displayXL|image]
### TA4 Signal Tower ### TA4 Signal Tower
@ -514,6 +524,14 @@ Wird die Kiste mit einem Schieber gefüllt, so füllen sich alle Speicherplätze
Wird die Kiste über einen Schieber geleert, leeren sich auch die Speicher wieder von links nach rechts. Wird die Kiste über einen Schieber geleert, leeren sich auch die Speicher wieder von links nach rechts.
**Stapelfunktion**
Mehrere TA4 8x2000 Kisten können zu einer großen Kiste mit mehr Inhalt verbunden werden. Dazu müssen die Kisten in einer Reihe hintereinander gesetzt werden.
Zuerst muss die Front-Kiste gesetzt werden, dann werden die Stapel-Kisten mit gleicher Blickrichtung dahinter gesetzt (alle Kisten haben die Front in Richtung Spieler). Bei 2 Kisten in Reihe erhöht sich die Größe auf 8x4000, usw.
Die angereihten Kisten können nun nicht mehr entfernt werden. Um die Kisten wieder abbauen zu können, muss zuerst die Frontkiste entfernt werden. Danach können die Kisten der Reihe nach wieder entfernt werden.
Die Kiste kann nur von den Spielern genutzt werden, die an diesem Ort auch bauen können, also Protection Rechte besitzen. Es spielt dabei keine Rolle, wer die Kiste setzt. Die Kiste kann nur von den Spielern genutzt werden, die an diesem Ort auch bauen können, also Protection Rechte besitzen. Es spielt dabei keine Rolle, wer die Kiste setzt.
Der Kiste besitzt ein zusätzliches Kommandos für den Lua Controller: Der Kiste besitzt ein zusätzliches Kommandos für den Lua Controller:

View File

@ -143,6 +143,7 @@
- [TA4 ICTA Controller](./manual_ta4_DE.md#ta4-icta-controller) - [TA4 ICTA Controller](./manual_ta4_DE.md#ta4-icta-controller)
- [Batterie](./manual_ta4_DE.md#batterie) - [Batterie](./manual_ta4_DE.md#batterie)
- [TA4 Display](./manual_ta4_DE.md#ta4-display) - [TA4 Display](./manual_ta4_DE.md#ta4-display)
- [TA4 Display XL](./manual_ta4_DE.md#ta4-display-xl)
- [TA4 Signal Tower](./manual_ta4_DE.md#ta4-signal-tower) - [TA4 Signal Tower](./manual_ta4_DE.md#ta4-signal-tower)
- [TA4 Lua Controller](./manual_ta4_DE.md#ta4-lua-controller) - [TA4 Lua Controller](./manual_ta4_DE.md#ta4-lua-controller)
- [TA4 Lua Server](./manual_ta4_DE.md#ta4-lua-server) - [TA4 Lua Server](./manual_ta4_DE.md#ta4-lua-server)

View File

@ -334,7 +334,6 @@ function techage.explore.dec_oil_amount(posC)
if idx <= (OIL_BUBBLE_SIZE - 256) then -- first level is stone, too if idx <= (OIL_BUBBLE_SIZE - 256) then -- first level is stone, too
local pos = calc_vmdata_pos(posC, idx) local pos = calc_vmdata_pos(posC, idx)
local node = techage.get_node_lvm(pos) local node = techage.get_node_lvm(pos)
print(idx, P2S(pos), node.name)
if node.name == "techage:oil_source" then if node.name == "techage:oil_source" then
minetest.remove_node(pos) minetest.remove_node(pos)
end end

View File

@ -50,13 +50,13 @@ local function stop_consumer(tbl, tlib_type)
end end
end end
local function get_generator_sum(tbl, tlib_type) local function get_generator_sum(tbl, tlib_type, cycle_time)
local sum = 0 local sum = 0
for _,v in ipairs(tbl or {}) do for _,v in ipairs(tbl or {}) do
local nvm = techage.get_nvm(v.pos) local nvm = techage.get_nvm(v.pos)
local def = nvm[tlib_type] -- power related network data local def = nvm[tlib_type] -- power related network data
if def and def["gstate"] ~= STOPPED then if def and def["gstate"] ~= STOPPED then
def["galive"] = (def["galive"] or 1) - 1 def["galive"] = (def["galive"] or 1) - cycle_time/2
if def["galive"] >= 0 then if def["galive"] >= 0 then
sum = sum + (def.curr_power or v.nominal) sum = sum + (def.curr_power or v.nominal)
end end
@ -65,13 +65,13 @@ local function get_generator_sum(tbl, tlib_type)
return sum return sum
end end
local function get_consumer_sum(tbl, tlib_type) local function get_consumer_sum(tbl, tlib_type, cycle_time)
local sum = 0 local sum = 0
for _,v in ipairs(tbl or {}) do for _,v in ipairs(tbl or {}) do
local nvm = techage.get_nvm(v.pos) local nvm = techage.get_nvm(v.pos)
local def = nvm[tlib_type] -- power related network data local def = nvm[tlib_type] -- power related network data
if def and def["cstate"] ~= STOPPED then if def and def["cstate"] ~= STOPPED then
def["calive"] = (def["calive"] or 1) - 1 def["calive"] = (def["calive"] or 1) - cycle_time/2
if def["calive"] >= 0 then if def["calive"] >= 0 then
sum = sum + v.nominal sum = sum + v.nominal
end end
@ -123,13 +123,13 @@ local function set_taken_values(tbl, taken, tlib_type)
return taken return taken
end end
function techage.power.power_distribution(network, tlib_type, netID) function techage.power.power_distribution(network, tlib_type, netID, cycle_time)
-- calc maximum power values -- calc maximum power values
network.available1 = get_generator_sum(network.gen1, tlib_type) network.available1 = get_generator_sum(network.gen1, tlib_type, cycle_time)
network.available2 = get_generator_sum(network.gen2, tlib_type) network.available2 = get_generator_sum(network.gen2, tlib_type, cycle_time)
network.needed1 = get_consumer_sum(network.con1, tlib_type) network.needed1 = get_consumer_sum(network.con1, tlib_type, cycle_time)
network.needed2 = get_consumer_sum(network.con2, tlib_type) network.needed2 = get_consumer_sum(network.con2, tlib_type, cycle_time)
--print(string.format("%X", netID), network.available1, network.available2, network.needed1, network.needed2, network.alive) --print(string.format("%X", netID), network.available1, network.available2, network.needed1, network.needed2)
-- store results -- store results
network.on = network.available1 + network.available2 >= network.needed1 network.on = network.available1 + network.available2 >= network.needed1

View File

@ -91,6 +91,15 @@ local function trigger_network(pos, outdir, Cable)
end end
end end
local function build_network_consumer(pos, Cable)
local outdirs = techage.networks.get_node_connections(pos, Cable.tube_type)
if #outdirs == 1 then
local netID = determine_netID(pos, outdirs[1], Cable)
store_netID(pos, outdirs[1], netID, Cable)
networks.build_network(pos, outdirs[1], Cable, netID)
end
end
-- To be called from each node via 'tubelib2_on_update2' -- To be called from each node via 'tubelib2_on_update2'
-- 'output' is optional and only needed for nodes with dedicated -- 'output' is optional and only needed for nodes with dedicated
-- pipe sides (e.g. pumps). -- pipe sides (e.g. pumps).
@ -160,14 +169,12 @@ function techage.power.consumer_alive(pos, Cable, cycle_time)
local nvm = techage.get_nvm(pos) local nvm = techage.get_nvm(pos)
local def = nvm[Cable.tube_type] -- power related network data local def = nvm[Cable.tube_type] -- power related network data
if def then if def then
if not def["netID"] or not networks.get_network(Cable.tube_type, def["netID"]) then
build_network_consumer(pos, Cable)
end
local rv = (cycle_time / 2) + 1 local rv = (cycle_time / 2) + 1
if def["netID"] and def["calive"] and def["calive"] < rv then -- network available if def["netID"] and def["calive"] and def["calive"] < rv then -- network available
def["calive"] = rv def["calive"] = rv
def["still_runing"] = true
return def["taken"] or 0
elseif def["still_runing"] then
def["calive"] = rv
def["still_runing"] = false
return def["taken"] or 0 return def["taken"] or 0
elseif not def["cstate"] or def["cstate"] == RUNNING then elseif not def["cstate"] or def["cstate"] == RUNNING then
local ndef = net_def(pos, Cable.tube_type) local ndef = net_def(pos, Cable.tube_type)

View File

@ -22,7 +22,7 @@ local HEX = function(val) return string.format("%XH", val) end
local power = techage.power local power = techage.power
local networks = techage.networks local networks = techage.networks
local CYCLE_TIME = 1.8 local CYCLE_TIME = 1
techage.schedule = {} techage.schedule = {}
@ -57,7 +57,7 @@ minetest.register_globalstep(function(dtime)
while item do while item do
local network = networks.peek_network(item.tube_type, item.netID) local network = networks.peek_network(item.tube_type, item.netID)
if network and network.alive and network.alive >= 0 then if network and network.alive and network.alive >= 0 then
power.power_distribution(network, item.tube_type, item.netID) power.power_distribution(network, item.tube_type, item.netID, CYCLE_TIME)
network.alive = network.alive - 1 network.alive = network.alive - 1
push(item) push(item)
else else
@ -74,6 +74,9 @@ end)
function techage.schedule.start(tube_type, netID) function techage.schedule.start(tube_type, netID)
if not JobTable[netID] then if not JobTable[netID] then
local network = networks.peek_network(tube_type, netID)
power.power_distribution(network, tube_type, netID, CYCLE_TIME/2)
network.alive = network.alive - 1
push({tube_type = tube_type, netID = netID}) push({tube_type = tube_type, netID = netID})
JobTable[netID] = true JobTable[netID] = true
end end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B