Ludeon Forums

RimWorld => Mods => Help => Topic started by: Captain_Goatse on September 23, 2017, 09:05:05 AM

Title: New to modding. Help with buildings, please.
Post by: Captain_Goatse on September 23, 2017, 09:05:05 AM
So, I am trying to mod some new buildings, something like the nutripaste dispenser. I am quite stumped. Is there a building tutorial somewhere? I've copied the petrochemical plant reaction from the Hardcore mod, but I still lack comprehension.

For example, I got an error named "Could not find a type named" and then the name of my building. Can someone explain?

Title: Re: New to modding. Help with buildings, please.
Post by: CannibarRechter on September 23, 2017, 09:47:28 AM
It's quite possible that the mod you copied is relying on a link to some custom C# code. I'm assuming you didn't write any. Post your building XML.
Title: Re: New to modding. Help with buildings, please.
Post by: Captain_Goatse on September 23, 2017, 09:49:49 AM
ok thanks.

<?xml version="1.0" encoding="UTF-8"?>

-<Buildings>


-<ThingDef ParentName="BenchBase">

<DefName>Flourmill</DefName>

<label>Flour Milling Line</label>

<ThingClass>AAL_Flourmill</ThingClass>

<Description>A milling machine for milling great quantities of wheat in a short time. Works only in bulk. Requires power.</Description>


-<graphicData>

<texPath>Things/Building/Flourmill</texPath>

<graphicClass>Graphic_Single</graphicClass>

<drawSize>(2,2)</drawSize>

</graphicData>


-<stuffCategories>

<li>Metallic</li>

</stuffCategories>

<costStuffCount>2000</costStuffCount>


-<CostList>

<Wire>40</Wire>

<Component>20</Component>

<ElectronicComponents>10</ElectronicComponents>

<Mechanism>10</Mechanism>

</CostList>

<altitudeLayer>Building</altitudeLayer>

<UseHitPoints>True</UseHitPoints>

<fillPercent>1</fillPercent>


-<statBases>

<Beauty>-40</Beauty>

<WorkToBuild>5000</WorkToBuild>

<MaxHitPoints>200</MaxHitPoints>

<Flammability>1.0</Flammability>

<Cleanliness>-1</Cleanliness>

</statBases>

<size>(4,3)</size>

<DesignationCategory>Production</DesignationCategory>

<passability>PassThroughOnly</passability>

<hasInteractionCell>True</hasInteractionCell>

<interactionCellOffset>(2,0,-2)</interactionCellOffset>

<surfaceType>Item</surfaceType>


-<recipes>

<li>FlourMillRecipe</li>

</recipes>

<tickerType>Normal</tickerType>


-<comps>


-<li Class="CompProperties_Power">

<compClass>CompPowerTrader</compClass>

<startElectricalFires>true</startElectricalFires>

<basePowerConsumption>400</basePowerConsumption>

<soundPowerOn>PowerOnSmall</soundPowerOn>

<soundPowerOff>PowerOffSmall</soundPowerOff>

</li>


-<li Class="CompProperties_Glower">

<glowRadius>7</glowRadius>

<glowColor>(217,217,208,0)</glowColor>

</li>


-<li Class="CompProperties_HeatPusher">

<compClass>CompHeatPusherPowered</compClass>

<heatPerSecond>2</heatPerSecond>

<heatPushMaxTemperature>30</heatPushMaxTemperature>

</li>


-<li Class="CompProperties_AffectedByFacilities">


-<linkableFacilities>

<li>Small_ToolCabinet</li>

</linkableFacilities>

</li>

<li Class="CompProperties_Flickable"/>

<li Class="CompProperties_Breakdownable"/>

</comps>


-<placeWorkers>

<li>PlaceWorker_ShowFacilitiesConnections</li>

</placeWorkers>


-<building>

<heatPerTickWhileWorking>0.7</heatPerTickWhileWorking>

<soundAmbient>GeothermalPlant_Ambience</soundAmbient>

<wantsHopperAdjacent>true</wantsHopperAdjacent>

</building>

<terrainAffordanceNeeded>Heavy</terrainAffordanceNeeded>

<staticSunShadowHeight>0.6</staticSunShadowHeight>


-<researchPrerequisites>

<li>AAL</li>

</researchPrerequisites>

</ThingDef>


-<ThingDef ParentName="BuildingBase">

<defName>GrainFeeder</defName>

<label>Flour Mill Hopper</label>

<thingClass>Building_Storage</thingClass>


-<graphicData>

<texPath>Things/Building/GenHopper</texPath>

<graphicClass>Graphic_Single</graphicClass>

</graphicData>

<altitudeLayer>Building</altitudeLayer>

<passability>PassThroughOnly</passability>

<fillPercent>0.5</fillPercent>

<pathCost>70</pathCost>


-<building>


-<fixedStorageSettings>

<priority>Important</priority>


-<filter>


-<thingDefs>

<li>Flour</li>

</thingDefs>

</filter>

</fixedStorageSettings>


-<defaultStorageSettings>

<priority>Important</priority>


-<filter>


-<thingDefs>

<li>Flour</li>

</thingDefs>

</filter>

</defaultStorageSettings>

</building>


-<inspectorTabs>

<li>ITab_Storage</li>

</inspectorTabs>

<castEdgeShadows>true</castEdgeShadows>


-<statBases>

<WorkToBuild>750</WorkToBuild>

<MaxHitPoints>100</MaxHitPoints>

<Flammability>1.0</Flammability>

</statBases>

<description>Holds wheat for the Flour Mill. Must be placed adjacent to a Flour Mill.</description>


-<stuffCategories>

<li>Metallic</li>

</stuffCategories>

<costStuffCount>20</costStuffCount>


-<costList>

<Component>2</Component>

</costList>

<tickerType>Never</tickerType>

<rotatable>true</rotatable>

<neverMultiSelect>true</neverMultiSelect>

<DesignationCategory>Production</DesignationCategory>

<staticSunShadowHeight>0.3</staticSunShadowHeight>

<surfaceType>Item</surfaceType>


-<placeWorkers>

<li>PlaceWorker_NextToHopperAccepter</li>

</placeWorkers>


-<researchPrerequisites>

<li>AAL</li>

</researchPrerequisites>

</ThingDef>

</Buildings>
Title: Re: New to modding. Help with buildings, please.
Post by: Captain_Goatse on September 23, 2017, 10:14:27 AM
Already solved, thanks anyways. Is there any tutorial out there? By the way, how can you put your building in one of the construction categories of the "architect" menu?
Title: Re: New to modding. Help with buildings, please.
Post by: ziame on September 24, 2017, 07:46:58 AM
you have to specify "designationCategory" in xml
Title: Re: New to modding. Help with buildings, please.
Post by: Kubouch on September 24, 2017, 03:50:27 PM
You can check out Modding (http://rimworldwiki.com/wiki/Modding) and Modding Tutorial (http://rimworldwiki.com/wiki/Modding_Tutorials) Wiki pages. You can also go through Stickied Mod Help (https://ludeon.com/forums/index.php?board=14.0) posts on this forum. Not sure how they are updated but they should get you started. There is Jecrell's modding tutorial and people say it's good. If you're going to change some vanilla defs, you should use xpathing, also explained in the stickied posts.