mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Move event generation out of trait handler
This commit is contained in:
parent
bb65120dd9
commit
758121ff4c
2 changed files with 18 additions and 13 deletions
|
@ -83,19 +83,25 @@ namespace RJWSexperience
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void PoptheCherry(this Pawn pawn, Pawn partner, SexProps props)
|
public static void PoptheCherry(this Pawn pawn, Pawn partner, SexProps props)
|
||||||
{
|
{
|
||||||
if (props?.sexType == xxx.rjwSextype.Vaginal)
|
if (props?.sexType != xxx.rjwSextype.Vaginal)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (pawn.IsVirgin())
|
||||||
{
|
{
|
||||||
if (pawn.IsVirgin())
|
pawn.TryGetComp<SexHistory.SexHistoryComp>()?.RecordFirst(partner, props);
|
||||||
|
int? removedDegree = Virginity.TraitHandler.RemoveVirginTrait(pawn);
|
||||||
|
if (removedDegree != null)
|
||||||
{
|
{
|
||||||
pawn.TryGetComp<SexHistory.SexHistoryComp>()?.RecordFirst(partner, props);
|
RJWUtility.ThrowVirginHIstoryEvent(pawn, partner, props, (int)removedDegree);
|
||||||
if (Virginity.TraitHandler.RemoveVirginTrait(pawn, partner, props))
|
Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true);
|
||||||
{
|
|
||||||
Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int? removedDegree = Virginity.TraitHandler.RemoveVirginTrait(pawn);
|
||||||
|
if (removedDegree != null)
|
||||||
{
|
{
|
||||||
Virginity.TraitHandler.RemoveVirginTrait(pawn, partner, props);
|
RJWUtility.ThrowVirginHIstoryEvent(pawn, partner, props, (int)removedDegree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,20 +46,19 @@ namespace RJWSexperience.Virginity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool RemoveVirginTrait(Pawn pawn, Pawn partner, SexProps props)
|
public static int? RemoveVirginTrait(Pawn pawn)
|
||||||
{
|
{
|
||||||
Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin);
|
Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin);
|
||||||
if (virgin == null)
|
if (virgin == null)
|
||||||
return false;
|
return null;
|
||||||
|
|
||||||
int degree = virgin.Degree;
|
int degree = virgin.Degree;
|
||||||
if (pawn.gender == Gender.Female && degree > 0 && !pawn.Dead)
|
if (pawn.gender == Gender.Female && degree > 0 && !pawn.Dead)
|
||||||
{
|
{
|
||||||
FilthMaker.TryMakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_Blood, pawn.LabelShort, 1, FilthSourceFlags.Pawn);
|
FilthMaker.TryMakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_Blood, pawn.LabelShort, 1, FilthSourceFlags.Pawn);
|
||||||
}
|
}
|
||||||
RJWUtility.ThrowVirginHIstoryEvent(pawn, partner, props, degree);
|
|
||||||
pawn.story.traits.RemoveTrait(virgin);
|
pawn.story.traits.RemoveTrait(virgin);
|
||||||
return true;
|
return degree;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue