mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Move/copy some classes to Ideology addon
This commit is contained in:
parent
aa69b75081
commit
99d3d18d8a
10 changed files with 209 additions and 176 deletions
|
@ -0,0 +1,54 @@
|
||||||
|
using RimWorld;
|
||||||
|
using Verse;
|
||||||
|
|
||||||
|
namespace RJWSexperience.Ideology
|
||||||
|
{
|
||||||
|
public class Thought_IncreaseRecord : Thought_Recordbased
|
||||||
|
{
|
||||||
|
protected float recordIncrement;
|
||||||
|
|
||||||
|
public override void ExposeData()
|
||||||
|
{
|
||||||
|
base.ExposeData();
|
||||||
|
Scribe_Values.Look(ref recordIncrement, "recordIncrement", recordIncrement, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ThoughtInterval()
|
||||||
|
{
|
||||||
|
base.ThoughtInterval();
|
||||||
|
if (recordIncrement != 0)
|
||||||
|
{
|
||||||
|
pawn.records.AddTo(recordDef, recordIncrement);
|
||||||
|
recordIncrement = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool TryMergeWithExistingMemory(out bool showBubble)
|
||||||
|
{
|
||||||
|
ThoughtHandler thoughts = pawn.needs.mood.thoughts;
|
||||||
|
if (thoughts.memories.NumMemoriesInGroup(this) >= def.stackLimit)
|
||||||
|
{
|
||||||
|
Thought_IncreaseRecord thought_Memory = (Thought_IncreaseRecord)thoughts.memories.OldestMemoryInGroup(this);
|
||||||
|
if (thought_Memory != null)
|
||||||
|
{
|
||||||
|
showBubble = (thought_Memory.age > thought_Memory.def.DurationTicks / 2);
|
||||||
|
thought_Memory.Merged();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
showBubble = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Init()
|
||||||
|
{
|
||||||
|
base.Init();
|
||||||
|
recordIncrement = Def.increment;
|
||||||
|
}
|
||||||
|
protected virtual void Merged()
|
||||||
|
{
|
||||||
|
age = 0;
|
||||||
|
recordIncrement += Def.increment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
using RimWorld;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace RJWSexperience.Ideology
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ThoughtDef using opinion
|
||||||
|
/// </summary>
|
||||||
|
public class ThoughtDef_Opinionbased : ThoughtDef
|
||||||
|
{
|
||||||
|
public List<float> minimumValueforStage = new List<float>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Thought class using record.
|
||||||
|
/// </summary>
|
||||||
|
public class Thought_Opinionbased : Thought_Memory
|
||||||
|
{
|
||||||
|
protected ThoughtDef_Opinionbased Def => (ThoughtDef_Opinionbased)def;
|
||||||
|
protected List<float> minimumValueforStage => Def.minimumValueforStage;
|
||||||
|
|
||||||
|
public override int CurStageIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
float value = 0f;
|
||||||
|
if (otherPawn != null) value = pawn.relations?.OpinionOf(otherPawn) ?? 0f;
|
||||||
|
for (int i = minimumValueforStage.Count - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
if (minimumValueforStage[i] < value) return i;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
RJWSexperience/IdeologyAddon/Ideology/Thought_Recordbased.cs
Normal file
38
RJWSexperience/IdeologyAddon/Ideology/Thought_Recordbased.cs
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
using RimWorld;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace RJWSexperience.Ideology
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ThoughtDef using record
|
||||||
|
/// </summary>
|
||||||
|
public class ThoughtDef_Recordbased : ThoughtDef
|
||||||
|
{
|
||||||
|
public RecordDef recordDef;
|
||||||
|
public List<float> minimumValueforStage = new List<float>();
|
||||||
|
public float increment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Thought class using record.
|
||||||
|
/// </summary>
|
||||||
|
public class Thought_Recordbased : Thought_Memory
|
||||||
|
{
|
||||||
|
protected ThoughtDef_Recordbased Def => (ThoughtDef_Recordbased)def;
|
||||||
|
protected RecordDef recordDef => Def.recordDef;
|
||||||
|
protected List<float> minimumValueforStage => Def.minimumValueforStage;
|
||||||
|
|
||||||
|
public override int CurStageIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
float value = pawn?.records?.GetValue(recordDef) ?? 0f;
|
||||||
|
for (int i = minimumValueforStage.Count - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
if (minimumValueforStage[i] < value) return i + 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -76,6 +76,9 @@
|
||||||
<Compile Include="Ideology\Rituals\RitualRoles.cs" />
|
<Compile Include="Ideology\Rituals\RitualRoles.cs" />
|
||||||
<Compile Include="Ideology\StatParts.cs" />
|
<Compile Include="Ideology\StatParts.cs" />
|
||||||
<Compile Include="Ideology\Utility.cs" />
|
<Compile Include="Ideology\Utility.cs" />
|
||||||
|
<Compile Include="Ideology\Thought_IncreaseRecord.cs" />
|
||||||
|
<Compile Include="Ideology\Thought_Opinionbased.cs" />
|
||||||
|
<Compile Include="Ideology\Thought_Recordbased.cs" />
|
||||||
<Compile Include="VariousDefOf.cs" />
|
<Compile Include="VariousDefOf.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
<Compile Include="Patches\RJW_Patch.cs" />
|
<Compile Include="Patches\RJW_Patch.cs" />
|
||||||
<Compile Include="SexperienceMod.cs" />
|
<Compile Include="SexperienceMod.cs" />
|
||||||
<Compile Include="StatParts.cs" />
|
<Compile Include="StatParts.cs" />
|
||||||
<Compile Include="Thought_Opinionbased.cs" />
|
<Compile Include="Thought_AteCum.cs" />
|
||||||
<Compile Include="Thought_Recordbased.cs" />
|
<Compile Include="Thought_Recordbased.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="UI\RJWUIUtility.cs" />
|
<Compile Include="UI\RJWUIUtility.cs" />
|
||||||
|
|
38
RJWSexperience/RJWSexperience/Thought_AteCum.cs
Normal file
38
RJWSexperience/RJWSexperience/Thought_AteCum.cs
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
using RimWorld;
|
||||||
|
|
||||||
|
namespace RJWSexperience
|
||||||
|
{
|
||||||
|
public class Thought_AteCum : Thought_Recordbased
|
||||||
|
{
|
||||||
|
public override int CurStageIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (pawn?.health?.hediffSet?.HasHediff(VariousDefOf.CumAddiction) ?? false) return minimumValueforStage.Count;
|
||||||
|
return base.CurStageIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool TryMergeWithExistingMemory(out bool showBubble)
|
||||||
|
{
|
||||||
|
ThoughtHandler thoughts = pawn.needs.mood.thoughts;
|
||||||
|
if (thoughts.memories.NumMemoriesInGroup(this) >= def.stackLimit)
|
||||||
|
{
|
||||||
|
Thought_AteCum thought_Memory = (Thought_AteCum)thoughts.memories.OldestMemoryInGroup(this);
|
||||||
|
if (thought_Memory != null)
|
||||||
|
{
|
||||||
|
showBubble = (thought_Memory.age > thought_Memory.def.DurationTicks / 2);
|
||||||
|
thought_Memory.Merged();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
showBubble = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void Merged()
|
||||||
|
{
|
||||||
|
age = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,42 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
using RimWorld;
|
|
||||||
|
|
||||||
|
|
||||||
namespace RJWSexperience
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// ThoughtDef using opinion
|
|
||||||
/// </summary>
|
|
||||||
public class ThoughtDef_Opinionbased : ThoughtDef
|
|
||||||
{
|
|
||||||
public List<float> minimumValueforStage = new List<float>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Thought class using record.
|
|
||||||
/// </summary>
|
|
||||||
public class Thought_Opinionbased : Thought_Memory
|
|
||||||
{
|
|
||||||
protected ThoughtDef_Opinionbased Def => (ThoughtDef_Opinionbased)def;
|
|
||||||
protected List<float> minimumValueforStage => Def.minimumValueforStage;
|
|
||||||
|
|
||||||
public override int CurStageIndex
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
float value = 0f;
|
|
||||||
if (otherPawn != null) value = pawn.relations?.OpinionOf(otherPawn) ?? 0f;
|
|
||||||
for (int i = minimumValueforStage.Count - 1; i > 0; i--)
|
|
||||||
{
|
|
||||||
if (minimumValueforStage[i] < value) return i;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +1,5 @@
|
||||||
using System;
|
using RimWorld;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
using RimWorld;
|
|
||||||
|
|
||||||
|
|
||||||
namespace RJWSexperience
|
namespace RJWSexperience
|
||||||
{
|
{
|
||||||
|
@ -16,7 +10,6 @@ namespace RJWSexperience
|
||||||
{
|
{
|
||||||
public RecordDef recordDef;
|
public RecordDef recordDef;
|
||||||
public List<float> minimumValueforStage = new List<float>();
|
public List<float> minimumValueforStage = new List<float>();
|
||||||
public float increment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -27,7 +20,6 @@ namespace RJWSexperience
|
||||||
protected ThoughtDef_Recordbased Def => (ThoughtDef_Recordbased)def;
|
protected ThoughtDef_Recordbased Def => (ThoughtDef_Recordbased)def;
|
||||||
protected RecordDef recordDef => Def.recordDef;
|
protected RecordDef recordDef => Def.recordDef;
|
||||||
protected List<float> minimumValueforStage => Def.minimumValueforStage;
|
protected List<float> minimumValueforStage => Def.minimumValueforStage;
|
||||||
protected float increment => Def.increment;
|
|
||||||
|
|
||||||
public override int CurStageIndex
|
public override int CurStageIndex
|
||||||
{
|
{
|
||||||
|
@ -42,90 +34,4 @@ namespace RJWSexperience
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Thought_AteCum : Thought_Recordbased
|
|
||||||
{
|
|
||||||
public override int CurStageIndex
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (pawn?.health?.hediffSet?.HasHediff(VariousDefOf.CumAddiction) ?? false) return minimumValueforStage.Count;
|
|
||||||
return base.CurStageIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool TryMergeWithExistingMemory(out bool showBubble)
|
|
||||||
{
|
|
||||||
ThoughtHandler thoughts = pawn.needs.mood.thoughts;
|
|
||||||
if (thoughts.memories.NumMemoriesInGroup(this) >= def.stackLimit)
|
|
||||||
{
|
|
||||||
Thought_AteCum thought_Memory = (Thought_AteCum)thoughts.memories.OldestMemoryInGroup(this);
|
|
||||||
if (thought_Memory != null)
|
|
||||||
{
|
|
||||||
showBubble = (thought_Memory.age > thought_Memory.def.DurationTicks / 2);
|
|
||||||
thought_Memory.Merged();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
showBubble = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Merged()
|
|
||||||
{
|
|
||||||
age = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Thought_IncreaseRecord : Thought_Recordbased
|
|
||||||
{
|
|
||||||
protected float recordIncrement;
|
|
||||||
|
|
||||||
public override void ExposeData()
|
|
||||||
{
|
|
||||||
base.ExposeData();
|
|
||||||
Scribe_Values.Look(ref recordIncrement, "recordIncrement", recordIncrement, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void ThoughtInterval()
|
|
||||||
{
|
|
||||||
base.ThoughtInterval();
|
|
||||||
if (recordIncrement != 0)
|
|
||||||
{
|
|
||||||
pawn.records.AddTo(recordDef, recordIncrement);
|
|
||||||
recordIncrement = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool TryMergeWithExistingMemory(out bool showBubble)
|
|
||||||
{
|
|
||||||
ThoughtHandler thoughts = pawn.needs.mood.thoughts;
|
|
||||||
if (thoughts.memories.NumMemoriesInGroup(this) >= def.stackLimit)
|
|
||||||
{
|
|
||||||
Thought_IncreaseRecord thought_Memory = (Thought_IncreaseRecord)thoughts.memories.OldestMemoryInGroup(this);
|
|
||||||
if (thought_Memory != null)
|
|
||||||
{
|
|
||||||
showBubble = (thought_Memory.age > thought_Memory.def.DurationTicks / 2);
|
|
||||||
thought_Memory.Merged();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
showBubble = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Init()
|
|
||||||
{
|
|
||||||
base.Init();
|
|
||||||
recordIncrement = increment;
|
|
||||||
}
|
|
||||||
protected virtual void Merged()
|
|
||||||
{
|
|
||||||
age = 0;
|
|
||||||
recordIncrement += increment;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,11 +236,11 @@
|
||||||
<!-- Thoughts -->
|
<!-- Thoughts -->
|
||||||
|
|
||||||
|
|
||||||
<RJWSexperience.ThoughtDef_Recordbased>
|
<RJWSexperience.Ideology.ThoughtDef_Recordbased>
|
||||||
<defName>Sex_Promiscuous</defName>
|
<defName>Sex_Promiscuous</defName>
|
||||||
<durationDays>1</durationDays>
|
<durationDays>1</durationDays>
|
||||||
<stackLimit>1</stackLimit>
|
<stackLimit>1</stackLimit>
|
||||||
<thoughtClass>RJWSexperience.Thought_IncreaseRecord</thoughtClass>
|
<thoughtClass>RJWSexperience.Ideology.Thought_IncreaseRecord</thoughtClass>
|
||||||
<recordDef>Lust</recordDef>
|
<recordDef>Lust</recordDef>
|
||||||
<increment>3.0</increment>
|
<increment>3.0</increment>
|
||||||
<stages>
|
<stages>
|
||||||
|
@ -250,7 +250,7 @@
|
||||||
<baseMoodEffect>5</baseMoodEffect>
|
<baseMoodEffect>5</baseMoodEffect>
|
||||||
</li>
|
</li>
|
||||||
</stages>
|
</stages>
|
||||||
</RJWSexperience.ThoughtDef_Recordbased>
|
</RJWSexperience.Ideology.ThoughtDef_Recordbased>
|
||||||
|
|
||||||
<ThoughtDef>
|
<ThoughtDef>
|
||||||
<defName>Sex_NonPromiscuous</defName>
|
<defName>Sex_NonPromiscuous</defName>
|
||||||
|
|
|
@ -258,9 +258,9 @@
|
||||||
</stages>
|
</stages>
|
||||||
</ThoughtDef>
|
</ThoughtDef>
|
||||||
|
|
||||||
<RJWSexperience.ThoughtDef_Opinionbased>
|
<RJWSexperience.Ideology.ThoughtDef_Opinionbased>
|
||||||
<defName>Virgin_Precious_Taken</defName>
|
<defName>Virgin_Precious_Taken</defName>
|
||||||
<thoughtClass>RJWSexperience.Thought_Opinionbased</thoughtClass>
|
<thoughtClass>RJWSexperience.Ideology.Thought_Opinionbased</thoughtClass>
|
||||||
<durationDays>7</durationDays>
|
<durationDays>7</durationDays>
|
||||||
<stackLimit>1</stackLimit>
|
<stackLimit>1</stackLimit>
|
||||||
<minimumValueforStage>
|
<minimumValueforStage>
|
||||||
|
@ -291,11 +291,11 @@
|
||||||
<baseMoodEffect>5</baseMoodEffect>
|
<baseMoodEffect>5</baseMoodEffect>
|
||||||
</li>
|
</li>
|
||||||
</stages>
|
</stages>
|
||||||
</RJWSexperience.ThoughtDef_Opinionbased>
|
</RJWSexperience.Ideology.ThoughtDef_Opinionbased>
|
||||||
|
|
||||||
<RJWSexperience.ThoughtDef_Opinionbased>
|
<RJWSexperience.Ideology.ThoughtDef_Opinionbased>
|
||||||
<defName>Virgin_Shameful_Taken</defName>
|
<defName>Virgin_Shameful_Taken</defName>
|
||||||
<thoughtClass>RJWSexperience.Thought_Opinionbased</thoughtClass>
|
<thoughtClass>RJWSexperience.Ideology.Thought_Opinionbased</thoughtClass>
|
||||||
<durationDays>7</durationDays>
|
<durationDays>7</durationDays>
|
||||||
<stackLimit>1</stackLimit>
|
<stackLimit>1</stackLimit>
|
||||||
<minimumValueforStage>
|
<minimumValueforStage>
|
||||||
|
@ -320,7 +320,7 @@
|
||||||
<baseMoodEffect>20</baseMoodEffect>
|
<baseMoodEffect>20</baseMoodEffect>
|
||||||
</li>
|
</li>
|
||||||
</stages>
|
</stages>
|
||||||
</RJWSexperience.ThoughtDef_Opinionbased>
|
</RJWSexperience.Ideology.ThoughtDef_Opinionbased>
|
||||||
|
|
||||||
|
|
||||||
<ThoughtDef>
|
<ThoughtDef>
|
||||||
|
|
Loading…
Reference in a new issue