mirror of
https://gitgud.io/AbstractConcept/rimworld-animations-patch.git
synced 2024-08-15 00:43:27 +00:00
003b67fb97
- Fixed an issue with the orgasm not filling in some circumstances - Fixed a bug with sex overdrive not applying correctly - Fixed an issue with 'on orgasm' events not triggering correctly
97 lines
3.6 KiB
C#
97 lines
3.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using RimWorld;
|
|
using Verse;
|
|
using AlienRace;
|
|
using UnityEngine;
|
|
using rjw;
|
|
|
|
namespace Rimworld_Animations_Patch
|
|
{
|
|
public class CompPawnSexData : ThingComp
|
|
{
|
|
public HandAnimationDef handAnimationDef = null;
|
|
public Graphic handGraphic = null;
|
|
|
|
public List<BodyPartRecord> hands = new List<BodyPartRecord>();
|
|
public float sizeOfPenis = 0f;
|
|
public float sizeOfBreasts = 0f;
|
|
|
|
public Dictionary<AlienPartGenerator.BodyAddon, BodyAddonData> bodyAddonData = new Dictionary<AlienPartGenerator.BodyAddon, BodyAddonData>();
|
|
public Dictionary<AlienPartGenerator.BodyAddon, BodyAddonData> bodyAddonDataPortraits = new Dictionary<AlienPartGenerator.BodyAddon, BodyAddonData>();
|
|
|
|
private Pawn pawn { get { return parent as Pawn; } }
|
|
private bool initialized;
|
|
|
|
// Refresh graphics on load
|
|
public override void CompTick()
|
|
{
|
|
if (initialized == false)
|
|
{
|
|
pawn?.Drawer?.renderer?.graphics?.ResolveAllGraphics();
|
|
|
|
//if (pawn?.jobs?.curDriver is JobDriver_SexBaseInitiator && pawn.pather.Moving == false)
|
|
//{ (pawn.jobs.curDriver as JobDriver_SexBaseInitiator).Start(); }
|
|
|
|
initialized = true;
|
|
}
|
|
}
|
|
|
|
public BodyAddonData GetBodyAddonData(AlienPartGenerator.BodyAddon bodyAddon, bool isPortrait)
|
|
{
|
|
if (pawn == null || (pawn.Map != Find.CurrentMap && pawn.holdingOwner == null) || bodyAddon == null) return null;
|
|
|
|
if (isPortrait)
|
|
{
|
|
if (bodyAddonDataPortraits.TryGetValue(bodyAddon, out BodyAddonData bodyAddonDatum) == false)
|
|
{
|
|
bodyAddonDatum = new BodyAddonData(pawn, bodyAddon, true);
|
|
bodyAddonDataPortraits.Add(bodyAddon, bodyAddonDatum);
|
|
}
|
|
|
|
return bodyAddonDatum;
|
|
}
|
|
|
|
else
|
|
{
|
|
if (bodyAddonData.TryGetValue(bodyAddon, out BodyAddonData bodyAddonDatum) == false)
|
|
{
|
|
bodyAddonDatum = new BodyAddonData(pawn, bodyAddon);
|
|
bodyAddonData.Add(bodyAddon, bodyAddonDatum);
|
|
}
|
|
|
|
return bodyAddonDatum;
|
|
}
|
|
}
|
|
|
|
public void UpdateBodyAddonVisibility()
|
|
{
|
|
foreach (KeyValuePair<AlienPartGenerator.BodyAddon, BodyAddonData> kvp in bodyAddonData)
|
|
{ kvp.Value?.UpdateVisibility(); }
|
|
|
|
foreach (KeyValuePair<AlienPartGenerator.BodyAddon, BodyAddonData> kvp in bodyAddonDataPortraits)
|
|
{ kvp.Value?.UpdateVisibility(); }
|
|
}
|
|
|
|
public void UpdateBodyPartCountAndSize()
|
|
{
|
|
hands = pawn?.health?.hediffSet?.GetNotMissingParts()?.Where(x => x.def.tags.Contains(RimWorld.BodyPartTagDefOf.ManipulationLimbCore))?.ToList();
|
|
|
|
Hediff hediffPenis = pawn?.health?.hediffSet?.hediffs?.FirstOrDefault(x => x.def.defName.Contains("penis", StringComparison.OrdinalIgnoreCase) == true);
|
|
sizeOfPenis = hediffPenis != null ? hediffPenis.Severity : 0f;
|
|
|
|
Hediff hediffBreasts = pawn?.health?.hediffSet?.hediffs?.FirstOrDefault(x => x.def.defName.Contains("breasts", StringComparison.OrdinalIgnoreCase) == true);
|
|
sizeOfBreasts = hediffBreasts != null ? hediffBreasts.Severity : 0f;
|
|
}
|
|
|
|
public int GetNumberOfHands()
|
|
{
|
|
if (hands.NullOrEmpty()) return 0;
|
|
|
|
return hands.Count;
|
|
}
|
|
}
|
|
}
|