Skip to content

Resizable Beds (code for beds contributed by Fluxic)

RecompiledBirds edited this page Jun 29, 2025 · 3 revisions

This component allows for beds that scale on both axes, as well as just one.

We will be using the Pillow Piles from _RimVali: Far From Avalon` as an example.

<ThingDef Name="RVFFA_BasePillowPile" ParentName="FurnitureWithQualityBase" Abstract="True">
	<thingClass>Building_Bed</thingClass>
	<altitudeLayer>Building</altitudeLayer>
	<designationCategory>RVFFA_Furniture</designationCategory>
	<rotatable>true</rotatable>
	<fillPercent>0.15</fillPercent>
	<pathCost>14</pathCost>
	<passability>PassThroughOnly</passability>
	<canOverlapZones>false</canOverlapZones>
	<castEdgeShadows>true</castEdgeShadows>
	<uiIconScale>0.80</uiIconScale>
	<stuffCategories>
		<li>Fabric</li>
		<li>Leathery</li>
        </stuffCategories>

	<building>
		<bed_humanlike>true</bed_humanlike>
		<bed_showSleeperBody>true</bed_showSleeperBody>
		<bed_healPerDay>4</bed_healPerDay>
		<destroySound>BuildingDestroyed_Soft_Small</destroySound>
		<buildingTags>
			<li>Bed</li>
		</buildingTags>
	</building>

	<techLevel>Medieval</techLevel>
	<researchPrerequisites>
		<li>ComplexFurniture</li>
	</researchPrerequisites>

	<comps>
		<li Class="CompProperties_AssignableToPawn">
			<drawAssignmentOverlay>false</drawAssignmentOverlay>
			<compClass>CompAssignableToPawn_Bed</compClass>
		</li>
		<li Class="CompProperties_AffectedByFacilities">
			<linkableFacilities>
				<li>EndTable</li>
				<li>Dresser</li>
				<li>RVFFA_IlluminateEndTable</li>
			</linkableFacilities>
		</li>
		<li Class="RVCRestructured.RVCBeds.ResizedBedCompProperties">
			<isPile>true</isPile>
			<rotationRange>-360~360</rotationRange>
                </li>
	</comps>
</ThingDef>

All that needs to be done is adding this component to the comps list. The rest is automatically handled.

<li Class="RVCRestructured.RVCBeds.ResizedBedCompProperties">
     <!-- Do pawns get a random rotation? -->
     <isPile>true</isPile>
     <!-- if isPile is true, whats the range a pawn can be rotated in?-->
     <rotationRange>-360~360</rotationRange>
</li>

Clone this wiki locally