null partner bugfix

This commit is contained in:
c0ffee12 2021-07-25 21:06:00 -07:00
parent 0d112972ef
commit 91d05d0e1e
13 changed files with 312 additions and 3 deletions

View File

@ -76,5 +76,8 @@
<ItemGroup>
<Folder Include="About\" />
</ItemGroup>
<ItemGroup>
<Content Include="LoadFolders.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.31205.134
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C0ffee's RJW Ideology Addons", "C0ffee's RJW Ideology Addons.csproj", "{D46BAA34-7459-482F-B152-321C071DCE18}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CRIALactation", "CRIALactation\CRIALactation.csproj", "{01BE0D84-9292-4F89-90FC-647B66771C61}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -15,6 +17,10 @@ Global
{D46BAA34-7459-482F-B152-321C071DCE18}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D46BAA34-7459-482F-B152-321C071DCE18}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D46BAA34-7459-482F-B152-321C071DCE18}.Release|Any CPU.Build.0 = Release|Any CPU
{01BE0D84-9292-4F89-90FC-647B66771C61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{01BE0D84-9292-4F89-90FC-647B66771C61}.Debug|Any CPU.Build.0 = Debug|Any CPU
{01BE0D84-9292-4F89-90FC-647B66771C61}.Release|Any CPU.ActiveCfg = Release|Any CPU
{01BE0D84-9292-4F89-90FC-647B66771C61}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{01BE0D84-9292-4F89-90FC-647B66771C61}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CRIALactation</RootNamespace>
<AssemblyName>CRIALactation</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>1.3\Assemblies\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\..\..\workshop\content\294100\2009463077\Current\Assemblies\0Harmony.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="HugsLib">
<HintPath>..\..\..\..\..\workshop\content\294100\818773962\v1.3\Assemblies\HugsLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Milk">
<HintPath>..\..\rjw-mc-master\1.3\Assemblies\Milk.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RJW">
<HintPath>..\..\rjw\1.3\Assemblies\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\RimWorldWin64_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Source\HediffDefOf\HediffDefOf_Milk.cs" />
<Compile Include="Source\LactationUtility.cs" />
<Compile Include="Source\Precepts\Precept_Lactation.cs" />
<Compile Include="Source\Thoughts\ThoughtWorker_Precept_Lactating_Essential.cs" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="Defs\PreceptDefs\Precepts_Lactating.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<!--Issue-->
<!--
<IssueDef>
<defName>Lactation</defName>
<label>lactation</label>
<iconPath>UI/Issues/MeatEating</iconPath>
</IssueDef>
<PreceptDef>
<defName>Lactating_Essential</defName>
<issue>Lactation</issue>
<label>essential</label>
<description>Milk from breasts is healthy and delicious. It should be produced and consumed by everyone on a regular basis.</description>
<comps>
<li Class="PreceptComp_SituationalThought">
<thought>Lactating_Essential</thought>
<description>Pawns with sizeable breasts should be producing milk</description>
</li>
</comps>
</PreceptDef>
<ThoughtDef>
<defName>Lactating_Essential</defName>
<thoughtClass>Thought_Situational</thoughtClass>
<workerClass>CRIALactation.ThoughtWorker_Precept_Lactating_Essential</workerClass>
<stages>
<li>
<label>producing milk</label>
<description>Expressing milk for my friends and family fills me with maternal pride.</description>
<baseMoodEffect>7</baseMoodEffect>
</li>
<li>
<label>not producing milk</label>
<description>I'm as useless as a dry well.</description>
<baseMoodEffect>-12</baseMoodEffect>
</li>
</stages>
</ThoughtDef>
-->
</Defs>

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CRIALactation")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CRIALactation")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("01be0d84-9292-4f89-90fc-647b66771c61")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,26 @@
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 HediffDefOf_Milk {
static HediffDefOf_Milk()
{
DefOfHelper.EnsureInitializedInCtor(typeof(HediffDefOf_Milk));
}
public static HediffDef Lactating_Drug;
public static HediffDef Lactating_Permanent;
public static HediffDef Heavy_Lactating_Permanent;
public static HediffDef Lactating_Natural;
}
}

View File

@ -0,0 +1,24 @@
using Milk;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace CRIALactation
{
public static class LactationUtility
{
public static bool IsLactating(Pawn p)
{
return
p.health.hediffSet.HasHediff(HediffDefOf_Milk.Lactating_Natural, false) ||
p.health.hediffSet.HasHediff(HediffDefOf_Milk.Lactating_Drug, false) ||
p.health.hediffSet.HasHediff(HediffDefOf_Milk.Lactating_Permanent, false) ||
p.health.hediffSet.HasHediff(HediffDefOf_Milk.Heavy_Lactating_Permanent, false);
}
}
}

View File

@ -0,0 +1,22 @@
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 Precept_Lactation : Precept
{
public override void Notify_MemberSpawned(Pawn pawn)
{
base.Notify_MemberSpawned(pawn);
}
}
}

View File

@ -0,0 +1,38 @@
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 : ThoughtWorker_Precept
{
protected override ThoughtState ShouldHaveThought(Pawn p)
{
if (ThoughtUtility.ThoughtNullified(p, this.def))
{
return false;
}
if (!Genital_Helper.has_breasts(p) || Genital_Helper.has_male_breasts(p))
{
return false;
}
if(LactationUtility.IsLactating(p))
{
return ThoughtState.ActiveAtStage(0);
}
return ThoughtState.ActiveAtStage(1);
}
}
}

9
LoadFolders.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<loadFolders>
<v1.3>
<li>/</li>
<li>1.3</li>
<li IfModActive="rjw.milk.humanoid">CRIALactation</li>
<li IfModActive="rjw.milk.humanoid">CRIALactation/1.3</li>
</v1.3>
</loadFolders>

View File

@ -19,7 +19,11 @@ namespace C0ffee_s_RJW_Ideology_Addons
if (fucker == fucked) return true; //pawns are always allowed to masturbate
if (DesignatorsData.rjwComfort.Contains(fucker) || DesignatorsData.rjwComfort.Contains(fucked)) return true; //designated comfort pawns allowed to have sex with
if (DesignatorsData.rjwComfort.Contains(fucked)) return true; //designated comfort pawns allowed to have sex with
if (fucked.IsSlaveOfColony || fucked.IsPrisonerOfColony) return true; //prisoners and slaves are free game
if (PawnsAreDesperate(fucker, fucked)) return true;
if (!IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucker) || !IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucked))
{
@ -43,5 +47,12 @@ namespace C0ffee_s_RJW_Ideology_Addons
return true;
}
public static bool PawnsAreDesperate(Pawn fucker, Pawn fucked)
{
if ((IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucker) || xxx.is_frustrated(fucker) && (IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucked) || xxx.is_frustrated(fucked)))) return true; //frustrated pawns have to have sex
return false;
}
}
}

View File

@ -21,13 +21,13 @@ namespace C0ffee_s_RJW_Ideology_Addons
HistoryEventDef def = __instance.pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, __instance.Partner) ? HistoryEventDefOf.GotLovin_Spouse : HistoryEventDefOf.GotLovin_NonSpouse;
if (!(__instance is JobDriver_Rape && IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.Partner))) //ensure raped pawns don't enjoy
if (!(IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.Partner) && (__instance.Partner.IsSlaveOfColony || __instance.Partner.IsPrisonerOfColony))) //ensure raped pawns don't enjoy
{
Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.GotLovin, __instance.Partner.Named(HistoryEventArgsNames.Doer)), true);
Find.HistoryEventsManager.RecordEvent(new HistoryEvent(def, __instance.Partner.Named(HistoryEventArgsNames.Doer)), true);
}
if (IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.Partner) || !(__instance is JobDriver_Rape)) //ensure raped pawns don't enjoy
if (IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.pawn) || !(__instance.Partner.IsSlaveOfColony || __instance.Partner.IsPrisonerOfColony)) //ensure slaves are free game, but not otherwise
{
Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.GotLovin, __instance.pawn.Named(HistoryEventArgsNames.Doer)), true);
Find.HistoryEventsManager.RecordEvent(new HistoryEvent(def, __instance.pawn.Named(HistoryEventArgsNames.Doer)), true);
@ -45,6 +45,9 @@ namespace C0ffee_s_RJW_Ideology_Addons
public static void Prefix(JobDriver_SexBaseInitiator __instance)
{
if (__instance is JobDriver_Masturbate || __instance.Partner == null) return;
if (IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.Partner) || !(__instance is JobDriver_Rape)) //ensure raped pawns don't enjoy
{
Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.InitiatedLovin, __instance.pawn.Named(HistoryEventArgsNames.Doer)), true);