Where do i find the XMLs on the caravan system? i want to speed up caravans.

Started by Mitz, January 09, 2017, 03:22:09 PM

Previous topic - Next topic

Mitz

I already started one part of my megamod, the animal part, but now i want to know where i can find the defs for the caravan speed.
It's sad autism's an insult, then i must be an insult.
and my cat also must be an insult, as well as every other cat in the universe.
space cats.

RawCode

dnspy
extract assembly-csharp.dll into any folder
notepad++
use search in files routine (see on screen 1)
keywords are caravan (speed is too broad keyword to search) and nothing more
result is 2255 hits in 157 files
well, read EACH one, it will take time

// Token: 0x02000467 RID: 1127
[StaticConstructorOnStartup]
public class Caravan : WorldObject, IIncidentTarget, ITrader, ILoadReferenceable


Caravan is object (wow, we hit proper keyword at first attempt!)

public int TicksPerMove
{
get
{
float num = 0f;
if (this.pawns.Count > 0)
{
for (int i = 0; i < this.pawns.Count; i++)
{
num += (float)this.pawns[i].TicksPerMoveCardinal / (float)this.pawns.Count;
}
num *= 170f;
}
else
{
Log.ErrorOnce("Caravan " + this + " has no pawns.", 983746153);
num = 100f;
}
return Mathf.Max(Mathf.RoundToInt(num), 1);
}
}

ticks per move is reverse speed

TicksPerMoveCardinal is our second keyword.

TicksPerMove is our third keyword, that lead to

private int TicksPerMove(bool diagonal)
{
float num = this.GetStatValue(StatDefOf.MoveSpeed, true);
if (base.Spawned && this.HostFaction != null && !PrisonBreakUtility.IsPrisonBreaking(this))
{
num *= 0.35f;
}
if (this.carryTracker != null && this.carryTracker.CarriedThing != null && this.carryTracker.CarriedThing.def.category == ThingCategory.Pawn)
{
num *= 0.6f;
}
float num2 = num / 60f;
float num3 = 1f / num2;
if (base.Spawned && !base.Map.roofGrid.Roofed(base.Position))
{
num3 /= base.Map.weatherManager.CurMoveSpeedMultiplier;
}
if (diagonal)
{
num3 *= 1.41421f;
}
int value = Mathf.RoundToInt(num3);
return Mathf.Clamp(value, 1, 450);
}


result is
// Token: 0x04001771 RID: 6001
public static StatDef MoveSpeed;

that obviously attribute of pawntype.

conclusion: there is no caravan system XML you need code injection to make caravan faster without making pawns faster.
in addition, you may have ultra uber fast pawntype that can be added to caravan and alter it's average speed, still, you will need custom code to alter caravan assembly.

[attachment deleted by admin due to age]