From 5752647b4fede09cd0f633d7e4362cb5fff4faed Mon Sep 17 00:00:00 2001 From: c0ffee12 Date: Mon, 26 Jul 2021 08:19:49 -0700 Subject: [PATCH] lactation precepts --- .../1.3/Assemblies/CRIALactation.dll | Bin 5120 -> 6144 bytes CRIALactation/CRIALactation.csproj | 3 + .../Defs/PreceptDefs/Precepts_Lactating.xml | 67 ++++++++++++++---- .../HarmonyPatches/HarmonyPatch_Ideo.cs | 25 +++++++ .../Source/HarmonyPatches/Harmony_PatchAll.cs | 23 ++++++ CRIALactation/Source/LactationUtility.cs | 18 +++++ .../PreceptDefOf/PreceptDefOf_Lactation.cs | 22 ++++++ .../Source/Precepts/Precept_Lactation.cs | 30 +++++++- ...oughtWorker_Precept_Lactating_Essential.cs | 19 ++++- ...rker_Precept_Lactating_Essential_Social.cs | 41 +++++++++++ 10 files changed, 231 insertions(+), 17 deletions(-) create mode 100644 CRIALactation/Source/HarmonyPatches/HarmonyPatch_Ideo.cs create mode 100644 CRIALactation/Source/HarmonyPatches/Harmony_PatchAll.cs create mode 100644 CRIALactation/Source/PreceptDefOf/PreceptDefOf_Lactation.cs create mode 100644 CRIALactation/Source/Thoughts/ThoughtWorker_Precept_Lactating_Essential_Social.cs diff --git a/CRIALactation/1.3/Assemblies/CRIALactation.dll b/CRIALactation/1.3/Assemblies/CRIALactation.dll index f4949f2b119a8752791c6aee8bc61ccb7855696e..98c9b4577a87ec2f6a10b3e78f00690c4255d692 100644 GIT binary patch delta 2589 zcmZWrZEPIH8GdK>>u&EHeCzmPlR)llNG_Zc=c_Go3rTDPG5Cn>BMu3)&f2$*uUX%Q zy>)}@k~0c{&<3g2mLwMWkpzjB7TQFX;76;dRHOolR!x62{SYMr2^y8Qph`u}kEqX# z&*4JHnrGhkc|YczcV_*2>bOiTsTf;JR1ZR*CqHbT`SIYQAG8x~ z7sM8#6Ut1wA-;zw4*hW$mW65F7Vcsz&5v&amBOqKzss`B3SVO@Su*@9YiWK9j$&-X zX{}iUNeCBl!Zm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_-BKGK#k1Jj!CE%4SXUdkeIjR^}-U`ygTyEhf<$i~5w9xV!%3CZuLmkoZyYjBX zr=KM+D1RShWAfK!sHavllq=S2W}ML&y?wH_oM=HEu@Jiyn-$v>yCl;%sGK3i5U~VN zWk07ltGGZk;tMRH0yprCR)yCw&HcCqkG>N>V=r&QWwrUsD)TmW^G@7DGkS0ZEqXsT z!SrF`U2T|@3Hp4fGSdyn$1)mFgx84M@F}qdUlINIp4gQ&WJ}5Trd-nE(#!{hFG(I(uipHX; z*{v_za;ojZoO3{IOsfnMh{m5^jpUWs#lfjQ^TDlISX>gmIS<$Ko8QF@nrQAwr}qn8St zy?HEm?L6|{^>deav+yrxEcX{Ix49^7Z>Gw{XZ+%8M?kz?5?Hl6?`! + + + 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); + } + + } + + } +}