New to modding. Help with buildings, please.

Started by Captain_Goatse, September 23, 2017, 09:05:05 AM

Previous topic - Next topic

Captain_Goatse

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?

...

CannibarRechter

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.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

Captain_Goatse

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>
...

Captain_Goatse

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?
...

ziame

you have to specify "designationCategory" in xml

Kubouch

You can check out Modding and Modding Tutorial Wiki pages. You can also go through Stickied Mod Help 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.