[Solved]Any way to set Thing's label from outside?

Started by Latta, May 02, 2015, 08:20:33 AM

Previous topic - Next topic

Latta

Just like Stuff and CompQuality does, it has to be thing-specific, not def based. Both uses RimWorld.GenLabel thus I can't follow them.
I've searched about reflection, but as Thing's Label property has no backing field nor setter, it isn't possible. If it only had a public string label field... or private...

If anyone has idea please tell me, or should I suggest this to Tynan?

BBream

I think Thing's Label is started here.

In Thing:

    public virtual string LabelBase
    {
      get
      {
        return GenLabel.ThingLabel((EntityDef) this.def, this.Stuff, 1);
      }
    }


So if you write overrided Label method, then you can modify label.

Latta

Oh I forgot to mention that I can't overload. Well, for...compatibility... My Infusion mod isn't overlading any Thing because of this.

But while I was looking at your answer I realized that there aren't many weapon mods that uses custom thing class. I should reflect it when it uses default class. Thank you again.