Random Building Graphic - Vanilla-Expanded/VanillaExpandedFramework GitHub Wiki

CompRandomBuildingGraphic allows you to assign random graphics to any building, except beds and other items that use the medical overlay (like nutrient past dispensers). Works both with Graphic_Single and Graphic_Multi.

        //A simple comp class that changes a building's graphic by using reflection
       
        //A list of image paths
        public List<string> randomGraphics;

        //By default, the building will spawn with an image from randomGraphics chosen at random, but the modder can disable that 
        public bool startAsRandom = true;

        //The modder can also disable the randomize image button from appearing on this building 
        public bool disableRandomButton = false;

        //The modder can also disable the choose image button from appearing on this building 
        public bool disableGraphicChoosingButton = false;

        //And I just noticed that this one is redundant (disables both buttons), but fuck it, I give you options and YOU'LL LIKE IT
        public bool disableAllButtons = false;

How do I use this code?

It is a comp class, so you just add it in XML in the tag of the building. For example, this would give a building a graphic at random chosen from two graphics from Vanilla Genetics Expanded. No buttons hidden, and the building will spawn with one of them at random.

<li Class="VanillaFurnitureExpanded.CompProperties_RandomBuildingGraphic">
        <randomGraphics>
		<li>Things/Building/GR_AnimalEnrichmentCenter</li>
		<li>Things/Building/GR_AdvancedGenePod</li>
        </randomGraphics>
</li>

WARNING: the original graphic of the building needs to be specified in randomGraphics too, or it will not be chosen as one of the alternatives (which might be what the modder wants, in that case don't add it)

⚠️ **GitHub.com Fallback** ⚠️