mirror of
				https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
				synced 2024-08-15 00:43:45 +00:00 
			
		
		
		
	adding addons to pawn animations
This commit is contained in:
		
							parent
							
								
									41608bde79
								
							
						
					
					
						commit
						90db02367f
					
				
					 8 changed files with 142 additions and 7 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -39,7 +39,54 @@
 | 
				
			||||||
        <animationClips>
 | 
					        <animationClips>
 | 
				
			||||||
          <li Class="Rimworld_Animations.PawnAnimationClip">
 | 
					          <li Class="Rimworld_Animations.PawnAnimationClip">
 | 
				
			||||||
            <layer>LayingPawn</layer>
 | 
					            <layer>LayingPawn</layer>
 | 
				
			||||||
            <keyframes></keyframes>
 | 
					          </li>
 | 
				
			||||||
 | 
							   <li Class="Rimworld_Animations.PawnAnimationClip">
 | 
				
			||||||
 | 
							   
 | 
				
			||||||
 | 
							    <addons>
 | 
				
			||||||
 | 
								    <li>
 | 
				
			||||||
 | 
								        <name>hand</name>
 | 
				
			||||||
 | 
									    <path>path/to/texture</path>
 | 
				
			||||||
 | 
									</li>
 | 
				
			||||||
 | 
									<li>
 | 
				
			||||||
 | 
									    <name>tail</tail>
 | 
				
			||||||
 | 
									    <path>path/to/texture2</path>
 | 
				
			||||||
 | 
									</li>
 | 
				
			||||||
 | 
								</addons>
 | 
				
			||||||
 | 
							   
 | 
				
			||||||
 | 
					            <keyframes>
 | 
				
			||||||
 | 
					              <li>
 | 
				
			||||||
 | 
					                <headBob>0</headBob>
 | 
				
			||||||
 | 
					                <tickDuration>10</tickDuration>
 | 
				
			||||||
 | 
					                <bodyAngle>27</bodyAngle>
 | 
				
			||||||
 | 
					                <bodyOffsetX>0.298</bodyOffsetX>
 | 
				
			||||||
 | 
					                <bodyOffsetZ>0.166</bodyOffsetZ>
 | 
				
			||||||
 | 
					                <headAngle>0</headAngle>
 | 
				
			||||||
 | 
					                <bodyFacing>1</bodyFacing>
 | 
				
			||||||
 | 
					                <headFacing>2</headFacing>
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
									<addonKeyframes>
 | 
				
			||||||
 | 
										    <li> 
 | 
				
			||||||
 | 
											    <name>hand</name>
 | 
				
			||||||
 | 
											    <render>true</render>
 | 
				
			||||||
 | 
											    <posX>3.2</posX>
 | 
				
			||||||
 | 
												<posY>1<posY>
 | 
				
			||||||
 | 
												<rotation>30</rotation>
 | 
				
			||||||
 | 
												<scale>1.5</scale>
 | 
				
			||||||
 | 
											</li>
 | 
				
			||||||
 | 
											<li> 
 | 
				
			||||||
 | 
											    <name>tail</name>
 | 
				
			||||||
 | 
											    <render>true</render>
 | 
				
			||||||
 | 
											    <posX>3.2</posX>
 | 
				
			||||||
 | 
												<posY>1<posY>
 | 
				
			||||||
 | 
												<rotation>30</rotation>
 | 
				
			||||||
 | 
												<scale>1.5</scale>
 | 
				
			||||||
 | 
											</li>
 | 
				
			||||||
 | 
											...
 | 
				
			||||||
 | 
									</addonKeyframes>
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
					              </li>
 | 
				
			||||||
 | 
								  ...
 | 
				
			||||||
 | 
					            </keyframes>
 | 
				
			||||||
          </li>
 | 
					          </li>
 | 
				
			||||||
          <li Class="Rimworld_Animations.PawnAnimationClip">
 | 
					          <li Class="Rimworld_Animations.PawnAnimationClip">
 | 
				
			||||||
            <keyframes></keyframes>
 | 
					            <keyframes></keyframes>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,6 +10,10 @@ namespace Rimworld_Animations {
 | 
				
			||||||
    public class PawnAnimationClip : BaseAnimationClip {
 | 
					    public class PawnAnimationClip : BaseAnimationClip {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public List<PawnKeyframe> keyframes;
 | 
					        public List<PawnKeyframe> keyframes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public List<AddonInfo> addons = new List<AddonInfo>();
 | 
				
			||||||
 | 
					        public List<AddonKeyframe> addonKeyframes = new List<AddonKeyframe>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public AltitudeLayer layer = AltitudeLayer.Pawn;
 | 
					        public AltitudeLayer layer = AltitudeLayer.Pawn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public Dictionary<int, bool> quiver = new Dictionary<int, bool>();
 | 
					        public Dictionary<int, bool> quiver = new Dictionary<int, bool>();
 | 
				
			||||||
| 
						 | 
					@ -22,6 +26,13 @@ namespace Rimworld_Animations {
 | 
				
			||||||
        public SimpleCurve HeadFacing = new SimpleCurve();
 | 
					        public SimpleCurve HeadFacing = new SimpleCurve();
 | 
				
			||||||
        public SimpleCurve BodyFacing = new SimpleCurve();
 | 
					        public SimpleCurve BodyFacing = new SimpleCurve();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public Dictionary<string, SimpleCurve> addonsPosX = new Dictionary<string, SimpleCurve>();
 | 
				
			||||||
 | 
					        public Dictionary<string, SimpleCurve> addonsPosY = new Dictionary<string, SimpleCurve>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public Dictionary<string, SimpleCurve> addonsRotation = new Dictionary<string, SimpleCurve>();
 | 
				
			||||||
 | 
					        public Dictionary<string, SimpleCurve> addonsScale = new Dictionary<string, SimpleCurve>();
 | 
				
			||||||
 | 
					        public Dictionary<string, Dictionary<int, bool>> addonsShouldRender = new Dictionary<string, Dictionary<int, bool>>();
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override void buildSimpleCurves() {
 | 
					        public override void buildSimpleCurves() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,6 +43,16 @@ namespace Rimworld_Animations {
 | 
				
			||||||
                duration += frame.tickDuration;
 | 
					                duration += frame.tickDuration;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            foreach(AddonInfo addonInfo in addons)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                addonsPosX.Add(addonInfo.name, new SimpleCurve());
 | 
				
			||||||
 | 
					                addonsPosY.Add(addonInfo.name, new SimpleCurve());
 | 
				
			||||||
 | 
					                addonsScale.Add(addonInfo.name, new SimpleCurve());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                addonsRotation.Add(addonInfo.name, new SimpleCurve());
 | 
				
			||||||
 | 
					                addonsShouldRender.Add(addonInfo.name, new Dictionary<int, bool>());
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //guarantees loops don't get cut off mid-anim
 | 
					            //guarantees loops don't get cut off mid-anim
 | 
				
			||||||
            this.duration = duration;
 | 
					            this.duration = duration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,7 +88,6 @@ namespace Rimworld_Animations {
 | 
				
			||||||
                        SoundEffects.Add((int)frame.atTick, frame.soundEffect);
 | 
					                        SoundEffects.Add((int)frame.atTick, frame.soundEffect);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    
 | 
					                    
 | 
				
			||||||
                    
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else {
 | 
					                else {
 | 
				
			||||||
                    if (frame.bodyAngle.HasValue)
 | 
					                    if (frame.bodyAngle.HasValue)
 | 
				
			||||||
| 
						 | 
					@ -98,6 +118,39 @@ namespace Rimworld_Animations {
 | 
				
			||||||
                        SoundEffects.Add(keyframePosition, frame.soundEffect);
 | 
					                        SoundEffects.Add(keyframePosition, frame.soundEffect);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    foreach (AddonInfo addon in addons)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        if (frame.addonKeyframes.Exists(addonKeyframe => addonKeyframe.name == addon.name))
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            AddonKeyframe addonKeyframe = frame.addonKeyframes.Find(element => element.name == addon.name);
 | 
				
			||||||
 | 
					                            if (addonKeyframe.posX != null)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                addonsPosX[addon.name].Add((float)keyframePosition / (float)duration, addonKeyframe.posX.Value, true);
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            if (addonKeyframe.posY != null)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                addonsPosX[addon.name].Add((float)keyframePosition / (float)duration, addonKeyframe.posY.Value, true);
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            if (addonKeyframe.rotation != null)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                addonsPosX[addon.name].Add((float)keyframePosition / (float)duration, addonKeyframe.rotation.Value, true);
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            if (addonKeyframe.scale != null)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                addonsScale[addon.name].Add((float)keyframePosition / (float)duration, addonKeyframe.scale.Value, true);
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            if (addonKeyframe.render != null)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                addonsShouldRender[addon.name].Add(keyframePosition, addonKeyframe.render.Value);
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (frame.tickDuration != 1 && frame.quiver.HasValue) {
 | 
					                    if (frame.tickDuration != 1 && frame.quiver.HasValue) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        quiver.Add(keyframePosition, true);
 | 
					                        quiver.Add(keyframePosition, true);
 | 
				
			||||||
| 
						 | 
					@ -105,6 +158,8 @@ namespace Rimworld_Animations {
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    keyframePosition += frame.tickDuration;
 | 
					                    keyframePosition += frame.tickDuration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								1.3/Source/Animations/Keyframes/AddonInfo.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								1.3/Source/Animations/Keyframes/AddonInfo.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,14 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Rimworld_Animations
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class AddonInfo
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public string name;
 | 
				
			||||||
 | 
					        public string path;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										15
									
								
								1.3/Source/Animations/Keyframes/AddonKeyframe.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								1.3/Source/Animations/Keyframes/AddonKeyframe.cs
									
										
									
									
									
										Normal 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 AddonKeyframe
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public string name;
 | 
				
			||||||
 | 
					        public bool? render;
 | 
				
			||||||
 | 
					        public float? posX, posY, rotation, scale;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -24,5 +24,7 @@ namespace Rimworld_Animations {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public bool? quiver;
 | 
					        public bool? quiver;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public List<AddonKeyframe> addonKeyframes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,11 +46,11 @@
 | 
				
			||||||
      <Private>False</Private>
 | 
					      <Private>False</Private>
 | 
				
			||||||
    </Reference>
 | 
					    </Reference>
 | 
				
			||||||
    <Reference Include="RJW">
 | 
					    <Reference Include="RJW">
 | 
				
			||||||
      <HintPath>..\..\rjw-master\1.3\Assemblies\RJW.dll</HintPath>
 | 
					      <HintPath>..\..\rjw\1.3\Assemblies\RJW.dll</HintPath>
 | 
				
			||||||
      <Private>False</Private>
 | 
					      <Private>False</Private>
 | 
				
			||||||
    </Reference>
 | 
					    </Reference>
 | 
				
			||||||
    <Reference Include="RJW-ToysAndMasturbation">
 | 
					    <Reference Include="RJW-ToysAndMasturbation">
 | 
				
			||||||
      <HintPath>..\..\rjw-toys-and-masturbation-master\Assemblies\RJW-ToysAndMasturbation.dll</HintPath>
 | 
					      <HintPath>..\..\rjw-toys-and-masturbation\Assemblies\RJW-ToysAndMasturbation.dll</HintPath>
 | 
				
			||||||
      <Private>False</Private>
 | 
					      <Private>False</Private>
 | 
				
			||||||
    </Reference>
 | 
					    </Reference>
 | 
				
			||||||
    <Reference Include="System" />
 | 
					    <Reference Include="System" />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,11 +44,11 @@
 | 
				
			||||||
      <Private>False</Private>
 | 
					      <Private>False</Private>
 | 
				
			||||||
    </Reference>
 | 
					    </Reference>
 | 
				
			||||||
    <Reference Include="RJW">
 | 
					    <Reference Include="RJW">
 | 
				
			||||||
      <HintPath>..\rjw-master\1.3\Assemblies\RJW.dll</HintPath>
 | 
					      <HintPath>..\rjw\1.3\Assemblies\RJW.dll</HintPath>
 | 
				
			||||||
      <Private>False</Private>
 | 
					      <Private>False</Private>
 | 
				
			||||||
    </Reference>
 | 
					    </Reference>
 | 
				
			||||||
    <Reference Include="RJW-ToysAndMasturbation">
 | 
					    <Reference Include="RJW-ToysAndMasturbation">
 | 
				
			||||||
      <HintPath>..\rjw-toys-and-masturbation-master\Assemblies\RJW-ToysAndMasturbation.dll</HintPath>
 | 
					      <HintPath>..\rjw-toys-and-masturbation\Assemblies\RJW-ToysAndMasturbation.dll</HintPath>
 | 
				
			||||||
      <Private>False</Private>
 | 
					      <Private>False</Private>
 | 
				
			||||||
    </Reference>
 | 
					    </Reference>
 | 
				
			||||||
    <Reference Include="System" />
 | 
					    <Reference Include="System" />
 | 
				
			||||||
| 
						 | 
					@ -69,6 +69,8 @@
 | 
				
			||||||
    </Reference>
 | 
					    </Reference>
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
 | 
					    <Compile Include="1.3\Source\Animations\Keyframes\AddonInfo.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="1.3\Source\Animations\Keyframes\AddonKeyframe.cs" />
 | 
				
			||||||
    <Compile Include="1.3\Source\Extensions\PawnWoundDrawerExtension.cs" />
 | 
					    <Compile Include="1.3\Source\Extensions\PawnWoundDrawerExtension.cs" />
 | 
				
			||||||
    <Compile Include="1.3\Source\Patches\RimworldPatches\HarmonyPatch_Thing.cs" />
 | 
					    <Compile Include="1.3\Source\Patches\RimworldPatches\HarmonyPatch_Thing.cs" />
 | 
				
			||||||
    <Compile Include="1.3\Source\Utilities\PatchOperationAddOrReplace.cs" />
 | 
					    <Compile Include="1.3\Source\Utilities\PatchOperationAddOrReplace.cs" />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue