Ludeon Forums
- August 16, 2022, 06:56:14 AM
- Welcome, Guest
![]() |
I really just need someone to give me a solid explanation of how the defs and dlls interact and work with each other.
public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
{
Building_HoneyBarrel building_HoneyBarrel = (Building_HoneyBarrel)t;
Thing t2 = this.FindPollen(pawn, building_HoneyBarrel);
return new Job(JobDefOf.ArthropodFillHoneyBarrel, t, t2)
{
count = building_HoneyBarrel.SpaceLeftForPollen
};
}
public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
{
Building_HoneyBarrel building_HoneyBarrel = t as Building_HoneyBarrel;
if (building_HoneyBarrel == null || building_HoneyBarrel.Fermented || building_HoneyBarrel.SpaceLeftForPollen <= 0)
{
return false;
}
//snip
World road building event.
Once a faction got allied with you and got 100 standing for about a while.
They offer you chance to build a road between their closest city and your colony.
You need to deliver the resources, while the other faction offer the manpower.
(...)
You think you know what the stat "Plant Harvest Yield" does? Well, let me surprise you - it does NOT increase the amount you get when you harvest plants, like "Mining Yield" does for ores.
It merely gives you a chance to fail below 100%, above 100% you do not gain anything.
Hash collision between ZombieCorythosaurus and SculptureSmall: both have short hash 56905
//IncidentDef def = IncidentDefOf.RaidEnemy;
// or
//IncidentDef def = DefDatabase<IncidentDef>.GetNamed("MyDefName");
def.Worker.TryExecute();
static IEnumerable<CodeInstruction> Transpiler (IEnumerable<CodeInstruction> instructions, ILGenerator generator)
rather thanstatic IEnumerable<CodeInstruction> Transpiler (IEnumerable<CodeInstruction> instructions)
Your first code is taken from 1.0 but I am adapting a 1.0 mod for B18.
// Page_ConfigureStartingPawns
using Verse;
private void RandomizeCurPawn()
{
if (TutorSystem.AllowAction("RandomizePawn"))
{
int num = 0;
do
{
curPawn = StartingPawnUtility.RandomizeInPlace(curPawn);
num++;
}
while (num <= 20 && !StartingPawnUtility.WorkTypeRequirementsSatisfied());
TutorSystem.Notify_Event("RandomizePawn");
}
}
// Page_ConfigureStartingPawns
using Verse;
private void RandomizeCurPawn()
{
if (TutorSystem.AllowAction("RandomizePawn"))
{
do
{
curPawn = StartingPawnUtility.RandomizeInPlace(curPawn);
}
while (!RandomSettings.CheckPawnIsSatisfiedMethodInfo);
TutorSystem.Notify_Event("RandomizePawn");
}
}
foreach codeinstruction in instructions
{
if (codeinstruction == call bool Verse.StartingPawnUtility::WorkTypeRequirementsSatisfied())
{
codeinstruction.operand = null;
codeinstruction.opcode = OpCodes.Ldarg_0;
yield return codeinstruction;
yield return new CodeInstruction(OpCodes.Ldfld, curPawnFieldInfo);
yield return new CodeInstruction(OpCodes.Call, CheckPawnIsSatisfiedMethodInfo);
}
else
yield return codeinstruction;
}