fuell cell and electrolyzer added
power improvements
@ -10,7 +10,7 @@ local Cable = techage.ElectricCable
|
||||
local power = techage.power
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
|
@ -20,7 +20,7 @@ local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local S2P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).consumer end
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
|
||||
local S = techage.S
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
local M = minetest.get_meta
|
||||
local N = minetest.get_node
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).consumer end
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
|
||||
local S = techage.S
|
||||
|
||||
@ -37,7 +37,7 @@ local FilterCache = {} -- local cache for filter settings
|
||||
|
||||
local function filter_settings(pos)
|
||||
local meta = M(pos)
|
||||
local param2 = minetest.get_node(pos).param2
|
||||
local param2 = techage.get_node_lvm(pos).param2
|
||||
local inv = meta:get_inventory()
|
||||
local filter = minetest.deserialize(meta:get_string("filter")) or {false,false,false,false}
|
||||
local ItemFilter = {} -- {<item:name> = {dir,...}]
|
||||
|
@ -15,7 +15,7 @@
|
||||
-- for lazy programmers
|
||||
local M = minetest.get_meta
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).consumer end
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
|
||||
local S = techage.S
|
||||
local STANDBY_TICKS = 10
|
||||
|
@ -17,7 +17,7 @@ local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).consumer end
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
|
||||
local STANDBY_TICKS = 10
|
||||
local COUNTDOWN_TICKS = 10
|
||||
@ -73,7 +73,7 @@ end
|
||||
|
||||
|
||||
local function get_water_level(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if minetest.get_item_group(node.name, "water") > 0 then
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
if ndef and ndef.liquidtype == "flowing" then
|
||||
|
@ -17,7 +17,7 @@ local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).consumer end
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
|
||||
local STANDBY_TICKS = 10
|
||||
local COUNTDOWN_TICKS = 10
|
||||
|
@ -15,7 +15,7 @@
|
||||
-- for lazy programmers
|
||||
local M = minetest.get_meta
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).consumer end
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
|
||||
local S = techage.S
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
-- for lazy programmers
|
||||
local M = minetest.get_meta
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).consumer end
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
|
||||
local S = techage.S
|
||||
|
||||
@ -76,7 +76,7 @@ end
|
||||
local function sample_liquid(pos, crd, mem, inv)
|
||||
local meta = M(pos)
|
||||
local water_pos = minetest.string_to_pos(meta:get_string("water_pos"))
|
||||
local giving_back = test_liquid(minetest.get_node(water_pos))
|
||||
local giving_back = test_liquid(techage.get_node_lvm(water_pos))
|
||||
if giving_back then
|
||||
if inv:room_for_item("dst", ItemStack(giving_back)) and
|
||||
inv:contains_item("src", ItemStack("bucket:bucket_empty")) then
|
||||
|
@ -27,7 +27,7 @@ local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).consumer end
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
|
||||
local STANDBY_TICKS = 10
|
||||
local COUNTDOWN_TICKS = 10
|
||||
|
@ -79,7 +79,7 @@ local function check_space(pos, param2, AssemblyPlan, player_name)
|
||||
return false
|
||||
end
|
||||
|
||||
local node = minetest.get_node(pos1)
|
||||
local node = techage.get_node_lvm(pos1)
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
if not ndef or ndef.walkable and node.name ~= node_name then
|
||||
minetest.chat_send_player(player_name, S("[TA] Not enough space!"))
|
||||
|
@ -25,7 +25,7 @@ local M = minetest.get_meta
|
||||
local D = techage.Debug
|
||||
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).consumer end
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
local CRDN = function(node) return (minetest.registered_nodes[node.name] or {}).consumer end
|
||||
|
||||
local power = techage.power
|
||||
@ -242,7 +242,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local meta = M(pos)
|
||||
local mem = tubelib2.init_mem(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
meta:set_int("push_dir", techage.side_to_indir("L", node.param2))
|
||||
meta:set_int("pull_dir", techage.side_to_indir("R", node.param2))
|
||||
local number = "-"
|
||||
|
@ -119,7 +119,7 @@ function techage.firebox.on_rightclick(pos, node, clicker)
|
||||
end
|
||||
|
||||
function techage.firebox.swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
|
@ -45,7 +45,7 @@ Node states:
|
||||
| cycle time operational needs power
|
||||
+---------+------------+-------------+-------------
|
||||
| RUNNING normal yes yes
|
||||
| BLOCKED long yes yes
|
||||
| BLOCKED long yes no
|
||||
| STANDBY long yes no
|
||||
| NOPOWER long no no
|
||||
| FAULT none no no
|
||||
@ -91,7 +91,7 @@ function techage.state_button(state)
|
||||
end
|
||||
|
||||
function techage.get_power_image(pos, mem)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
local s = "3" -- electrical power
|
||||
if string.find(node.name, "techage:ta2") then
|
||||
s = "2" -- axles power
|
||||
@ -130,7 +130,7 @@ local function has_power(pos, mem)
|
||||
end
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
@ -191,6 +191,15 @@ function NodeStates:node_init(pos, mem, number)
|
||||
end
|
||||
end
|
||||
|
||||
-- to be used to re-start the timer outside of node_timer()
|
||||
local function start_timer_delayed(pos, cycle_time)
|
||||
local t = minetest.get_node_timer(pos)
|
||||
t:stop()
|
||||
if cycle_time > 0.9 then
|
||||
minetest.after(0.1, t.start, t, cycle_time)
|
||||
end
|
||||
end
|
||||
|
||||
function NodeStates:stop(pos, mem)
|
||||
local state = mem.techage_state or STOPPED
|
||||
mem.techage_state = STOPPED
|
||||
@ -249,20 +258,12 @@ function NodeStates:start(pos, mem)
|
||||
if self.on_state_change then
|
||||
self.on_state_change(pos, state, RUNNING)
|
||||
end
|
||||
minetest.get_node_timer(pos):start(self.cycle_time)
|
||||
start_timer_delayed(pos, self.cycle_time)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- to be used from node timer functions
|
||||
function NodeStates:start_from_timer(pos, mem)
|
||||
local state = mem.techage_state or STOPPED
|
||||
if state ~= RUNNING and state ~= FAULT then
|
||||
minetest.after(0.1, self.start, self, pos, mem)
|
||||
end
|
||||
end
|
||||
|
||||
function NodeStates:standby(pos, mem)
|
||||
local state = mem.techage_state or STOPPED
|
||||
if state == RUNNING then
|
||||
@ -277,13 +278,10 @@ function NodeStates:standby(pos, mem)
|
||||
if self.formspec_func then
|
||||
M(pos):set_string("formspec", self.formspec_func(self, pos, mem))
|
||||
end
|
||||
if minetest.get_node_timer(pos):is_started() then
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end
|
||||
if self.on_state_change then
|
||||
self.on_state_change(pos, state, STANDBY)
|
||||
end
|
||||
minetest.get_node_timer(pos):start(self.cycle_time * self.standby_ticks)
|
||||
start_timer_delayed(pos, self.cycle_time * self.standby_ticks)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
@ -304,13 +302,10 @@ function NodeStates:blocked(pos, mem)
|
||||
if self.formspec_func then
|
||||
M(pos):set_string("formspec", self.formspec_func(self, pos, mem))
|
||||
end
|
||||
if minetest.get_node_timer(pos):is_started() then
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end
|
||||
if self.on_state_change then
|
||||
self.on_state_change(pos, state, BLOCKED)
|
||||
end
|
||||
minetest.get_node_timer(pos):start(self.cycle_time * self.standby_ticks)
|
||||
start_timer_delayed(pos, self.cycle_time * self.standby_ticks)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
@ -333,7 +328,7 @@ function NodeStates:nopower(pos, mem)
|
||||
if self.on_state_change then
|
||||
self.on_state_change(pos, state, NOPOWER)
|
||||
end
|
||||
minetest.get_node_timer(pos):start(self.cycle_time * self.standby_ticks)
|
||||
start_timer_delayed(pos, self.cycle_time * self.standby_ticks)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
@ -394,7 +389,9 @@ end
|
||||
-- and keep the node in state RUNNING
|
||||
function NodeStates:keep_running(pos, mem, val, num_items)
|
||||
-- set to RUNNING if not already done
|
||||
self:start_from_timer(pos, mem)
|
||||
if mem.techage_state ~= RUNNING then
|
||||
self:start(pos, mem)
|
||||
end
|
||||
mem.techage_countdown = val or 4
|
||||
mem.techage_item_meter = (mem.techage_item_meter or 0) + (num_items or 1)
|
||||
end
|
||||
@ -431,7 +428,7 @@ function NodeStates:on_receive_message(pos, topic, payload)
|
||||
self:stop(pos, tubelib2.get_mem(pos))
|
||||
return true
|
||||
elseif topic == "state" then
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == "ignore" then -- unloaded node?
|
||||
return "unloaded"
|
||||
end
|
||||
@ -461,7 +458,7 @@ function NodeStates:on_node_load(pos, not_start_timer)
|
||||
local number = M(pos):get_string("node_number")
|
||||
if number == "" then
|
||||
minetest.log("warning", "[TA] Node at "..S(pos).." has no node_number")
|
||||
local name = minetest.get_node(pos).name
|
||||
local name = techage.get_node_lvm(pos).name
|
||||
local number = techage.add_node(pos, name)
|
||||
self:node_init(pos, mem, number)
|
||||
return
|
||||
|
@ -66,6 +66,7 @@ local State = techage.NodeStates:new({
|
||||
|
||||
local function node_timer(pos, elapsed)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
print("akku", mem.running, mem.delivered, mem.capa)
|
||||
if mem.running then
|
||||
mem.delivered = power.secondary_alive(pos, mem, mem.capa, PWR_CAPA)
|
||||
mem.capa = mem.capa - mem.delivered
|
||||
|
@ -24,7 +24,7 @@ local function transfer(pos, in_dir, topic, payload)
|
||||
end
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
|
@ -23,7 +23,7 @@ local CYCLE_TIME = 2
|
||||
local BURN_CYCLE_FACTOR = 0.5
|
||||
|
||||
local function firehole(pos, on)
|
||||
local param2 = minetest.get_node(pos).param2
|
||||
local param2 = techage.get_node_lvm(pos).param2
|
||||
local pos2 = techage.get_pos(pos, 'F')
|
||||
if on == true then
|
||||
minetest.swap_node(pos2, {name="techage:coalfirehole_on", param2 = param2})
|
||||
|
@ -35,6 +35,8 @@ local function collect_network_data(pos, mem)
|
||||
solar = {},
|
||||
akku = {},
|
||||
stor = {},
|
||||
elec = {},
|
||||
fcel = {},
|
||||
}
|
||||
local add = function(kind, attr, val)
|
||||
data[kind][attr] = (data[kind][attr] or 0) + (val or 0)
|
||||
@ -51,11 +53,11 @@ local function collect_network_data(pos, mem)
|
||||
add("fuel", "curr", mem.provided)
|
||||
elseif node.name == "techage:ta3_akku" then
|
||||
add("akku", "num", 1)
|
||||
add("akku", "nomi", mem.pwr_available2)
|
||||
add("akku", "nomi", mem.pwr_could_provide)
|
||||
add("akku", "curr", mem.delivered)
|
||||
elseif node.name == "techage:heatexchanger1" then
|
||||
add("stor", "num", 1)
|
||||
add("stor", "nomi", mem.pwr_available2)
|
||||
add("stor", "nomi", mem.pwr_could_provide)
|
||||
add("stor", "curr", mem.delivered)
|
||||
elseif node.name == "techage:tiny_generator" or node.name == "techage:tiny_generator_on" then
|
||||
add("fuel", "num", 1)
|
||||
@ -69,6 +71,14 @@ local function collect_network_data(pos, mem)
|
||||
add("wind", "num", 1)
|
||||
add("wind", "nomi", mem.pwr_available)
|
||||
add("wind", "curr", mem.delivered)
|
||||
elseif node.name == "techage:ta4_fuelcell" or node.name == "techage:ta4_fuelcell_on" then
|
||||
add("fcel", "num", 1)
|
||||
add("fcel", "nomi", mem.pwr_available)
|
||||
add("fcel", "curr", mem.provided)
|
||||
elseif node.name == "techage:ta4_electrolyzer" or node.name == "techage:ta4_electrolyzer_on" then
|
||||
add("elec", "num", 1)
|
||||
add("elec", "nomi", -mem.pwr_could_need)
|
||||
add("elec", "curr", -mem.consumed)
|
||||
end
|
||||
end
|
||||
)
|
||||
@ -89,19 +99,21 @@ local function formspec(pos)
|
||||
if nnodes > (techage.MAX_NUM_NODES - 50) then
|
||||
alarm = " (max. "..(techage.MAX_NUM_NODES).." !!!)"
|
||||
end
|
||||
return "size[10,6.5]"..
|
||||
return "size[10,7.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"label[2,0.0;"..S("Network Data").."]"..
|
||||
"label[3,0.7;"..S("(number / current / max.)").."]"..
|
||||
"label[0,1.4;"..S("Power Fuel")..":]".. "label[4,1.4;"..get("fuel").."]"..
|
||||
"label[0,2.1;"..S("Power Solar")..":]".. "label[4,2.1;"..get("solar").."]"..
|
||||
"label[0,2.8;"..S("Power Wind")..":]".. "label[4,2.8;"..get("wind").."]"..
|
||||
"label[0,3.5;"..S("Power Storage")..":]".."label[4,3.5;"..get("stor").."]"..
|
||||
"label[0,4.2;"..S("Power Akkus")..":]".. "label[4,4.2;"..get("akku").."]"..
|
||||
"label[0,4.9;"..S("Number nodes").." : "..nnodes..alarm.."]"..
|
||||
"button[2.5,5.8;2,1;update;"..S("Update").."]"
|
||||
"label[0,1.4;"..S("TA3 Coal/oil")..":]".. "label[5,1.4;"..get("fuel").."]"..
|
||||
"label[0,2.1;"..S("TA3 Akku")..":]".. "label[5,2.1;"..get("akku").."]"..
|
||||
"label[0,2.8;"..S("TA4 Solar Inverter")..":]".. "label[5,2.8;"..get("solar").."]"..
|
||||
"label[0,3.5;"..S("TA4 Wind Turbine")..":]".. "label[5,3.5;"..get("wind").."]"..
|
||||
"label[0,4.2;"..S("TA4 Energy Storage")..":]".. "label[5,4.2;"..get("stor").."]"..
|
||||
"label[0,4.9;"..S("TA4 Electrolyzer")..":]".. "label[5,4.9;"..get("elec").."]"..
|
||||
"label[0,5.6;"..S("TA4 Fuel Cell")..":]".. "label[5,5.6;"..get("fcel").."]"..
|
||||
"label[0,6.3;"..S("Number of nodes").." : "..nnodes..alarm.."]"..
|
||||
"button[2.5,6.8;2,1;update;"..S("Update").."]"
|
||||
end
|
||||
|
||||
local function update_formspec(pos)
|
||||
|
@ -29,7 +29,7 @@ local function transfer_generator(pos, topic, payload)
|
||||
end
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
|
@ -111,5 +111,8 @@ techage.Items = {
|
||||
ta4_solarcarrier = "techage:ta4_solar_carrier",
|
||||
ta4_solar_inverter = "techage:ta4_solar_inverter",
|
||||
techage_ta4_solar = "techage_ta4_solar.png",
|
||||
ta4_hydrogen = "techage_hydrogen_inv.png",
|
||||
ta4_electrolyzer = "techage:ta4_electrolyzer",
|
||||
ta4_fuelcell = "techage:ta4_fuelcell",
|
||||
--ta4_ "",
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ techage.manual_DE = {}
|
||||
techage.manual_DE.aTitel = {
|
||||
"1,Tech Age Mod",
|
||||
"2,Hinweise",
|
||||
"2,History",
|
||||
"1,TA1: Eisenzeitalter",
|
||||
"2,Köhler / Coal Pile",
|
||||
"2,Kohlebrenner / Coal Burner",
|
||||
@ -110,6 +111,9 @@ techage.manual_DE.aTitel = {
|
||||
"3,TA4 Turbine",
|
||||
"3,TA4 Generator",
|
||||
"3,TA4 Röhre / Pipe",
|
||||
"2,Wasserstoff",
|
||||
"3,Elektrolyseur",
|
||||
"3,Brennstoffzelle",
|
||||
}
|
||||
|
||||
techage.manual_DE.aText = {
|
||||
@ -144,6 +148,9 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"Mit TA4 kommen weitere Stromquellen dazu\\, aber auch höhere logistische Herausforderungen (Stromtrassen\\, Item Transport).\n"..
|
||||
"\n",
|
||||
" - 28.09.2019: Um Solaranlage erweitert\n"..
|
||||
" - 05.10.2019: Daten zur Solaranlage und Beschreibung zum Wechselrichter und zum Power-Terminal geändert\n"..
|
||||
"\n",
|
||||
"In TA1 geht es darum\\, mit einfachen Werkzeugen und Gerätschaften ausreichend Erze zu schürfen und Holzkohle herzustellen\\, so dass damit TA2 Maschinen hergestellt und betrieben werden können.\n"..
|
||||
"\n"..
|
||||
"Natürlich muss es für ein Eisenzeitalter auch Eisen geben und nicht nur Stahl (steel)\\, wie in \"Minetest Game\". Daher wurden einige Rezepte geändert\\, so dass zuerst Eisen hergestellt werden muss und erst später dann Stahl.\n"..
|
||||
@ -801,6 +808,8 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"Die kleinste Einheit bei einer Solaranlage sind zwei Solarmodule und ein Trägermodul. Das Trägermodul muss zuerst gesetzt werden\\, die zwei Solarmodule dann links und rechts daneben (nicht darüber!).\n"..
|
||||
"\n"..
|
||||
"Der Plan rechts zeigt 3 Einheiten mit je zwei Solarmodulen und einem Trägermodul\\, über rote Kabel mit dem Wechselrichter verbunden.\n"..
|
||||
"\n"..
|
||||
"Solarmodule liefern Gleichspannung\\, welcher nicht direkt in das Stromnetz eingespeist werden kann. Daher müssen zuerst die Solareinheiten über das rote Kabel mit dem Wechselrichter verbunden werden. Dieser besteht aus zwei Blöcken\\, einen für das rote Kabel zu den Solarmodulen (DC) und einen für das graue Stromkabel ins Stromnetz (AC).\n"..
|
||||
"\n"..
|
||||
"Der Kartenbereich\\, wo die Solaranlage steht\\, muss komplett geladen sein. Es empfiehlt sich daher\\, zuerst einen Forceload Block zu setzen\\, und dann innerhalb dieses Bereiches die Module zu platzieren.\n"..
|
||||
@ -820,6 +829,7 @@ techage.manual_DE.aText = {
|
||||
"\n",
|
||||
"Der Wechselrichter wandelt den Solarstrom (DC) in Wechselstrom (AC) um\\, so dass dieser in das Stromnetz eingespeist werden kann.\n"..
|
||||
"Ein Wechselrichter\\, bestehend aus zwei Blöcken kann maximal 100 ku an Strom einspeisen\\, was 33 Solarmodulen oder auch mehr entspricht.\n"..
|
||||
"Der DC Block muss links neben den AC-Block gesetzt werden.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
@ -877,11 +887,36 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Strom kann mittels Elektrolyse in Wasserstoff und Sauerstoff aufgespalten werden. Auf der anderen Seite kann über eine Brennstoffzelle Wasserstoff mit Sauerstoff aus der Luft wieder in Strom umgewandelt werden.\n"..
|
||||
"Damit können Stromspitzen oder ein Überangebot an Strom in Wasserstoff umgewandelt und so gespeichert werden.\n"..
|
||||
"\n"..
|
||||
"Im Spiel kann Strom mit Hilfe des Elektrolyseurs in Wasserstoff-Items und Wasserstoff-Items über die Brennstoffzelle wieder in Strom umgewandelt werden.\n"..
|
||||
"Damit kann Strom (in Form von Wasserstoff-Items) nicht nur in Kisten gelagert\\, sonder auch über Wagen (carts) oder Röhren transportiert werden.\n"..
|
||||
"\n"..
|
||||
"Die Umwandlung von Strom in Wasserstoff und zurück ist aber verlustbehaftet. Von 100 Einheiten Strom kommen nach der Umwandlung in Wasserstoff und zurück nur 75 Einheiten Strom wieder raus.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Der Elektrolyseur wandelt Strom in Wasserstoff um.\n"..
|
||||
"Es muss von links mit Strom versorgt werden. Rechts können die Wasserstoff-Items per Schieber entnommen werden.\n"..
|
||||
"\n"..
|
||||
"Der Elektrolyseur kann bis zu 40 ku an Strom aufnehmen und generiert alle 8 s ein Wasserstoff Item.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Die Brennstoffzelle wandelt Wasserstoff in Strom um.\n"..
|
||||
"Sie muss von links per Schieber mit Wasserstoff-Items versorgt werden. Rechts ist der Stromanschluss.\n"..
|
||||
"\n"..
|
||||
"Die Brennstoffzelle kann bis zu 40 ku an Strom abgeben und benötigt dazu alle 6 s ein Wasserstoff Item.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
}
|
||||
|
||||
techage.manual_DE.aItemName = {
|
||||
"wlanchip",
|
||||
"",
|
||||
"",
|
||||
"techage_ta1",
|
||||
"",
|
||||
"",
|
||||
@ -989,12 +1024,16 @@ techage.manual_DE.aItemName = {
|
||||
"ta4_turbine",
|
||||
"ta4_generator",
|
||||
"ta4_pipe",
|
||||
"ta4_hydrogen",
|
||||
"ta4_electrolyzer",
|
||||
"ta4_fuelcell",
|
||||
}
|
||||
|
||||
techage.manual_DE.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"coalpile",
|
||||
"coalburner",
|
||||
"",
|
||||
@ -1101,5 +1140,8 @@ techage.manual_DE.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ local Cable = techage.ElectricCable
|
||||
local power = techage.power
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
|
@ -87,7 +87,7 @@ local function stop_sound(pos)
|
||||
end
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
@ -113,6 +113,21 @@ local function charging(pos, mem, is_charging)
|
||||
end
|
||||
end
|
||||
|
||||
local function delivering(pos, mem, delivered)
|
||||
print("delivering", delivered, mem.had_delivered)
|
||||
if mem.capa <= 0 then
|
||||
return
|
||||
end
|
||||
if delivered ~= mem.had_delivered then
|
||||
mem.had_delivered = delivered
|
||||
if delivered > 0 then
|
||||
turbine_cmnd(pos, "start")
|
||||
elseif delivered == 0 then
|
||||
turbine_cmnd(pos, "stop")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function glowing(pos, mem, should_glow)
|
||||
if mem.win_pos then
|
||||
if should_glow then
|
||||
@ -171,9 +186,9 @@ local function start_node(pos, mem, state)
|
||||
mem.running = true
|
||||
mem.delivered = 0
|
||||
mem.was_charging = true
|
||||
mem.had_delivered = nil
|
||||
play_sound(pos)
|
||||
mem.win_pos = inlet_cmnd(pos, "window")
|
||||
turbine_cmnd(pos, "start")
|
||||
power.secondary_start(pos, mem, PWR_PERF, PWR_PERF)
|
||||
end
|
||||
|
||||
@ -204,6 +219,7 @@ local function node_timer(pos, elapsed)
|
||||
mem.capa = in_range(mem.capa, 0, mem.capa_max)
|
||||
glowing(pos, mem, mem.capa > mem.capa_max * 0.8)
|
||||
charging(pos, mem, mem.delivered < 0)
|
||||
delivering(pos, mem, mem.delivered)
|
||||
end
|
||||
return mem.running
|
||||
end
|
||||
|
@ -21,7 +21,7 @@ local CYCLE_TIME = 2
|
||||
local Pipe = techage.BiogasPipe
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
|
@ -28,7 +28,7 @@ local function infotext(pos, state)
|
||||
end
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
|
@ -18,7 +18,7 @@ local S = techage.S
|
||||
local D = techage.Debug
|
||||
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).consumer end
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
|
||||
local STANDBY_TICKS = 6
|
||||
local COUNTDOWN_TICKS = 6
|
||||
|
270
hydrogen/electrolyzer.lua
Normal file
@ -0,0 +1,270 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019 Joachim Stolberg
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA4 Electrolyzer
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local Power = techage.ElectricCable
|
||||
local power = techage.power
|
||||
|
||||
local CYCLE_TIME = 2
|
||||
local STANDBY_TICKS = 5
|
||||
local PWR_NEEDED = 40
|
||||
local PWR_UNITS_PER_HYDROGEN_ITEM = 320
|
||||
|
||||
local function formspec(self, pos, mem)
|
||||
return "size[8,6.6]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"image[0.5,0;1,2;"..power.formspec_power_bar(PWR_NEEDED, mem.consumed).."]"..
|
||||
"label[0.7,1.9;"..S("\\[ku\\]").."]"..
|
||||
"image[3,0;1,1;techage_form_arrow_fg.png^[transformR270]"..
|
||||
"image_button[4,1;1,1;".. self:get_state_button_image(mem) ..";state_button;]"..
|
||||
"button[2.1,1;1.8,1;update;"..S("Update").."]"..
|
||||
"list[context;dst;5.5,0;2,2;]"..
|
||||
"list[current_player;main;0,2.8;8,4;]" ..
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;dst]" ..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 2.8)
|
||||
end
|
||||
|
||||
local function start_node(pos, mem, state)
|
||||
mem.running = true
|
||||
mem.consumed = 0
|
||||
power.secondary_start(pos, mem, PWR_NEEDED, PWR_NEEDED)
|
||||
end
|
||||
|
||||
local function stop_node(pos, mem, state)
|
||||
mem.running = false
|
||||
mem.consumed = 0
|
||||
power.secondary_stop(pos, mem)
|
||||
end
|
||||
|
||||
local State = techage.NodeStates:new({
|
||||
node_name_passive = "techage:ta4_electrolyzer",
|
||||
node_name_active = "techage:ta4_electrolyzer_on",
|
||||
cycle_time = CYCLE_TIME,
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
formspec_func = formspec,
|
||||
infotext_name = "TA4 Electrolyzer",
|
||||
start_node = start_node,
|
||||
stop_node = stop_node,
|
||||
})
|
||||
|
||||
local function add_hydrogen(pos)
|
||||
local inv = M(pos):get_inventory()
|
||||
local leftover = inv:add_item("dst", ItemStack("techage:hydrogen"))
|
||||
return leftover:get_count() == 0
|
||||
end
|
||||
|
||||
local function room_for_hydrogen(pos)
|
||||
local inv = M(pos):get_inventory()
|
||||
return inv:room_for_item("dst", ItemStack("techage:hydrogen"))
|
||||
end
|
||||
|
||||
-- converts power into hydrogen
|
||||
local function node_timer(pos, elapsed)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
mem.num_pwr_units = mem.num_pwr_units or 0
|
||||
--print("electrolyzer", mem.running, mem.consumed, mem.num_pwr_units, techage.get_state_string(mem))
|
||||
if mem.running then
|
||||
if techage.needs_power(mem) then
|
||||
mem.consumed = -power.secondary_alive(pos, mem, 0, 1)
|
||||
--print("mem.consumed", mem.consumed)
|
||||
if mem.consumed > 0 then
|
||||
mem.num_pwr_units = mem.num_pwr_units + mem.consumed
|
||||
if mem.num_pwr_units >= PWR_UNITS_PER_HYDROGEN_ITEM then
|
||||
if add_hydrogen(pos) then
|
||||
mem.num_pwr_units = mem.num_pwr_units - PWR_UNITS_PER_HYDROGEN_ITEM
|
||||
State:keep_running(pos, mem, 1, 0) -- count items
|
||||
else
|
||||
State:blocked(pos, mem)
|
||||
power.secondary_stop(pos, mem)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
mem.consumed = -power.secondary_alive(pos, mem, 1, 1)
|
||||
if room_for_hydrogen(pos) then
|
||||
State:start(pos, mem)
|
||||
power.secondary_start(pos, mem, PWR_NEEDED, PWR_NEEDED)
|
||||
end
|
||||
end
|
||||
end
|
||||
return mem.running
|
||||
end
|
||||
|
||||
local function on_receive_fields(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
State:state_button_event(pos, mem, fields)
|
||||
|
||||
if fields.update then
|
||||
M(pos):set_string("formspec", formspec(State, pos, mem))
|
||||
end
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
if stack:get_name() == "techage:hydrogen" then
|
||||
return stack:get_count()
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
local function on_rightclick(pos)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
M(pos):set_string("formspec", formspec(State, pos, mem))
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta4_electrolyzer", {
|
||||
description = S("TA4 Electrolyzer"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_arrow.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_outp.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_hole_electric.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_electrolyzer.png^techage_appl_ctrl_unit.png^[transformFX",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_electrolyzer.png^techage_appl_ctrl_unit.png",
|
||||
},
|
||||
|
||||
on_construct = function(pos)
|
||||
local mem = tubelib2.init_mem(pos)
|
||||
local number = techage.add_node(pos, "techage:ta4_electrolyzer")
|
||||
mem.running = false
|
||||
mem.num_pwr_units = 0
|
||||
State:node_init(pos, mem, number)
|
||||
local meta = M(pos)
|
||||
meta:set_string("formspec", formspec(State, pos, mem))
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('dst', 4)
|
||||
end,
|
||||
|
||||
can_dig = function(pos, player)
|
||||
local inv = M(pos):get_inventory()
|
||||
return inv:is_empty("dst")
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = allow_metadata_inventory,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory,
|
||||
on_receive_fields = on_receive_fields,
|
||||
on_timer = node_timer,
|
||||
on_rightclick = on_rightclick,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2, crumbly=2, choppy=2},
|
||||
on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
})
|
||||
|
||||
minetest.register_node("techage:ta4_electrolyzer_on", {
|
||||
description = S("TA4 Electrolyzer"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_arrow.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_outp.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_hole_electric.png",
|
||||
{
|
||||
image = "techage_filling4_ta4.png^techage_frame4_ta4.png^techage_appl_electrolyzer4.png^techage_appl_ctrl_unit4.png^[transformFX",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 32,
|
||||
aspect_h = 32,
|
||||
length = 0.8,
|
||||
},
|
||||
},
|
||||
{
|
||||
image = "techage_filling4_ta4.png^techage_frame4_ta4.png^techage_appl_electrolyzer4.png^techage_appl_ctrl_unit4.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 32,
|
||||
aspect_h = 32,
|
||||
length = 0.8,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
allow_metadata_inventory_put = allow_metadata_inventory,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory,
|
||||
on_receive_fields = on_receive_fields,
|
||||
on_timer = node_timer,
|
||||
on_rightclick = on_rightclick,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
diggable = false,
|
||||
paramtype = "light",
|
||||
light_source = 6,
|
||||
})
|
||||
|
||||
techage.power.register_node({"techage:ta4_electrolyzer", "techage:ta4_electrolyzer_on"}, {
|
||||
conn_sides = {"L"},
|
||||
power_network = Power,
|
||||
after_place_node = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local indir = techage.side_to_indir("R", node.param2)
|
||||
M(pos):set_int("in_dir", indir)
|
||||
end,
|
||||
})
|
||||
|
||||
techage.register_node({"techage:ta4_electrolyzer", "techage:ta4_electrolyzer_on"}, {
|
||||
on_pull_item = function(pos, in_dir, num)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_int("in_dir") == in_dir then
|
||||
local inv = M(pos):get_inventory()
|
||||
return techage.get_items(inv, "dst", num)
|
||||
end
|
||||
end,
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_int("in_dir") == in_dir then
|
||||
local inv = M(pos):get_inventory()
|
||||
State:start_if_standby(pos)
|
||||
return techage.put_items(inv, "dst", stack)
|
||||
end
|
||||
end,
|
||||
on_unpull_item = function(pos, in_dir, stack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_int("in_dir") == in_dir then
|
||||
local inv = M(pos):get_inventory()
|
||||
return techage.put_items(inv, "dst", stack)
|
||||
end
|
||||
end,
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
return State:on_receive_message(pos, topic, payload)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta4_electrolyzer",
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'dye:blue', 'default:steel_ingot'},
|
||||
{'techage:electric_cableS', 'default:glass', 'techage:tubeS'},
|
||||
{'default:steel_ingot', "techage:ta4_wlanchip", 'default:steel_ingot'},
|
||||
},
|
||||
})
|
||||
|
271
hydrogen/fuelcell.lua
Normal file
@ -0,0 +1,271 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019 Joachim Stolberg
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA4 Fuel Cell
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local Power = techage.ElectricCable
|
||||
local power = techage.power
|
||||
|
||||
local CYCLE_TIME = 2
|
||||
local STANDBY_TICKS = 5
|
||||
local PWR_CAPA = 40
|
||||
local PWR_UNITS_PER_HYDROGEN_ITEM = 240
|
||||
|
||||
local function formspec(self, pos, mem)
|
||||
return "size[8,6.6]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[context;src;0.5,0;2,2;]"..
|
||||
"image[4,0;1,1;techage_form_arrow_fg.png^[transformR270]"..
|
||||
"image_button[5,1;1,1;".. self:get_state_button_image(mem) ..";state_button;]"..
|
||||
"button[3.1,1;1.8,1;update;"..S("Update").."]"..
|
||||
"image[6.5,0;1,2;"..power.formspec_power_bar(PWR_CAPA, mem.provided).."]"..
|
||||
"label[6.7,1.9;"..S("\\[ku\\]").."]"..
|
||||
"list[current_player;main;0,2.8;8,4;]" ..
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;src]" ..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 2.8)
|
||||
end
|
||||
|
||||
local function start_node(pos, mem, state)
|
||||
mem.running = true
|
||||
mem.provided = 0
|
||||
power.generator_start(pos, mem, PWR_CAPA)
|
||||
end
|
||||
|
||||
local function stop_node(pos, mem, state)
|
||||
mem.running = false
|
||||
mem.provided = 0
|
||||
power.generator_stop(pos, mem)
|
||||
end
|
||||
|
||||
local State = techage.NodeStates:new({
|
||||
node_name_passive = "techage:ta4_fuelcell",
|
||||
node_name_active = "techage:ta4_fuelcell_on",
|
||||
cycle_time = CYCLE_TIME,
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
formspec_func = formspec,
|
||||
infotext_name = "TA4 Fuel Cell",
|
||||
start_node = start_node,
|
||||
stop_node = stop_node,
|
||||
})
|
||||
|
||||
local function get_hydrogen(pos)
|
||||
local inv = M(pos):get_inventory()
|
||||
local taken = inv:remove_item("src", ItemStack("techage:hydrogen"))
|
||||
return taken:get_count() > 0
|
||||
end
|
||||
|
||||
local function contains_hydrogen(pos)
|
||||
local inv = M(pos):get_inventory()
|
||||
return inv:contains_item("src", ItemStack("techage:hydrogen"))
|
||||
end
|
||||
|
||||
-- converts hydrogen into power
|
||||
local function node_timer(pos, elapsed)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
mem.num_pwr_units = mem.num_pwr_units or 0
|
||||
--print("fuelcell", mem.running, mem.provided, mem.num_pwr_units, techage.get_state_string(mem))
|
||||
if mem.running then
|
||||
if techage.needs_power(mem) then
|
||||
if mem.num_pwr_units <= 0 then
|
||||
if get_hydrogen(pos) then
|
||||
State:keep_running(pos, mem, 1, 0) -- count items
|
||||
mem.num_pwr_units = mem.num_pwr_units + PWR_UNITS_PER_HYDROGEN_ITEM
|
||||
else
|
||||
State:standby(pos, mem)
|
||||
mem.provided = 0
|
||||
power.generator_stop(pos, mem)
|
||||
M(pos):set_string("formspec", formspec(State, pos, mem))
|
||||
return true
|
||||
end
|
||||
end
|
||||
mem.provided = power.generator_alive(pos, mem)
|
||||
mem.num_pwr_units = mem.num_pwr_units - mem.provided
|
||||
else
|
||||
if contains_hydrogen(pos) then
|
||||
State:start(pos, mem)
|
||||
mem.provided = 0
|
||||
power.generator_start(pos, mem, PWR_CAPA)
|
||||
M(pos):set_string("formspec", formspec(State, pos, mem))
|
||||
end
|
||||
end
|
||||
end
|
||||
return mem.running
|
||||
end
|
||||
|
||||
local function on_receive_fields(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
State:state_button_event(pos, mem, fields)
|
||||
|
||||
if fields.update then
|
||||
M(pos):set_string("formspec", formspec(State, pos, mem))
|
||||
end
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
if stack:get_name() == "techage:hydrogen" then
|
||||
return stack:get_count()
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
local function on_rightclick(pos)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
M(pos):set_string("formspec", formspec(State, pos, mem))
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta4_fuelcell", {
|
||||
description = S("TA4 Fuel Cell"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_arrow.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_hole_electric.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_inp.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_fuelcell.png^techage_appl_ctrl_unit.png^[transformFX",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_fuelcell.png^techage_appl_ctrl_unit.png",
|
||||
},
|
||||
|
||||
on_construct = function(pos)
|
||||
local mem = tubelib2.init_mem(pos)
|
||||
local number = techage.add_node(pos, "techage:ta4_fuelcell")
|
||||
mem.running = false
|
||||
mem.num_pwr_units = 0
|
||||
State:node_init(pos, mem, number)
|
||||
local meta = M(pos)
|
||||
meta:set_string("formspec", formspec(State, pos, mem))
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('src', 4)
|
||||
end,
|
||||
|
||||
can_dig = function(pos, player)
|
||||
local inv = M(pos):get_inventory()
|
||||
return inv:is_empty("src")
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = allow_metadata_inventory,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory,
|
||||
on_receive_fields = on_receive_fields,
|
||||
on_timer = node_timer,
|
||||
on_rightclick = on_rightclick,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2, crumbly=2, choppy=2},
|
||||
on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
})
|
||||
|
||||
minetest.register_node("techage:ta4_fuelcell_on", {
|
||||
description = S("TA4 Fuel Cell"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_arrow.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_hole_electric.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_inp.png",
|
||||
{
|
||||
image = "techage_filling4_ta4.png^techage_frame4_ta4.png^techage_appl_fuelcell4.png^techage_appl_ctrl_unit4.png^[transformFX",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 32,
|
||||
aspect_h = 32,
|
||||
length = 0.8,
|
||||
},
|
||||
},
|
||||
{
|
||||
image = "techage_filling4_ta4.png^techage_frame4_ta4.png^techage_appl_fuelcell4.png^techage_appl_ctrl_unit4.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 32,
|
||||
aspect_h = 32,
|
||||
length = 0.8,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
allow_metadata_inventory_put = allow_metadata_inventory,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory,
|
||||
on_receive_fields = on_receive_fields,
|
||||
on_timer = node_timer,
|
||||
on_rightclick = on_rightclick,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
diggable = false,
|
||||
paramtype = "light",
|
||||
light_source = 6,
|
||||
})
|
||||
|
||||
techage.power.register_node({"techage:ta4_fuelcell", "techage:ta4_fuelcell_on"}, {
|
||||
conn_sides = {"R"},
|
||||
power_network = Power,
|
||||
after_place_node = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local indir = techage.side_to_indir("L", node.param2)
|
||||
M(pos):set_int("in_dir", indir)
|
||||
end,
|
||||
})
|
||||
|
||||
techage.register_node({"techage:ta4_fuelcell", "techage:ta4_fuelcell_on"}, {
|
||||
on_pull_item = function(pos, in_dir, num)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_int("in_dir") == in_dir then
|
||||
local inv = M(pos):get_inventory()
|
||||
return techage.get_items(inv, "src", num)
|
||||
end
|
||||
end,
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_int("in_dir") == in_dir then
|
||||
local inv = M(pos):get_inventory()
|
||||
State:start_if_standby(pos)
|
||||
return techage.put_items(inv, "src", stack)
|
||||
end
|
||||
end,
|
||||
on_unpull_item = function(pos, in_dir, stack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_int("in_dir") == in_dir then
|
||||
local inv = M(pos):get_inventory()
|
||||
return techage.put_items(inv, "src", stack)
|
||||
end
|
||||
end,
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
return State:on_receive_message(pos, topic, payload)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta4_fuelcell",
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'dye:blue', 'default:steel_ingot'},
|
||||
{'techage:tubeS', 'techage:ta4_fuelcellstack', 'techage:electric_cableS'},
|
||||
{'default:steel_ingot', "techage:ta4_wlanchip", 'default:steel_ingot'},
|
||||
},
|
||||
})
|
||||
|
34
hydrogen/hydrogen.lua
Normal file
@ -0,0 +1,34 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019 Joachim Stolberg
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA4 Hydrogen
|
||||
|
||||
]]--
|
||||
|
||||
local S = techage.S
|
||||
|
||||
minetest.register_craftitem("techage:hydrogen", {
|
||||
description = S("TA4 Hydrogen"),
|
||||
inventory_image = "techage_hydrogen_inv.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("techage:ta4_fuelcellstack", {
|
||||
description = S("TA4 Fuell Cell Stack"),
|
||||
inventory_image = "techage_fc_stack_inv.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta4_fuelcellstack",
|
||||
recipe = {
|
||||
{'techage:baborium_ingot', 'techage:ta4_carbon_fiber', 'default:copper_ingot'},
|
||||
{'default:gold_ingot', 'techage:ta4_carbon_fiber', 'default:tin_ingot'},
|
||||
{"techage:baborium_ingot", 'techage:ta4_carbon_fiber', 'default:copper_ingot'},
|
||||
},
|
||||
})
|
4
init.lua
@ -201,4 +201,8 @@ else
|
||||
dofile(MP.."/energy_storage/inlet.lua")
|
||||
dofile(MP.."/energy_storage/nodes.lua")
|
||||
|
||||
-- Hydrogen
|
||||
dofile(MP.."/hydrogen/hydrogen.lua")
|
||||
dofile(MP.."/hydrogen/electrolyzer.lua")
|
||||
dofile(MP.."/hydrogen/fuelcell.lua")
|
||||
end
|
@ -22,7 +22,7 @@ local get_random_basalt_ore = techage.gravelsieve_get_random_basalt_ore
|
||||
|
||||
-- handle the sieve animation
|
||||
local function swap_node(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
local idx = string.byte(node.name, -1) - 48
|
||||
idx = (idx + 1) % 4
|
||||
minetest.swap_node(pos, {name = "techage:sieve"..idx, param2 = node.param2})
|
||||
@ -31,7 +31,7 @@ end
|
||||
|
||||
local function push_items(pos, items)
|
||||
local pos1 = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local node = minetest.get_node(pos1)
|
||||
local node = techage.get_node_lvm(pos1)
|
||||
minetest.add_item({x=pos.x, y=pos.y-0.4, z=pos.z}, items)
|
||||
end
|
||||
|
||||
|
@ -204,7 +204,7 @@ end
|
||||
local function get_heat(pos)
|
||||
local heat = 0
|
||||
pos.y = pos.y - 1
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if minetest.get_item_group(node.name, "techage_flame") == 0 then
|
||||
pos.y = pos.y + 1
|
||||
@ -212,7 +212,7 @@ local function get_heat(pos)
|
||||
end
|
||||
|
||||
pos.y = pos.y - 1
|
||||
node = minetest.get_node(pos)
|
||||
node = techage.get_node_lvm(pos)
|
||||
pos.y = pos.y + 2
|
||||
if minetest.get_item_group(node.name, "techage_flame") == 0 and
|
||||
node.name ~= "techage:charcoal_burn" then
|
||||
|
@ -57,7 +57,7 @@ Network Data=Netzwerkdaten
|
||||
No plan available=Kein Plan verfügar
|
||||
No wind at this altitude!=Kein Wind auf dieser Höhe
|
||||
Node owner=Blockbesitzer
|
||||
Number nodes=Blocknummern
|
||||
Number of nodes=Anzahl Blöcke
|
||||
Oil Drill Box=Ölbohrkiste
|
||||
Oil Pumpjack=Ölpumpe
|
||||
Oil Source=Erdöl
|
||||
@ -67,15 +67,14 @@ Plan=Plan
|
||||
Position=Position
|
||||
Position temperature=Positionstemperatur
|
||||
Power=Energie
|
||||
Power Akkus=Strom Akkus
|
||||
Power Fuel=Strom Kohle/Öl
|
||||
Power Solar=Strom Solar
|
||||
Power Storage=Strom Speicher
|
||||
Power Wind=Strom Wind
|
||||
Primary available=Primär verfügbar
|
||||
Primary needed=Primär benötigt
|
||||
Pusher=Schieber
|
||||
Remove derrick=Entferne Ölturm
|
||||
Rinsing=Waschen
|
||||
Save=Speichern
|
||||
Secondary available=Sekundär verfügbar
|
||||
Secondary needed=Sekundär benötigt
|
||||
Send signal if nodes have been:=Sende ein Signal falls Blöcke:
|
||||
Sieved Basalt Gravel=Basaltkies gesiebt
|
||||
Sieved Gravel=Gesiebtes Kies
|
||||
@ -124,6 +123,7 @@ TA2 Gearbox=TA2 Getriebeblock
|
||||
TA2 Gravel Sieve=TA2 Kiessieb
|
||||
TA2 Protected Chest=TA2 Gesicherte Kiste
|
||||
TA2 Steam Pipe=TA2 Dampfleitung
|
||||
TA3 Akku=TA3 Akku
|
||||
TA3 Akku Box=TA3 Akku Block
|
||||
TA3 Boiler Base=TA3 Boiler unten
|
||||
TA3 Boiler Top=TA3 Boiler oben
|
||||
@ -131,6 +131,7 @@ TA3 Booster=TA3 Gebläse
|
||||
TA3 Button/Switch=TA3 Taster/Schalter
|
||||
TA3 Cart Detector=TA3 Wagen Detektor
|
||||
TA3 Coal Power Station Firebox=TA3 Kohlekraftwerks-Feuerbox
|
||||
TA3 Coal/oil=TA3 Kohle/Öl
|
||||
TA3 Cooler=TA3 Kühler
|
||||
TA3 Derrick=TA3 Bohrturm
|
||||
TA3 Detector=TA3 Detektor
|
||||
@ -158,12 +159,16 @@ TA3 Turbine=TA3 Turbine
|
||||
TA3 Vacuum Tube=TA3 Vakuumröhre
|
||||
TA4 Carbon Fiber=TA4 Kohlefaser
|
||||
TA4 Derrick=TA4 Bohrturm
|
||||
TA4 Electrolyzer=TA4 Elektrolyseur
|
||||
TA4 Energy Storage=TA4 Energiespeicher
|
||||
TA4 Epoxide Resin=TA4 Epoxidharz
|
||||
TA4 Fuel Cell=TA4 Brennstoffzelle
|
||||
TA4 Generator=TA4 Generator
|
||||
TA4 Heat Exchanger=TA4 Wärmetauscher
|
||||
TA4 Heat Exchanger 1=TA4 Wärmetauscher 1
|
||||
TA4 Heat Exchanger 2=TA4 Wärmetauscher 2
|
||||
TA4 Heat Exchanger 3=TA4 Wärmetauscher 3
|
||||
TA4 Hydrogen=TA4 Wasserstoff
|
||||
TA4 Junction Pipe=TA4 Verbindungsrohr
|
||||
TA4 Low Power Box==TA4 Niederspannungsverteilerbox
|
||||
TA4 Low Power Cable=TA4 Niederspannungskabel
|
||||
@ -216,6 +221,7 @@ Wrong place for wind turbines!=Falscher Ort für Windkraftanlagen
|
||||
[TechAge Programmer] node programmed!=[TechAge Programmer] Nicht programmiert!
|
||||
[TechAge Programmer] number=[TechAge Programmer] Nummer=
|
||||
[TechAge Programmer] programmer reset=[TechAge Programmer] Programmer zurück gesetzt
|
||||
\\[ku\\]=\\[ku\\]
|
||||
accept=akzeptieren
|
||||
added=hinzugefügt wird
|
||||
added or removed=hinzugefügt oder entfernt wird
|
||||
|
@ -55,7 +55,7 @@ Network Data=
|
||||
No plan available=
|
||||
No wind at this altitude!=
|
||||
Node owner=
|
||||
Number nodes=
|
||||
Number of nodes=
|
||||
Oil Drill Box=
|
||||
Oil Pumpjack=
|
||||
Oil Source=
|
||||
@ -65,15 +65,14 @@ Plan=
|
||||
Position=
|
||||
Position temperature=
|
||||
Power=
|
||||
Power Akkus=
|
||||
Power Fuel=
|
||||
Power Solar=
|
||||
Power Storage=
|
||||
Power Wind=
|
||||
Primary available=
|
||||
Primary needed=
|
||||
Pusher=
|
||||
Remove derrick=
|
||||
Rinsing=
|
||||
Save=
|
||||
Secondary available=
|
||||
Secondary needed=
|
||||
Send signal if nodes have been:=
|
||||
Sieved Basalt Gravel=
|
||||
Sieved Gravel=
|
||||
@ -122,6 +121,7 @@ TA2 Gearbox=
|
||||
TA2 Gravel Sieve=
|
||||
TA2 Protected Chest=
|
||||
TA2 Steam Pipe=
|
||||
TA3 Akku=
|
||||
TA3 Akku Box=
|
||||
TA3 Boiler Base=
|
||||
TA3 Boiler Top=
|
||||
@ -129,6 +129,7 @@ TA3 Booster=
|
||||
TA3 Button/Switch=
|
||||
TA3 Cart Detector=
|
||||
TA3 Coal Power Station Firebox=
|
||||
TA3 Coal/oil=
|
||||
TA3 Cooler=
|
||||
TA3 Derrick=
|
||||
TA3 Detector=
|
||||
@ -156,12 +157,16 @@ TA3 Turbine=
|
||||
TA3 Vacuum Tube=
|
||||
TA4 Carbon Fiber=
|
||||
TA4 Derrick=
|
||||
TA4 Electrolyzer=
|
||||
TA4 Energy Storage=
|
||||
TA4 Epoxide Resin=
|
||||
TA4 Fuel Cell=
|
||||
TA4 Generator=
|
||||
TA4 Heat Exchanger=
|
||||
TA4 Heat Exchanger 1=
|
||||
TA4 Heat Exchanger 2=
|
||||
TA4 Heat Exchanger 3=
|
||||
TA4 Hydrogen=
|
||||
TA4 Junction Pipe=
|
||||
TA4 Low Power Box=
|
||||
TA4 Low Power Cable=
|
||||
@ -214,6 +219,7 @@ Wrong place for wind turbines!=
|
||||
[TechAge Programmer] node programmed!=
|
||||
[TechAge Programmer] number=
|
||||
[TechAge Programmer] programmer reset=
|
||||
\\[ku\\]=
|
||||
accept=
|
||||
added=
|
||||
added or removed=
|
||||
|
@ -40,7 +40,7 @@ function techage.logic.dest_pos(pos, param2, route)
|
||||
end
|
||||
|
||||
function techage.logic.swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
return false
|
||||
end
|
||||
|
@ -114,10 +114,10 @@ minetest.register_node("techage:signal_lamp_on", {
|
||||
techage.register_node({"techage:signal_lamp_off", "techage:signal_lamp_on"}, {
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
if topic == "on" then
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
switch_on(pos, node)
|
||||
elseif topic == "off" then
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
switch_off(pos, node)
|
||||
else
|
||||
return "unsupported"
|
||||
|
@ -179,3 +179,41 @@ Die Röhren dienen bei TA4 zur Weiterleitung von Gas und Dampf.
|
||||
Die maximale Leitungslänge beträgt 100 m.
|
||||
|
||||
[ta4_pipe|image]
|
||||
|
||||
|
||||
## Wasserstoff
|
||||
|
||||
Strom kann mittels Elektrolyse in Wasserstoff und Sauerstoff aufgespalten werden. Auf der anderen Seite kann über eine Brennstoffzelle Wasserstoff mit Sauerstoff aus der Luft wieder in Strom umgewandelt werden.
|
||||
Damit können Stromspitzen oder ein Überangebot an Strom in Wasserstoff umgewandelt und so gespeichert werden.
|
||||
|
||||
Im Spiel kann Strom mit Hilfe des Elektrolyseurs in Wasserstoff-Items und Wasserstoff-Items über die Brennstoffzelle wieder in Strom umgewandelt werden.
|
||||
Damit kann Strom (in Form von Wasserstoff-Items) nicht nur in Kisten gelagert, sonder auch über Wagen (carts) oder Röhren transportiert werden.
|
||||
|
||||
Die Umwandlung von Strom in Wasserstoff und zurück ist aber verlustbehaftet. Von 100 Einheiten Strom kommen nach der Umwandlung in Wasserstoff und zurück nur 75 Einheiten Strom wieder raus.
|
||||
|
||||
[ta4_hydrogen|image]
|
||||
|
||||
|
||||
### Elektrolyseur
|
||||
|
||||
Der Elektrolyseur wandelt Strom in Wasserstoff um.
|
||||
Es muss von links mit Strom versorgt werden. Rechts können die Wasserstoff-Items per Schieber entnommen werden.
|
||||
|
||||
Der Elektrolyseur kann bis zu 40 ku an Strom aufnehmen und generiert alle 8 s ein Wasserstoff Item.
|
||||
|
||||
[ta4_electrolyzer|image]
|
||||
|
||||
|
||||
### Brennstoffzelle
|
||||
|
||||
Die Brennstoffzelle wandelt Wasserstoff in Strom um.
|
||||
Sie muss von links per Schieber mit Wasserstoff-Items versorgt werden. Rechts ist der Stromanschluss.
|
||||
|
||||
Die Brennstoffzelle kann bis zu 40 ku an Strom abgeben und benötigt dazu alle 6 s ein Wasserstoff Item.
|
||||
|
||||
[ta4_fuelcell|image]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
- [Tech Age Mod](./manual_DE.md#tech-age-mod)
|
||||
- [Hinweise](./manual_DE.md#hinweise)
|
||||
- [History](./manual_DE.md#history)
|
||||
- [TA1: Eisenzeitalter](./manual_ta1_DE.md#ta1:-eisenzeitalter)
|
||||
- [Köhler / Coal Pile](./manual_ta1_DE.md#köhler--coal-pile)
|
||||
- [Kohlebrenner / Coal Burner](./manual_ta1_DE.md#kohlebrenner--coal-burner)
|
||||
@ -109,3 +110,6 @@
|
||||
- [TA4 Turbine](./manual_ta4_DE.md#ta4-turbine)
|
||||
- [TA4 Generator](./manual_ta4_DE.md#ta4-generator)
|
||||
- [TA4 Röhre / Pipe](./manual_ta4_DE.md#ta4-röhre--pipe)
|
||||
- [Wasserstoff](./manual_ta4_DE.md#wasserstoff)
|
||||
- [Elektrolyseur](./manual_ta4_DE.md#elektrolyseur)
|
||||
- [Brennstoffzelle](./manual_ta4_DE.md#brennstoffzelle)
|
@ -17,7 +17,7 @@ local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).consumer end
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
|
||||
local STANDBY_TICKS = 4
|
||||
local COUNTDOWN_TICKS = 6
|
||||
|
@ -19,7 +19,7 @@ local P = minetest.string_to_pos
|
||||
local S = techage.S
|
||||
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).consumer end
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
local CRDN = function(node) return (minetest.registered_nodes[node.name] or {}).consumer end
|
||||
|
||||
local STANDBY_TICKS = 10
|
||||
|
@ -21,7 +21,7 @@ local N = function(pos) return minetest.get_node(pos).name end
|
||||
local D = techage.Debug
|
||||
|
||||
-- Techage Related Data
|
||||
local PWR = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).power end
|
||||
local PWR = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).power end
|
||||
|
||||
-- Used to determine the already passed nodes while power distribution
|
||||
local Route = {}
|
||||
@ -38,7 +38,7 @@ local NOPOWER = 2
|
||||
local RUNNING = 3
|
||||
|
||||
-------------------------------------------------- Migrate
|
||||
local CRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).consumer end
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
local Consumer = {
|
||||
["techage:streetlamp_off"] = 0,
|
||||
["techage:streetlamp_on"] = 0.5,
|
||||
@ -117,7 +117,7 @@ local function migrate(pos, mem, node)
|
||||
mem.pwr_power_provided_cnt = 2
|
||||
mem.pwr_node_alive_cnt = 4
|
||||
|
||||
local name = minetest.get_node(pos).name
|
||||
local name = techage.get_node_lvm(pos).name
|
||||
mem.pwr_needed = Consumer[name]
|
||||
mem.pwr_available = Generator[name]
|
||||
mem.pwr_could_provide = Akku[name]
|
||||
@ -578,6 +578,7 @@ function techage.power.secondary_stop(pos, mem)
|
||||
mem.pwr_node_alive_cnt = 0
|
||||
mem.pwr_could_provide = 0
|
||||
mem.pwr_could_need = 0
|
||||
mem.pwr_needed2 = 0
|
||||
if determine_new_master(pos, mem) then -- last available master
|
||||
power_distribution(pos, mem)
|
||||
end
|
||||
@ -598,8 +599,11 @@ function techage.power.secondary_alive(pos, mem, capa_curr, capa_max)
|
||||
if D.pwr then D.dbg("secondary_alive is master") end
|
||||
power_distribution(pos, mem, 1)
|
||||
end
|
||||
if mem.pwr_master_pos then
|
||||
return mem.pwr_provided or 0
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
--
|
||||
-- Read the current power value from all connected devices (used for solar cells)
|
||||
@ -618,7 +622,7 @@ function techage.power.get_power(start_pos, inverter)
|
||||
if pwr and pwr.on_getpower then
|
||||
sum = sum + pwr.on_getpower(pos, mem)
|
||||
else
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == inverter then
|
||||
num_inverter = num_inverter + 1
|
||||
end
|
||||
|
@ -17,7 +17,7 @@ local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
local N = function(pos) return minetest.get_node(pos).name end
|
||||
-- Techage Related Data
|
||||
local PWR = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).power end
|
||||
local PWR = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).power end
|
||||
local PWRN = function(node) return (minetest.registered_nodes[node.name] or {}).power end
|
||||
|
||||
local network_changed = techage.power.network_changed
|
||||
@ -78,7 +78,7 @@ local function matching_nodes(pos, peer_pos)
|
||||
end
|
||||
|
||||
function techage.get_pos(pos, side)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
local dir = nil
|
||||
if node.name ~= "air" and node.name ~= "ignore" then
|
||||
dir = side_to_dir(node.param2, side)
|
||||
@ -236,7 +236,7 @@ end
|
||||
|
||||
|
||||
function techage.power.side_to_outdir(pos, side)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
return side_to_dir(node.param2, side)
|
||||
end
|
||||
|
||||
@ -244,7 +244,7 @@ end
|
||||
function techage.power.power_cut(pos, dir, cable, cut)
|
||||
local npos = vector.add(pos, tubelib2.Dir6dToVector[dir or 0])
|
||||
|
||||
local node = minetest.get_node(npos)
|
||||
local node = techage.get_node_lvm(npos)
|
||||
if node.name ~= "techage:powerswitch_box" and
|
||||
M(npos):get_string("techage_hidden_nodename") ~= "techage:powerswitch_box" then
|
||||
return
|
||||
|
@ -264,7 +264,7 @@ techage.power.register_node({"techage:powerswitch_box"}, {
|
||||
|
||||
techage.register_node({"techage:powerswitch", "techage:powerswitch_on"}, {
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if topic == "on" and node.name == "techage:powerswitch" then
|
||||
switch_on(pos, node, nil, "techage:powerswitch_on")
|
||||
return true
|
||||
|
@ -52,7 +52,7 @@ end
|
||||
local old_is_protected = minetest.is_protected
|
||||
|
||||
function minetest.is_protected(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if IsNodeUnderObservation[node.name] and is_protected(pos, name, RANGE) then
|
||||
return true
|
||||
end
|
||||
|
@ -32,7 +32,7 @@ end
|
||||
|
||||
-- return the required param2 for solar modules
|
||||
local function get_param2(pos, side)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
local dir = power.side_to_dir(node.param2, side)
|
||||
return (dir + 1) % 4
|
||||
end
|
||||
@ -49,7 +49,7 @@ end
|
||||
local function is_solar_module(base_pos, pos, side)
|
||||
local pos1 = techage.get_pos(pos, side)
|
||||
if pos1 then
|
||||
local node = minetest.get_node(pos1)
|
||||
local node = techage.get_node_lvm(pos1)
|
||||
if node and node.name == "techage:ta4_solar_module" and light(pos1) then
|
||||
if side == "L" and node.param2 == M(base_pos):get_int("left_param2") then
|
||||
return true
|
||||
|
@ -20,7 +20,7 @@ local S = techage.S
|
||||
local Pipe = techage.SteamPipe
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
|
@ -24,7 +24,7 @@ local Axle = techage.Axle
|
||||
local power = techage.power
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
|
BIN
textures/techage_appl_ctrl_unit.png
Normal file
After Width: | Height: | Size: 233 B |
BIN
textures/techage_appl_ctrl_unit4.png
Normal file
After Width: | Height: | Size: 425 B |
BIN
textures/techage_appl_electrolyzer.png
Normal file
After Width: | Height: | Size: 223 B |
BIN
textures/techage_appl_electrolyzer4.png
Normal file
After Width: | Height: | Size: 245 B |
BIN
textures/techage_appl_fuelcell.png
Normal file
After Width: | Height: | Size: 248 B |
BIN
textures/techage_appl_fuelcell4.png
Normal file
After Width: | Height: | Size: 354 B |
BIN
textures/techage_fc_stack_inv.png
Normal file
After Width: | Height: | Size: 175 B |
BIN
textures/techage_hydrogen_inv.png
Normal file
After Width: | Height: | Size: 338 B |
@ -23,6 +23,17 @@ local Nodes2Convert = {
|
||||
["techage:button_on"] = "techage:ta3_button_on",
|
||||
}
|
||||
|
||||
local function power_data(power)
|
||||
local tbl = {}
|
||||
tbl[1] = S("Primary available") ..": "..(power.prim_available or 0)
|
||||
tbl[2] = S("Secondary available") ..": "..(power.sec_available or 0)
|
||||
tbl[3] = S("Primary needed") ..": "..(power.prim_needed or 0)
|
||||
tbl[4] = S("Secondary needed") ..": "..(power.sec_needed or 0)
|
||||
tbl[5] = S("Number of nodes") ..": "..(power.num_nodes or 0)
|
||||
tbl[6] = ""
|
||||
return table.concat(tbl, "\n")
|
||||
end
|
||||
|
||||
local function read_state(itemstack, user, pointed_thing)
|
||||
local pos = pointed_thing.under
|
||||
if pos and user then
|
||||
@ -94,9 +105,8 @@ local function read_state(itemstack, user, pointed_thing)
|
||||
if ndef.is_power_available then
|
||||
techage.power.mark_nodes(user:get_player_name(), pos)
|
||||
local power = ndef.is_power_available(pos)
|
||||
if power and power.prim_available then
|
||||
local text = "\nGenerators: "..power.prim_available.." ku\nAkkus: "..power.sec_available.." ku\nMachines: "..power.prim_needed.." ku\nNum Nodes: "..power.num_nodes.."\n"
|
||||
minetest.chat_send_player(user:get_player_name(), ndef.description..":"..text)
|
||||
if power then
|
||||
minetest.chat_send_player(user:get_player_name(), ndef.description..":\n"..power_data(power))
|
||||
end
|
||||
end
|
||||
local owner = M(pos):get_string("owner") or ""
|
||||
|