furnace bugfixes, lamp improvements, standby power consumption bugfix, further work on TES
This commit is contained in:
parent
5911dcadbe
commit
19fbdbec87
@ -19,7 +19,6 @@ local function swap_node(pos, name)
|
||||
end
|
||||
|
||||
local function on_power(pos, mem)
|
||||
mydbg("dbg", "on_power")
|
||||
if mem.running then
|
||||
swap_node(pos, "techage:sink_on")
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
@ -28,7 +27,6 @@ local function on_power(pos, mem)
|
||||
end
|
||||
|
||||
local function on_nopower(pos, mem)
|
||||
mydbg("dbg", "on_nopower")
|
||||
swap_node(pos, "techage:sink")
|
||||
M(pos):set_string("infotext", "nopower")
|
||||
end
|
||||
@ -44,14 +42,12 @@ local function on_rightclick(pos, node, clicker)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
if not mem.running and power.power_available(pos, mem, PWR_NEEDED) then
|
||||
mem.running = true
|
||||
mydbg("dbg", "turn on")
|
||||
--swap_node(pos, "techage:sink_on")
|
||||
power.consumer_start(pos, mem, CYCLE_TIME, PWR_NEEDED)
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
M(pos):set_string("infotext", "on")
|
||||
else
|
||||
mem.running = false
|
||||
mydbg("dbg", "turn off")
|
||||
swap_node(pos, "techage:sink")
|
||||
power.consumer_stop(pos, mem)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
@ -125,8 +125,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if listname == "src" then
|
||||
CRD(pos).State:start_if_standby(pos)
|
||||
return stack:get_count()
|
||||
elseif stack:get_count() == 1 and
|
||||
(list[index]:get_count() == 0 or stack:get_name() ~= list[index]:get_name()) then
|
||||
elseif (list[index]:get_count() == 0 or stack:get_name() ~= list[index]:get_name()) then
|
||||
filter_settings(pos)
|
||||
return 1
|
||||
end
|
||||
|
@ -22,36 +22,44 @@
|
||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
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 CRDN = function(node) return (minetest.registered_nodes[node.name] or {}).consumer end
|
||||
|
||||
local power = techage.power
|
||||
|
||||
local function can_start(pos, mem, state)
|
||||
mydbg("con", "consumer can_start", state)
|
||||
return power.power_available(pos, mem, CRD(pos).power_consumption)
|
||||
local function has_power(pos, mem, state)
|
||||
if D.con then D.dbg("consumer has_power", state) end
|
||||
if not power.power_available(pos, mem, 0) then
|
||||
-- force to set to NOPOWER
|
||||
local crd = CRD(pos)
|
||||
techage.power.consumer_start(pos, mem, crd.cycle_time, crd.power_consumption)
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local function start_node(pos, mem, state)
|
||||
local crd = CRD(pos)
|
||||
mydbg("con", "consumer start_node", state)
|
||||
if D.con then D.dbg("consumer start_node", state) end
|
||||
power.consumer_start(pos, mem, crd.cycle_time, crd.power_consumption)
|
||||
end
|
||||
|
||||
local function stop_node(pos, mem, state)
|
||||
mydbg("con", "consumer stop_node", state)
|
||||
if D.con then D.dbg("consumer stop_node", state) end
|
||||
power.consumer_stop(pos, mem)
|
||||
end
|
||||
|
||||
local function on_power(pos, mem)
|
||||
mydbg("con", "consumer on_power")
|
||||
if D.con then D.dbg("consumer on_power") end
|
||||
local crd = CRD(pos)
|
||||
crd.State:start(pos, mem)
|
||||
end
|
||||
|
||||
local function on_nopower(pos, mem)
|
||||
mydbg("con", "consumer on_nopower")
|
||||
if D.con then D.dbg("consumer on_nopower") end
|
||||
local crd = CRD(pos)
|
||||
crd.State:nopower(pos, mem)
|
||||
end
|
||||
@ -60,8 +68,7 @@ local function node_timer(pos, elapsed)
|
||||
local crd = CRD(pos)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
local state = mem.techage_state
|
||||
mydbg("con", "consumer node_timer", techage.needs_power(mem))
|
||||
if techage.power_alive(mem) then
|
||||
if techage.needs_power(mem) then
|
||||
power.consumer_alive(pos, mem)
|
||||
end
|
||||
-- call the node timer routine
|
||||
@ -127,7 +134,8 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
|
||||
standby_ticks = tNode.standby_ticks,
|
||||
formspec_func = tNode.formspec,
|
||||
on_state_change = tNode.on_state_change,
|
||||
can_start = power_used and can_start or nil,
|
||||
can_start = tNode.can_start,
|
||||
has_power = tNode.has_power or power_used and has_power or nil,
|
||||
start_node = power_used and start_node or nil,
|
||||
stop_node = power_used and stop_node or nil,
|
||||
})
|
||||
|
@ -161,16 +161,6 @@ function techage.dropped_node(node, ndef)
|
||||
return ndef.drop or node.name
|
||||
end
|
||||
|
||||
function mydbg(topic, text, ...)
|
||||
if techage.DebugTopics[topic] then
|
||||
local t = string.format("%.4f %4s: ", minetest.get_us_time() / 1000000.0, topic)
|
||||
if type(text) ~= "string" then
|
||||
text = dump(text)
|
||||
end
|
||||
print(t..text, unpack({...}))
|
||||
end
|
||||
end
|
||||
|
||||
-- needed for windmill plants
|
||||
local function determine_ocean_ids()
|
||||
techage.OceanIdTbl = {}
|
||||
|
@ -120,6 +120,12 @@ techage.NodeStates = {}
|
||||
local NodeStates = techage.NodeStates
|
||||
|
||||
local function can_start(pos, mem)
|
||||
--if false, node goes in FAULT
|
||||
return true
|
||||
end
|
||||
|
||||
local function has_power(pos, mem)
|
||||
--if false, node goes in NOPOWER
|
||||
return true
|
||||
end
|
||||
|
||||
@ -144,10 +150,12 @@ function techage.needs_power(mem)
|
||||
return state < STANDBY
|
||||
end
|
||||
|
||||
-- is node alive (power related)
|
||||
function techage.power_alive(mem)
|
||||
local state = mem.techage_state or STOPPED
|
||||
return state < FAULT
|
||||
function techage.needs_power2(state)
|
||||
return state < STANDBY
|
||||
end
|
||||
|
||||
function techage.get_state_string(mem)
|
||||
return techage.StateStrings[mem.techage_state or STOPPED]
|
||||
end
|
||||
|
||||
function NodeStates:new(attr)
|
||||
@ -159,6 +167,7 @@ function NodeStates:new(attr)
|
||||
node_name_passive = attr.node_name_passive,
|
||||
node_name_active = attr.node_name_active,
|
||||
infotext_name = attr.infotext_name,
|
||||
has_power = attr.has_power or has_power,
|
||||
can_start = attr.can_start or can_start,
|
||||
start_node = attr.start_node,
|
||||
stop_node = attr.stop_node,
|
||||
@ -214,6 +223,10 @@ function NodeStates:start(pos, mem)
|
||||
self:fault(pos, mem)
|
||||
return false
|
||||
end
|
||||
if not self.has_power(pos, mem, state) then
|
||||
self:nopower(pos, mem)
|
||||
return false
|
||||
end
|
||||
mem.techage_state = RUNNING
|
||||
if self.start_node then
|
||||
self.start_node(pos, mem, state)
|
||||
@ -304,7 +317,7 @@ end
|
||||
|
||||
function NodeStates:nopower(pos, mem)
|
||||
local state = mem.techage_state or RUNNING
|
||||
if state ~= STOPPED then
|
||||
if state ~= NOPOWER then
|
||||
mem.techage_state = NOPOWER
|
||||
if self.node_name_passive then
|
||||
swap_node(pos, self.node_name_passive)
|
||||
@ -352,10 +365,6 @@ function NodeStates:get_state(mem)
|
||||
return mem.techage_state or techage.STOPPED
|
||||
end
|
||||
|
||||
function NodeStates:get_state_string(mem)
|
||||
return techage.StateStrings[mem.techage_state or STOPPED]
|
||||
end
|
||||
|
||||
-- keep the timer running?
|
||||
function NodeStates:is_active(mem)
|
||||
local state = mem.techage_state or STOPPED
|
||||
@ -394,7 +403,9 @@ function NodeStates:state_button_event(pos, mem, fields)
|
||||
if fields.state_button ~= nil then
|
||||
local state = mem.techage_state or STOPPED
|
||||
if state == STOPPED or state == STANDBY or state == BLOCKED then
|
||||
self:start(pos, mem)
|
||||
if not self:start(pos, mem) and state == STANDBY then
|
||||
self:stop(pos, mem)
|
||||
end
|
||||
elseif state == RUNNING or state == FAULT or state == NOPOWER then
|
||||
self:stop(pos, mem)
|
||||
end
|
||||
|
@ -36,7 +36,6 @@ end
|
||||
|
||||
local function node_timer(pos, elapsed)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
mydbg("dbg", "firebox burn_cycles = "..(mem.burn_cycles or 0))
|
||||
if mem.running then
|
||||
-- trigger generator and provide power ratio 0..1
|
||||
local ratio = techage.transfer(
|
||||
|
@ -24,7 +24,7 @@ local HEAT_STEP = 10
|
||||
local WATER_CONSUMPTION = 0.5
|
||||
local MAX_WATER = 10
|
||||
|
||||
local Pipe = techage.SteamPipe
|
||||
local Pipe = techage.BiogasPipe
|
||||
|
||||
local Water = {
|
||||
["bucket:bucket_river_water"] = true,
|
||||
@ -77,18 +77,6 @@ local function no_space(pos)
|
||||
return node1.name ~= "air" or node2.name ~= "air"
|
||||
end
|
||||
|
||||
local function place_nodes(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
print("node.param2", node.param2)
|
||||
minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name = "techage:heatexchanger2", param2 = node.param2})
|
||||
minetest.set_node({x=pos.x, y=pos.y+2, z=pos.z}, {name = "techage:heatexchanger1", param2 = node.param2})
|
||||
end
|
||||
|
||||
local function remove_nodes(pos)
|
||||
minetest.remove_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
minetest.remove_node({x=pos.x, y=pos.y+2, z=pos.z})
|
||||
end
|
||||
|
||||
local State = techage.NodeStates:new({
|
||||
node_name_passive = "techage:boiler2",
|
||||
cycle_time = CYCLE_TIME,
|
||||
@ -229,24 +217,36 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
||||
return 0
|
||||
end
|
||||
|
||||
local function orientate_node(pos, name)
|
||||
local node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
if node.name == name then
|
||||
local param2 = node.param2
|
||||
node = minetest.get_node(pos)
|
||||
node.param2 = param2
|
||||
minetest.swap_node(pos, node)
|
||||
else
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- Top
|
||||
minetest.register_node("techage:heatexchanger1", {
|
||||
description = S("TA4 Heat Exchanger"),
|
||||
minetest.register_node("techage:heatexchanger3", {
|
||||
description = S("TA4 Heat Exchanger 3"),
|
||||
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_hole_ta4.png",
|
||||
"techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_hole_biogas.png",
|
||||
"techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_hole_biogas.png",
|
||||
"techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_ribsT.png",
|
||||
"techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_ribsT.png",
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {0,0,0,0,0,0},
|
||||
},
|
||||
after_place_node = function(pos, placer)
|
||||
return orientate_node(pos, "techage:heatexchanger2")
|
||||
end,
|
||||
paramtype2 = "facedir",
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2, not_in_creative_inventory=1},
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2},
|
||||
--on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
@ -254,43 +254,37 @@ minetest.register_node("techage:heatexchanger1", {
|
||||
|
||||
-- Middle
|
||||
minetest.register_node("techage:heatexchanger2", {
|
||||
description = S("TA4 Heat Exchanger"),
|
||||
description = S("TA4 Heat Exchanger 2"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png",
|
||||
"techage_hole_ta4.png",
|
||||
"techage_hole_ta4.png",
|
||||
"techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_tes_turb.png",
|
||||
"techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_tes_core.png",
|
||||
"techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_ribsM.png",
|
||||
"techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_ribsM.png",
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {0,0,0,0,0,0},
|
||||
},
|
||||
after_place_node = function(pos, placer)
|
||||
return orientate_node(pos, "techage:heatexchanger1")
|
||||
end,
|
||||
paramtype2 = "facedir",
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2, not_in_creative_inventory=1},
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2},
|
||||
--on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("techage:heatexchanger3", {
|
||||
description = S("TA4 Heat Exchanger"),
|
||||
inventory_image = "techage_heat_exchanger_inv.png",
|
||||
minetest.register_node("techage:heatexchanger1", {
|
||||
description = S("TA4 Heat Exchanger 1"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png",
|
||||
"techage_hole_ta4.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png",
|
||||
"techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_biogas.png",
|
||||
"techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_biogas.png",
|
||||
"techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_ribsB.png",
|
||||
"techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_ribsB.png",
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-8/16, -8/16, -8/16, 8/16, 40/16, 8/16},
|
||||
},
|
||||
|
||||
on_construct = function(pos)
|
||||
tubelib2.init_mem(pos)
|
||||
@ -304,7 +298,6 @@ minetest.register_node("techage:heatexchanger3", {
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
place_nodes(pos)
|
||||
-- secondary 'after_place_node', called by power. Don't use tubelib2.init_mem(pos)!!!
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
State:node_init(pos, mem, "")
|
||||
@ -315,7 +308,6 @@ minetest.register_node("techage:heatexchanger3", {
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos)
|
||||
remove_nodes(pos)
|
||||
end,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
@ -325,6 +317,11 @@ minetest.register_node("techage:heatexchanger3", {
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
||||
techage.power.register_node({"techage:heatexchanger1", "techage:heatexchanger3"}, {
|
||||
conn_sides = {"R", "L"},
|
||||
power_network = Pipe,
|
||||
})
|
||||
|
||||
|
||||
-- boiler2: Main part, needed as generator
|
||||
--minetest.register_node("techage:heatexchanger3", {
|
||||
@ -424,35 +421,3 @@ minetest.register_node("techage:heatexchanger3", {
|
||||
-- S("Part of the steam engine. Has to be placed on top of TA2 Boiler Base.@n(see Steam Engine)"),
|
||||
-- "techage:boiler2")
|
||||
|
||||
minetest.register_node("techage:ta4_tes_coreelem", {
|
||||
description = S("TA4 TES Core Element"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_tes_core_elem_top.png",
|
||||
"techage_tes_core_elem_top.png",
|
||||
"techage_tes_core_elem.png",
|
||||
},
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("techage:ta4_tes_inlet", {
|
||||
description = S("TA4 TES Core Element"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_tes_inlet.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-8/16, -8/16, -8/16, 8/16, -12/32, 8/16},
|
||||
},
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
92
energy_storage/inlet.lua
Normal file
92
energy_storage/inlet.lua
Normal file
@ -0,0 +1,92 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019 Joachim Stolberg
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA4 Pipe Inlet
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local S2P = minetest.string_to_pos
|
||||
local D = techage.Debug
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local Pipe = techage.BiogasPipe
|
||||
|
||||
minetest.register_node("techage:ta4_pipe_inlet", {
|
||||
description = S("TA4 Pipe Inlet"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"basic_materials_concrete_block.png",
|
||||
"basic_materials_concrete_block.png",
|
||||
"basic_materials_concrete_block.png",
|
||||
"basic_materials_concrete_block.png",
|
||||
"basic_materials_concrete_block.png^techage_tes_inlet.png",
|
||||
"basic_materials_concrete_block.png^techage_tes_inlet.png",
|
||||
},
|
||||
|
||||
paramtype2 = "facedir", -- important!
|
||||
on_rotate = screwdriver.disallow, -- important!
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
||||
-- for mechanical pipe connections
|
||||
techage.power.register_node({"techage:ta4_pipe_inlet"}, {
|
||||
conn_sides = {"F", "B"},
|
||||
power_network = Pipe,
|
||||
})
|
||||
|
||||
local function volume(pos, in_dir)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
if not mem.pos1 or not mem.pos2 or not mem.volume then
|
||||
local dir = tubelib2.Dir6dToVector[in_dir]
|
||||
local pos2 = vector.add(pos, vector.multiply(dir, 8))
|
||||
local poses = minetest.find_nodes_in_area(pos, pos2, {"techage:ta4_pipe_inlet"})
|
||||
if #poses == 2 then
|
||||
mem.pos1 = poses[1]
|
||||
mem.pos2 = poses[2]
|
||||
local _, node_tbl = minetest.find_nodes_in_area(mem.pos1, mem.pos2,
|
||||
{"default:gravel", "techage:ta4_pipe_inlet",
|
||||
"basic_materials:concrete_block", "default:obsidian_glass",
|
||||
"techage:glow_gravel"})
|
||||
print(dump(node_tbl))
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- for logical communication
|
||||
techage.register_node({"techage:ta4_pipe_inlet"}, {
|
||||
on_transfer = function(pos, in_dir, topic, payload)
|
||||
print(P2S(pos), in_dir, topic, payload)
|
||||
if topic == "increment" then
|
||||
if transfer(pos, in_dir, topic, nil) then
|
||||
swap_node(pos, "techage:cooler_on")
|
||||
return true
|
||||
end
|
||||
elseif topic == "decrement" then
|
||||
swap_node(pos, "techage:cooler")
|
||||
return transfer(pos, in_dir, topic, nil)
|
||||
elseif topic == "volume" then
|
||||
return volume(pos, in_dir)
|
||||
end
|
||||
return false
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'shapeless',
|
||||
output = "techage:ta4_pipe_inlet",
|
||||
recipe = {"basic_materials:concrete_block", "techage:ta4_pipeS"},
|
||||
})
|
52
energy_storage/nodes.lua
Normal file
52
energy_storage/nodes.lua
Normal file
@ -0,0 +1,52 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019 Joachim Stolberg
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA4 Heat Exchanger
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local Pipe = techage.BiogasPipe
|
||||
|
||||
minetest.register_node("techage:glow_gravel", {
|
||||
description = "Techage Gravel",
|
||||
tiles = {{
|
||||
name = "techage_gravel4.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.2,
|
||||
},
|
||||
}},
|
||||
paramtype = "light",
|
||||
light_source = 8,
|
||||
groups = {crumbly = 2, falling_node = 1},
|
||||
sounds = default.node_sound_gravel_defaults(),
|
||||
drop = "",
|
||||
})
|
||||
|
||||
minetest.register_node("techage:ta4_tes_coreelem", {
|
||||
description = S("TA4 TES Core Element"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_tes_core_elem_top.png",
|
||||
"techage_tes_core_elem_top.png",
|
||||
"techage_tes_core_elem.png",
|
||||
},
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
@ -15,6 +15,7 @@
|
||||
-- for lazy programmers
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
local D = techage.Debug
|
||||
|
||||
local PWR_NEEDED = 3
|
||||
local CYCLE_TIME = 2
|
||||
@ -39,28 +40,29 @@ local function on_power(pos, mem)
|
||||
if mem.running then
|
||||
swap_node(pos, "techage:ta3_booster_on")
|
||||
infotext(pos, "running")
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
end
|
||||
mydbg("dbg2", "booster on_power")
|
||||
if D.dbg2 then D.dbg("booster on_power") end
|
||||
mem.is_powered = true
|
||||
end
|
||||
|
||||
local function on_nopower(pos, mem)
|
||||
swap_node(pos, "techage:ta3_booster")
|
||||
infotext(pos, "no power")
|
||||
mydbg("dbg2", "booster on_nopower")
|
||||
if D.dbg2 then D.dbg("booster on_nopower") end
|
||||
mem.is_powered = false
|
||||
end
|
||||
|
||||
local function node_timer(pos, elapsed)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
if mem.is_powered then
|
||||
if mem.running and mem.is_powered then
|
||||
minetest.sound_play("techage_booster", {
|
||||
pos = pos,
|
||||
gain = 1,
|
||||
max_hear_distance = 7})
|
||||
end
|
||||
power.consumer_alive(pos, mem)
|
||||
if mem.running then
|
||||
power.consumer_alive(pos, mem)
|
||||
end
|
||||
return mem.running
|
||||
end
|
||||
|
||||
@ -146,23 +148,22 @@ techage.register_node({"techage:ta3_booster", "techage:ta3_booster_on"}, {
|
||||
if M(pos):get_int("indir") == in_dir then
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
if topic == "power" then
|
||||
mydbg("dbg2", "booster", mem.is_powered)
|
||||
return mem.is_powered
|
||||
if D.dbg2 then D.dbg("booster power") end
|
||||
return power.power_available(pos, mem, 0)
|
||||
elseif topic == "start" and not mem.running then
|
||||
mydbg("dbg2", "booster try start", mem.pwr_master_pos, mem.pwr_power_provided_cnt)
|
||||
if D.dbg2 then D.dbg("booster try start", mem.pwr_master_pos, mem.pwr_power_provided_cnt) end
|
||||
if power.power_available(pos, mem, 0) then
|
||||
mem.running = true
|
||||
mydbg("dbg2", "booster start")
|
||||
if D.dbg2 then D.dbg("booster start") end
|
||||
power.consumer_start(pos, mem, CYCLE_TIME, PWR_NEEDED)
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
else
|
||||
mydbg("dbg2", "booster no power")
|
||||
if D.dbg2 then D.dbg("booster no power") end
|
||||
infotext(pos, "no power")
|
||||
end
|
||||
elseif topic == "stop" then
|
||||
mem.running = false
|
||||
mem.is_powered = false
|
||||
mydbg("dbg2", "booster stop")
|
||||
if D.dbg2 then D.dbg("booster stop") end
|
||||
swap_node(pos, "techage:ta3_booster")
|
||||
power.consumer_stop(pos, mem)
|
||||
minetest.get_node_timer(pos):stop()
|
||||
|
@ -188,26 +188,15 @@ techage.register_node({"techage:furnace_firebox", "techage:furnace_firebox_on"},
|
||||
end,
|
||||
-- called from furnace_top
|
||||
on_transfer = function(pos, in_dir, topic, payload)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
if topic == "fuel" then
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
if booster_cmnd(pos, "power") then
|
||||
-- fire keeps on even if the booster is off for some seconds
|
||||
mem.booster_cnt = 3
|
||||
end
|
||||
mydbg("dbg2", "firebox fuel", mem.booster_cnt)
|
||||
mem.booster_cnt = (mem.booster_cnt or 3) - 1
|
||||
return has_fuel(pos, mem) and mem.booster_cnt > 0
|
||||
return has_fuel(pos, mem) and booster_cmnd(pos, "power")
|
||||
elseif topic == "start" then
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
start_firebox(pos, mem)
|
||||
booster_cmnd(pos, "start")
|
||||
mem.booster_cnt = 4
|
||||
mydbg("dbg2", "firebox start", mem.booster_cnt)
|
||||
elseif topic == "stop" then
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
stop_firebox(pos, mem)
|
||||
booster_cmnd(pos, "stop")
|
||||
mydbg("dbg2", "firebox stop", mem.booster_cnt)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -15,6 +15,7 @@
|
||||
-- for lazy programmers
|
||||
local M = minetest.get_meta
|
||||
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
|
||||
@ -88,7 +89,7 @@ local function cooking(pos, crd, mem, elapsed)
|
||||
crd.State:idle(pos, mem)
|
||||
end
|
||||
else
|
||||
crd.State:fault(pos, mem)
|
||||
crd.State:idle(pos, mem)
|
||||
end
|
||||
end
|
||||
|
||||
@ -164,12 +165,21 @@ local function can_dig(pos, player)
|
||||
return inv:is_empty("dst") and inv:is_empty("src")
|
||||
end
|
||||
|
||||
local function can_start(pos, mem, state)
|
||||
if D.dbg2 then D.dbg("can_start", state, firebox_cmnd(pos, "fuel")) end
|
||||
return firebox_cmnd(pos, "fuel")
|
||||
end
|
||||
|
||||
local function on_node_state_change(pos, old_state, new_state)
|
||||
mydbg("dbg2", "on_node_state_change", new_state)
|
||||
if new_state == techage.RUNNING then
|
||||
firebox_cmnd(pos, "start")
|
||||
else
|
||||
firebox_cmnd(pos, "stop")
|
||||
if D.dbg2 then D.dbg("on_node_state_change", new_state) end
|
||||
local pwr1 = techage.needs_power2(old_state)
|
||||
local pwr2 = techage.needs_power2(new_state)
|
||||
if pwr1 ~= pwr2 then
|
||||
if pwr2 then
|
||||
firebox_cmnd(pos, "start")
|
||||
else
|
||||
firebox_cmnd(pos, "stop")
|
||||
end
|
||||
end
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
reset_cooking(mem)
|
||||
@ -232,6 +242,7 @@ local _, node_name_ta3, _ =
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
formspec = formspec,
|
||||
tubing = tubing,
|
||||
can_start = can_start,
|
||||
on_state_change = on_node_state_change,
|
||||
after_place_node = function(pos, placer)
|
||||
local inv = M(pos):get_inventory()
|
||||
|
22
init.lua
22
init.lua
@ -19,12 +19,18 @@ else
|
||||
-- Load support for I18n.
|
||||
techage.S = minetest.get_translator("techage")
|
||||
|
||||
-- Debugging via "mydbg(topic, text)"
|
||||
techage.DebugTopics = {
|
||||
-- Debugging via "techage.Debug.dbg(text)"
|
||||
techage.Debug = {
|
||||
dbg = function(text, ...)
|
||||
local t = string.format("%.4f %4s: ", minetest.get_us_time() / 1000000.0, topic)
|
||||
if type(text) ~= "string" then
|
||||
text = dump(text)
|
||||
end
|
||||
print(t..text, unpack({...}))
|
||||
end,
|
||||
--con = true, -- consumer modell
|
||||
--pwr = true, -- power distribution
|
||||
--sts = true, -- status plots
|
||||
--dbg = true,
|
||||
--dbg2 = true,
|
||||
--tst = true,
|
||||
--bot = true -- Signs Bot
|
||||
@ -187,9 +193,11 @@ else
|
||||
dofile(MP.."/wind_turbine/signallamp.lua")
|
||||
|
||||
-- TA4 Energy Storage
|
||||
--dofile(MP.."/energy_storage/heatexchanger.lua")
|
||||
--dofile(MP.."/energy_storage/generator.lua")
|
||||
--dofile(MP.."/energy_storage/turbine.lua")
|
||||
--dofile(MP.."/energy_storage/help.lua")
|
||||
-- dofile(MP.."/energy_storage/heatexchanger.lua")
|
||||
-- dofile(MP.."/energy_storage/generator.lua")
|
||||
-- dofile(MP.."/energy_storage/turbine.lua")
|
||||
-- dofile(MP.."/energy_storage/inlet.lua")
|
||||
-- dofile(MP.."/energy_storage/nodes.lua")
|
||||
-- dofile(MP.."/energy_storage/help.lua")
|
||||
|
||||
end
|
@ -128,4 +128,16 @@ function techage.register_lamp(basename, ndef_off, ndef_on)
|
||||
on_power = on_power,
|
||||
on_nopower = on_nopower,
|
||||
})
|
||||
minetest.register_lbm({
|
||||
label = "[techage] Start lamp",
|
||||
name = "techage:start_lamp",
|
||||
nodenames = {basename.."_on"},
|
||||
run_at_every_load = true,
|
||||
action = function(pos, node)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
power.consumer_start(pos, mem, CYCLE_TIME, PWR_NEEDED)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -155,6 +155,20 @@ local function command(pos, command, player)
|
||||
meta:set_string("formspec", formspec2(meta))
|
||||
return
|
||||
end
|
||||
|
||||
local cmnd, payload = command:match('^pipe%s+(%w+)%s*(.*)$')
|
||||
if cmnd then
|
||||
local resp = techage.transfer(
|
||||
pos,
|
||||
"B", -- outdir
|
||||
cmnd, -- topic
|
||||
payload, -- payload
|
||||
techage.BiogasPipe, -- network
|
||||
nil) -- valid nodes
|
||||
output(pos, dump(resp))
|
||||
return
|
||||
end
|
||||
|
||||
if command ~= "" then
|
||||
output(pos, CMNDS_TA3)
|
||||
end
|
||||
|
2
mod.conf
2
mod.conf
@ -1,4 +1,4 @@
|
||||
name = techage
|
||||
depends = default,tubelib2,basic_materials,bucket,stairs
|
||||
depends = default,tubelib2,basic_materials,bucket,stairs,screwdriver
|
||||
optional_depends = unified_inventory,wielded_light,minecart,unifieddyes
|
||||
description = Techage, go through 4 tech ages in search of wealth and power!
|
@ -17,6 +17,8 @@
|
||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
local D = techage.Debug
|
||||
|
||||
-- Techage Related Data
|
||||
local PWR = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).power end
|
||||
|
||||
@ -159,10 +161,6 @@ local function migrate(pos, mem, node)
|
||||
techage.power.secondary_start(pos, mem, mem.pwr_could_provide, mem.pwr_could_need)
|
||||
end
|
||||
end
|
||||
|
||||
if not mem.pwr_needed and not mem.pwr_available and not mem.pwr_available2 then
|
||||
mydbg("dbg", name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -220,8 +218,8 @@ local function accounting(pos, mem)
|
||||
mem.mst_supply2 = min(mem.mst_demand1 - mem.mst_supply1, mem.mst_available2)
|
||||
mem.mst_demand2 = min(mem.mst_supply1 - mem.mst_demand1, mem.mst_available1)
|
||||
mem.mst_reserve = (mem.mst_available1 + mem.mst_available2) - mem.mst_needed1
|
||||
mydbg("sts", "needed = "..mem.mst_needed1.."/"..mem.mst_needed2..", available = "..mem.mst_available1.."/"..mem.mst_available2)
|
||||
mydbg("sts", "supply = "..mem.mst_supply1.."/"..mem.mst_supply2..", demand = "..mem.mst_demand1.."/"..mem.mst_demand2..", reserve = "..mem.mst_reserve)
|
||||
if D.sts then D.dbg("needed = "..mem.mst_needed1.."/"..mem.mst_needed2..", available = "..mem.mst_available1.."/"..mem.mst_available2) end
|
||||
if D.sts then D.dbg("supply = "..mem.mst_supply1.."/"..mem.mst_supply2..", demand = "..mem.mst_demand1.."/"..mem.mst_demand2..", reserve = "..mem.mst_reserve) end
|
||||
end
|
||||
end
|
||||
|
||||
@ -242,7 +240,7 @@ end
|
||||
-- if no power available
|
||||
local function consumer_turn_off(pos, mem)
|
||||
local pwr = PWR(pos)
|
||||
mydbg("pwr", "consumer_turn_off")
|
||||
if D.pwr then D.dbg("consumer_turn_off") end
|
||||
if pwr and pwr.on_nopower then
|
||||
pwr.on_nopower(pos, mem)
|
||||
end
|
||||
@ -252,7 +250,7 @@ end
|
||||
|
||||
local function consumer_turn_on(pos, mem)
|
||||
local pwr = PWR(pos)
|
||||
mydbg("pwr", "consumer_turn_on")
|
||||
if D.pwr then D.dbg("consumer_turn_on") end
|
||||
if pwr and pwr.on_power then
|
||||
pwr.on_power(pos, mem)
|
||||
end
|
||||
@ -315,6 +313,7 @@ local function handle_consumer(mst_mem, mem, pos, power_needed)
|
||||
-- current cycle
|
||||
if (mst_mem.mst_demand1 or 0) >= power_needed then
|
||||
mst_mem.mst_demand1 = (mst_mem.mst_demand1 or 0) - power_needed
|
||||
if D.sts then D.dbg("consumer_turn_on: mst_demand = "..mst_mem.mst_demand1..", node = "..minetest.get_node(pos).name) end
|
||||
consumer_turn_on(pos, mem)
|
||||
end
|
||||
elseif mem.pwr_state == RUNNING then
|
||||
@ -328,6 +327,7 @@ local function handle_consumer(mst_mem, mem, pos, power_needed)
|
||||
mst_mem.mst_reserve = (mst_mem.mst_reserve or 0) - power_needed
|
||||
else -- no power available
|
||||
mst_mem.mst_demand1 = 0
|
||||
if D.sts then D.dbg("consumer_turn_off: mst_demand = "..mst_mem.mst_demand1..", node = "..minetest.get_node(pos).name) end
|
||||
consumer_turn_off(pos, mem)
|
||||
end
|
||||
end
|
||||
@ -362,7 +362,7 @@ local function trigger_nodes(mst_pos, mst_mem, dec)
|
||||
connection_walk(mst_pos, function(pos, mem)
|
||||
mem.pwr_node_alive_cnt = (mem.pwr_node_alive_cnt or 1) - dec
|
||||
mem.pwr_power_provided_cnt = 2
|
||||
--mydbg("pwr", "trigger_nodes", minetest.get_node(pos).name, mem.pwr_node_alive_cnt, mem.pwr_available2 or mem.pwr_available or mem.pwr_needed)
|
||||
if D.pwr then D.dbg("trigger_nodes", minetest.get_node(pos).name, mem.pwr_node_alive_cnt, mem.pwr_available2 or mem.pwr_available or mem.pwr_needed) end
|
||||
if mem.pwr_node_alive_cnt >= 0 then
|
||||
if mem.pwr_available then
|
||||
handle_generator(mst_mem, mem, pos, mem.pwr_available)
|
||||
@ -379,7 +379,7 @@ local function turn_off_nodes(mst_pos)
|
||||
Route = {}
|
||||
NumNodes = 0
|
||||
pos_already_reached(mst_pos)
|
||||
mydbg("pwr", "turn_off_nodes")
|
||||
if D.pwr then D.dbg("turn_off_nodes") end
|
||||
connection_walk(mst_pos, function(pos, mem)
|
||||
if (mem.pwr_node_alive_cnt or -1) >= 0 then
|
||||
if mem.pwr_needed then
|
||||
@ -409,7 +409,7 @@ end
|
||||
|
||||
-- called from master position
|
||||
local function power_distribution(pos, mem, dec)
|
||||
mydbg("pwr", "power_distribution")
|
||||
if D.pwr then D.dbg("power_distribution") end
|
||||
if mem.pwr_is_master then
|
||||
mem.mst_needed1 = 0
|
||||
mem.mst_needed2 = 0
|
||||
@ -426,7 +426,7 @@ end
|
||||
|
||||
-- To be called for each network change from any node
|
||||
function techage.power.network_changed(pos, mem)
|
||||
mydbg("pwr", "network_changed")
|
||||
if D.pwr then D.dbg("network_changed") end
|
||||
mem.pwr_node_alive_cnt = (mem.pwr_cycle_time or 2)/2 + 1
|
||||
if determine_new_master(pos, mem) then -- new master?
|
||||
power_distribution(pos, mem)
|
||||
@ -486,7 +486,7 @@ function techage.power.consumer_stop(pos, mem)
|
||||
end
|
||||
|
||||
function techage.power.consumer_alive(pos, mem)
|
||||
--mydbg("pwr", "consumer_alive", mem.pwr_power_provided_cnt, mem.pwr_cycle_time)
|
||||
if D.pwr then D.dbg("consumer_alive", mem.pwr_power_provided_cnt, mem.pwr_cycle_time) end
|
||||
mem.pwr_node_alive_cnt = (mem.pwr_cycle_time or 2)/2 + 1
|
||||
mem.pwr_power_provided_cnt = (mem.pwr_power_provided_cnt or 0) - 1
|
||||
if mem.pwr_power_provided_cnt < 0 and mem.pwr_state == RUNNING then
|
||||
@ -549,7 +549,7 @@ function techage.power.secondary_stop(pos, mem)
|
||||
end
|
||||
|
||||
function techage.power.secondary_alive(pos, mem, capa_curr, capa_max)
|
||||
--mydbg("pwr", "secondary_alive")
|
||||
if D.pwr then D.dbg("secondary_alive") end
|
||||
if capa_curr >= capa_max then
|
||||
mem.pwr_available2, mem.pwr_needed2 = mem.pwr_could_provide, 0 -- can provide only
|
||||
elseif capa_curr <= 0 then
|
||||
@ -560,7 +560,7 @@ function techage.power.secondary_alive(pos, mem, capa_curr, capa_max)
|
||||
|
||||
mem.pwr_node_alive_cnt = 2
|
||||
if mem.pwr_is_master then
|
||||
--mydbg("pwr", "secondary_alive is master")
|
||||
if D.pwr then D.dbg("secondary_alive is master") end
|
||||
power_distribution(pos, mem, 1)
|
||||
end
|
||||
return mem.pwr_provided or 0
|
||||
|
@ -138,7 +138,6 @@ function techage.power.register_node(names, pwr_def)
|
||||
-- To be called delayed, so that all network connections have been established
|
||||
minetest.after(0.2, network_changed, pos, mem)
|
||||
if pwr.after_tube_update then
|
||||
mydbg("tlib", "after_tube_update", node.name)
|
||||
return pwr.after_tube_update(node, pos, out_dir, peer_pos, peer_in_dir)
|
||||
end
|
||||
end,
|
||||
@ -201,7 +200,6 @@ end
|
||||
|
||||
-- Used to turn on/off the power by means of a power switch
|
||||
function techage.power.power_cut(pos, dir, cable, cut)
|
||||
mydbg("pwr", "power_cut")
|
||||
local npos = vector.add(pos, tubelib2.Dir6dToVector[dir or 0])
|
||||
|
||||
local node = minetest.get_node(npos)
|
||||
|
@ -20,48 +20,23 @@ local S = techage.S
|
||||
|
||||
local Pipe = tubelib2.Tube:new({
|
||||
dirs_to_check = {1,2,3,4,5,6},
|
||||
max_tube_length = 1000,
|
||||
max_tube_length = 100,
|
||||
show_infotext = false,
|
||||
force_to_use_tubes = true,
|
||||
tube_type = "ta4_pipe",
|
||||
primary_node_names = {"techage:ta4_pipeS", "techage:ta4_pipeA"},
|
||||
secondary_node_names = {},
|
||||
after_place_tube = function(pos, param2, tube_type, num_tubes)
|
||||
-- Don't replace "hidden" cable
|
||||
if M(pos):get_string("techage_hidden_nodename") == "" then
|
||||
minetest.swap_node(pos, {name = "techage:ta4_pipe"..tube_type, param2 = param2 % 32})
|
||||
end
|
||||
M(pos):set_int("tl2_param2", param2)
|
||||
minetest.swap_node(pos, {name = "techage:ta4_pipe"..tube_type, param2 = param2})
|
||||
end,
|
||||
})
|
||||
|
||||
Pipe:register_on_tube_update(function(node, pos, out_dir, peer_pos, peer_in_dir)
|
||||
minetest.registered_nodes[node.name].after_tube_update(node, pos, out_dir, peer_pos, peer_in_dir)
|
||||
end)
|
||||
|
||||
techage.BiogasPipe = Pipe
|
||||
|
||||
|
||||
-- Overridden method of tubelib2!
|
||||
function Pipe:get_primary_node_param2(pos, dir)
|
||||
return techage.get_primary_node_param2(pos, dir)
|
||||
end
|
||||
|
||||
function Pipe:is_primary_node(pos, dir)
|
||||
return techage.is_primary_node(pos, dir)
|
||||
end
|
||||
|
||||
function Pipe:get_secondary_node(pos, dir)
|
||||
local npos = vector.add(pos, tubelib2.Dir6dToVector[dir or 0])
|
||||
local node = self:get_node_lvm(npos)
|
||||
if self.secondary_node_names[node.name] or
|
||||
self.secondary_node_names[M(npos):get_string("techage_hidden_nodename")] then
|
||||
return node, npos
|
||||
end
|
||||
end
|
||||
|
||||
function Pipe:is_secondary_node(pos, dir)
|
||||
local npos = vector.add(pos, tubelib2.Dir6dToVector[dir or 0])
|
||||
local node = self:get_node_lvm(npos)
|
||||
return self.secondary_node_names[node.name] or
|
||||
self.secondary_node_names[M(npos):get_string("techage_hidden_nodename")]
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta4_pipeS", {
|
||||
description = S("TA4 Pipe"),
|
||||
tiles = {
|
||||
@ -82,10 +57,7 @@ minetest.register_node("techage:ta4_pipeS", {
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
if oldmetadata and oldmetadata.fields and oldmetadata.fields.tl2_param2 then
|
||||
oldnode.param2 = oldmetadata.fields.tl2_param2
|
||||
Pipe:after_dig_tube(pos, oldnode)
|
||||
end
|
||||
Pipe:after_dig_tube(pos, oldnode)
|
||||
end,
|
||||
|
||||
paramtype2 = "facedir", -- important!
|
||||
@ -100,7 +72,7 @@ minetest.register_node("techage:ta4_pipeS", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2, techage_trowel = 1},
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
||||
@ -116,10 +88,7 @@ minetest.register_node("techage:ta4_pipeA", {
|
||||
},
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
if oldmetadata and oldmetadata.fields and oldmetadata.fields.tl2_param2 then
|
||||
oldnode.param2 = oldmetadata.fields.tl2_param2
|
||||
Pipe:after_dig_tube(pos, oldnode)
|
||||
end
|
||||
Pipe:after_dig_tube(pos, oldnode)
|
||||
end,
|
||||
|
||||
paramtype2 = "facedir", -- important!
|
||||
@ -137,18 +106,11 @@ minetest.register_node("techage:ta4_pipeA", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2, techage_trowel = 1, not_in_creative_inventory=1},
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
drop = "techage:ta4_pipeS",
|
||||
})
|
||||
|
||||
Pipe:register_on_tube_update(function(node, pos, out_dir, peer_pos, peer_in_dir)
|
||||
if minetest.registered_nodes[node.name].after_tube_update then
|
||||
minetest.registered_nodes[node.name].after_tube_update(node, pos, out_dir, peer_pos, peer_in_dir)
|
||||
else
|
||||
techage.power.after_tube_update(node, pos, out_dir, peer_pos, peer_in_dir, Cable)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta4_pipeS 3",
|
||||
|
@ -58,7 +58,6 @@ local function node_timer(pos, elapsed)
|
||||
mem.capa = 0
|
||||
end
|
||||
end
|
||||
mydbg("tst", "PWR_CAPA = "..PWR_CAPA..", mem.capa = "..mem.capa..", light = "..light)
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -24,7 +24,6 @@ local BURN_CYCLE_FACTOR = 0.8
|
||||
|
||||
local function node_timer(pos, elapsed)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
mydbg("dbg", "firebox burn_cycles = "..(mem.burn_cycles or 0))
|
||||
if mem.running then
|
||||
local power = techage.transfer(
|
||||
{x=pos.x, y=pos.y+2, z=pos.z},
|
||||
|
BIN
textures/techage_gravel4.png
Normal file
BIN
textures/techage_gravel4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 330 B |
BIN
textures/techage_hole_ta4.png
Normal file
BIN
textures/techage_hole_ta4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 180 B |
Binary file not shown.
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 387 B |
Binary file not shown.
Before Width: | Height: | Size: 206 B |
Loading…
Reference in New Issue
Block a user