mirror of
https://gitgud.io/AbstractConcept/rimworld-animations-patch.git
synced 2024-08-15 00:43:27 +00:00
v 1.2.2
This commit is contained in:
parent
dab724fb50
commit
f089b94044
46 changed files with 2631 additions and 393 deletions
|
@ -15,7 +15,7 @@ namespace Rimworld_Animations_Patch
|
|||
public Vector3 position;
|
||||
public float rotation = 0f;
|
||||
|
||||
public bool isBeingWorn = true;
|
||||
public bool? isBeingWorn = null;
|
||||
public bool coversChest = false;
|
||||
public bool coversGroin = false;
|
||||
public bool coversBelly = false;
|
||||
|
|
86
Source/Scripts/Comps/CompPawnSexData.cs
Normal file
86
Source/Scripts/Comps/CompPawnSexData.cs
Normal file
|
@ -0,0 +1,86 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using AlienRace;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Rimworld_Animations_Patch
|
||||
{
|
||||
public class CompPawnSexData : ThingComp
|
||||
{
|
||||
public HandAnimationDef handAnimationDef = null;
|
||||
public Graphic handGraphic = null;
|
||||
|
||||
public List<BodyPartRecord> hands = new List<BodyPartRecord>();
|
||||
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;
|
||||
private int lastExclaimationTick = -1;
|
||||
private int exclaimationCoolDown = 90;
|
||||
|
||||
public BodyAddonData GetBodyAddonData(AlienPartGenerator.BodyAddon bodyAddon, bool isPortrait)
|
||||
{
|
||||
if (pawn == null)
|
||||
{ pawn = parent as Pawn; }
|
||||
|
||||
if (pawn == null || pawn.Map != Find.CurrentMap || 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 UpdateHands()
|
||||
{
|
||||
hands = pawn?.health?.hediffSet?.GetNotMissingParts()?.Where(x => x.def.tags.Contains(BodyPartTagDefOf.ManipulationLimbCore))?.ToList();
|
||||
}
|
||||
|
||||
public int GetNumberOfHands()
|
||||
{
|
||||
if (hands.NullOrEmpty()) return 0;
|
||||
|
||||
return hands.Count;
|
||||
}
|
||||
|
||||
public void TryToExclaim()
|
||||
{
|
||||
if (Find.TickManager.TicksGame > exclaimationCoolDown + lastExclaimationTick)
|
||||
{
|
||||
lastExclaimationTick = Find.TickManager.TicksGame;
|
||||
FleckMaker.ThrowMetaIcon(pawn.Position, pawn.Map, FleckDefOf.IncapIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
|
||||
namespace Rimworld_Animations_Patch
|
||||
{
|
||||
|
@ -12,4 +10,4 @@ namespace Rimworld_Animations_Patch
|
|||
base.compClass = typeof(CompApparelVisibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
13
Source/Scripts/Comps/CompProperties_PawnSexData.cs
Normal file
13
Source/Scripts/Comps/CompProperties_PawnSexData.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations_Patch
|
||||
{
|
||||
public class CompProperties_PawnSexData : CompProperties
|
||||
{
|
||||
public CompProperties_PawnSexData()
|
||||
{
|
||||
base.compClass = typeof(CompPawnSexData);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue