This commit is contained in:
Emoji 2022-07-10 09:23:52 +08:00
parent 283919c829
commit e65af03f18
6 changed files with 257 additions and 0 deletions

14
init.lua Normal file
View File

@ -0,0 +1,14 @@
local MN = minetest.get_current_modname()
local MP = minetest.get_modpath(MN)
local function require(name)
minetest.log("action","[EXTRA_TT] Loading " .. name)
dofile(MP .. "/src/" .. name .. ".lua")
end
require("mesecons")
require("advtrains")
require("technic")
-- ALWAYS THE LAST!
require("techname")

4
mod.conf Normal file
View File

@ -0,0 +1,4 @@
title = Extra Tooltips
name = extra_tt
depends = tt, mesecons, mesecons_alias, mesecons_blinkyplant, mesecons_button, mesecons_commandblock, mesecons_delayer, mesecons_detector, mesecons_doors, mesecons_extrawires, mesecons_fpga, mesecons_gamecompat, mesecons_gates, mesecons_hydroturbine, mesecons_insulated, mesecons_lamp, mesecons_lightstone, mesecons_luacontroller, mesecons_materials, mesecons_microcontroller, mesecons_movestones, mesecons_mvps, mesecons_noteblock, mesecons_pistons, mesecons_powerplant, mesecons_pressureplates, mesecons_random, mesecons_receiver, mesecons_solarpanel, mesecons_stickyblocks, mesecons_switch, mesecons_torch, mesecons_walllever, mesecons_wires, advtrains, advtrains_interlocking, advtrains_itrainmap, advtrains_line_automation, advtrains_luaautomation, advtrains_signals_ks, advtrains_train_track, technic, technic_chests, technic_cnc, technic_worldgen

69
src/advtrains.lua Normal file
View File

@ -0,0 +1,69 @@
local craftitems = "Craft Train-related Stuffs"
local signals = "Give Instructions to Trains"
local luaatc = "Control the Advance Trains System by Lua"
local tracks = "Advanced Train Tracks"
local helps = {
["advtrains:boiler"] = craftitems,
["advtrains:driver_cab"] = craftitems,
["advtrains:wheel"] = craftitems,
["advtrains:chimney"] = craftitems,
["advtrains:across_off"] = "Warn Players from Hitting by Trains",
["advtrains:signal_wall_l_off"] = signals,
["advtrains:signal_wall_t_off"] = signals,
["advtrains:signal_wall_r_off"] = signals,
["advtrains:retrosignal_off"] = signals,
["advtrains_interlocking:tcb_node"] = "Configure Track Circuits",
["advtrains_luaautomation:oppanel"] = luaatc,
["advtrains_luaautomation:mesecon_controller0000"] = luaatc;
["advtrains_signals_ks:sign_8_0"] = signals,
["advtrains_signals_ks:sign_hfs_0"] = signals,
["advtrains_signals_ks:sign_lf_8_0"] = signals,
["advtrains_signals_ks:sign_lf7_8_0"] = signals,
["advtrains:signal_off"] = signals,
}
minetest.override_item("advtrains:trackworker",{
description = "Track Worker Tool",
_tt_help = "Left-click: change rail type (straight/curve/switch)\nRight-click: rotate rail/bumper/signal/etc.",
})
minetest.override_item("advtrains_interlocking:tool",{
description = "Interlocking tool",
_tt_help = "right-click turnouts to inspect route locks",
})
minetest.override_item("advtrains_luaautomation:pcnaming",{
description = "Passive Component Naming Tool",
_tt_help = "Right-click to name a passive component.",
})
minetest.override_item("advtrains:copytool",{
description = "Train copy/paste tool",
_tt_help = "Left-click: copy train\nRight-click: paste train",
})
for x,y in pairs(helps) do
minetest.override_item(x,{
_tt_help = y,
})
end
tt.register_snippet(function(itemstring)
local itemdef = minetest.registered_items[itemstring]
if itemdef.groups and itemdef.groups.not_blocking_trains then
return "Not Blocking Advanced Trains", tt.COLOR_GOOD
end
end)
tt.register_snippet(function(itemstring)
local itemdef = minetest.registered_items[itemstring]
if itemdef.groups and itemdef.groups.not_blocking_trains and itemdef.groups.platform then
return "Advanced Trains Platforms", tt.COLOR_GOOD
end
end)
tt.register_snippet(function(itemstring)
local itemdef = minetest.registered_items[itemstring]
if itemdef.groups and itemdef.groups.advtrains_trackplacer then
return "Advanced Trains Track Placers", tt.COLOR_GOOD
end
end)

86
src/mesecons.lua Normal file
View File

@ -0,0 +1,86 @@
local insulated = "Only Connect to Specific Directions"
local logic = "Binary Logic Gates for Mesecons"
local craftitem = "Used to Craft Technical Items"
local movestone = "Move on Mesecon Signals"
local pressure = "Produce Mesecon Signals on Pressure"
local switch = "Change State by Rightclick"
local helps = {
["mesecons:wire_00000000_off"] = "Transmit Mesecon Signals",
["mesecons_blinkyplant:blinky_plant_off"] = "Blinks Every 3 Seconds",
["mesecons_button:button_off"] = "Give out Mesecon Signal on Press",
["mesecons_commandblock:commandblock_off"] = "Run Administrative Commands",
["mesecons_delayer:delayer_off_1"] = "Delay Mesecon Signal Transmission",
["mesecons_detector:node_detector_off"] = "Detect Nodes Nearby",
["mesecons_detector:object_detector_off"] = "Detect Players Nearby",
["mesecons_extrawires:corner_off"] = insulated,
["mesecons_extrawires:crossover_off"] = "Mesecon Signals Crossing",
["mesecons_extrawires:corner_off"] = insulated,
["mesecons_extrawires:tjunction_off"] = insulated,
["mesecons_extrawires:vertical_off"] = "Vertically Transmit Mesecon Signals",
["mesecons_fpga:fpga0000"] = "Chain Multiple Logic Gates Together",
["mesecons_gates:diode_off"] = logic,
["mesecons_gates:not_off"] = logic,
["mesecons_gates:and_off"] = logic,
["mesecons_gates:nand_off"] = logic,
["mesecons_gates:xor_off"] = logic,
["mesecons_gates:nor_off"] = logic,
["mesecons_gates:or_off"] = logic,
["mesecons_hydroturbine:hydro_turbine_off"] = "Produce Mesecon Signals on Water Flow",
["mesecons_insulated:insulated_off"] = insulated,
["mesecons_lamp:lamp_off"] = "Produce Light on Mesecon Signals",
-- mesecons_lightstone
["mesecons_luacontroller:luacontroller0000"] = "Programmable with Lua",
["mesecons_materials:glue"] = craftitem,
["mesecons_materials:fiber"] = craftitem,
["mesecons_materials:silicon"] = craftitem,
["mesecons_microcontroller:microcontroller0000"] = "Simple Programmable Component",
["mesecons_movestones:movestone"] = movestone,
["mesecons_movestones:movestone_vertical"] = movestone,
["mesecons_movestones:sticky_movestone"] = movestone,
["mesecons_movestones:sticky_movestone_vertical"] = movestone,
["mesecons_noteblock:noteblock"] = "Play Sounds",
["mesecons_pistons:piston_normal_off"] = "Push Nodes on Mesecon Signals",
["mesecons_pistons:piston_sticky_off"] = "Push or Pull Nodes on Mesecon Signals",
["mesecons_powerplant:power_plant"] = "Stable Mesecon Signal Source",
["mesecons_pressureplates:pressure_plate_wood_off"] = pressure,
["mesecons_pressureplates:pressure_plate_stone_off"] = pressure,
["mesecons_random:removestone"] = "Disappear on Mesecon Signals",
["mesecons_random:ghoststone"] = "Hide itself on Mesecon Signals",
["mesecons_solarpanel:solar_panel_off"] = "Produce Mesecon Signals on Sunlight",
["mesecons_stickyblocks:sticky_block_all"] = "Stick Multiple Blocks Together",
["mesecons_switch:mesecon_switch_off"] = switch,
["mesecons_torch:mesecon_torch_on"] = "Revert Mesecon Signals",
["mesecons_walllever:wall_lever_off"] = switch,
}
for _,y in pairs({"red","green","blue","gray","darkgray","yellow","orange","white","pink","magenta","cyan","violet"}) do
local nodename = "mesecons_lightstone:lightstone_" .. y .. "_off"
local y_upper = y:gsub("%f[%a].", string.upper)
helps[nodename] = "Produce " .. y_upper .. "Light on Mesecon Signals"
end
for x,y in pairs(helps) do
minetest.override_item(x,{
_tt_help = y,
})
end
tt.register_snippet(function(itemstring)
local itemdef = minetest.registered_items[itemstring]
if itemdef.mesecons and itemdef.mesecons.receptor then
return "Mesecon Receptors", tt.COLOR_GOOD
end
end)
tt.register_snippet(function(itemstring)
local itemdef = minetest.registered_items[itemstring]
if itemdef.mesecons and itemdef.mesecons.conductor then
return "Mesecon Conductors", tt.COLOR_GOOD
end
end)
tt.register_snippet(function(itemstring)
local itemdef = minetest.registered_items[itemstring]
if itemdef.mesecons and itemdef.mesecons.effector then
return "Mesecon Effectors", tt.COLOR_GOOD
end
end)

3
src/techname.lua Normal file
View File

@ -0,0 +1,3 @@
tt.register_snippet(function(itemstring)
return itemstring, tt.COLOR_DEFAULT
end)

81
src/technic.lua Normal file
View File

@ -0,0 +1,81 @@
local function volt(bstr)
return function(v)
return bstr:format(v)
end
end
local batterybox = volt("Store %s Power")
local cables = volt("Transmit %s Power")
local solar = volt("Produce %s Power from Sunlight")
local generator = volt("Produce %s Power")
local alloy = "Alloy Metals"
local furnace = "Smelt Minerals and Cook Foods"
local grinder = "Grin stuffs into small pieces"
local compressor = "Compress stuffs"
local helps = {}
for _,v in pairs({"lv","mv","hv"}) do
do
local nname = ("technic:%s_battery_box0"):format(v)
helps[nname] = batterybox(v:upper())
end
do
local nname = ("technic:solar_array_%s"):format(v)
helps[nname] = solar(v:upper())
end
do
if v ~= "hv" then
local nname = ("technic:%s_electric_furnace"):format(v)
if v == "lv" then
nname = "technic:electric_furnace"
end
helps[nname] = furnace
end
end
do
if v ~= "hv" then
local nname = ("technic:%s_grinder"):format(v)
helps[nname] = grinder
end
end
do
if v ~= "hv" then
local nname = ("technic:%s_compressor"):format(v)
helps[nname] = grinder
end
end
do
local nname = ("technic:%s_cable"):format(v)
helps[nname] = cables(v:upper())
end
do
local nname = ("technic:%s_generator"):format(v)
helps[nname] = generator(v:upper())
end
end
for x,y in pairs(helps) do
minetest.override_item(x,{
_tt_help = y,
})
end
tt.register_snippet(function(itemstring)
local itemdef = minetest.registered_items[itemstring]
if itemdef.wear_represents == "technic_RE_charge" then
return "Rechargeable", tt.COLOR_GOOD
end
end)
tt.register_snippet(function(itemstring)
local itemdef = minetest.registered_items[itemstring]
if itemdef.groups and itemdef.groups.radioactive then
return "Radioactive", tt.COLOR_GOOD
end
end)
tt.register_snippet(function(itemstring)
local itemdef = minetest.registered_items[itemstring]
if itemdef.groups and itemdef.groups.technic_machine then
return "Technic Machines", tt.COLOR_GOOD
end
end)