Hack to let TP authors override inv/wield images
@ -76,3 +76,4 @@ include("item_nodebox_zfighting")
|
||||
include("item_virtual")
|
||||
include("item_stackmax")
|
||||
include("item_touch_hurt")
|
||||
include("item_txp_overlay")
|
||||
|
41
mods/nc_api/item_txp_overlay.lua
Normal file
@ -0,0 +1,41 @@
|
||||
-- LUALOCALS < ---------------------------------------------------------
|
||||
local io, minetest, nodecore, pairs, table, type
|
||||
= io, minetest, nodecore, pairs, table, type
|
||||
local io_open, table_concat, table_sort
|
||||
= io.open, table.concat, table.sort
|
||||
-- LUALOCALS > ---------------------------------------------------------
|
||||
|
||||
local missing = {}
|
||||
|
||||
minetest.after(0, function()
|
||||
local t = {}
|
||||
for k in pairs(missing) do t[#t + 1] = k end
|
||||
if #t < 1 then return end
|
||||
table_sort(t)
|
||||
minetest.log("WARNING: missing txp override images:\n\t"
|
||||
.. table_concat(t, "\n\t"))
|
||||
end)
|
||||
|
||||
local function overlay(name, img, imgtype)
|
||||
if (not img) or (img == "") or (type(img) ~= "string")
|
||||
or (not img:match("%^")) or img:match("%^txp_") then return img end
|
||||
|
||||
local tpath = "txp_" .. name:gsub("^%W+", "")
|
||||
:gsub("%W+", "_") .. "_" .. imgtype .. ".png"
|
||||
|
||||
local fullpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
.. "/textures/" .. tpath
|
||||
local f = io_open(fullpath, "rb")
|
||||
if not f then
|
||||
missing[fullpath] = img
|
||||
return img
|
||||
end
|
||||
f:close()
|
||||
|
||||
return img .. "^" .. tpath .. "^[makealpha:255,254,2"
|
||||
end
|
||||
|
||||
nodecore.register_on_register_item(function(name, def)
|
||||
def.inventory_image = overlay(name, def.inventory_image, "inv")
|
||||
def.wield_image = overlay(name, def.wield_image, "wield")
|
||||
end)
|
BIN
mods/nc_fire/textures/txp_nc_fire_lump_ash_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_fire/textures/txp_nc_fire_lump_coal_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_prill_annealed_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_prill_hot_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_prill_tempered_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_tool_hatchet_annealed_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_tool_hatchet_tempered_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_tool_mallet_annealed_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_tool_mallet_tempered_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_tool_mattock_annealed_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_tool_mattock_tempered_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_tool_pick_annealed_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_tool_pick_tempered_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_tool_spade_annealed_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_tool_spade_tempered_inv.png
Normal file
After Width: | Height: | Size: 81 B |
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_toolhead_hatchet_hot_inv.png
Normal file
After Width: | Height: | Size: 81 B |
After Width: | Height: | Size: 81 B |
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_toolhead_mallet_hot_inv.png
Normal file
After Width: | Height: | Size: 81 B |
After Width: | Height: | Size: 81 B |
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_toolhead_mattock_hot_inv.png
Normal file
After Width: | Height: | Size: 81 B |
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_toolhead_pick_annealed_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_toolhead_pick_hot_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_toolhead_pick_tempered_inv.png
Normal file
After Width: | Height: | Size: 81 B |
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lode/textures/txp_nc_lode_toolhead_spade_hot_inv.png
Normal file
After Width: | Height: | Size: 81 B |
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lux/textures/txp_nc_lux_irradiated_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lux/textures/txp_nc_lux_tool_hatchet_annealed_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lux/textures/txp_nc_lux_tool_hatchet_tempered_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lux/textures/txp_nc_lux_tool_mallet_annealed_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lux/textures/txp_nc_lux_tool_mallet_tempered_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lux/textures/txp_nc_lux_tool_mattock_annealed_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lux/textures/txp_nc_lux_tool_mattock_tempered_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lux/textures/txp_nc_lux_tool_pick_annealed_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lux/textures/txp_nc_lux_tool_pick_tempered_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lux/textures/txp_nc_lux_tool_spade_annealed_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_lux/textures/txp_nc_lux_tool_spade_tempered_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_stonework/textures/txp_nc_stonework_tool_hatchet_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_stonework/textures/txp_nc_stonework_tool_mallet_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_stonework/textures/txp_nc_stonework_tool_pick_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_stonework/textures/txp_nc_stonework_tool_spade_inv.png
Normal file
After Width: | Height: | Size: 81 B |
BIN
mods/nc_tree/textures/txp_nc_tree_eggcorn_inv.png
Normal file
After Width: | Height: | Size: 81 B |