[1.7.4] Attachment slot missing in tinker description

Make all T-Engine/ToME 4 bug reports here

Moderator: Moderator

Post Reply
Message
Author
Zizzo
Sher'Tul Godslayer
Posts: 2220
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

[1.7.4] Attachment slot missing in tinker description

#1 Post by Zizzo »

So I was digging around in the object description code trying to find where I cound wedge in a mention of which slot a tinker is supposed to attach to (because its absence is vaguely annoying), when I discovered that the code is already supposed to be mentioning that. :shock: The relevant code in Object:getTextualDesc() is:

Code: Select all

    if self.is_tinker then
        if self.on_type then
            if self.on_subtype then
            --  vvvvvvvv
                desc.add(("Attach on item of type '#ORANGE#%s / %s#LAST#'"):tformat(self.on_type, self.on_subtype):toTString(), true)
            else
            --  vvvvvvvv
                desc.add(("Attach on item of type '#ORANGE#%s#LAST#'"):tformat(self.on_type):toTString(), true)
            end
        end
        --                   vvvvvvvv
        if self.on_slot then desc.add(("Attach on item worn on slot '#ORANGE#%s#LAST#'"):tformat(_t(self.on_slot, "entity on slot"):lower():gsub('_', ' ')):toTString(), true) end

        if self.object_tinker and (self.object_tinker.combat or self.object_tinker.wielder) then
            desc:add({"color","YELLOW"}, _t"When attach to an other item:", {"color", "LAST"}, true)
            if self.object_tinker.combat then desc_combat(self.object_tinker, compare_with, "combat") end
            if self.object_tinker.wielder then desc_wielder(self.object_tinker, compare_with, "wielder") end
        end
    end
I've marked the problem points. Using desc.add() instead of desc:add() is an obvious problem [I've made that mistake myself… :oops: :wink:], but on further testing, :add() doesn't seem to be what we want to use here, since we're adding a full-blown TString; in my tests, I had to change those calls to desc:merge() to make the slot description appear.

Edit 2022-05-22: In the meantime, I've added some code to Tinker Tinkering to paper over the bug.
"Blessed are the yeeks, for they shall inherit Arda..."

Post Reply