From 5baec009ca74b87224d4ee1becb941e8f59e7fae Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Tue, 17 Sep 2019 23:37:29 +0200 Subject: [PATCH] ingame docu improved --- basic_machines/distributor.lua | 2 +- basis/guide.lua | 21 +++++++++++++++++++-- energy_storage/help.lua | 30 +++++++++++++++--------------- 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/basic_machines/distributor.lua b/basic_machines/distributor.lua index 3d226d4..e70351e 100644 --- a/basic_machines/distributor.lua +++ b/basic_machines/distributor.lua @@ -37,7 +37,7 @@ local function order_checkbox(pos, filter) if cnt == 1 then local order = M(pos):get_int("order") == 1 and "true" or "false" return "checkbox[2,0;order;1:1;"..order.."]".. - "tooltip[2,0;1,1;"..S("Force order of filter items")..";#FFFFFF;#000000]" + "tooltip[2,0;1,1;"..S("Force order of filter items")..";#0C3D32;#FFFFFF]" else M(pos):set_int("order", 0) -- disable sequencing end diff --git a/basis/guide.lua b/basis/guide.lua index e7df162..d2270b0 100644 --- a/basis/guide.lua +++ b/basis/guide.lua @@ -79,20 +79,37 @@ local function get_ref(player_name) return Categories[1], Categories[1] end +local function tooltip(item) + if type(item) == "table" then + local img, name = item[1], item[2] + local ndef = minetest.registered_nodes[name] + if ndef and ndef.description then + return img, minetest.formspec_escape(ndef.description) + end + return img + end + return item +end + + -- formspec images local function plan(images) local tbl = {} if images == "none" then return "label[1,3;"..S("No plan available") end for y=1,#images do for x=1,#images[1] do - local img = images[y][x] or false - if img ~= false then + local item = images[y][x] or false + if item ~= false then + local img, tooltip = tooltip(item) local x_offs, y_offs = (x-1) * 0.9, (y-1) * 0.9 + 0.8 if string.find(img, ":") then tbl[#tbl+1] = "item_image["..x_offs..","..y_offs..";1,1;"..img.."]" else tbl[#tbl+1] = "image["..x_offs..","..y_offs..";1,1;"..img.."]" end + if tooltip then + tbl[#tbl+1] = "tooltip["..x_offs..","..y_offs..";1,1;"..tooltip..";#0C3D32;#FFFFFF]" + end end end end diff --git a/energy_storage/help.lua b/energy_storage/help.lua index f096a2c..d2f70a3 100644 --- a/energy_storage/help.lua +++ b/energy_storage/help.lua @@ -14,21 +14,21 @@ local S = techage.S -local CONCR = "basic_materials_concrete_block.png" -local PIPEH = "techage_gaspipe.png" -local PIPEV = "techage_gaspipe.png^[transformR90" -local PN000 = "techage_gaspipe_knee.png" -local PN090 = "techage_gaspipe_knee.png^[transformR90" -local PN180 = "techage_gaspipe_knee.png^[transformR180" -local PN270 = "techage_gaspipe_knee.png^[transformR270" -local HEXR1 = "techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_ribsT.png" -local HEXR2 = "techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_ribsB.png" -local HEXR3 = "techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_electric.png" -local TURBN = "techage_filling_ta4.png^techage_appl_turbine.png^techage_frame_ta4.png" -local GENER = "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_generator.png^[transformFX]" -local GRAVL = "default_gravel.png" -local INLET = "basic_materials_concrete_block.png^techage_gaspipe.png^[transformR90" -local GLASS = "default_obsidian_glass.png" +local CONCR = {"basic_materials_concrete_block.png", "basic_materials:concrete_block"} +local PIPEH = {"techage_gaspipe.png", "techage:ta4_pipeS"} +local PIPEV = {"techage_gaspipe.png^[transformR90", "techage:ta4_pipeS"} +local PN000 = {"techage_gaspipe_knee.png", "techage:ta4_pipeS"} +local PN090 = {"techage_gaspipe_knee.png^[transformR90", "techage:ta4_pipeS"} +local PN180 = {"techage_gaspipe_knee.png^[transformR180", "techage:ta4_pipeS"} +local PN270 = {"techage_gaspipe_knee.png^[transformR270", "techage:ta4_pipeS"} +local HEXR1 = {"techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_ribsT.png", "techage:heatexchanger3"} +local HEXR2 = {"techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_ribsB.png", "techage:heatexchanger2"} +local HEXR3 = {"techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_electric.png", "techage:heatexchanger1"} +local TURBN = {"techage_filling_ta4.png^techage_appl_turbine.png^techage_frame_ta4.png", "techage:ta4_turbine"} +local GENER = {"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_generator.png^[transformFX]", "techage:ta4_generator"} +local GRAVL = {"default_gravel.png", "default:gravel"} +local INLET = {"basic_materials_concrete_block.png^techage_gaspipe.png^[transformR90", "techage:ta4_pipe_inlet"} +local GLASS = {"default_obsidian_glass.png", "default:obsidian_glass"} local Images = { {false, false, false, false, false, false, false, false, false, false, false},