CompProperties_ResourceStorage - AndroidQuazar/VanillaExpandedFramework GitHub Wiki
This comp can be added to any building. It allows said building to connect to other buildings in the net and act as storage.
Below, an example of the comp, the building do not need to tick (🟢 mean it default to true).
<li Class="PipeSystem.CompProperties_ResourceStorage">
<!-- Accept a PipeNetDef -->
<pipeNet>VCHE_ChemfuelNet</pipeNet>
<!-- Amount that can be stored -->
<storageCapacity>1500</storageCapacity>
<!-- False if you don't want the storage bar to show -->
<drawStorageBar>True</drawStorageBar> 🟢
<!-- False if you don't want the storage info to show in inspect tab -->
<addStorageInfo>True</addStorageInfo> 🟢
<!-- False if player shouldn't be able to transfer content to other comps -->
<addTransferGizmo>True</addTransferGizmo> 🟢
<!-- Lenght and Width of the bar -->
<barSize>(1.3, 0.25)</barSize>
<!-- 0 mean there is no bar outline -->
<margin>0.1</margin>
<!-- Bar center offset -->
<centerOffset>(0, 0, 0.35)</centerOffset>
<!-- Only use this if you want the player to be able to tell pawn to extract stuff -->
<extractOptions>
<!-- Extract gizmo icon -->
<texPath>UI/Gizmos/ExtractChemfuel</texPath>
<!-- Those need to be translation key -->
<labelKey>VCHE_ExtractChemfuel</labelKey>
<descKey>VCHE_ExtractChemfuelDesc</descKey>
<!-- The amount extracted -->
<extractAmount>150</extractAmount>
<!-- The amount of ticks it take to extract-->
<extractTime>150</extractTime>
<!-- The thing spawned after extract -->
<thing>Chemfuel</thing>
<!-- 1 spawned, 1*X less in the grid -->
<ratio>X</ratio>
</extractOptions>
<refillOptions>
<!-- If true, will always be refilled by pawns. -->
<!-- If false, allow user to enable/disable tank refill -->
<alwaysRefill>false</alwaysRefill>
<!-- Number of ticks needed to refill -->
<refillTime>150</refillTime>
<!-- Thing to refill with -->
<thing>Chemfuel</thing>
<!-- 1 used, 1*X more in the grid -->
<ratio>X</ratio>
</refillOptions>
<!-- Use this if you want filth to be spawned when the storage is destroyed -->
<destroyOption>
<!-- Filth to spawn -->
<filth>VNPE_Filth_Paste</filth>
<!-- Amount to spawn: X/ratio -->
<ratio>1</ratio>
<!-- Spawn around -->
<maxRadius>4</maxRadius>
</destroyOption>
</li>
You will also need to add to your def (if drawStorageBar
is True):
<drawerType>MapMeshAndRealTime</drawerType>
If you want the storage to explode when damaged, and the explosion size scaling with how full the storage is, you can use the CompProperties_ExplosiveContent
comp.
<li Class="PipeSystem.CompProperties_ExplosiveContent">
<!-- 0 when empty, 12 when full -->
<explosiveMaxRadius>12</explosiveMaxRadius>
<!-- Vanilla options below -->
<explosiveDamageType>Flame</explosiveDamageType>
<destroyThingOnExplosionSize>2</destroyThingOnExplosionSize>
<startWickHitPointsPercent>0.333</startWickHitPointsPercent>
<preExplosionSpawnThingDef>Filth_Fuel</preExplosionSpawnThingDef>
<preExplosionSpawnChance>1</preExplosionSpawnChance>
<wickTicks>70~150</wickTicks>
</li>
If your building have this comp. Use the GetComp<CompResourceStorage>()
method. Then you have access to everything inherited from CompProperties_Resource;