API:GetDyeTintMasks
From RoR Wiki
UI Lua API · Dye functions
Version: WAR 1.4.8
Returns which dye colours (primary, secondary) an item's model can take.
tintMask = GetDyeTintMasks(itemId)
Arguments
- itemId
number– Item id (theidfield of an item data table).
Returns
- tintMask
number– Bit mask: 1 = primary colour, 2 = secondary colour, 3 = both, 0 = none. These match the stock UI'sGameData.TintMasks.A,B,BOTHandNONEchecks.
Details
- The mask comes from the item's model data. It does not look at the
EITEMFLAG_DYE_ABLEflag; the stock UI checks both. - If the argument check fails, nothing is returned.
- Exactly one argument must be passed.
Errors
None besides the generic Invalid Parameters message when the argument is missing or not a number.
Example
From default/ea_modifyitem/source/useitemtargeting.lua:
function UseItemTargeting.ItemIsDyable(itemData)
local tintMasks = GetDyeTintMasks( itemData.id )
return( itemData.flags[GameData.Item.EITEMFLAG_DYE_ABLE] == true and tintMasks ~= GameData.TintMasks.NONE and not itemData.broken )
end
