Potted rose mod help - texture not scaling

Started by lewisd, February 23, 2014, 04:38:07 PM

Previous topic - Next topic

lewisd

Hey folks,

I'm trying my hand at rimworld modding for the first time, on build 362.  I'm trying to take the potted daylily, and make a new plant pot that contains a rose instead.  I have it mostly working, except that the texture for the rose appears at full size right away, even though the rose is only 11% (or whatever) grown.

I used the xml files from the Royal Bed mod as an example, and just copy-pasted the potted plant over, changed it's def name, and the def of the plant it grows.  I'm not sure what I'm missing, or doing wrong.

The only real difference I could find between the lily and rose definitions is that the rose has overDraw set to true, and the lily doesn't have it set.  Does anyone know what that does?

Could it have anything to do with the fact that the daylily is a DDS file, but the rose is a PNG? Does it not rescale PNGs?


<?xml version="1.0" encoding="utf-8" ?>
<Buildings>


<ThingDef Name="BuildingBase" Abstract="True">
<category>Building</category>
<bulletImpactSound>BulletImpactMetal</bulletImpactSound>
<selectable>true</selectable>
<drawerType>MapMeshAndRealTime</drawerType>
<surfaceNeeded>Light</surfaceNeeded>
<constructionEffect>ConstructMetal</constructionEffect>
<repairEffect>Repair</repairEffect>
</ThingDef>


<ThingDef ParentName="BuildingBase">
<defName>RosePot</defName>
<eType>BuildingComplex</eType>
<label>Rose plant pot</label>
<thingClass> Building_PlantGrower</thingClass>
<texturePath>Things/Building/PlantPot</texturePath>

<altitudeLayer>Waist</altitudeLayer>
<passability>Impassable</passability>
<maxHealth>100</maxHealth>
<flammability>1.0</flammability>
<description>Growers plant decorative roses here.</description>
<size>(1,1)</size>
<workToBuild>100</workToBuild>
<costList>
<li>
<thingDef>Metal</thingDef>
<count>10</count>
</li>
</costList>
<filthLeavings>
<li>
<thingDef>SlagRubble</thingDef>
<count>1</count>
</li>
</filthLeavings>
<overdraw>false</overdraw>
<plantToGrowDefName>PlantRose</plantToGrowDefName>
<fertility>1.0</fertility>
<designationCategory>Furniture</designationCategory>
<sunShadowInfo>
<basewidth>0.3</basewidth>
<baseHeight>0.3</baseHeight>
<tallness>0.6</tallness>
</sunShadowInfo>
<plantsDestroyWithMe>true</plantsDestroyWithMe>
<supportsPlants>true</supportsPlants>
<rotatable>false</rotatable>
<itemSurface>true</itemSurface>
</ThingDef>

</Buildings>

Tynan

It may just be a difference in the image in the art.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

lewisd

Well, that's what has me puzzled.  I couldn't find any images, nor any configuration in the xml, for the potted daylily to have multiple images.  Just one image.  Yet, in game, when it's first planted, it starts out small, but once it's grown, it looks bigger.  Looking at it closely, it looks to me like the "young plant" is a scaled down image of the "old plant".  Is that right?

Tynan

There are values which define the size % of the plant at minimum and maxmum growth. You can find them under <plant>, but I forgot what they were, to be honest.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

lewisd

Yeah, I saw those.  The rose has them already, set to the same values as the daylily, but it doesn't seem to be doing anything when it's in a plant pot, or when it's planted in a growing area.  The full size image shows up immediately after it's planted.  I guess that's a bug?

Tynan

I'd set them to really extreme value (0,10) and see if it makes a difference.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

ItchyFlea

OverDraw makes the game draw the texture larger than normal. Set it to false and see if that helps.
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

lewisd

Quote from: Tynan on February 23, 2014, 09:03:00 PM
I'd set them to really extreme value (0,10) and see if it makes a difference.

I think there are 2 bugs here, though I have no idea the cause of one.

Here's what I've done:
Disabled any mods, and changed both "PlantDaylily" and "PlantRose" in Mods/Core/Defs/ThingDefs/Plants.xml to have:
<visualSizeRange>
<min>0</min>
<max>10</max>
</visualSizeRange>


This is... interesting. The daylily pots I have around my colony are enormous.  The first bug is that they aren't properly centered.  They're centered fine left/right, but not up/down.  They look exactly the same when they're planted in a growing area.

The rose, however, is *always* the same size, from immediately after they're planted and are 5% growth.  They never change size.

Adding <overDraw>True</overDraw> to "PlantRose" ("PlantLily" already has it) makes the rose draw the same way the lily does, getting bigger as it grows.  So it doesn't just make it draw "larger than normal", it seems to be required for <visualSizeRange> to do anything.  It's a bit confusing.  Maybe the rose should have that set.  Mind you, I just noticed potatoes don't, and they work fine!  Nothing else does, actually, just the lily.  The rose is using a png file in Mods/Core/Textures, instead of something from the unity resource bundle like everything else, so maybe that has something to do with it?

Either way, seems like a bug, if setting <visualSizeRange> is having no effect?


Tynan

Could be. I'll try to look at it tomorrow.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

lewisd

I can add this to mantis, if you think it's a valid bug.

Tynan

Tynan Sylvester - @TynanSylvester - Tynan's Blog

lewisd

Should I be retesting this on the latest build, or is it still unaddressed?  Are modding bugs being addressed for Alpha 2?

Tynan

No, Alpha 2 is locked unless some serious new issue crops up.
Tynan Sylvester - @TynanSylvester - Tynan's Blog