Looking for Help with some C# JobDriver functionality

Started by Spar10Tech, October 27, 2017, 12:23:23 PM

Previous topic - Next topic

Spar10Tech

I'm in the early stages of making a Funeral mod.  Right now I'm working with a basic crafting spot copy for a funeral spot with a job position for the leader/preacher of the funeral.  I'm going to have it work similar to maybe a marriage ceremony with spectate event for other pawns.

My question:  Is there any example or recommendations for the funeral ceremony JobDriver where at the end of the ceremony I'd like the preacher to bury the corpse at the nearest grave?

My current thoughts are the funeral event job would call the BuryCorpse job similar to the code below from the "WorkGiver_BuryCorpses" class. I'm still early in my overall design of the funeral job process and digging through RimWorld with ILSpy so any comments are welcome.

return new Job(JobDefOf.BuryCorpse, t, building_Grave)
{
count = corpse.stackCount
};



Iamkriil

You can start a job from within a class that inherits from JobDriver with the following code:


if (true) //condition here if you need one
{
    Job newJob = new Job(JobDefOf.SomeJob, Thing); //there are 6 overloads on this method
    pawn.jobs.StartJob(newJob, JobCondition.InterruptForced, null, false, true, null, null, false); //might need to play with the input parameters
}


This will start the new job immediately.