Add energy demand to machine infotexts (#317)

* Add a new line in machines infotext to show the current demand

* Fix translations

* Remove i18n.py (mistake)

* Add infotexts for non-register_base_machine()-based machines

* Move demand infotext at the beginning when demand is constant
This commit is contained in:
Athozus 2023-07-22 19:11:09 +02:00 committed by GitHub
parent 9067f1a38c
commit c7a27a7435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 29 additions and 16 deletions

View File

@ -94,6 +94,7 @@ Corium Source=Corium-Quelle
Cube=Würfel Cube=Würfel
Current target:=Aktuelles Ziel: Current target:=Aktuelles Ziel:
Current track: @1=Aktueller Kurs: @1 Current track: @1=Aktueller Kurs: @1
Demand: @1=Bedarf: @1
Diamond Drill Head=Diamantbohrkopf Diamond Drill Head=Diamantbohrkopf
Digging @1 m below machine=Graben @1 m unterhalb der Maschine Digging @1 m below machine=Graben @1 m unterhalb der Maschine
Digging finished=Graben beendet Digging finished=Graben beendet

View File

@ -94,6 +94,7 @@ Corium Source=Fuente de corio
Cube=Cubo Cube=Cubo
Current target:=Objetivo actual: Current target:=Objetivo actual:
Current track: @1=Pista actual: @1 Current track: @1=Pista actual: @1
Demand: @1=Demanda: @1
Diamond Drill Head=Mecha de Taladro de Diamante Diamond Drill Head=Mecha de Taladro de Diamante
Digging @1 m below machine=Excavación @1 m por debajo de la máquina Digging @1 m below machine=Excavación @1 m por debajo de la máquina
Digging finished=Excavación terminada Digging finished=Excavación terminada

View File

@ -94,6 +94,7 @@ Corium Source=Source de corium
Cube=Cube Cube=Cube
Current target:=Cible actuelle : Current target:=Cible actuelle :
Current track: @1=Piste actuelle : @1 Current track: @1=Piste actuelle : @1
Demand: @1=Demande : @1
Diamond Drill Head=Tête de forage en diamant Diamond Drill Head=Tête de forage en diamant
Digging @1 m below machine=Creusement à @1m en dessous de la machine Digging @1 m below machine=Creusement à @1m en dessous de la machine
Digging finished=Creusement terminé Digging finished=Creusement terminé

View File

@ -94,6 +94,7 @@ Corium Source=Sorgente di corium
Cube=Cubo Cube=Cubo
Current target:=Obiettivo attuale: Current target:=Obiettivo attuale:
Current track: @1=Traccia attuale: @1 Current track: @1=Traccia attuale: @1
Demand: @1=Domanda: @1
Diamond Drill Head=Trivella diamantata Diamond Drill Head=Trivella diamantata
Digging @1 m below machine=Scavo di @1 m sotto la macchina Digging @1 m below machine=Scavo di @1 m sotto la macchina
Digging finished=Scavo finito Digging finished=Scavo finito

View File

@ -94,6 +94,7 @@ Corium Source=Źródło Korium
Cube=Cube Cube=Cube
Current target:=Aktualny cel: Current target:=Aktualny cel:
Current track: @1=Aktualna ścieżka: @1 Current track: @1=Aktualna ścieżka: @1
Demand: @1=Popyt: @1
Diamond Drill Head=Diamentowa głowica wiertła Diamond Drill Head=Diamentowa głowica wiertła
Digging @1 m below machine=Kopię @1 m pod maszyną Digging @1 m below machine=Kopię @1 m pod maszyną
Digging finished=Kopanie skończone Digging finished=Kopanie skończone

View File

@ -94,6 +94,7 @@ Corium Source=Fonte de Cório
Cube=Cube Cube=Cube
Current target:=Meta atual: Current target:=Meta atual:
Current track: @1=Pista atual: @1 Current track: @1=Pista atual: @1
Demand: @1=Demanda: @1
Diamond Drill Head=Cabeça de Broca de Diamante Diamond Drill Head=Cabeça de Broca de Diamante
Digging @1 m below machine=Escavando @1 m abaixo da máquina Digging @1 m below machine=Escavando @1 m abaixo da máquina
Digging finished=Escavação terminada Digging finished=Escavação terminada

View File

@ -94,6 +94,7 @@ Corium Source=镭射源
Cube=立方体 Cube=立方体
Current target:=目前的目标。 Current target:=目前的目标。
Current track: @1=目前的轨道。@1 Current track: @1=目前的轨道。@1
Demand: @1=需求。 @1
Diamond Drill Head=金刚石钻头 Diamond Drill Head=金刚石钻头
Digging @1 m below machine=挖掘 @1 m以下的机器 Digging @1 m below machine=挖掘 @1 m以下的机器
Digging finished=挖完 Digging finished=挖完

View File

@ -91,6 +91,7 @@ Corium Source=
Cube= Cube=
Current target:= Current target:=
Current track: @1= Current track: @1=
Demand: @1=
Diamond Drill Head= Diamond Drill Head=
Digging @1 m below machine= Digging @1 m below machine=
Digging finished= Digging finished=

View File

@ -290,7 +290,8 @@ local function run(pos, node)
elseif eu_input >= power_requirement then elseif eu_input >= power_requirement then
if node.name == "technic:forcefield_emitter_off" then if node.name == "technic:forcefield_emitter_off" then
technic.swap_node(pos, "technic:forcefield_emitter_on") technic.swap_node(pos, "technic:forcefield_emitter_on")
meta:set_string("infotext", S("@1 Active", machine_name)) meta:set_string("infotext", S("@1 Active", machine_name) .. "\n" ..
S("Demand: @1", technic.EU_string(power_requirement)))
end end
update_forcefield(pos, meta, true) update_forcefield(pos, meta, true)
end end

View File

@ -13,7 +13,8 @@ local quarry_demand = 10000
local network_time_limit = 30000 local network_time_limit = 30000
local infotext = { local infotext = {
active = S("@1 Active", S("@1 Quarry", S("HV"))), active = S("@1 Active", S("@1 Quarry", S("HV"))) .. "\n" ..
S("Demand: @1", technic.EU_string(quarry_demand)),
disabled = S("@1 Disabled", S("@1 Quarry", S("HV"))), disabled = S("@1 Disabled", S("@1 Quarry", S("HV"))),
finished = S("@1 Finished", S("@1 Quarry", S("HV"))), finished = S("@1 Finished", S("@1 Quarry", S("HV"))),
purge = S("@1 Purging Cache", S("@1 Quarry", S("HV"))), purge = S("@1 Purging Cache", S("@1 Quarry", S("HV"))),

View File

@ -5,10 +5,10 @@
local S = technic.getter local S = technic.getter
local desc = S("@1 Lamp", S("LV")) local desc = S("@1 Lamp", S("LV"))
local active_desc = S("@1 Active", desc) local demand = 50
local active_desc = S("@1 Active", desc) .. "\n" .. S("Demand: @1", technic.EU_string(demand))
local unpowered_desc = S("@1 Unpowered", desc) local unpowered_desc = S("@1 Unpowered", desc)
local off_desc = S("@1 Off", desc) local off_desc = S("@1 Off", desc)
local demand = 50
-- Invisible light source node used for illumination -- Invisible light source node used for illumination
minetest.register_node("technic:dummy_light_source", { minetest.register_node("technic:dummy_light_source", {

View File

@ -5,9 +5,9 @@
local S = technic.getter local S = technic.getter
local desc = S("@1 LED", S("LV")) local desc = S("@1 LED", S("LV"))
local active_desc = S("@1 Active", desc)
local unpowered_desc = S("@1 Unpowered", desc)
local demand = 5 local demand = 5
local active_desc = S("@1 Active", desc) .. "\n" .. S("Demand: @1", technic.EU_string(demand))
local unpowered_desc = S("@1 Unpowered", desc)
local function led_run(pos, node) local function led_run(pos, node)

View File

@ -50,7 +50,8 @@ local run = function(pos, node)
music_handle = nil music_handle = nil
end end
elseif eu_input >= demand then elseif eu_input >= demand then
meta:set_string("infotext", S("@1 Active", machine_name)) meta:set_string("infotext", S("@1 Active", machine_name) .. "\n" ..
S("Demand: @1", technic.EU_string(demand)))
if not music_handle then if not music_handle then
music_handle = play_track(pos, current_track) music_handle = play_track(pos, current_track)
end end

View File

@ -74,7 +74,8 @@ local run = function(pos, node)
if eu_input < workshop_demand[EU_upgrade+1] then if eu_input < workshop_demand[EU_upgrade+1] then
meta:set_string("infotext", S("@1 Unpowered", machine_name)) meta:set_string("infotext", S("@1 Unpowered", machine_name))
elseif eu_input >= workshop_demand[EU_upgrade+1] then elseif eu_input >= workshop_demand[EU_upgrade+1] then
meta:set_string("infotext", S("@1 Active", machine_name)) meta:set_string("infotext", S("@1 Active", machine_name) .. "\n" ..
S("Demand: @1", technic.EU_string(workshop_demand[EU_upgrade+1])))
srcstack:add_wear(-1000) srcstack:add_wear(-1000)
inv:set_stack("src", 1, srcstack) inv:set_stack("src", 1, srcstack)
end end

View File

@ -117,7 +117,8 @@ function technic.register_base_machine(nodename, data)
end end
meta:set_int(tier.."_EU_demand", machine_demand[EU_upgrade+1]) meta:set_int(tier.."_EU_demand", machine_demand[EU_upgrade+1])
technic.swap_node(pos, nodename.."_active") technic.swap_node(pos, nodename.."_active")
meta:set_string("infotext", infotext_active) meta:set_string("infotext", infotext_active .. "\n" ..
S("Demand: @1", technic.EU_string(machine_demand[EU_upgrade+1])))
if meta:get_int("src_time") < round(result.time*10) then if meta:get_int("src_time") < round(result.time*10) then
if not powered then if not powered then
technic.swap_node(pos, nodename) technic.swap_node(pos, nodename)