Furniture Comp Classes - AndroidQuazar/VanillaExpandedFramework GitHub Wiki
The Furniture module of the framework has two comp classes that can be added to any Building to provide special behaviours:
-
CompProperties_SelectBuildingBehind: Adds a command button (called gizmos in the code) to the Building that allows the player to deselect it and select another building that is in the same tile. This is also done in the game by clicking in the same spot several times, so this class is mostly cosmetic. You can set via XML the button's graphic, text and description. For example, we use it with Vanilla Furniture Expanded - Art's holograms, where a button appears on hologram to select the underneath hologram base. You can check an example here
-
CompProperties_RandomBuildingGraphic: Allows random building graphics. Works both with Graphic_Single and Graphic_Multi. Simple example here:
<li Class="VanillaFurnitureExpanded.CompProperties_RandomBuildingGraphic">
<randomGraphics>
<li>Things/Building/GR_AnimalEnrichmentCenter</li>
<li>Things/Building/GR_AdvancedGenePod</li>
</randomGraphics>
</li>
-
CompProperties_RockSpawner: This is just code for an auto-drill. It selects rocks from the biome it is in.
-
CompProperties_SpawnOtherBuildingWhenPowered: A comp class to detect whether this Building is powered (and flicked ON) and then spawn a different Building on top of it. If the first Building is flicked OFF, or runs out of power, or is moved away, the second Building despawns
This second building needs to have:
<clearBuildingArea>false</clearBuildingArea>
<building>
<isEdifice>false</isEdifice>
<canPlaceOverWall>true</canPlaceOverWall>
</building>
Or it will just delete the first one! Though maybe that's what you want, I won't judge
We use this class with Vanilla Furniture Expanded - Art's holograms. The base spawns the hologram itself. The base has 0 Beauty, but the hologram has variable beauty (depending on quality). This allows us to create a building that only produces Beauty when powered, with very very low lag.
Example of this code in use is here
They are all comp classes, so you just add them in XML in the tag. Check any of the examples to see.