Question about apparel color when 2 materials are used

Started by Hiztaar, March 28, 2016, 07:34:17 PM

Previous topic - Next topic

Hiztaar

Hi !

I'm trying to allow all my custom apparels to be crafted with any textile in the game. Everything is fine with simple apparels but it becomes more complicated with apparels using 2 ressources.

My armors and helmet both used Steel and Fabric/Leather.
But when crafted it turns out to be a "Steel" armor or "Steel" Helmet. I want it to be Fabric/Leather inherited, not steel. Do you have an idea on how to force the game to do that ?

In the xml it looks like this :


  <ThingDef Name="HatBase" Abstract="True">
    <thingClass>Apparel</thingClass>
    <category>Item</category>
    <selectable>True</selectable>
    <pathCost>10</pathCost>
    <useHitPoints>True</useHitPoints>
    <graphicData>
      <onGroundRandomRotateAngle>35</onGroundRandomRotateAngle>
    </graphicData>
    <drawGUIOverlay>true</drawGUIOverlay>
    <statBases>
      <MaxHitPoints>100</MaxHitPoints>
      <Flammability>1.0</Flammability>
      <DeteriorationRate>3</DeteriorationRate>
      <SellPriceFactor>0.5</SellPriceFactor>
    </statBases>
    <altitudeLayer>Item</altitudeLayer>
    <alwaysHaulable>True</alwaysHaulable>
    <tickerType>Never</tickerType>
    <thingCategories>
      <li>USCMHeadgears</li>
    </thingCategories>
    <comps>
      <li>
        <compClass>CompForbiddable</compClass>
      </li>
      <li>
        <compClass>CompColorable</compClass>
      </li>
      <li>
        <compClass>CompQuality</compClass>
      </li>
    </comps>
  </ThingDef>

<ThingDef Name="ApparelMakeableBase" ParentName="HatBase" Abstract="True">
<recipeMaker>
<workSpeedStat>TailoringSpeed</workSpeedStat>
<workSkill>Crafting</workSkill>
<effectWorking>Tailor</effectWorking>
<soundWorking>Recipe_Tailor</soundWorking>
<recipeUsers>
<li>TableTailor</li>
</recipeUsers>
<unfinishedThingDef>UnfinishedApparel</unfinishedThingDef>
</recipeMaker>
</ThingDef>


 
    <ThingDef ParentName="ApparelMakeableBase">
<defName>USCM_CamoHelmet</defName>
<label>M10 ballistic helmet</label>
<description>Marine M10 Ballistic helmet. Standard issue for Colonial Marines.</description>
<graphicData>
<texPath>Marines/Helmet/USCM_CamoHelmet</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<statBases>
<WorkToMake>10000</WorkToMake>
<MaxHitPoints>150</MaxHitPoints>
<ArmorRating_Blunt>0.25</ArmorRating_Blunt>
<ArmorRating_Sharp>0.30</ArmorRating_Sharp>
<ArmorRating_Heat>0.2</ArmorRating_Heat>
<ArmorRating_Electric>0.1</ArmorRating_Electric>
<Insulation_Cold>-4</Insulation_Cold>
</statBases>
<costList>
<Steel>90</Steel>
</costList>
<costStuffCount>30</costStuffCount>
<stuffCategories>
<li>Fabric</li>
<li>Leathery</li>
</stuffCategories>
<equippedStatOffsets>
  <MoveSpeed>0</MoveSpeed>
  <ShootingAccuracy>0.05</ShootingAccuracy>
</equippedStatOffsets>
<apparel>
<bodyPartGroups>
<li>UpperHead</li>
</bodyPartGroups>
<worngraphicPath>Marines/Helmet/USCM_CamoHelmet</worngraphicPath>
<layers>
<li>Overhead</li>
</layers>
<commonality>1</commonality>
<tags>
<li>Military</li>
</tags>
<defaultOutfitTags>
<li>Soldier</li>
</defaultOutfitTags>
</apparel>
<colorGenerator Class="ColorGenerator_StandardApparel" />
</ThingDef>


Maybe that part is wrong ? :


<costList>
<Steel>90</Steel>
</costList>
<costStuffCount>30</costStuffCount>
<stuffCategories>
<li>Fabric</li>
<li>Leathery</li>
</stuffCategories>


Thanks for the help !
"What do you mean, "*They* cut the power ?"

[B18] United States Colonial Marines (Aliens) - All mods

skullywag

#1
If you make something out of stuff depending on the shader used in the graphicdata it will take on that stuffs colour. If you dont define the correct shader type you will simply get the colour of the texture. For stuff based things you want to have a light grey/white texture and the appropriate shader type set.

Probably best look at core beds for mask based colouring (parts of the texture).

Check core melee weapons for full image colouring

But to be clear that bit you put above is right.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Hiztaar

Thanks Skully. But the problem is something else in fact.

When making an armored helmet for exemple (USCM_CamoHelmet), the armor will inherit the properties of the materials it is made of. I do want it to inherit the properties (stats + textures) of textiles and not steel.

When a pawn start making the helmet with a specific textile (Devilstrand) it has 90% of chances to turn out to be a Steel M10 ballistic helmet and sometimes (like 10%) it turns out to be a Devilstrand M10 ballistic helmet. When it's a Devilstrand M10 ballistic helmet, the final stats are upgraded by devilstrand and my green helmet turns dark red, it's ok. When it's steel, the color is indeed darker like steel but no changes in stats and the devilstrand is consumed for nothing.

Is there a way to force the inheritance of properties ? The famous material prefix when crafting ? Or to forbid a specific inheritance ?

PS : I looked at the "bed" properties. It looks like it always inherits properties from the <stuffCategories> and not from the <costList>. It's clearly not the same with crafted items. Bug ?
"What do you mean, "*They* cut the power ?"

[B18] United States Colonial Marines (Aliens) - All mods

Shinzy

It tends to pick it's stats from whichever material was used most of (but that's still not 100%)
so if you want to "force" it to use fabric/leather your best bet (through xmls anyway) and if you want to keep the cost the same
is to make another material like "helmet base" or something that is made of your 90 steel

and then if you want you can give your "helmet base" material some fancy prefix of it's own like "This is"
so when it does rarely get it's stats from that one it'll be fantastic as you have lovely "This is USCM helmet" helmet

Hiztaar

Haha, thanks, nice workaround ;)

I'll wait for Tynan or Ison to do something about it. or at least have a hand on the choice of inheritance behavior.
"What do you mean, "*They* cut the power ?"

[B18] United States Colonial Marines (Aliens) - All mods