mirror of
https://gitgud.io/c0ffeeeeeeee/coffees-rjw-ideology-addons.git
synced 2024-08-14 23:57:38 +00:00
replaced compinducelactation with hediffcomp; cleaner
todo: add abilitydef to hucow handler to begin inducing lactation; give lactation induction hediff to recipient pawn add thoughtdef w/ thoughtworker_hediff to give pawns thoughts on inducing lactation
This commit is contained in:
parent
1d6ecb3f95
commit
5b4b203d13
19 changed files with 233 additions and 70 deletions
Binary file not shown.
|
@ -71,16 +71,18 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Source\CompProperties\CompAbilityEffects\CompProperties_AbilityConvertHucow.cs" />
|
||||
<Compile Include="Source\CompProperties\CompProperties_InduceLactation.cs" />
|
||||
<Compile Include="Source\CompProperties\CompProperties_Lactation.cs" />
|
||||
<Compile Include="Source\Comps\CompAbilityEffects\CompAbilityEffect_ConvertHucow.cs" />
|
||||
<Compile Include="Source\Comps\CompInduceLactation.cs" />
|
||||
<Compile Include="Source\Comps\CompLactation.cs" />
|
||||
<Compile Include="Source\HarmonyPatches\HarmonyPatch_FoodUtility.cs" />
|
||||
<Compile Include="Source\HarmonyPatches\HarmonyPatch_Ideo.cs" />
|
||||
<Compile Include="Source\HarmonyPatches\HarmonyPatch_Thing.cs" />
|
||||
<Compile Include="Source\HarmonyPatches\Harmony_PatchAll.cs" />
|
||||
<Compile Include="Source\HarmonyPatches\RJW\HarmonyPatch_Milk_HumanCompHasGatherableBodyResource.cs" />
|
||||
<Compile Include="Source\HediffDefOf\HediffDefOf_Milk.cs" />
|
||||
<Compile Include="Source\Hediffs\HediffCompProperties_LactationInduction.cs" />
|
||||
<Compile Include="Source\Hediffs\HediffCompProperties_StopOnceNotLactating.cs" />
|
||||
<Compile Include="Source\Hediffs\HediffComp_LactationInduction.cs" />
|
||||
<Compile Include="Source\Hediffs\HediffComp_StopOnceNotLactating.cs" />
|
||||
<Compile Include="Source\HistoryEventDefOf\HistoryEventDefOf_Milk.cs" />
|
||||
<Compile Include="Source\JobDefOf\JobDefOf_CRIALactation.cs" />
|
||||
|
|
|
@ -43,4 +43,48 @@
|
|||
<li Class="CRIALactation.CompProperties_AbilityConvertHucow" />
|
||||
</comps>
|
||||
</AbilityDef>
|
||||
|
||||
<AbilityDef>
|
||||
<defName>BeginInducingLactation</defName>
|
||||
<label>begin inducing lactation</label>
|
||||
<description>Stimulate someone's milk ducts to begin the process of lactation without childbirth.</description>
|
||||
<jobDef>CastAbilityOnThingMelee</jobDef>
|
||||
<iconPath>UI/Abilities/WorkDrive</iconPath>
|
||||
<warmupMoteSocialSymbol>UI/Issues/Lactating</warmupMoteSocialSymbol>
|
||||
<stunTargetWhileCasting>True</stunTargetWhileCasting>
|
||||
<showPsycastEffects>False</showPsycastEffects>
|
||||
<displayGizmoWhileUndrafted>True</displayGizmoWhileUndrafted>
|
||||
<disableGizmoWhileUndrafted>False</disableGizmoWhileUndrafted>
|
||||
|
||||
<overrideGroupCooldown>True</overrideGroupCooldown>
|
||||
<cooldownTicksRange>3000</cooldownTicksRange>
|
||||
|
||||
<hotKey>Misc12</hotKey>
|
||||
<uiOrder>4</uiOrder>
|
||||
<warmupStartSound>WorkDrive_Warmup</warmupStartSound>
|
||||
<statBases>
|
||||
<Ability_Duration>3000</Ability_Duration>
|
||||
</statBases>
|
||||
<verbProperties>
|
||||
<verbClass>Verb_CastAbilityTouch</verbClass>
|
||||
<drawAimPie>False</drawAimPie>
|
||||
<range>-1</range>
|
||||
<warmupTime>3.0</warmupTime>
|
||||
<targetParams>
|
||||
<canTargetAnimals>false</canTargetAnimals>
|
||||
<canTargetSelf>false</canTargetSelf>
|
||||
<canTargetBuildings>false</canTargetBuildings>
|
||||
<canTargetMechs>false</canTargetMechs>
|
||||
<onlyTargetColonistsOrPrisonersOrSlaves>true</onlyTargetColonistsOrPrisonersOrSlaves>
|
||||
</targetParams>
|
||||
</verbProperties>
|
||||
<comps>
|
||||
<li Class="CompProperties_AbilityGiveHediff">
|
||||
<compClass>CompAbilityEffect_GiveHediff</compClass>
|
||||
<hediffDef>Hucow</hediffDef>
|
||||
<applicableToMechs>False</applicableToMechs>
|
||||
</li>
|
||||
<li Class="CRIALactation.CompProperties_AbilityConvertHucow" />
|
||||
</comps>
|
||||
</AbilityDef>
|
||||
</Defs>
|
|
@ -21,4 +21,26 @@
|
|||
</li>
|
||||
</stages>
|
||||
</HediffDef>
|
||||
|
||||
<HediffDef ParentName="RoleStatBuff">
|
||||
<defName>InducingLactation</defName>
|
||||
<label>inducing lactation</label>
|
||||
<description>This person's breasts are being encouraged to lactate. This is a long, arduous process of breast and nipple stimulation. It causes feelings of soreness and swelling that ends once milk begins expressing.</description>
|
||||
<hediffClass>HediffWithComps</hediffClass>
|
||||
<comps>
|
||||
<li Class="HediffCompProperties_DisappearsOnDeath" />
|
||||
<li Class="CRIALactation.HediffCompProperties_LactationInduction" />
|
||||
</comps>
|
||||
<isBad>false</isBad>
|
||||
<stages>
|
||||
<li>
|
||||
<statFactors>
|
||||
<MilkProductionYield>2.75</MilkProductionYield>
|
||||
<MilkProductionSpeed>0.5</MilkProductionSpeed>
|
||||
<WorkSpeedGlobal>0.4</WorkSpeedGlobal>
|
||||
<MoveSpeed>0.65</MoveSpeed>
|
||||
</statFactors>
|
||||
</li>
|
||||
</stages>
|
||||
</HediffDef>
|
||||
</Defs>
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
<!--
|
||||
<MemeGroupDef>
|
||||
<defName>Sexuality</defName>
|
||||
<drawOffset>(0.09, 0.33)</drawOffset>
|
||||
<maxRows>1</maxRows>
|
||||
</MemeGroupDef>-->
|
||||
</MemeGroupDef>
|
||||
|
||||
<MemeDef>
|
||||
<defName>Hucow</defName>
|
||||
<label>hucow</label>
|
||||
<description>Breast milk should be produced for and consumed by all.</description>
|
||||
<iconPath>UI/Memes/Hucow</iconPath>
|
||||
<groupDef>Misc</groupDef>
|
||||
<groupDef>Sexuality</groupDef>
|
||||
<exclusionTags>
|
||||
<li>Sexuality</li>
|
||||
</exclusionTags>
|
||||
<impact>3</impact>
|
||||
<renderOrder>50</renderOrder>
|
||||
<requireOne>
|
||||
|
@ -20,9 +22,6 @@
|
|||
<li>Lactating_Essential</li>
|
||||
<li>Lactating_MandatoryHucow</li>
|
||||
</li>
|
||||
<li>
|
||||
<li>IdeoRole_HucowHandler</li>
|
||||
</li>
|
||||
</requireOne>
|
||||
<generalRules>
|
||||
<rulesStrings>
|
||||
|
@ -64,21 +63,17 @@
|
|||
</descriptionMaker>
|
||||
<symbolPacks>
|
||||
<li>
|
||||
<ideoName>Lactatism</ideoName>
|
||||
<theme>lactation</theme>
|
||||
<adjective>lactatist</adjective>
|
||||
<member>lactatist</member>
|
||||
<ideoName>Bovinism</ideoName>
|
||||
<theme>bovines</theme>
|
||||
<adjective>Bovine</adjective>
|
||||
<member>Bovinist</member>
|
||||
</li>
|
||||
<li>
|
||||
<ideoName>Hucowism</ideoName>
|
||||
<theme>hucows</theme>
|
||||
<adjective>bovine</adjective>
|
||||
<adjective>hucow</adjective>
|
||||
<member>Hucowist</member>
|
||||
</li>
|
||||
</symbolPacks>
|
||||
<ritualsToMake>1</ritualsToMake>
|
||||
<replaceRitualsWithTags>
|
||||
<li>CelebratedDate</li>
|
||||
</replaceRitualsWithTags>
|
||||
</MemeDef>
|
||||
</Defs>
|
|
@ -30,20 +30,27 @@
|
|||
</roleTags>
|
||||
</PreceptDef>
|
||||
-->
|
||||
|
||||
<IssueDef>
|
||||
<defName>HucowHandling</defName>
|
||||
<label>hucow handling</label>
|
||||
<iconPath>UI/Issues/Lactating</iconPath>
|
||||
</IssueDef>
|
||||
|
||||
<PreceptDef ParentName="PreceptRoleSingleBase">
|
||||
<defName>IdeoRole_HucowHandler</defName>
|
||||
<issue>HucowHandling</issue>
|
||||
<!--this is needed to override old issue in issuedef to have hucow handler role-->
|
||||
<label>hucow handler</label>
|
||||
<description>A special ideoligious status which can convert lactating pawns to hucows, increasing their lactation yield at the cost of their work and movement speed. \n\nThey also receive an increase in the speed at which they harvest milk, and the speed at which they induce lactation in other pawns.</description>
|
||||
<iconPath>UI/Roles/SpecialistMelee</iconPath>
|
||||
<nameMaker>NamerRoleMoralist</nameMaker>
|
||||
<displayOrderInImpact>100</displayOrderInImpact>
|
||||
<roleTags>
|
||||
<li>HucowHandler</li>
|
||||
</roleTags>
|
||||
|
||||
<roleRequirements>
|
||||
<li Class="RoleRequirement_SameIdeo">
|
||||
<labelKey>RoleRequirementLabelSameIdeo</labelKey>
|
||||
</li>
|
||||
<li Class="RoleRequirement_MinSkillAny">
|
||||
<skills>
|
||||
<Animals>6</Animals>
|
||||
|
@ -51,7 +58,9 @@
|
|||
</li>
|
||||
|
||||
</roleRequirements>
|
||||
|
||||
<roleRequiredWorkTags>
|
||||
<li>Animals</li>
|
||||
</roleRequiredWorkTags>
|
||||
<roleEffects>
|
||||
<li Class="RoleEffect_PawnStatOffset">
|
||||
<statDef>AnimalGatherSpeed</statDef>
|
||||
|
@ -139,7 +148,6 @@
|
|||
<grantedAbilities>
|
||||
<li>ConvertToHucow</li>
|
||||
</grantedAbilities>
|
||||
<displayOrderInImpact>2</displayOrderInImpact>
|
||||
</PreceptDef>
|
||||
|
||||
</Defs>
|
||||
|
|
|
@ -17,9 +17,7 @@
|
|||
<li Class="PatchOperationAdd">
|
||||
<xpath>/Defs/ThingDef[@Name="BasePawn"]/comps</xpath>
|
||||
<value>
|
||||
<li Class="CRIALactation.CompProperties_InduceLactation">
|
||||
<DaysToLactating>15</DaysToLactating>
|
||||
<TimesMassagedADay>2.5</TimesMassagedADay>
|
||||
<li Class="CRIALactation.CompProperties_Lactation">
|
||||
</li>
|
||||
</value>
|
||||
</li>
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
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 CompProperties_InduceLactation : CompProperties
|
||||
{
|
||||
public CompProperties_InduceLactation()
|
||||
{
|
||||
this.compClass = typeof(CompInduceLactation);
|
||||
}
|
||||
|
||||
public float DaysToLactating = 15;
|
||||
public float TimesMassagedADay = 2.5f;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
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 CompProperties_Lactation : CompProperties
|
||||
{
|
||||
public CompProperties_Lactation()
|
||||
{
|
||||
this.compClass = typeof(CompLactation);
|
||||
}
|
||||
|
||||
//public float DaysToLactating = 15;
|
||||
//public float TimesMassagedADay = 2.5f;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
using RimWorld;
|
||||
using RimWorld.Planet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace CRIALactation
|
||||
{
|
||||
public class CompAbilityEffect_BeginInducingLactation : CompAbilityEffect
|
||||
{
|
||||
|
||||
public override bool Valid(LocalTargetInfo target, bool throwMessages = false)
|
||||
{
|
||||
Pawn pawn = target.Pawn;
|
||||
|
||||
if (pawn == null) return false;
|
||||
if (!pawn.IsColonistPlayerControlled || !pawn.IsSlaveOfColony || !pawn.IsPrisonerOfColony) return false;
|
||||
if (LactationUtility.IsLactating(pawn)) return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -10,7 +10,20 @@ using UnityEngine;
|
|||
|
||||
namespace CRIALactation
|
||||
{
|
||||
public class CompInduceLactation : ThingComp
|
||||
public class CompLactation : ThingComp
|
||||
{
|
||||
public int lastHumanLactationIngestedTick = 0;
|
||||
public override void PostExposeData()
|
||||
{
|
||||
base.PostExposeData();
|
||||
Scribe_Values.Look<int>(ref this.lastHumanLactationIngestedTick, "lastHumanLactationIngestedTick", 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public class CompLactation : ThingComp
|
||||
{
|
||||
private readonly int OneDayInTicks = 60000;
|
||||
private int TicksSinceLastMassage = -60000;
|
||||
|
@ -124,4 +137,6 @@ namespace CRIALactation
|
|||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
|
@ -17,8 +17,8 @@ namespace CRIALactation
|
|||
|
||||
if(__instance?.def == ThingDefOf_Milk.HumanMilk || __instance?.def == ThingDefOf_Milk.HumanoidMilk)
|
||||
{
|
||||
if (ingester.TryGetComp<CompInduceLactation>() == null) return;
|
||||
ingester.TryGetComp<CompInduceLactation>().lastHumanLactationIngestedTick = Find.TickManager.TicksGame;
|
||||
if (ingester.TryGetComp<CompLactation>() == null) return;
|
||||
ingester.TryGetComp<CompLactation>().lastHumanLactationIngestedTick = Find.TickManager.TicksGame;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ namespace CRIALactation
|
|||
public static HediffDef Lactating_Permanent;
|
||||
public static HediffDef Heavy_Lactating_Permanent;
|
||||
public static HediffDef Lactating_Natural;
|
||||
|
||||
|
||||
public static HediffDef InducingLactation;
|
||||
public static HediffDef Hucow;
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace CRIALactation
|
||||
{
|
||||
public class HediffCompProperties_LactationInduction : HediffCompProperties
|
||||
{
|
||||
public HediffCompProperties_LactationInduction()
|
||||
{
|
||||
this.compClass = typeof(HediffComp_LactationInduction);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace CRIALactation
|
||||
{
|
||||
public class HediffComp_LactationInduction : HediffComp
|
||||
{
|
||||
private readonly int OneDayInTicks = 60000;
|
||||
private float TimesMassagedADay = 2.5f;
|
||||
private int tickLastMassaged = 0, DaysToLactating = 15;
|
||||
|
||||
|
||||
|
||||
public void massage(Pawn massager)
|
||||
{
|
||||
|
||||
this.parent.Severity += (float)1 / (DaysToLactating * (TimesMassagedADay + Rand.Value));
|
||||
}
|
||||
|
||||
public bool canMassage()
|
||||
{
|
||||
return tickLastMassaged + OneDayInTicks / TimesMassagedADay < GenTicks.TicksGame;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void CompExposeData()
|
||||
{
|
||||
Scribe_Values.Look<int>(ref this.tickLastMassaged, "lastLactationInductionMassagedTick", 0);
|
||||
base.CompExposeData();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,6 +28,7 @@ namespace CRIALactation
|
|||
Toil massage = new Toil();
|
||||
massage.FailOnDespawnedOrNull(TargetIndex.A);
|
||||
massage.FailOnAggroMentalStateAndHostile(TargetIndex.A);
|
||||
float massageProgress = 0;
|
||||
massage.initAction = delegate
|
||||
{
|
||||
Pawn p = job.GetTarget(TargetIndex.A).Thing as Pawn;
|
||||
|
@ -46,14 +47,9 @@ namespace CRIALactation
|
|||
Pawn p = job.GetTarget(TargetIndex.A).Thing as Pawn;
|
||||
if (massageProgress >= WorkTotal)
|
||||
{
|
||||
p.TryGetComp<CompInduceLactation>().MassageBreasts();
|
||||
p.health.hediffSet.GetFirstHediffOfDef(HediffDefOf_Milk.InducingLactation).TryGetComp<HediffComp_LactationInduction>().massage(pawn);
|
||||
return JobCondition.Succeeded;
|
||||
}
|
||||
|
||||
if (!(p.TryGetComp<CompInduceLactation>().isActive && p.TryGetComp<CompInduceLactation>().CanMassage))
|
||||
{
|
||||
return JobCondition.Incompletable;
|
||||
}
|
||||
|
||||
return JobCondition.Ongoing;
|
||||
|
||||
|
@ -74,7 +70,5 @@ namespace CRIALactation
|
|||
yield break;
|
||||
|
||||
}
|
||||
|
||||
float massageProgress = 0f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,13 +55,10 @@ namespace CRIALactation
|
|||
|
||||
public static bool isMassageable(Pawn p)
|
||||
{
|
||||
CompInduceLactation c = p.TryGetComp<CompInduceLactation>();
|
||||
if (c != null && c.isActive && c.CanMassage)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Hediff lactationInductionHediff = p.health?.hediffSet?.GetFirstHediffOfDef(HediffDefOf_Milk.InducingLactation);
|
||||
if (lactationInductionHediff == null) return false;
|
||||
|
||||
return false;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace CRIALactation
|
|||
|
||||
protected override ThoughtState ShouldHaveThought(Pawn p)
|
||||
{
|
||||
int num = Mathf.Max(0, p.TryGetComp<CompInduceLactation>().lastHumanLactationIngestedTick);
|
||||
int num = Mathf.Max(0, p.TryGetComp<CompLactation>().lastHumanLactationIngestedTick);
|
||||
return Find.TickManager.TicksGame - num > 480000 && !LactationUtility.IsHucow(p);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,13 +36,15 @@ namespace CRIALactation
|
|||
public override bool HasJobOnThing(Pawn p, Thing t, bool forced = false)
|
||||
{
|
||||
Pawn pawn2 = t as Pawn;
|
||||
if(pawn2?.TryGetComp<CompInduceLactation>() == null)
|
||||
if(pawn2?.health?.hediffSet.GetFirstHediffOfDef(HediffDefOf_Milk.InducingLactation) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
CompInduceLactation c = pawn2.TryGetComp<CompInduceLactation>();
|
||||
Hediff lactationInductionHediff = pawn2?.health?.hediffSet?.GetFirstHediffOfDef(HediffDefOf_Milk.InducingLactation);
|
||||
if (lactationInductionHediff == null) return false;
|
||||
|
||||
return p != pawn2 && c.isActive && c.CanMassage && !pawn2.Downed && !pawn2.Drafted && !pawn2.InAggroMentalState && !pawn2.IsFormingCaravan() && pawn2.CanCasuallyInteractNow(false, true, false) && p.CanReserve(pawn2, 1, -1, null, forced);
|
||||
HediffComp_LactationInduction lactInductComp = lactationInductionHediff.TryGetComp<HediffComp_LactationInduction>();
|
||||
return p != pawn2 && lactInductComp.canMassage() && !pawn2.Downed && !pawn2.Drafted && !pawn2.InAggroMentalState && !pawn2.IsFormingCaravan() && pawn2.CanCasuallyInteractNow(false, true, false) && p.CanReserve(pawn2, 1, -1, null, forced);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue