hack around removed traits

721156233a/1.5/Source/DefOf/VanillaTraitDefOf.cs
This commit is contained in:
Lorolas 2024-04-13 19:45:24 +02:00
parent aaa7e8897a
commit f31db7f526
3 changed files with 31 additions and 6 deletions

View file

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using RimWorld; using RimWorld;
using Verse; using Verse;
using static RimWorld.TraitDefOf; using static rjw.VanillaTraitDefOf;
namespace RJW_PlasticSurgeries namespace RJW_PlasticSurgeries
{ {
@ -11,10 +11,9 @@ namespace RJW_PlasticSurgeries
/// <inheritdoc /> /// <inheritdoc />
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
{ {
/* if (!pawn.story.traits.HasTrait(Beauty) || if (!pawn.story.traits.HasTrait(Beauty) ||
pawn.story.traits.HasTrait(Beauty) && pawn.story.traits.GetTrait(Beauty).Degree < 2) pawn.story.traits.HasTrait(Beauty) && pawn.story.traits.GetTrait(Beauty).Degree < 2)
yield return pawn.RaceProps.body.corePart; */ yield return pawn.RaceProps.body.corePart;
return new HashSet<BodyPartRecord>();
} }
/// <inheritdoc /> /// <inheritdoc />
@ -42,14 +41,14 @@ namespace RJW_PlasticSurgeries
/// <param name="severity">the new severity of the pawn's Beautiful trait</param> /// <param name="severity">the new severity of the pawn's Beautiful trait</param>
protected void SurgeryX(Pawn pawn, int severity) protected void SurgeryX(Pawn pawn, int severity)
{ {
/* if (pawn.story.traits.HasTrait(Beauty)) if (pawn.story.traits.HasTrait(Beauty))
{ {
pawn.story.traits.allTraits.FindAll(t => Beauty.ConflictsWith(t)) pawn.story.traits.allTraits.FindAll(t => Beauty.ConflictsWith(t))
.ForEach(t => pawn.story.traits.RemoveTrait(t)); .ForEach(t => pawn.story.traits.RemoveTrait(t));
pawn.story.traits.RemoveTrait(pawn.story.traits.allTraits.Find(t => t.def == Beauty)); pawn.story.traits.RemoveTrait(pawn.story.traits.allTraits.Find(t => t.def == Beauty));
} }
pawn.story.traits.GainTrait(new Trait(Beauty, severity)); */ pawn.story.traits.GainTrait(new Trait(Beauty, severity));
} }
} }

View file

@ -0,0 +1,26 @@
using Verse;
using RimWorld;
namespace rjw
{
[DefOf]
public static class VanillaTraitDefOf
{
public static TraitDef Tough;
public static TraitDef Nerves;
public static TraitDef Beauty;
public static TraitDef TooSmart;
public static TraitDef NaturalMood;
public static TraitDef Cannibal;
static VanillaTraitDefOf()
{
DefOfHelper.EnsureInitializedInCtor(typeof(VanillaTraitDefOf));
}
}
}