diff --git a/CRIALactation/1.3/Assemblies/CRIALactation.dll b/CRIALactation/1.3/Assemblies/CRIALactation.dll index f4949f2..98c9b45 100644 Binary files a/CRIALactation/1.3/Assemblies/CRIALactation.dll and b/CRIALactation/1.3/Assemblies/CRIALactation.dll differ diff --git a/CRIALactation/CRIALactation.csproj b/CRIALactation/CRIALactation.csproj index f5b60bd..33c99f3 100644 --- a/CRIALactation/CRIALactation.csproj +++ b/CRIALactation/CRIALactation.csproj @@ -70,10 +70,13 @@ + + + diff --git a/CRIALactation/Defs/PreceptDefs/Precepts_Lactating.xml b/CRIALactation/Defs/PreceptDefs/Precepts_Lactating.xml index 46ba1fc..104a631 100644 --- a/CRIALactation/Defs/PreceptDefs/Precepts_Lactating.xml +++ b/CRIALactation/Defs/PreceptDefs/Precepts_Lactating.xml @@ -4,28 +4,29 @@ - Lactation - + Lactating + UI/Issues/MeatEating Lactating_Essential - Lactation + Lactating - Milk from breasts is healthy and delicious. It should be produced and consumed by everyone on a regular basis. + High + Milk from breasts is creamy and delicious. It should be produced and consumed on a regular basis. -
  • Lactating_Essential - Pawns with sizeable breasts should be producing milk + Sizeable breasts must produce milk + true +
  • +
  • + Lactating_Essential_Social
  • - -
    - Lactating_Essential Thought_Situational @@ -33,15 +34,55 @@
  • - Expressing milk for my friends and family fills me with maternal pride. - 7 + Expressing milk for fills me with maternal pride. + 6
  • +
  • - I'm as useless as a dry well. - -12 + We live in such difficult times. Producing milk is a pipe dream, but it would be nice. + -6 +
  • + +
  • + + I'm as useless as a dry well. A healthy supply of my milk is expected, but I'm failing to deliver. + -9 +
  • + +
  • + + Producing milk is a basic duty for someone like me. I'm embarrassed and ashamed to be dry. + -16
  • + + + + Lactating_Essential_Social + Thought_SituationalSocial + CRIALactation.ThoughtWorker_Precept_Lactating_Essential_Social + +
  • + + 15 +
  • +
  • + + -5 +
  • +
  • + + -20 +
  • +
  • + + -40 +
  • + +
    +
    + diff --git a/CRIALactation/Source/HarmonyPatches/HarmonyPatch_Ideo.cs b/CRIALactation/Source/HarmonyPatches/HarmonyPatch_Ideo.cs new file mode 100644 index 0000000..c06240b --- /dev/null +++ b/CRIALactation/Source/HarmonyPatches/HarmonyPatch_Ideo.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using RimWorld; +using rjw; +using Milk; +using UnityEngine; +using HarmonyLib; + +namespace CRIALactation +{ + + /** //to be implemented next update + [HarmonyPatch(typeof(IdeoUtility), "Notify_MemberGenerated")] + public static class HarmonyPatch_Ideo_Notify_MemberGenerated + { + public static void Prefix() + { + + } + + }**/ +} diff --git a/CRIALactation/Source/HarmonyPatches/Harmony_PatchAll.cs b/CRIALactation/Source/HarmonyPatches/Harmony_PatchAll.cs new file mode 100644 index 0000000..6f31021 --- /dev/null +++ b/CRIALactation/Source/HarmonyPatches/Harmony_PatchAll.cs @@ -0,0 +1,23 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace C0ffeeRIA +{ + + [StaticConstructorOnStartup] + public static class Harmony_PatchAll + { + static Harmony_PatchAll() + { + Harmony harmony = new Harmony("CRIALactation"); + harmony.PatchAll(Assembly.GetExecutingAssembly()); + } + + } +} diff --git a/CRIALactation/Source/LactationUtility.cs b/CRIALactation/Source/LactationUtility.cs index acb859f..00e0246 100644 --- a/CRIALactation/Source/LactationUtility.cs +++ b/CRIALactation/Source/LactationUtility.cs @@ -1,4 +1,5 @@ using Milk; +using rjw; using System; using System.Collections.Generic; using System.Linq; @@ -20,5 +21,22 @@ namespace CRIALactation p.health.hediffSet.HasHediff(HediffDefOf_Milk.Lactating_Permanent, false) || p.health.hediffSet.HasHediff(HediffDefOf_Milk.Heavy_Lactating_Permanent, false); } + + public static bool HasMilkableBreasts(Pawn p) + { + if (Genital_Helper.has_breasts(p) && !Genital_Helper.has_male_breasts(p)) + { + return true; + } + + return false; + } + + public static void StartLactating(Pawn p, bool natural) + { + Hediff lactating = HediffMaker.MakeHediff(natural ? HediffDefOf_Milk.Lactating_Natural : HediffDefOf_Milk.Lactating_Drug, p, null); + lactating.Severity = Rand.Value; + p.health.AddHediff(lactating, Genital_Helper.get_breastsBPR(p)); + } } } diff --git a/CRIALactation/Source/PreceptDefOf/PreceptDefOf_Lactation.cs b/CRIALactation/Source/PreceptDefOf/PreceptDefOf_Lactation.cs new file mode 100644 index 0000000..53a570c --- /dev/null +++ b/CRIALactation/Source/PreceptDefOf/PreceptDefOf_Lactation.cs @@ -0,0 +1,22 @@ +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace CRIALactation +{ + [DefOf] + public static class PreceptDefOf_Lactation + { + static PreceptDefOf_Lactation() + { + DefOfHelper.EnsureInitializedInCtor(typeof(PreceptDefOf_Lactation)); + } + + public static PreceptDef Lactating_Essential; + + } +} \ No newline at end of file diff --git a/CRIALactation/Source/Precepts/Precept_Lactation.cs b/CRIALactation/Source/Precepts/Precept_Lactation.cs index b83741d..a1a4405 100644 --- a/CRIALactation/Source/Precepts/Precept_Lactation.cs +++ b/CRIALactation/Source/Precepts/Precept_Lactation.cs @@ -10,13 +10,41 @@ using UnityEngine; namespace CRIALactation { + /** //doesn't work because inheritance problems with rimworld public class Precept_Lactation : Precept { - + public override void Notify_MemberSpawned(Pawn pawn) { + Log.Message("spawning pawn with lact"); + if (!pawn.IsColonistPlayerControlled && !LactationUtility.IsLactating(pawn)) + { + LactationUtility.StartLactating(pawn, pawn.relations.ChildrenCount > 0); + } + + //spawned into map base.Notify_MemberSpawned(pawn); } + public override void Notify_MemberGenerated(Pawn pawn) + { + Log.Message("Creating pawn with lact"); + + //first created + if(pawn.IsColonistPlayerControlled && LactationUtility.HasMilkableBreasts(pawn)) + { + + if (!LactationUtility.IsLactating(pawn)) + { + LactationUtility.StartLactating(pawn, pawn.relations.ChildrenCount > 0); + Log.Message("Creating pawn with lact" + pawn.Name); + } + } + + base.Notify_MemberGenerated(pawn); + } + + } + **/ } diff --git a/CRIALactation/Source/Thoughts/ThoughtWorker_Precept_Lactating_Essential.cs b/CRIALactation/Source/Thoughts/ThoughtWorker_Precept_Lactating_Essential.cs index 801e8bf..8b7468c 100644 --- a/CRIALactation/Source/Thoughts/ThoughtWorker_Precept_Lactating_Essential.cs +++ b/CRIALactation/Source/Thoughts/ThoughtWorker_Precept_Lactating_Essential.cs @@ -15,13 +15,16 @@ namespace CRIALactation protected override ThoughtState ShouldHaveThought(Pawn p) { + + if (!p.IsColonistPlayerControlled) return false; + if (ThoughtUtility.ThoughtNullified(p, this.def)) { return false; } - if (!Genital_Helper.has_breasts(p) || Genital_Helper.has_male_breasts(p)) + if(!LactationUtility.HasMilkableBreasts(p)) { return false; } @@ -31,8 +34,18 @@ namespace CRIALactation return ThoughtState.ActiveAtStage(0); } - return ThoughtState.ActiveAtStage(1); - + if(ExpectationsUtility.CurrentExpectationFor(p).order <= ExpectationDefOf.VeryLow.order) + { + return ThoughtState.ActiveAtStage(1); + } + else if(ExpectationsUtility.CurrentExpectationFor(p).order <= ExpectationDefOf.Moderate.order) + { + return ThoughtState.ActiveAtStage(2); + } + else + { + return ThoughtState.ActiveAtStage(3); + } } } } diff --git a/CRIALactation/Source/Thoughts/ThoughtWorker_Precept_Lactating_Essential_Social.cs b/CRIALactation/Source/Thoughts/ThoughtWorker_Precept_Lactating_Essential_Social.cs new file mode 100644 index 0000000..b389919 --- /dev/null +++ b/CRIALactation/Source/Thoughts/ThoughtWorker_Precept_Lactating_Essential_Social.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using RimWorld; +using rjw; +using Milk; +using UnityEngine; + +namespace CRIALactation +{ + public class ThoughtWorker_Precept_Lactating_Essential_Social : ThoughtWorker_Precept_Social + { + protected override ThoughtState ShouldHaveThought(Pawn p, Pawn otherPawn) + { + + if(LactationUtility.HasMilkableBreasts(otherPawn) && !LactationUtility.IsLactating(otherPawn)) + { + + return ThoughtState.ActiveAtStage(0); + + } + + if (ExpectationsUtility.CurrentExpectationFor(p).order <= ExpectationDefOf.VeryLow.order) + { + return ThoughtState.ActiveAtStage(1); + } + else if (ExpectationsUtility.CurrentExpectationFor(p).order <= ExpectationDefOf.Moderate.order) + { + return ThoughtState.ActiveAtStage(2); + } + else + { + return ThoughtState.ActiveAtStage(3); + } + + } + + } +}