Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - K4nna

#1
Help / Re: xpath syntax for multiple selection
May 26, 2022, 12:44:16 AM
So I used the good syntax, but it doesn't work as I think with the abstract thing and inheritance.
Even the costList I can't do it works...

<xpath>Defs/ThingDef[minifiedDef="MinifiedThing" and (not(comps/li/compClass="CompQuality")) and (not(@Abstract="True")) and (not(thingCategories="BuildingsSecurity")) and costList]</xpath>
Doesn't work   (I tried with only Abstract, or only costList...)

<xpath>Defs/ThingDef[minifiedDef="MinifiedThing" and (not(comps/li/compClass="CompQuality")) and (not(@Name="FurnitureBase")) and (not(thingCategories="BuildingsSecurity")) and (not(@ParentName="BuildingNaturalBase")) and (not(defName="AnimusStone")) and (not(defName="MonumentMarker"))]</xpath>
Works as I want (with additional patch for the 'drape')
#2
Help / Re: xpath syntax for multiple selection
May 25, 2022, 12:59:07 PM
I will try it tomorrow, but it's weird, I'm sure that I tried (not(@Abstract="True")).
For costList, I'm not sure if I copied/paste from file or not.

With that I can already do my patch with full compatibility with buildings from mods I think.
If I look for <minifiedDef>MinifiedThing</minifiedDef>, it's because the mod I patch looks for buildings this way (via C#).

Thank you again, I will look about discord another time.
#3
Help / Re: xpath syntax for multiple selection
May 24, 2022, 05:09:43 AM
So, (not(Abstract="True")) doesn't work. I have almost the same result by using (not(@Name="FurnitureBase")) (only the 'drape' is not patched, without mods). But it could be good to know the syntax for filter Abstract.

Edit: I also search to add a condition 'don't have <CostList>', (not(CostList)) doesn't work :/
#4
Help / Re: xpath syntax for multiple selection
May 24, 2022, 03:53:53 AM
Thank you, the syntax is good.
But it doesn't works as intended, I think I have to filter by 'Abstract="True"'
#5
Help / Use <weight> with <statFactors> ?
May 24, 2022, 02:30:54 AM
Hi,

I have a patch like that:
<li Class="PatchOperationAdd">
<xpath>/Defs/StatDef[defName="PruningSpeed" or defName="MeditationFocusGain"]</xpath>
  <value>
    <statFactors>
      <li>PsychicSensitivity</li>
    </statFactors>
  </value>
</li>


The effect is a bit too strong, I want to reduce the weight of the statFactors, in the same way it's done for <capacityFactors>. But nothing working, I can't find a good syntax, and that is never done in the game files, so maybe I just can't do that.

Any idea please?
#6
Help / xpath syntax for multiple selection
May 23, 2022, 11:37:32 PM
Hi,

How is the correct syntax for my xpath please?

<xpath>/Defs/ThingDef[ ??? ]</xpath>

I want to select all ThingDef who have <minifiedDef>MinifiedThing</minifiedDef>, but who don't have <compClass>CompQuality</compClass> (select all the minifiable buildings who don't have quality).

I tried various things without find the good one :/


Also, can I use PatchOperation to add a new node who use the same value of another node? (add <WorkToMake> with the same value of <WorkToBuild>). I think no, but maybe...?
#7
Help / Make psychite tea - CanGiveJob and JobOnX
April 07, 2022, 05:42:03 AM
Hello,

I make a little mod who adds campfires, and in last checking I found a bug who seems to affect all modded campfires/stoves.
It happens only when the first job at the modded campfire/stove is Make psychite tea (or the x4), the pawn will skip the job the first time, then all seems to works fine all the long for this savegame.
(If a pawn cook something else first at the campfire/stove, then psychite tea, no error happens)

The error is:
RimWorld.WorkGiver_DoBill provided target Thing_Darkcampfire24049 but yielded no actual job for pawn Dacato. The CanGiveJob and JobOnX methods may not be synchronized.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Verse.Log:Error (string)
Verse.Log:ErrorOnce (string,int)
RimWorld.JobGiver_Work:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.ThinkNode_PrioritySorter:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.ThinkNode_Tagger:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.ThinkNode_Subtree:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.ThinkNode_Conditional:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.Pawn_JobTracker:DetermineNextJob (Verse.ThinkTreeDef&)
Verse.AI.Pawn_JobTracker:TryFindAndStartJob ()
(wrapper dynamic-method) Verse.AI.Pawn_JobTracker:Verse.AI.Pawn_JobTracker.EndCurrentJob_Patch1 (Verse.AI.Pawn_JobTracker,Verse.AI.JobCondition,bool,bool)
Verse.AI.Pawn_JobTracker:JobTrackerTick ()
(wrapper dynamic-method) Verse.Pawn:Verse.Pawn.Tick_Patch2 (Verse.Pawn)
(wrapper dynamic-method) Verse.TickList:Verse.TickList.Tick_Patch2 (Verse.TickList)
(wrapper dynamic-method) Verse.TickManager:Verse.TickManager.DoSingleTick_Patch2 (Verse.TickManager)
Verse.TickManager:TickManagerUpdate ()
Verse.Game:UpdatePlay ()
Verse.Root_Play:Update ()


I patched all the same things I can see for campfire in xml files, I don't see what I can do more. I checked others mods and nothing special is done (and the same issue happens).

Can I safely ignore this bug? (very situational)

Thank you for reading.
#8
Thanks, so by looking again and searching age, I found that I took a bad way. What I search for is in PawnGenerator.
So by following the things, I have PawnGenerator.GenerateRandomAge(pawn, request); who sent me here:

private static void GenerateRandomAge(Pawn pawn, PawnGenerationRequest request)
{
if (request.FixedBiologicalAge != null && request.FixedChronologicalAge != null)
{
float? fixedBiologicalAge = request.FixedBiologicalAge;
float? fixedChronologicalAge = request.FixedChronologicalAge;
if (fixedBiologicalAge.GetValueOrDefault() > fixedChronologicalAge.GetValueOrDefault() & (fixedBiologicalAge != null & fixedChronologicalAge != null))
{
Log.Warning(string.Concat(new object[]
{
"Tried to generate age for pawn ",
pawn,
", but pawn generation request demands biological age (",
request.FixedBiologicalAge,
") to be greater than chronological age (",
request.FixedChronologicalAge,
")."
}));
}
}
if (request.Newborn)
{
pawn.ageTracker.AgeBiologicalTicks = 0L;
}
else if (request.FixedBiologicalAge != null)
{
pawn.ageTracker.AgeBiologicalTicks = (long)(request.FixedBiologicalAge.Value * 3600000f);
}
else
{
int num = 0;
float num2;
for (;;)
{
if (pawn.RaceProps.ageGenerationCurve != null)
{
num2 = (float)Mathf.RoundToInt(Rand.ByCurve(pawn.RaceProps.ageGenerationCurve));
}
else if (pawn.RaceProps.IsMechanoid)
{
num2 = Rand.Range(0f, 2500f);
}
else
{
num2 = Rand.ByCurve(PawnGenerator.DefaultAgeGenerationCurve) * pawn.RaceProps.lifeExpectancy;
}
num++;
if (num > 300)
{
break;
}
if (num2 <= (float)pawn.kindDef.maxGenerationAge && num2 >= (float)pawn.kindDef.minGenerationAge)
{
goto IL_1A4;
}
}
Log.Error("Tried 300 times to generate age for " + pawn);
IL_1A4:
pawn.ageTracker.AgeBiologicalTicks = (long)(num2 * 3600000f) + (long)Rand.Range(0, 3600000);
}


This thing generate age for all pawns, not only animal. And, it's maths... I'm not sure which part make animals always spawn adult, maybe (float)pawn.kindDef.minGenerationAge, but I only find it in PawnKindDef like this: public int minGenerationAge; , nothing more :s

If I could try it easily, I would try to quit the loop this way:

if (num2 <= (float)pawn.kindDef.maxGenerationAge && num2 > 0)

But I would have to make this exit only for animals.

Or I could define minGenerationAge with XML?

_____________________________
_____________________________

Awesome! I can do my mod only by using XML now that I understood how it's works :D
Without your answer I would have give up or tried in C# then Give up ^^'

So I only have to define minGenerationAge and ageGenerationCurve for animals that I want to meet younger, and it's works!
#9
Hello,
I want to be able to meet baby and juvenile wild animals when I enter on a new map, or as animals entering on my map.
As I found no mod for that, I want to see if I can do it.
First, I found it seems I can't do it with only xml, my last hint from xml is GenStep_Animals.

Even if I don't know C#, I search to understand how wild animal generation works, to see if I would be able to patch it if I learn to mod with C#.
So I opened files with dnSpy, found WildAnimalSpawner, saw they seems to be spawn with:

GenSpawn.Spawn(PawnGenerator.GeneratePawn(pawnKindDef, null), loc2, this.map, WipeMode.Vanish);

who send me to PawnGenerationRequest who give me:

public PawnGenerationRequest(PawnKindDef kind, Faction faction = null, PawnGenerationContext context = PawnGenerationContext.NonPlayer, int tile = -1, bool forceGenerateNewPawn = false, bool newborn = false, bool allowDead = false, bool allowDowned = false, bool canGeneratePawnRelations = true, bool mustBeCapableOfViolence = false, float colonistRelationChanceFactor = 1f, bool forceAddFreeWarmLayerIfNeeded = false, bool allowGay = true, bool allowFood = true, bool allowAddictions = true, bool inhabitant = false, bool certainlyBeenInCryptosleep = false, bool forceRedressWorldPawnIfFormerColonist = false, bool worldPawnFactionDoesntMatter = false, float biocodeWeaponChance = 0f, float biocodeApparelChance = 0f, Pawn extraPawnForExtraRelationChance = null, float relationWithExtraPawnChanceFactor = 1f, Predicate<Pawn> validatorPreGear = null, Predicate<Pawn> validatorPostGear = null, IEnumerable<TraitDef> forcedTraits = null, IEnumerable<TraitDef> prohibitedTraits = null, float? minChanceToRedressWorldPawn = null, float? fixedBiologicalAge = null, float? fixedChronologicalAge = null, Gender? fixedGender = null, float? fixedMelanin = null, string fixedLastName = null, string fixedBirthName = null, RoyalTitleDef fixedTitle = null, Ideo fixedIdeo = null, bool forceNoIdeo = false, bool forceNoBackstory = false, bool forbidAnyTitle = false)

Here I see newborn, who could make spawn as a newborn baby, not really what I want, and fixedBiologicalAge = null, but I don't think it's what I search for.
So I reach a dead end without find why wild animals always spawn as adult.
I don't search in the right place? any idea please?
#10
Bugs / [1.3.3102] Slab bed, Flammability missing
August 29, 2021, 05:15:44 AM
Hello,

The Wooden slab bed can't burn, same for Metallic and for Slab double bed.

By looking xml files, we found from where the issue come:
<statBases Inherit="False">
      <MaxHitPoints>140</MaxHitPoints>
      <WorkToBuild>400</WorkToBuild>
      <Mass>30</Mass>
      <BedRestEffectiveness>1</BedRestEffectiveness>
      <ImmunityGainSpeedFactor>1.07</ImmunityGainSpeedFactor>
      <SurgerySuccessChanceFactor>1</SurgerySuccessChanceFactor>
    </statBases>

Inherit="False" without <Flammability>1.0</Flammability>, so of course it can't burn.

My guess is that Slab bed was thought to be made only from stone, then woody/metallic was added but flammability forgotten.
#11
Ideas / Auto-release to wild
August 11, 2021, 06:23:15 AM
Hello,

It could be nice to be able to toggle the auto-slaughter into a auto-release to wild, for 'killing innocent animals' precept.
#12
Bugs / [1.3.3080] animal bed, missing owner name
August 10, 2021, 04:53:45 AM
Hello,
With 1.3, you forgot to add <drawGUIOverlay>true</drawGUIOverlay> for the AnimalBed, as you did for AnimalSleepingSpot and AnimalSleepingBox.


Also, the bed owner name for animal beds should match with the Show animal names(None, Tame (named only), Tame (all)) setting, as it make no sense to choose to don't show animal names but to have to see all bed owner name in the barn (and it's hideous).
#13
Help / Re: Using <expandHomeArea> with a TerrainDef?
October 21, 2020, 06:24:03 AM
Oh, I hadn't paid attention. You are right, I don't need it... Thanks ^^'
#14
Hi,
For buildings, we can use <building><expandHomeArea>false</expandHomeArea></building>.
I would like to do the same for flooring, but I don't know how.
I can't only copy/paste, <building> is not for TerrainDef, and I don't know where to put <expandHomeArea>false</expandHomeArea>...

An idea please?
#15
Quote from: Kopp on October 14, 2020, 07:55:28 AMAnyway... Did you try:
<li Class="PatchOperationAdd">
            <xpath>/Defs/TerrainDef[defName = "WaterShallow"]</xpath>
            <value>
               <affordances>
                  <li>MyCustomAffordance</li>
               </affordances>
            </value>
         </li>
This one doesn't works too.

But the @ was the solution, thank you! :)
My bad, I didn't read the full tutorial page, it's written in "Random stuff".