Help with creating "stuff" from chunks

Started by wnci997, July 26, 2016, 03:35:21 PM

Previous topic - Next topic

wnci997

Hello! Long time lurker, first time question-asker? Little backstory on my problem:
I recently released a mod on workshop that allows you to create "rock" walls from stone bricks. They look just like natural walls, and were designed for cosmetics in mind.

However, it was asked if I could make it fill the gap between Wood -> Steel, without using stonecutting. I thought I'd give it a try, because how hard can it be.
The answer is exceptionally hard. For me atleast :P

Here is the general idea of the workflow:
Make craftingspot -> Bill:Make Stone Shards (Item) -> Get 2 Shards -> Complete!
The Bill would take 1 stone chunk and output 2 stone shards of the chunks type i.e. 1 limestone chunk makes 2 limestone shards.

My Current, and only real problem, is that when I tell them to make the stone shards, the output is instead 20 stone BRICKS.
Here is the code for my "Item".
<?xml version="1.0" encoding="utf-8" ?>
<Defs>

  <ThingDef ParentName="ResourceBase" Name="StoneShardsBase" Abstract="True">
    <description>Shards of stone. Mostly useful for building long-lasting, simple structures.</description>
    <graphicData>
      <texPath>Things/Item/Resource/StoneBlocks</texPath>
      <graphicClass>Graphic_Single</graphicClass>
    </graphicData>
    <soundInteract>Stone_Drop</soundInteract>
    <soundDrop>Stone_Drop</soundDrop>
    <useHitPoints>false</useHitPoints>
    <statBases>
      <MarketValue>1.9</MarketValue>
      <SharpDamageMultiplier>0.6</SharpDamageMultiplier>
      <BluntDamageMultiplier>1.0</BluntDamageMultiplier>
    </statBases>
    <thingCategories>
      <li>StoneBlocks</li>
    </thingCategories>
    <stuffProps>
      <categories>
        <li>Stony</li>
      </categories>
      <appearance>Bricks</appearance>
      <statOffsets>
        <WorkToMake>200</WorkToMake>
        <Beauty>1</Beauty>
      </statOffsets>
      <statFactors>
        <Beauty>1.0</Beauty>
        <MarketValue>0.4</MarketValue>
        <MaxHitPoints>2.4</MaxHitPoints>
        <Flammability>0</Flammability>
        <WorkToMake>4.5</WorkToMake>
        <DoorOpenSpeed>0.45</DoorOpenSpeed>
        <BedRestEffectiveness>0.9</BedRestEffectiveness>
        <MeleeWeapon_Cooldown>1.35</MeleeWeapon_Cooldown>
      </statFactors>
    </stuffProps>
  </ThingDef>



  <!-- =========== Stone solids, chunks, and blocks =========== -->

  <ThingDef ParentName="StoneShardsBase">
    <defName>ShardSandstone</defName>
    <label>sandstone shards</label>
    <description>Shards of sandstone. Sandstone is a relatively soft rock and chips easily.</description>
    <graphicData>
      <color>(126,104,94)</color>
    </graphicData>
    <statBases>
      <MarketValue>1.0</MarketValue>
      <SharpDamageMultiplier>0.5</SharpDamageMultiplier>
    </statBases>
    <stuffProps>
      <color>(126,104,94)</color>
      <soundImpactStuff>BulletImpactGround</soundImpactStuff>
      <soundMeleeHitSharp>MeleeHit_Stone</soundMeleeHitSharp>
      <soundMeleeHitBlunt>MeleeHit_Stone</soundMeleeHitBlunt>
      <stuffAdjective>sandstone</stuffAdjective>
      <statFactors>
        <Beauty>0.3</Beauty> 
        <MarketValue>0.4</MarketValue>
        <MaxHitPoints>1.0</MaxHitPoints>
      </statFactors>
    </stuffProps>
  </ThingDef>




  <ThingDef ParentName="StoneShardsBase">
    <defName>ShardGranite</defName>
    <label>granite shards</label>
    <description>Shards of granite. Granite is a very hard stone.</description>
    <graphicData>
      <color>(105,95,97)</color>
    </graphicData>
    <statBases>
      <MarketValue>1.5</MarketValue>
      <SharpDamageMultiplier>0.65</SharpDamageMultiplier>
    </statBases>
    <stuffProps>
      <color>(105,95,97)</color>
      <soundImpactStuff>BulletImpactGround</soundImpactStuff>
      <soundMeleeHitSharp>MeleeHit_Stone</soundMeleeHitSharp>
      <soundMeleeHitBlunt>MeleeHit_Stone</soundMeleeHitBlunt>
      <stuffAdjective>granite</stuffAdjective>
      <statFactors>
        <MarketValue>0.5</MarketValue>
        <MaxHitPoints>0.7</MaxHitPoints>
      </statFactors>
    </stuffProps>
  </ThingDef>







  <ThingDef ParentName="StoneShardsBase">
    <defName>ShardLimestone</defName>
    <label>limestone Shards</label>
    <description>Shards of limestone.</description>
    <graphicData>
      <color>(158,153,135)</color>
    </graphicData>
    <statBases>
      <MarketValue>1.0</MarketValue>
    </statBases>
    <stuffProps>
      <color>(158,153,135)</color>
      <soundImpactStuff>BulletImpactGround</soundImpactStuff>
      <soundMeleeHitSharp>MeleeHit_Stone</soundMeleeHitSharp>
      <soundMeleeHitBlunt>MeleeHit_Stone</soundMeleeHitBlunt>
      <stuffAdjective>limestone</stuffAdjective>
      <statFactors>
        <MarketValue>0.4</MarketValue>
        <MaxHitPoints>0.55</MaxHitPoints>
      </statFactors>
    </stuffProps>
  </ThingDef>





  <ThingDef ParentName="StoneShardsBase">
    <defName>ShardSlate</defName>
    <label>slate shard</label>
    <description>Shards of slate. A dull-looking rock that chips easily.</description>
    <graphicData>
      <color>(70,70,70)</color>
    </graphicData>
    <statBases>
      <MarketValue>1.0</MarketValue>
    </statBases>
    <stuffProps>
      <color>(70,70,70)</color>
      <soundImpactStuff>BulletImpactGround</soundImpactStuff>
      <soundMeleeHitSharp>MeleeHit_Stone</soundMeleeHitSharp>
      <soundMeleeHitBlunt>MeleeHit_Stone</soundMeleeHitBlunt>
      <stuffAdjective>slate</stuffAdjective>
      <statFactors>
        <Beauty>0.3</Beauty>
        <MarketValue>0.38</MarketValue>
        <MaxHitPoints>1.0</MaxHitPoints>
      </statFactors>
    </stuffProps>
  </ThingDef>





  <ThingDef ParentName="StoneShardsBase">
    <defName>ShardMarble</defName>
    <label>marble shard</label>
    <description>Shards of marble. Marble is a soft, beautiful stone, known for being easy to sculpt.</description>
    <graphicData>
      <color>(132,135,132)</color>
    </graphicData>
    <statBases>
      <MarketValue>1.0</MarketValue>
    </statBases>
    <stuffProps>
      <color>(132,135,132)</color>
      <soundImpactStuff>BulletImpactGround</soundImpactStuff>
      <soundMeleeHitSharp>MeleeHit_Stone</soundMeleeHitSharp>
      <soundMeleeHitBlunt>MeleeHit_Stone</soundMeleeHitBlunt>
      <stuffAdjective>marble</stuffAdjective>
      <statFactors>
        <Beauty>0.35</Beauty>
        <MarketValue>0.45</MarketValue>
        <MaxHitPoints>1.0</MaxHitPoints>
      </statFactors>
    </stuffProps>
  </ThingDef>


</Defs>



Here is the code for my recipe
<?xml version="1.0" encoding="utf-8" ?>
<RecipeDefs>

<RecipeDef>
<defName>MakeStoneShards</defName>
<label>make stone shards</label>
<description>Smashes rock chunks into usable stone shards.</description>
<jobString>Stonecutting.</jobString>
<workAmount>1600</workAmount>
<workSpeedStat>StonecuttingSpeed</workSpeedStat>
    <workSkill>Crafting</workSkill>
    <workSkillLearnFactor>0.25</workSkillLearnFactor>
<effectWorking>CutStone</effectWorking>
    <soundWorking>Recipe_MakeStoneBlocks</soundWorking>
    <targetCountAdjustment>50</targetCountAdjustment>
    <ingredients>
<li>
<filter>
<categories>
<li>StoneChunks</li>
</categories>
</filter>
<count>1</count>
</li>
</ingredients>
<fixedIngredientFilter>
<stuffproducts>
      <StoneShardsBase>10</StoneShardsBase>
    </stuffproducts>
      <categories>
        <li>StoneChunks</li>
      </categories>
</fixedIngredientFilter>
  </RecipeDef>


</RecipeDefs>


and here is the code for my production table (although I dont think ive had any problems with this)
<?xml version="1.0" encoding="utf-8" ?>
<ThingDefs>

  <ThingDef ParentName="BuildingBase">
    <defName>CraftingSpot</defName>
    <label>crafting spot</label>
    <Description>A place for crafting simple things like shivs or bows.</Description>
    <ThingClass>Building_WorkTable</ThingClass>
    <graphicData>
      <texPath>Things/Building/Production/CraftingSpot</texPath>
      <graphicClass>Graphic_Single</graphicClass>
      <drawSize>(1,1)</drawSize>
    </graphicData>
    <AltitudeLayer>FloorEmplacement</AltitudeLayer>
    <statBases>
      <WorkToMake>0</WorkToMake>
    </statBases>
    <useHitPoints>False</useHitPoints>
    <Size>(1,1)</Size>
    <DesignationCategory>Production</DesignationCategory>
    <Passability>Standable</Passability>
    <hasInteractionCell>True</hasInteractionCell>
    <interactionCellOffset>(0,0,-1)</interactionCellOffset>
    <surfaceType>Item</surfaceType>
    <inspectorTabs>
      <li>ITab_Bills</li>
    </inspectorTabs>
    <building>
      <spawnedConceptLearnOpportunity>BillsTab</spawnedConceptLearnOpportunity>
      <sowTag>SupportPlantsOnly</sowTag>
      <canPlaceOverImpassablePlant>false</canPlaceOverImpassablePlant>
    </building>
    <comps>
      <li Class="CompProperties_AffectedByFacilities">
        <linkableFacilities>
          <li>ToolCabinet</li>
        </linkableFacilities>
      </li>
    </comps>
    <designationHotkey>Misc1</designationHotkey>
<placeWorkers>
<li>PlaceWorker_ShowFacilitiesConnections</li>
</placeWorkers>
<recipes>
      <li>MakeStoneShards</li>
    </recipes>
  </ThingDef>


</ThingDefs>


Ive also attached my mode in its entirety below, so hopefully that helps too :P

[attachment deleted by admin - too old]

kaptain_kavern

#1
From the top of my head, if you need to define also a stuffed classed (look for a folder with stuffed or something similar in Core.

Also you can check Jaxxas reinforced stuff. It is similar

1000101

#2
Your xml is wrong.  "StoneShardsBase" is an abstract class which means it doesn't exist beyond loading and creating actual defs.  Like the stone blocks, you need specific stone shards.  ie: limestone shards.  The shards themselves are the actual stuff and which you will assign to your "StoneShards" stuff category and make your rock walls use stuff using "StoneShards".
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

wnci997

Quote from: 1000101 on July 26, 2016, 06:14:11 PM
Further, because rock chunks already create stone blocks you need to create specific recipes for each rock type, ie: limestone chunks -> limestone shards.

Ah, thank you. I had thought I might need to do that, but I was hoping I wouldnt have to. Feels like im clogging up the bills tab (Although its the crafting spot, so it isnt that big of a deal :P)

RemingtonRyder

I know that you were asked specifically to make something stuff-based, but I'm not sure why there's a need to have five different kinds of crude stone blocks (and the recipes for them). I would just make all the broken chunks into cobblestone.

wnci997

Yea Marvin, you're right. It would be MUCH easier and much less cluttered if I made one recipe, for one resource, and left it at that.

But then I lose out on "stuffing" the rock walls. I have no idea how I would make the colours switchable if it only required one kind of resource, instead of a "stuffed" resource. And because the original idea of the mod was "an aesthetic way to get your mountain walls back", having them appropriately coloured was a must.

So far I've made it work, and although its a little cluttered in the CraftingSpot bills, it isnt in the structure menu, which I think is more important (especially when you are like me and download pretty much every mod you see. Those architect menus get huge! especially furniture and floors!). Im actually just about to release this version, right after I figure out a way to balance it for later game too, so its not such a chore to make :P (Here, have a preview, because why not?)

Also, I think "stuff" is a really cool concept, and working with it, while irritating at times, has been a load of fun and a good learning experience to a newbie modder like me!

[attachment deleted by admin - too old]

1000101

I changed my post a bit, you don't need multiple recipes but you do need a new stuff category.  Then just use the same basic recipe as stone blocks but instead of making stone blocks you'll make shards.  Alternately you don't need stuff categories at all and one recipe to turn any rock chunk into a specific shard ThingDef.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

Fluffy (l2032)

I don't think you can copy pasta the stone block recipes, as stone chunks are actually butchered into blocks. This is how the game handles all the blocks with one recipe. Problem is, you can't define a different butcherproducts for a different recipe. You could see if you can set up smeltingProducts and use the smelting code to smelt chunks into shards analogous to butchering chunks into blocks.

That leaves you with two options, ditch the idea of having stuffed shards and just have one shard item, or create separate recipes a-la stonecutting tweak.

1000101

You may have a point about the butcher products, that would take testing.

You can certainly do the vectored input to a specific output though (stone chunks->shards (ThingDef)) though.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By