bugfixes and improvements
This commit is contained in:
parent
c8f685c0d5
commit
3b33cfec36
@ -3,12 +3,12 @@
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019 Joachim Stolberg
|
||||
Copyright (C) 2019-2020 Joachim Stolberg
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
Forceload block
|
||||
Forceload block
|
||||
|
||||
]]--
|
||||
|
||||
@ -82,7 +82,7 @@ end
|
||||
local function shoe_flbs(pos, name, range)
|
||||
local pos1 = {x=pos.x-range, y=pos.y-range, z=pos.z-range}
|
||||
local pos2 = {x=pos.x+range, y=pos.y+range, z=pos.z+range}
|
||||
for _,npos in ipairs(minetest.find_nodes_in_area(pos1, pos2, {"techage:forceload"})) do
|
||||
for _,npos in ipairs(minetest.find_nodes_in_area(pos1, pos2, {"techage:forceload", "techage:forceloadtile"})) do
|
||||
local _pos1, _pos2 = calc_area(npos)
|
||||
local owner = M(npos):get_string("owner")
|
||||
techage.mark_region(name, _pos1, _pos2, owner)
|
||||
@ -119,6 +119,53 @@ local function formspec(name)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_place(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
return minetest.rotate_and_place(itemstack, placer, pointed_thing)
|
||||
end
|
||||
|
||||
local function after_place_node(pos, placer, itemstack)
|
||||
if add_pos(pos, placer) then
|
||||
minetest.forceload_block(pos, true)
|
||||
local pos1, pos2, num, max = get_data(pos, placer)
|
||||
M(pos):set_string("infotext", "Area "..P2S(pos1).." to "..P2S(pos2).." "..S("loaded").."!\n"..
|
||||
S("Punch the block to make the area visible."))
|
||||
chat(placer, "Area ("..num.."/"..max..") "..P2S(pos1).." to "..P2S(pos2).." "..S("loaded").."!")
|
||||
techage.mark_region(placer:get_player_name(), pos1, pos2)
|
||||
M(pos):set_string("owner", placer:get_player_name())
|
||||
else
|
||||
chat(placer, S("Area already loaded or max. number of Forceload Blocks reached!"))
|
||||
minetest.remove_node(pos)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
|
||||
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
local player = minetest.get_player_by_name(oldmetadata.fields.owner)
|
||||
if player then
|
||||
del_pos(pos, player)
|
||||
end
|
||||
minetest.forceload_free_block(pos, true)
|
||||
techage.unmark_region(oldmetadata.fields.owner)
|
||||
end
|
||||
|
||||
local function on_rightclick(pos, node, clicker, itemstack, pointed_thing)
|
||||
local owner = M(pos):get_string("owner")
|
||||
local name = clicker:get_player_name()
|
||||
if name == owner or minetest.check_player_privs(name, "server") then
|
||||
local s = formspec(owner)
|
||||
if s then
|
||||
minetest.show_formspec(owner, "techage:forceload", s)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function on_punch(pos, node, puncher, pointed_thing)
|
||||
local pos1, pos2 = calc_area(pos)
|
||||
techage.switch_region(puncher:get_player_name(), pos1, pos2)
|
||||
end
|
||||
|
||||
minetest.register_node("techage:forceload", {
|
||||
description = S("Techage Forceload Block"),
|
||||
@ -138,47 +185,11 @@ minetest.register_node("techage:forceload", {
|
||||
},
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
if add_pos(pos, placer) then
|
||||
minetest.forceload_block(pos, true)
|
||||
local pos1, pos2, num, max = get_data(pos, placer)
|
||||
M(pos):set_string("infotext", "Area "..P2S(pos1).." to "..P2S(pos2).." "..S("loaded").."!\n"..
|
||||
S("Punch the block to make the area visible."))
|
||||
chat(placer, "Area ("..num.."/"..max..") "..P2S(pos1).." to "..P2S(pos2).." "..S("loaded").."!")
|
||||
techage.mark_region(placer:get_player_name(), pos1, pos2)
|
||||
M(pos):set_string("owner", placer:get_player_name())
|
||||
else
|
||||
chat(placer, S("Area already loaded or max. number of Forceload Blocks reached!"))
|
||||
minetest.remove_node(pos)
|
||||
return itemstack
|
||||
end
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local player = minetest.get_player_by_name(oldmetadata.fields.owner)
|
||||
if player then
|
||||
del_pos(pos, player)
|
||||
end
|
||||
minetest.forceload_free_block(pos, true)
|
||||
techage.unmark_region(oldmetadata.fields.owner)
|
||||
end,
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
on_rightclick = on_rightclick,
|
||||
on_punch = on_punch,
|
||||
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local owner = M(pos):get_string("owner")
|
||||
local name = clicker:get_player_name()
|
||||
if name == owner or minetest.check_player_privs(name, "server") then
|
||||
local s = formspec(owner)
|
||||
if s then
|
||||
minetest.show_formspec(owner, "techage:forceload", s)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
on_punch = function(pos, node, puncher, pointed_thing)
|
||||
local pos1, pos2 = calc_area(pos)
|
||||
techage.switch_region(puncher:get_player_name(), pos1, pos2)
|
||||
end,
|
||||
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
groups = {choppy=2, cracky=2, crumbly=2,
|
||||
@ -187,6 +198,45 @@ minetest.register_node("techage:forceload", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("techage:forceloadtile", {
|
||||
description = S("Techage Forceload Tile"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
{
|
||||
image = "techage_filling_ta2.png^techage_frame_ta2_top.png^techage_appl_forceload.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 32,
|
||||
aspect_h = 32,
|
||||
length = 0.5,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
--{-5/16, -7/16, -5/16, 5/16, -5/16, 5/16},
|
||||
{-4/16, -8/16, -4/16, 4/16, -15/32, 4/16},
|
||||
},
|
||||
},
|
||||
|
||||
on_place = on_place,
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
on_rightclick = on_rightclick,
|
||||
on_punch = on_punch,
|
||||
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = {choppy=2, cracky=2, crumbly=2,
|
||||
not_in_creative_inventory = techage.max_num_forceload_blocks == 0 and 1 or 0},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
if techage.max_num_forceload_blocks > 0 then
|
||||
minetest.register_craft({
|
||||
@ -197,6 +247,11 @@ if techage.max_num_forceload_blocks > 0 then
|
||||
{"group:wood", "techage:iron_ingot", "group:wood"},
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "techage:forceloadtile",
|
||||
recipe = {"techage:forceload"},
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
|
@ -66,9 +66,17 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
||||
return stack:get_count()
|
||||
end
|
||||
|
||||
local function is_water(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local liquiddef = bucket.liquids[node.name]
|
||||
if liquiddef ~= nil and liquiddef.itemname ~= nil and node.name == liquiddef.source then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local function can_start(pos, nvm, state)
|
||||
local water_pos = minetest.string_to_pos(M(pos):get_string("water_pos"))
|
||||
if not techage.is_ocean(water_pos) then
|
||||
if not is_water(water_pos) then
|
||||
return S("no usable water")
|
||||
end
|
||||
return true
|
||||
|
@ -120,7 +120,6 @@ local function empty_container(pos, inv, full_container)
|
||||
local ndef_lqd = LQD(pos)
|
||||
local tank_size = (ndef_lqd and ndef_lqd.capa) or 0
|
||||
local ldef = get_liquid_def(full_container)
|
||||
--print("ldef", dump(ldef), "tank_size", tank_size)
|
||||
if ldef and (not nvm.liquid.name or ldef.inv_item == nvm.liquid.name) then
|
||||
if nvm.liquid.amount + ldef.size <= tank_size then
|
||||
if inv:room_for_item("dst", {name = ldef.container}) then
|
||||
@ -177,14 +176,16 @@ local function fill_on_punch(nvm, empty_container, item_count, puncher)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- check of the wielded full container can be emptied into the tank
|
||||
local function empty_on_punch(pos, nvm, full_container, item_count)
|
||||
nvm.liquid = nvm.liquid or {}
|
||||
nvm.liquid.amount = nvm.liquid.amount or 0
|
||||
local lqd_def
|
||||
-- handle legacy items
|
||||
if full_container == "techage:hydrogen" or full_container == "techage:oil_source" then
|
||||
lqd_def = {inv_item = full_container, size = item_count, container = ""}
|
||||
if IsLiquid[full_container] then
|
||||
lqd_def = {inv_item = full_container, size = (item_count or 1), container = ""}
|
||||
else
|
||||
lqd_def = get_liquid_def(full_container)
|
||||
end
|
||||
@ -221,12 +222,6 @@ function techage.liquid.on_punch(pos, node, puncher, pointed_thing)
|
||||
end
|
||||
end
|
||||
|
||||
function techage.register_liquid(full_container, empty_container, container_size, inv_item)
|
||||
LiquidDef[full_container] = {container = empty_container, size = container_size, inv_item = inv_item}
|
||||
ContainerDef[empty_container] = ContainerDef[empty_container] or {}
|
||||
ContainerDef[empty_container][inv_item] = full_container
|
||||
end
|
||||
|
||||
techage.liquid.get_liquid_def = get_liquid_def
|
||||
techage.liquid.get_container_def = get_container_def
|
||||
techage.liquid.is_container_empty = is_container_empty
|
||||
|
@ -18,7 +18,7 @@ local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
|
||||
-- Node data will be stored every NUM_SLOTS * CYCLE_TIME seconds
|
||||
local NUM_SLOTS = 50
|
||||
local CYCLE_TIME = 30
|
||||
local CYCLE_TIME = 60
|
||||
local NvmStore = {}
|
||||
local MemStore = {}
|
||||
local NumNodes = 0
|
||||
@ -99,7 +99,9 @@ local function cyclic_task()
|
||||
StoredNodes = 0
|
||||
local deleted = nvm_storage()
|
||||
t = minetest.get_us_time() - t
|
||||
print("[TA NVM Storage] duration="..t.."us, total="..NumNodes..", stored="..StoredNodes..", deleted="..deleted)
|
||||
if StoredNodes > 0 then
|
||||
minetest.log("action", "[TA NVM Storage] duration="..t.."us, total="..NumNodes..", stored="..StoredNodes..", deleted="..deleted)
|
||||
end
|
||||
minetest.after(CYCLE_TIME, cyclic_task)
|
||||
end
|
||||
|
||||
|
@ -147,7 +147,7 @@ techage.register_node({"techage:turbine", "techage:turbine_on"}, {
|
||||
end
|
||||
local power = transfer_generator(pos, topic, payload)
|
||||
if not power or power <= 0 and nvm.running then
|
||||
swap_node(pos, "techage:cylinder")
|
||||
swap_node(pos, "techage:turbine")
|
||||
stop_sound(pos)
|
||||
nvm.running = false
|
||||
return 0
|
||||
|
@ -282,7 +282,6 @@ techage.ConstructionPlans["ta4_storagesystem"] = {
|
||||
local SOLAR = {"techage_solar_module_top.png", "techage:ta4_solar_module"}
|
||||
local RCBLE = {"techage_ta4_cable_inv.png", "techage:ta4_power_cableS"}
|
||||
local CARRI = {"techage:ta4_solar_carrier", "techage:ta4_solar_carrier"}
|
||||
local INVDC = {"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_inverterDC.png", "techage:ta4_solar_inverterDC"}
|
||||
local INVAC = {"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_inverter.png", "techage:ta4_solar_inverter"}
|
||||
|
||||
techage.ConstructionPlans["ta4_solarplant"] = {
|
||||
@ -290,7 +289,7 @@ techage.ConstructionPlans["ta4_solarplant"] = {
|
||||
{false, false, false, false, false, false, false, false, false, false, false},
|
||||
{false, false, false, false, false, false, false, false, false, false, false},
|
||||
{false, SOLAR, SOLAR, SOLAR},
|
||||
{false, CARRI, CARRI, CARRI, RCBLE, RCBLE, INVDC, INVAC, Cable},
|
||||
{false, CARRI, CARRI, CARRI, RCBLE, RCBLE, RCBLE, INVAC, Cable},
|
||||
{false, SOLAR, SOLAR, SOLAR},
|
||||
}
|
||||
|
||||
|
@ -264,9 +264,8 @@ techage.register_node({"techage:heatexchanger1"}, {
|
||||
play_sound(pos)
|
||||
end
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.capa = (nvm.capa or 0) + (mem.capa or 0)
|
||||
tubelib2.del_mem(pos)
|
||||
--tubelib2.del_mem(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -30,6 +30,10 @@ end
|
||||
|
||||
local function formspec(self, pos, nvm)
|
||||
local capa_max, capa, needed_max, needed = he1_cmnd(pos, "state")
|
||||
capa_max = capa_max or 0
|
||||
capa = capa or 0
|
||||
needed_max = needed_max or 0
|
||||
needed = needed or 0
|
||||
local arrow = "image[2.5,1.5;1,1;techage_form_arrow_bg.png^[transformR270]"
|
||||
if needed > 0 then
|
||||
arrow = "image[2.5,1.5;1,1;techage_form_arrow_fg.png^[transformR270]"
|
||||
|
@ -26,7 +26,7 @@ local EFFICIENCY = 2 -- burn cycles
|
||||
local CATEGORY = 3
|
||||
|
||||
local function has_fuel(pos, nvm)
|
||||
return nvm.burn_cycles > 0 or (nvm.liquid and nvm.liquid.amount and nvm.liquid.amount > 0)
|
||||
return (nvm.burn_cycles or 0) > 0 or (nvm.liquid and nvm.liquid.amount and nvm.liquid.amount > 0)
|
||||
end
|
||||
|
||||
local function stop_firebox(pos, nvm)
|
||||
|
@ -21,7 +21,7 @@ minetest.register_alias("techage:hopper_ta1", "minecart:hopper")
|
||||
|
||||
minecart.register_inventory(
|
||||
{
|
||||
"techage:chest_ta3", "techage:chest_ta4",
|
||||
"techage:chest_ta2", "techage:chest_ta3", "techage:chest_ta4",
|
||||
"techage:meltingpot", "techage:meltingpot_active",
|
||||
},
|
||||
{
|
||||
|
@ -252,3 +252,20 @@ minetest.register_craft({
|
||||
{"", "", ""},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_lbm({
|
||||
label = "Repair Tanks",
|
||||
name = "techage:tank",
|
||||
nodenames = {"techage:ta3_tank", "techage:oiltank", "techage:ta4_tank"},
|
||||
run_at_every_load = true,
|
||||
action = function(pos, node)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
if mem.liquid and mem.liquid.amount then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.liquid = nvm.liquid or {}
|
||||
nvm.liquid.amount = mem.liquid.amount
|
||||
nvm.liquid.name = mem.liquid.name
|
||||
--tubelib2.del_mem(pos)
|
||||
end
|
||||
end,
|
||||
})
|
@ -189,8 +189,8 @@ minetest.register_craft({
|
||||
output = "techage:t4_waterpump",
|
||||
recipe = {
|
||||
{"", "default:mese_crystal", ""},
|
||||
{"", "default:mese_crystal", ""},
|
||||
{"", "techage:vacuum_tube", ""},
|
||||
{"", "techage:ta3_liquidsampler_pas", ""},
|
||||
{"", "techage:ta4_wlanchip", ""},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
]]--
|
||||
|
||||
local N = function(pos) return techage.get_node_lvm(pos).name end
|
||||
local net_def = techage.networks.net_def
|
||||
|
||||
local STOPPED = techage.power.STOPPED
|
||||
@ -120,13 +121,13 @@ local function set_taken_values(tbl, taken, tlib_type)
|
||||
return taken
|
||||
end
|
||||
|
||||
function techage.power.power_distribution(network, tlib_type)
|
||||
function techage.power.power_distribution(network, tlib_type, netID)
|
||||
-- calc maximum power values
|
||||
network.available1 = get_generator_sum(network.gen1, tlib_type)
|
||||
network.available2 = get_generator_sum(network.gen2, tlib_type)
|
||||
network.needed1 = get_consumer_sum(network.con1, tlib_type)
|
||||
network.needed2 = get_consumer_sum(network.con2, tlib_type)
|
||||
--print(network.available1, network.available2, network.needed1, network.needed2, network.alive)
|
||||
--print(string.format("%X", netID), network.available1, network.available2, network.needed1, network.needed2, network.alive)
|
||||
|
||||
-- store results
|
||||
network.on = network.available1 + network.available2 >= network.needed1
|
||||
|
@ -57,21 +57,3 @@ techage.register_junction("techage:electric_junction", 2/8, Boxes, Cable, {
|
||||
},
|
||||
})
|
||||
|
||||
local Names = {}
|
||||
|
||||
for idx = 0,63 do
|
||||
Names[#Names+1] = "techage:electric_junction"..idx
|
||||
end
|
||||
|
||||
minetest.register_lbm({
|
||||
label = "Repair Junction",
|
||||
name = "techage:electric_junction",
|
||||
nodenames = Names,
|
||||
run_at_every_load = true,
|
||||
action = function(pos, node)
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
ndef.after_place_node(pos)
|
||||
ndef.tubelib2_on_update2(pos, 0, Cable)
|
||||
tubelib2.del_mem(pos)
|
||||
end,
|
||||
})
|
||||
|
@ -86,6 +86,7 @@ local function trigger_network(pos, outdir, Cable)
|
||||
networks.build_network(pos, outdir, Cable, netID)
|
||||
elseif not networks.get_network(Cable.tube_type, netID) then
|
||||
print("build_network !!!!!!!!!!!!!!!!!!!!")
|
||||
delete_netID(pos, outdir, Cable)
|
||||
networks.build_network(pos, outdir, Cable, netID)
|
||||
end
|
||||
end
|
||||
|
@ -41,8 +41,11 @@ local function switch_on(pos, node, clicker, name)
|
||||
})
|
||||
local dir = Param2ToDir[node.param2]
|
||||
local pos2 = tubelib2.get_pos(pos, dir)
|
||||
M(pos2):set_int("tl2_param2", M(pos2):get_int("techage_hidden_param2"))
|
||||
Cable:after_place_tube(pos2, clicker)
|
||||
local node2 = techage.get_node_lvm(pos2)
|
||||
if node2.name == "techage:powerswitch_box" then
|
||||
M(pos2):set_int("tl2_param2", M(pos2):get_int("techage_hidden_param2"))
|
||||
Cable:after_place_tube(pos2, clicker)
|
||||
end
|
||||
end
|
||||
|
||||
local function switch_off(pos, node, clicker, name)
|
||||
@ -60,9 +63,11 @@ local function switch_off(pos, node, clicker, name)
|
||||
local dir = Param2ToDir[node.param2]
|
||||
local pos2 = tubelib2.get_pos(pos, dir)
|
||||
local node2 = techage.get_node_lvm(pos2)
|
||||
node2.param2 = Cable:get_primary_node_param2(pos2)
|
||||
M(pos2):set_int("tl2_param2", 0)
|
||||
Cable:after_dig_tube(pos2, node2)
|
||||
if node2.name == "techage:powerswitch_box" then
|
||||
node2.param2 = Cable:get_primary_node_param2(pos2)
|
||||
M(pos2):set_int("tl2_param2", 0)
|
||||
Cable:after_dig_tube(pos2, node2)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -62,36 +62,6 @@ minetest.register_node("techage:powerswitch_box", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("techage:powerswitch_box_off", {
|
||||
description = S("TA Power Switch Box"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
'techage_electric_switch.png^[transformR90',
|
||||
'techage_electric_switch.png^[transformR90',
|
||||
'techage_electric_switch.png',
|
||||
'techage_electric_switch.png',
|
||||
'techage_electric_junction.png',
|
||||
'techage_electric_junction.png',
|
||||
},
|
||||
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -1/4, -1/4, -2/4, 1/4, 1/4, 2/4},
|
||||
},
|
||||
},
|
||||
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
on_rotate = screwdriver.disallow, -- important!
|
||||
paramtype2 = "facedir",
|
||||
drop = "techage:powerswitch_box",
|
||||
groups = {choppy=2, cracky=2, crumbly=2, techage_trowel = 1, not_in_creative_inventory = 1},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:powerswitch_box",
|
||||
recipe = {
|
||||
|
@ -52,10 +52,11 @@ end
|
||||
minetest.register_globalstep(function(dtime)
|
||||
techage.SystemTime = techage.SystemTime + dtime
|
||||
local item = pop()
|
||||
local t = minetest.get_us_time()
|
||||
while item do
|
||||
local network = networks.peek_network(item.tube_type, item.netID)
|
||||
if network and network.alive and network.alive >= 0 then
|
||||
power.power_distribution(network, item.tube_type)
|
||||
power.power_distribution(network, item.tube_type, item.netID)
|
||||
network.alive = network.alive - 1
|
||||
push(item)
|
||||
else
|
||||
@ -64,6 +65,10 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
item = pop()
|
||||
end
|
||||
t = minetest.get_us_time() - t
|
||||
if t > 10000 then
|
||||
minetest.log("action", "[TA Schedule] duration="..t.."us")
|
||||
end
|
||||
end)
|
||||
|
||||
function techage.schedule.start(tube_type, netID)
|
||||
|
@ -280,13 +280,13 @@ minetest.register_craft({
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_lbm({
|
||||
label = "Repair Carrier Module",
|
||||
name = "techage:ta4_solar_carrier",
|
||||
nodenames = {"techage:ta4_solar_carrier", "techage:ta4_solar_carrierB"},
|
||||
run_at_every_load = true,
|
||||
action = function(pos, node)
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
ndef.after_place_node(pos)
|
||||
end,
|
||||
})
|
||||
--minetest.register_lbm({
|
||||
-- label = "Repair Carrier Module",
|
||||
-- name = "techage:ta4_solar_carrier",
|
||||
-- nodenames = {"techage:ta4_solar_carrier", "techage:ta4_solar_carrierB"},
|
||||
-- run_at_every_load = false,
|
||||
-- action = function(pos, node)
|
||||
-- local ndef = minetest.registered_nodes[node.name]
|
||||
-- ndef.after_place_node(pos)
|
||||
-- end,
|
||||
--})
|
||||
|
@ -38,7 +38,7 @@ local function play_sound(pos)
|
||||
mem.handle = minetest.sound_play("techage_steamengine", {
|
||||
pos = pos,
|
||||
gain = 0.5,
|
||||
max_hear_distance = 10,
|
||||
max_hear_distance = 8,
|
||||
loop = true})
|
||||
if mem.handle == -1 then
|
||||
minetest.after(1, play_sound, pos)
|
||||
|
@ -152,19 +152,23 @@ local function repair(itemstack, user, pointed_thing)
|
||||
end
|
||||
|
||||
if netw and netw.ele1 and netw.ele1.ntype == "junc" then
|
||||
ndef.after_place_node(pos)
|
||||
ndef.tubelib2_on_update2(pos, 0, Cable1)
|
||||
minetest.chat_send_player(user:get_player_name(), ndef.description.." "..S("repaired"))
|
||||
itemstack:add_wear(65636/200)
|
||||
return itemstack
|
||||
if ndef.after_place_node and ndef.tubelib2_on_update2 then
|
||||
ndef.after_place_node(pos)
|
||||
ndef.tubelib2_on_update2(pos, 0, Cable1)
|
||||
minetest.chat_send_player(user:get_player_name(), ndef.description.." "..S("repaired"))
|
||||
itemstack:add_wear(65636/200)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
|
||||
if netw and netw.ele2 and netw.ele2.ntype == "junc" then
|
||||
ndef.after_place_node(pos)
|
||||
ndef.tubelib2_on_update2(pos, 0, Cable2)
|
||||
minetest.chat_send_player(user:get_player_name(), ndef.description.." "..S("repaired"))
|
||||
itemstack:add_wear(65636/200)
|
||||
return itemstack
|
||||
if ndef.after_place_node and ndef.tubelib2_on_update2 then
|
||||
ndef.after_place_node(pos)
|
||||
ndef.tubelib2_on_update2(pos, 0, Cable2)
|
||||
minetest.chat_send_player(user:get_player_name(), ndef.description.." "..S("repaired"))
|
||||
itemstack:add_wear(65636/200)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -202,7 +206,7 @@ local function read_state(itemstack, user, pointed_thing)
|
||||
local node = minetest.get_node(pos)
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
|
||||
if ndef.networks then
|
||||
if ndef and ndef.networks then
|
||||
local player_name = user:get_player_name()
|
||||
if ndef.networks.ele1 then
|
||||
network_check(pos, Cable1, player_name)
|
||||
|
@ -110,9 +110,9 @@ end
|
||||
|
||||
local function start_rotor(pos, nvm)
|
||||
local npos = techage.get_pos(pos, "F")
|
||||
local node = minetest.get_node(npos)
|
||||
local node = techage.get_node_lvm(npos)
|
||||
if node.name ~= "techage:ta4_wind_turbine_nacelle" then
|
||||
M(pos):set_string("infotext", S("TA4 Wind Turbine").." "..S("Error"))
|
||||
M(pos):set_string("infotext", S("TA4 Wind Turbine").." "..S("Nacelle is missing"))
|
||||
nvm.error = true
|
||||
return
|
||||
end
|
||||
@ -139,7 +139,7 @@ end
|
||||
local function node_timer(pos, elapsed)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
|
||||
if not nvm.running then
|
||||
if not nvm.running or nvm.error then
|
||||
return false
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user