Test arms and legs; body type based props

This commit is contained in:
c0ffee 2024-04-23 23:10:35 -07:00
parent 1ba5e0e117
commit df3a670d6f
20 changed files with 383 additions and 16 deletions

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<AnimationDef>
<defName>TestAnimation3</defName>
<durationTicks>400</durationTicks>
<playWhenDowned>False</playWhenDowned>
<animationParts>
<!--Note: Rotate animal body by setting body rotation, not head rotation; different for animals-->
<li>
<key>Root</key>
<value>
<workerClass>Rimworld_Animations.AnimationWorker_KeyframesExtended</workerClass>
<keyframes>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<sound>Fuck</sound>
<tick>30</tick>
<angle>90</angle>
<rotation>East</rotation>
<visible>true</visible>
</li>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<tick>100</tick>
<angle>80</angle>
<rotation>East</rotation>
<visible>true</visible>
</li>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<tick>200</tick>
<angle>90</angle>
<rotation>East</rotation>
<visible>true</visible>
</li>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<tick>300</tick>
<angle>80</angle>
<rotation>East</rotation>
<visible>true</visible>
</li>
</keyframes>
</value>
</li>
<li>
<key>Head</key>
<value>
<workerClass>Rimworld_Animations.AnimationWorker_KeyframesExtended</workerClass>
<keyframes>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<tick>0</tick>
<angle>-30</angle>
<rotation>East</rotation>
<visible>true</visible>
</li>
</keyframes>
</value>
</li>
<li>
<key>RenderNodeTag_Knees</key>
<value>
<workerClass>Rimworld_Animations.AnimationWorker_KeyframesExtended</workerClass>
<keyframes>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<variant>1</variant>
<tick>0</tick>
<angle>0</angle>
<visible>true</visible>
</li>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<variant>1</variant>
<tick>200</tick>
<angle>3</angle>
<visible>true</visible>
</li>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<variant>1</variant>
<tick>400</tick>
<angle>0</angle>
<visible>true</visible>
</li>
</keyframes>
</value>
</li>
<li>
<key>RenderNodeTag_Arms</key>
<value>
<workerClass>Rimworld_Animations.AnimationWorker_KeyframesExtended</workerClass>
<keyframes>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<variant>1</variant>
<tick>0</tick>
<angle>0</angle>
<visible>true</visible>
</li>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<variant>1</variant>
<tick>200</tick>
<angle>3</angle>
<visible>true</visible>
</li>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<variant>1</variant>
<tick>400</tick>
<angle>0</angle>
<visible>true</visible>
</li>
</keyframes>
</value>
</li>
</animationParts>
</AnimationDef>
</Defs>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<PawnRenderNodeTagDef>
<defName>RenderNodeTag_Knees</defName>
</PawnRenderNodeTagDef>
<Rimworld_Animations.AnimationPropDef>
<defName>AnimationProp_Knees</defName>
<animPropProperties Class="Rimworld_Animations.PawnRenderNodeProperties_BodyTypeVariants">
<debugLabel>Knees</debugLabel>
<nodeClass>Rimworld_Animations.PawnRenderNode_BodyTypeVariants</nodeClass>
<workerClass>Rimworld_Animations.PawnRenderNodeWorker_BodyTypeVariants</workerClass>
<tagDef>RenderNodeTag_Knees</tagDef>
<absoluteTransform>False</absoluteTransform>
<parentTagDef>Root</parentTagDef>
<!-- for height -->
<overlayLayer>Head</overlayLayer>
<useSkinShader>True</useSkinShader>
<colorType>Skin</colorType>
<baseLayer>95</baseLayer>
<bodyTypeVariantsDef>
<li>
<bodyType>Female</bodyType>
<texPathVariantsDef>TexPathVariants_Knees</texPathVariantsDef>
</li>
</bodyTypeVariantsDef>
</animPropProperties>
</Rimworld_Animations.AnimationPropDef>
<PawnRenderNodeTagDef>
<defName>RenderNodeTag_Arms</defName>
</PawnRenderNodeTagDef>
<Rimworld_Animations.AnimationPropDef>
<defName>AnimationProp_Arms</defName>
<animPropProperties Class="Rimworld_Animations.PawnRenderNodeProperties_BodyTypeVariants">
<debugLabel>Arms</debugLabel>
<nodeClass>Rimworld_Animations.PawnRenderNode_BodyTypeVariants</nodeClass>
<workerClass>Rimworld_Animations.PawnRenderNodeWorker_BodyTypeVariants</workerClass>
<tagDef>RenderNodeTag_Knees</tagDef>
<absoluteTransform>False</absoluteTransform>
<parentTagDef>Root</parentTagDef>
<useSkinShader>True</useSkinShader>
<colorType>Skin</colorType>
<!-- for height -->
<overlayLayer>Body</overlayLayer>
<baseLayer>-1</baseLayer>
<bodyTypeVariantsDef>
<li>
<bodyType>Female</bodyType>
<texPathVariantsDef>TexPathVariants_Arms</texPathVariantsDef>
</li>
</bodyTypeVariantsDef>
</animPropProperties>
</Rimworld_Animations.AnimationPropDef>
</Defs>

View File

@ -10,16 +10,16 @@
<li>
<probability>3</probability>
<animationDefs>
<li>TestAnimation1</li>
<li>TestAnimation2</li>
<li>TestAnimation3</li>
<li>TestAnimation3</li>
</animationDefs>
</li>
<li>
<probability>1</probability>
<animationDefs>
<li>TestAnimation1</li>
<li>TestAnimation2</li>
<li>TestAnimation3</li>
<li>TestAnimation3</li>
</animationDefs>
</li>
</loopOptions>
@ -49,7 +49,6 @@
<li>Sex_Reverse_Anal</li>
<li>Sex_Reverse_Vaginal</li>
</interactionDefs>
</li>
</contexts>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<Rimworld_Animations.TexPathVariantsDef>
<defName>TexPathVariants_Arms</defName>
<variants>
<li>AnimationProps/Doggystyle/Doggy_Arms</li>
</variants>
</Rimworld_Animations.TexPathVariantsDef>
</Defs>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<Rimworld_Animations.TexPathVariantsDef>
<defName>TexPathVariants_Knees</defName>
<variants>
<li>AnimationProps/Doggystyle/Doggy_Legs</li>
</variants>
</Rimworld_Animations.TexPathVariantsDef>
</Defs>

View File

@ -196,10 +196,6 @@ namespace Rimworld_Animations {
{
PawnRenderNodeProperties props = animationProp.animPropProperties;
if (props.texPath.NullOrEmpty())
{
props.texPath = "AnimationProps/Banana/Banana";
}
//create new render node
PawnRenderNode animRenderNode = (PawnRenderNode)Activator.CreateInstance(props.nodeClass, new object[] {

View File

@ -82,8 +82,23 @@ namespace Rimworld_Animations {
public static void Prefix(ref JobDriver_SexBaseInitiator __instance)
{
//stop pawn animating
AnimationUtility.StopGroupAnimation(__instance.pawn);
//stop partner animating
if (__instance.Partner is Pawn partner)
{
AnimationUtility.StopGroupAnimation(partner);
}
//stop partner's other partners (threesome pawns) animating
if (__instance.Partner.jobs.curDriver is JobDriver_SexBaseReciever partnerReceiverJob)
{
foreach(Pawn pawn in partnerReceiverJob.parteners)
{
if (pawn != null) AnimationUtility.StopGroupAnimation(pawn);
}
}
}
}
}

View File

@ -12,6 +12,10 @@ namespace Rimworld_Animations
[HarmonyPatch(typeof(JobDriver_SexBaseRecieverRaped), "MakeNewToils")]
public class HarmonyPatch_JobDriver_SexBaseReceiverRaped
{
/*
* Doesn't work; ienumerables are read-only, can't modify toil
* would need to harmonypatch; stopped partner animating in sexbaseinitiator instead
*
public static void Postfix(JobDriver_SexBaseRecieverRaped __instance, ref IEnumerable<Toil> __result)
{
//added for sudden end of jobdriver
@ -19,5 +23,7 @@ namespace Rimworld_Animations
AnimationUtility.StopGroupAnimation(__instance.pawn);
});
}
*/
}
}

View File

@ -0,0 +1,27 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace Rimworld_Animations
{
public class PawnRenderNodeProperties_BodyTypeVariants : PawnRenderNodeProperties_GraphicVariants
{
public List<TexPathVariants_BodyType> bodyTypeVariantsDef;
}
public class TexPathVariants_BodyType
{
public BodyTypeDef bodyType;
public TexPathVariantsDef texPathVariantsDef;
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Rimworld_Animations
{
public class PawnRenderNodeWorker_BodyTypeVariants : PawnRenderNodeWorker_GraphicVariants
{
//same functionality as graphicvariants worker
//just here for readability
}
}

View File

@ -0,0 +1,58 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace Rimworld_Animations
{
public class PawnRenderNode_BodyTypeVariants : PawnRenderNode_GraphicVariants
{
protected new PawnRenderNodeProperties_BodyTypeVariants props;
public PawnRenderNode_BodyTypeVariants(Pawn pawn, PawnRenderNodeProperties props, PawnRenderTree tree) : base(pawn, props, tree)
{
this.props = (PawnRenderNodeProperties_BodyTypeVariants)props;
}
protected override Dictionary<int, Graphic> GraphicVariantsFor(Pawn pawn)
{
if (props.bodyTypeVariantsDef == null)
{
Log.ErrorOnce("[Anims] Error: Tried to use BodyTypeVariants node, but bodyTypeVariants weren't given", 211341349);
return null;
}
//for each different hediff-based texpathvariants,
foreach (TexPathVariants_BodyType texPathVariant_BodyType in props.bodyTypeVariantsDef)
{
if (pawn.story.bodyType == texPathVariant_BodyType.bodyType)
{
//return that specific variant
return GenerateVariants(pawn, texPathVariant_BodyType.texPathVariantsDef);
}
}
//otherwise just use default
return base.GraphicVariantsFor(pawn);
}
protected override void EnsureMaterialsInitialized()
{
variants = GraphicVariantsFor(this.tree.pawn);
base.EnsureMaterialsInitialized();
}
}
}

View File

@ -23,6 +23,12 @@ namespace Rimworld_Animations
protected override Dictionary<int, Graphic> GraphicVariantsFor(Pawn pawn)
{
if (props.hediffVariants == null)
{
Log.ErrorOnce("[Anims] Error: Tried to use GraphicHediffVariants node, but hediffVariants weren't given", 231321349);
return null;
}
//for each different hediff-based texpathvariants,
foreach (TexPathVariants_Hediff texPathVariant_Hediff in props.hediffVariants)
{

View File

@ -40,6 +40,7 @@ namespace Rimworld_Animations
&& extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick) != null)
{
Material materialVariant = GetMaterialVariant(nodeWithGraphicVariants, parms, (int)extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick));
if (materialVariant != null) {
return materialVariant;
}
@ -52,11 +53,11 @@ namespace Rimworld_Animations
public virtual Material GetMaterialVariant(PawnRenderNode_GraphicVariants node, PawnDrawParms parms, int variant)
{
Material material = node.getGraphicVariant(variant).NodeGetMat(parms);
Material material = node.getGraphicVariant(variant)?.NodeGetMat(parms);
if (material == null) return null;
if (material != null && !parms.Portrait && parms.flags.FlagSet(PawnRenderFlags.Invisible))
if (!parms.Portrait && parms.flags.FlagSet(PawnRenderFlags.Invisible))
{
material = InvisibilityMatPool.GetInvisibleMat(material);
}

View File

@ -16,9 +16,8 @@ namespace Rimworld_Animations
public Graphic getGraphicVariant(int variant)
{
if (!variants.ContainsKey(variant))
if (variants == null || !variants.ContainsKey(variant))
{
Log.ErrorOnce("[Anims] Error: tried to get key from variants that doesn't exist; key = " + variant, 2043428111);
return null;
}
@ -45,17 +44,21 @@ namespace Rimworld_Animations
protected virtual Dictionary<int, Graphic> GraphicVariantsFor(Pawn pawn)
{
if (props.texPathVariantsDef == null)
{
return null;
}
return GenerateVariants(pawn, props.texPathVariantsDef);
}
//used by all, including base classes, to create texPathVariants for pawn
protected Dictionary<int, Graphic> GenerateVariants(Pawn pawn, TexPathVariantsDef texPathVariants)
{
Dictionary<int, Graphic> variantGraphics = new Dictionary<int, Graphic>();
if (texPathVariants == null) return variantGraphics;
//for each graphic variant
for (int i = 0; i < texPathVariants.variants.Count; i++)
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<LanguageData>
<!-- Mod menu -->
<RimAnim_ModSettings>RJW Animation Settings</RimAnim_ModSettings>
<RimAnim_SoundOverride>启用声音覆盖</RimAnim_SoundOverride>
<RimAnim_GenitalRotation>控制生殖器旋转</RimAnim_GenitalRotation>
<RimAnim_OrgasmQuiver>启用高潮颤抖</RimAnim_OrgasmQuiver>
<RimAnim_RapeShiver>启用强奸颤动</RimAnim_RapeShiver>
<RimAnim_HeartsDuringLovin>性爱时启用心形</RimAnim_HeartsDuringLovin>
<RimAnim_PlayNonsexual>播放非性行为的动画 (牵手、亲热)</RimAnim_PlayNonsexual>
<RimAnim_AnimManagerTab>启用动画管理器选项卡</RimAnim_AnimManagerTab>
<RimAnim_ShiverIntensity>颤抖/颤动强度 (默认为 2): </RimAnim_ShiverIntensity>
<RimAnim_DebugMode>调试模式</RimAnim_DebugMode>
<!-- Main Tab Window -->
<RimAnims_AnimManager>Animation Manager</RimAnims_AnimManager>
<RimAnims_Warning>警告--一般情况下,你不想更改人类偏移值,只想更改外星種族偏移值或动物偏移值</RimAnims_Warning>
<RimAnims_CopyToClipboard>将偏移值复制到剪贴板</RimAnims_CopyToClipboard>
<RimAnims_ShareSettings>将偏移值粘贴到 OffsetDef 中,或在 Discord 中共享</RimAnims_ShareSettings>
</LanguageData>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<LanguageData>
<!-- Mod menu -->
<RimAnim_ModSettings>RJW Animation Settings</RimAnim_ModSettings>
<RimAnim_SoundOverride>啟用聲音覆蓋</RimAnim_SoundOverride>
<RimAnim_GenitalRotation>控制生殖器旋轉</RimAnim_GenitalRotation>
<RimAnim_OrgasmQuiver>啟用高潮顫抖</RimAnim_OrgasmQuiver>
<RimAnim_RapeShiver>啟用強姦顫動</RimAnim_RapeShiver>
<RimAnim_HeartsDuringLovin>性愛時啟用心形</RimAnim_HeartsDuringLovin>
<RimAnim_PlayNonsexual>播放非性行為的動畫 (牽手、親熱)</RimAnim_PlayNonsexual>
<RimAnim_AnimManagerTab>啟用動畫管理器選項卡</RimAnim_AnimManagerTab>
<RimAnim_ShiverIntensity>顫抖/顫動強度 (預設為 2): </RimAnim_ShiverIntensity>
<RimAnim_DebugMode>除錯模式</RimAnim_DebugMode>
<!-- Main Tab Window -->
<RimAnims_AnimManager>Animation Manager</RimAnims_AnimManager>
<RimAnims_Warning>警告--一般情況下,你不想更改人類偏移值,只想更改外星種族偏移值或動物偏移值</RimAnims_Warning>
<RimAnims_CopyToClipboard>將偏移值複製到剪貼板</RimAnims_CopyToClipboard>
<RimAnims_ShareSettings>將偏移值黏貼到 OffsetDef 中,或在 Discord 中共享</RimAnims_ShareSettings>
</LanguageData>

View File

@ -118,6 +118,9 @@
<Compile Include="1.5\Source\Patches\RJWPatches\JobDrivers\HarmonyPatch_JobDriver_SexBaseInitiator.cs" />
<Compile Include="1.5\Source\Patches\RJWPatches\JobDrivers\SexBaseReceivers\HarmonyPatch_JobDriver_SexBaseReceiverRaped.cs" />
<Compile Include="1.5\Source\Patches\RJWPatches\JobDrivers\SexBaseReceivers\HarmonyPatch_JobDriver_SexBaseReceiverLoved.cs" />
<Compile Include="1.5\Source\PawnRenderNode\GraphicBodyTypeVariants\PawnRenderNodeProperties_GraphicBodyTypeVariants.cs" />
<Compile Include="1.5\Source\PawnRenderNode\GraphicBodyTypeVariants\PawnRenderNodeWorker_GraphicBodyTypeVariants.cs" />
<Compile Include="1.5\Source\PawnRenderNode\GraphicBodyTypeVariants\PawnRenderNode_GraphicBodyTypeVariants.cs" />
<Compile Include="1.5\Source\PawnRenderNode\GraphicHediffVariants\PawnRenderNodeProperties_GraphicHediffVariants.cs" />
<Compile Include="1.5\Source\PawnRenderNode\GraphicHediffVariants\PawnRenderNodeWorker_GraphicHediffVariants.cs" />
<Compile Include="1.5\Source\PawnRenderNode\GraphicHediffVariants\PawnRenderNode_GraphicHediffVariants.cs" />
@ -136,6 +139,8 @@
<Content Include="1.5\Assemblies\RJW.dll" />
<Content Include="1.5\Defs\AnimationDefs\TestAnimation1.xml" />
<Content Include="1.5\Defs\AnimationDefs\TestAnimation2.xml" />
<Content Include="1.5\Defs\AnimationDefs\TestAnimation3.xml" />
<Content Include="1.5\Defs\AnimationPropDefs\AnimationPropDef_Knees.xml" />
<Content Include="1.5\Defs\AnimationPropDefs\AnimationPropDef_Xray_Inside.xml" />
<Content Include="1.5\Defs\AnimationPropDefs\AnimationPropDef_Banana.xml" />
<Content Include="1.5\Defs\AnimationPropDefs\AnimationPropDef_Xray_Penis.xml" />
@ -144,6 +149,8 @@
<Content Include="1.5\Defs\OffsetDefs\OffsetDef_GroinToAppropriateHeight.xml" />
<Content Include="1.5\Defs\SoundDefs\Sounds_Sex.xml" />
<Content Include="1.5\Defs\TexPathVariantsDefs\TexPathVariants_Cat.xml" />
<Content Include="1.5\Defs\TexPathVariantsDefs\TexPathVariants_Arms.xml" />
<Content Include="1.5\Defs\TexPathVariantsDefs\TexPathVariants_Knees.xml" />
<Content Include="1.5\Defs\TexPathVariantsDefs\TexPathVariants_Xray_Inside.xml" />
<Content Include="1.5\Defs\TexPathVariantsDefs\TexPathVariants_XrayPenis_Horse.xml" />
<Content Include="1.5\Defs\TexPathVariantsDefs\TexPathVariants_XrayPenis_Human.xml" />
@ -188,6 +195,8 @@
<Content Include="1.5\Textures\AnimationProps\Banana\Banana_north.png" />
<Content Include="1.5\Textures\AnimationProps\Banana\Banana_south.png" />
<Content Include="1.5\Textures\AnimationProps\Banana\Banana_west.png" />
<Content Include="1.5\Textures\AnimationProps\Doggystyle\Doggy_Arms_north.png" />
<Content Include="1.5\Textures\AnimationProps\Doggystyle\Doggy_Legs_north.png" />
<Content Include="1.5\Textures\UI\MainTab.png" />
<Content Include="About\About.xml" />
<Content Include="About\Manifest.xml" />