mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
Added dynamic prop rendering system to extendedanimator
rendernodes dynamically attach and remove per animation configure props in AnimationPropDef
This commit is contained in:
parent
0de9346eac
commit
9621dc2841
14 changed files with 156 additions and 17 deletions
Binary file not shown.
|
@ -98,6 +98,35 @@
|
|||
</keyframes>
|
||||
</value>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<key>RenderNodeTag_Banana</key>
|
||||
<value>
|
||||
<workerClass>Rimworld_Animations.AnimationWorker_KeyframesExtended</workerClass>
|
||||
<keyframes>
|
||||
<li Class="Rimworld_Animations.ExtendedKeyframe">
|
||||
<tick>30</tick>
|
||||
<angle>0</angle>
|
||||
<visible>true</visible>
|
||||
</li>
|
||||
<li Class="Rimworld_Animations.ExtendedKeyframe">
|
||||
<tick>100</tick>
|
||||
<angle>0</angle>
|
||||
<visible>false</visible>
|
||||
</li>
|
||||
<li Class="Rimworld_Animations.ExtendedKeyframe">
|
||||
<tick>200</tick>
|
||||
<angle>0</angle>
|
||||
<visible>true</visible>
|
||||
</li>
|
||||
<li Class="Rimworld_Animations.ExtendedKeyframe">
|
||||
<tick>300</tick>
|
||||
<angle>0</angle>
|
||||
<visible>true</visible>
|
||||
</li>
|
||||
</keyframes>
|
||||
</value>
|
||||
</li>
|
||||
</animationParts>
|
||||
</AnimationDef>
|
||||
</Defs>
|
||||
|
|
25
1.5/Defs/AnimationPropDefs/AnimationPropDef.xml
Normal file
25
1.5/Defs/AnimationPropDefs/AnimationPropDef.xml
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
|
||||
<PawnRenderNodeTagDef>
|
||||
<defName>RenderNodeTag_Banana</defName>
|
||||
</PawnRenderNodeTagDef>
|
||||
|
||||
<Rimworld_Animations.AnimationPropDef>
|
||||
<defName>AnimationProp_Banana</defName>
|
||||
|
||||
<!-- Note: props always return graphic_multi; set cardinal textures to blank and only north in anim if only one tex-->
|
||||
<!-- or draw east, south, and west directions, use them in animations? -->
|
||||
<animPropProperties>
|
||||
<debugLabel>AnimProp_Banana</debugLabel>
|
||||
<workerClass>Rimworld_Animations.PawnRenderNodeWorker_AnimationProp</workerClass>
|
||||
<tagDef>RenderNodeTag_Banana</tagDef>
|
||||
<parentTagDef>Body</parentTagDef>
|
||||
<texPath>AnimationProps/Banana/Banana</texPath>
|
||||
<!-- for height -->
|
||||
<overlayLayer>Head</overlayLayer>
|
||||
<baseLayer>95</baseLayer>
|
||||
|
||||
</animPropProperties>
|
||||
</Rimworld_Animations.AnimationPropDef>
|
||||
</Defs>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
<Rimworld_Animations.AnimationPropDef>
|
||||
<tagDef>Root</tagDef>
|
||||
<renderNode>
|
||||
<debugLabel>Hand</debugLabel>
|
||||
<nodeClass>PawnRenderNode</nodeClass>
|
||||
<graphic>P</graphic>
|
||||
</renderNode>
|
||||
</Rimworld_Animations.AnimationPropDef>
|
||||
</Defs>
|
16
1.5/Source/AnimationProps/AnimationPropDef.cs
Normal file
16
1.5/Source/AnimationProps/AnimationPropDef.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations
|
||||
{
|
||||
public class AnimationPropDef : Def
|
||||
{
|
||||
|
||||
public PawnRenderNodeProperties animPropProperties;
|
||||
|
||||
}
|
||||
}
|
|
@ -124,9 +124,57 @@ namespace Rimworld_Animations {
|
|||
|
||||
}
|
||||
|
||||
public static void CheckRecacheNecessary(int anim)
|
||||
public override List<PawnRenderNode> CompRenderNodes()
|
||||
{
|
||||
//only if pawn is animating for performance
|
||||
if (IsAnimating)
|
||||
{
|
||||
List<PawnRenderNode> animRenderNodes = new List<PawnRenderNode>();
|
||||
|
||||
// for all animationpropdefs,
|
||||
foreach (AnimationPropDef animationProp in DefDatabase<AnimationPropDef>.AllDefsListForReading)
|
||||
{
|
||||
//if animation makes use of prop,
|
||||
if (AnimationMakesUseOfProp(animationProp))
|
||||
{
|
||||
//create new render node
|
||||
PawnRenderNode animRenderNode = new PawnRenderNode(pawn, animationProp.animPropProperties, pawn.Drawer.renderer.renderTree);
|
||||
animRenderNodes.Add(animRenderNode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//return list of rendernodes that should animate
|
||||
return animRenderNodes;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool AnimationMakesUseOfProp(AnimationPropDef animationProp)
|
||||
{
|
||||
// never true if not animating; anim props shouldn't be attached
|
||||
if (!IsAnimating) return false;
|
||||
|
||||
//for all queued animations,
|
||||
foreach (AnimationDef animation in animationQueue)
|
||||
{
|
||||
// for each prop tag in the currently playing animation,
|
||||
foreach (PawnRenderNodeTagDef propTag in animation.animationParts.Keys)
|
||||
{
|
||||
// if that proptag is the same as the one for animationProp,
|
||||
if (propTag == animationProp.animPropProperties.tagDef)
|
||||
{
|
||||
//that prop is being used in the animation
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Pawn pawn => base.parent as Pawn;
|
||||
|
|
|
@ -10,8 +10,7 @@ namespace Rimworld_Animations
|
|||
{
|
||||
public class ExtendedKeyframe : Verse.Keyframe
|
||||
{
|
||||
|
||||
public Rot4 rotation;
|
||||
public Rot4 rotation = Rot4.North;
|
||||
public SoundDef sound = null;
|
||||
public bool visible = true;
|
||||
|
||||
|
|
|
@ -9,7 +9,9 @@ using Verse;
|
|||
|
||||
namespace Rimworld_Animations
|
||||
{
|
||||
//Head Rotation Code - Textures
|
||||
// Head Rotation Code - Textures
|
||||
// it's fine to just edit each AppendRequests individually
|
||||
// because they all the parms are passed down to each child node recursively
|
||||
[HarmonyPatch(typeof(PawnRenderNode), "AppendRequests")]
|
||||
public static class HarmonyPatch_PawnRenderNode
|
||||
{
|
||||
|
@ -28,7 +30,9 @@ namespace Rimworld_Animations
|
|||
//replace maybe?
|
||||
|
||||
//cheaper call now comparing prev tick to cur tick
|
||||
return extendedAnimWorker.visibleAtTick(__instance.tree.AnimationTick);
|
||||
|
||||
//not necessary because of new rendernodeworker hiding props now
|
||||
//return extendedAnimWorker.visibleAtTick(__instance.tree.AnimationTick);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations
|
||||
{
|
||||
public class PawnRenderNodeWorker_AnimationProp : PawnRenderNodeWorker
|
||||
{
|
||||
public override bool CanDrawNow(PawnRenderNode node, PawnDrawParms parms)
|
||||
{
|
||||
if (node.AnimationWorker is AnimationWorker_KeyframesExtended propAnimator)
|
||||
{
|
||||
return propAnimator.visibleAtTick(node.tree.AnimationTick);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
BIN
1.5/Textures/AnimationProps/Banana/Banana_east.png
Normal file
BIN
1.5/Textures/AnimationProps/Banana/Banana_east.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
1.5/Textures/AnimationProps/Banana/Banana_north.png
Normal file
BIN
1.5/Textures/AnimationProps/Banana/Banana_north.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
BIN
1.5/Textures/AnimationProps/Banana/Banana_south.png
Normal file
BIN
1.5/Textures/AnimationProps/Banana/Banana_south.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
1.5/Textures/AnimationProps/Banana/Banana_west.png
Normal file
BIN
1.5/Textures/AnimationProps/Banana/Banana_west.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
|
@ -72,6 +72,7 @@
|
|||
<Compile Include="1.5\Source\Actors\Actor.cs" />
|
||||
<Compile Include="1.5\Source\Actors\AlienRaceOffset.cs" />
|
||||
<Compile Include="1.5\Source\Actors\BodyTypeOffset.cs" />
|
||||
<Compile Include="1.5\Source\AnimationProps\AnimationPropDef.cs" />
|
||||
<Compile Include="1.5\Source\AnimationWorkers\AnimationWorker_KeyframesExtended.cs" />
|
||||
<Compile Include="1.5\Source\Comps\CompExtendedAnimator.cs" />
|
||||
<Compile Include="1.5\Source\Comps\CompProperties_ExtendedAnimator.cs" />
|
||||
|
@ -105,6 +106,7 @@
|
|||
<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\PawnRenderNodeWorker_AnimationProp.cs" />
|
||||
<Compile Include="1.5\Source\Settings\AnimationSettings.cs" />
|
||||
<Compile Include="1.5\Source\Utilities\AnimationUtility.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
@ -115,11 +117,11 @@
|
|||
<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\AnimationPropDefs\AnimationPropDef.xml" />
|
||||
<Content Include="1.5\Defs\GroupAnimationDefs\TestGroupAnimation1.xml" />
|
||||
<Content Include="1.5\Defs\MainTabDefs\MainButtonDef.xml" />
|
||||
<Content Include="1.5\Defs\OffsetDefs\OffsetDef_GroinToAppropriateHeight.xml" />
|
||||
<Content Include="1.5\Defs\SoundDefs\Sounds_Sex.xml" />
|
||||
<Content Include="1.5\Defs\XMLFile1.xml" />
|
||||
<Content Include="1.5\Patches\AnimationPatchHSK.xml" />
|
||||
<Content Include="1.5\Patches\AnimationPatch_CompExtendedAnimator.xml" />
|
||||
<Content Include="1.5\Patches\CompatibilityPatch_FacialAnimation.xml" />
|
||||
|
@ -156,6 +158,10 @@
|
|||
<Content Include="1.5\Sounds\Sex\Suck\Swallow_1.wav" />
|
||||
<Content Include="1.5\Sounds\Sex\Suck\Swallow_2.wav" />
|
||||
<Content Include="1.5\Sounds\Sex\Suck\Swallow_3.wav" />
|
||||
<Content Include="1.5\Textures\AnimationProps\Banana\Banana_east.png" />
|
||||
<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\UI\MainTab.png" />
|
||||
<Content Include="About\About.xml" />
|
||||
<Content Include="About\Manifest.xml" />
|
||||
|
|
Loading…
Reference in a new issue