mirror of
https://gitgud.io/c0ffeeeeeeee/coffees-rjw-ideology-addons.git
synced 2024-08-14 23:57:38 +00:00
lactation production boost
This commit is contained in:
parent
5752647b4f
commit
a2327fc291
5 changed files with 76 additions and 5 deletions
Binary file not shown.
Binary file not shown.
|
@ -71,6 +71,8 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Source\HarmonyPatches\HarmonyPatch_Ideo.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\LactationUtility.cs" />
|
||||
<Compile Include="Source\PreceptDefOf\PreceptDefOf_Lactation.cs" />
|
||||
|
|
|
@ -14,7 +14,11 @@
|
|||
<issue>Lactating</issue>
|
||||
<label>essential</label>
|
||||
<impact>High</impact>
|
||||
<description>Milk from breasts is creamy and delicious. It should be produced and consumed on a regular basis.</description>
|
||||
<displayOrderInIssue>20</displayOrderInIssue>
|
||||
<displayOrderInImpact>100</displayOrderInImpact>
|
||||
<description>Milk from breasts is creamy and delicious. It should be produced and consumed on a regular basis.
|
||||
|
||||
Lactating colonists will produce double the normal amount of milk.</description>
|
||||
<comps>
|
||||
<li Class="PreceptComp_SituationalThought">
|
||||
<thought>Lactating_Essential</thought>
|
||||
|
@ -23,6 +27,7 @@
|
|||
</li>
|
||||
<li Class="PreceptComp_SituationalThought">
|
||||
<thought>Lactating_Essential_Social</thought>
|
||||
<tooltipShowMoodRange>true</tooltipShowMoodRange>
|
||||
</li>
|
||||
</comps>
|
||||
</PreceptDef>
|
||||
|
@ -40,19 +45,19 @@
|
|||
|
||||
<li>
|
||||
<label>not producing milk</label>
|
||||
<description>We live in such difficult times. Producing milk is a pipe dream, but it would be nice.</description>
|
||||
<description>We live in such difficult times. I wish I could be producing milk right now.</description>
|
||||
<baseMoodEffect>-6</baseMoodEffect>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label>not producing milk</label>
|
||||
<description>I'm as useless as a dry well. A healthy supply of my milk is expected, but I'm failing to deliver.</description>
|
||||
<baseMoodEffect>-9</baseMoodEffect>
|
||||
<description>I'm as useless as a dry well. A healthy supply of my milk can benefit the colony, but I'm failing to deliver.</description>
|
||||
<baseMoodEffect>-10</baseMoodEffect>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label>not producing milk</label>
|
||||
<description>Producing milk is a basic duty for someone like me. I'm embarrassed and ashamed to be dry.</description>
|
||||
<description>Producing milk is a basic responsibility. I'm embarrassed and ashamed to be dry.</description>
|
||||
<baseMoodEffect>-16</baseMoodEffect>
|
||||
</li>
|
||||
</stages>
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
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;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace CRIALactation
|
||||
|
||||
{
|
||||
[HarmonyPatch(typeof(HumanCompHasGatherableBodyResource), "CompTick")]
|
||||
public static class HarmonyPatch_Milk_HumanCompHasGatherableBodyResource
|
||||
{
|
||||
|
||||
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> codeInstructions)
|
||||
{
|
||||
|
||||
var ins = codeInstructions.ToList();
|
||||
|
||||
for(int i = 0; i < ins.Count; i++)
|
||||
{
|
||||
|
||||
if (ins[i].opcode == OpCodes.Callvirt && ins.Count > i + 1 && ins[i + 1].OperandIs(60000))
|
||||
{
|
||||
|
||||
yield return ins[i];
|
||||
yield return new CodeInstruction(OpCodes.Ldarg_0);
|
||||
yield return new CodeInstruction(OpCodes.Call, AccessTools.DeclaredMethod(typeof(HarmonyPatch_Milk_HumanCompHasGatherableBodyResource), "AdjustGatherResourceDaysForPrecept"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
yield return ins[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static float AdjustGatherResourceDaysForPrecept(float resourcesIntervalDays, HumanCompHasGatherableBodyResource __instance)
|
||||
{
|
||||
|
||||
Pawn pawn = __instance.parent as Pawn;
|
||||
if(pawn.Ideo.HasPrecept(PreceptDefOf_Lactation.Lactating_Essential))
|
||||
{
|
||||
return resourcesIntervalDays * 0.5f;
|
||||
}
|
||||
|
||||
return resourcesIntervalDays;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue