KhymChanur: There are a few problems with the flavour system when it comes to addons ading aditional flavoured items to a module. Firstly, a module provides a set number of flavours for a certain type of item, which might run out if an addon adds to many new flavoured items, or will already be run out if the module provides only exactly enough flavours for the items the module itself implements (like the ToME module does). A means could be provided for addons to supply additional flavours to add to the flavours list, but two different addons might supply use the same flavour strings, or a single addon might provide a flavour string that is later used by the module when a new version of the module adds new items to its core.
Secondly, if a flavoured item wants to have a fixed (non-random) flavour (like a potion of water is alway clear, and apple juice is always light brown), then it's flavour must be put at the begining of the flavour list, before the point that randomization begins, and the item's sval must corespond to position of the item's flavour in the flavour list. This means that it's currently impossible for an addon to add an item with a fixed flavour.
My proposal has two parts: first, instead of having a simple list of strings and colors for the flavours of a particular type, the module provides a function which will be passed as an argument the number of flavours to generate and which will return a list of string; that function can generate the list in whichever way it wants. The ToME module would (for things other than scrolls) add prefixes and suffixes to a standard list to generate as many flavours as needed. As a simplified example, the potion flavours would start out with just the seven colors of the rainbow. If seven colors isn't enough, then it add to the color list the original rainbow colors, but with "Speckled" appended, to get "Red Speckled" through "Violet Speckled". If fourteen colors isn't enough, it will add the seven rainbow colors, but with "Clotted" prepended, to get "Clotted Red" through "Clotted Violet". Other suffixes and prefixes can be used, like "Runny", "Translucent", "Swirling" and "Glowing".
Second, once the flavour list is generated and randomized, if an item has the flag FLAG_FLAVOUR, then that flag's value (the flavour stirng) will be copied over onto that item's position in the flavour table (position being determined by sval), and the colour will be copied from the item's colour. This means that the random flavour which was originally in that position will never be seen in the game, but that shouldn't be a problem.
Also, this way of doing flavours could be useful for randart rings and amulets. Currently, an unidentified randart ring is either shown as simply "ring", or it's name is shown even though it isn't identified. Instead of doing it this way, many more ring flavours can be made than are needed for the non-random rings, and the extra flavours can be assigned to the randart rings, so that unidentified randart rings will look no different from other unidentified rings.
KhymChanur: I went ahead and did it as a /patch which hasn't been committed yet. To simplify things, I split off mushrooms from TV_FOOD into TV_MUSHROOM, but that shouldn't be a problem. Should be easy to tweak to provide flavours for randart rings and amulets once randarts get going.
NerdanelVampire: I don't know enough of the T-Engine to say if this will really be a problem (which is why I'm not sure I should be posting here...), but a) if the standard rings are named first, it could be that something like a "gleaming fluorspar" ring will be the first generated artifact ring 100% of the time in some module, making the randomization pointless for people familiar with the module, b) if some random flavors are reserved for artifacts when a character is started, what happens if the flavors run out anyway?
Anyway, I got a little carried away while designing new mushroom flavors for my module and I have them about twice the needed amount. I'm not sure if the current flavor system would use the whole list, but I think it should, so that some games would have mushroom flavors not found in other games,
KhymChanur: a) Randomization of the flavour lists is deffered until after all the addons and modules are loaded and inialized, so a module's/addon's flavoured items will be randomized along with everything else.
b) If there aren't enough flavours to cover all the items, an error is generated saying so when the game starts. A module or addon can add to the list of flavors by registering additional flavour generating functions, so if the base module doesn't provide enough flavours, its the module or addon's job to provide more.
ToME Wiki