Spawn Other Building When Powered - Vanilla-Expanded/VanillaExpandedFramework GitHub Wiki

<- Back

CompProperties_SpawnOtherBuildingWhenPowered detects whether this Building is powered (and flicked ON) and then spawns 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

public string defOfBuildingToSpawn = "HorseshoesPin";
public int tickRaresToCheck = 1;

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

How do I use this code?

It is a comp class, so you just add it in XML in the <comps> tag.

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.

<comps>
	<li Class="VanillaFurnitureExpanded.CompProperties_SpawnOtherBuildingWhenPowered">
		<defOfBuildingToSpawn>VFE_HologramOn</defOfBuildingToSpawn>
		<tickRaresToCheck>1</tickRaresToCheck>
	</li>
</comps>
⚠️ **GitHub.com Fallback** ⚠️