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 - rubenwardy

#1
What output do you get with the following commands?

apt-cache show mono-devel
apt-cache policy mono-devel
#2
Quote from: rogerbacon on February 09, 2017, 07:47:54 PM
What is the advantage of using MonoDevlop over something like Visual Studio?

Visual Studio only supports Windows
#3
You should be able to ignore it and it will still work
#4
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/
#5
Reverting to Mono 3.12.1 worked! It no longer crashes, the pawns just keep doing the "having an accident job" forever, but I guess that's the fault of the job driver
#6
Okay, thanks. How would I set targetA to be the current player's position?

Yeah, I'm aware of caching through static variables. I wanted to get it to work first before doing so.
#7
Quote from: skullywag on July 20, 2016, 11:33:25 AM
I have always used 3.5, I have been told by others to NOT use anything other than 3.5, make of this what you will, just stating what ive been told.

Can anyone tell me how to set up 3.5 in MonoDevelop on Linux (Ubuntu based)? .NET 3.5 support has been removed since Mono 4.0.
I've tried compiling Mono 3.12.1 from source, but I get errors which lead to nothing helpful when Googled:

  CC       libmini_static_la-exceptions-amd64.lo
  CC       libmini_static_la-tramp-amd64.lo
  CC       libmini_static_la-mini-posix.lo
  CXXLD    libmini.la
ar: `u' modifier ignored since `D' is the default (see `U')
  CCLD     libmonosgen-2.0.la
ar: `u' modifier ignored since `D' is the default (see `U')
  CXXLD    libmini-static.la
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       mono_sgen-main-sgen.o
  CCLD     mono-sgen
./.libs/libmini-static.a(libmini_static_la-mini.o): In function `mono_get_jit_tls_offset':
/home/ruben/Downloads/tmp/mono-3.12.1/mono/mini/mini.c:2649: undefined reference to `mono_jit_tls'
/home/ruben/Downloads/tmp/mono-3.12.1/mono/mini/mini.c:2649: undefined reference to `mono_jit_tls'
../../mono/metadata/.libs/libmonoruntimesgen-static.a(libmonoruntimesgen_static_la-sgen-alloc.o): In function `create_allocator':
/home/ruben/Downloads/tmp/mono-3.12.1/mono/metadata/sgen-alloc.c:759: undefined reference to `tlab_next_addr'
collect2: error: ld returned 1 exit status
Makefile:1336: recipe for target 'mono-sgen' failed
make[4]: *** [mono-sgen] Error 1
make[4]: Leaving directory '/home/ruben/Downloads/tmp/mono-3.12.1/mono/mini'
Makefile:1161: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/home/ruben/Downloads/tmp/mono-3.12.1/mono/mini'
Makefile:434: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/ruben/Downloads/tmp/mono-3.12.1/mono'
Makefile:518: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/ruben/Downloads/tmp/mono-3.12.1'
Makefile:445: recipe for target 'all' failed
make: *** [all] Error 2



wget http://download.mono-project.com/sources/mono/mono-3.12.1.tar.bz2
tar -xvf mono-3.12.1.tar.bz2
./configure --prefix=/usr/local --disable-boehm

make -j3
# ^-- error in make


Here is my ./configure output: https://gist.github.com/rubenwardy/e9c95fac663b3c10d7ce032605e64da8

There's one warning there:

WARNING: Could not find libX11.so. Do you have X.org or XFree86 installed? Assuming libX11.so.6...
#8
Referencing all libraries in RimWorld/RimWorldLinux_Data/Managed/ except for mscorlib doesn't fix it. Disabling the default referencing of mscorlib, and using mscorlib.dll causes an "type forwarder for type System.Action in assembly mscorlib has circular dependency" error. This could be related to the fact that I'm using .NET 4.0, however other forum topics say that this is fine as long as I only use language features in 3.0 (and in the project settings I've set it so the language version is 3.0)
#9
Second Question / Problem

I'm unsure of the etiquette on this forum, so I'll post a second follow up question here

I'm now getting this error:

Exception in SetupToil(pawn=Kimmy, job=Accident): System.TypeLoadException: Could not load type 'System.Action' from assembly 'toilets'.
    at Verse.AI.JobDriver.SetupToils()
Verse.Log:Error(string)
Verse.AI.JobDriver:SetupToil()
Verse.AI.Pawn_JobTracker:StatJob(Job, JobCondition, ThinkNode, Boolean, Boolean, ThinkTreeDef)
Verse.AI.Pawn_JobTracker:TryFindAndStartJob()
Verse.AI.Pawn_JobTracter:EndCurrentJob(JobCondition)
...


My JobDriver is as above. This is my job giver:

using System;
using RimWorld;
using Verse;
using Verse.AI;

namespace toilets
{
public class JobGiver_Accident : ThinkNode_JobGiver
{
protected override Job TryGiveJob(Pawn pawn)
{
return new Job(DefDatabase<JobDef>.GetNamed("Accident"), null);
}
}
}


My job def:

<?xml version="1.0" encoding="utf-8" ?>
<JobDefs>
<JobDef>
<defName>Accident</defName>
<driverClass>toilets.JobDriver_Accident</driverClass>
<playerInterruptible>false</playerInterruptible>
<casualInterruptible>false</casualInterruptible>
<reportString>having an accident.</reportString>
<suspendable>false</suspendable>
</JobDef>
</JobDefs>


and my think tree defs:

<?xml version="1.0" encoding="utf-8" ?>
<ThinkTrees>
<ThinkTreeDef>
<defName>HaveAccident</defName>
<insertTag>Humanlike_PostDuty</insertTag>
<insertPriority>100</insertPriority>
<thinkRoot Class="ThinkNode_ConditionalNeedPercentageAbove">
<need>Bladder</need>
<threshold>0.01</threshold>
<invert>true</invert>
<subNodes>
<li Class="ThinkNode_Priority">
<subNodes>
<li Class="toilets.JobGiver_Accident" />
</subNodes>
</li>
</subNodes>
</thinkRoot>
</ThinkTreeDef>
</ThinkTrees>


I'm using MonoDevelop. I rebuilt the project after the update today. The build was successful, and I only get errors when the pawns should be having accidents. I also get the following error:

Kimmy started 10 jobs in one tick .....

Which I guess is self explanatory. (it fails to start the accident job, so tries the think tree again

Here is my full source code: https://github.com/rubenwardy/rimworld-toilets
#10
Quote from: 1000101 on July 19, 2016, 10:29:43 PM
Also, my Smooth Wall mod spawns a new thing (a wall, duh?) which may help you with that part.

Thank you for your help! Can you see any problems with this? If all is ok, I just need to implement my JobGiver now.

protected override IEnumerable<Toil> MakeNewToils ()
{
Toil toil = new Toil {
defaultCompleteMode = ToilCompleteMode.Never,
initAction = new Action(() =>
{
ticksLeft = 100;
}),
tickAction = new Action(() =>
{
ticksLeft--;
})
};

toil.endConditions.Add((Func<JobCondition>)(() => {
return (ticksLeft > 0) ? JobCondition.Ongoing : JobCondition.Succeeded;
}));

toil.AddFinishAction (new Action (() => {
ThingDef fecesThingDef = DefDatabase<ThingDef>.GetNamed ("FilthFeces", true);
var thing = ThingMaker.MakeThing(fecesThingDef);
if (thing != null) {
var splat = GenSpawn.Spawn(thing, TargetA.Cell);
if (splat != null) {
splat.SetFaction( Faction.OfPlayer );
}
}
}));

yield return toil;
}
#11
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?