ideology compatibility

This commit is contained in:
c0ffee12 2021-07-24 07:32:04 -07:00
parent bc23c0d62f
commit 61fa2feb26
6 changed files with 51 additions and 1 deletions

Binary file not shown.

View file

@ -53,6 +53,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Source\DefOfs\OrgyDutyDefOf.cs" />
<Compile Include="Source\DefOfs\TaleDefOf.cs" /> <Compile Include="Source\DefOfs\TaleDefOf.cs" />
<Compile Include="Source\DefOfs\ThoughtDefOf.cs" /> <Compile Include="Source\DefOfs\ThoughtDefOf.cs" />
<Compile Include="Source\GatheringWorkers\GatheringWorker_Orgy.cs" /> <Compile Include="Source\GatheringWorkers\GatheringWorker_Orgy.cs" />

View file

@ -0,0 +1,22 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse.AI;
namespace RJW_Events
{
[DefOf]
public static class OrgyDutyDefOf
{
static OrgyDutyDefOf()
{
DefOfHelper.EnsureInitializedInCtor(typeof(DutyDefOf));
}
public static DutyDef Orgy;
}
}

View file

@ -22,5 +22,22 @@ namespace RJW_Events
return RCellFinder.TryFindGatheringSpot(organizer, this.def, false, out spot); return RCellFinder.TryFindGatheringSpot(organizer, this.def, false, out spot);
} }
public override bool CanExecute(Map map, Pawn organizer = null)
{
if(ModLister.IdeologyInstalled)
{
var ideo = Faction.OfPlayer.ideos.PrimaryIdeo;
if (!ideo.HasPrecept(DefDatabase<PreceptDef>.GetNamed("Lovin_FreeApproved", true)))
{
return false;
}
}
return base.CanExecute(map, organizer);
}
} }
} }

View file

@ -54,7 +54,7 @@ namespace RJW_Events
List<Pawn> targets = LordUtility.GetLord(pawn).ownedPawns.Where((Pawn p) => { List<Pawn> targets = LordUtility.GetLord(pawn).ownedPawns.Where((Pawn p) => {
if(p?.mindState?.duty == null) if(p?.mindState?.duty == null && p.mindState.duty.def != OrgyDutyDefOf.Orgy)
{ {
return false; return false;
} }

View file

@ -52,6 +52,16 @@ namespace RJW_Events
{ {
if (!CasualSex_Helper.CanHaveSex(p)) return 0; if (!CasualSex_Helper.CanHaveSex(p)) return 0;
if (ModLister.IdeologyInstalled)
{
var ideo = p.ideo.Ideo;
if (!ideo.HasPrecept(DefDatabase<PreceptDef>.GetNamed("Lovin_FreeApproved", true)))
{
return 0;
}
}
return base.VoluntaryJoinPriorityFor(p); return base.VoluntaryJoinPriorityFor(p);
} }