bugfixes and improvements

This commit is contained in:
Joachim Stolberg 2019-08-21 21:52:11 +02:00
parent 29e9431e4a
commit 4d30ba4bef
9 changed files with 51 additions and 34 deletions

View File

@ -288,21 +288,27 @@ minetest.register_craftitem("techage:wlanchip", {
if minetest.global_exists("unified_inventory") then
unified_inventory.register_craft_type("electronic_fab", {
description = S("Electronic Fab"),
unified_inventory.register_craft_type("ta2_electronic_fab", {
description = S("TA2 Ele Fab"),
icon = 'techage_filling_ta2.png^techage_appl_electronic_fab.png^techage_frame_ta2.png',
width = 2,
height = 2,
})
unified_inventory.register_craft_type("ta3_electronic_fab", {
description = S("TA3 Ele Fab"),
icon = 'techage_filling_ta3.png^techage_appl_electronic_fab.png^techage_frame_ta3.png',
width = 2,
height = 2,
})
unified_inventory.register_craft({
output = "techage:vacuum_tube 2",
items = {"default:glass", "basic_materials:copper_wire", "basic_materials:plastic_sheet", "techage:usmium_nuggets"},
type = "electronic_fab",
type = "ta2_electronic_fab",
})
unified_inventory.register_craft({
output = "techage:ta4_wlanchip 8",
items = {"default:mese_crystal", "default:copper_ingot", "default:gold_ingot", "techage:ta4_silicon_wafer"},
type = "electronic_fab",
type = "ta3_electronic_fab",
})
end

View File

@ -28,32 +28,33 @@ local Param2ToDir = {
local function formspec(pos)
local jpos = minetest.deserialize(M(pos):get_string("junction_pos"))
local ndef = minetest.registered_nodes[minetest.get_node(jpos).name]
if ndef.is_power_available then
local power = ndef.is_power_available(jpos)
if power and power.prim_available then
return "size[5,4]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"label[1.5,0.0;"..S("Network Data").."]"..
"label[0,0.8;"..S("Generators").." : "..power.prim_available.." ku]"..
"label[0,1.4;"..S("Akkus").." : "..power.sec_available.." ku]"..
"label[0,2.0;"..S("Machines").." : "..power.prim_needed.." ku]"..
"label[0,2.6;"..S("Number nodes").." : "..power.num_nodes.."]"..
"button[1.5,3.3;2,1;update;"..S("Update").."]"
local power = techage.power.power_accounting(jpos, tubelib2.get_mem(jpos))
if power and power.prim_available then
local alarm = ""
if power.num_nodes > (techage.MAX_NUM_NODES - 50) then
alarm = " (max. "..(techage.MAX_NUM_NODES).." !!!)"
end
return "size[5,4]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"label[1.5,0.0;"..S("Network Data").."]"..
"label[0,0.8;"..S("Generators").." : "..power.prim_available.." ku]"..
"label[0,1.4;"..S("Akkus").." : "..power.sec_available.." ku]"..
"label[0,2.0;"..S("Machines").." : "..power.prim_needed.." ku]"..
"label[0,2.6;"..S("Number nodes").." : "..power.num_nodes..alarm.."]"..
"button[1.5,3.3;2,1;update;"..S("Update").."]"
end
return "size[5,4]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"label[1.5,0.0;"..S("Network Data").."]"..
"label[0,0.8;"..S("Generators").." : 0 ku]"..
"label[0,1.4;"..S("Akkus").." : 0 ku]"..
"label[0,2.0;"..S("Machines").." : 0 ku]"..
"label[0,2.6;"..S("Number nodes").." : 0]"..
"button[1.5,3.3;2,1;update;"..S("Update").."]"
"label[1.5,0.0;"..S("Network Data").."]"..
"label[0,0.8;"..S("Generators").." : 0 ku]"..
"label[0,1.4;"..S("Akkus").." : 0 ku]"..
"label[0,2.0;"..S("Machines").." : 0 ku]"..
"label[0,2.6;"..S("Number nodes").." : 0]"..
"button[1.5,3.3;2,1;update;"..S("Update").."]"
end

View File

@ -119,6 +119,7 @@ function techage.furnace.smelting(pos, mem, elapsed)
elapsed = elapsed - recipe.time
end
mem.leftover = elapsed
mem.item_percent = math.min(math.floor((mem.leftover * 100.0) / recipe.time), 100)
return state
end
return techage.STANDBY

View File

@ -41,7 +41,8 @@ local function formspec(self, pos, mem)
default.gui_bg_img..
default.gui_slots..
"list[context;src;0,0;2,2;]"..
"image[2,0.5;1,1;techage_form_arrow.png]"..
"image[2,0.5;1,1;techage_form_arrow_bg.png^[lowpart:"..
(mem.item_percent or 0)..":techage_form_arrow_fg.png^[transformR270]"..
"image_button[2,2;1,1;".. self:get_state_button_image(mem) ..";state_button;]"..
"list[context;dst;3,0;2,2;]"..
@ -95,6 +96,10 @@ local function keep_running(pos, elapsed)
local mem = tubelib2.get_mem(pos)
local crd = CRD(pos)
cooking(pos, crd, mem, elapsed)
mem.toggle = not mem.toggle
if mem.toggle then
M(pos):set_string("formspec", formspec(crd.State, pos, mem))
end
return crd.State:is_active(mem)
end

View File

@ -26,7 +26,8 @@ local NumNodes = 0
techage.power = {}
local MAX_NUM_NODES = 100
local MAX_NUM_NODES = 1000
techage.MAX_NUM_NODES = MAX_NUM_NODES
-- Consumer States
local STOPPED = 1
@ -197,7 +198,7 @@ minetest.register_lbm({
local function pos_already_reached(pos)
local key = minetest.hash_node_position(pos)
if not Route[key] then
if not Route[key] and NumNodes < MAX_NUM_NODES then
Route[key] = true
NumNodes = NumNodes + 1
return false

View File

@ -34,7 +34,7 @@ local function node_timer(pos, elapsed)
local mem = tubelib2.get_mem(pos)
mem.capa = mem.capa or 0
pos.y = pos.y + 1
local light = minetest.get_node_light(pos)
local light = minetest.get_node_light(pos) or 0
pos.y = pos.y - 1
if light >= (minetest.LIGHT_MAX - 1) then
@ -103,6 +103,7 @@ minetest.register_node("techage:ta4_solar_minicell", {
techage.power.register_node({"techage:ta4_solar_minicell"}, {
power_network = Cable,
conn_sides = {"D"},
})
techage.register_node({"techage:ta4_solar_minicell"}, {
@ -110,13 +111,11 @@ techage.register_node({"techage:ta4_solar_minicell"}, {
local mem = tubelib2.get_mem(pos)
if topic == "state" then
if mem.providing then
if (mem.provided or 0) > 0 then
return "discharging"
else
return "unused"
end
else
return "discharging"
elseif (mem.capa or 0) > 0 then
return "charging"
else
return "unused"
end
else
return "unsupported"

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

View File

@ -40,6 +40,10 @@ local S = techage.S
local function read_state(itemstack, user, pointed_thing)
local pos = pointed_thing.under
if pos and user then
local data = minetest.get_biome_data(pos)
if data then
minetest.chat_send_player(user:get_player_name(), "Temp: "..math.floor(data.heat).." ")
end
local number = techage.get_node_number(pos)
local ndef = minetest.registered_nodes[minetest.get_node(pos).name]
if number then