71 lines
2.8 KiB
Plaintext
71 lines
2.8 KiB
Plaintext
---==================================================================================================================---
|
|
--- ---
|
|
--- Original Author(s) : RavenAscendant ---
|
|
--- Edited : N/A ---
|
|
--- Date : 06/01/2022 ---
|
|
--- License : Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported ---
|
|
--- ---
|
|
--- Dynamic tint for anomaly inventory. ---
|
|
--- ---
|
|
---==================================================================================================================---
|
|
|
|
function pr(txt, ...)
|
|
-- printf("RAXPH: "..txt, ...)
|
|
end
|
|
|
|
local icon_colors = {}
|
|
|
|
|
|
--functor should return an ARGB for the tint color. recomend low alpha values. there is no unregister, just register nil
|
|
function register(name, functor)
|
|
if not name then return end
|
|
icon_colors[name] = functor
|
|
end
|
|
|
|
local base_Colorize = utils_ui.UICellItem.Colorize
|
|
|
|
function utils_ui.UICellItem:Colorize(clr_id)
|
|
base_Colorize(self, clr_id)
|
|
|
|
if clr_id ~= "def" then return end -- only gong to change it when not changed by base script
|
|
local clr
|
|
for _, functor in pairs(icon_colors) do
|
|
clr = functor(self) or clr
|
|
end
|
|
if not clr then return end
|
|
|
|
|
|
if self.ico then self.ico:SetTextureColor( clr ) end
|
|
if self.ico_scope then self.ico_scope:SetTextureColor( clr ) end
|
|
if self.ico_sil then self.ico_sil:SetTextureColor( clr ) end
|
|
if self.ico_gl then self.ico_gl:SetTextureColor( clr ) end
|
|
if self.layer then
|
|
for i=1,#self.layer do
|
|
self.layer[i]:SetTextureColor( clr )
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
|
|
--[[
|
|
Use
|
|
|
|
local table_of_itmes_to_tint = {vodka = true}
|
|
local bags = {actor_bag = true,actor_trade_bag= true} --player inv in normal/looting and in the merchant UI. full list in ui_inventory.script
|
|
function tinter(cell)
|
|
if not bags[cell.container.ID] then return end -- if you only want this to be applied in the inventory UI and then only certine parts
|
|
if table_of_itmes_to_tint[cell.section] then --for object id use cell.ID ID not used in all UIs
|
|
return GetARGB(100, 0, 255, 0)
|
|
end
|
|
end
|
|
|
|
|
|
function on_game_start()
|
|
rax_icon_tint.register("my_tint", tinter)
|
|
end
|
|
|
|
|
|
|
|
|
|
--]] |