Stop clothing piece from changing colour based on materials

Started by EzraN, August 12, 2016, 12:48:07 AM

Previous topic - Next topic

Shinzy

Quote from: CallMeDio on August 16, 2016, 11:14:29 AM
-snip-

Adjusting the colour generator thing only works with nonstuffed apparel. Iif the thing uses any stuffy stuff in it's recipe it'll inherit it's colour from that unless the colorcomp is removed

CallMeDio

QuoteYou may need a rubber duck.  Also, try some caveman debugging.

Released mods: No Mood Loss on Prisoner Sold or Died

JT

Quote from: Shinzy on August 15, 2016, 03:22:28 PM
Yeah the comp colorable is apparel only thing, it works just for them
with buildings my best guess would be to just use the Costlist instead of CostStuffcount
looking at the defs only the buildings that get coloured in vanilla use those. Check some of the vanilla buildings (like cooking stove) for some pointers

I've found out that buildings not being coloured is a symptom of using the <shaderType>CutoutComplex</shaderType> tag within the graphicData node of the ThingDef.  It is entirely possible to use a costStuffCount and still have the buildings coloured -- e.g., the Hand Tailoring Bench uses only a costStuffCount with no costList. =)

Shinzy

Quote from: JT on August 17, 2016, 12:52:26 PM
Quote from: Shinzy on August 15, 2016, 03:22:28 PM
Yeah the comp colorable is apparel only thing, it works just for them
with buildings my best guess would be to just use the Costlist instead of CostStuffcount
looking at the defs only the buildings that get coloured in vanilla use those. Check some of the vanilla buildings (like cooking stove) for some pointers

I've found out that buildings not being coloured is a symptom of using the <shaderType>CutoutComplex</shaderType> tag within the graphicData node of the ThingDef.  It is entirely possible to use a costStuffCount and still have the buildings coloured -- e.g., the Hand Tailoring Bench uses only a costStuffCount with no costList. =)

Oh that makes so much more sense ;D I just had a quick glance at the files and bit of guesswork =P thanks!

Ben84

Quote from: Shinzy on August 15, 2016, 09:47:04 AM
you need to remove the comp colorable from the item and it's parent def to get it to not use stuffcolour (but then you'll have to manually colour the texture yourself if you want it to have any colour of it's own)
Hello everyone,
I'm totally new to RimWorld Modding and I need your help,please.
I've the same problem/issue like the OP.

I've made an Uniform which is craftable by leather and fabric, but because it uses stuff, the uniform gets the colour of used stuff instead of using my texture colour. Searched a lot and subscribed also a lot of workshop items and searched their files (found a lot of other useful things), but apparently I'm not able to get it to work. The only thing is a lazy workaraound with using steel instead of stuff, but I don't want to use this method.
Like Shinzy stated, I don't have any clue how to get rid of that comp colorable value.Which tag/s is/are that/those? Do I need an additional xml file? Have you an example?
I tried this in my Apparel_Uniform.xml :
<comps>
<li Class="CompProperties_Forbiddable"/>
<li>
<compClass>CompColorable</compClass>
</li>
<li>
<compClass>CompQuality</compClass>
</li>
</comps>

And also this at the end:
<colorGenerator Class="ColorGenerator_StandardApparel" />
Any help is really much appreciated and sorry for my bad english, not my native language.
Regards
Ben


kaptain_kavern

#20
Quote from: Shinzy on August 15, 2016, 09:47:04 AM
you need to remove the comp colorable from the item and it's parent def to get it to not use stuffcolour (but then you'll have to manually colour the texture yourself if you want it to have any colour of it's own)
To me that means to remove :
<li>
<compClass>CompColorable</compClass>
</li>


no?

Ben84

Unfortunately no.
I used the vanilla parka as template. There are not any comp tags in that xml and it still uses the colour of the used stuff instead of using the colour of the texture itself.

skullywag

Another way to do this would be to change the shader and use a mask texture. Mask the texture so nothing is effected by "stuff", you can then keep the stuff type recipe so it can be made of whatever but the image will always be the colour you made it.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

kaptain_kavern

Quote from: Ben84 on July 04, 2017, 08:24:16 AM
Unfortunately no.
I used the vanilla parka as template. There are not any comp tags in that xml and it still uses the colour of the used stuff instead of using the colour of the texture itself.

Parka inherit from "ApparelMakeableBase" which inherit from "ApparelBase" which has it

Ben84

Quote from: skullywag on July 04, 2017, 08:38:51 AM
Another way to do this would be to change the shader and use a mask texture. Mask the texture so nothing is effected by "stuff", you can then keep the stuff type recipe so it can be made of whatever but the image will always be the colour you made it.
Sounds interesting, but I have absolutely no idea what to do exactly !? :/

Quote from: kaptain_kavern on July 04, 2017, 08:40:23 AM
Quote from: Ben84 on July 04, 2017, 08:24:16 AM
Unfortunately no.
I used the vanilla parka as template. There are not any comp tags in that xml and it still uses the colour of the used stuff instead of using the colour of the texture itself.

Parka inherit from "ApparelMakeableBase" which inherit from "ApparelBase" which has it
Okay, so I have made two files now:
The first one is my uniform, called WehrUniform in Apparel_WehrUniform.xml
<?xml version="1.0" encoding="utf-8" ?>
<ThingDefs>

<ThingDef ParentName="ApparelMakeableBase">
<defName>Apparel_WehrUniform</defName>
<label>WehrUniform</label>
<description>Die schneidige WehrUniform lässt jeden noch so beleibten Soldaten schlank und rank aussehen.</description>
<graphicData>
<texPath>Things/Apparel/WehrUniform/WehrUniform</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<techLevel>Neolithic</techLevel>
<costStuffCount>10</costStuffCount>
<stuffCategories>
<li>Fabric</li>
<li>Leathery</li>
</stuffCategories>
<thingCategories>
<li>Apparel</li>
</thingCategories>
<statBases>
<MaxHitPoints>200</MaxHitPoints>
<WorkToMake>100</WorkToMake>
<Mass>2.0</Mass>
<ArmorRating_Sharp>0.2</ArmorRating_Sharp>
<ArmorRating_Heat>0.05</ArmorRating_Heat>
<Insulation_Cold>-20</Insulation_Cold>
<Insulation_Heat>25</Insulation_Heat>
</statBases>
<equippedStatOffsets>
<MoveSpeed>-0.02</MoveSpeed>
<WorkSpeedGlobal>-0.10</WorkSpeedGlobal>
<MentalBreakThreshold>-0.15</MentalBreakThreshold>
<RecruitPrisonerChance>0.20</RecruitPrisonerChance>
<SocialImpact>0.1</SocialImpact>
<TradePriceImprovement>0.2</TradePriceImprovement>
<ShootingAccuracy>0.20</ShootingAccuracy>
<MeleeHitChance>0.25</MeleeHitChance>
<AimingDelayFactor>-0.2</AimingDelayFactor>
</equippedStatOffsets>
<generateCommonality>0.2</generateCommonality>
<apparel>
<bodyPartGroups>
<li>Torso</li>
<li>Shoulders</li>
<li>Arms</li>
<li>Legs</li>
</bodyPartGroups>
<worngraphicPath>Things/Apparel/WehrUniform/WehrUniform</worngraphicPath>
<layers>
<li>Shell</li>
</layers>
<tags>
<li>Outlander</li>
<li>Spacer</li>
</tags>
<defaultOutfitTags>
<li>Soldier</li>
</defaultOutfitTags>
</apparel>

</ThingDef>

</ThingDefs>

The second file is Bases_WehrUniform.xml :
<?xml version="1.0" encoding="utf-8" ?>
<ThingDefs>

<!-- normal bases -->

<ThingDef Name="WehrUniformApparelBase" 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>2</DeteriorationRate>
<SellPriceFactor>0.5</SellPriceFactor>
</statBases>
<altitudeLayer>Item</altitudeLayer>
<alwaysHaulable>True</alwaysHaulable>
<tickerType>Never</tickerType>
<comps>
<li Class="CompProperties_Forbiddable"/>

<li>
<compClass>CompQuality</compClass>
</li>
</comps>
</ThingDef>


<ThingDef Name="WehrUniformApparelMakeableBase" ParentName="WehrUniformApparelBase" Abstract="True">
<recipeMaker>
<workSpeedStat>TailoringSpeed</workSpeedStat>
<workSkill>Crafting</workSkill>
<effectWorking>Tailor</effectWorking>
<soundWorking>Recipe_Tailor</soundWorking>
<recipeUsers>
<li>ElectricTailoringBench</li>
<li>HandTailoringBench</li>
</recipeUsers>
<unfinishedThingDef>UnfinishedApparel</unfinishedThingDef>
</recipeMaker>
</ThingDef>

</ThingDefs>

Here I deleted the line:
<li>
<compClass>CompColorable</compClass>
</li>

The Uniform is craftable but still uses the colour of the used stuff.
I don't get any errors at start of the game. Do I linked something wrong?
I'm near to give up on this topic :(

kaptain_kavern

Don't give up! you're near the end.

now you need to make your modded apparel to use the modded base you just made.

Try to just change

<ThingDef ParentName="ApparelMakeableBase">
<defName>Apparel_WehrUniform</defName>
<....>

to

<ThingDef ParentName="WehrUniformApparelMakeableBase">
<defName>Apparel_WehrUniform</defName>
<....>

kaptain_kavern

#26
A base or Abstract is like a template you do to not have to retype everything from scratch.

And a Defs always inherits from it's parentBase if there is one

Ben84

Quote from: kaptain_kavern on July 04, 2017, 11:07:08 AM
Don't give up! you're near the end.

now you need to make your modded apparel to use the modded base you just made.

Try to just change

<ThingDef ParentName="ApparelMakeableBase">
<defName>Apparel_WehrUniform</defName>
<....>

to

<ThingDef ParentName="WehrUniformApparelMakeableBase">
<defName>Apparel_WehrUniform</defName>
<....>

I changed it, but the WehrUniform still uses the colour of the used stuff instead of my texture colour :(


[attachment deleted by admin due to age]

kaptain_kavern

#28
Quote from: skullywag on July 04, 2017, 08:38:51 AM
Another way to do this would be to change the shader and use a mask texture. Mask the texture so nothing is effected by "stuff", you can then keep the stuff type recipe so it can be made of whatever but the image will always be the colour you made it.
Do you talk about a completely black shader or completely red? I'm pretty sure it's black but I'm not that gifted with "graphical stuff" ^^

@Ben84 : It's related to this : https://github.com/seraphile/rimshare/wiki/Colouring-in-Images

Ben84

Quote from: kaptain_kavern on July 04, 2017, 12:08:11 PM
Quote from: skullywag on July 04, 2017, 08:38:51 AM
Another way to do this would be to change the shader and use a mask texture. Mask the texture so nothing is effected by "stuff", you can then keep the stuff type recipe so it can be made of whatever but the image will always be the colour you made it.
Do you talk about a completely black shader or completely red? I'm pretty sure it's black but I'm not that gifted with "graphical stuff" ^^

@Ben84 : It's related to this : https://github.com/seraphile/rimshare/wiki/Colouring-in-Images
Thanks for your patience so far. But I wonder, why it's not working with the bases.xml file !?
Also for this shader thing, i will try that,too. But where to put the xml code in? Is it a seperate xml file, if yes how to name and where to locate it? If not, then where to put the xml code in, in apparel.xml or bases.xml ?

So that means I have to made 3xMale, 3xFemale,3xHulk, 3xFat and 3xThin black 128x128px files named with the m before .png....

I really wish there just was a xml tag like: <UseColorVariation>FALSE</UseColorVariation>