In the first patch you mispelled the def name durign the declaration:
[defname = "SmokeleafJoint"]
instead of
[defName = "SmokeleafJoint"]
[defname = "SmokeleafJoint"]
instead of
[defName = "SmokeleafJoint"]
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 MenuQuoteIf you can define the ThingClass for the workbench, you can make a derived class that does something like this:
Quotethen adding a Harmony Postfix() should work:
using System;
using RimWorld;
using Verse;
namespace WAMH_Code
{
// Token: 0x02000005 RID: 5
public class ThoughtWorker_WAMH2 : ThoughtWorker
{
// Token: 0x06000005 RID: 5 RVA: 0x00002538 File Offset: 0x00001538
protected override ThoughtState CurrentStateInternal(Pawn p)
{
bool flag = p.story.traits.HasTrait(TraitDef.Named("Cannibal"));
ThoughtState result;
if (flag)
{
result = false;
}
else
{
bool flag2 = p.story.traits.HasTrait(TraitDef.Named("Kind"));
if (flag2)
{
result = false;
}
else
{
bool flag3 = p.story.traits.HasTrait(TraitDef.Named("BleedingHeart"));
if (flag3)
{
result = false;
}
else
{
bool flag4 = p.story.traits.HasTrait(TraitDef.Named("Psychopath"));
if (flag4)
{
result = true;
}
else
{
bool flag5 = !p.story.childhood.DisallowsTrait(TraitDef.Named("Cannibal"), 0) && (p.story.adulthood == null || !p.story.adulthood.DisallowsTrait(TraitDef.Named("Cannibal"), 0));
if (flag5)
{
float num = 1E-05f;
int level = p.skills.GetSkill(SkillDefOf.Social).Level;
num -= (float)level * 5E-07f;
bool starving = p.needs.food.Starving;
int num2 = 0;
bool flag6 = starving;
if (flag6)
{
num2 += 2;
}
bool flag7 = !starving;
if (flag7)
{
num2 += 10;
}
float statValue = StatExtension.GetStatValue(p, StatDefOf.MentalBreakThreshold, true);
bool flag8 = (float)num2 < statValue;
if (flag8)
{
num += 1E-05f;
}
else
{
bool flag9 = (float)num2 < statValue + 0.05f;
if (flag9)
{
num += 5E-06f;
}
else
{
bool flag10 = (float)num2 < 0.35f;
if (flag10)
{
num += 2.5E-06f;
}
else
{
bool flag11 = (float)num2 >= 0.65f;
if (flag11)
{
bool flag12 = (float)num2 < 0.9f;
if (flag12)
{
num -= 5E-06f;
}
else
{
num -= 1E-05f;
}
}
}
}
}
bool flag13 = p.story.traits.HasTrait(TraitDef.Named("Abrasive"));
if (flag13)
{
num += 2.5E-06f;
}
bool flag14 = p.story.traits.HasTrait(TraitDef.Named("Bloodlust"));
if (flag14)
{
num += 5E-06f;
}
bool flag15 = Rand.Value < num;
if (flag15)
{
string text = GenText.CapitalizeFirst(p.Name.ToStringShort) + Translator.Translate("WAMH.NewCannibal.Text");
Find.LetterStack.ReceiveLetter(Translator.Translate("WAMH.NewCannibal.Label"), text, LetterDefOf.NeutralEvent, p, null);
p.story.traits.GainTrait(new Trait(TraitDef.Named("Cannibal"), 0, true));
}
}
result = false;
}
}
}
}
return result;
}
}
}