mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
Compare commits
4 commits
8a93f3b087
...
8ed52c0696
Author | SHA1 | Date | |
---|---|---|---|
|
8ed52c0696 | ||
|
a491c1dade | ||
|
d36c2b8314 | ||
|
6d174dbce4 |
13 changed files with 142 additions and 2 deletions
Binary file not shown.
|
@ -19,6 +19,10 @@
|
|||
<overlayLayer>Head</overlayLayer>
|
||||
<baseLayer>95</baseLayer>
|
||||
<texPathVariantsDef>TexPathVariants_Cowgirl_Xray</texPathVariantsDef>
|
||||
|
||||
<!-- <propOffsetDef>PropOffsetDef_Cowgirl_Xray</propOffsetDef> -->
|
||||
|
||||
|
||||
</animPropProperties>
|
||||
</Rimworld_Animations.AnimationPropDef>
|
||||
|
||||
|
|
|
@ -15,6 +15,11 @@ namespace Rimworld_Animations
|
|||
{
|
||||
}
|
||||
|
||||
public override bool Enabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override Vector3 OffsetAtTick(int tick, PawnDrawParms parms)
|
||||
{
|
||||
//Todo: Use this for bodyoffsets
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations
|
||||
{
|
||||
|
||||
[HarmonyPatch(typeof(PawnRenderer), "BodyAngle")]
|
||||
|
||||
public class HarmonyPatch_PawnRenderer
|
||||
{
|
||||
public static bool Prefix(ref Pawn ___pawn, ref float __result)
|
||||
{
|
||||
//stop using cache when animating, for when downed (downed disables cache)
|
||||
if (___pawn?.Drawer?.renderer?.renderTree?.rootNode?.AnimationWorker is AnimationWorker_KeyframesExtended)
|
||||
{
|
||||
__result = 0;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -10,6 +10,7 @@ namespace Rimworld_Animations
|
|||
public class PawnRenderNodeProperties_GraphicVariants : PawnRenderNodeProperties
|
||||
{
|
||||
|
||||
public AnimationOffsetDef propOffsetDef = null;
|
||||
public TexPathVariantsDef texPathVariantsDef = null;
|
||||
public bool absoluteTransform = false;
|
||||
|
||||
|
|
|
@ -61,9 +61,51 @@ namespace Rimworld_Animations
|
|||
|
||||
return material;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override Vector3 OffsetFor(PawnRenderNode node, PawnDrawParms parms, out Vector3 pivot)
|
||||
{
|
||||
Vector3 regularOffsets = base.OffsetFor(node, parms, out pivot);
|
||||
|
||||
if ((node.Props as PawnRenderNodeProperties_GraphicVariants)?.propOffsetDef?.offsets is List<BaseAnimationOffset> offsets)
|
||||
{
|
||||
foreach (BaseAnimationOffset offset in offsets)
|
||||
{
|
||||
if (offset.appliesToPawn(node.tree.pawn))
|
||||
{
|
||||
//modify offset of prop for animationOffset position
|
||||
regularOffsets += offset.getOffset(node.tree.pawn) ?? Vector3.zero;
|
||||
return regularOffsets;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//unmodified; no offsets found
|
||||
return regularOffsets;
|
||||
}
|
||||
|
||||
public override Quaternion RotationFor(PawnRenderNode node, PawnDrawParms parms)
|
||||
{
|
||||
Quaternion rotation = base.RotationFor(node, parms);
|
||||
|
||||
if ((node.Props as PawnRenderNodeProperties_GraphicVariants)?.propOffsetDef?.offsets is List<BaseAnimationOffset> offsets)
|
||||
{
|
||||
foreach (BaseAnimationOffset offset in offsets)
|
||||
{
|
||||
if (offset.appliesToPawn(node.tree.pawn))
|
||||
{
|
||||
//modify offset of prop for animationOffset rotation
|
||||
rotation *= Quaternion.AngleAxis(offset.getRotation(node.tree.pawn) ?? 0, Vector3.up);
|
||||
return rotation;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//unmodified; no rotation offsets found
|
||||
return rotation;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Rimworld_Animations
|
|||
|
||||
return GenerateVariants(pawn, props.texPathVariantsDef);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected override void EnsureMaterialsInitialized()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations
|
||||
{
|
||||
public class PawnRenderSubWorker_HideWhenAnimating : PawnRenderSubWorker
|
||||
{
|
||||
|
||||
public override void EditMaterial(PawnRenderNode node, PawnDrawParms parms, ref Material material)
|
||||
{
|
||||
if (node.tree.rootNode.AnimationWorker is AnimationWorker_KeyframesExtended
|
||||
|| node.tree.rootNode.children.Any(x => x.AnimationWorker is AnimationWorker_KeyframesExtended))
|
||||
{
|
||||
material.color = Color.clear;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -29,6 +29,7 @@
|
|||
<li>1.5</li>
|
||||
<li IfModActive="erdelf.HumanoidAlienRaces">Patch_HumanoidAlienRaces/1.5</li>
|
||||
<li IfModActive="c0ffee.SexToysMasturbation">Patch_SexToysMasturbation/1.5</li>
|
||||
<li IfModActive="Nals.FacialAnimation">Patch_FacialAnimation/1.5</li>
|
||||
</v1.5>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Patch>
|
||||
<!-- hide node when animating -->
|
||||
<Operation Class="PatchOperationSequence">
|
||||
<success>Always</success>
|
||||
<operations>
|
||||
<li Class="PatchOperationConditional">
|
||||
<xpath>/Defs/PawnRenderTreeDef[defName="Humanlike"]/root/children/li[debugLabel="Head"]/subworkerClasses</xpath>
|
||||
<success>Always</success>
|
||||
<nomatch Class="PatchOperationAdd">
|
||||
<xpath>/Defs/PawnRenderTreeDef[defName="Humanlike"]/root/children/li[debugLabel="Head"]</xpath>
|
||||
<value>
|
||||
<subworkerClasses />
|
||||
</value>
|
||||
</nomatch>
|
||||
</li>
|
||||
|
||||
<li Class="PatchOperationAdd">
|
||||
<xpath>/Defs/PawnRenderTreeDef[defName="Humanlike"]/root/children/li[debugLabel="Head"]/subworkerClasses</xpath>
|
||||
<value>
|
||||
<li>Rimworld_Animations.PawnRenderSubWorker_HideWhenAnimating</li>
|
||||
</value>
|
||||
</li>
|
||||
</operations>
|
||||
</Operation>
|
||||
|
||||
</Patch>
|
Binary file not shown.
Binary file not shown.
|
@ -104,6 +104,7 @@
|
|||
<Compile Include="1.5\Source\MainTabWindows\OffsetMainButtonDefOf.cs" />
|
||||
<Compile Include="1.5\Source\MainTabWindows\WorldComponent_UpdateMainTab.cs" />
|
||||
<Compile Include="1.5\Source\Patches\Harmony_PatchAll.cs" />
|
||||
<Compile Include="1.5\Source\Patches\RimworldPatches\HarmonyPatch_PawnRenderer.cs" />
|
||||
<Compile Include="1.5\Source\Patches\RimworldPatches\HarmonyPatch_PawnRenderNode.cs" />
|
||||
<Compile Include="1.5\Source\Patches\RimworldPatches\HarmonyPatch_PawnRenderNodeWorker.cs" />
|
||||
<Compile Include="1.5\Source\Patches\RimworldPatches\HarmonyPatch_PawnRenderTree.cs" />
|
||||
|
@ -133,6 +134,7 @@
|
|||
<Compile Include="1.5\Source\PawnRenderNode\TexPathVariants.cs" />
|
||||
<Compile Include="1.5\Source\RenderSubWorkers\PawnRenderSubWorker_ChangeOffset.cs" />
|
||||
<Compile Include="1.5\Source\Patches\RJWPatches\RJWAnimationSettings.cs" />
|
||||
<Compile Include="1.5\Source\RenderSubWorkers\PawnRenderSubWorker_HideWhenAnimating.cs" />
|
||||
<Compile Include="1.5\Source\Utilities\AnimationUtility.cs" />
|
||||
<Compile Include="1.5\Source\Voices\VoiceDef.cs" />
|
||||
<Compile Include="1.5\Source\Voices\VoiceDefOf.cs" />
|
||||
|
@ -319,6 +321,7 @@
|
|||
<Content Include="Languages\PortugueseBrazilian\DefInjected\Rimworld_Animations.AnimationDef\Animations_Multi.xml" />
|
||||
<Content Include="Languages\PortugueseBrazilian\DefInjected\Rimworld_Animations.AnimationDef\Animations_vanilla.xml" />
|
||||
<Content Include="LoadFolders.xml" />
|
||||
<Content Include="Patch_FacialAnimation\1.5\Patches\AnimationPatch_HideHeadWhenAnimating.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="1.5\Source\Extensions\" />
|
||||
|
|
Loading…
Reference in a new issue