Merge branch 'AbsCon' into 'master'

Patch by AbstractConcept

See merge request c0ffeeeeeeee/rimworld-animations!6
This commit is contained in:
c0ffeeeeeeee 2022-09-07 19:36:51 +00:00
commit 69933350d7
14 changed files with 66 additions and 22 deletions

View File

@ -21,6 +21,6 @@ namespace Rimworld_Animations {
public BodyTypeOffset bodyTypeOffset = new BodyTypeOffset();
public Vector3 offset = new Vector2(0, 0);
public List<string> requiredGender;
public List<string> tags = new List<string>();
}
}

View File

@ -10,9 +10,10 @@ namespace Rimworld_Animations {
public string stageName;
public int stageIndex;
public int playTimeTicks = 0;
public int playTimeTicksQuick = -1;
public bool isLooping;
public List<BaseAnimationClip> animationClips;
public List<string> tags = new List<string>();
public void initialize() {
foreach (BaseAnimationClip clip in animationClips) {

View File

@ -15,6 +15,6 @@ namespace Rimworld_Animations {
public abstract void buildSimpleCurves();
public string soundDef = null; //for playing sounds
public int actor;
public List<string> tags = new List<string>();
}
}

View File

@ -10,5 +10,6 @@ namespace Rimworld_Animations {
public int tickDuration = 1;
public float? atTick;
public string soundEffect;
public List<string> tags = new List<string>();
}
}

View File

@ -52,6 +52,7 @@ namespace Rimworld_Animations {
public List<Pawn> actorsInCurrentAnimation;
public bool controlGenitalAngle = false;
public bool fastAnimForQuickie = false;
private AnimationDef anim;
private AnimationStage stage {
@ -155,7 +156,9 @@ namespace Rimworld_Animations {
this.actor = actor;
this.anim = anim;
this.mirror = mirror;
if(fastAnimForQuickie)
this.fastAnimForQuickie = fastAnimForQuickie;
if (fastAnimForQuickie && anim.animationStages.Any(x => x.playTimeTicksQuick >= 0) == false)
{
curStage = 1;
animTicks = anim.animationStages[0].playTimeTicks;
@ -259,7 +262,7 @@ namespace Rimworld_Animations {
stageTicks++;
if(stageTicks >= stage.playTimeTicks) {
if(stageTicks >= stage.playTimeTicks || (fastAnimForQuickie && stage.playTimeTicksQuick >= 0 && stageTicks >= stage.playTimeTicksQuick)) {
curStage++;

View File

@ -1,4 +1,4 @@
 using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -11,7 +11,6 @@ namespace Rimworld_Animations {
{
public CompProperties_BodyAnimator()
{
base.compClass = typeof(CompBodyAnimator);
}
}

View File

@ -15,6 +15,7 @@ namespace Rimworld_Animations {
public bool sounds = false;
public List<rjw.xxx.rjwSextype> sexTypes = null;
public List<String> interactionDefTypes = null;
public List<string> tags = new List<string>();
public override void PostLoad() {
base.PostLoad();

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using RimWorld;
using UnityEngine;
using Verse;
using Rimworld_Animations;
namespace Rimworld_Animations
{
[StaticConstructorOnStartup]
public static class PawnWoundDrawerExtension
{
public static void RenderOverBody(this PawnWoundDrawer pawnWoundDrawer, Vector3 drawLoc, Mesh bodyMesh, Quaternion quat, bool drawNow, BodyTypeDef.WoundLayer layer, Rot4 pawnRot, bool? overApparel = null, Pawn pawn = null, PawnRenderFlags flags = new PawnRenderFlags())
{
if (pawn == null)
{ return; }
if (!flags.FlagSet(PawnRenderFlags.Portrait) && layer == BodyTypeDef.WoundLayer.Head)
{
CompBodyAnimator pawnAnimator = pawn.TryGetComp<CompBodyAnimator>();
if (pawnAnimator != null && pawnAnimator.isAnimating && pawn.Drawer.renderer.graphics.headGraphic != null)
{
pawnRot = pawnAnimator.headFacing;
quat = Quaternion.AngleAxis(angle: pawnAnimator.headAngle, axis: Vector3.up);
float y = drawLoc.y;
drawLoc = pawnAnimator.getPawnHeadPosition() - Quaternion.AngleAxis(pawnAnimator.headAngle, Vector3.up) * pawn.Drawer.renderer.BaseHeadOffsetAt(pawnAnimator.headFacing);
drawLoc.y = y;
}
}
pawnWoundDrawer.RenderOverBody(drawLoc, bodyMesh, quat, drawNow, layer, pawnRot, overApparel);
}
}
}

View File

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HarmonyLib;
using RimWorld;
using Verse;
@ -66,18 +64,21 @@ namespace Rimworld_Animations {
//headFacing equals true
}
// Fixes the offsets for eye implants and wounds on the head during animations
else if (ins[i].opcode == OpCodes.Callvirt && ins[i].operand != null && ins[i].OperandIs(AccessTools.DeclaredMethod(typeof(PawnWoundDrawer), "RenderOverBody")))
{
// Pass some additional info to a new overload of RenderOverBody
yield return new CodeInstruction(OpCodes.Ldarg_0);
yield return new CodeInstruction(OpCodes.Ldfld, AccessTools.DeclaredField(typeof(PawnRenderer), "pawn"));
yield return new CodeInstruction(OpCodes.Ldarg_S, (object)6); // renderer flags
yield return new CodeInstruction(OpCodes.Call, AccessTools.DeclaredMethod(typeof(PawnWoundDrawerExtension), "RenderOverBody"));
}
else
{
yield return ins[i];
}
}
}
}
}
}

View File

@ -27,7 +27,6 @@ namespace Rimworld_Animations
{
if (i.OperandIs(AccessTools.Method(typeof(PawnUtility), "IsInvisible")))
{
yield return new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(PawnRenderer_RenderPawnAt_Patch), "ClearCache"));
}
else

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>Rimworld-Animations</identifier>
<version>1.2.7</version>
<version>1.2.8</version>
</Manifest>

View File

@ -46,11 +46,11 @@
<Private>False</Private>
</Reference>
<Reference Include="RJW">
<HintPath>..\..\rjw\1.3\Assemblies\RJW.dll</HintPath>
<HintPath>..\..\rjw-master\1.3\Assemblies\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RJW-ToysAndMasturbation">
<HintPath>..\..\rjw-toys-and-masturbation\Assemblies\RJW-ToysAndMasturbation.dll</HintPath>
<HintPath>..\..\rjw-toys-and-masturbation-master\Assemblies\RJW-ToysAndMasturbation.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />

View File

@ -44,7 +44,11 @@
<Private>False</Private>
</Reference>
<Reference Include="RJW">
<HintPath>..\rjw\1.3\Assemblies\RJW.dll</HintPath>
<HintPath>..\rjw-master\1.3\Assemblies\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RJW-ToysAndMasturbation">
<HintPath>..\rjw-toys-and-masturbation-master\Assemblies\RJW-ToysAndMasturbation.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
@ -65,6 +69,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="1.3\Source\Extensions\PawnWoundDrawerExtension.cs" />
<Compile Include="1.3\Source\Patches\RimworldPatches\HarmonyPatch_Thing.cs" />
<Compile Include="1.3\Source\Utilities\PatchOperationAddOrReplace.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />