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

Topics - rubenwardy

#1
After many many hours of research, here is a repost of a blog post I made explaining how to install Monodevelop in a way that allows you to compile to .NET 3.5 http://blog.rubenwardy.com/2016/07/20/rimworld-install-monodevelop-with-dot-net-3.5/
#2
First question (now answered)

See other question in post below

Hello all! This is my first post on the forums. I've been playing this game for a year or so, but only recently felt the need to make a mod.

I've got a bladder need set up which works well. I'm trying to make a job driver which triggers after a while at being at bladder=0

Using the decompiler (MonoDevelop), I've added a jobdriver_accident class which is based on the vomit driver


using System;
using RimWorld;
using System.Collections.Generic;
using System.Diagnostics;
using Verse;
using Verse.AI;

namespace toilets
{
public class JobDriver_Accident : JobDriver
{
//
// Fields
//
private int ticksLeft;

//
// Methods
//
public override void ExposeData ()
{
base.ExposeData ();
Scribe_Values.LookValue<int> (ref this.ticksLeft, "ticksLeft", 0, false);
}


protected override IEnumerable<Toil> MakeNewToils ()
{
JobDriver_Accident.<MakeNewToils>c__Iterator3B <MakeNewToils>c__Iterator3B = new JobDriver_Accident.<MakeNewToils>c__Iterator3B ();
<MakeNewToils>c__Iterator3B.<>f__this = this;
JobDriver_Accident.<MakeNewToils>c__Iterator3B expr_0E = <MakeNewToils>c__Iterator3B;
expr_0E.$PC = -2;
return expr_0E;
}
}
}


I don't understand what that syntax in  IEnumerable<Toil> MakeNewToils () is, it looks like decompiler rubbish from the yield statements. I've tried googling it, but the only result is a stack traceback. I can't see a toil which spawns a thingdef.

<?xml version="1.0" encoding="utf-8" ?>
<ThingDefs>
<ThingDef ParentName="BaseFilth">
<defName>FilthFeces</defName>
<label>feces</label>
<statBases>
<Beauty>-40</Beauty>
<Cleanliness>-15</Cleanliness>
</statBases>
<graphicData>
<texPath>Things/Filth/Spatter</texPath>
<color>(201, 204, 143, 180)</color>
</graphicData>
<filth>
<rainWashes>true</rainWashes>
<cleaningWorkToReduceThickness>70</cleaningWorkToReduceThickness>
<canFilthAttach>true</canFilthAttach>
</filth>
</ThingDef>
</ThingDefs>


MonoDevelop doesn't support .NET 3.5, so I've had to use 4.0. My Need_Bladder.cs and ThoughtWorker_Bladder.cs work fine.

I've tried googling for spawning thingdef/filth in job drivers, and for copies of jobdriver_vomit which are unedited.

So my question is, how would I create a job like vomit which spawns that thing def? And how would I trigger it on low bladder after a while?