[A17] Miniaturisation Overloaded

Started by notfood, August 03, 2016, 09:36:22 PM

Previous topic - Next topic

subarctic_guy

It was Fortified Wall http://steamcommunity.com/sharedfiles/filedetails/?id=725727352

The mod repeats the full contents of the core buildings_structure.xml with the new item appended to the end instead of just adding the new item. I removed the stuff that's already in the core and now it seems to play nice.  :D



notfood

Ooh. What if you load Miniaturisation after that one? Should be overrided.

notfood

#62


Mod Friendly Overrides
you dug too deep

Download Beta 6

Example OverrideDef.xml

Added two more filters:
Trader: <Override.Def Filter="Trader" Category="Caravan" Tech="Outlander" Role="BulkGoods">
Race: <Override.Def Filter="Race" Race="Humanlike"> (Human, Humanlike, Animal, Mechanoid)

Added custom parser:
<inspectorTabsResolved Mode="Append" Parser="ITab">

Huge optimizations.

It's pretty much done. Maybe a few rough edges like lack of documentation and certain fields I haven't tested. This will be the last Beta if no issues come out.

Elysium

I'm considering utilising overrides for a simple mod I want to make, but to do so I assume I would need to include your assembly.  Are you okay with this if it is clear in my post that 99% of the work was done by you? Otherwise I have to direct people to this post and tell them to download this and put my def into overridedefs which seems like a bit of a turn off for most people.

notfood

It'll be included in CCL is everything goes smoothly.

Elysium

Was hoping that would be the case.

I seem to be having trouble targeting some verbs, doesn't seem to want to work no matter what kind of filter or match I use.  I suspect I am doing something wrong but I don't know what it might be.

Override:
<Defs>
    <Override.Def Filter="Match" Match="ThingDef@defName=Human">
<verbs>
<li>
<verbClass>Verb_MeleeAttack</verbClass>
<defaultCooldownTicks>100</defaultCooldownTicks>
<meleeDamageBaseAmount>1</meleeDamageBaseAmount>
<meleeDamageDef>Blunt</meleeDamageDef>
<linkedBodyPartsGroup>LeftHand</linkedBodyPartsGroup>
</li>
<li>
<verbClass>Verb_MeleeAttack</verbClass>
<defaultCooldownTicks>100</defaultCooldownTicks>
<meleeDamageBaseAmount>1</meleeDamageBaseAmount>
<meleeDamageDef>Blunt</meleeDamageDef>
<linkedBodyPartsGroup>RightHand</linkedBodyPartsGroup>
</li>
</verbs>
</Override.Def>
</Defs>


Output:
Override :: Filter is "((def Is ThingDef) && (((def.GetType().GetField("defName") != null) && HandlesType(def.GetType().GetField("defName").FieldType)) && Equals(def.GetType().GetField("defName").GetValue(def), FromString("Human", def.GetType().GetField("defName").FieldType))))"

Override :: Human :: "verbs" not found in target

Override :: Found 1 Defs


Vanilla Code:
  <ThingDef ParentName="BasePawn">
    <defName>Human</defName>
    <label>human</label>
    <description>A baseline human, mostly unmodified by gene engineering and mostly unchanged by evolutionary pressures on non-Earth planets.</description>
    <uiIconPath>Things/Pawn/Humanlike/UI/IconHuman</uiIconPath>
    <statBases>
      <MarketValue>1750</MarketValue>
      <MoveSpeed>4.61</MoveSpeed>
      <Flammability>1.0</Flammability>
      <ComfyTemperatureMin>12</ComfyTemperatureMin>
      <ComfyTemperatureMax>32</ComfyTemperatureMax>
      <LeatherAmount>20</LeatherAmount>
    </statBases>
    <verbs>
      <li>
        <verbClass>Verb_MeleeAttack</verbClass>
        <defaultCooldownTicks>100</defaultCooldownTicks>
        <meleeDamageBaseAmount>7</meleeDamageBaseAmount>
        <meleeDamageDef>Blunt</meleeDamageDef>
        <linkedBodyPartsGroup>LeftHand</linkedBodyPartsGroup>
      </li>
      <li>
        <verbClass>Verb_MeleeAttack</verbClass>
        <defaultCooldownTicks>100</defaultCooldownTicks>
        <meleeDamageBaseAmount>7</meleeDamageBaseAmount>
        <meleeDamageDef>Blunt</meleeDamageDef>
        <linkedBodyPartsGroup>RightHand</linkedBodyPartsGroup>
      </li>
    </verbs>
    <race>
      <thinkTreeMain>Humanlike</thinkTreeMain>
      <thinkTreeConstant>HumanlikeConstant</thinkTreeConstant>
      <intelligence>Humanlike</intelligence>
      <makesFootprints>true</makesFootprints>
      <lifeExpectancy>80</lifeExpectancy>
      <leatherColor>(211,194,143)</leatherColor>
      <leatherCommonalityFactor>0.01</leatherCommonalityFactor>
      <leatherInsulation>0.70</leatherInsulation>
      <leatherMarketValue>15</leatherMarketValue>
      <nameCategory>HumanStandard</nameCategory>
      <body>Human</body>
      <baseBodySize>1</baseBodySize>
      <baseHealthScale>1</baseHealthScale>
      <foodType>OmnivoreHuman</foodType>
      <gestationPeriodDays>45</gestationPeriodDays>
      <litterSizeCurve>
        <points>
          <li>(0.5, 0)</li>
          <li>(1, 1)</li>
          <li>(1.01, 0.02)</li>
          <li>(3.5, 0)</li>
        </points>
      </litterSizeCurve>
      <lifeStageAges>
        <li>
          <def>HumanlikeBaby</def>
          <minAge>0</minAge>
        </li>
        <li>
          <def>HumanlikeToddler</def>
          <minAge>1.2</minAge>
        </li>
        <li>
          <def>HumanlikeChild</def>
          <minAge>4</minAge>
        </li>
        <li>
          <def>HumanlikeTeenager</def>
          <minAge>13</minAge>
        </li>
        <li>
          <def>HumanlikeAdult</def>
          <minAge>18</minAge>
        </li>
      </lifeStageAges>
      <soundMeleeHitPawn>Pawn_Melee_Punch_HitPawn</soundMeleeHitPawn>
      <soundMeleeHitBuilding>Pawn_Melee_Punch_HitBuilding</soundMeleeHitBuilding>
      <soundMeleeMiss>Pawn_Melee_Punch_Miss</soundMeleeMiss>
      <specialshadowData>
        <volume>(0.3, 0.8, 0.4)</volume>
        <offset>(0,0,-0.3)</offset>
      </specialshadowData>
      <ageGenerationCurve>
        <points>
          <li>(14,0)</li>
          <li>(16,100)</li>
          <li>(50,100)</li>
          <li>(60,30)</li>
          <li>(70,18)</li>
          <li>(80,10)</li>
          <li>(90,3)</li>
          <li>(100,0)</li>
        </points>
      </ageGenerationCurve>
      <hediffGiverSets>
        <li>OrganicStandard</li>
      </hediffGiverSets>
    </race>
    <recipes>
      <li>InstallPowerClaw</li>
      <li>InstallScytherBlade</li>
      <li>InstallBionicEye</li>
      <li>InstallBionicArm</li>
      <li>InstallBionicLeg</li>
      <li>InstallSimpleProstheticArm</li>
      <li>InstallSimpleProstheticLeg</li>
      <li>InstallPegLeg</li>
      <li>InstallDenture</li>
      <li>InstallJoywire</li>
      <li>InstallPainstopper</li>
      <li>InstallNaturalHeart</li>
      <li>InstallNaturalLung</li>
      <li>InstallNaturalKidney</li>
      <li>InstallNaturalLiver</li>
      <li>ExciseCarcinoma</li>
      <li>RemoveBodyPart</li>
      <li>Euthanize</li>
    </recipes>
  </ThingDef>

notfood

#66
Oh, interesting. verbs is private. It's the only private of the bunch.

The attached should fix it.

Elysium

Great! That fixed it, thanks!  One more question, should I be using clear mode in this instance?

notfood

Use default mode. It actually needs a replacer so it doesn't toss a duplicate warning but there is no replacer for verbs yet.

You can write a custom one if you feel daring. I'll do it later.

subarctic_guy

Quote from: notfood on August 16, 2016, 05:57:38 AM
Ooh. What if you load Miniaturisation after that one? Should be overrided.

I did try that and it didn't have any noticeable effect.

notfood



Mod Friendly Overrides
you dug too deep

Download Beta 7

Example OverrideDef.xml

NameFilter accepts Type attribute.
<Override.Def Type="ThingDef" Target="Human">

Added Comparer for verbs:
<verbs Mode="Replace">

Release?

[attachment deleted by admin - too old]

Elysium

Nice job, can't wait till this gets into CCL so modders can start to use it.

Devecseri

Just wanna throw out a little warning to people that may get the idea of adding Ancient Cryptosleep Caskets to their miniaturisation list; it will most likely corrupt your save, which I managed to fix luckily. I had already opened the newly found caskets before uninstalling them, but after putting it in my base to store prisoners for harvesting purposes I noticed that when you open it you'll get a copy of the miniaturised casket. I didn't think much of it other than having a little laugh, but after restarting the game the save wouldn't load. After taking a little look in the error log and save file, I found the problem. Basically, one of the caskets kept on copying itself so a good 10% of the save file was filled with nested entries for it. I fixed the save by removing all those entries, but it was still pretty hilarious. Not sure if there's a way to make them work, but I wouldn't recommend messing with it for now.

Maybe you can try it for debugging purposes, notfood? I have no clue if it's the mods fault or just how containers are coded, I haven't updated to the latest version of the mod yet so idk if that'd help. Other than that, this mod owns! :)

Elysium

Would have never thought to try it on those, but I could see someone potentially doing the same thing with graves or sarcophagus.  I would assume those might have the same issues but I'm not sure.  May need to add a safeguard or a warning on the post/about if this is not something that can be fixed easily.

notfood

Does it only happen with containers?