power distribution bugfix, redstone recipe changed, display infotext added, silo and tank bugfixes, tin probability increased
This commit is contained in:
parent
831783dda6
commit
0c3138ac50
@ -122,6 +122,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
|
|||||||
nominal = tNode.power_consumption[stage],
|
nominal = tNode.power_consumption[stage],
|
||||||
on_power = on_power,
|
on_power = on_power,
|
||||||
on_nopower = on_nopower,
|
on_nopower = on_nopower,
|
||||||
|
is_running = function(pos, nvm) return techage.is_running(nvm) end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if tNode.networks and tNode.networks.pipe2 then
|
if tNode.networks and tNode.networks.pipe2 then
|
||||||
|
@ -354,6 +354,8 @@ local tubing = {
|
|||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
if nvm.techage_state == techage.RUNNING then
|
if nvm.techage_state == techage.RUNNING then
|
||||||
play_sound(pos)
|
play_sound(pos)
|
||||||
|
else
|
||||||
|
stop_sound(pos)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,9 @@ local ore_probability = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local ProbabilityCorrections = {
|
local ProbabilityCorrections = {
|
||||||
|
["default:tin_lump"] = 0.5, -- extensively used
|
||||||
["default:coal_lump"] = 0.3, -- extensively used
|
["default:coal_lump"] = 0.3, -- extensively used
|
||||||
["default:iron_lump"] = 0.4, -- extensively used
|
["default:iron_lump"] = 0.5, -- extensively used
|
||||||
["techage:baborium_lump"] = 99999, -- mining required
|
["techage:baborium_lump"] = 99999, -- mining required
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,6 +148,10 @@ function techage.is_operational(nvm)
|
|||||||
return state < NOPOWER
|
return state < NOPOWER
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function techage.is_running(nvm)
|
||||||
|
return (nvm.techage_state or STOPPED) == RUNNING
|
||||||
|
end
|
||||||
|
|
||||||
-- consumes power
|
-- consumes power
|
||||||
function techage.needs_power(nvm)
|
function techage.needs_power(nvm)
|
||||||
local state = nvm.techage_state or STOPPED
|
local state = nvm.techage_state or STOPPED
|
||||||
|
@ -59,6 +59,10 @@ local function on_nopower(pos)
|
|||||||
nvm.has_power = false
|
nvm.has_power = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function is_running(pos, nvm)
|
||||||
|
return nvm.has_power
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node("techage:ta4_reactor_stand", {
|
minetest.register_node("techage:ta4_reactor_stand", {
|
||||||
description = S("TA4 Reactor Stand"),
|
description = S("TA4 Reactor Stand"),
|
||||||
tiles = {
|
tiles = {
|
||||||
@ -134,6 +138,7 @@ minetest.register_node("techage:ta4_reactor_stand", {
|
|||||||
on_power = on_power,
|
on_power = on_power,
|
||||||
on_nopower = on_nopower,
|
on_nopower = on_nopower,
|
||||||
nominal = PWR_NEEDED,
|
nominal = PWR_NEEDED,
|
||||||
|
is_running = is_running,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -93,6 +93,10 @@ end
|
|||||||
local function on_nopower(pos)
|
local function on_nopower(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function is_running(pos, nvm)
|
||||||
|
return nvm.charging
|
||||||
|
end
|
||||||
|
|
||||||
local function start_node(pos, nvm)
|
local function start_node(pos, nvm)
|
||||||
nvm.running = true
|
nvm.running = true
|
||||||
nvm.needed = 0
|
nvm.needed = 0
|
||||||
@ -196,6 +200,7 @@ local net_def = {
|
|||||||
nominal = PWR_PERF,
|
nominal = PWR_PERF,
|
||||||
on_power = on_power,
|
on_power = on_power,
|
||||||
on_nopower = on_nopower,
|
on_nopower = on_nopower,
|
||||||
|
is_running = is_running,
|
||||||
},
|
},
|
||||||
pipe2 = {
|
pipe2 = {
|
||||||
sides = {L = 1, R = 1},
|
sides = {L = 1, R = 1},
|
||||||
@ -279,6 +284,8 @@ techage.register_node({"techage:heatexchanger1"}, {
|
|||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
if nvm.running and nvm.charging then
|
if nvm.running and nvm.charging then
|
||||||
play_sound(pos)
|
play_sound(pos)
|
||||||
|
else
|
||||||
|
stop_sound(pos)
|
||||||
end
|
end
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
nvm.capa = (nvm.capa or 0) + (mem.capa or 0)
|
nvm.capa = (nvm.capa or 0) + (mem.capa or 0)
|
||||||
|
@ -93,16 +93,6 @@ local function tubelib2_on_update2(pos, outdir, tlib2, node)
|
|||||||
power.update_network(pos, outdir, tlib2)
|
power.update_network(pos, outdir, tlib2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local net_def = {
|
|
||||||
ele1 = {
|
|
||||||
sides = {B = true, F = true, L = true, D = true, U = true},
|
|
||||||
ntype = "con1",
|
|
||||||
on_power = on_power,
|
|
||||||
on_nopower = on_nopower,
|
|
||||||
nominal = PWR_NEEDED,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
minetest.register_node("techage:ta3_booster", {
|
minetest.register_node("techage:ta3_booster", {
|
||||||
description = S("TA3 Booster"),
|
description = S("TA3 Booster"),
|
||||||
tiles = {
|
tiles = {
|
||||||
@ -119,7 +109,15 @@ minetest.register_node("techage:ta3_booster", {
|
|||||||
after_place_node = after_place_node,
|
after_place_node = after_place_node,
|
||||||
after_dig_node = after_dig_node,
|
after_dig_node = after_dig_node,
|
||||||
tubelib2_on_update2 = tubelib2_on_update2,
|
tubelib2_on_update2 = tubelib2_on_update2,
|
||||||
networks = net_def,
|
networks = {
|
||||||
|
ele1 = {
|
||||||
|
sides = {B = true, F = true, L = true, D = true, U = true},
|
||||||
|
ntype = "con1",
|
||||||
|
on_power = on_power,
|
||||||
|
on_nopower = on_nopower,
|
||||||
|
nominal = PWR_NEEDED,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2, crumbly=2, choppy=2},
|
groups = {cracky=2, crumbly=2, choppy=2},
|
||||||
@ -162,7 +160,16 @@ minetest.register_node("techage:ta3_booster_on", {
|
|||||||
after_place_node = after_place_node,
|
after_place_node = after_place_node,
|
||||||
after_dig_node = after_dig_node,
|
after_dig_node = after_dig_node,
|
||||||
tubelib2_on_update2 = tubelib2_on_update2,
|
tubelib2_on_update2 = tubelib2_on_update2,
|
||||||
networks = net_def,
|
networks = {
|
||||||
|
ele1 = {
|
||||||
|
sides = {B = true, F = true, L = true, D = true, U = true},
|
||||||
|
ntype = "con1",
|
||||||
|
on_power = on_power,
|
||||||
|
on_nopower = on_nopower,
|
||||||
|
nominal = PWR_NEEDED,
|
||||||
|
is_running = function() return true end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {not_in_creative_inventory = 1},
|
groups = {not_in_creative_inventory = 1},
|
||||||
|
@ -90,6 +90,12 @@ local function process(inv, recipe, output)
|
|||||||
if not inv:room_for_item("dst", stack) then
|
if not inv:room_for_item("dst", stack) then
|
||||||
return techage.BLOCKED
|
return techage.BLOCKED
|
||||||
end
|
end
|
||||||
|
-- handle waste
|
||||||
|
if recipe.waste then
|
||||||
|
if not inv:room_for_item("dst", ItemStack(recipe.waste)) then
|
||||||
|
return techage.BLOCKED
|
||||||
|
end
|
||||||
|
end
|
||||||
-- remove items
|
-- remove items
|
||||||
local list = inv:get_list("src")
|
local list = inv:get_list("src")
|
||||||
for _,item in ipairs(recipe.input) do
|
for _,item in ipairs(recipe.input) do
|
||||||
@ -101,6 +107,14 @@ local function process(inv, recipe, output)
|
|||||||
inv:set_list("src", list)
|
inv:set_list("src", list)
|
||||||
-- add output to dst
|
-- add output to dst
|
||||||
inv:add_item("dst", stack)
|
inv:add_item("dst", stack)
|
||||||
|
-- add waste to dst
|
||||||
|
if recipe.waste then
|
||||||
|
local leftover = inv:add_item("dst", ItemStack(recipe.waste))
|
||||||
|
if leftover:get_count() > 0 then
|
||||||
|
inv:set_list("src", leftover)
|
||||||
|
return techage.BLOCKED
|
||||||
|
end
|
||||||
|
end
|
||||||
return techage.RUNNING
|
return techage.RUNNING
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -198,6 +212,7 @@ function techage.furnace.register_recipe(recipe)
|
|||||||
end
|
end
|
||||||
table.insert(Recipes[output], {
|
table.insert(Recipes[output], {
|
||||||
input = recipe.recipe,
|
input = recipe.recipe,
|
||||||
|
waste = recipe.waste,
|
||||||
number = number,
|
number = number,
|
||||||
time = math.max((recipe.time or 3) * number, 2),
|
time = math.max((recipe.time or 3) * number, 2),
|
||||||
})
|
})
|
||||||
|
@ -62,16 +62,6 @@ local function tubelib2_on_update2(pos, outdir, tlib2, node)
|
|||||||
power.update_network(pos, outdir, tlib2)
|
power.update_network(pos, outdir, tlib2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local net_def = {
|
|
||||||
ele1 = {
|
|
||||||
sides = {B = true, F = true, L = true, D = true, U = true},
|
|
||||||
ntype = "con1",
|
|
||||||
on_power = on_power,
|
|
||||||
on_nopower = on_nopower,
|
|
||||||
nominal = PWR_NEEDED,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
minetest.register_node("techage:furnace_heater", {
|
minetest.register_node("techage:furnace_heater", {
|
||||||
description = S("TA4 Furnace Heater"),
|
description = S("TA4 Furnace Heater"),
|
||||||
tiles = {
|
tiles = {
|
||||||
@ -88,7 +78,15 @@ minetest.register_node("techage:furnace_heater", {
|
|||||||
after_place_node = after_place_node,
|
after_place_node = after_place_node,
|
||||||
after_dig_node = after_dig_node,
|
after_dig_node = after_dig_node,
|
||||||
tubelib2_on_update2 = tubelib2_on_update2,
|
tubelib2_on_update2 = tubelib2_on_update2,
|
||||||
networks = net_def,
|
networks = {
|
||||||
|
ele1 = {
|
||||||
|
sides = {B = true, F = true, L = true, D = true, U = true},
|
||||||
|
ntype = "con1",
|
||||||
|
on_power = on_power,
|
||||||
|
on_nopower = on_nopower,
|
||||||
|
nominal = PWR_NEEDED,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2, crumbly=2, choppy=2},
|
groups = {cracky=2, crumbly=2, choppy=2},
|
||||||
@ -113,7 +111,16 @@ minetest.register_node("techage:furnace_heater_on", {
|
|||||||
after_place_node = after_place_node,
|
after_place_node = after_place_node,
|
||||||
after_dig_node = after_dig_node,
|
after_dig_node = after_dig_node,
|
||||||
tubelib2_on_update2 = tubelib2_on_update2,
|
tubelib2_on_update2 = tubelib2_on_update2,
|
||||||
networks = net_def,
|
networks = {
|
||||||
|
ele1 = {
|
||||||
|
sides = {B = true, F = true, L = true, D = true, U = true},
|
||||||
|
ntype = "con1",
|
||||||
|
on_power = on_power,
|
||||||
|
on_nopower = on_nopower,
|
||||||
|
nominal = PWR_NEEDED,
|
||||||
|
is_running = function() return true end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
light_source = 8,
|
light_source = 8,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -86,6 +86,9 @@ local function on_nopower(pos)
|
|||||||
nvm.running = false
|
nvm.running = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function is_running(pos, nvm)
|
||||||
|
return nvm.running
|
||||||
|
end
|
||||||
|
|
||||||
local function generating(pos, nvm)
|
local function generating(pos, nvm)
|
||||||
nvm.num_pwr_units = nvm.num_pwr_units or 0
|
nvm.num_pwr_units = nvm.num_pwr_units or 0
|
||||||
@ -172,6 +175,7 @@ local netw_def = {
|
|||||||
on_power = on_power,
|
on_power = on_power,
|
||||||
on_nopower = on_nopower,
|
on_nopower = on_nopower,
|
||||||
nominal = PWR_NEEDED,
|
nominal = PWR_NEEDED,
|
||||||
|
is_running = is_running,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
local S = techage.S
|
||||||
|
|
||||||
local NUM_ROWS = 5
|
local NUM_ROWS = 5
|
||||||
local RADIUS = 6
|
local RADIUS = 6
|
||||||
local Param2ToFacedir = {[0] = 0, 0, 3, 1, 2, 0}
|
local Param2ToFacedir = {[0] = 0, 0, 3, 1, 2, 0}
|
||||||
@ -81,7 +83,7 @@ local lcd_box = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
minetest.register_node("techage:ta4_display", {
|
minetest.register_node("techage:ta4_display", {
|
||||||
description = "TA4 Display",
|
description = S("TA4 Display"),
|
||||||
inventory_image = 'techage_display_inventory.png',
|
inventory_image = 'techage_display_inventory.png',
|
||||||
tiles = {"techage_display.png"},
|
tiles = {"techage_display.png"},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
@ -101,6 +103,7 @@ minetest.register_node("techage:ta4_display", {
|
|||||||
local number = techage.add_node(pos, "techage:ta4_display")
|
local number = techage.add_node(pos, "techage:ta4_display")
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("number", number)
|
meta:set_string("number", number)
|
||||||
|
meta:set_string("infotext", S("Display no: ")..number)
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
nvm.text = {"My", "Techage","TA4", "Display", "No: "..number}
|
nvm.text = {"My", "Techage","TA4", "Display", "No: "..number}
|
||||||
lcdlib.update_entities(pos)
|
lcdlib.update_entities(pos)
|
||||||
@ -127,7 +130,7 @@ local lcd_boxXL = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
minetest.register_node("techage:ta4_displayXL", {
|
minetest.register_node("techage:ta4_displayXL", {
|
||||||
description = "TA4 Display XL",
|
description = S("TA4 Display XL"),
|
||||||
inventory_image = 'techage_display_inventoryXL.png',
|
inventory_image = 'techage_display_inventoryXL.png',
|
||||||
tiles = {"techage_displayXL.png"},
|
tiles = {"techage_displayXL.png"},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
@ -147,6 +150,7 @@ minetest.register_node("techage:ta4_displayXL", {
|
|||||||
local number = techage.add_node(pos, "techage:ta4_displayXL")
|
local number = techage.add_node(pos, "techage:ta4_displayXL")
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("number", number)
|
meta:set_string("number", number)
|
||||||
|
meta:set_string("infotext", S("Display no: ")..number)
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
nvm.text = {"My", "Techage","TA4", "Display", "No: "..number}
|
nvm.text = {"My", "Techage","TA4", "Display", "No: "..number}
|
||||||
lcdlib.update_entities(pos)
|
lcdlib.update_entities(pos)
|
||||||
@ -214,14 +218,9 @@ local function write_row(pos, payload, cycle_time)
|
|||||||
mem.ticks = cycle_time
|
mem.ticks = cycle_time
|
||||||
end
|
end
|
||||||
|
|
||||||
if row < 0 then row = 1 end
|
if row < 1 then row = 1 end
|
||||||
if row > NUM_ROWS then row = NUM_ROWS end
|
if row > NUM_ROWS then row = NUM_ROWS end
|
||||||
|
|
||||||
if row == 0 then
|
|
||||||
meta:set_string("infotext", str)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
while #nvm.text < row do
|
while #nvm.text < row do
|
||||||
table.insert(nvm.text, "")
|
table.insert(nvm.text, "")
|
||||||
end
|
end
|
||||||
|
@ -17,6 +17,7 @@ local S = techage.S
|
|||||||
minetest.register_craftitem("techage:gibbsite_powder", {
|
minetest.register_craftitem("techage:gibbsite_powder", {
|
||||||
description = S("Gibbsite Powder"),
|
description = S("Gibbsite Powder"),
|
||||||
inventory_image = "techage_powder_inv.png^[colorize:#C6DCDB:120",
|
inventory_image = "techage_powder_inv.png^[colorize:#C6DCDB:120",
|
||||||
|
groups = {powder = 1},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("techage:aluminum", {
|
minetest.register_craftitem("techage:aluminum", {
|
||||||
|
@ -41,6 +41,7 @@ minetest.register_node("techage:bauxite_gravel", {
|
|||||||
minetest.register_craftitem("techage:bauxite_powder", {
|
minetest.register_craftitem("techage:bauxite_powder", {
|
||||||
description = S("Bauxite Powder"),
|
description = S("Bauxite Powder"),
|
||||||
inventory_image = "techage_powder_inv.png^[colorize:#FB2A00:120",
|
inventory_image = "techage_powder_inv.png^[colorize:#FB2A00:120",
|
||||||
|
groups = {powder = 1},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,11 +17,13 @@ local S = techage.S
|
|||||||
minetest.register_craftitem("techage:leave_powder", {
|
minetest.register_craftitem("techage:leave_powder", {
|
||||||
description = S("Leave Powder"),
|
description = S("Leave Powder"),
|
||||||
inventory_image = "techage_powder_inv.png^[colorize:#71a157:120",
|
inventory_image = "techage_powder_inv.png^[colorize:#71a157:120",
|
||||||
|
groups = {powder = 1},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("techage:needle_powder", {
|
minetest.register_craftitem("techage:needle_powder", {
|
||||||
description = S("Needle Powder"),
|
description = S("Needle Powder"),
|
||||||
inventory_image = "techage_powder_inv.png^[colorize:#1c800f:120",
|
inventory_image = "techage_powder_inv.png^[colorize:#1c800f:120",
|
||||||
|
groups = {powder = 1},
|
||||||
})
|
})
|
||||||
|
|
||||||
techage.add_grinder_recipe({input="default:acacia_bush_leaves", output="techage:leave_powder"})
|
techage.add_grinder_recipe({input="default:acacia_bush_leaves", output="techage:leave_powder"})
|
||||||
|
@ -95,9 +95,10 @@ minetest.register_craft({
|
|||||||
techage.furnace.register_recipe({
|
techage.furnace.register_recipe({
|
||||||
output = "techage:red_stone",
|
output = "techage:red_stone",
|
||||||
recipe = {
|
recipe = {
|
||||||
"techage:redmud",
|
"techage:canister_redmud",
|
||||||
"default:sand",
|
"default:sand",
|
||||||
},
|
},
|
||||||
|
waste = "techage:ta3_canister_empty",
|
||||||
time = 4,
|
time = 4,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ minetest.register_craftitem("techage:usmium_nuggets", {
|
|||||||
minetest.register_craftitem("techage:usmium_powder", {
|
minetest.register_craftitem("techage:usmium_powder", {
|
||||||
description = S("Usmium Powder"),
|
description = S("Usmium Powder"),
|
||||||
inventory_image = "techage_powder_inv.png^[colorize:#46728E:120",
|
inventory_image = "techage_powder_inv.png^[colorize:#46728E:120",
|
||||||
|
groups = {powder = 1},
|
||||||
})
|
})
|
||||||
|
|
||||||
techage.add_grinder_recipe({input="techage:usmium_nuggets", output="techage:usmium_powder"})
|
techage.add_grinder_recipe({input="techage:usmium_nuggets", output="techage:usmium_powder"})
|
||||||
|
@ -39,10 +39,18 @@ end
|
|||||||
|
|
||||||
local function on_power(pos)
|
local function on_power(pos)
|
||||||
swap_node(pos, "on")
|
swap_node(pos, "on")
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
nvm.turned_on = true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_nopower(pos)
|
local function on_nopower(pos)
|
||||||
swap_node(pos, "off")
|
swap_node(pos, "off")
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
nvm.turned_on = false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function is_running(pos, nvm)
|
||||||
|
return nvm.turned_on
|
||||||
end
|
end
|
||||||
|
|
||||||
local function node_timer(pos, elapsed)
|
local function node_timer(pos, elapsed)
|
||||||
@ -106,6 +114,7 @@ local net_def = {
|
|||||||
on_power = on_power,
|
on_power = on_power,
|
||||||
on_nopower = on_nopower,
|
on_nopower = on_nopower,
|
||||||
nominal = PWR_NEEDED,
|
nominal = PWR_NEEDED,
|
||||||
|
is_running = is_running,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,6 +125,7 @@ local net_def2 = {
|
|||||||
on_power = on_power,
|
on_power = on_power,
|
||||||
on_nopower = on_nopower,
|
on_nopower = on_nopower,
|
||||||
nominal = PWR_NEEDED * 2,
|
nominal = PWR_NEEDED * 2,
|
||||||
|
is_running = is_running,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ local function get_netID(pos, outdir)
|
|||||||
return nvm.pipe2 and nvm.pipe2.netIDs and nvm.pipe2.netIDs[outdir]
|
return nvm.pipe2 and nvm.pipe2.netIDs and nvm.pipe2.netIDs[outdir]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- return list of nodes {pos = ..., indir = ...} of given type
|
||||||
local function get_network_table(pos, outdir, ntype)
|
local function get_network_table(pos, outdir, ntype)
|
||||||
local netID = get_netID(pos, outdir)
|
local netID = get_netID(pos, outdir)
|
||||||
if netID then
|
if netID then
|
||||||
@ -133,7 +134,7 @@ function liquid.put(pos, outdir, name, amount, player_name)
|
|||||||
return amount or 0
|
return amount or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Take given amount of liquid for the remote inventory.
|
-- Take given amount of liquid from the remote inventory.
|
||||||
-- return taken amount and item name
|
-- return taken amount and item name
|
||||||
function liquid.take(pos, outdir, name, amount, player_name)
|
function liquid.take(pos, outdir, name, amount, player_name)
|
||||||
local taken = 0
|
local taken = 0
|
||||||
|
@ -97,11 +97,15 @@ local tLiquid = {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
put = function(pos, indir, name, amount)
|
put = function(pos, indir, name, amount)
|
||||||
local inv = M(pos):get_inventory()
|
-- check if it is powder
|
||||||
local stack = ItemStack(name.." "..amount)
|
local ndef = minetest.registered_craftitems[name] or {}
|
||||||
if inv:room_for_item("main", stack) then
|
if ndef.groups and ndef.groups.powder == 1 then
|
||||||
inv:add_item("main", stack)
|
local inv = M(pos):get_inventory()
|
||||||
return 0
|
local stack = ItemStack(name.." "..amount)
|
||||||
|
if inv:room_for_item("main", stack) then
|
||||||
|
inv:add_item("main", stack)
|
||||||
|
return 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return amount
|
return amount
|
||||||
end,
|
end,
|
||||||
|
@ -54,12 +54,17 @@ local function take_liquid(pos, indir, name, amount)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function put_liquid(pos, indir, name, amount)
|
local function put_liquid(pos, indir, name, amount)
|
||||||
local leftover = liquid.srv_put(pos, indir, name, amount)
|
-- check if it is not powder
|
||||||
if techage.is_activeformspec(pos) then
|
local ndef = minetest.registered_craftitems[name] or {}
|
||||||
local nvm = techage.get_nvm(pos)
|
if not ndef.groups or ndef.groups.powder ~= 1 then
|
||||||
M(pos):set_string("formspec", liquid.formspec(pos, nvm))
|
local leftover = liquid.srv_put(pos, indir, name, amount)
|
||||||
|
if techage.is_activeformspec(pos) then
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
M(pos):set_string("formspec", liquid.formspec(pos, nvm))
|
||||||
|
end
|
||||||
|
return leftover
|
||||||
end
|
end
|
||||||
return leftover
|
return amount
|
||||||
end
|
end
|
||||||
|
|
||||||
local networks_def = {
|
local networks_def = {
|
||||||
|
@ -76,6 +76,10 @@ local function on_nopower(pos)
|
|||||||
swap_node(pos, false)
|
swap_node(pos, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function is_running(pos, nvm)
|
||||||
|
return nvm.running
|
||||||
|
end
|
||||||
|
|
||||||
local function pump_cmnd(pos, cmnd, payload)
|
local function pump_cmnd(pos, cmnd, payload)
|
||||||
return techage.transfer(
|
return techage.transfer(
|
||||||
pos,
|
pos,
|
||||||
@ -178,6 +182,7 @@ local net_def = {
|
|||||||
on_power = on_power,
|
on_power = on_power,
|
||||||
on_nopower = on_nopower,
|
on_nopower = on_nopower,
|
||||||
nominal = PWR_NEEDED,
|
nominal = PWR_NEEDED,
|
||||||
|
is_running = is_running,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ local function stop_consumer(tbl, tlib_type)
|
|||||||
for _,v in pairs(tbl or {}) do
|
for _,v in pairs(tbl or {}) do
|
||||||
local nvm = techage.get_nvm(v.pos)
|
local nvm = techage.get_nvm(v.pos)
|
||||||
local def = nvm[tlib_type] -- power related network data
|
local def = nvm[tlib_type] -- power related network data
|
||||||
if def and def["cstate"] == RUNNING then
|
local ndef = net_def(v.pos, tlib_type)
|
||||||
local ndef = net_def(v.pos, tlib_type)
|
if (def and def["cstate"] == RUNNING) or (ndef.is_running and ndef.is_running(v.pos, nvm)) then
|
||||||
def["cstate"] = NOPOWER
|
def["cstate"] = NOPOWER
|
||||||
def["taken"] = 0
|
def["taken"] = 0
|
||||||
if ndef.on_nopower then
|
if ndef.on_nopower then
|
||||||
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 327 KiB |
@ -137,6 +137,7 @@ minetest.register_node("techage:ta4_solar_module", {
|
|||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
groups = {cracky=2, crumbly=2, choppy=2},
|
groups = {cracky=2, crumbly=2, choppy=2},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techage:ta4_solar_carrier", {
|
minetest.register_node("techage:ta4_solar_carrier", {
|
||||||
@ -175,6 +176,7 @@ minetest.register_node("techage:ta4_solar_carrier", {
|
|||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
groups = {cracky=2, crumbly=2, choppy=2},
|
groups = {cracky=2, crumbly=2, choppy=2},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techage:ta4_solar_carrierB", {
|
minetest.register_node("techage:ta4_solar_carrierB", {
|
||||||
@ -213,6 +215,7 @@ minetest.register_node("techage:ta4_solar_carrierB", {
|
|||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
groups = {cracky=2, crumbly=2, choppy=2},
|
groups = {cracky=2, crumbly=2, choppy=2},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techage:ta4_solar_carrierT", {
|
minetest.register_node("techage:ta4_solar_carrierT", {
|
||||||
@ -239,6 +242,7 @@ minetest.register_node("techage:ta4_solar_carrierT", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2, crumbly=2, choppy=2},
|
groups = {cracky=2, crumbly=2, choppy=2},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
Cable:add_secondary_node_names({"techage:ta4_solar_carrier", "techage:ta4_solar_carrierB"})
|
Cable:add_secondary_node_names({"techage:ta4_solar_carrier", "techage:ta4_solar_carrierB"})
|
||||||
|
Loading…
Reference in New Issue
Block a user