Bed Doesn't Change Textures When Set To Prisoner Mode

Started by Mythistocles, May 05, 2015, 09:11:12 PM

Previous topic - Next topic

Mythistocles

I've been working on a mod that adds a hospital bed that is buildable using herbal medicine. I've included basic front (MakeshiftHospitalBed_front.png), back (MakeshiftHospitalBed_back.png), and side (MakeshiftHospitalBed_side.png) textures, as well as a different set of textures to be used when the bed is set to prisoner mode (MakeshiftHospitalBedPrisoner_front.png, etc). Here's the bed definition:


<ThingDef ParentName="BuildingBase">
    <defName>MakeshiftHospitalBed</defName>
    <label>makeshift hospital bed</label>
    <Description>A makeshift hospital bed that isn't as good as a regular hospital bed but is better than nothing.</Description>
    <ThingClass>Building_Bed</ThingClass>
    <graphicPath>Things/Building/Furniture/MakeshiftHospitalBed</graphicPath>
    <graphicClass>Graphic_Multi</graphicClass>
    <graphicShaderType>CutoutComplex</graphicShaderType>
    <AltitudeLayer>Waist</AltitudeLayer>
    <statBases>
      <MaxHitPoints>150</MaxHitPoints>
      <WorkToMake>1900</WorkToMake>
      <Flammability>1.0</Flammability>
      <BedRestEffectiveness>0.95</BedRestEffectiveness>
    </statBases>
    <Size>(1,2)</Size>
    <stuffCategories>
      <li>Metallic</li>
    </stuffCategories>
    <costStuffCount>40</costStuffCount>
    <costList>
      <Steel>80</Steel>
      <HerbalMedicine>25</HerbalMedicine>
    </costList>
    <graphicOverdraw>True</graphicOverdraw>
    <building>
      <Bed_ShowSleeperBody>False</Bed_ShowSleeperBody>
      <Bed_HealTickInterval>1975</Bed_HealTickInterval>
      <bed_medicalBonusFactor>1.02</bed_medicalBonusFactor>
      <bed_defaultMedical>true</bed_defaultMedical>
    </building>
    <fillPercent>0.4</fillPercent>
    <PathCost>60</PathCost>
    <LeaveResourcesWhenKilled>True</LeaveResourcesWhenKilled>
    <StaticSunShadowHeight>0.17</StaticSunShadowHeight>
    <CastEdgeShadows>True</CastEdgeShadows>
    <DesignationCategory>Furniture</DesignationCategory>
    <Passability>PassThroughOnly</Passability>
    <DrawGUIOverlay>True</DrawGUIOverlay>
    <researchPrerequisite>HospitalBed</researchPrerequisite>
  </ThingDef>


All the textures are located in Things/Building/Furniture, and in game the default textures load properly, but setting the bed to prisoner mode results in no change. Can anyone help me figure out how to get the texture to change when the bed is set to prisoner mode?

mrofa

You cant do that in xml.
Vanilia beds dont change textures they only change color overlay, so prisoner mode get orange overlay , medical mode get blue overlay.
Did have same problem in clutter, had to code that part in. You can test it on clutter yourself its a accesible via xml so you can change textures there if thats what you want i can single out the dll for you.
All i do is clutter all around.

Mythistocles

Quoteif thats what you want i can single out the dll for you.

That would be great, thanks. So far I've only messed around with XMLs, but I've been wanting to dive into dlls.

mrofa

https://www.sendspace.com/file/0bwfmq
Thats the link to the dll

XML example
Color stuff is what you will need to add
Green-  Class="MultiTex.MultiTexThingDefs"
Is for game to use custom thingdefs in xml

Red- Custom thingclass for texture change

Yellow - you put textures path there, work the same as graphic path in terms of graphic_single or graphic_multi

<ThingDef Class="MultiTex.MultiTexThingDefs" ParentName="BuildingBase">
<defName>ClutterBedA</defName>
<Label>SlabBed</Label>
<Description>Clutter Mod Furniture:
      
Slab bed, for not so dead yet</Description>
<ThingClass>MultiTex.Beds</ThingClass>
<graphicShaderType>CutoutComplex</graphicShaderType>
<graphicPath>Clutter/Beds/SlabBed/SlabBed</graphicPath>
<graphicClass>Graphic_Multi</graphicClass>
<uiIconPath>Clutter/Beds/BedA</uiIconPath>
<AltitudeLayer>Waist</AltitudeLayer>
<statBases>
<MaxHitPoints>150</MaxHitPoints>
<Flammability>2.0</Flammability>
<Beauty>60</Beauty>
<WorkToMake>4500</WorkToMake>
<BedRestEffectiveness>1.05</BedRestEffectiveness>
<Comfort>0.85</Comfort>
</statBases>
<Size>(1,2)</Size>
<costList>
<Cloth>50</Cloth>
</costList>
<stuffCategories>
<li>Metallic</li>
<li>Woody</li>
<li>Stony</li>
</stuffCategories>
<costStuffCount>50</costStuffCount>
<building>
<Bed_ShowSleeperBody>False</Bed_ShowSleeperBody>
<Bed_HealTickInterval>2000</Bed_HealTickInterval>
</building>
<graphicOverdraw>True</graphicOverdraw>
<tickerType>Normal</tickerType>
<fillPercent>0.4</fillPercent>
<PathCost>60</PathCost>
<StaticSunShadowHeight>0.15</StaticSunShadowHeight>
<CastEdgeShadows>True</CastEdgeShadows>
<LeaveResourcesWhenKilled>True</LeaveResourcesWhenKilled>
<DesignationCategory>Furniture</DesignationCategory>
<researchPrerequisite>ComfyTech</researchPrerequisite>
<Passability>PassThroughOnly</Passability>
<DrawGUIOverlay>True</DrawGUIOverlay>
<PrisonerBedTexture>Clutter/Beds/SlabBed/SlabBedPrisoner</PrisonerBedTexture>
<MedicalBedTexture>Clutter/Beds/SlabBed/SlabBedMedical</MedicalBedTexture>
<MedicalPrisonerBedTexture>Clutter/Beds/SlabBed/SlabBedPrisonerMedical</MedicalPrisonerBedTexture>

</ThingDef>
All i do is clutter all around.