[A11] Command class "Desc" is never used, always references "defaultDesc"

Started by 1000101, July 04, 2015, 08:38:10 PM

Previous topic - Next topic


I'm not sure if I should have posted it here, it is a "real bug" but not one that effects actual game play.  If this is the wrong place for it, I apologise now.

This bug only really shows up when modding as it only becomes apparent when extending the Command class in conjunction with Gizmos.

In the Command class, there is a virtual property Desc which (in theory) allows commands description to be handled by inheritors.  Unfortunately, it doesn't seem this is ever invoked and the defaultDesc is always used.

This leads to unexpected behaviour when modding, namely, no description callback.  If your description is static no problem, use defaultDesc.

Unless I am totally missing the purpose of the Desc property...?

Sample code to reproduce:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using RimWorld;
using UnityEngine;
using Verse;
using Verse.AI;

namespace foo
    public class TestCommand : Command
        public TestCommand() {
            // Give it the grow zone icon for testing
            icon = ContentFinder<Texture2D>.Get( "UI/Designators/ZoneCreate_Growing", true );

        // Shows "No description."
        public override string Desc {
            get { return "Yes description."; }


    public class Building_Bar : Building
        public override IEnumerable<Command> GetGizmos()
            yield return base.GetGizmos();

            // Get the offending gizmo
            var bar = new foo.TestCommand();
            yield return bar;

            // No more gizmos
            yield break;


(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By


You're right, for the tooltip it was ignoring Desc. Fixed now, thanks.
Tynan Sylvester - @TynanSylvester - Tynan's Blog